repo_name
stringlengths
4
116
path
stringlengths
3
942
size
stringlengths
1
7
content
stringlengths
3
1.05M
license
stringclasses
15 values
sixuanwang/SAMSaaS
wirecloud-develop/src/wirecloud/platform/static/js/wirecloud/ui/WiringEditor/GenericInterface.js
67661
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER * * Copyright (c) 2012-2013 Universidad Politécnica de Madrid * Copyright (c) 2012-2013 the Center for Open Middleware * * Licensed under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /*global gettext, ngettext, interpolate, StyledElements, Wirecloud*/ (function () { "use strict"; /************************************************************************* * Private functions *************************************************************************/ var updateErrorInfo = function updateErrorInfo() { var label, errorCount = this.entity.logManager.getErrorCount(); this.log_button.setDisabled(errorCount === 0); label = ngettext("%(errorCount)s error", "%(errorCount)s errors", errorCount); label = interpolate(label, {errorCount: errorCount}, true); this.log_button.setTitle(label); }; /************************************************************************* * Constructor *************************************************************************/ /** * GenericInterface Class */ var GenericInterface = function GenericInterface(extending, wiringEditor, entity, title, manager, className, isGhost) { if (extending === true) { return; } var del_button, log_button, type, msg, ghostNotification; StyledElements.Container.call(this, {'class': className}, []); Object.defineProperty(this, 'entity', {value: entity}); this.editingPos = false; this.targetAnchorsByName = {}; this.sourceAnchorsByName = {}; this.targetAnchors = []; this.sourceAnchors = []; this.wiringEditor = wiringEditor; this.title = title; this.className = className; this.initPos = {'x': 0, 'y': 0}; this.draggableSources = []; this.draggableTargets = []; this.activatedTree = null; this.hollowConnections = {}; this.fullConnections = {}; this.subdataConnections = {}; this.isMinimized = false; this.minWidth = ''; this.movement = false; this.numberOfSources = 0; this.numberOfTargets = 0; this.potentialArrow = null; // Only for minimize maximize operators. this.initialPos = null; this.isGhost = isGhost; this.readOnlyEndpoints = 0; this.readOnly = false; if (manager instanceof Wirecloud.ui.WiringEditor.ArrowCreator) { this.isMiniInterface = false; this.arrowCreator = manager; } else { this.isMiniInterface = true; this.arrowCreator = null; } // Interface buttons, not for miniInterface if (!this.isMiniInterface) { if (className == 'iwidget') { type = 'widget'; this.version = this.entity.version; this.vendor = this.entity.vendor; this.name = this.entity.name; } else { type = 'operator'; this.version = this.entity.meta.version; this.vendor = this.entity.meta.vendor; this.name = this.entity.meta.name; } // header, sources and targets for the widget this.resourcesDiv = new StyledElements.BorderLayout({'class': "geContainer"}); this.sourceDiv = this.resourcesDiv.getEastContainer(); this.sourceDiv.addClassName("sources"); this.targetDiv = this.resourcesDiv.getWestContainer(); this.targetDiv.addClassName("targets"); this.header = this.resourcesDiv.getNorthContainer(); this.header.addClassName('header'); this.wrapperElement.appendChild(this.resourcesDiv.wrapperElement); // Ghost interface if (isGhost) { this.vendor = this.entity.name.split('/')[0]; this.name = this.entity.name.split('/')[1]; this.version = new Wirecloud.Version(this.entity.name.split('/')[2].trim()); this.wrapperElement.classList.add('ghost'); ghostNotification = document.createElement("span"); ghostNotification.classList.add('ghostNotification'); msg = gettext('Warning: %(type)s not found!'); msg = interpolate(msg, {type: type}, true); ghostNotification.textContent = msg; this.header.appendChild(ghostNotification); } // Version Status if (type == 'operator' && this.wiringEditor.operatorVersions[this.vendor + '/' + this.name] && this.wiringEditor.operatorVersions[this.vendor + '/' + this.name].lastVersion.compareTo(this.version) > 0) { // Old Entity Version this.versionStatus = document.createElement("span"); this.versionStatus.classList.add('status'); this.versionStatus.classList.add('icon-exclamation-sign'); this.versionStatus.setAttribute('title', 'Outdated Version (' + this.version.text + ')'); this.header.appendChild(this.versionStatus); this.wrapperElement.classList.add('old') } // Widget name this.nameElement = document.createElement("span"); this.nameElement.textContent = title; this.nameElement.title = title; this.header.appendChild(this.nameElement); // Close button del_button = new StyledElements.StyledButton({ 'title': gettext("Remove"), 'class': 'closebutton icon-remove', 'plain': true }); del_button.insertInto(this.header); del_button.addEventListener('click', function () { if (this.readOnly == true) { return; } if (className == 'iwidget') { this.wiringEditor.events.widgetremoved.dispatch(this); } else { this.wiringEditor.events.operatorremoved.dispatch(this); } }.bind(this)); // Log button this.log_button = new StyledElements.StyledButton({ 'plain': true, 'class': 'logbutton icon-warning-sign' }); if (!isGhost) { this.log_button.addEventListener("click", function () { var dialog = new Wirecloud.ui.LogWindowMenu(this.entity.logManager); dialog.show(); }.bind(this)); updateErrorInfo.call(this); this.entity.logManager.addEventListener('newentry', updateErrorInfo.bind(this)); } else { this.log_button.disable(); } this.log_button.insertInto(this.header); // special icon for minimized interface this.iconAux = document.createElement("div"); this.iconAux.classList.add("specialIcon"); this.iconAux.classList.add("icon-cogs"); this.iconAux.setAttribute('title', title); this.resourcesDiv.wrapperElement.appendChild(this.iconAux); this.iconAux.addEventListener('click', function () { if (!this.movement) { this.restore(); } }.bind(this)); // Add a menu button except on mini interfaces this.menu_button = new StyledElements.PopupButton({ 'title': gettext("Menu"), 'class': 'editPos_button icon-cog', 'plain': true }); this.menu_button.insertInto(this.header); this.menu_button.popup_menu.append(new Wirecloud.ui.WiringEditor.GenericInterfaceSettingsMenuItems(this)); } else { // MiniInterface this.header = document.createElement("div"); this.header.classList.add('header'); this.wrapperElement.appendChild(this.header); // MiniInterface name this.nameElement = document.createElement("span"); this.nameElement.textContent = title; this.header.appendChild(this.nameElement); // MiniInterface status this.miniStatus = document.createElement("span"); this.miniStatus.classList.add('status'); this.miniStatus.classList.add('icon-exclamation-sign'); this.miniStatus.setAttribute('title', gettext('Warning! this is an old version of the operator, click to change the version')); this._miniwidgetMenu_button_callback = function _miniwidgetMenu_button_callback(e) { // Context Menu e.stopPropagation(); if (this.contextmenu.isVisible()) { this.contextmenu.hide(); } else { this.contextmenu.show(this.wrapperElement.getBoundingClientRect()); } return; }.bind(this); this.miniStatus.addEventListener('mousedown', Wirecloud.Utils.stopPropagationListener, false); this.miniStatus.addEventListener('click', this._miniwidgetMenu_button_callback, false); this.miniStatus.addEventListener('contextmenu', this._miniwidgetMenu_button_callback, false); this.header.appendChild(this.miniStatus); // MiniInterface Context Menu if (className == 'ioperator') { this.contextmenu = new StyledElements.PopupMenu({'position': ['bottom-left', 'top-left']}); this._miniwidgetMenu_callback = function _miniwidgetMenu_callback(e) { // Context Menu e.stopPropagation(); if (e.button === 2) { if (this.contextmenu.isVisible()) { this.contextmenu.hide(); } else { this.contextmenu.show(this.wrapperElement.getBoundingClientRect()); } return; } }.bind(this); this.wrapperElement.addEventListener('mousedown', this._miniwidgetMenu_callback, false); this.contextmenu.append(new Wirecloud.ui.WiringEditor.MiniInterfaceSettingsMenuItems(this)); } this.wrapperElement.addEventListener('contextmenu', Wirecloud.Utils.preventDefaultListener); } // Draggable if (!this.isMiniInterface) { this.makeDraggable(); } else { //miniInterface this.draggable = new Wirecloud.ui.Draggable(this.wrapperElement, {iObject: this}, function onStart(draggable, context) { var miniwidget_clon, pos_miniwidget, headerHeight; headerHeight = context.iObject.wiringEditor.getBoundingClientRect().top; //initial position pos_miniwidget = context.iObject.getBoundingClientRect(); context.y = pos_miniwidget.top - (headerHeight); context.x = pos_miniwidget.left; //create a miniwidget clon if (context.iObject instanceof Wirecloud.ui.WiringEditor.WidgetInterface) { miniwidget_clon = new Wirecloud.ui.WiringEditor.WidgetInterface(context.iObject.wiringEditor, context.iObject.iwidget, context.iObject.wiringEditor, true); } else { miniwidget_clon = new Wirecloud.ui.WiringEditor.OperatorInterface(context.iObject.wiringEditor, context.iObject.ioperator, context.iObject.wiringEditor, true); } miniwidget_clon.addClassName('clon'); //set the clon position over the originar miniWidget miniwidget_clon.setBoundingClientRect(pos_miniwidget, {top: -headerHeight, left: 0, width: -2, height: -10}); // put the miniwidget clon in the layout context.iObject.wiringEditor.layout.wrapperElement.appendChild(miniwidget_clon.wrapperElement); //put the clon in the context.iObject context.iObjectClon = miniwidget_clon; }, function onDrag(e, draggable, context, xDelta, yDelta) { context.iObjectClon.setPosition({posX: context.x + xDelta, posY: context.y + yDelta}); context.iObjectClon.repaint(); }, this.onFinish.bind(this), function () { return this.enabled && !this.wrapperElement.classList.contains('clon'); }.bind(this) ); }//else miniInterface }; GenericInterface.prototype = new StyledElements.Container({'extending': true}); /************************************************************************* * Private methods *************************************************************************/ var getElementPos = function getElementPos(elemList, elem) { var i; for (i = 0; i < elemList.length; i++) { if (elem === elemList[i]) { return i; } } }; /** * @Private * is empty object? */ var isEmpty = function isEmpty(obj) { for(var key in obj) { return false; } return true; }; var createMulticonnector = function createMulticonnector(name, anchor) { var multiconnector; multiconnector = new Wirecloud.ui.WiringEditor.Multiconnector(this.wiringEditor.nextMulticonnectorId, this.getId(), name, this.wiringEditor.layout.getCenterContainer().wrapperElement, this.wiringEditor, anchor, null, null); this.wiringEditor.nextMulticonnectorId = parseInt(this.wiringEditor.nextMulticonnectorId, 10) + 1; this.wiringEditor.addMulticonnector(multiconnector); multiconnector.addMainArrow(); }; /** * OutputSubendpoint */ var OutputSubendpoint = function OutputSubendpoint(name, description, iwidget, type) { var nameList, subdata, i; this.iwidget = iwidget; this.name = name; this.subdata = description.subdata; this.variable = description; this.type = type; this.friendcode = description.friendcode; nameList = name.split('/'); subdata = JSON.parse(description.subdata); for (i = 1; i < nameList.length; i++) { if (nameList[0] == nameList[1]) { break; } subdata = subdata[nameList[i]]; this.friendcode = subdata.semanticType; subdata = subdata.subdata; } }; /** * Serialize OutputSubendpoint */ OutputSubendpoint.prototype.serialize = function serialize() { return { 'type': this.type, 'id': this.iwidget.id, 'endpoint': this.name }; }; /** * Set ActionLabel listeners in a endpoint */ var setlabelActionListeners = function setlabelActionListeners(labelActionLayer, checkbox) { // Emphasize listeners labelActionLayer.addEventListener('mouseover',function (thecheckbox) { this.wiringEditor.recommendations.emphasize(thecheckbox); }.bind(this, checkbox), false); labelActionLayer.addEventListener('mouseout',function (thecheckbox) { this.wiringEditor.recommendations.deemphasize(thecheckbox); }.bind(this, checkbox), false); checkbox.wrapperElement.addEventListener('mouseover',function (thecheckbox) { this.wiringEditor.recommendations.emphasize(thecheckbox); }.bind(this, checkbox), false); checkbox.wrapperElement.addEventListener('mouseout',function (thecheckbox) { this.wiringEditor.recommendations.deemphasize(thecheckbox); }.bind(this, checkbox), false); // Sticky effect labelActionLayer.addEventListener('mouseover', checkbox._mouseover_callback, false); labelActionLayer.addEventListener('mouseout', checkbox._mouseout_callback, false); // Connect anchor whith mouseup on the label labelActionLayer.addEventListener('mouseup', checkbox._mouseup_callback, false); }; /** * format Tree */ var formatTree = function(treeDiv, entityWidth) { var heightPerLeaf, branchList, i, j, nleafsAux, desp, checkbox, label, height, firstFrame, firstTree, width, diff, treeWidth, actionLayer, bounding, treeBounding, leafs, lastTop, subtrees; firstFrame = treeDiv.getElementsByClassName("labelsFrame")[0]; firstTree = treeDiv.getElementsByClassName("tree")[0]; diff = (firstTree.getBoundingClientRect().top - firstFrame.getBoundingClientRect().top); if (diff == -10) { return; } firstFrame.style.top = diff + 10 + 'px'; height = firstFrame.getBoundingClientRect().height + 10; width = firstFrame.getBoundingClientRect().width; firstTree.style.height = height + 10 + 'px'; treeWidth = treeDiv.getBoundingClientRect().width; if (treeWidth < entityWidth - 14) { treeDiv.style.width = entityWidth - 14 + 'px'; treeDiv.style.left = 7 + 'px'; } treeDiv.style.height = height + 'px'; // Vertical Alignment leafs = treeDiv.getElementsByClassName('leaf'); heightPerLeaf = height/leafs.length; branchList = treeDiv.getElementsByClassName("dataTree branch"); for (i = 0; i < branchList.length; i++) { // Set Label position nleafsAux = branchList[i].getElementsByClassName('leaf').length; desp = -(((nleafsAux / 2) * heightPerLeaf) - (heightPerLeaf / 2)); label = branchList[i].getElementsByClassName('labelTree')[branchList[i].getElementsByClassName('labelTree').length - 1]; // Set label and anchor position checkbox = branchList[i].getElementsByClassName('subAnchor')[branchList[i].getElementsByClassName('subAnchor').length - 1]; label.style.top = desp + 'px'; checkbox.style.top = desp + 'px'; // Set action layer bounding for the label treeBounding = branchList[i].getBoundingClientRect(); if (i == 0) { lastTop = treeBounding.top; } actionLayer = branchList[i].nextElementSibling; bounding = label.getBoundingClientRect(); actionLayer.style.height = bounding.height + 'px'; actionLayer.style.width = bounding.width + 'px'; actionLayer.style.left = (bounding.left - treeBounding.left) + 'px'; actionLayer.style.top = Math.abs(lastTop - bounding.top) + 'px'; lastTop = treeBounding.top + 1; // Set leaf action layers setLeafActionLayers(branchList[i].parentNode.children); // Set leaf action layers in only-leafs subtree if (branchList[i].getElementsByClassName("dataTree branch").length == 0) { subtrees = branchList[i].getElementsByClassName('subTree'); for (j = 0; j < subtrees.length; j++) { // All leafs subtree found setLeafActionLayers(subtrees[j].getElementsByClassName('labelsFrame')[0].children); } } } }; var setLeafActionLayers = function setLeafActionLayers (brothers) { var acumulatedTop, j, treeBounding, bounding, actionLayer; acumulatedTop = 5; for (j = 0; j < brothers.length; j += 2) { treeBounding = brothers[j].getBoundingClientRect(); if (brothers[j].hasClassName('dataTree leaf')) { bounding = brothers[j].getElementsByClassName('labelTree')[0].getBoundingClientRect(); actionLayer = brothers[j].nextElementSibling; actionLayer.style.height = bounding.height + 'px'; actionLayer.style.width = bounding.width + 'px'; actionLayer.style.left = (bounding.left - treeBounding.left) + 'px'; actionLayer.style.top = acumulatedTop + 'px'; } acumulatedTop += treeBounding.height; } }; /************************************************************************* * Public methods *************************************************************************/ /** * Making Interface Draggable. */ GenericInterface.prototype.makeDraggable = function makeDraggable() { this.draggable = new Wirecloud.ui.Draggable(this.wrapperElement, {iObject: this}, function onStart(draggable, context) { context.y = context.iObject.wrapperElement.style.top === "" ? 0 : parseInt(context.iObject.wrapperElement.style.top, 10); context.x = context.iObject.wrapperElement.style.left === "" ? 0 : parseInt(context.iObject.wrapperElement.style.left, 10); context.preselected = context.iObject.selected; context.iObject.select(true); context.iObject.wiringEditor.onStarDragSelected(); }, function onDrag(e, draggable, context, xDelta, yDelta) { context.iObject.setPosition({posX: context.x + xDelta, posY: context.y + yDelta}); context.iObject.repaint(); context.iObject.wiringEditor.onDragSelectedObjects(xDelta, yDelta); }, function onFinish(draggable, context) { context.iObject.wiringEditor.onFinishSelectedObjects(); var position = context.iObject.getStylePosition(); if (position.posX < 0) { position.posX = 8; } if (position.posY < 0) { position.posY = 8; } context.iObject.setPosition(position); context.iObject.repaint(); //pseudoClick if ((Math.abs(context.x - position.posX) < 2) && (Math.abs(context.y - position.posY) < 2)) { if (context.preselected) { context.iObject.unselect(true); } context.iObject.movement = false; } else { if (!context.preselected) { context.iObject.unselect(true); } context.iObject.movement = true; } }, function () {return true; } ); }; /** * Make draggable all sources and targets for sorting */ GenericInterface.prototype.makeSlotsDraggable = function makeSlotsDraggable() { var i; for (i = 0; i < this.draggableSources.length; i++) { this.makeSlotDraggable(this.draggableSources[i], this.wiringEditor.layout.center, 'source_clon'); } for (i = 0; i < this.draggableTargets.length; i++) { this.makeSlotDraggable(this.draggableTargets[i], this.wiringEditor.layout.center, 'target_clon'); } }; /** * Make draggable a specific sources or targets for sorting */ GenericInterface.prototype.makeSlotDraggable = function makeSlotDraggable(element, place, className) { element.draggable = new Wirecloud.ui.Draggable(element.wrapperElement, {iObject: element, genInterface: this, wiringEditor: this.wiringEditor}, function onStart(draggable, context) { var clon, pos_miniwidget, gridbounds, childsN, childPos; //initial position pos_miniwidget = context.iObject.wrapperElement.getBoundingClientRect(); gridbounds = context.wiringEditor.getGridElement().getBoundingClientRect(); context.y = pos_miniwidget.top - gridbounds.top; context.x = pos_miniwidget.left - gridbounds.left; //create clon context.iObject.wrapperElement.classList.add('moving'); clon = context.iObject.wrapperElement.cloneNode(true); clon.classList.add(className); // put the clon in place place.wrapperElement.appendChild(clon); //set the clon position over the originar miniWidget clon.style.height = (pos_miniwidget.height) + 'px'; clon.style.left = (context.x) + 'px'; clon.style.top = (context.y) + 'px'; clon.style.width = (pos_miniwidget.width) + 'px'; //put the clon in the context.iObjectClon context.iObjectClon = clon; //put the reference height for change position context.refHeigth = context.iObject.wrapperElement.getBoundingClientRect().height + 2; context.refHeigthUp = context.refHeigth; context.refHeigthDown = context.refHeigth; childsN = context.iObject.wrapperElement.parentNode.childElementCount; childPos = getElementPos(context.iObject.wrapperElement.parentNode.children, context.iObject.wrapperElement); context.maxUps = childPos; context.maxDowns = childsN - (childPos + 1); }, function onDrag(e, draggable, context, xDelta, yDelta) { var top; context.iObjectClon.style.left = (context.x + xDelta) + 'px'; context.iObjectClon.style.top = (context.y + yDelta) + 'px'; top = parseInt(context.iObjectClon.style.top, 10); if (((context.y - top) > context.refHeigthUp) && (context.maxUps > 0)) { context.maxDowns += 1; context.maxUps -= 1; context.refHeigthUp += context.refHeigth; context.refHeigthDown -= context.refHeigth; context.genInterface.up(context.iObject); } else if (((top - context.y) > context.refHeigthDown) && (context.maxDowns > 0)) { context.maxUps += 1; context.maxDowns -= 1; context.refHeigthDown += context.refHeigth; context.refHeigthUp -= context.refHeigth; context.genInterface.down(context.iObject); } }, function onFinish(draggable, context) { context.iObject.wrapperElement.classList.remove('moving'); if (context.iObjectClon.parentNode) { context.iObjectClon.parentNode.removeChild(context.iObjectClon); } context.iObjectClon = null; }, function () {return true; } ); }; /** * Get the GenericInterface position. */ GenericInterface.prototype.getPosition = function getPosition() { var coordinates = {posX: this.wrapperElement.offsetLeft, posY: this.wrapperElement.offsetTop}; return coordinates; }; /** * Get the GenericInterface style position. */ GenericInterface.prototype.getStylePosition = function getStylePosition() { var coordinates; coordinates = {posX: parseInt(this.wrapperElement.style.left, 10), posY: parseInt(this.wrapperElement.style.top, 10)}; return coordinates; }; /** * Gets an anchor given a name */ GenericInterface.prototype.getAnchor = function getAnchor(name) { if (name in this.sourceAnchorsByName) { return this.sourceAnchorsByName[name]; } else if (name in this.targetAnchorsByName) { return this.targetAnchorsByName[name]; } else { return null; } }; /** * Add Ghost Endpoint */ GenericInterface.prototype.addGhostEndpoint = function addGhostEndpoint(theEndpoint, isSource) { var context; if (isSource) { context = {'data': new Wirecloud.wiring.GhostSourceEndpoint(theEndpoint, this.entity), 'iObject': this}; this.addSource(theEndpoint.endpoint, '', theEndpoint.endpoint, context, true); return this.sourceAnchorsByName[theEndpoint.endpoint]; } else { context = {'data': new Wirecloud.wiring.GhostTargetEndpoint(theEndpoint, this.entity), 'iObject': this}; this.addTarget(theEndpoint.endpoint, '', theEndpoint.endpoint, context, true); return this.targetAnchorsByName[theEndpoint.endpoint]; } }; /** * Set the GenericInterface position. */ GenericInterface.prototype.setPosition = function setPosition(coordinates) { this.wrapperElement.style.left = coordinates.posX + 'px'; this.wrapperElement.style.top = coordinates.posY + 'px'; }; /** * Set the BoundingClientRect parameters */ GenericInterface.prototype.setBoundingClientRect = function setBoundingClientRect(BoundingClientRect, move) { this.wrapperElement.style.height = (BoundingClientRect.height + move.height) + 'px'; this.wrapperElement.style.left = (BoundingClientRect.left + move.left) + 'px'; this.wrapperElement.style.top = (BoundingClientRect.top + move.top) + 'px'; this.wrapperElement.style.width = (BoundingClientRect.width + move.width) + 'px'; }; /** * Set the initial position in the menubar, miniobjects. */ GenericInterface.prototype.setMenubarPosition = function setMenubarPosition(menubarPosition) { this.menubarPosition = menubarPosition; }; /** * Set the initial position in the menubar, miniobjects. */ GenericInterface.prototype.getMenubarPosition = function getMenubarPosition() { return this.menubarPosition; }; /** * Increasing the number of read only connections */ GenericInterface.prototype.incReadOnlyConnectionsCount = function incReadOnlyConnectionsCount() { this.readOnlyEndpoints += 1; this.readOnly = true; }; /** * Reduce the number of read only connections */ GenericInterface.prototype.reduceReadOnlyConnectionsCount = function reduceReadOnlyConnectionsCount() { this.readOnlyEndpoints -= 1; if (this.readOnlyEndpoints == 0) { this.readOnly = false; } }; /** * Generic repaint */ GenericInterface.prototype.repaint = function repaint(temporal) { var key; StyledElements.Container.prototype.repaint.apply(this, arguments); for (key in this.sourceAnchorsByName) { this.sourceAnchorsByName[key].repaint(temporal); } for (key in this.targetAnchorsByName) { this.targetAnchorsByName[key].repaint(temporal); } }; /** * Generate SubTree */ GenericInterface.prototype.generateSubTree = function generateSubTree(anchorContext, subAnchors) { var treeFrame, key, lab, checkbox, subdata, subTree, labelsFrame, context, name, labelActionLayer, entity, type; treeFrame = document.createElement("div"); treeFrame.classList.add('subTree'); labelsFrame = document.createElement("div"); labelsFrame.classList.add('labelsFrame'); treeFrame.appendChild(labelsFrame); if (!isEmpty(subAnchors.subdata)) { for (key in subAnchors.subdata) { lab = document.createElement("span"); lab.classList.add("labelTree"); lab.textContent = subAnchors.subdata[key].label; name = anchorContext.data.name + "/" + key; if (anchorContext.data.iwidget != null) { entity = anchorContext.data.iwidget; type = 'iwidget'; } else { entity = anchorContext.data.operator; type = 'ioperator'; } context = {'data': new OutputSubendpoint(name, anchorContext.data, entity, type), 'iObject': this}; checkbox = new Wirecloud.ui.WiringEditor.SourceAnchor(context, anchorContext.iObject.arrowCreator, subAnchors.subdata[key]); checkbox.wrapperElement.classList.add("subAnchor"); checkbox.wrapperElement.classList.add("icon-circle"); this.sourceAnchorsByName[name] = checkbox; this.sourceAnchors.push(checkbox); subdata = document.createElement("div"); subdata.classList.add("dataTree"); labelActionLayer = document.createElement("div"); labelActionLayer.classList.add("labelActionLayer"); setlabelActionListeners.call(this, labelActionLayer, checkbox); subTree = this.generateSubTree(context, subAnchors.subdata[key], checkbox); if (subTree !== null) { subdata.appendChild(subTree); subdata.classList.add("branch"); } else{ subdata.classList.add("leaf"); } subdata.appendChild(lab); subdata.appendChild(checkbox.wrapperElement); labelsFrame.appendChild(subdata); labelsFrame.appendChild(labelActionLayer); } return treeFrame; } else { return null; } }; /** * Generate Tree */ GenericInterface.prototype.generateTree = function generateTree(anchor, name, anchorContext, subtree, label, closeHandler) { var subAnchors, treeFrame, lab, checkbox, subdata, key, subTree, subTreeFrame, type, labelsFrame, labelMain, close_button, context, name, labelActionLayer, entity, treeDiv; // Generate tree treeDiv = document.createElement("div"); treeDiv.classList.add('anchorTree'); treeDiv.addEventListener('click', function (e) { e.stopPropagation(); }.bind(this), false); treeDiv.addEventListener('mousedown', function (e) { e.stopPropagation(); }.bind(this), false); treeFrame = document.createElement("div"); treeFrame.classList.add('tree'); treeFrame.classList.add('sources'); // Close button close_button = new StyledElements.StyledButton({ 'title': gettext("Hide"), 'class': 'hideTreeButton icon-off', 'plain': true }); close_button.insertInto(treeFrame); close_button.addEventListener('click', function () {closeHandler();}, false); subAnchors = JSON.parse(subtree); subTreeFrame = null; labelsFrame = document.createElement("div"); labelsFrame.classList.add('labelsFrame'); if (subAnchors !== null) { subTreeFrame = document.createElement("div"); subTreeFrame.classList.add('subTree'); for (key in subAnchors) { lab = document.createElement("span"); lab.classList.add("labelTree"); lab.textContent = subAnchors[key].label; name = anchorContext.data.name + "/" + key; if (anchorContext.data.iwidget != null) { entity = anchorContext.data.iwidget; type = 'iwidget'; } else { entity = anchorContext.data.operator; type = 'ioperator'; } context = {'data': new OutputSubendpoint(name, anchorContext.data, entity, type), 'iObject': this}; checkbox = new Wirecloud.ui.WiringEditor.SourceAnchor(context, anchorContext.iObject.arrowCreator, subAnchors[key]); checkbox.wrapperElement.classList.add("subAnchor"); checkbox.wrapperElement.classList.add("icon-circle"); this.sourceAnchorsByName[name] = checkbox; this.sourceAnchors.push(checkbox); subdata = document.createElement("div"); subdata.classList.add("dataTree"); labelActionLayer = document.createElement("div"); labelActionLayer.classList.add("labelActionLayer"); setlabelActionListeners.call(this, labelActionLayer, checkbox); subTree = this.generateSubTree(context, subAnchors[key], checkbox); if (subTree !== null) { subdata.appendChild(subTree); subdata.classList.add("branch"); } else{ subdata.classList.add("leaf"); } subdata.appendChild(lab); subdata.appendChild(checkbox.wrapperElement); labelsFrame.appendChild(subdata); labelsFrame.appendChild(labelActionLayer); subTreeFrame.appendChild(labelsFrame); } } lab = document.createElement("span"); lab.classList.add("labelTree"); lab.textContent = label; name = anchorContext.data.name + "/" + anchorContext.data.name; if (anchorContext.data.iwidget != null) { entity = anchorContext.data.iwidget; type = 'iwidget'; } else { entity = anchorContext.data.operator; type = 'ioperator'; } context = {'data': new OutputSubendpoint(name, anchorContext.data, entity, type), 'iObject': this}; checkbox = new Wirecloud.ui.WiringEditor.SourceAnchor(context, anchorContext.iObject.arrowCreator, subAnchors); checkbox.wrapperElement.classList.add("subAnchor"); checkbox.wrapperElement.classList.add("icon-circle"); this.sourceAnchorsByName[name] = checkbox; this.sourceAnchors.push(checkbox); subdata = document.createElement("div"); subdata.classList.add("dataTree"); labelActionLayer = document.createElement("div"); labelActionLayer.classList.add("labelActionLayer"); setlabelActionListeners.call(this, labelActionLayer, checkbox); if (subTreeFrame !== null) { subdata.appendChild(subTreeFrame); subdata.classList.add("branch"); } else { subdata.classList.add("leaf"); } subdata.appendChild(lab); subdata.appendChild(checkbox.wrapperElement); labelMain = document.createElement("div"); labelMain.classList.add('labelsFrame'); labelMain.appendChild(subdata); labelMain.appendChild(labelActionLayer); treeFrame.appendChild(labelMain); treeDiv.appendChild(treeFrame); this.wrapperElement.appendChild(treeDiv); // Handler for subdata tree menu anchor.menu.append(new StyledElements.MenuItem(gettext("Unfold data structure"), this.subdataHandler.bind(this, treeDiv, name))); }; /** * handler for show/hide anchorTrees */ GenericInterface.prototype.subdataHandler = function subdataHandler(treeDiv, name) { var initialHeiht, initialWidth, key, i, externalRep, layer, subDataArrow, firstIndex, mainEndpoint, mainSubEndPoint, theArrow, mainEndpointArrows; if (treeDiv == null) { // Descend canvas this.wiringEditor.canvas.canvasElement.classList.remove("elevated"); // Hide tree this.activatedTree.classList.remove('activated'); this.activatedTree = null; // Deactivate subdataMode this.wrapperElement.classList.remove('subdataMode'); // Hide subdata connections, and show hollow and full connections if (!isEmpty(this.subdataConnections[name])) { for (key in this.subdataConnections[name]) { firstIndex = this.subdataConnections[name][key].length - 1; for (i = firstIndex; i >= 0 ; i -= 1) { externalRep = this.subdataConnections[name][key][i].externalRep; subDataArrow = this.subdataConnections[name][key][i].subDataArrow; externalRep.show(); if (externalRep.hasClassName('hollow')) { subDataArrow.hide(); } else { // Remove all subconnections that represent full connections subDataArrow.destroy(); this.subdataConnections[name][key].splice(i, 1); this.fullConnections[name][key].splice(this.fullConnections[name][key].indexOf(externalRep), 1); } } } } } else { // Elevate canvas this.wiringEditor.canvas.canvasElement.classList.add("elevated"); // Show tree initialWidth = this.wrapperElement.getBoundingClientRect().width; treeDiv.classList.add('activated'); this.activatedTree = treeDiv; formatTree(treeDiv, initialWidth); // Activate subdataMode this.wrapperElement.classList.add('subdataMode'); // Add a subconnection for each main connexion in the main endpoint layer = this.wiringEditor.arrowCreator.layer; mainEndpoint = this.sourceAnchorsByName[name]; mainSubEndPoint = this.sourceAnchorsByName[name + "/" + name]; mainEndpointArrows = mainEndpoint.getArrows(); for (i = 0; i < mainEndpointArrows.length ; i += 1) { if (!mainEndpointArrows[i].hasClassName('hollow')) { // New full subConnection theArrow = this.wiringEditor.canvas.drawArrow(mainSubEndPoint.getCoordinates(layer), mainEndpointArrows[i].endAnchor.getCoordinates(layer), "arrow subdataConnection full"); theArrow.setEndAnchor(mainEndpointArrows[i].endAnchor); theArrow.setStartAnchor(mainSubEndPoint); mainSubEndPoint.addArrow(theArrow); mainEndpointArrows[i].endAnchor.addArrow(theArrow); // Add this connections to subdataConnections if (this.subdataConnections[name] == null) { this.subdataConnections[name] = {}; } if (this.subdataConnections[name][name + "/" + name] == null) { this.subdataConnections[name][name + "/" + name] = []; } this.subdataConnections[name][name + "/" + name].push({'subDataArrow' : theArrow, 'externalRep': mainEndpointArrows[i]}); // Add this connections to fullConnections if (this.fullConnections[name] == null) { this.fullConnections[name] = {}; } if (this.fullConnections[name][name + "/" + name] == null) { this.fullConnections[name][name + "/" + name] = []; } this.fullConnections[name][name + "/" + name].push(mainEndpointArrows[i]); } } // Show subdata connections, and hide hollow connections for (key in this.subdataConnections[name]) { for (i = 0; i < this.subdataConnections[name][key].length ; i += 1) { this.subdataConnections[name][key][i].externalRep.hide(); this.subdataConnections[name][key][i].subDataArrow.show(); } } } this.repaint(); this.wiringEditor.activatedTree = this.activatedTree; }; /** * Add subdata connection. */ GenericInterface.prototype.addSubdataConnection = function addSubdataConnection(endpoint, subdatakey, connection, sourceAnchor, targetAnchor, isLoadingWiring) { var theArrow, mainEndpoint, layer; if (this.subdataConnections[endpoint] == null) { this.subdataConnections[endpoint] = {}; } if (this.subdataConnections[endpoint][subdatakey] == null) { this.subdataConnections[endpoint][subdatakey] = []; } layer = this.wiringEditor.arrowCreator.layer; mainEndpoint = this.sourceAnchorsByName[endpoint]; if ((endpoint + "/" + endpoint) == subdatakey) { // Add full connection if (this.fullConnections[endpoint] == null) { this.fullConnections[endpoint] = {}; } if (this.fullConnections[endpoint][subdatakey] == null) { this.fullConnections[endpoint][subdatakey] = []; } connection.addClassName('full'); theArrow = this.wiringEditor.canvas.drawArrow(mainEndpoint.getCoordinates(layer), targetAnchor.getCoordinates(layer), "arrow"); this.fullConnections[endpoint][subdatakey].push(theArrow); } else { // Add a hollow connection if (this.hollowConnections[endpoint] == null) { this.hollowConnections[endpoint] = {}; } if (this.hollowConnections[endpoint][subdatakey] == null) { this.hollowConnections[endpoint][subdatakey] = []; } theArrow = this.wiringEditor.canvas.drawArrow(mainEndpoint.getCoordinates(layer), targetAnchor.getCoordinates(layer), "arrow hollow"); this.hollowConnections[endpoint][subdatakey].push(theArrow); } theArrow.setEndAnchor(targetAnchor); theArrow.setStartAnchor(mainEndpoint); mainEndpoint.addArrow(theArrow); targetAnchor.addArrow(theArrow); if (isLoadingWiring) { connection.hide(); } else { theArrow.hide(); } this.subdataConnections[endpoint][subdatakey].push({'subDataArrow' : connection, 'externalRep': theArrow}); }; /** * Remove subdata connection. */ GenericInterface.prototype.removeSubdataConnection = function removeSubdataConnection(endpoint, subdatakey, connection) { var i, externalRep; if ((endpoint + "/" + endpoint) == subdatakey) { // Remove full connection if (this.fullConnections[endpoint] != null && this.fullConnections[endpoint][subdatakey] != null) { for (i = 0; i < this.subdataConnections[endpoint][subdatakey].length ; i += 1) { if (this.subdataConnections[endpoint][subdatakey][i].subDataArrow == connection) { externalRep = this.subdataConnections[endpoint][subdatakey][i].externalRep; this.fullConnections[endpoint][subdatakey].splice(this.fullConnections[endpoint][subdatakey].indexOf(externalRep), 1); externalRep.destroy(); connection.destroy(); this.subdataConnections[endpoint][subdatakey].splice(i, 1); break; } } } else { // Error } } else { // Remove a hollow connection if (this.hollowConnections[endpoint] != null && this.hollowConnections[endpoint][subdatakey] != null) { for (i = 0; i < this.subdataConnections[endpoint][subdatakey].length ; i += 1) { if (this.subdataConnections[endpoint][subdatakey][i].subDataArrow == connection) { externalRep = this.subdataConnections[endpoint][subdatakey][i].externalRep; this.hollowConnections[endpoint][subdatakey].splice(this.hollowConnections[endpoint][subdatakey].indexOf(externalRep), 1); externalRep.destroy(); connection.destroy(); this.subdataConnections[endpoint][subdatakey].splice(i, 1); break; } } } else { // Error } } }; /** * Add Source. */ GenericInterface.prototype.addSource = function addSource(label, desc, name, anchorContext, isGhost) { var anchor, anchorDiv, labelDiv, anchorLabel, treeDiv, subAnchors; // Sources counter this.numberOfSources += 1; // AnchorDiv anchorDiv = document.createElement("div"); // If the output have not description, take the label if (desc === '') { desc = label; } if (isGhost) { anchorDiv.setAttribute('title', gettext("Mismatch endpoint! ") + label); } else { anchorDiv.setAttribute('title', label + ': ' + desc); } anchorDiv.classList.add('anchorDiv'); if (isGhost) { anchorDiv.classList.add('ghost'); } // Anchor visible label anchorLabel = document.createElement("span"); anchorLabel.textContent = label; labelDiv = document.createElement("div"); anchorDiv.appendChild(labelDiv); labelDiv.setAttribute('class', 'labelDiv'); labelDiv.appendChild(anchorLabel); if (!this.isMiniInterface) { anchor = new Wirecloud.ui.WiringEditor.SourceAnchor(anchorContext, this.arrowCreator, null, isGhost); labelDiv.appendChild(anchor.wrapperElement); anchor.menu.append(new StyledElements.MenuItem(gettext('Add multiconnector'), createMulticonnector.bind(this, name, anchor))); subAnchors = anchorContext.data.subdata; if (subAnchors != null) { // Generate the tree this.generateTree(anchor, name, anchorContext, subAnchors, label, this.subdataHandler.bind(this, null, name)); } labelDiv.addEventListener('mouseover', function () { this.wiringEditor.recommendations.emphasize(anchor); }.bind(this)); labelDiv.addEventListener('mouseout', function () { this.wiringEditor.recommendations.deemphasize(anchor); }.bind(this)); // Sticky effect anchorDiv.addEventListener('mouseover', function (e) { anchor._mouseover_callback(e); }.bind(this)); anchorDiv.addEventListener('mouseout', function (e) { anchor._mouseout_callback(e); }.bind(this)); // Connect anchor whith mouseup on the label anchorDiv.addEventListener('mouseup', function (e) { anchor._mouseup_callback(e); }.bind(this)); this.sourceAnchorsByName[name] = anchor; this.sourceAnchors.push(anchor); } this.sourceDiv.appendChild(anchorDiv); this.draggableSources.push({'wrapperElement': anchorDiv, 'context': anchorContext}); }; /** * Add Target. */ GenericInterface.prototype.addTarget = function addTarget(label, desc, name, anchorContext, isGhost) { var anchor, anchorDiv, labelDiv, anchorLabel; // Targets counter this.numberOfTargets += 1; // AnchorDiv anchorDiv = document.createElement("div"); // If the output have not description, take the label if (desc === '') { desc = label; } if (isGhost) { anchorDiv.setAttribute('title', gettext('Mismatch endpoint! ') + label); } else { anchorDiv.setAttribute('title', label + ': ' + desc); } anchorDiv.classList.add('anchorDiv'); if (isGhost) { anchorDiv.classList.add('ghost'); } // Anchor visible label anchorLabel = document.createElement("span"); anchorLabel.textContent = label; labelDiv = document.createElement("div"); anchorDiv.appendChild(labelDiv); labelDiv.setAttribute('class', 'labelDiv'); labelDiv.appendChild(anchorLabel); if (!this.isMiniInterface) { anchor = new Wirecloud.ui.WiringEditor.TargetAnchor(anchorContext, this.arrowCreator, isGhost); labelDiv.appendChild(anchor.wrapperElement); anchor.menu.append(new StyledElements.MenuItem(gettext('Add multiconnector'), createMulticonnector.bind(this, name, anchor))); labelDiv.addEventListener('mouseover', function () { if (!this.wiringEditor.recommendationsActivated) { this.wiringEditor.recommendations.emphasize(anchor); } }.bind(this)); labelDiv.addEventListener('mouseout', function () { if (!this.wiringEditor.recommendationsActivated) { this.wiringEditor.recommendations.deemphasize(anchor); } }.bind(this)); // Sticky effect anchorDiv.addEventListener('mouseover', function (e) { anchor._mouseover_callback(e); }.bind(this)); anchorDiv.addEventListener('mouseout', function (e) { anchor._mouseout_callback(e); }.bind(this)); // Connect anchor whith mouseup on the label anchorDiv.addEventListener('mouseup', function (e) { anchor._mouseup_callback(e); }.bind(this)); this.targetAnchorsByName[name] = anchor; this.targetAnchors.push(anchor); } this.targetDiv.appendChild(anchorDiv); this.draggableTargets.push({'wrapperElement': anchorDiv, 'context': anchorContext}); }; /** * Add new class in to the genericInterface */ GenericInterface.prototype.addClassName = function addClassName(className) { var atr; if (className == null) { return; } atr = this.wrapperElement.getAttribute('class'); if (atr == null) { atr = ''; } this.wrapperElement.setAttribute('class', Wirecloud.Utils.appendWord(atr, className)); }; /** * Remove a genericInterface Class name */ GenericInterface.prototype.removeClassName = function removeClassName(className) { var atr; if (className == null) { return; } atr = this.wrapperElement.getAttribute('class'); if (atr == null) { atr = ''; } this.wrapperElement.setAttribute('class', Wirecloud.Utils.removeWord(atr, className)); }; /** * Select this genericInterface */ GenericInterface.prototype.select = function select(withCtrl) { var i, j, arrows; if (this.hasClassName('disabled')) { return; } if (this.hasClassName('selected')) { return; } if (!(this.wiringEditor.ctrlPushed) && (this.wiringEditor.selectedCount > 0) && (withCtrl)) { this.wiringEditor.resetSelection(); } this.selected = true; this.addClassName('selected'); // Arrows for (i = 0; i < this.targetAnchors.length; i += 1) { arrows = this.targetAnchors[i].arrows; for (j = 0; j < arrows.length; j += 1) { arrows[j].emphasize(); } } for (i = 0; i < this.sourceAnchors.length; i += 1) { arrows = this.sourceAnchors[i].arrows; for (j = 0; j < arrows.length; j += 1) { arrows[j].emphasize(); } } this.wiringEditor.addSelectedObject(this); }; /** * Unselect this genericInterface */ GenericInterface.prototype.unselect = function unselect(withCtrl) { var i, j, arrows; this.selected = false; this.removeClassName('selected'); //arrows for (i = 0; i < this.targetAnchors.length; i += 1) { arrows = this.targetAnchors[i].arrows; for (j = 0; j < arrows.length; j += 1) { arrows[j].deemphasize(); } } for (i = 0; i < this.sourceAnchors.length; i += 1) { arrows = this.sourceAnchors[i].arrows; for (j = 0; j < arrows.length; j += 1) { arrows[j].deemphasize(); } } this.wiringEditor.removeSelectedObject(this); if (!(this.wiringEditor.ctrlPushed) && (this.wiringEditor.selectedCount > 0) && (withCtrl)) { this.wiringEditor.resetSelection(); } }; /** * Destroy */ GenericInterface.prototype.destroy = function destroy() { var i, j, arrows; this.unselect(); if (this.editingPos === true) { this.disableEdit(); } StyledElements.Container.prototype.destroy.call(this); for (i = 0; i < this.sourceAnchors.length; i += 1) { arrows = this.sourceAnchors[i].arrows.slice(0); for (j = 0; j < arrows.length; j += 1) { if (!arrows[j].controlledDestruction()) { arrows[j].destroy(); } } this.sourceAnchors[i].destroy(); } for (i = 0; i < this.targetAnchors.length; i += 1) { arrows = this.targetAnchors[i].arrows.slice(0); for (j = 0; j < arrows.length; j += 1) { if (!arrows[j].controlledDestruction()) { arrows[j].destroy(); } } this.targetAnchors[i].destroy(); } this.draggable.destroy(); this.draggable = null; this.draggableSources = null; this.draggableTargets = null; this.wrapperElement = null; this.hollowConnections = null; this.subdataConnections = null; }; /** * Edit source and targets positions */ GenericInterface.prototype.editPos = function editPos() { var obj; obj = null; if ((this.targetAnchors.length <= 1) && (this.sourceAnchors.length <= 1)) { return; } if (this.editingPos === true) { this.disableEdit(); } else { this.enableEdit(); obj = this; } this.repaint(); return obj; }; /** * Enable poditions editor */ GenericInterface.prototype.enableEdit = function enableEdit() { this.draggable.destroy(); this.editingPos = true; this.sourceDiv.wrapperElement.classList.add("editing"); this.targetDiv.wrapperElement.classList.add("editing"); this.addClassName("editing"); this.makeSlotsDraggable(); }; /** * Disable poditions editor */ GenericInterface.prototype.disableEdit = function disableEdit() { var i; this.makeDraggable(); this.editingPos = false; this.sourceDiv.wrapperElement.classList.remove("editing"); this.targetDiv.wrapperElement.classList.remove("editing"); this.removeClassName("editing"); for (i = 0; i < this.draggableSources.length; i++) { this.draggableSources[i].draggable.destroy(); } for (i = 0; i < this.draggableTargets.length; i++) { this.draggableTargets[i].draggable.destroy(); } }; /** * Move an endpoint up 1 position. */ GenericInterface.prototype.up = function up(element) { element.wrapperElement.parentNode.insertBefore(element.wrapperElement, element.wrapperElement.previousElementSibling); this.repaint(); }; /** * Move an endpoint down 1 position. */ GenericInterface.prototype.down = function down(element) { if (element.wrapperElement.nextElementSibling !== null) { element.wrapperElement.parentNode.insertBefore(element.wrapperElement, element.wrapperElement.nextElementSibling.nextElementSibling); this.repaint(); } }; /** * Get sources and targets titles lists in order to save positions */ GenericInterface.prototype.getInOutPositions = function getInOutPositions() { var i, sources, targets; sources = []; targets = []; for (i = 0; i < this.sourceDiv.wrapperElement.childNodes.length; i++) { sources[i] = this.getNameForSort(this.sourceDiv.wrapperElement.childNodes[i], 'source'); } for (i = 0; i < this.targetDiv.wrapperElement.childNodes.length; i++) { targets[i] = this.getNameForSort(this.targetDiv.wrapperElement.childNodes[i], 'target'); } return {'sources': sources, 'targets': targets}; }; /** * Get the source or target name for the especific node */ GenericInterface.prototype.getNameForSort = function getNameForSort(node, type) { var i, collection; if (type === 'source') { collection = this.draggableSources; } else { collection = this.draggableTargets; } for (i = 0; collection.length; i++) { if (collection[i].wrapperElement === node) { return collection[i].context.data.name; } } }; /** * Change to minimized view for operators */ GenericInterface.prototype.minimize = function minimize(omitEffects) { var position, oc, scrollX, scrollY; if (!omitEffects) { this.resizeTransitStart(); } this.initialPos = this.wrapperElement.getBoundingClientRect(); this.minWidth = this.wrapperElement.style.minWidth; this.wrapperElement.classList.add('reducedInt'); this.wrapperElement.style.minWidth = '55px'; // Scroll correction oc = this.wiringEditor.layout.getCenterContainer(); scrollX = parseInt(oc.wrapperElement.scrollLeft, 10); scrollY = parseInt(oc.wrapperElement.scrollTop, 10); this.wrapperElement.style.top = (this.initialPos.top + scrollY - this.wiringEditor.headerHeight) + ((this.initialPos.height - 8) / 2) - 12 + 'px'; this.wrapperElement.style.left = (this.initialPos.left + scrollX - this.wiringEditor.menubarWidth) + (this.initialPos.width / 2) - 32 + 'px'; // correct it pos if is out of grid position = this.getStylePosition(); if (position.posX < 0) { position.posX = 8; } if (position.posY < 0) { position.posY = 8; } this.setPosition(position); this.isMinimized = true; this.repaint(); }; /** * Change to normal view for operators */ GenericInterface.prototype.restore = function restore(omitEffects) { var currentPos, position, oc, scrollX, scrollY; if (!omitEffects) { this.resizeTransitStart(); } // Scroll correction oc = this.wiringEditor.layout.getCenterContainer(); scrollX = parseInt(oc.wrapperElement.scrollLeft, 10) + 1; scrollY = parseInt(oc.wrapperElement.scrollTop, 10); currentPos = this.wrapperElement.getBoundingClientRect(); this.wrapperElement.style.top = (currentPos.top + scrollY - this.wiringEditor.headerHeight) - ((this.initialPos.height + 8) / 2) + 'px'; this.wrapperElement.style.left = (currentPos.left + scrollX - this.wiringEditor.menubarWidth) - (this.initialPos.width / 2) + 32 + 'px'; // correct it position if is out of grid position = this.getStylePosition(); if (position.posX < 0) { position.posX = 8; } if (position.posY < 0) { position.posY = 8; } this.setPosition(position); this.wrapperElement.style.minWidth = this.minWidth; this.wrapperElement.classList.remove('reducedInt'); this.isMinimized = false; this.repaint(); }; /** * Resize Transit Start */ GenericInterface.prototype.resizeTransitStart = function resizeTransitStart() { var interval; // transition events this.wrapperElement.classList.add('flex'); /*this.wrapperElement.addEventListener('webkitTransitionEnd', this.resizeTransitEnd.bind(this), false); this.wrapperElement.addEventListener('transitionend', this.resizeTransitEnd.bind(this), false); this.wrapperElement.addEventListener('oTransitionEnd', this.resizeTransitEnd.bind(this), false);*/ interval = setInterval(this.animateArrows.bind(this), 20); setTimeout(function () { clearInterval(interval); }, 400); setTimeout(function () { this.resizeTransitEnd(); }.bind(this), 450); }; /** * Resize Transit End */ GenericInterface.prototype.resizeTransitEnd = function resizeTransitEnd() { // transition events this.wrapperElement.classList.remove('flex'); /*this.wrapperElement.removeEventListener('webkitTransitionEnd', this.resizeTransitEnd.bind(this), false); this.wrapperElement.removeEventListener('transitionend', this.resizeTransitEnd.bind(this), false); this.wrapperElement.removeEventListener('oTransitionEnd', this.resizeTransitEnd.bind(this), false);*/ this.repaint(); }; /** * Animated arrows for the transitions betwen minimized an normal shape */ GenericInterface.prototype.animateArrows = function animateArrows() { var key, layer; for (key in this.sourceAnchorsByName) { this.sourceAnchorsByName[key].repaint(); } for (key in this.targetAnchorsByName) { this.targetAnchorsByName[key].repaint(); } if (this.potentialArrow != null) { layer = this.wiringEditor.canvas.getHTMLElement().parentNode; if (this.potentialArrow.startAnchor != null) { // from source to target this.potentialArrow.setStart(this.potentialArrow.startAnchor.getCoordinates(layer)); } else { // from target to source this.potentialArrow.setEnd(this.potentialArrow.endAnchor.getCoordinates(layer)); } } }; /************************************************************************* * Make GenericInterface public *************************************************************************/ Wirecloud.ui.WiringEditor.GenericInterface = GenericInterface; })();
gpl-2.0
erdfisch/DBCD16
web/themes/custom/dbcd_theme_base/example.config.js
253
module.exports = { browserSync: { hostname: "localhost", port: 8080, openAutomatically: false, reloadDelay: 50 }, drush: { enabled: false, alias: 'drush @SITE-ALIAS cache-rebuild' }, twig: { useCache: true } };
gpl-2.0
dc914337/PSD
PSD/app/src/main/java/anon/psd/gui/activities/MainActivity.java
4342
package anon.psd.gui.activities; import android.content.ContextWrapper; import android.content.Intent; import android.graphics.BitmapFactory; import android.os.Bundle; import android.support.v7.widget.SearchView; import android.view.View; import android.widget.AdapterView; import com.nhaarman.listviewanimations.itemmanipulation.DynamicListView; import java.io.File; import anon.psd.R; import anon.psd.gui.activities.global.PSDActivity; import anon.psd.gui.adapters.PassItemsAdapter; import anon.psd.gui.exchange.ActivitiesExchange; import anon.psd.models.AppearancesList; import anon.psd.models.PasswordList; import anon.psd.models.gui.PrettyPassword; import anon.psd.storage.AppearanceCfg; import static anon.psd.utils.DebugUtils.Log; public class MainActivity extends PSDActivity implements SearchView.OnQueryTextListener, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener { DynamicListView lvPasses; File appearanceCfgFile; AppearancesList passes; PassItemsAdapter adapter; AppearanceCfg appearanceCfg; @Override public void passItemChanged() { adapter.notifyDataSetChanged(); } @Override public void onPassesInfo(PasswordList passesInfo) { checkOrUpdateAppearanceCfg(); passes = AppearancesList.Merge(passesInfo, appearanceCfg.getPassesAppearances()); bindAdapter(); } /** * Activity events */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log(this, "[ ACTIVITY ] [ CREATE ]"); setContentView(R.layout.activity_main); initVariables(); } @Override protected void onResume() { super.onResume(); checkOrUpdateAppearanceCfg(); //if (passes != null) // bindAdapter(); } private void initVariables() { //load path to appearance.cfg file appearanceCfgFile = new File(new ContextWrapper(this).getFilesDir().getPath(), "appearance.cfg"); //init passes list element lvPasses = (DynamicListView) findViewById(R.id.lvPassesList); lvPasses.setOnItemClickListener(this); lvPasses.setOnItemLongClickListener(this); //set default pic for passes PrettyPassword.setDefaultPic(BitmapFactory.decodeResource(getResources(), R.drawable.default_key_pic)); PrettyPassword.setPicsDir(new File(new ContextWrapper(this).getFilesDir().getPath(), "pics")); } /** * Search */ @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { return false; } /** * Items */ @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { PrettyPassword item = (PrettyPassword) (lvPasses).getAdapter().getItem(position); openItem(item); } public void openItem(PrettyPassword item) { ActivitiesExchange.addObject("PASSES", passes); ActivitiesExchange.addObject("ACTIVITIES_SERVICE_WORKER", serviceWorker); Intent intent = new Intent(getApplicationContext(), PassActivity.class); intent.putExtra("ID", item.getPassItem().getPsdId()); startActivity(intent); } @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long id) { PrettyPassword selectedPassWrapper = (PrettyPassword) adapterView.getItemAtPosition(position); serviceWorker.sendPrettyPass(selectedPassWrapper); return true; } private void bindAdapter() { adapter = new PassItemsAdapter<>(this, android.R.layout.simple_list_item_1, passes); lvPasses.setAdapter(adapter); } private void checkOrUpdateAppearanceCfg() { //loading appearanceCfg appearanceCfg = new AppearanceCfg(appearanceCfgFile); AppearancesList prevPasses = ActivitiesExchange.getObject("PASSES"); if (prevPasses != null) appearanceCfg.setPassesAppearances(prevPasses); else appearanceCfg.update(); } @Override public void killService() { serviceWorker.killService(); } }
gpl-2.0
dh-electronics/linux-imx25
net/batman-adv/soft-interface.c
24495
/* * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA * */ #include "main.h" #include "soft-interface.h" #include "hard-interface.h" #include "routing.h" #include "send.h" #include "bat_debugfs.h" #include "translation-table.h" #include "hash.h" #include "gateway_common.h" #include "gateway_client.h" #include "bat_sysfs.h" #include "originator.h" #include <linux/slab.h> #include <linux/ethtool.h> #include <linux/etherdevice.h> #include <linux/if_vlan.h> #include "unicast.h" static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); static void bat_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); static u32 bat_get_msglevel(struct net_device *dev); static void bat_set_msglevel(struct net_device *dev, u32 value); static u32 bat_get_link(struct net_device *dev); static const struct ethtool_ops bat_ethtool_ops = { .get_settings = bat_get_settings, .get_drvinfo = bat_get_drvinfo, .get_msglevel = bat_get_msglevel, .set_msglevel = bat_set_msglevel, .get_link = bat_get_link, }; int my_skb_head_push(struct sk_buff *skb, unsigned int len) { int result; /** * TODO: We must check if we can release all references to non-payload * data using skb_header_release in our skbs to allow skb_cow_header to * work optimally. This means that those skbs are not allowed to read * or write any data which is before the current position of skb->data * after that call and thus allow other skbs with the same data buffer * to write freely in that area. */ result = skb_cow_head(skb, len); if (result < 0) return result; skb_push(skb, len); return 0; } static void softif_neigh_free_ref(struct softif_neigh *softif_neigh) { if (atomic_dec_and_test(&softif_neigh->refcount)) kfree_rcu(softif_neigh, rcu); } static void softif_neigh_vid_free_rcu(struct rcu_head *rcu) { struct softif_neigh_vid *softif_neigh_vid; struct softif_neigh *softif_neigh; struct hlist_node *node, *node_tmp; struct bat_priv *bat_priv; softif_neigh_vid = container_of(rcu, struct softif_neigh_vid, rcu); bat_priv = softif_neigh_vid->bat_priv; spin_lock_bh(&bat_priv->softif_neigh_lock); hlist_for_each_entry_safe(softif_neigh, node, node_tmp, &softif_neigh_vid->softif_neigh_list, list) { hlist_del_rcu(&softif_neigh->list); softif_neigh_free_ref(softif_neigh); } spin_unlock_bh(&bat_priv->softif_neigh_lock); kfree(softif_neigh_vid); } static void softif_neigh_vid_free_ref(struct softif_neigh_vid *softif_neigh_vid) { if (atomic_dec_and_test(&softif_neigh_vid->refcount)) call_rcu(&softif_neigh_vid->rcu, softif_neigh_vid_free_rcu); } static struct softif_neigh_vid *softif_neigh_vid_get(struct bat_priv *bat_priv, short vid) { struct softif_neigh_vid *softif_neigh_vid; struct hlist_node *node; rcu_read_lock(); hlist_for_each_entry_rcu(softif_neigh_vid, node, &bat_priv->softif_neigh_vids, list) { if (softif_neigh_vid->vid != vid) continue; if (!atomic_inc_not_zero(&softif_neigh_vid->refcount)) continue; goto out; } softif_neigh_vid = kzalloc(sizeof(*softif_neigh_vid), GFP_ATOMIC); if (!softif_neigh_vid) goto out; softif_neigh_vid->vid = vid; softif_neigh_vid->bat_priv = bat_priv; /* initialize with 2 - caller decrements counter by one */ atomic_set(&softif_neigh_vid->refcount, 2); INIT_HLIST_HEAD(&softif_neigh_vid->softif_neigh_list); INIT_HLIST_NODE(&softif_neigh_vid->list); spin_lock_bh(&bat_priv->softif_neigh_vid_lock); hlist_add_head_rcu(&softif_neigh_vid->list, &bat_priv->softif_neigh_vids); spin_unlock_bh(&bat_priv->softif_neigh_vid_lock); out: rcu_read_unlock(); return softif_neigh_vid; } static struct softif_neigh *softif_neigh_get(struct bat_priv *bat_priv, const uint8_t *addr, short vid) { struct softif_neigh_vid *softif_neigh_vid; struct softif_neigh *softif_neigh = NULL; struct hlist_node *node; softif_neigh_vid = softif_neigh_vid_get(bat_priv, vid); if (!softif_neigh_vid) goto out; rcu_read_lock(); hlist_for_each_entry_rcu(softif_neigh, node, &softif_neigh_vid->softif_neigh_list, list) { if (!compare_eth(softif_neigh->addr, addr)) continue; if (!atomic_inc_not_zero(&softif_neigh->refcount)) continue; softif_neigh->last_seen = jiffies; goto unlock; } softif_neigh = kzalloc(sizeof(*softif_neigh), GFP_ATOMIC); if (!softif_neigh) goto unlock; memcpy(softif_neigh->addr, addr, ETH_ALEN); softif_neigh->last_seen = jiffies; /* initialize with 2 - caller decrements counter by one */ atomic_set(&softif_neigh->refcount, 2); INIT_HLIST_NODE(&softif_neigh->list); spin_lock_bh(&bat_priv->softif_neigh_lock); hlist_add_head_rcu(&softif_neigh->list, &softif_neigh_vid->softif_neigh_list); spin_unlock_bh(&bat_priv->softif_neigh_lock); unlock: rcu_read_unlock(); out: if (softif_neigh_vid) softif_neigh_vid_free_ref(softif_neigh_vid); return softif_neigh; } static struct softif_neigh *softif_neigh_get_selected( struct softif_neigh_vid *softif_neigh_vid) { struct softif_neigh *softif_neigh; rcu_read_lock(); softif_neigh = rcu_dereference(softif_neigh_vid->softif_neigh); if (softif_neigh && !atomic_inc_not_zero(&softif_neigh->refcount)) softif_neigh = NULL; rcu_read_unlock(); return softif_neigh; } static struct softif_neigh *softif_neigh_vid_get_selected( struct bat_priv *bat_priv, short vid) { struct softif_neigh_vid *softif_neigh_vid; struct softif_neigh *softif_neigh = NULL; softif_neigh_vid = softif_neigh_vid_get(bat_priv, vid); if (!softif_neigh_vid) goto out; softif_neigh = softif_neigh_get_selected(softif_neigh_vid); out: if (softif_neigh_vid) softif_neigh_vid_free_ref(softif_neigh_vid); return softif_neigh; } static void softif_neigh_vid_select(struct bat_priv *bat_priv, struct softif_neigh *new_neigh, short vid) { struct softif_neigh_vid *softif_neigh_vid; struct softif_neigh *curr_neigh; softif_neigh_vid = softif_neigh_vid_get(bat_priv, vid); if (!softif_neigh_vid) goto out; spin_lock_bh(&bat_priv->softif_neigh_lock); if (new_neigh && !atomic_inc_not_zero(&new_neigh->refcount)) new_neigh = NULL; curr_neigh = rcu_dereference_protected(softif_neigh_vid->softif_neigh, 1); rcu_assign_pointer(softif_neigh_vid->softif_neigh, new_neigh); if ((curr_neigh) && (!new_neigh)) bat_dbg(DBG_ROUTES, bat_priv, "Removing mesh exit point on vid: %d (prev: %pM).\n", vid, curr_neigh->addr); else if ((curr_neigh) && (new_neigh)) bat_dbg(DBG_ROUTES, bat_priv, "Changing mesh exit point on vid: %d from %pM " "to %pM.\n", vid, curr_neigh->addr, new_neigh->addr); else if ((!curr_neigh) && (new_neigh)) bat_dbg(DBG_ROUTES, bat_priv, "Setting mesh exit point on vid: %d to %pM.\n", vid, new_neigh->addr); if (curr_neigh) softif_neigh_free_ref(curr_neigh); spin_unlock_bh(&bat_priv->softif_neigh_lock); out: if (softif_neigh_vid) softif_neigh_vid_free_ref(softif_neigh_vid); } static void softif_neigh_vid_deselect(struct bat_priv *bat_priv, struct softif_neigh_vid *softif_neigh_vid) { struct softif_neigh *curr_neigh; struct softif_neigh *softif_neigh = NULL, *softif_neigh_tmp; struct hard_iface *primary_if = NULL; struct hlist_node *node; primary_if = primary_if_get_selected(bat_priv); if (!primary_if) goto out; /* find new softif_neigh immediately to avoid temporary loops */ rcu_read_lock(); curr_neigh = rcu_dereference(softif_neigh_vid->softif_neigh); hlist_for_each_entry_rcu(softif_neigh_tmp, node, &softif_neigh_vid->softif_neigh_list, list) { if (softif_neigh_tmp == curr_neigh) continue; /* we got a neighbor but its mac is 'bigger' than ours */ if (memcmp(primary_if->net_dev->dev_addr, softif_neigh_tmp->addr, ETH_ALEN) < 0) continue; if (!atomic_inc_not_zero(&softif_neigh_tmp->refcount)) continue; softif_neigh = softif_neigh_tmp; goto unlock; } unlock: rcu_read_unlock(); out: softif_neigh_vid_select(bat_priv, softif_neigh, softif_neigh_vid->vid); if (primary_if) hardif_free_ref(primary_if); if (softif_neigh) softif_neigh_free_ref(softif_neigh); } int softif_neigh_seq_print_text(struct seq_file *seq, void *offset) { struct net_device *net_dev = (struct net_device *)seq->private; struct bat_priv *bat_priv = netdev_priv(net_dev); struct softif_neigh_vid *softif_neigh_vid; struct softif_neigh *softif_neigh; struct hard_iface *primary_if; struct hlist_node *node, *node_tmp; struct softif_neigh *curr_softif_neigh; int ret = 0, last_seen_secs, last_seen_msecs; primary_if = primary_if_get_selected(bat_priv); if (!primary_if) { ret = seq_printf(seq, "BATMAN mesh %s disabled - " "please specify interfaces to enable it\n", net_dev->name); goto out; } if (primary_if->if_status != IF_ACTIVE) { ret = seq_printf(seq, "BATMAN mesh %s " "disabled - primary interface not active\n", net_dev->name); goto out; } seq_printf(seq, "Softif neighbor list (%s)\n", net_dev->name); rcu_read_lock(); hlist_for_each_entry_rcu(softif_neigh_vid, node, &bat_priv->softif_neigh_vids, list) { seq_printf(seq, " %-15s %s on vid: %d\n", "Originator", "last-seen", softif_neigh_vid->vid); curr_softif_neigh = softif_neigh_get_selected(softif_neigh_vid); hlist_for_each_entry_rcu(softif_neigh, node_tmp, &softif_neigh_vid->softif_neigh_list, list) { last_seen_secs = jiffies_to_msecs(jiffies - softif_neigh->last_seen) / 1000; last_seen_msecs = jiffies_to_msecs(jiffies - softif_neigh->last_seen) % 1000; seq_printf(seq, "%s %pM %3i.%03is\n", curr_softif_neigh == softif_neigh ? "=>" : " ", softif_neigh->addr, last_seen_secs, last_seen_msecs); } if (curr_softif_neigh) softif_neigh_free_ref(curr_softif_neigh); seq_printf(seq, "\n"); } rcu_read_unlock(); out: if (primary_if) hardif_free_ref(primary_if); return ret; } void softif_neigh_purge(struct bat_priv *bat_priv) { struct softif_neigh *softif_neigh, *curr_softif_neigh; struct softif_neigh_vid *softif_neigh_vid; struct hlist_node *node, *node_tmp, *node_tmp2; int do_deselect; rcu_read_lock(); hlist_for_each_entry_rcu(softif_neigh_vid, node, &bat_priv->softif_neigh_vids, list) { if (!atomic_inc_not_zero(&softif_neigh_vid->refcount)) continue; curr_softif_neigh = softif_neigh_get_selected(softif_neigh_vid); do_deselect = 0; spin_lock_bh(&bat_priv->softif_neigh_lock); hlist_for_each_entry_safe(softif_neigh, node_tmp, node_tmp2, &softif_neigh_vid->softif_neigh_list, list) { if ((!time_after(jiffies, softif_neigh->last_seen + msecs_to_jiffies(SOFTIF_NEIGH_TIMEOUT))) && (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE)) continue; if (curr_softif_neigh == softif_neigh) { bat_dbg(DBG_ROUTES, bat_priv, "Current mesh exit point on vid: %d " "'%pM' vanished.\n", softif_neigh_vid->vid, softif_neigh->addr); do_deselect = 1; } hlist_del_rcu(&softif_neigh->list); softif_neigh_free_ref(softif_neigh); } spin_unlock_bh(&bat_priv->softif_neigh_lock); /* soft_neigh_vid_deselect() needs to acquire the * softif_neigh_lock */ if (do_deselect) softif_neigh_vid_deselect(bat_priv, softif_neigh_vid); if (curr_softif_neigh) softif_neigh_free_ref(curr_softif_neigh); softif_neigh_vid_free_ref(softif_neigh_vid); } rcu_read_unlock(); spin_lock_bh(&bat_priv->softif_neigh_vid_lock); hlist_for_each_entry_safe(softif_neigh_vid, node, node_tmp, &bat_priv->softif_neigh_vids, list) { if (!hlist_empty(&softif_neigh_vid->softif_neigh_list)) continue; hlist_del_rcu(&softif_neigh_vid->list); softif_neigh_vid_free_ref(softif_neigh_vid); } spin_unlock_bh(&bat_priv->softif_neigh_vid_lock); } static void softif_batman_recv(struct sk_buff *skb, struct net_device *dev, short vid) { struct bat_priv *bat_priv = netdev_priv(dev); struct ethhdr *ethhdr = (struct ethhdr *)skb->data; struct batman_ogm_packet *batman_ogm_packet; struct softif_neigh *softif_neigh = NULL; struct hard_iface *primary_if = NULL; struct softif_neigh *curr_softif_neigh = NULL; if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) batman_ogm_packet = (struct batman_ogm_packet *) (skb->data + ETH_HLEN + VLAN_HLEN); else batman_ogm_packet = (struct batman_ogm_packet *) (skb->data + ETH_HLEN); if (batman_ogm_packet->version != COMPAT_VERSION) goto out; if (batman_ogm_packet->packet_type != BAT_OGM) goto out; if (!(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) goto out; if (is_my_mac(batman_ogm_packet->orig)) goto out; softif_neigh = softif_neigh_get(bat_priv, batman_ogm_packet->orig, vid); if (!softif_neigh) goto out; curr_softif_neigh = softif_neigh_vid_get_selected(bat_priv, vid); if (curr_softif_neigh == softif_neigh) goto out; primary_if = primary_if_get_selected(bat_priv); if (!primary_if) goto out; /* we got a neighbor but its mac is 'bigger' than ours */ if (memcmp(primary_if->net_dev->dev_addr, softif_neigh->addr, ETH_ALEN) < 0) goto out; /* close own batX device and use softif_neigh as exit node */ if (!curr_softif_neigh) { softif_neigh_vid_select(bat_priv, softif_neigh, vid); goto out; } /* switch to new 'smallest neighbor' */ if (memcmp(softif_neigh->addr, curr_softif_neigh->addr, ETH_ALEN) < 0) softif_neigh_vid_select(bat_priv, softif_neigh, vid); out: kfree_skb(skb); if (softif_neigh) softif_neigh_free_ref(softif_neigh); if (curr_softif_neigh) softif_neigh_free_ref(curr_softif_neigh); if (primary_if) hardif_free_ref(primary_if); return; } static int interface_open(struct net_device *dev) { netif_start_queue(dev); return 0; } static int interface_release(struct net_device *dev) { netif_stop_queue(dev); return 0; } static struct net_device_stats *interface_stats(struct net_device *dev) { struct bat_priv *bat_priv = netdev_priv(dev); return &bat_priv->stats; } static int interface_set_mac_addr(struct net_device *dev, void *p) { struct bat_priv *bat_priv = netdev_priv(dev); struct sockaddr *addr = p; if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; /* only modify transtable if it has been initialized before */ if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) { tt_local_remove(bat_priv, dev->dev_addr, "mac address changed", false); tt_local_add(dev, addr->sa_data, NULL_IFINDEX); } memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); return 0; } static int interface_change_mtu(struct net_device *dev, int new_mtu) { /* check ranges */ if ((new_mtu < 68) || (new_mtu > hardif_min_mtu(dev))) return -EINVAL; dev->mtu = new_mtu; return 0; } static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) { struct ethhdr *ethhdr = (struct ethhdr *)skb->data; struct bat_priv *bat_priv = netdev_priv(soft_iface); struct hard_iface *primary_if = NULL; struct bcast_packet *bcast_packet; struct vlan_ethhdr *vhdr; struct softif_neigh *curr_softif_neigh = NULL; struct orig_node *orig_node = NULL; int data_len = skb->len, ret; short vid = -1; bool do_bcast; if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE) goto dropped; soft_iface->trans_start = jiffies; switch (ntohs(ethhdr->h_proto)) { case ETH_P_8021Q: vhdr = (struct vlan_ethhdr *)skb->data; vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK; if (ntohs(vhdr->h_vlan_encapsulated_proto) != ETH_P_BATMAN) break; /* fall through */ case ETH_P_BATMAN: softif_batman_recv(skb, soft_iface, vid); goto end; } /** * if we have a another chosen mesh exit node in range * it will transport the packets to the mesh */ curr_softif_neigh = softif_neigh_vid_get_selected(bat_priv, vid); if (curr_softif_neigh) goto dropped; /* Register the client MAC in the transtable */ tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif); orig_node = transtable_search(bat_priv, ethhdr->h_source, ethhdr->h_dest); do_bcast = is_multicast_ether_addr(ethhdr->h_dest); if (do_bcast || (orig_node && orig_node->gw_flags)) { ret = gw_is_target(bat_priv, skb, orig_node); if (ret < 0) goto dropped; if (ret) do_bcast = false; } /* ethernet packet should be broadcasted */ if (do_bcast) { primary_if = primary_if_get_selected(bat_priv); if (!primary_if) goto dropped; if (my_skb_head_push(skb, sizeof(*bcast_packet)) < 0) goto dropped; bcast_packet = (struct bcast_packet *)skb->data; bcast_packet->version = COMPAT_VERSION; bcast_packet->ttl = TTL; /* batman packet type: broadcast */ bcast_packet->packet_type = BAT_BCAST; /* hw address of first interface is the orig mac because only * this mac is known throughout the mesh */ memcpy(bcast_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN); /* set broadcast sequence number */ bcast_packet->seqno = htonl(atomic_inc_return(&bat_priv->bcast_seqno)); add_bcast_packet_to_list(bat_priv, skb, 1); /* a copy is stored in the bcast list, therefore removing * the original skb. */ kfree_skb(skb); /* unicast packet */ } else { ret = unicast_send_skb(skb, bat_priv); if (ret != 0) goto dropped_freed; } bat_priv->stats.tx_packets++; bat_priv->stats.tx_bytes += data_len; goto end; dropped: kfree_skb(skb); dropped_freed: bat_priv->stats.tx_dropped++; end: if (curr_softif_neigh) softif_neigh_free_ref(curr_softif_neigh); if (primary_if) hardif_free_ref(primary_if); if (orig_node) orig_node_free_ref(orig_node); return NETDEV_TX_OK; } void interface_rx(struct net_device *soft_iface, struct sk_buff *skb, struct hard_iface *recv_if, int hdr_size) { struct bat_priv *bat_priv = netdev_priv(soft_iface); struct unicast_packet *unicast_packet; struct ethhdr *ethhdr; struct vlan_ethhdr *vhdr; struct softif_neigh *curr_softif_neigh = NULL; short vid = -1; int ret; /* check if enough space is available for pulling, and pull */ if (!pskb_may_pull(skb, hdr_size)) goto dropped; skb_pull_rcsum(skb, hdr_size); skb_reset_mac_header(skb); if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) goto dropped; ethhdr = (struct ethhdr *)skb_mac_header(skb); switch (ntohs(ethhdr->h_proto)) { case ETH_P_8021Q: if (!pskb_may_pull(skb, VLAN_ETH_HLEN)) goto dropped; vhdr = (struct vlan_ethhdr *)skb->data; vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK; if (ntohs(vhdr->h_vlan_encapsulated_proto) != ETH_P_BATMAN) break; /* fall through */ case ETH_P_BATMAN: goto dropped; } /** * if we have a another chosen mesh exit node in range * it will transport the packets to the non-mesh network */ curr_softif_neigh = softif_neigh_vid_get_selected(bat_priv, vid); if (curr_softif_neigh) { skb_push(skb, hdr_size); unicast_packet = (struct unicast_packet *)skb->data; if ((unicast_packet->packet_type != BAT_UNICAST) && (unicast_packet->packet_type != BAT_UNICAST_FRAG)) goto dropped; skb_reset_mac_header(skb); memcpy(unicast_packet->dest, curr_softif_neigh->addr, ETH_ALEN); ret = route_unicast_packet(skb, recv_if); if (ret == NET_RX_DROP) goto dropped; goto out; } /* skb->dev & skb->pkt_type are set here */ skb->protocol = eth_type_trans(skb, soft_iface); /* should not be necessary anymore as we use skb_pull_rcsum() * TODO: please verify this and remove this TODO * -- Dec 21st 2009, Simon Wunderlich */ /* skb->ip_summed = CHECKSUM_UNNECESSARY;*/ bat_priv->stats.rx_packets++; bat_priv->stats.rx_bytes += skb->len + sizeof(struct ethhdr); soft_iface->last_rx = jiffies; if (is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest)) goto dropped; netif_rx(skb); goto out; dropped: kfree_skb(skb); out: if (curr_softif_neigh) softif_neigh_free_ref(curr_softif_neigh); return; } static const struct net_device_ops bat_netdev_ops = { .ndo_open = interface_open, .ndo_stop = interface_release, .ndo_get_stats = interface_stats, .ndo_set_mac_address = interface_set_mac_addr, .ndo_change_mtu = interface_change_mtu, .ndo_start_xmit = interface_tx, .ndo_validate_addr = eth_validate_addr }; static void interface_setup(struct net_device *dev) { struct bat_priv *priv = netdev_priv(dev); char dev_addr[ETH_ALEN]; ether_setup(dev); dev->netdev_ops = &bat_netdev_ops; dev->destructor = free_netdev; dev->tx_queue_len = 0; /** * can't call min_mtu, because the needed variables * have not been initialized yet */ dev->mtu = ETH_DATA_LEN; /* reserve more space in the skbuff for our header */ dev->hard_header_len = BAT_HEADER_LEN; /* generate random address */ random_ether_addr(dev_addr); memcpy(dev->dev_addr, dev_addr, ETH_ALEN); SET_ETHTOOL_OPS(dev, &bat_ethtool_ops); memset(priv, 0, sizeof(*priv)); } struct net_device *softif_create(const char *name) { struct net_device *soft_iface; struct bat_priv *bat_priv; int ret; soft_iface = alloc_netdev(sizeof(*bat_priv), name, interface_setup); if (!soft_iface) goto out; ret = register_netdevice(soft_iface); if (ret < 0) { pr_err("Unable to register the batman interface '%s': %i\n", name, ret); goto free_soft_iface; } bat_priv = netdev_priv(soft_iface); atomic_set(&bat_priv->aggregated_ogms, 1); atomic_set(&bat_priv->bonding, 0); atomic_set(&bat_priv->ap_isolation, 0); atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE); atomic_set(&bat_priv->gw_mode, GW_MODE_OFF); atomic_set(&bat_priv->gw_sel_class, 20); atomic_set(&bat_priv->gw_bandwidth, 41); atomic_set(&bat_priv->orig_interval, 1000); atomic_set(&bat_priv->hop_penalty, 10); atomic_set(&bat_priv->log_level, 0); atomic_set(&bat_priv->fragmentation, 1); atomic_set(&bat_priv->bcast_queue_left, BCAST_QUEUE_LEN); atomic_set(&bat_priv->batman_queue_left, BATMAN_QUEUE_LEN); atomic_set(&bat_priv->mesh_state, MESH_INACTIVE); atomic_set(&bat_priv->bcast_seqno, 1); atomic_set(&bat_priv->ttvn, 0); atomic_set(&bat_priv->tt_local_changes, 0); atomic_set(&bat_priv->tt_ogm_append_cnt, 0); bat_priv->tt_buff = NULL; bat_priv->tt_buff_len = 0; bat_priv->tt_poss_change = false; bat_priv->primary_if = NULL; bat_priv->num_ifaces = 0; ret = sysfs_add_meshif(soft_iface); if (ret < 0) goto unreg_soft_iface; ret = debugfs_add_meshif(soft_iface); if (ret < 0) goto unreg_sysfs; ret = mesh_init(soft_iface); if (ret < 0) goto unreg_debugfs; return soft_iface; unreg_debugfs: debugfs_del_meshif(soft_iface); unreg_sysfs: sysfs_del_meshif(soft_iface); unreg_soft_iface: unregister_netdev(soft_iface); return NULL; free_soft_iface: free_netdev(soft_iface); out: return NULL; } void softif_destroy(struct net_device *soft_iface) { debugfs_del_meshif(soft_iface); sysfs_del_meshif(soft_iface); mesh_free(soft_iface); unregister_netdevice(soft_iface); } int softif_is_valid(const struct net_device *net_dev) { if (net_dev->netdev_ops->ndo_start_xmit == interface_tx) return 1; return 0; } /* ethtool */ static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { cmd->supported = 0; cmd->advertising = 0; ethtool_cmd_speed_set(cmd, SPEED_10); cmd->duplex = DUPLEX_FULL; cmd->port = PORT_TP; cmd->phy_address = 0; cmd->transceiver = XCVR_INTERNAL; cmd->autoneg = AUTONEG_DISABLE; cmd->maxtxpkt = 0; cmd->maxrxpkt = 0; return 0; } static void bat_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { strcpy(info->driver, "B.A.T.M.A.N. advanced"); strcpy(info->version, SOURCE_VERSION); strcpy(info->fw_version, "N/A"); strcpy(info->bus_info, "batman"); } static u32 bat_get_msglevel(struct net_device *dev) { return -EOPNOTSUPP; } static void bat_set_msglevel(struct net_device *dev, u32 value) { } static u32 bat_get_link(struct net_device *dev) { return 1; }
gpl-2.0
rminnich/lunacy
drivers/net/wireless/iwlwifi/iwl-6000.c
5116
/****************************************************************************** * * Copyright(c) 2008-2009 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: * Intel Linux Wireless <[email protected]> * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 * *****************************************************************************/ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> #include <linux/dma-mapping.h> #include <linux/delay.h> #include <linux/skbuff.h> #include <linux/netdevice.h> #include <linux/wireless.h> #include <net/mac80211.h> #include <linux/etherdevice.h> #include <asm/unaligned.h> #include "iwl-eeprom.h" #include "iwl-dev.h" #include "iwl-core.h" #include "iwl-io.h" #include "iwl-sta.h" #include "iwl-helpers.h" #include "iwl-5000-hw.h" /* Highest firmware API version supported */ #define IWL6000_UCODE_API_MAX 2 #define IWL6050_UCODE_API_MAX 2 /* Lowest firmware API version supported */ #define IWL6000_UCODE_API_MIN 1 #define IWL6050_UCODE_API_MIN 1 #define IWL6000_FW_PRE "iwlwifi-6000-" #define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode" #define IWL6000_MODULE_FIRMWARE(api) _IWL6000_MODULE_FIRMWARE(api) #define IWL6050_FW_PRE "iwlwifi-6050-" #define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode" #define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api) static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = { .get_hcmd_size = iwl5000_get_hcmd_size, .build_addsta_hcmd = iwl5000_build_addsta_hcmd, .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag, .calc_rssi = iwl5000_calc_rssi, }; static struct iwl_ops iwl6000_ops = { .lib = &iwl5000_lib, .hcmd = &iwl5000_hcmd, .utils = &iwl6000_hcmd_utils, }; struct iwl_cfg iwl6000_2ag_cfg = { .name = "6000 Series 2x2 AG", .fw_name_pre = IWL6000_FW_PRE, .ucode_api_max = IWL6000_UCODE_API_MAX, .ucode_api_min = IWL6000_UCODE_API_MIN, .sku = IWL_SKU_A|IWL_SKU_G, .ops = &iwl6000_ops, .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, .eeprom_ver = EEPROM_5000_EEPROM_VERSION, .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, .mod_params = &iwl50_mod_params, .valid_tx_ant = ANT_BC, .valid_rx_ant = ANT_BC, .need_pll_cfg = false, }; struct iwl_cfg iwl6000_2agn_cfg = { .name = "6000 Series 2x2 AGN", .fw_name_pre = IWL6000_FW_PRE, .ucode_api_max = IWL6000_UCODE_API_MAX, .ucode_api_min = IWL6000_UCODE_API_MIN, .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, .ops = &iwl6000_ops, .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, .eeprom_ver = EEPROM_5000_EEPROM_VERSION, .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, .mod_params = &iwl50_mod_params, .valid_tx_ant = ANT_BC, .valid_rx_ant = ANT_BC, .need_pll_cfg = false, }; struct iwl_cfg iwl6050_2agn_cfg = { .name = "6050 Series 2x2 AGN", .fw_name_pre = IWL6050_FW_PRE, .ucode_api_max = IWL6050_UCODE_API_MAX, .ucode_api_min = IWL6050_UCODE_API_MIN, .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, .ops = &iwl6000_ops, .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, .eeprom_ver = EEPROM_5000_EEPROM_VERSION, .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, .mod_params = &iwl50_mod_params, .valid_tx_ant = ANT_BC, .valid_rx_ant = ANT_BC, .need_pll_cfg = false, }; struct iwl_cfg iwl6000_3agn_cfg = { .name = "6000 Series 3x3 AGN", .fw_name_pre = IWL6000_FW_PRE, .ucode_api_max = IWL6000_UCODE_API_MAX, .ucode_api_min = IWL6000_UCODE_API_MIN, .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, .ops = &iwl6000_ops, .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, .eeprom_ver = EEPROM_5000_EEPROM_VERSION, .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, .mod_params = &iwl50_mod_params, .valid_tx_ant = ANT_ABC, .valid_rx_ant = ANT_ABC, .need_pll_cfg = false, }; struct iwl_cfg iwl6050_3agn_cfg = { .name = "6050 Series 3x3 AGN", .fw_name_pre = IWL6050_FW_PRE, .ucode_api_max = IWL6050_UCODE_API_MAX, .ucode_api_min = IWL6050_UCODE_API_MIN, .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, .ops = &iwl6000_ops, .eeprom_size = IWL_5000_EEPROM_IMG_SIZE, .eeprom_ver = EEPROM_5000_EEPROM_VERSION, .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, .mod_params = &iwl50_mod_params, .valid_tx_ant = ANT_ABC, .valid_rx_ant = ANT_ABC, .need_pll_cfg = false, }; MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
gpl-2.0
muromec/qtopia-ezx
qtopiacore/qt/doc/html/itemviews-puzzle-puzzlewidget-cpp.html
8637
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Qt 4.3: puzzlewidget.cpp Example File (itemviews/puzzle/puzzlewidget.cpp)</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td> <td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 class="title">puzzlewidget.cpp Example File<br /><span class="small-subtitle">itemviews/puzzle/puzzlewidget.cpp</span> </h1> <pre><span class="comment"> /**************************************************************************** ** ** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. ** ** This file is part of the example classes of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License versions 2.0 or 3.0 as published by the Free Software ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Alternatively you may (at ** your option) use any later version of the GNU General Public ** License if such license has been publicly approved by Trolltech ASA ** (or its successors, if any) and the KDE Free Qt Foundation. In ** addition, as a special exception, Trolltech gives you certain ** additional rights. These rights are described in the Trolltech GPL ** Exception version 1.2, which can be found at ** http://www.trolltech.com/products/qt/gplexception/ and in the file ** GPL_EXCEPTION.txt in this package. ** ** Please review the following information to ensure GNU General ** Public Licensing requirements will be met: ** http://trolltech.com/products/qt/licenses/licensing/opensource/. If ** you are unsure which license is appropriate for your use, please ** review the following information: ** http://trolltech.com/products/qt/licenses/licensing/licensingoverview ** or contact the sales department at [email protected]. ** ** In addition, as a special exception, Trolltech, as the sole ** copyright holder for Qt Designer, grants users of the Qt/Eclipse ** Integration plug-in the right for the Qt/Eclipse Integration to ** link to functionality provided by Qt Designer and its related ** libraries. ** ** This file is provided &quot;AS IS&quot; with NO WARRANTY OF ANY KIND, ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly ** granted herein. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/</span> #include &lt;QtGui&gt; #include &quot;puzzlewidget.h&quot; PuzzleWidget::PuzzleWidget(QWidget *parent) : QWidget(parent) { setAcceptDrops(true); setMinimumSize(400, 400); setMaximumSize(400, 400); } void PuzzleWidget::clear() { pieceLocations.clear(); piecePixmaps.clear(); pieceRects.clear(); highlightedRect = QRect(); inPlace = 0; update(); } void PuzzleWidget::dragEnterEvent(QDragEnterEvent *event) { if (event-&gt;mimeData()-&gt;hasFormat(&quot;image/x-puzzle-piece&quot;)) event-&gt;accept(); else event-&gt;ignore(); } void PuzzleWidget::dragLeaveEvent(QDragLeaveEvent *event) { QRect updateRect = highlightedRect; highlightedRect = QRect(); update(updateRect); event-&gt;accept(); } void PuzzleWidget::dragMoveEvent(QDragMoveEvent *event) { QRect updateRect = highlightedRect.unite(targetSquare(event-&gt;pos())); if (event-&gt;mimeData()-&gt;hasFormat(&quot;image/x-puzzle-piece&quot;) &amp;&amp; findPiece(targetSquare(event-&gt;pos())) == -1) { highlightedRect = targetSquare(event-&gt;pos()); event-&gt;setDropAction(Qt::MoveAction); event-&gt;accept(); } else { highlightedRect = QRect(); event-&gt;ignore(); } update(updateRect); } void PuzzleWidget::dropEvent(QDropEvent *event) { if (event-&gt;mimeData()-&gt;hasFormat(&quot;image/x-puzzle-piece&quot;) &amp;&amp; findPiece(targetSquare(event-&gt;pos())) == -1) { QByteArray pieceData = event-&gt;mimeData()-&gt;data(&quot;image/x-puzzle-piece&quot;); QDataStream stream(&amp;pieceData, QIODevice::ReadOnly); QRect square = targetSquare(event-&gt;pos()); QPixmap pixmap; QPoint location; stream &gt;&gt; pixmap &gt;&gt; location; pieceLocations.append(location); piecePixmaps.append(pixmap); pieceRects.append(square); highlightedRect = QRect(); update(square); event-&gt;setDropAction(Qt::MoveAction); event-&gt;accept(); if (location == QPoint(square.x()/80, square.y()/80)) { inPlace++; if (inPlace == 25) emit puzzleCompleted(); } } else { highlightedRect = QRect(); event-&gt;ignore(); } } int PuzzleWidget::findPiece(const QRect &amp;pieceRect) const { for (int i = 0; i &lt; pieceRects.size(); ++i) { if (pieceRect == pieceRects[i]) { return i; } } return -1; } void PuzzleWidget::mousePressEvent(QMouseEvent *event) { QRect square = targetSquare(event-&gt;pos()); int found = findPiece(square); if (found == -1) return; QPoint location = pieceLocations[found]; QPixmap pixmap = piecePixmaps[found]; pieceLocations.removeAt(found); piecePixmaps.removeAt(found); pieceRects.removeAt(found); if (location == QPoint(square.x()/80, square.y()/80)) inPlace--; update(square); QByteArray itemData; QDataStream dataStream(&amp;itemData, QIODevice::WriteOnly); dataStream &lt;&lt; pixmap &lt;&lt; location; QMimeData *mimeData = new QMimeData; mimeData-&gt;setData(&quot;image/x-puzzle-piece&quot;, itemData); QDrag *drag = new QDrag(this); drag-&gt;setMimeData(mimeData); drag-&gt;setHotSpot(event-&gt;pos() - square.topLeft()); drag-&gt;setPixmap(pixmap); if (drag-&gt;start(Qt::MoveAction) == 0) { pieceLocations.insert(found, location); piecePixmaps.insert(found, pixmap); pieceRects.insert(found, square); update(targetSquare(event-&gt;pos())); if (location == QPoint(square.x()/80, square.y()/80)) inPlace++; } } void PuzzleWidget::paintEvent(QPaintEvent *event) { QPainter painter; painter.begin(this); painter.fillRect(event-&gt;rect(), Qt::white); if (highlightedRect.isValid()) { painter.setBrush(QColor(&quot;#ffcccc&quot;)); painter.setPen(Qt::NoPen); painter.drawRect(highlightedRect.adjusted(0, 0, -1, -1)); } for (int i = 0; i &lt; pieceRects.size(); ++i) { painter.drawPixmap(pieceRects[i], piecePixmaps[i]); } painter.end(); } const QRect PuzzleWidget::targetSquare(const QPoint &amp;position) const { return QRect(position.x()/80 * 80, position.y()/80 * 80, 80, 80); }</pre> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td> <td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="30%" align="right"><div align="right">Qt 4.3.6</div></td> </tr></table></div></address></body> </html>
gpl-2.0
valdas-s/sandelys2
vendor/plugins/validates_timeliness/spec/action_view/instance_tag_spec.rb
10844
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe 'ValidatesTimeliness::ActionView::InstanceTag' do include ActionView::Helpers::DateHelper include ActionController::Assertions::SelectorAssertions before do @person = Person.new end def params @params ||= {} end describe "datetime_select" do it "should use param values when attribute is nil" do params["person"] = { "birth_date_and_time(1i)" => 2009, "birth_date_and_time(2i)" => 2, "birth_date_and_time(3i)" => 29, "birth_date_and_time(4i)" => 12, "birth_date_and_time(5i)" => 13, "birth_date_and_time(6i)" => 14, } @person.birth_date_and_time = nil output = datetime_select(:person, :birth_date_and_time, :include_blank => true, :include_seconds => true) output.should have_tag('select[id=person_birth_date_and_time_1i] option[selected=selected]', '2009') output.should have_tag('select[id=person_birth_date_and_time_2i] option[selected=selected]', 'February') output.should have_tag('select[id=person_birth_date_and_time_3i] option[selected=selected]', '29') output.should have_tag('select[id=person_birth_date_and_time_4i] option[selected=selected]', '12') output.should have_tag('select[id=person_birth_date_and_time_5i] option[selected=selected]', '13') output.should have_tag('select[id=person_birth_date_and_time_6i] option[selected=selected]', '14') end it "should override object values and use params if present" do params["person"] = { "birth_date_and_time(1i)" => 2009, "birth_date_and_time(2i)" => 2, "birth_date_and_time(3i)" => 29, "birth_date_and_time(4i)" => 13, "birth_date_and_time(5i)" => 14, "birth_date_and_time(6i)" => 15, } @person.birth_date_and_time = "2009-03-01 13:14:15" output = datetime_select(:person, :birth_date_and_time, :include_blank => true, :include_seconds => true) output.should have_tag('select[id=person_birth_date_and_time_1i] option[selected=selected]', '2009') output.should have_tag('select[id=person_birth_date_and_time_2i] option[selected=selected]', 'February') output.should have_tag('select[id=person_birth_date_and_time_3i] option[selected=selected]', '29') output.should have_tag('select[id=person_birth_date_and_time_4i] option[selected=selected]', '13') output.should have_tag('select[id=person_birth_date_and_time_5i] option[selected=selected]', '14') output.should have_tag('select[id=person_birth_date_and_time_6i] option[selected=selected]', '15') end it "should select attribute values from object if no params" do @person.birth_date_and_time = "2009-01-02 13:14:15" output = datetime_select(:person, :birth_date_and_time, :include_blank => true, :include_seconds => true) output.should have_tag('select[id=person_birth_date_and_time_1i] option[selected=selected]', '2009') output.should have_tag('select[id=person_birth_date_and_time_2i] option[selected=selected]', 'January') output.should have_tag('select[id=person_birth_date_and_time_3i] option[selected=selected]', '2') output.should have_tag('select[id=person_birth_date_and_time_4i] option[selected=selected]', '13') output.should have_tag('select[id=person_birth_date_and_time_5i] option[selected=selected]', '14') output.should have_tag('select[id=person_birth_date_and_time_6i] option[selected=selected]', '15') end it "should select attribute values if params does not contain attribute params" do @person.birth_date_and_time = "2009-01-02 13:14:15" params["person"] = { } output = datetime_select(:person, :birth_date_and_time, :include_blank => true, :include_seconds => true) output.should have_tag('select[id=person_birth_date_and_time_1i] option[selected=selected]', '2009') output.should have_tag('select[id=person_birth_date_and_time_2i] option[selected=selected]', 'January') output.should have_tag('select[id=person_birth_date_and_time_3i] option[selected=selected]', '2') output.should have_tag('select[id=person_birth_date_and_time_4i] option[selected=selected]', '13') output.should have_tag('select[id=person_birth_date_and_time_5i] option[selected=selected]', '14') output.should have_tag('select[id=person_birth_date_and_time_6i] option[selected=selected]', '15') end it "should not select values when attribute value is nil and has no param values" do @person.birth_date_and_time = nil output = datetime_select(:person, :birth_date_and_time, :include_blank => true, :include_seconds => true) output.should_not have_tag('select[id=person_birth_date_and_time_1i] option[selected=selected]') output.should_not have_tag('select[id=person_birth_date_and_time_2i] option[selected=selected]') output.should_not have_tag('select[id=person_birth_date_and_time_3i] option[selected=selected]') output.should_not have_tag('select[id=person_birth_date_and_time_4i] option[selected=selected]') output.should_not have_tag('select[id=person_birth_date_and_time_5i] option[selected=selected]') output.should_not have_tag('select[id=person_birth_date_and_time_6i] option[selected=selected]') end end describe "date_select" do it "should use param values when attribute is nil" do params["person"] = { "birth_date(1i)" => 2009, "birth_date(2i)" => 2, "birth_date(3i)" => 29, } @person.birth_date = nil output = date_select(:person, :birth_date, :include_blank => true, :include_seconds => true) output.should have_tag('select[id=person_birth_date_1i] option[selected=selected]', '2009') output.should have_tag('select[id=person_birth_date_2i] option[selected=selected]', 'February') output.should have_tag('select[id=person_birth_date_3i] option[selected=selected]', '29') end it "should override object values and use params if present" do params["person"] = { "birth_date(1i)" => 2009, "birth_date(2i)" => 2, "birth_date(3i)" => 29, } @person.birth_date = "2009-03-01" output = date_select(:person, :birth_date, :include_blank => true, :include_seconds => true) output.should have_tag('select[id=person_birth_date_1i] option[selected=selected]', '2009') output.should have_tag('select[id=person_birth_date_2i] option[selected=selected]', 'February') output.should have_tag('select[id=person_birth_date_3i] option[selected=selected]', '29') end it "should select attribute values from object if no params" do @person.birth_date = "2009-01-02" output = date_select(:person, :birth_date, :include_blank => true, :include_seconds => true) output.should have_tag('select[id=person_birth_date_1i] option[selected=selected]', '2009') output.should have_tag('select[id=person_birth_date_2i] option[selected=selected]', 'January') output.should have_tag('select[id=person_birth_date_3i] option[selected=selected]', '2') end it "should select attribute values if params does not contain attribute params" do @person.birth_date = "2009-01-02" params["person"] = { } output = date_select(:person, :birth_date, :include_blank => true, :include_seconds => true) output.should have_tag('select[id=person_birth_date_1i] option[selected=selected]', '2009') output.should have_tag('select[id=person_birth_date_2i] option[selected=selected]', 'January') output.should have_tag('select[id=person_birth_date_3i] option[selected=selected]', '2') end it "should not select values when attribute value is nil and has no param values" do @person.birth_date = nil output = date_select(:person, :birth_date, :include_blank => true, :include_seconds => true) output.should_not have_tag('select[id=person_birth_date_1i] option[selected=selected]') output.should_not have_tag('select[id=person_birth_date_2i] option[selected=selected]') output.should_not have_tag('select[id=person_birth_date_3i] option[selected=selected]') end end describe "time_select" do before :all do Time.now = Time.mktime(2009,1,1) end it "should use param values when attribute is nil" do params["person"] = { "birth_time(1i)" => 2000, "birth_time(2i)" => 1, "birth_time(3i)" => 1, "birth_time(4i)" => 12, "birth_time(5i)" => 13, "birth_time(6i)" => 14, } @person.birth_time = nil output = time_select(:person, :birth_time, :include_blank => true, :include_seconds => true) output.should have_tag('input[id=person_birth_time_1i][value=2000]') output.should have_tag('input[id=person_birth_time_2i][value=1]') output.should have_tag('input[id=person_birth_time_3i][value=1]') output.should have_tag('select[id=person_birth_time_4i] option[selected=selected]', '12') output.should have_tag('select[id=person_birth_time_5i] option[selected=selected]', '13') output.should have_tag('select[id=person_birth_time_6i] option[selected=selected]', '14') end it "should select attribute values from object if no params" do @person.birth_time = "13:14:15" output = time_select(:person, :birth_time, :include_blank => true, :include_seconds => true) output.should have_tag('input[id=person_birth_time_1i][value=2000]') output.should have_tag('input[id=person_birth_time_2i][value=1]') output.should have_tag('input[id=person_birth_time_3i][value=1]') output.should have_tag('select[id=person_birth_time_4i] option[selected=selected]', '13') output.should have_tag('select[id=person_birth_time_5i] option[selected=selected]', '14') output.should have_tag('select[id=person_birth_time_6i] option[selected=selected]', '15') end it "should not select values when attribute value is nil and has no param values" do @person.birth_time = nil output = time_select(:person, :birth_time, :include_blank => true, :include_seconds => true) output.should have_tag('input[id=person_birth_time_1i][value=""]') # Annoyingly these may or not have value attribute depending on rails version. # output.should have_tag('input[id=person_birth_time_2i][value=""]') # output.should have_tag('input[id=person_birth_time_3i][value=""]') output.should_not have_tag('select[id=person_birth_time_4i] option[selected=selected]') output.should_not have_tag('select[id=person_birth_time_5i] option[selected=selected]') output.should_not have_tag('select[id=person_birth_time_6i] option[selected=selected]') end after :all do Time.now = nil end end end
gpl-2.0
Debian/openjfx
modules/web/src/main/native/Source/WebCore/Modules/vibration/NavigatorVibration.cpp
1684
/* * Copyright (C) 2012 Samsung Electronics * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "config.h" #include "NavigatorVibration.h" #if ENABLE(VIBRATION) #include "Frame.h" #include "Navigator.h" #include "Page.h" #include "Vibration.h" #include <runtime/Uint32Array.h> namespace WebCore { NavigatorVibration::NavigatorVibration() { } NavigatorVibration::~NavigatorVibration() { } bool NavigatorVibration::vibrate(Navigator& navigator, unsigned time) { return NavigatorVibration::vibrate(navigator, VibrationPattern(1, time)); } bool NavigatorVibration::vibrate(Navigator& navigator, const VibrationPattern& pattern) { if (!navigator.frame()->page()) return false; if (navigator.frame()->page()->visibilityState() == PageVisibilityState::Hidden) return false; return Vibration::from(navigator.frame()->page())->vibrate(pattern); } } // namespace WebCore #endif // ENABLE(VIBRATION)
gpl-2.0
bk138/gromit-mpx
src/drawing.h
729
#ifndef DRAWING_H #define DRAWING_H /* Functions that manipulate the surfaces pixel-wise. Does not include functions that treat a surface like a buffer, like undo/redo etc. */ #include "main.h" void draw_line (GromitData *data, GdkDevice *dev, gint x1, gint y1, gint x2, gint y2); void draw_arrow (GromitData *data, GdkDevice *dev, gint x1, gint y1, gint width, gfloat direction); gboolean coord_list_get_arrow_param (GromitData *data, GdkDevice *dev, gint search_radius, gint *ret_width, gfloat *ret_direction); void coord_list_prepend (GromitData *data, GdkDevice* dev, gint x, gint y, gint width); void coord_list_free (GromitData *data, GdkDevice* dev); #endif
gpl-2.0
mikelolasagasti/liferea
src/ui/auth_dialog.c
3899
/** * @file auth_dialog.c authentication dialog * * Copyright (C) 2007-2018 Lars Windolf <[email protected]> * * 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ui/auth_dialog.h" #include <libxml/uri.h> #include "common.h" #include "debug.h" #include "ui/liferea_dialog.h" struct _AuthDialog { GObject parentInstance; subscriptionPtr subscription; GtkWidget *dialog; GtkWidget *username; GtkWidget *password; gint flags; }; G_DEFINE_TYPE (AuthDialog, auth_dialog, G_TYPE_OBJECT); static void auth_dialog_finalize (GObject *object) { AuthDialog *ad = AUTH_DIALOG (object); if (ad->subscription != NULL) ad->subscription->activeAuth = FALSE; gtk_widget_destroy (ad->dialog); } static void auth_dialog_class_init (AuthDialogClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = auth_dialog_finalize; } static void on_authdialog_response (GtkDialog *dialog, gint response_id, gpointer user_data) { AuthDialog *ad = AUTH_DIALOG (user_data); if (response_id == GTK_RESPONSE_OK) { subscription_set_auth_info (ad->subscription, gtk_entry_get_text (GTK_ENTRY (ad->username)), gtk_entry_get_text (GTK_ENTRY (ad->password))); subscription_update (ad->subscription, ad->flags); } g_object_unref (ad); } static void auth_dialog_load (AuthDialog *ad, subscriptionPtr subscription, gint flags) { gchar *promptStr; gchar *source = NULL; xmlURIPtr uri; subscription->activeAuth = TRUE; ad->subscription = subscription; ad->flags = flags; uri = xmlParseURI (subscription_get_source (ad->subscription)); if (uri) { if (uri->user) { gchar *user = uri->user; gchar *pass = strstr (user, ":"); if(pass) { pass[0] = '\0'; pass++; gtk_entry_set_text (GTK_ENTRY (ad->password), pass); } gtk_entry_set_text (GTK_ENTRY (ad->username), user); xmlFree (uri->user); uri->user = NULL; } xmlFree (uri->user); uri->user = NULL; source = (gchar *) xmlSaveUri (uri); xmlFreeURI (uri); } promptStr = g_strdup_printf ( _("Enter the username and password for \"%s\" (%s):"), node_get_title (ad->subscription->node), source?source:_("Unknown source")); gtk_label_set_text (GTK_LABEL (liferea_dialog_lookup (ad->dialog, "prompt")), promptStr); g_free (promptStr); if (source) xmlFree (source); } static void auth_dialog_init (AuthDialog *ad) { ad->dialog = liferea_dialog_new ("auth"); ad->username = liferea_dialog_lookup (ad->dialog, "usernameEntry"); ad->password = liferea_dialog_lookup (ad->dialog, "passwordEntry"); g_signal_connect (G_OBJECT (ad->dialog), "response", G_CALLBACK (on_authdialog_response), ad); gtk_widget_show_all (ad->dialog); } AuthDialog * auth_dialog_new (subscriptionPtr subscription, gint flags) { AuthDialog *ad; if (subscription->activeAuth) { debug0 (DEBUG_UPDATE, "Missing/wrong authentication. Skipping, as a dialog is already active."); return NULL; } ad = AUTH_DIALOG (g_object_new (AUTH_DIALOG_TYPE, NULL)); auth_dialog_load(ad, subscription, flags); return ad; }
gpl-2.0
dengbiao/tc_kernel_linux
drivers/net/benet/be_cmds.h
28853
/* * Copyright (C) 2005 - 2010 ServerEngines * 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 version 2 * as published by the Free Software Foundation. The full GNU General * Public License is included in this distribution in the file called COPYING. * * Contact Information: * [email protected] * * ServerEngines * 209 N. Fair Oaks Ave * Sunnyvale, CA 94085 */ /* * The driver sends configuration and managements command requests to the * firmware in the BE. These requests are communicated to the processor * using Work Request Blocks (WRBs) submitted to the MCC-WRB ring or via one * WRB inside a MAILBOX. * The commands are serviced by the ARM processor in the BladeEngine's MPU. */ struct be_sge { u32 pa_lo; u32 pa_hi; u32 len; }; #define MCC_WRB_EMBEDDED_MASK 1 /* bit 0 of dword 0*/ #define MCC_WRB_SGE_CNT_SHIFT 3 /* bits 3 - 7 of dword 0 */ #define MCC_WRB_SGE_CNT_MASK 0x1F /* bits 3 - 7 of dword 0 */ struct be_mcc_wrb { u32 embedded; /* dword 0 */ u32 payload_length; /* dword 1 */ u32 tag0; /* dword 2 */ u32 tag1; /* dword 3 */ u32 rsvd; /* dword 4 */ union { u8 embedded_payload[236]; /* used by embedded cmds */ struct be_sge sgl[19]; /* used by non-embedded cmds */ } payload; }; #define CQE_FLAGS_VALID_MASK (1 << 31) #define CQE_FLAGS_ASYNC_MASK (1 << 30) #define CQE_FLAGS_COMPLETED_MASK (1 << 28) #define CQE_FLAGS_CONSUMED_MASK (1 << 27) /* Completion Status */ enum { MCC_STATUS_SUCCESS = 0x0, /* The client does not have sufficient privileges to execute the command */ MCC_STATUS_INSUFFICIENT_PRIVILEGES = 0x1, /* A parameter in the command was invalid. */ MCC_STATUS_INVALID_PARAMETER = 0x2, /* There are insufficient chip resources to execute the command */ MCC_STATUS_INSUFFICIENT_RESOURCES = 0x3, /* The command is completing because the queue was getting flushed */ MCC_STATUS_QUEUE_FLUSHING = 0x4, /* The command is completing with a DMA error */ MCC_STATUS_DMA_FAILED = 0x5, MCC_STATUS_NOT_SUPPORTED = 66 }; #define CQE_STATUS_COMPL_MASK 0xFFFF #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ #define CQE_STATUS_EXTD_MASK 0xFFFF #define CQE_STATUS_EXTD_SHIFT 16 /* bits 16 - 31 */ struct be_mcc_compl { u32 status; /* dword 0 */ u32 tag0; /* dword 1 */ u32 tag1; /* dword 2 */ u32 flags; /* dword 3 */ }; /* When the async bit of mcc_compl is set, the last 4 bytes of * mcc_compl is interpreted as follows: */ #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */ #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF #define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16 #define ASYNC_TRAILER_EVENT_TYPE_MASK 0xFF #define ASYNC_EVENT_CODE_LINK_STATE 0x1 #define ASYNC_EVENT_CODE_GRP_5 0x5 #define ASYNC_EVENT_QOS_SPEED 0x1 #define ASYNC_EVENT_COS_PRIORITY 0x2 struct be_async_event_trailer { u32 code; }; enum { ASYNC_EVENT_LINK_DOWN = 0x0, ASYNC_EVENT_LINK_UP = 0x1 }; /* When the event code of an async trailer is link-state, the mcc_compl * must be interpreted as follows */ struct be_async_event_link_state { u8 physical_port; u8 port_link_status; u8 port_duplex; u8 port_speed; u8 port_fault; u8 rsvd0[7]; struct be_async_event_trailer trailer; } __packed; /* When the event code of an async trailer is GRP-5 and event_type is QOS_SPEED * the mcc_compl must be interpreted as follows */ struct be_async_event_grp5_qos_link_speed { u8 physical_port; u8 rsvd[5]; u16 qos_link_speed; u32 event_tag; struct be_async_event_trailer trailer; } __packed; /* When the event code of an async trailer is GRP5 and event type is * CoS-Priority, the mcc_compl must be interpreted as follows */ struct be_async_event_grp5_cos_priority { u8 physical_port; u8 available_priority_bmap; u8 reco_default_priority; u8 valid; u8 rsvd0; u8 event_tag; struct be_async_event_trailer trailer; } __packed; struct be_mcc_mailbox { struct be_mcc_wrb wrb; struct be_mcc_compl compl; }; #define CMD_SUBSYSTEM_COMMON 0x1 #define CMD_SUBSYSTEM_ETH 0x3 #define CMD_SUBSYSTEM_LOWLEVEL 0xb #define OPCODE_COMMON_NTWK_MAC_QUERY 1 #define OPCODE_COMMON_NTWK_MAC_SET 2 #define OPCODE_COMMON_NTWK_MULTICAST_SET 3 #define OPCODE_COMMON_NTWK_VLAN_CONFIG 4 #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5 #define OPCODE_COMMON_READ_FLASHROM 6 #define OPCODE_COMMON_WRITE_FLASHROM 7 #define OPCODE_COMMON_CQ_CREATE 12 #define OPCODE_COMMON_EQ_CREATE 13 #define OPCODE_COMMON_MCC_CREATE 21 #define OPCODE_COMMON_SET_QOS 28 #define OPCODE_COMMON_MCC_CREATE_EXT 90 #define OPCODE_COMMON_SEEPROM_READ 30 #define OPCODE_COMMON_NTWK_RX_FILTER 34 #define OPCODE_COMMON_GET_FW_VERSION 35 #define OPCODE_COMMON_SET_FLOW_CONTROL 36 #define OPCODE_COMMON_GET_FLOW_CONTROL 37 #define OPCODE_COMMON_SET_FRAME_SIZE 39 #define OPCODE_COMMON_MODIFY_EQ_DELAY 41 #define OPCODE_COMMON_FIRMWARE_CONFIG 42 #define OPCODE_COMMON_NTWK_INTERFACE_CREATE 50 #define OPCODE_COMMON_NTWK_INTERFACE_DESTROY 51 #define OPCODE_COMMON_MCC_DESTROY 53 #define OPCODE_COMMON_CQ_DESTROY 54 #define OPCODE_COMMON_EQ_DESTROY 55 #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58 #define OPCODE_COMMON_NTWK_PMAC_ADD 59 #define OPCODE_COMMON_NTWK_PMAC_DEL 60 #define OPCODE_COMMON_FUNCTION_RESET 61 #define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69 #define OPCODE_COMMON_GET_BEACON_STATE 70 #define OPCODE_COMMON_READ_TRANSRECV_DATA 73 #define OPCODE_COMMON_GET_PHY_DETAILS 102 #define OPCODE_ETH_RSS_CONFIG 1 #define OPCODE_ETH_ACPI_CONFIG 2 #define OPCODE_ETH_PROMISCUOUS 3 #define OPCODE_ETH_GET_STATISTICS 4 #define OPCODE_ETH_TX_CREATE 7 #define OPCODE_ETH_RX_CREATE 8 #define OPCODE_ETH_TX_DESTROY 9 #define OPCODE_ETH_RX_DESTROY 10 #define OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG 12 #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17 #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18 #define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19 struct be_cmd_req_hdr { u8 opcode; /* dword 0 */ u8 subsystem; /* dword 0 */ u8 port_number; /* dword 0 */ u8 domain; /* dword 0 */ u32 timeout; /* dword 1 */ u32 request_length; /* dword 2 */ u8 version; /* dword 3 */ u8 rsvd[3]; /* dword 3 */ }; #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ #define RESP_HDR_INFO_SUBSYS_SHIFT 8 /* bits 8 - 15 */ struct be_cmd_resp_hdr { u32 info; /* dword 0 */ u32 status; /* dword 1 */ u32 response_length; /* dword 2 */ u32 actual_resp_len; /* dword 3 */ }; struct phys_addr { u32 lo; u32 hi; }; /************************** * BE Command definitions * **************************/ /* Pseudo amap definition in which each bit of the actual structure is defined * as a byte: used to calculate offset/shift/mask of each field */ struct amap_eq_context { u8 cidx[13]; /* dword 0*/ u8 rsvd0[3]; /* dword 0*/ u8 epidx[13]; /* dword 0*/ u8 valid; /* dword 0*/ u8 rsvd1; /* dword 0*/ u8 size; /* dword 0*/ u8 pidx[13]; /* dword 1*/ u8 rsvd2[3]; /* dword 1*/ u8 pd[10]; /* dword 1*/ u8 count[3]; /* dword 1*/ u8 solevent; /* dword 1*/ u8 stalled; /* dword 1*/ u8 armed; /* dword 1*/ u8 rsvd3[4]; /* dword 2*/ u8 func[8]; /* dword 2*/ u8 rsvd4; /* dword 2*/ u8 delaymult[10]; /* dword 2*/ u8 rsvd5[2]; /* dword 2*/ u8 phase[2]; /* dword 2*/ u8 nodelay; /* dword 2*/ u8 rsvd6[4]; /* dword 2*/ u8 rsvd7[32]; /* dword 3*/ } __packed; struct be_cmd_req_eq_create { struct be_cmd_req_hdr hdr; u16 num_pages; /* sword */ u16 rsvd0; /* sword */ u8 context[sizeof(struct amap_eq_context) / 8]; struct phys_addr pages[8]; } __packed; struct be_cmd_resp_eq_create { struct be_cmd_resp_hdr resp_hdr; u16 eq_id; /* sword */ u16 rsvd0; /* sword */ } __packed; /******************** Mac query ***************************/ enum { MAC_ADDRESS_TYPE_STORAGE = 0x0, MAC_ADDRESS_TYPE_NETWORK = 0x1, MAC_ADDRESS_TYPE_PD = 0x2, MAC_ADDRESS_TYPE_MANAGEMENT = 0x3 }; struct mac_addr { u16 size_of_struct; u8 addr[ETH_ALEN]; } __packed; struct be_cmd_req_mac_query { struct be_cmd_req_hdr hdr; u8 type; u8 permanent; u16 if_id; } __packed; struct be_cmd_resp_mac_query { struct be_cmd_resp_hdr hdr; struct mac_addr mac; }; /******************** PMac Add ***************************/ struct be_cmd_req_pmac_add { struct be_cmd_req_hdr hdr; u32 if_id; u8 mac_address[ETH_ALEN]; u8 rsvd0[2]; } __packed; struct be_cmd_resp_pmac_add { struct be_cmd_resp_hdr hdr; u32 pmac_id; }; /******************** PMac Del ***************************/ struct be_cmd_req_pmac_del { struct be_cmd_req_hdr hdr; u32 if_id; u32 pmac_id; }; /******************** Create CQ ***************************/ /* Pseudo amap definition in which each bit of the actual structure is defined * as a byte: used to calculate offset/shift/mask of each field */ struct amap_cq_context { u8 cidx[11]; /* dword 0*/ u8 rsvd0; /* dword 0*/ u8 coalescwm[2]; /* dword 0*/ u8 nodelay; /* dword 0*/ u8 epidx[11]; /* dword 0*/ u8 rsvd1; /* dword 0*/ u8 count[2]; /* dword 0*/ u8 valid; /* dword 0*/ u8 solevent; /* dword 0*/ u8 eventable; /* dword 0*/ u8 pidx[11]; /* dword 1*/ u8 rsvd2; /* dword 1*/ u8 pd[10]; /* dword 1*/ u8 eqid[8]; /* dword 1*/ u8 stalled; /* dword 1*/ u8 armed; /* dword 1*/ u8 rsvd3[4]; /* dword 2*/ u8 func[8]; /* dword 2*/ u8 rsvd4[20]; /* dword 2*/ u8 rsvd5[32]; /* dword 3*/ } __packed; struct be_cmd_req_cq_create { struct be_cmd_req_hdr hdr; u16 num_pages; u16 rsvd0; u8 context[sizeof(struct amap_cq_context) / 8]; struct phys_addr pages[8]; } __packed; struct be_cmd_resp_cq_create { struct be_cmd_resp_hdr hdr; u16 cq_id; u16 rsvd0; } __packed; /******************** Create MCCQ ***************************/ /* Pseudo amap definition in which each bit of the actual structure is defined * as a byte: used to calculate offset/shift/mask of each field */ struct amap_mcc_context { u8 con_index[14]; u8 rsvd0[2]; u8 ring_size[4]; u8 fetch_wrb; u8 fetch_r2t; u8 cq_id[10]; u8 prod_index[14]; u8 fid[8]; u8 pdid[9]; u8 valid; u8 rsvd1[32]; u8 rsvd2[32]; } __packed; struct be_cmd_req_mcc_create { struct be_cmd_req_hdr hdr; u16 num_pages; u16 rsvd0; u32 async_event_bitmap[1]; u8 context[sizeof(struct amap_mcc_context) / 8]; struct phys_addr pages[8]; } __packed; struct be_cmd_resp_mcc_create { struct be_cmd_resp_hdr hdr; u16 id; u16 rsvd0; } __packed; /******************** Create TxQ ***************************/ #define BE_ETH_TX_RING_TYPE_STANDARD 2 #define BE_ULP1_NUM 1 /* Pseudo amap definition in which each bit of the actual structure is defined * as a byte: used to calculate offset/shift/mask of each field */ struct amap_tx_context { u8 rsvd0[16]; /* dword 0 */ u8 tx_ring_size[4]; /* dword 0 */ u8 rsvd1[26]; /* dword 0 */ u8 pci_func_id[8]; /* dword 1 */ u8 rsvd2[9]; /* dword 1 */ u8 ctx_valid; /* dword 1 */ u8 cq_id_send[16]; /* dword 2 */ u8 rsvd3[16]; /* dword 2 */ u8 rsvd4[32]; /* dword 3 */ u8 rsvd5[32]; /* dword 4 */ u8 rsvd6[32]; /* dword 5 */ u8 rsvd7[32]; /* dword 6 */ u8 rsvd8[32]; /* dword 7 */ u8 rsvd9[32]; /* dword 8 */ u8 rsvd10[32]; /* dword 9 */ u8 rsvd11[32]; /* dword 10 */ u8 rsvd12[32]; /* dword 11 */ u8 rsvd13[32]; /* dword 12 */ u8 rsvd14[32]; /* dword 13 */ u8 rsvd15[32]; /* dword 14 */ u8 rsvd16[32]; /* dword 15 */ } __packed; struct be_cmd_req_eth_tx_create { struct be_cmd_req_hdr hdr; u8 num_pages; u8 ulp_num; u8 type; u8 bound_port; u8 context[sizeof(struct amap_tx_context) / 8]; struct phys_addr pages[8]; } __packed; struct be_cmd_resp_eth_tx_create { struct be_cmd_resp_hdr hdr; u16 cid; u16 rsvd0; } __packed; /******************** Create RxQ ***************************/ struct be_cmd_req_eth_rx_create { struct be_cmd_req_hdr hdr; u16 cq_id; u8 frag_size; u8 num_pages; struct phys_addr pages[2]; u32 interface_id; u16 max_frame_size; u16 rsvd0; u32 rss_queue; } __packed; struct be_cmd_resp_eth_rx_create { struct be_cmd_resp_hdr hdr; u16 id; u8 rss_id; u8 rsvd0; } __packed; /******************** Q Destroy ***************************/ /* Type of Queue to be destroyed */ enum { QTYPE_EQ = 1, QTYPE_CQ, QTYPE_TXQ, QTYPE_RXQ, QTYPE_MCCQ }; struct be_cmd_req_q_destroy { struct be_cmd_req_hdr hdr; u16 id; u16 bypass_flush; /* valid only for rx q destroy */ } __packed; /************ I/f Create (it's actually I/f Config Create)**********/ /* Capability flags for the i/f */ enum be_if_flags { BE_IF_FLAGS_RSS = 0x4, BE_IF_FLAGS_PROMISCUOUS = 0x8, BE_IF_FLAGS_BROADCAST = 0x10, BE_IF_FLAGS_UNTAGGED = 0x20, BE_IF_FLAGS_ULP = 0x40, BE_IF_FLAGS_VLAN_PROMISCUOUS = 0x80, BE_IF_FLAGS_VLAN = 0x100, BE_IF_FLAGS_MCAST_PROMISCUOUS = 0x200, BE_IF_FLAGS_PASS_L2_ERRORS = 0x400, BE_IF_FLAGS_PASS_L3L4_ERRORS = 0x800 }; /* An RX interface is an object with one or more MAC addresses and * filtering capabilities. */ struct be_cmd_req_if_create { struct be_cmd_req_hdr hdr; u32 version; /* ignore currently */ u32 capability_flags; u32 enable_flags; u8 mac_addr[ETH_ALEN]; u8 rsvd0; u8 pmac_invalid; /* if set, don't attach the mac addr to the i/f */ u32 vlan_tag; /* not used currently */ } __packed; struct be_cmd_resp_if_create { struct be_cmd_resp_hdr hdr; u32 interface_id; u32 pmac_id; }; /****** I/f Destroy(it's actually I/f Config Destroy )**********/ struct be_cmd_req_if_destroy { struct be_cmd_req_hdr hdr; u32 interface_id; }; /*************** HW Stats Get **********************************/ struct be_port_rxf_stats { u32 rx_bytes_lsd; /* dword 0*/ u32 rx_bytes_msd; /* dword 1*/ u32 rx_total_frames; /* dword 2*/ u32 rx_unicast_frames; /* dword 3*/ u32 rx_multicast_frames; /* dword 4*/ u32 rx_broadcast_frames; /* dword 5*/ u32 rx_crc_errors; /* dword 6*/ u32 rx_alignment_symbol_errors; /* dword 7*/ u32 rx_pause_frames; /* dword 8*/ u32 rx_control_frames; /* dword 9*/ u32 rx_in_range_errors; /* dword 10*/ u32 rx_out_range_errors; /* dword 11*/ u32 rx_frame_too_long; /* dword 12*/ u32 rx_address_match_errors; /* dword 13*/ u32 rx_vlan_mismatch; /* dword 14*/ u32 rx_dropped_too_small; /* dword 15*/ u32 rx_dropped_too_short; /* dword 16*/ u32 rx_dropped_header_too_small; /* dword 17*/ u32 rx_dropped_tcp_length; /* dword 18*/ u32 rx_dropped_runt; /* dword 19*/ u32 rx_64_byte_packets; /* dword 20*/ u32 rx_65_127_byte_packets; /* dword 21*/ u32 rx_128_256_byte_packets; /* dword 22*/ u32 rx_256_511_byte_packets; /* dword 23*/ u32 rx_512_1023_byte_packets; /* dword 24*/ u32 rx_1024_1518_byte_packets; /* dword 25*/ u32 rx_1519_2047_byte_packets; /* dword 26*/ u32 rx_2048_4095_byte_packets; /* dword 27*/ u32 rx_4096_8191_byte_packets; /* dword 28*/ u32 rx_8192_9216_byte_packets; /* dword 29*/ u32 rx_ip_checksum_errs; /* dword 30*/ u32 rx_tcp_checksum_errs; /* dword 31*/ u32 rx_udp_checksum_errs; /* dword 32*/ u32 rx_non_rss_packets; /* dword 33*/ u32 rx_ipv4_packets; /* dword 34*/ u32 rx_ipv6_packets; /* dword 35*/ u32 rx_ipv4_bytes_lsd; /* dword 36*/ u32 rx_ipv4_bytes_msd; /* dword 37*/ u32 rx_ipv6_bytes_lsd; /* dword 38*/ u32 rx_ipv6_bytes_msd; /* dword 39*/ u32 rx_chute1_packets; /* dword 40*/ u32 rx_chute2_packets; /* dword 41*/ u32 rx_chute3_packets; /* dword 42*/ u32 rx_management_packets; /* dword 43*/ u32 rx_switched_unicast_packets; /* dword 44*/ u32 rx_switched_multicast_packets; /* dword 45*/ u32 rx_switched_broadcast_packets; /* dword 46*/ u32 tx_bytes_lsd; /* dword 47*/ u32 tx_bytes_msd; /* dword 48*/ u32 tx_unicastframes; /* dword 49*/ u32 tx_multicastframes; /* dword 50*/ u32 tx_broadcastframes; /* dword 51*/ u32 tx_pauseframes; /* dword 52*/ u32 tx_controlframes; /* dword 53*/ u32 tx_64_byte_packets; /* dword 54*/ u32 tx_65_127_byte_packets; /* dword 55*/ u32 tx_128_256_byte_packets; /* dword 56*/ u32 tx_256_511_byte_packets; /* dword 57*/ u32 tx_512_1023_byte_packets; /* dword 58*/ u32 tx_1024_1518_byte_packets; /* dword 59*/ u32 tx_1519_2047_byte_packets; /* dword 60*/ u32 tx_2048_4095_byte_packets; /* dword 61*/ u32 tx_4096_8191_byte_packets; /* dword 62*/ u32 tx_8192_9216_byte_packets; /* dword 63*/ u32 rx_fifo_overflow; /* dword 64*/ u32 rx_input_fifo_overflow; /* dword 65*/ }; struct be_rxf_stats { struct be_port_rxf_stats port[2]; u32 rx_drops_no_pbuf; /* dword 132*/ u32 rx_drops_no_txpb; /* dword 133*/ u32 rx_drops_no_erx_descr; /* dword 134*/ u32 rx_drops_no_tpre_descr; /* dword 135*/ u32 management_rx_port_packets; /* dword 136*/ u32 management_rx_port_bytes; /* dword 137*/ u32 management_rx_port_pause_frames; /* dword 138*/ u32 management_rx_port_errors; /* dword 139*/ u32 management_tx_port_packets; /* dword 140*/ u32 management_tx_port_bytes; /* dword 141*/ u32 management_tx_port_pause; /* dword 142*/ u32 management_rx_port_rxfifo_overflow; /* dword 143*/ u32 rx_drops_too_many_frags; /* dword 144*/ u32 rx_drops_invalid_ring; /* dword 145*/ u32 forwarded_packets; /* dword 146*/ u32 rx_drops_mtu; /* dword 147*/ u32 rsvd0[15]; }; struct be_erx_stats { u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/ u32 debug_wdma_sent_hold; /* dword 44*/ u32 debug_wdma_pbfree_sent_hold; /* dword 45*/ u32 debug_wdma_zerobyte_pbfree_sent_hold; /* dword 46*/ u32 debug_pmem_pbuf_dealloc; /* dword 47*/ }; struct be_hw_stats { struct be_rxf_stats rxf; u32 rsvd[48]; struct be_erx_stats erx; }; struct be_cmd_req_get_stats { struct be_cmd_req_hdr hdr; u8 rsvd[sizeof(struct be_hw_stats)]; }; struct be_cmd_resp_get_stats { struct be_cmd_resp_hdr hdr; struct be_hw_stats hw_stats; }; struct be_cmd_req_vlan_config { struct be_cmd_req_hdr hdr; u8 interface_id; u8 promiscuous; u8 untagged; u8 num_vlan; u16 normal_vlan[64]; } __packed; struct be_cmd_req_promiscuous_config { struct be_cmd_req_hdr hdr; u8 port0_promiscuous; u8 port1_promiscuous; u16 rsvd0; } __packed; /******************** Multicast MAC Config *******************/ #define BE_MAX_MC 64 /* set mcast promisc if > 64 */ struct macaddr { u8 byte[ETH_ALEN]; }; struct be_cmd_req_mcast_mac_config { struct be_cmd_req_hdr hdr; u16 num_mac; u8 promiscuous; u8 interface_id; struct macaddr mac[BE_MAX_MC]; } __packed; static inline struct be_hw_stats * hw_stats_from_cmd(struct be_cmd_resp_get_stats *cmd) { return &cmd->hw_stats; } /******************** Link Status Query *******************/ struct be_cmd_req_link_status { struct be_cmd_req_hdr hdr; u32 rsvd; }; enum { PHY_LINK_DUPLEX_NONE = 0x0, PHY_LINK_DUPLEX_HALF = 0x1, PHY_LINK_DUPLEX_FULL = 0x2 }; enum { PHY_LINK_SPEED_ZERO = 0x0, /* => No link */ PHY_LINK_SPEED_10MBPS = 0x1, PHY_LINK_SPEED_100MBPS = 0x2, PHY_LINK_SPEED_1GBPS = 0x3, PHY_LINK_SPEED_10GBPS = 0x4 }; struct be_cmd_resp_link_status { struct be_cmd_resp_hdr hdr; u8 physical_port; u8 mac_duplex; u8 mac_speed; u8 mac_fault; u8 mgmt_mac_duplex; u8 mgmt_mac_speed; u16 link_speed; u32 rsvd0; } __packed; /******************** Port Identification ***************************/ /* Identifies the type of port attached to NIC */ struct be_cmd_req_port_type { struct be_cmd_req_hdr hdr; u32 page_num; u32 port; }; enum { TR_PAGE_A0 = 0xa0, TR_PAGE_A2 = 0xa2 }; struct be_cmd_resp_port_type { struct be_cmd_resp_hdr hdr; u32 page_num; u32 port; struct data { u8 identifier; u8 identifier_ext; u8 connector; u8 transceiver[8]; u8 rsvd0[3]; u8 length_km; u8 length_hm; u8 length_om1; u8 length_om2; u8 length_cu; u8 length_cu_m; u8 vendor_name[16]; u8 rsvd; u8 vendor_oui[3]; u8 vendor_pn[16]; u8 vendor_rev[4]; } data; }; /******************** Get FW Version *******************/ struct be_cmd_req_get_fw_version { struct be_cmd_req_hdr hdr; u8 rsvd0[FW_VER_LEN]; u8 rsvd1[FW_VER_LEN]; } __packed; struct be_cmd_resp_get_fw_version { struct be_cmd_resp_hdr hdr; u8 firmware_version_string[FW_VER_LEN]; u8 fw_on_flash_version_string[FW_VER_LEN]; } __packed; /******************** Set Flow Contrl *******************/ struct be_cmd_req_set_flow_control { struct be_cmd_req_hdr hdr; u16 tx_flow_control; u16 rx_flow_control; } __packed; /******************** Get Flow Contrl *******************/ struct be_cmd_req_get_flow_control { struct be_cmd_req_hdr hdr; u32 rsvd; }; struct be_cmd_resp_get_flow_control { struct be_cmd_resp_hdr hdr; u16 tx_flow_control; u16 rx_flow_control; } __packed; /******************** Modify EQ Delay *******************/ struct be_cmd_req_modify_eq_delay { struct be_cmd_req_hdr hdr; u32 num_eq; struct { u32 eq_id; u32 phase; u32 delay_multiplier; } delay[8]; } __packed; struct be_cmd_resp_modify_eq_delay { struct be_cmd_resp_hdr hdr; u32 rsvd0; } __packed; /******************** Get FW Config *******************/ #define BE_FUNCTION_CAPS_RSS 0x2 struct be_cmd_req_query_fw_cfg { struct be_cmd_req_hdr hdr; u32 rsvd[31]; }; struct be_cmd_resp_query_fw_cfg { struct be_cmd_resp_hdr hdr; u32 be_config_number; u32 asic_revision; u32 phys_port; u32 function_mode; u32 rsvd[26]; u32 function_caps; }; /******************** RSS Config *******************/ /* RSS types */ #define RSS_ENABLE_NONE 0x0 #define RSS_ENABLE_IPV4 0x1 #define RSS_ENABLE_TCP_IPV4 0x2 #define RSS_ENABLE_IPV6 0x4 #define RSS_ENABLE_TCP_IPV6 0x8 struct be_cmd_req_rss_config { struct be_cmd_req_hdr hdr; u32 if_id; u16 enable_rss; u16 cpu_table_size_log2; u32 hash[10]; u8 cpu_table[128]; u8 flush; u8 rsvd0[3]; }; /******************** Port Beacon ***************************/ #define BEACON_STATE_ENABLED 0x1 #define BEACON_STATE_DISABLED 0x0 struct be_cmd_req_enable_disable_beacon { struct be_cmd_req_hdr hdr; u8 port_num; u8 beacon_state; u8 beacon_duration; u8 status_duration; } __packed; struct be_cmd_resp_enable_disable_beacon { struct be_cmd_resp_hdr resp_hdr; u32 rsvd0; } __packed; struct be_cmd_req_get_beacon_state { struct be_cmd_req_hdr hdr; u8 port_num; u8 rsvd0; u16 rsvd1; } __packed; struct be_cmd_resp_get_beacon_state { struct be_cmd_resp_hdr resp_hdr; u8 beacon_state; u8 rsvd0[3]; } __packed; /****************** Firmware Flash ******************/ struct flashrom_params { u32 op_code; u32 op_type; u32 data_buf_size; u32 offset; u8 data_buf[4]; }; struct be_cmd_write_flashrom { struct be_cmd_req_hdr hdr; struct flashrom_params params; }; /************************ WOL *******************************/ struct be_cmd_req_acpi_wol_magic_config{ struct be_cmd_req_hdr hdr; u32 rsvd0[145]; u8 magic_mac[6]; u8 rsvd2[2]; } __packed; /********************** LoopBack test *********************/ struct be_cmd_req_loopback_test { struct be_cmd_req_hdr hdr; u32 loopback_type; u32 num_pkts; u64 pattern; u32 src_port; u32 dest_port; u32 pkt_size; }; struct be_cmd_resp_loopback_test { struct be_cmd_resp_hdr resp_hdr; u32 status; u32 num_txfer; u32 num_rx; u32 miscomp_off; u32 ticks_compl; }; struct be_cmd_req_set_lmode { struct be_cmd_req_hdr hdr; u8 src_port; u8 dest_port; u8 loopback_type; u8 loopback_state; }; struct be_cmd_resp_set_lmode { struct be_cmd_resp_hdr resp_hdr; u8 rsvd0[4]; }; /********************** DDR DMA test *********************/ struct be_cmd_req_ddrdma_test { struct be_cmd_req_hdr hdr; u64 pattern; u32 byte_count; u32 rsvd0; u8 snd_buff[4096]; u8 rsvd1[4096]; }; struct be_cmd_resp_ddrdma_test { struct be_cmd_resp_hdr hdr; u64 pattern; u32 byte_cnt; u32 snd_err; u8 rsvd0[4096]; u8 rcv_buff[4096]; }; /*********************** SEEPROM Read ***********************/ #define BE_READ_SEEPROM_LEN 1024 struct be_cmd_req_seeprom_read { struct be_cmd_req_hdr hdr; u8 rsvd0[BE_READ_SEEPROM_LEN]; }; struct be_cmd_resp_seeprom_read { struct be_cmd_req_hdr hdr; u8 seeprom_data[BE_READ_SEEPROM_LEN]; }; enum { PHY_TYPE_CX4_10GB = 0, PHY_TYPE_XFP_10GB, PHY_TYPE_SFP_1GB, PHY_TYPE_SFP_PLUS_10GB, PHY_TYPE_KR_10GB, PHY_TYPE_KX4_10GB, PHY_TYPE_BASET_10GB, PHY_TYPE_BASET_1GB, PHY_TYPE_DISABLED = 255 }; struct be_cmd_req_get_phy_info { struct be_cmd_req_hdr hdr; u8 rsvd0[24]; }; struct be_cmd_resp_get_phy_info { struct be_cmd_req_hdr hdr; u16 phy_type; u16 interface_type; u32 misc_params; u32 future_use[4]; }; /*********************** Set QOS ***********************/ #define BE_QOS_BITS_NIC 1 struct be_cmd_req_set_qos { struct be_cmd_req_hdr hdr; u32 valid_bits; u32 max_bps_nic; u32 rsvd[7]; }; struct be_cmd_resp_set_qos { struct be_cmd_resp_hdr hdr; u32 rsvd; }; extern int be_pci_fnum_get(struct be_adapter *adapter); extern int be_cmd_POST(struct be_adapter *adapter); extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, u8 type, bool permanent, u32 if_handle); extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, u32 if_id, u32 *pmac_id); extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id); extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, u8 *mac, bool pmac_invalid, u32 *if_handle, u32 *pmac_id, u32 domain); extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle); extern int be_cmd_eq_create(struct be_adapter *adapter, struct be_queue_info *eq, int eq_delay); extern int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq, struct be_queue_info *eq, bool sol_evts, bool no_delay, int num_cqe_dma_coalesce); extern int be_cmd_mccq_create(struct be_adapter *adapter, struct be_queue_info *mccq, struct be_queue_info *cq); extern int be_cmd_txq_create(struct be_adapter *adapter, struct be_queue_info *txq, struct be_queue_info *cq); extern int be_cmd_rxq_create(struct be_adapter *adapter, struct be_queue_info *rxq, u16 cq_id, u16 frag_size, u16 max_frame_size, u32 if_id, u32 rss, u8 *rss_id); extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, int type); extern int be_cmd_link_status_query(struct be_adapter *adapter, bool *link_up, u8 *mac_speed, u16 *link_speed); extern int be_cmd_reset(struct be_adapter *adapter); extern int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd); extern int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver); extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd); extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, u32 num, bool untagged, bool promiscuous); extern int be_cmd_promiscuous_config(struct be_adapter *adapter, u8 port_num, bool en); extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, struct net_device *netdev, struct be_dma_mem *mem); extern int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc); extern int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc); extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, u32 *function_mode, u32 *function_caps); extern int be_cmd_reset_function(struct be_adapter *adapter); extern int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, u16 table_size); extern int be_process_mcc(struct be_adapter *adapter, int *status); extern int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon, u8 status, u8 state); extern int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state); extern int be_cmd_read_port_type(struct be_adapter *adapter, u32 port, u8 *connector); extern int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, u32 flash_oper, u32 flash_opcode, u32 buf_size); int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, int offset); extern int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, struct be_dma_mem *nonemb_cmd); extern int be_cmd_fw_init(struct be_adapter *adapter); extern int be_cmd_fw_clean(struct be_adapter *adapter); extern void be_async_mcc_enable(struct be_adapter *adapter); extern void be_async_mcc_disable(struct be_adapter *adapter); extern int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern); extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, u32 byte_cnt, struct be_dma_mem *cmd); extern int be_cmd_get_seeprom_data(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd); extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, u8 loopback_type, u8 enable); extern int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd); extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); extern void be_detect_dump_ue(struct be_adapter *adapter);
gpl-2.0
dilawar/moogli
docs/doxygen/html/HTML/Y/324.html
906
<html> <head> <title>setColorArray</title> <meta name='robots' content='noindex,nofollow'> <meta name='generator' content='GLOBAL-5.7.1'> </head> <body text='#191970' bgcolor='#f5f5dc' vlink='gray'> <pre> <a href='../S/7.html#L198'>setColorArray</a> 198 src/core/Compartment.cpp geometry -&gt; setColorArray(colors, osg::Array::BIND_OVERALL); <a href='../S/8.html#L192'>setColorArray</a> 192 src/core/Neuron.cpp geometry -&gt; setColorArray(colors, osg::Array::BIND_OVERALL); <a href='../S/9.html#L84'>setColorArray</a> 84 src/core/Voxel.cpp node -&gt; setColorArray(colors, osg::Array::BIND_OVERALL); <a href='../S/1.html#L243'>setColorArray</a> 243 src/mesh/CylinderMesh.cpp geometry -&gt; setColorArray(colors); <a href='../S/2.html#L167'>setColorArray</a> 167 src/mesh/SphereMesh.cpp geometry -&gt; setColorArray(colors); </pre> </body> </html>
gpl-2.0
mihaienescu1/wp_wmihu
wp-content/themes/presentation-lite/inc/customizer.php
8069
<?php /** * Theme Customizer */ function presentation_lite_customize_register( $wp_customize ) { /** =============== * Extends CONTROLS class to add textarea */ class presentation_lite_customize_textarea_control extends WP_Customize_Control { public $type = 'textarea'; public function render_content() { ?> <label> <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> <textarea rows="5" style="width:98%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea> </label> <?php } } /** =============== * Site Title (Logo) & Tagline */ // section adjustments $wp_customize->get_section( 'title_tagline' )->title = __( 'Site Title (Logo) & Tagline', 'presentation_lite' ); $wp_customize->get_section( 'title_tagline' )->priority = 10; //site title $wp_customize->get_control( 'blogname' )->priority = 10; $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; // tagline $wp_customize->get_control( 'blogdescription' )->priority = 30; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // logo uploader $wp_customize->add_setting( 'presentation_lite_logo', array( 'default' => null ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'presentation_lite_logo', array( 'label' => __( 'Custom Site Logo (replaces title)', 'presentation_lite' ), 'section' => 'title_tagline', 'settings' => 'presentation_lite_logo', 'priority' => 20 ) ) ); /** =============== * Presentation Lite Design Options */ $wp_customize->add_section( 'presentation_lite_style_section', array( 'title' => __( 'Design Options', 'presentation_lite' ), 'description' => __( 'Choose a color scheme for Presentation Lite. Individual styles can be overwritten in your child theme stylesheet.', 'presentation_lite' ), 'priority' => 25, ) ); $wp_customize->add_setting( 'presentation_lite_stylesheet', array( 'default' => 'blue', 'sanitize_callback' => 'presentation_lite_sanitize_stylesheet' ) ); $wp_customize->add_control( 'presentation_lite_stylesheet', array( 'type' => 'select', 'label' => __( 'Choose a color scheme:', 'presentation_lite' ), 'section' => 'presentation_lite_style_section', 'choices' => array( 'blue' => 'Blue', 'purple' => 'Purple', 'red' => 'Red', 'gray' => 'Gray' ) ) ); /** =============== * Content Options */ $wp_customize->add_section( 'presentation_lite_content_section', array( 'title' => __( 'Content Options', 'presentation_lite' ), 'description' => __( 'Adjust the display of content on your website. All options have a default value that can be left as-is but you are free to customize.', 'presentation_lite' ), 'priority' => 20, ) ); // post content $wp_customize->add_setting( 'presentation_lite_post_content', array( 'default' => 'full_content', 'sanitize_callback' => 'presentation_lite_sanitize_radio' ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'presentation_lite_post_content', array( 'label' => __( 'Post Feed Content', 'presentation_lite' ), 'section' => 'presentation_lite_content_section', 'settings' => 'presentation_lite_post_content', 'priority' => 10, 'type' => 'radio', 'choices' => array( 'excerpt' => 'Excerpt', 'full_content' => 'Full Content' ), ) ) ); // show single post footer? $wp_customize->add_setting( 'presentation_lite_post_footer', array( 'default' => 1, 'sanitize_callback' => 'presentation_lite_sanitize_checkbox' ) ); $wp_customize->add_control( 'presentation_lite_post_footer', array( 'label' => __( 'Show Post Footer on Single Posts?', 'presentation_lite' ), 'section' => 'presentation_lite_content_section', 'priority' => 50, 'type' => 'checkbox', ) ); // twitter url $wp_customize->add_setting( 'presentation_lite_twitter', array( 'default' => null, 'sanitize_callback' => 'presentation_lite_sanitize_text' ) ); $wp_customize->add_control( 'presentation_lite_twitter', array( 'label' => __( 'Twitter Profile URL', 'presentation_lite' ), 'section' => 'presentation_lite_content_section', 'settings' => 'presentation_lite_twitter', 'priority' => 80, ) ); // facebook url $wp_customize->add_setting( 'presentation_lite_facebook', array( 'default' => null, 'sanitize_callback' => 'presentation_lite_sanitize_text' ) ); $wp_customize->add_control( 'presentation_lite_facebook', array( 'label' => __( 'Facebook Profile URL', 'presentation_lite' ), 'section' => 'presentation_lite_content_section', 'settings' => 'presentation_lite_facebook', 'priority' => 90, ) ); // google plus url $wp_customize->add_setting( 'presentation_lite_gplus', array( 'default' => null, 'sanitize_callback' => 'presentation_lite_sanitize_text' ) ); $wp_customize->add_control( 'presentation_lite_gplus', array( 'label' => __( 'Google Plus Profile URL', 'presentation_lite' ), 'section' => 'presentation_lite_content_section', 'settings' => 'presentation_lite_gplus', 'priority' => 100, ) ); // linkedin url $wp_customize->add_setting( 'presentation_lite_linkedin', array( 'default' => null, 'sanitize_callback' => 'presentation_lite_sanitize_text' ) ); $wp_customize->add_control( 'presentation_lite_linkedin', array( 'label' => __( 'LinkedIn Profile URL', 'presentation_lite' ), 'section' => 'presentation_lite_content_section', 'settings' => 'presentation_lite_linkedin', 'priority' => 110, ) ); /** =============== * Navigation Menu(s) */ // section adjustments $wp_customize->get_section( 'nav' )->title = __( 'Navigation Menu(s)', 'presentation_lite' ); $wp_customize->get_section( 'nav' )->priority = 40; /** =============== * Static Front Page */ // section adjustments $wp_customize->get_section( 'static_front_page' )->priority = 50; } add_action( 'customize_register', 'presentation_lite_customize_register' ); /** =============== * Sanitize the theme design select option */ function presentation_lite_sanitize_stylesheet( $input ) { $valid = array( 'blue' => 'Blue', 'purple' => 'Purple', 'red' => 'Red', 'gray' => 'Gray' ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } /** =============== * Sanitize checkbox options */ function presentation_lite_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return 0; } } /** =============== * Sanitize radio options */ function presentation_lite_sanitize_radio( $input ) { $valid = array( 'excerpt' => 'Excerpt', 'full_content' => 'Full Content' ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } /** =============== * Sanitize text input */ function presentation_lite_sanitize_text( $input ) { return strip_tags( stripslashes( $input ) ); } /** =============== * Add Customizer UI styles to the <head> only on Customizer page */ function presentation_lite_customizer_styles() { ?> <style type="text/css"> body { background: #fff; } #customize-controls #customize-theme-controls .description { display: block; color: #999; margin: 2px 0 15px; font-style: italic; } textarea, input, select, .customize-description { font-size: 12px !important; } .customize-control-title { font-size: 13px !important; margin: 10px 0 3px !important; } .customize-control label { font-size: 12px !important; } </style> <?php } add_action('customize_controls_print_styles', 'presentation_lite_customizer_styles'); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function presentation_lite_customize_preview_js() { wp_enqueue_script( 'presentation_lite_customizer', get_template_directory_uri() . '/inc/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'presentation_lite_customize_preview_js' );
gpl-2.0
kittee/gst-plugins-bad
gst/mpegtsmux/mpegtsmux.c
53868
/* * Copyright 2006, 2007, 2008, 2009, 2010 Fluendo S.A. * Authors: Jan Schmidt <[email protected]> * Kapil Agrawal <[email protected]> * Julien Moutte <[email protected]> * * Copyright (C) 2011 Jan Schmidt <[email protected]> * * This library is licensed under 4 different licenses and you * can choose to use it under the terms of any one of them. The * four licenses are the MPL 1.1, the LGPL, the GPL and the MIT * license. * * MPL: * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * LGPL: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. * * GPL: * * 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * MIT: * * Unless otherwise indicated, Source Code is licensed under MIT license. * See further explanation attached in License Statement (distributed in the file * LICENSE). * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdio.h> #include <string.h> #include <gst/tag/tag.h> #include <gst/video/video.h> #include <gst/mpegts/mpegts.h> #include "mpegtsmux.h" #include "mpegtsmux_aac.h" #include "mpegtsmux_ttxt.h" GST_DEBUG_CATEGORY (mpegtsmux_debug); #define GST_CAT_DEFAULT mpegtsmux_debug enum { PROP_0, PROP_PROG_MAP, PROP_M2TS_MODE, PROP_PAT_INTERVAL, PROP_PMT_INTERVAL, PROP_ALIGNMENT, PROP_SI_INTERVAL }; #define MPEGTSMUX_DEFAULT_ALIGNMENT -1 #define MPEGTSMUX_DEFAULT_M2TS FALSE static GstStaticPadTemplate mpegtsmux_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%d", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("video/mpeg, " "parsed = (boolean) TRUE, " "mpegversion = (int) { 1, 2, 4 }, " "systemstream = (boolean) false; " "video/x-dirac;" "video/x-h264,stream-format=(string)byte-stream," "alignment=(string){au, nal}; " "audio/mpeg, " "parsed = (boolean) TRUE, " "mpegversion = (int) { 1, 2 };" "audio/mpeg, " "framed = (boolean) TRUE, " "mpegversion = (int) 4, stream-format = (string) { raw, adts };" "audio/x-lpcm, " "width = (int) { 16, 20, 24 }, " "rate = (int) { 48000, 96000 }, " "channels = (int) [ 1, 8 ], " "dynamic_range = (int) [ 0, 255 ], " "emphasis = (boolean) { FALSE, TRUE }, " "mute = (boolean) { FALSE, TRUE }; " "audio/x-ac3, framed = (boolean) TRUE;" "audio/x-dts, framed = (boolean) TRUE;" "subpicture/x-dvb;" "application/x-teletext")); static GstStaticPadTemplate mpegtsmux_src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/mpegts, " "systemstream = (boolean) true, " "packetsize = (int) { 188, 192} ") ); static void gst_mpegtsmux_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_mpegtsmux_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static void mpegtsmux_reset (MpegTsMux * mux, gboolean alloc); static void mpegtsmux_dispose (GObject * object); static void alloc_packet_cb (GstBuffer ** _buf, void *user_data); static gboolean new_packet_cb (GstBuffer * buf, void *user_data, gint64 new_pcr); static void release_buffer_cb (guint8 * data, void *user_data); static GstFlowReturn mpegtsmux_collect_packet (MpegTsMux * mux, GstBuffer * buf); static GstFlowReturn mpegtsmux_push_packets (MpegTsMux * mux, gboolean force); static gboolean new_packet_m2ts (MpegTsMux * mux, GstBuffer * buf, gint64 new_pcr); static void mpegtsmux_prepare_srcpad (MpegTsMux * mux); GstFlowReturn mpegtsmux_clip_inc_running_time (GstCollectPads * pads, GstCollectData * cdata, GstBuffer * buf, GstBuffer ** outbuf, gpointer user_data); static GstFlowReturn mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data, GstBuffer * buf, MpegTsMux * mux); static gboolean mpegtsmux_sink_event (GstCollectPads * pads, GstCollectData * data, GstEvent * event, gpointer user_data); static GstPad *mpegtsmux_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name, const GstCaps * caps); static void mpegtsmux_release_pad (GstElement * element, GstPad * pad); static GstStateChangeReturn mpegtsmux_change_state (GstElement * element, GstStateChange transition); static gboolean mpegtsmux_send_event (GstElement * element, GstEvent * event); static void mpegtsmux_set_header_on_caps (MpegTsMux * mux); static gboolean mpegtsmux_src_event (GstPad * pad, GstObject * parent, GstEvent * event); #if 0 static void mpegtsmux_set_index (GstElement * element, GstIndex * index); static GstIndex *mpegtsmux_get_index (GstElement * element); static GstFormat pts_format; static GstFormat spn_format; #endif typedef struct { GstMapInfo map_info; GstBuffer *buffer; } StreamData; G_DEFINE_TYPE (MpegTsMux, mpegtsmux, GST_TYPE_ELEMENT) /* Takes over the ref on the buffer */ static StreamData *stream_data_new (GstBuffer * buffer) { StreamData *res = g_new (StreamData, 1); res->buffer = buffer; gst_buffer_map (buffer, &(res->map_info), GST_MAP_READ); return res; } static void stream_data_free (StreamData * data) { if (data) { gst_buffer_unmap (data->buffer, &data->map_info); gst_buffer_unref (data->buffer); g_free (data); } } #define parent_class mpegtsmux_parent_class static void mpegtsmux_class_init (MpegTsMuxClass * klass) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&mpegtsmux_sink_factory)); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&mpegtsmux_src_factory)); gst_element_class_set_static_metadata (gstelement_class, "MPEG Transport Stream Muxer", "Codec/Muxer", "Multiplexes media streams into an MPEG Transport Stream", "Fluendo <[email protected]>"); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_mpegtsmux_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_mpegtsmux_get_property); gobject_class->dispose = mpegtsmux_dispose; gstelement_class->request_new_pad = mpegtsmux_request_new_pad; gstelement_class->release_pad = mpegtsmux_release_pad; gstelement_class->change_state = mpegtsmux_change_state; gstelement_class->send_event = mpegtsmux_send_event; #if 0 gstelement_class->set_index = GST_DEBUG_FUNCPTR (mpegtsmux_set_index); gstelement_class->get_index = GST_DEBUG_FUNCPTR (mpegtsmux_get_index); #endif g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PROG_MAP, g_param_spec_boxed ("prog-map", "Program map", "A GstStructure specifies the mapping from elementary streams to programs", GST_TYPE_STRUCTURE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_M2TS_MODE, g_param_spec_boolean ("m2ts-mode", "M2TS(192 bytes) Mode", "Set to TRUE to output Blu-Ray disc format with 192 byte packets. " "FALSE for standard TS format with 188 byte packets.", MPEGTSMUX_DEFAULT_M2TS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PAT_INTERVAL, g_param_spec_uint ("pat-interval", "PAT interval", "Set the interval (in ticks of the 90kHz clock) for writing out the PAT table", 1, G_MAXUINT, TSMUX_DEFAULT_PAT_INTERVAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PMT_INTERVAL, g_param_spec_uint ("pmt-interval", "PMT interval", "Set the interval (in ticks of the 90kHz clock) for writing out the PMT table", 1, G_MAXUINT, TSMUX_DEFAULT_PMT_INTERVAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_ALIGNMENT, g_param_spec_int ("alignment", "packet alignment", "Number of packets per buffer (padded with dummy packets on EOS) " "(-1 = auto, 0 = all available packets, 7 for UDP streaming)", -1, G_MAXINT, MPEGTSMUX_DEFAULT_ALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SI_INTERVAL, g_param_spec_uint ("si-interval", "SI interval", "Set the interval (in ticks of the 90kHz clock) for writing out the Service" "Information tables", 1, G_MAXUINT, TSMUX_DEFAULT_SI_INTERVAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } static void mpegtsmux_init (MpegTsMux * mux) { mux->srcpad = gst_pad_new_from_static_template (&mpegtsmux_src_factory, "src"); gst_pad_use_fixed_caps (mux->srcpad); gst_pad_set_event_function (mux->srcpad, GST_DEBUG_FUNCPTR (mpegtsmux_src_event)); gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad); mux->collect = gst_collect_pads_new (); gst_collect_pads_set_buffer_function (mux->collect, (GstCollectPadsBufferFunction) GST_DEBUG_FUNCPTR (mpegtsmux_collected_buffer), mux); gst_collect_pads_set_event_function (mux->collect, (GstCollectPadsEventFunction) GST_DEBUG_FUNCPTR (mpegtsmux_sink_event), mux); gst_collect_pads_set_clip_function (mux->collect, (GstCollectPadsClipFunction) GST_DEBUG_FUNCPTR (mpegtsmux_clip_inc_running_time), mux); mux->adapter = gst_adapter_new (); mux->out_adapter = gst_adapter_new (); /* properties */ mux->m2ts_mode = MPEGTSMUX_DEFAULT_M2TS; mux->pat_interval = TSMUX_DEFAULT_PAT_INTERVAL; mux->pmt_interval = TSMUX_DEFAULT_PMT_INTERVAL; mux->si_interval = TSMUX_DEFAULT_SI_INTERVAL; mux->prog_map = NULL; mux->alignment = MPEGTSMUX_DEFAULT_ALIGNMENT; /* initial state */ mpegtsmux_reset (mux, TRUE); } static void mpegtsmux_pad_reset (MpegTsPadData * pad_data) { pad_data->pid = 0; pad_data->dts = GST_CLOCK_STIME_NONE; pad_data->prog_id = -1; #if 0 pad_data->prog_id = -1; pad_data->element_index_writer_id = -1; #endif if (pad_data->free_func) pad_data->free_func (pad_data->prepare_data); pad_data->prepare_data = NULL; pad_data->prepare_func = NULL; pad_data->free_func = NULL; if (pad_data->codec_data) gst_buffer_replace (&pad_data->codec_data, NULL); /* reference owned elsewhere */ pad_data->stream = NULL; pad_data->prog = NULL; if (pad_data->language) { g_free (pad_data->language); pad_data->language = NULL; } } static void mpegtsmux_reset (MpegTsMux * mux, gboolean alloc) { GSList *walk; mux->first = TRUE; mux->last_flow_ret = GST_FLOW_OK; mux->previous_pcr = -1; mux->pcr_rate_num = mux->pcr_rate_den = 1; mux->last_ts = 0; mux->is_delta = TRUE; mux->streamheader_sent = FALSE; mux->pending_key_unit_ts = GST_CLOCK_TIME_NONE; #if 0 mux->spn_count = 0; if (mux->element_index) { gst_object_unref (mux->element_index); mux->element_index = NULL; } #endif if (mux->adapter) gst_adapter_clear (mux->adapter); if (mux->out_adapter) gst_adapter_clear (mux->out_adapter); if (mux->tsmux) { tsmux_free (mux->tsmux); mux->tsmux = NULL; } if (mux->programs) { g_hash_table_destroy (mux->programs); } mux->programs = g_hash_table_new (g_direct_hash, g_direct_equal); if (mux->streamheader) { GstBuffer *buf; GList *sh; sh = mux->streamheader; while (sh) { buf = sh->data; gst_buffer_unref (buf); sh = g_list_next (sh); } g_list_free (mux->streamheader); mux->streamheader = NULL; } gst_event_replace (&mux->force_key_unit_event, NULL); gst_buffer_replace (&mux->out_buffer, NULL); if (mux->collect) { GST_COLLECT_PADS_STREAM_LOCK (mux->collect); for (walk = mux->collect->data; walk != NULL; walk = g_slist_next (walk)) mpegtsmux_pad_reset ((MpegTsPadData *) walk->data); GST_COLLECT_PADS_STREAM_UNLOCK (mux->collect); } if (alloc) { mux->tsmux = tsmux_new (); tsmux_set_write_func (mux->tsmux, new_packet_cb, mux); tsmux_set_alloc_func (mux->tsmux, alloc_packet_cb, mux); } } static void mpegtsmux_dispose (GObject * object) { MpegTsMux *mux = GST_MPEG_TSMUX (object); mpegtsmux_reset (mux, FALSE); if (mux->adapter) { g_object_unref (mux->adapter); mux->adapter = NULL; } if (mux->out_adapter) { g_object_unref (mux->out_adapter); mux->out_adapter = NULL; } if (mux->collect) { gst_object_unref (mux->collect); mux->collect = NULL; } if (mux->prog_map) { gst_structure_free (mux->prog_map); mux->prog_map = NULL; } if (mux->programs) { g_hash_table_destroy (mux->programs); mux->programs = NULL; } GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); } static void gst_mpegtsmux_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { MpegTsMux *mux = GST_MPEG_TSMUX (object); GSList *walk; switch (prop_id) { case PROP_M2TS_MODE: /*set incase if the output stream need to be of 192 bytes */ mux->m2ts_mode = g_value_get_boolean (value); break; case PROP_PROG_MAP: { const GstStructure *s = gst_value_get_structure (value); if (mux->prog_map) { gst_structure_free (mux->prog_map); } if (s) mux->prog_map = gst_structure_copy (s); else mux->prog_map = NULL; break; } case PROP_PAT_INTERVAL: mux->pat_interval = g_value_get_uint (value); if (mux->tsmux) tsmux_set_pat_interval (mux->tsmux, mux->pat_interval); break; case PROP_PMT_INTERVAL: walk = mux->collect->data; mux->pmt_interval = g_value_get_uint (value); while (walk) { MpegTsPadData *ts_data = (MpegTsPadData *) walk->data; tsmux_set_pmt_interval (ts_data->prog, mux->pmt_interval); walk = g_slist_next (walk); } break; case PROP_ALIGNMENT: mux->alignment = g_value_get_int (value); break; case PROP_SI_INTERVAL: mux->si_interval = g_value_get_uint (value); tsmux_set_si_interval (mux->tsmux, mux->si_interval); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void gst_mpegtsmux_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { MpegTsMux *mux = GST_MPEG_TSMUX (object); switch (prop_id) { case PROP_M2TS_MODE: g_value_set_boolean (value, mux->m2ts_mode); break; case PROP_PROG_MAP: gst_value_set_structure (value, mux->prog_map); break; case PROP_PAT_INTERVAL: g_value_set_uint (value, mux->pat_interval); break; case PROP_PMT_INTERVAL: g_value_set_uint (value, mux->pmt_interval); break; case PROP_ALIGNMENT: g_value_set_int (value, mux->alignment); break; case PROP_SI_INTERVAL: g_value_set_uint (value, mux->si_interval); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } #if 0 static void mpegtsmux_set_index (GstElement * element, GstIndex * index) { MpegTsMux *mux = GST_MPEG_TSMUX (element); GST_OBJECT_LOCK (mux); if (mux->element_index) gst_object_unref (mux->element_index); mux->element_index = index ? gst_object_ref (index) : NULL; GST_OBJECT_UNLOCK (mux); GST_DEBUG_OBJECT (mux, "Set index %" GST_PTR_FORMAT, mux->element_index); } static GstIndex * mpegtsmux_get_index (GstElement * element) { GstIndex *result = NULL; MpegTsMux *mux = GST_MPEG_TSMUX (element); GST_OBJECT_LOCK (mux); if (mux->element_index) result = gst_object_ref (mux->element_index); GST_OBJECT_UNLOCK (mux); GST_DEBUG_OBJECT (mux, "Returning index %" GST_PTR_FORMAT, result); return result; } #endif static void release_buffer_cb (guint8 * data, void *user_data) { stream_data_free (user_data); } static GstFlowReturn mpegtsmux_create_stream (MpegTsMux * mux, MpegTsPadData * ts_data) { GstFlowReturn ret = GST_FLOW_ERROR; GstCaps *caps; GstStructure *s; GstPad *pad; TsMuxStreamType st = TSMUX_ST_RESERVED; const gchar *mt; const GValue *value = NULL; GstBuffer *codec_data = NULL; pad = ts_data->collect.pad; caps = gst_pad_get_current_caps (pad); if (caps == NULL) goto not_negotiated; GST_DEBUG_OBJECT (pad, "Creating stream with PID 0x%04x for caps %" GST_PTR_FORMAT, ts_data->pid, caps); s = gst_caps_get_structure (caps, 0); mt = gst_structure_get_name (s); value = gst_structure_get_value (s, "codec_data"); if (value != NULL) codec_data = gst_value_get_buffer (value); if (strcmp (mt, "video/x-dirac") == 0) { st = TSMUX_ST_VIDEO_DIRAC; } else if (strcmp (mt, "audio/x-ac3") == 0) { st = TSMUX_ST_PS_AUDIO_AC3; } else if (strcmp (mt, "audio/x-dts") == 0) { st = TSMUX_ST_PS_AUDIO_DTS; } else if (strcmp (mt, "audio/x-lpcm") == 0) { st = TSMUX_ST_PS_AUDIO_LPCM; } else if (strcmp (mt, "video/x-h264") == 0) { st = TSMUX_ST_VIDEO_H264; } else if (strcmp (mt, "audio/mpeg") == 0) { gint mpegversion; if (!gst_structure_get_int (s, "mpegversion", &mpegversion)) { GST_ERROR_OBJECT (pad, "caps missing mpegversion"); goto not_negotiated; } switch (mpegversion) { case 1: st = TSMUX_ST_AUDIO_MPEG1; break; case 2: st = TSMUX_ST_AUDIO_MPEG2; break; case 4: { st = TSMUX_ST_AUDIO_AAC; if (codec_data) { /* TODO - Check stream format - codec data should only come with RAW stream */ GST_DEBUG_OBJECT (pad, "we have additional codec data (%" G_GSIZE_FORMAT " bytes)", gst_buffer_get_size (codec_data)); ts_data->codec_data = gst_buffer_ref (codec_data); ts_data->prepare_func = mpegtsmux_prepare_aac; } else { ts_data->codec_data = NULL; } break; } default: GST_WARNING_OBJECT (pad, "unsupported mpegversion %d", mpegversion); goto not_negotiated; } } else if (strcmp (mt, "video/mpeg") == 0) { gint mpegversion; if (!gst_structure_get_int (s, "mpegversion", &mpegversion)) { GST_ERROR_OBJECT (pad, "caps missing mpegversion"); goto not_negotiated; } switch (mpegversion) { case 1: st = TSMUX_ST_VIDEO_MPEG1; break; case 2: st = TSMUX_ST_VIDEO_MPEG2; break; case 4: st = TSMUX_ST_VIDEO_MPEG4; break; default: GST_WARNING_OBJECT (pad, "unsupported mpegversion %d", mpegversion); goto not_negotiated; } } else if (strcmp (mt, "subpicture/x-dvb") == 0) { st = TSMUX_ST_PS_DVB_SUBPICTURE; } else if (strcmp (mt, "application/x-teletext") == 0) { st = TSMUX_ST_PS_TELETEXT; /* needs a particularly sized layout */ ts_data->prepare_func = mpegtsmux_prepare_teletext; } if (st != TSMUX_ST_RESERVED) { ts_data->stream = tsmux_create_stream (mux->tsmux, st, ts_data->pid, ts_data->language); } else { GST_DEBUG_OBJECT (pad, "Failed to determine stream type"); } if (ts_data->stream != NULL) { gst_structure_get_int (s, "rate", &ts_data->stream->audio_sampling); gst_structure_get_int (s, "channels", &ts_data->stream->audio_channels); gst_structure_get_int (s, "bitrate", &ts_data->stream->audio_bitrate); tsmux_stream_set_buffer_release_func (ts_data->stream, release_buffer_cb); tsmux_program_add_stream (ts_data->prog, ts_data->stream); ret = GST_FLOW_OK; } #if 0 GST_OBJECT_LOCK (mux); if (mux->element_index) { gboolean parsed = FALSE; if (ts_data->stream->is_video_stream) { if (gst_structure_get_boolean (s, "parsed", &parsed) && parsed) { if (ts_data->element_index_writer_id == -1) { gst_index_get_writer_id (mux->element_index, GST_OBJECT (mux), &ts_data->element_index_writer_id); GST_DEBUG_OBJECT (mux, "created GstIndex writer_id = %d for stream", ts_data->element_index_writer_id); gst_index_add_format (mux->element_index, ts_data->element_index_writer_id, pts_format); gst_index_add_format (mux->element_index, ts_data->element_index_writer_id, spn_format); } } else { GST_WARNING_OBJECT (pad, "no indexing for (unparsed) stream !"); } } } GST_OBJECT_UNLOCK (mux); #endif gst_caps_unref (caps); return ret; /* ERRORS */ not_negotiated: { GST_DEBUG_OBJECT (pad, "Sink pad caps were not set before pushing"); if (caps) gst_caps_unref (caps); return GST_FLOW_NOT_NEGOTIATED; } } static GstFlowReturn mpegtsmux_create_streams (MpegTsMux * mux) { GstFlowReturn ret = GST_FLOW_OK; GSList *walk = mux->collect->data; /* Create the streams */ while (walk) { GstCollectData *c_data = (GstCollectData *) walk->data; MpegTsPadData *ts_data = (MpegTsPadData *) walk->data; gchar *name = NULL; walk = g_slist_next (walk); if (ts_data->prog_id == -1) { name = GST_PAD_NAME (c_data->pad); if (mux->prog_map != NULL && gst_structure_has_field (mux->prog_map, name)) { gint idx; gboolean ret = gst_structure_get_int (mux->prog_map, name, &idx); if (!ret) { GST_ELEMENT_ERROR (mux, STREAM, MUX, ("Reading program map failed. Assuming default"), (NULL)); idx = DEFAULT_PROG_ID; } if (idx < 0) { GST_DEBUG_OBJECT (mux, "Program number %d associate with pad %s less " "than zero; DEFAULT_PROGRAM = %d is used instead", idx, name, DEFAULT_PROG_ID); idx = DEFAULT_PROG_ID; } ts_data->prog_id = idx; } else { ts_data->prog_id = DEFAULT_PROG_ID; } } ts_data->prog = g_hash_table_lookup (mux->programs, GINT_TO_POINTER (ts_data->prog_id)); if (ts_data->prog == NULL) { ts_data->prog = tsmux_program_new (mux->tsmux, ts_data->prog_id); if (ts_data->prog == NULL) goto no_program; tsmux_set_pmt_interval (ts_data->prog, mux->pmt_interval); g_hash_table_insert (mux->programs, GINT_TO_POINTER (ts_data->prog_id), ts_data->prog); } if (ts_data->stream == NULL) { ret = mpegtsmux_create_stream (mux, ts_data); if (ret != GST_FLOW_OK) goto no_stream; } } return GST_FLOW_OK; /* ERRORS */ no_program: { GST_ELEMENT_ERROR (mux, STREAM, MUX, ("Could not create new program"), (NULL)); return GST_FLOW_ERROR; } no_stream: { GST_ELEMENT_ERROR (mux, STREAM, MUX, ("Could not create handler for stream"), (NULL)); return ret; } } #define COLLECT_DATA_PAD(collect_data) (((GstCollectData *)(collect_data))->pad) static gboolean mpegtsmux_sink_event (GstCollectPads * pads, GstCollectData * data, GstEvent * event, gpointer user_data) { MpegTsMux *mux = GST_MPEG_TSMUX (user_data); gboolean res = FALSE; gboolean forward = TRUE; MpegTsPadData *pad_data = (MpegTsPadData *) data; #ifndef GST_DISABLE_GST_DEBUG GstPad *pad; pad = data->pad; #endif switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CUSTOM_DOWNSTREAM: { GstClockTime timestamp, stream_time, running_time; gboolean all_headers; guint count; if (!gst_video_event_is_force_key_unit (event)) goto out; res = TRUE; forward = FALSE; gst_video_event_parse_downstream_force_key_unit (event, &timestamp, &stream_time, &running_time, &all_headers, &count); GST_INFO_OBJECT (pad, "have downstream force-key-unit event, " "seqnum %d, running-time %" GST_TIME_FORMAT " count %d", gst_event_get_seqnum (event), GST_TIME_ARGS (running_time), count); if (mux->force_key_unit_event != NULL) { GST_INFO_OBJECT (mux, "skipping downstream force key unit event " "as an upstream force key unit is already queued"); goto out; } if (!all_headers) goto out; mux->pending_key_unit_ts = running_time; gst_event_replace (&mux->force_key_unit_event, event); break; } case GST_EVENT_TAG:{ GstTagList *list; gchar *lang = NULL; GST_DEBUG_OBJECT (mux, "received tag event"); gst_event_parse_tag (event, &list); /* Matroska wants ISO 639-2B code, taglist most likely contains 639-1 */ if (gst_tag_list_get_string (list, GST_TAG_LANGUAGE_CODE, &lang)) { const gchar *lang_code; lang_code = gst_tag_get_language_code_iso_639_2B (lang); if (lang_code) { GST_DEBUG_OBJECT (pad, "Setting language to '%s'", lang_code); pad_data->language = g_strdup (lang_code); } else { GST_WARNING_OBJECT (pad, "Did not get language code for '%s'", lang); } g_free (lang); } /* handled this, don't want collectpads to forward it downstream */ res = TRUE; forward = gst_tag_list_get_scope (list) == GST_TAG_SCOPE_GLOBAL; break; } default: break; } out: if (!forward) gst_event_unref (event); else res = gst_collect_pads_event_default (pads, data, event, FALSE); return res; } static gboolean mpegtsmux_src_event (GstPad * pad, GstObject * parent, GstEvent * event) { MpegTsMux *mux = GST_MPEG_TSMUX (parent); gboolean res = TRUE, forward = TRUE; switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CUSTOM_UPSTREAM: { GstIterator *iter; GstIteratorResult iter_ret; GstPad *sinkpad; GValue sinkpad_value = G_VALUE_INIT; GstClockTime running_time; gboolean all_headers, done, res = FALSE; guint count; if (!gst_video_event_is_force_key_unit (event)) break; forward = FALSE; gst_video_event_parse_upstream_force_key_unit (event, &running_time, &all_headers, &count); GST_INFO_OBJECT (mux, "received upstream force-key-unit event, " "seqnum %d running_time %" GST_TIME_FORMAT " all_headers %d count %d", gst_event_get_seqnum (event), GST_TIME_ARGS (running_time), all_headers, count); if (!all_headers) break; mux->pending_key_unit_ts = running_time; gst_event_replace (&mux->force_key_unit_event, event); iter = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (mux)); done = FALSE; while (!done) { gboolean tmp; iter_ret = gst_iterator_next (iter, &sinkpad_value); sinkpad = g_value_get_object (&sinkpad_value); switch (iter_ret) { case GST_ITERATOR_DONE: done = TRUE; break; case GST_ITERATOR_OK: GST_INFO_OBJECT (pad, "forwarding"); tmp = gst_pad_push_event (sinkpad, gst_event_ref (event)); GST_INFO_OBJECT (mux, "result %d", tmp); /* succeed if at least one pad succeeds */ res |= tmp; break; case GST_ITERATOR_ERROR: done = TRUE; break; case GST_ITERATOR_RESYNC: break; } g_value_reset (&sinkpad_value); } g_value_unset (&sinkpad_value); gst_iterator_free (iter); break; } default: break; } if (forward) res = gst_pad_event_default (pad, parent, event); else gst_event_unref (event); return res; } static GstEvent * check_pending_key_unit_event (GstEvent * pending_event, GstSegment * segment, GstClockTime timestamp, guint flags, GstClockTime pending_key_unit_ts) { GstClockTime running_time, stream_time; gboolean all_headers; guint count; GstEvent *event = NULL; g_assert (segment != NULL); if (pending_event == NULL) goto out; if (GST_CLOCK_TIME_IS_VALID (pending_key_unit_ts) && timestamp == GST_CLOCK_TIME_NONE) goto out; running_time = gst_segment_to_running_time (segment, GST_FORMAT_TIME, timestamp); GST_INFO ("now %" GST_TIME_FORMAT " wanted %" GST_TIME_FORMAT, GST_TIME_ARGS (running_time), GST_TIME_ARGS (pending_key_unit_ts)); if (GST_CLOCK_TIME_IS_VALID (pending_key_unit_ts) && running_time < pending_key_unit_ts) goto out; if (flags & GST_BUFFER_FLAG_DELTA_UNIT) { GST_INFO ("pending force key unit, waiting for keyframe"); goto out; } stream_time = gst_segment_to_stream_time (segment, GST_FORMAT_TIME, timestamp); if (GST_EVENT_TYPE (pending_event) == GST_EVENT_CUSTOM_DOWNSTREAM) { gst_video_event_parse_downstream_force_key_unit (pending_event, NULL, NULL, NULL, &all_headers, &count); } else { gst_video_event_parse_upstream_force_key_unit (pending_event, NULL, &all_headers, &count); } event = gst_video_event_new_downstream_force_key_unit (timestamp, stream_time, running_time, all_headers, count); gst_event_set_seqnum (event, gst_event_get_seqnum (pending_event)); out: return event; } GstFlowReturn mpegtsmux_clip_inc_running_time (GstCollectPads * pads, GstCollectData * cdata, GstBuffer * buf, GstBuffer ** outbuf, gpointer user_data) { MpegTsPadData *pad_data = (MpegTsPadData *) cdata; GstClockTime time; *outbuf = buf; /* PTS */ time = GST_BUFFER_PTS (buf); /* invalid left alone and passed */ if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (time))) { time = gst_segment_to_running_time (&cdata->segment, GST_FORMAT_TIME, time); if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (time))) { GST_DEBUG_OBJECT (cdata->pad, "clipping buffer on pad outside segment"); gst_buffer_unref (buf); *outbuf = NULL; goto beach; } else { GST_LOG_OBJECT (cdata->pad, "buffer pts %" GST_TIME_FORMAT " -> %" GST_TIME_FORMAT " running time", GST_TIME_ARGS (GST_BUFFER_PTS (buf)), GST_TIME_ARGS (time)); buf = *outbuf = gst_buffer_make_writable (buf); GST_BUFFER_PTS (*outbuf) = time; } } /* DTS */ time = GST_BUFFER_DTS (buf); /* invalid left alone and passed */ if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (time))) { gint sign; gint64 dts; sign = gst_segment_to_running_time_full (&cdata->segment, GST_FORMAT_TIME, time, &time); if (sign > 0) dts = (gint64) time; else dts = -((gint64) time); GST_LOG_OBJECT (cdata->pad, "buffer dts %" GST_TIME_FORMAT " -> %" GST_STIME_FORMAT " running time", GST_TIME_ARGS (GST_BUFFER_DTS (buf)), GST_STIME_ARGS (dts)); if (GST_CLOCK_STIME_IS_VALID (pad_data->dts) && dts < pad_data->dts) { /* Ignore DTS going backward */ GST_WARNING_OBJECT (cdata->pad, "ignoring DTS going backward"); dts = pad_data->dts; } *outbuf = gst_buffer_make_writable (buf); if (sign > 0) GST_BUFFER_DTS (*outbuf) = time; else GST_BUFFER_DTS (*outbuf) = GST_CLOCK_TIME_NONE; pad_data->dts = dts; } else { pad_data->dts = GST_CLOCK_STIME_NONE; } buf = *outbuf; if (pad_data->prepare_func) { MpegTsMux *mux = (MpegTsMux *) user_data; *outbuf = pad_data->prepare_func (buf, pad_data, mux); g_assert (*outbuf); gst_buffer_unref (buf); } beach: return GST_FLOW_OK; } static GstFlowReturn mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data, GstBuffer * buf, MpegTsMux * mux) { GstFlowReturn ret = GST_FLOW_OK; MpegTsPadData *best = (MpegTsPadData *) data; TsMuxProgram *prog; gint64 pts = GST_CLOCK_STIME_NONE; gint64 dts = GST_CLOCK_STIME_NONE; gboolean delta = TRUE, header = FALSE; StreamData *stream_data; GST_DEBUG_OBJECT (mux, "Pads collected"); if (G_UNLIKELY (mux->first)) { ret = mpegtsmux_create_streams (mux); if (G_UNLIKELY (ret != GST_FLOW_OK)) return ret; mpegtsmux_prepare_srcpad (mux); mux->first = FALSE; } if (G_UNLIKELY (best == NULL)) { /* EOS */ /* drain some possibly cached data */ new_packet_m2ts (mux, NULL, -1); mpegtsmux_push_packets (mux, TRUE); gst_pad_push_event (mux->srcpad, gst_event_new_eos ()); return GST_FLOW_OK; } prog = best->prog; if (prog == NULL) goto no_program; g_assert (buf != NULL); if (mux->force_key_unit_event != NULL && best->stream->is_video_stream) { GstEvent *event; event = check_pending_key_unit_event (mux->force_key_unit_event, &best->collect.segment, GST_BUFFER_PTS (buf), GST_BUFFER_FLAGS (buf), mux->pending_key_unit_ts); if (event) { GstClockTime running_time; guint count; GList *cur; mux->pending_key_unit_ts = GST_CLOCK_TIME_NONE; gst_event_replace (&mux->force_key_unit_event, NULL); gst_video_event_parse_downstream_force_key_unit (event, NULL, NULL, &running_time, NULL, &count); GST_INFO_OBJECT (mux, "pushing downstream force-key-unit event %d " "%" GST_TIME_FORMAT " count %d", gst_event_get_seqnum (event), GST_TIME_ARGS (running_time), count); gst_pad_push_event (mux->srcpad, event); /* output PAT */ mux->tsmux->last_pat_ts = -1; /* output PMT for each program */ for (cur = mux->tsmux->programs; cur; cur = cur->next) { TsMuxProgram *program = (TsMuxProgram *) cur->data; program->last_pmt_ts = -1; } tsmux_program_set_pcr_stream (prog, NULL); } } if (G_UNLIKELY (prog->pcr_stream == NULL)) { /* Take the first data stream for the PCR */ GST_DEBUG_OBJECT (COLLECT_DATA_PAD (best), "Use stream (pid=%d) from pad as PCR for program (prog_id = %d)", best->pid, best->prog_id); /* Set the chosen PCR stream */ tsmux_program_set_pcr_stream (prog, best->stream); } GST_DEBUG_OBJECT (COLLECT_DATA_PAD (best), "Chose stream for output (PID: 0x%04x)", best->pid); if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (buf))) { pts = GSTTIME_TO_MPEGTIME (GST_BUFFER_PTS (buf)); GST_DEBUG_OBJECT (mux, "Buffer has PTS %" GST_TIME_FORMAT " pts %" G_GINT64_FORMAT, GST_TIME_ARGS (GST_BUFFER_PTS (buf)), pts); } if (GST_CLOCK_STIME_IS_VALID (best->dts)) { dts = GSTTIME_TO_MPEGTIME (best->dts); GST_DEBUG_OBJECT (mux, "Buffer has DTS %s%" GST_TIME_FORMAT " dts %" G_GINT64_FORMAT, best->dts >= 0 ? " " : "-", GST_TIME_ARGS (ABS (best->dts)), dts); } /* should not have a DTS without PTS */ if (!GST_CLOCK_STIME_IS_VALID (pts) && GST_CLOCK_STIME_IS_VALID (dts)) { GST_DEBUG_OBJECT (mux, "using DTS for unknown PTS"); pts = dts; } if (best->stream->is_video_stream) { delta = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); header = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_HEADER); #if 0 GST_OBJECT_LOCK (mux); if (mux->element_index && !delta && best->element_index_writer_id != -1) { gst_index_add_association (mux->element_index, best->element_index_writer_id, GST_ASSOCIATION_FLAG_KEY_UNIT, spn_format, mux->spn_count, pts_format, pts, NULL); } GST_OBJECT_UNLOCK (mux); #endif } GST_DEBUG_OBJECT (mux, "delta: %d", delta); stream_data = stream_data_new (buf); tsmux_stream_add_data (best->stream, stream_data->map_info.data, stream_data->map_info.size, stream_data, pts, dts, !delta); /* outgoing ts follows ts of PCR program stream */ if (prog->pcr_stream == best->stream) { /* prefer DTS if present for PCR as it should be monotone */ mux->last_ts = GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buf)) ? GST_BUFFER_DTS (buf) : GST_BUFFER_PTS (buf); } mux->is_delta = delta; mux->is_header = header; while (tsmux_stream_bytes_in_buffer (best->stream) > 0) { if (!tsmux_write_stream_packet (mux->tsmux, best->stream)) { /* Failed writing data for some reason. Set appropriate error */ GST_DEBUG_OBJECT (mux, "Failed to write data packet"); GST_ELEMENT_ERROR (mux, STREAM, MUX, ("Failed writing output data to stream %04x", best->stream->id), (NULL)); goto write_fail; } } /* flush packet cache */ return mpegtsmux_push_packets (mux, FALSE); /* ERRORS */ write_fail: { return mux->last_flow_ret; } no_program: { GST_ELEMENT_ERROR (mux, STREAM, MUX, ("Stream on pad %" GST_PTR_FORMAT " is not associated with any program", COLLECT_DATA_PAD (best)), (NULL)); return GST_FLOW_ERROR; } } static GstPad * mpegtsmux_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name, const GstCaps * caps) { MpegTsMux *mux = GST_MPEG_TSMUX (element); gint pid = -1; gchar *pad_name = NULL; GstPad *pad = NULL; MpegTsPadData *pad_data = NULL; if (name != NULL && sscanf (name, "sink_%d", &pid) == 1) { if (tsmux_find_stream (mux->tsmux, pid)) goto stream_exists; } else { pid = tsmux_get_new_pid (mux->tsmux); } pad_name = g_strdup_printf ("sink_%d", pid); pad = gst_pad_new_from_template (templ, pad_name); g_free (pad_name); pad_data = (MpegTsPadData *) gst_collect_pads_add_pad (mux->collect, pad, sizeof (MpegTsPadData), (GstCollectDataDestroyNotify) (mpegtsmux_pad_reset), TRUE); if (pad_data == NULL) goto pad_failure; mpegtsmux_pad_reset (pad_data); pad_data->pid = pid; if (G_UNLIKELY (!gst_element_add_pad (element, pad))) goto could_not_add; return pad; /* ERRORS */ stream_exists: { GST_ELEMENT_ERROR (element, STREAM, MUX, ("Duplicate PID requested"), (NULL)); return NULL; } could_not_add: { GST_ELEMENT_ERROR (element, STREAM, FAILED, ("Internal data stream error."), ("Could not add pad to element")); gst_collect_pads_remove_pad (mux->collect, pad); gst_object_unref (pad); return NULL; } pad_failure: { GST_ELEMENT_ERROR (element, STREAM, FAILED, ("Internal data stream error."), ("Could not add pad to collectpads")); gst_object_unref (pad); return NULL; } } static void mpegtsmux_release_pad (GstElement * element, GstPad * pad) { MpegTsMux *mux = GST_MPEG_TSMUX (element); GST_DEBUG_OBJECT (mux, "Pad %" GST_PTR_FORMAT " being released", pad); if (mux->collect) { gst_collect_pads_remove_pad (mux->collect, pad); } /* chain up */ gst_element_remove_pad (element, pad); } static void new_packet_common_init (MpegTsMux * mux, GstBuffer * buf, guint8 * data, guint len) { /* Packets should be at least 188 bytes, but check anyway */ g_assert (len >= 2 || !data); if (!mux->streamheader_sent && data) { guint pid = ((data[1] & 0x1f) << 8) | data[2]; /* if it's a PAT or a PMT */ if (pid == 0x00 || (pid >= TSMUX_START_PMT_PID && pid < TSMUX_START_ES_PID)) { GstBuffer *hbuf; if (!buf) { hbuf = gst_buffer_new_and_alloc (len); gst_buffer_fill (hbuf, 0, data, len); } else { hbuf = gst_buffer_copy (buf); } mux->streamheader = g_list_append (mux->streamheader, hbuf); } else if (mux->streamheader) { mpegtsmux_set_header_on_caps (mux); mux->streamheader_sent = TRUE; } } if (buf) { if (mux->is_header) { GST_LOG_OBJECT (mux, "marking as header buffer"); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER); } if (mux->is_delta) { GST_LOG_OBJECT (mux, "marking as delta unit"); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); } else { GST_DEBUG_OBJECT (mux, "marking as non-delta unit"); mux->is_delta = TRUE; } } } static GstFlowReturn mpegtsmux_push_packets (MpegTsMux * mux, gboolean force) { GstBufferList *buffer_list; gint align = mux->alignment; gint av, packet_size; if (mux->m2ts_mode) { packet_size = M2TS_PACKET_LENGTH; if (align < 0) align = 32; } else { packet_size = NORMAL_TS_PACKET_LENGTH; if (align < 0) align = 0; } av = gst_adapter_available (mux->out_adapter); GST_LOG_OBJECT (mux, "align %d, av %d", align, av); if (av == 0) return GST_FLOW_OK; /* no alignment, just push all available data */ if (align == 0) { buffer_list = gst_adapter_take_buffer_list (mux->out_adapter, av); return gst_pad_push_list (mux->srcpad, buffer_list); } align *= packet_size; if (!force && align > av) return GST_FLOW_OK; buffer_list = gst_buffer_list_new_sized ((av / align) + 1); GST_LOG_OBJECT (mux, "aligning to %d bytes", align); while (align <= av) { gst_buffer_list_add (buffer_list, gst_adapter_take_buffer (mux->out_adapter, align)); av -= align; } if (av > 0 && force) { GstBuffer *buf; guint8 *data; guint32 header; gint dummy; GstMapInfo map; GST_LOG_OBJECT (mux, "handling %d leftover bytes", av); buf = gst_buffer_new_and_alloc (align); gst_buffer_map (buf, &map, GST_MAP_READ); data = map.data; gst_adapter_copy (mux->out_adapter, data, 0, av); gst_adapter_clear (mux->out_adapter); data += av; header = GST_READ_UINT32_BE (data - packet_size); dummy = (map.size - av) / packet_size; GST_LOG_OBJECT (mux, "adding %d null packets", dummy); for (; dummy > 0; dummy--) { gint offset; if (packet_size > NORMAL_TS_PACKET_LENGTH) { GST_WRITE_UINT32_BE (data, header); /* simply increase header a bit and never mind too much */ header++; offset = 4; } else { offset = 0; } GST_WRITE_UINT8 (data + offset, TSMUX_SYNC_BYTE); /* null packet PID */ GST_WRITE_UINT16_BE (data + offset + 1, 0x1FFF); /* no adaptation field exists | continuity counter undefined */ GST_WRITE_UINT8 (data + offset + 3, 0x10); /* payload */ memset (data + offset + 4, 0, NORMAL_TS_PACKET_LENGTH - 4); data += packet_size; } gst_buffer_unmap (buf, &map); gst_buffer_list_add (buffer_list, buf); } return gst_pad_push_list (mux->srcpad, buffer_list); } static GstFlowReturn mpegtsmux_collect_packet (MpegTsMux * mux, GstBuffer * buf) { GST_LOG_OBJECT (mux, "collecting packet size %" G_GSIZE_FORMAT, gst_buffer_get_size (buf)); gst_adapter_push (mux->out_adapter, buf); return GST_FLOW_OK; } static gboolean new_packet_m2ts (MpegTsMux * mux, GstBuffer * buf, gint64 new_pcr) { GstBuffer *out_buf; int chunk_bytes; GstMapInfo map; GST_LOG_OBJECT (mux, "Have buffer %p with new_pcr=%" G_GINT64_FORMAT, buf, new_pcr); chunk_bytes = gst_adapter_available (mux->adapter); if (G_LIKELY (buf)) { if (new_pcr < 0) { /* If there is no pcr in current ts packet then just add the packet to the adapter for later output when we see a PCR */ GST_LOG_OBJECT (mux, "Accumulating non-PCR packet"); gst_adapter_push (mux->adapter, buf); goto exit; } /* no first interpolation point yet, then this is the one, * otherwise it is the second interpolation point */ if (mux->previous_pcr < 0 && chunk_bytes) { mux->previous_pcr = new_pcr; mux->previous_offset = chunk_bytes; GST_LOG_OBJECT (mux, "Accumulating non-PCR packet"); gst_adapter_push (mux->adapter, buf); goto exit; } } else { g_assert (new_pcr == -1); } /* interpolate if needed, and 2 points available */ if (chunk_bytes && (new_pcr != mux->previous_pcr)) { gint64 offset = 0; GST_LOG_OBJECT (mux, "Processing pending packets; " "previous pcr %" G_GINT64_FORMAT ", previous offset %d, " "current pcr %" G_GINT64_FORMAT ", current offset %d", mux->previous_pcr, (gint) mux->previous_offset, new_pcr, (gint) chunk_bytes); g_assert (chunk_bytes > mux->previous_offset); /* if draining, use previous rate */ if (G_LIKELY (new_pcr > 0)) { mux->pcr_rate_num = new_pcr - mux->previous_pcr; mux->pcr_rate_den = chunk_bytes - mux->previous_offset; } while (offset < chunk_bytes) { guint64 cur_pcr, ts; /* Loop, pulling packets of the adapter, updating their 4 byte * timestamp header and pushing */ /* interpolate PCR */ if (G_LIKELY (offset >= mux->previous_offset)) cur_pcr = mux->previous_pcr + gst_util_uint64_scale (offset - mux->previous_offset, mux->pcr_rate_num, mux->pcr_rate_den); else cur_pcr = mux->previous_pcr - gst_util_uint64_scale (mux->previous_offset - offset, mux->pcr_rate_num, mux->pcr_rate_den); /* FIXME: what about DTS here? */ ts = gst_adapter_prev_pts (mux->adapter, NULL); out_buf = gst_adapter_take_buffer (mux->adapter, M2TS_PACKET_LENGTH); g_assert (out_buf); offset += M2TS_PACKET_LENGTH; GST_BUFFER_PTS (out_buf) = ts; gst_buffer_map (out_buf, &map, GST_MAP_WRITE); /* The header is the bottom 30 bits of the PCR, apparently not * encoded into base + ext as in the packets themselves */ GST_WRITE_UINT32_BE (map.data, cur_pcr & 0x3FFFFFFF); gst_buffer_unmap (out_buf, &map); GST_LOG_OBJECT (mux, "Outputting a packet of length %d PCR %" G_GUINT64_FORMAT, M2TS_PACKET_LENGTH, cur_pcr); mpegtsmux_collect_packet (mux, out_buf); } } if (G_UNLIKELY (!buf)) goto exit; gst_buffer_map (buf, &map, GST_MAP_WRITE); /* Finally, output the passed in packet */ /* Only write the bottom 30 bits of the PCR */ GST_WRITE_UINT32_BE (map.data, new_pcr & 0x3FFFFFFF); gst_buffer_unmap (buf, &map); GST_LOG_OBJECT (mux, "Outputting a packet of length %d PCR %" G_GUINT64_FORMAT, M2TS_PACKET_LENGTH, new_pcr); mpegtsmux_collect_packet (mux, buf); if (new_pcr != mux->previous_pcr) { mux->previous_pcr = new_pcr; mux->previous_offset = -M2TS_PACKET_LENGTH; } exit: return TRUE; } /* Called when the TsMux has prepared a packet for output. Return FALSE * on error */ static gboolean new_packet_cb (GstBuffer * buf, void *user_data, gint64 new_pcr) { MpegTsMux *mux = (MpegTsMux *) user_data; gint offset = 0; GstMapInfo map; #if 0 GST_LOG_OBJECT (mux, "handling packet %d", mux->spn_count); mux->spn_count++; #endif if (mux->m2ts_mode) { offset = 4; gst_buffer_set_size (buf, NORMAL_TS_PACKET_LENGTH + offset); } gst_buffer_map (buf, &map, GST_MAP_READWRITE); if (offset) { /* there should be a better way to do this */ memmove (map.data + offset, map.data, map.size - offset); } GST_BUFFER_PTS (buf) = mux->last_ts; /* do common init (flags and streamheaders) */ new_packet_common_init (mux, buf, map.data + offset, map.size); gst_buffer_unmap (buf, &map); /* all is meant for downstream, including any prefix */ if (offset) return new_packet_m2ts (mux, buf, new_pcr); else mpegtsmux_collect_packet (mux, buf); return TRUE; } /* called when TsMux needs new packet to write into */ static void alloc_packet_cb (GstBuffer ** _buf, void *user_data) { MpegTsMux *mux = (MpegTsMux *) user_data; GstBuffer *buf; gint offset = 0; if (mux->m2ts_mode == TRUE) offset = 4; buf = gst_buffer_new_and_alloc (NORMAL_TS_PACKET_LENGTH + offset); gst_buffer_set_size (buf, NORMAL_TS_PACKET_LENGTH); *_buf = buf; } static void mpegtsmux_set_header_on_caps (MpegTsMux * mux) { GstBuffer *buf; GstStructure *structure; GValue array = { 0 }; GValue value = { 0 }; GstCaps *caps; GList *sh; caps = gst_caps_make_writable (gst_pad_get_current_caps (mux->srcpad)); structure = gst_caps_get_structure (caps, 0); g_value_init (&array, GST_TYPE_ARRAY); sh = mux->streamheader; while (sh) { buf = sh->data; g_value_init (&value, GST_TYPE_BUFFER); gst_value_take_buffer (&value, buf); gst_value_array_append_value (&array, &value); g_value_unset (&value); sh = g_list_next (sh); } g_list_free (mux->streamheader); mux->streamheader = NULL; gst_structure_set_value (structure, "streamheader", &array); gst_pad_set_caps (mux->srcpad, caps); g_value_unset (&array); gst_caps_unref (caps); } static void mpegtsmux_prepare_srcpad (MpegTsMux * mux) { GstSegment seg; /* we are not going to seek */ GstEvent *new_seg; gchar s_id[32]; GstCaps *caps = gst_caps_new_simple ("video/mpegts", "systemstream", G_TYPE_BOOLEAN, TRUE, "packetsize", G_TYPE_INT, (mux->m2ts_mode ? M2TS_PACKET_LENGTH : NORMAL_TS_PACKET_LENGTH), NULL); /* stream-start (FIXME: create id based on input ids) */ g_snprintf (s_id, sizeof (s_id), "mpegtsmux-%08x", g_random_int ()); gst_pad_push_event (mux->srcpad, gst_event_new_stream_start (s_id)); gst_segment_init (&seg, GST_FORMAT_TIME); new_seg = gst_event_new_segment (&seg); /* Set caps on src pad from our template and push new segment */ gst_pad_set_caps (mux->srcpad, caps); gst_caps_unref (caps); if (!gst_pad_push_event (mux->srcpad, new_seg)) { GST_WARNING_OBJECT (mux, "New segment event was not handled downstream"); } } static GstStateChangeReturn mpegtsmux_change_state (GstElement * element, GstStateChange transition) { MpegTsMux *mux = GST_MPEG_TSMUX (element); GstStateChangeReturn ret; switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: break; case GST_STATE_CHANGE_READY_TO_PAUSED: gst_collect_pads_start (mux->collect); break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break; case GST_STATE_CHANGE_PAUSED_TO_READY: gst_collect_pads_stop (mux->collect); break; case GST_STATE_CHANGE_READY_TO_NULL: break; default: break; } ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); switch (transition) { case GST_STATE_CHANGE_PLAYING_TO_PAUSED: break; case GST_STATE_CHANGE_PAUSED_TO_READY: mpegtsmux_reset (mux, TRUE); break; case GST_STATE_CHANGE_READY_TO_NULL: break; default: break; } return ret; } static gboolean mpegtsmux_send_event (GstElement * element, GstEvent * event) { GstMpegtsSection *section; MpegTsMux *mux = GST_MPEG_TSMUX (element); section = gst_event_parse_mpegts_section (event); gst_event_unref (event); if (section) { GST_DEBUG ("Received event with mpegts section"); /* TODO: Check that the section type is supported */ tsmux_add_mpegts_si_section (mux->tsmux, section); return TRUE; } return FALSE; } static gboolean plugin_init (GstPlugin * plugin) { gst_mpegts_initialize (); if (!gst_element_register (plugin, "mpegtsmux", GST_RANK_PRIMARY, mpegtsmux_get_type ())) return FALSE; GST_DEBUG_CATEGORY_INIT (mpegtsmux_debug, "mpegtsmux", 0, "MPEG Transport Stream muxer"); return TRUE; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, mpegtsmux, "MPEG-TS muxer", plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
gpl-2.0
hpfem/hermes2d
src/weakform.h
6594
// This file is part of Hermes2D. // // Hermes2D 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. // // Hermes2D is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>. #ifndef __H2D_WEAKFORM_H #define __H2D_WEAKFORM_H #include "function.h" #include "solution.h" class RefMap; class DiscreteProblem; class LinearProblem; class Space; class MeshFunction; struct EdgePos; class Ord; struct Element; class Shapeset; template<typename T> class Func; template<typename T> class Geom; template<typename T> class ExtData; // Bilinear form symmetry flag, see WeakForm::add_matrix_form enum SymFlag { H2D_ANTISYM = -1, H2D_UNSYM = 0, H2D_SYM = 1 }; /// \brief Represents the weak formulation of a problem. /// /// The WeakForm class represents the weak formulation of a system of linear PDEs. /// The number of equations ("neq") in the system is fixed and is passed to the constructor. /// The weak formulation of the system A(U,V) = L(V) has a block structure. A(U,V) is /// a (neq x neq) matrix of bilinear forms a_mn(u,v) and L(V) is a neq-component vector /// of linear forms l(v). U and V are the vectors of basis and test functions. /// /// /// class H2D_API WeakForm { public: WeakForm(int neq = 1, bool mat_free = false); // general case typedef scalar (*matrix_form_val_t)(int n, double *wt, Func<scalar> *u[], Func<double> *vi, Func<double> *vj, Geom<double> *e, ExtData<scalar> *); typedef Ord (*matrix_form_ord_t)(int n, double *wt, Func<Ord> *u[], Func<Ord> *vi, Func<Ord> *vj, Geom<Ord> *e, ExtData<Ord> *); typedef scalar (*vector_form_val_t)(int n, double *wt, Func<scalar> *u[], Func<double> *vi, Geom<double> *e, ExtData<scalar> *); typedef Ord (*vector_form_ord_t)(int n, double *wt, Func<Ord> *u[], Func<Ord> *vi, Geom<Ord> *e, ExtData<Ord> *); // general case void add_matrix_form(int i, int j, matrix_form_val_t fn, matrix_form_ord_t ord, SymFlag sym = H2D_UNSYM, int area = H2D_ANY, Tuple<MeshFunction*>ext = Tuple<MeshFunction*>()); void add_matrix_form(matrix_form_val_t fn, matrix_form_ord_t ord, SymFlag sym = H2D_UNSYM, int area = H2D_ANY, Tuple<MeshFunction*>ext = Tuple<MeshFunction*>()); // single equation case void add_matrix_form_surf(int i, int j, matrix_form_val_t fn, matrix_form_ord_t ord, int area = H2D_ANY, Tuple<MeshFunction*>ext = Tuple<MeshFunction*>()); void add_matrix_form_surf(matrix_form_val_t fn, matrix_form_ord_t ord, int area = H2D_ANY, Tuple<MeshFunction*>ext = Tuple<MeshFunction*>()); // single equation case void add_vector_form(int i, vector_form_val_t fn, vector_form_ord_t ord, int area = H2D_ANY, Tuple<MeshFunction*>ext = Tuple<MeshFunction*>()); void add_vector_form(vector_form_val_t fn, vector_form_ord_t ord, int area = H2D_ANY, Tuple<MeshFunction*>ext = Tuple<MeshFunction*>()); // single equation case void add_vector_form_surf(int i, vector_form_val_t fn, vector_form_ord_t ord, int area = H2D_ANY, Tuple<MeshFunction*>ext = Tuple<MeshFunction*>()); void add_vector_form_surf(vector_form_val_t fn, vector_form_ord_t ord, int area = H2D_ANY, Tuple<MeshFunction*>ext = Tuple<MeshFunction*>()); // single equation case void set_ext_fns(void* fn, Tuple<MeshFunction*>ext = Tuple<MeshFunction*>()); /// Returns the number of equations int get_neq() { return neq; } /// Internal. Used by DiscreteProblem to detect changes in the weakform. int get_seq() const { return seq; } bool is_matrix_free() { return is_matfree; } int neq; protected: int seq; bool is_matfree; struct Area { /*std::string name;*/ std::vector<int> markers; }; H2D_API_USED_STL_VECTOR(Area); std::vector<Area> areas; H2D_API_USED_STL_VECTOR(MeshFunction*); public: scalar evaluate_fn(int point_cnt, double *weights, Func<double> *values_v, Geom<double> *geometry, ExtData<scalar> *values_ext_fnc, Element* element, Shapeset* shape_set, int shape_inx); ///< Evaluate value of the user defined function. Ord evaluate_ord(int point_cnt, double *weights, Func<Ord> *values_v, Geom<Ord> *geometry, ExtData<Ord> *values_ext_fnc, Element* element, Shapeset* shape_set, int shape_inx); ///< Evaluate order of the user defined function. // general case struct MatrixFormVol { int i, j, sym, area; matrix_form_val_t fn; matrix_form_ord_t ord; std::vector<MeshFunction *> ext; }; struct MatrixFormSurf { int i, j, area; matrix_form_val_t fn; matrix_form_ord_t ord; std::vector<MeshFunction *> ext; }; struct VectorFormVol { int i, area; vector_form_val_t fn; vector_form_ord_t ord; std::vector<MeshFunction *> ext; }; struct VectorFormSurf { int i, area; vector_form_val_t fn; vector_form_ord_t ord; std::vector<MeshFunction *> ext; }; // general case std::vector<MatrixFormVol> mfvol; std::vector<MatrixFormSurf> mfsurf; std::vector<VectorFormVol> vfvol; std::vector<VectorFormSurf> vfsurf; struct Stage { std::vector<int> idx; std::vector<Mesh*> meshes; std::vector<Transformable*> fns; std::vector<MeshFunction*> ext; // general case std::vector<MatrixFormVol *> mfvol; std::vector<MatrixFormSurf *> mfsurf; std::vector<VectorFormVol *> vfvol; std::vector<VectorFormSurf *> vfsurf; std::set<int> idx_set; std::set<unsigned> seq_set; std::set<MeshFunction*> ext_set; }; void get_stages(Tuple< Space* > spaces, Tuple< Solution* > u_ext, std::vector< WeakForm::Stage >& stages, bool rhsonly); bool** get_blocks(); bool is_in_area(int marker, int area) const { return area >= 0 ? area == marker : is_in_area_2(marker, area); } bool is_sym() const { return false; /* not impl. yet */ } friend class DiscreteProblem; friend class RefDiscreteProblem; friend class LinearProblem; friend class FeProblem; friend class Precond; private: Stage* find_stage(std::vector<WeakForm::Stage>& stages, int ii, int jj, Mesh* m1, Mesh* m2, std::vector<MeshFunction*>& ext, std::vector<Solution*>& u_ext); bool is_in_area_2(int marker, int area) const; }; #endif
gpl-2.0
berkeley-amsa/past-site
administrator/tmp/install_4e65459e58fe3/admin/elements/icons.php
1170
<?php /** * @version $Id$ * @package Joomla.Administrator * @subpackage JoomDOC * @author ARTIO s.r.o., [email protected], http:://www.artio.net * @copyright Copyright (C) 2011 Artio s.r.o.. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die(); include_once(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomdoc' . DS . 'defines.php'); class JElementIcons extends JElement { var $_name = 'Icons'; function fetchElement ($name, $value, &$node, $control_name) { $field = JText::_('JOOMDOC_ICON_THEME_NOT_AVAILABLE'); if (JFolder::exists(JOOMDOC_PATH_ICONS)) { $themes = JFolder::folders(JOOMDOC_PATH_ICONS, '.', false, false); foreach ($themes as $theme) $options[] = JHtml::_('select.option', $theme, $theme, 'id', 'title'); if (isset($options)) { $fieldName = $control_name ? $control_name . '[' . $name . ']' : $name; $field = JHtml::_('select.genericlist', $options, $fieldName, '', 'id', 'title', $value); } } return $field; } } ?>
gpl-2.0
sephirot47/OpenGL-Deferred-Lighting
include/Texture.h
626
#ifndef TEXTURE_H #define TEXTURE_H #define GL_GLEXT_PROTOTYPES #include <GL/gl.h> #include <GL/glu.h> #include <GL/glext.h> #include "Debug.h" class Texture { private: GLuint object; void Bind() const; void UnBind() const; public: Texture(); ~Texture(); void SetWrapMode(GLenum mode) const; void SetScaleMode(GLenum mode) const; void SetData(const void *data, int width, int height, GLenum format, GLenum internalFormat, GLenum type) const; void Bind(GLuint slot) const; static void UnBind(GLuint slot); GLuint GetObject() const { return object; } }; #endif // TEXTURE_H
gpl-2.0
boundary/wireshark
epan/dissectors/packet-mount.c
33771
/* packet-mount.c * Routines for mount dissection * * $Id$ * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * Copied from packet-smb.c * * 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include <string.h> #include "packet-rpc.h" #include "packet-mount.h" #include "packet-nfs.h" static int proto_mount = -1; static int proto_sgi_mount = -1; static int hf_mount_procedure_v1 = -1; static int hf_mount_procedure_v2 = -1; static int hf_mount_procedure_v3 = -1; static int hf_sgi_mount_procedure_v1 = -1; static int hf_mount_path = -1; static int hf_mount3_status = -1; static int hf_mount_mountlist_hostname = -1; static int hf_mount_mountlist_directory = -1; static int hf_mount_mountlist = -1; static int hf_mount_groups_group = -1; static int hf_mount_groups = -1; static int hf_mount_exportlist_directory = -1; static int hf_mount_exportlist = -1; static int hf_mount_has_options = -1; static int hf_mount_options = -1; static int hf_mount_pathconf_link_max = -1; static int hf_mount_pathconf_max_canon = -1; static int hf_mount_pathconf_max_input = -1; static int hf_mount_pathconf_name_max = -1; static int hf_mount_pathconf_path_max = -1; static int hf_mount_pathconf_pipe_buf = -1; static int hf_mount_pathconf_vdisable = -1; static int hf_mount_pathconf_mask = -1; static int hf_mount_pathconf_error_all = -1; static int hf_mount_pathconf_error_link_max = -1; static int hf_mount_pathconf_error_max_canon = -1; static int hf_mount_pathconf_error_max_input = -1; static int hf_mount_pathconf_error_name_max = -1; static int hf_mount_pathconf_error_path_max = -1; static int hf_mount_pathconf_error_pipe_buf = -1; static int hf_mount_pathconf_chown_restricted = -1; static int hf_mount_pathconf_no_trunc = -1; static int hf_mount_pathconf_error_vdisable = -1; static int hf_mount_statvfs_bsize = -1; static int hf_mount_statvfs_frsize = -1; static int hf_mount_statvfs_blocks = -1; static int hf_mount_statvfs_bfree = -1; static int hf_mount_statvfs_bavail = -1; static int hf_mount_statvfs_files = -1; static int hf_mount_statvfs_ffree = -1; static int hf_mount_statvfs_favail = -1; static int hf_mount_statvfs_fsid = -1; static int hf_mount_statvfs_basetype = -1; static int hf_mount_statvfs_flag = -1; static int hf_mount_statvfs_flag_rdonly = -1; static int hf_mount_statvfs_flag_nosuid = -1; static int hf_mount_statvfs_flag_notrunc = -1; static int hf_mount_statvfs_flag_nodev = -1; static int hf_mount_statvfs_flag_grpid = -1; static int hf_mount_statvfs_flag_local = -1; static int hf_mount_statvfs_namemax = -1; static int hf_mount_statvfs_fstr = -1; static int hf_mount_flavors = -1; static int hf_mount_flavor = -1; static gint ett_mount = -1; static gint ett_mount_mountlist = -1; static gint ett_mount_groups = -1; static gint ett_mount_exportlist = -1; static gint ett_mount_pathconf_mask = -1; static gint ett_mount_statvfs_flag = -1; #define MAX_GROUP_NAME_LIST 128 static char group_name_list[MAX_GROUP_NAME_LIST]; static int group_names_len; /* RFC 1813, Page 107 */ static const value_string mount3_mountstat3[] = { { 0, "OK" }, { 1, "ERR_PERM" }, { 2, "ERR_NOENT" }, { 5, "ERR_IO" }, { 13, "ERR_ACCESS" }, { 20, "ERR_NOTDIR" }, { 22, "ERR_INVAL" }, { 63, "ERR_NAMETOOLONG" }, { 10004, "ERR_NOTSUPP" }, { 10006, "ERR_SERVERFAULT" }, { 0, NULL } }; /* RFC 1094, Page 24 */ /* This function dissects fhstatus for v1 and v2 of the mount protocol. * Formally, hf_mount3_status only define the status codes returned by version * 3 of the protocol. * Though not formally defined in the standard, we use the same * value-to-string mappings as version 3 since we belive that this mapping * is consistant with most v1 and v2 implementations. */ static int dissect_fhstatus(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { gint32 status; status=tvb_get_ntohl(tvb,offset); offset = dissect_rpc_uint32(tvb,tree,hf_mount3_status,offset); switch (status) { case 0: offset = dissect_fhandle(tvb,offset,pinfo,tree,"fhandle", NULL); break; default: /* void */ col_append_fstr( pinfo->cinfo, COL_INFO, " Error:%s", val_to_str(status, mount3_mountstat3, "Unknown (0x%08X)")); break; } return offset; } static int dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { const char *mountpoint=NULL; if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){ rpc_call_info_value *civ=(rpc_call_info_value *)pinfo->private_data; if(civ->request && (civ->proc==1)){ const gchar *host; unsigned char *name; guint32 len; unsigned char *ptr; host=ip_to_str((guint8 *)pinfo->dst.data); len=tvb_get_ntohl(tvb, offset); if (len >= ITEM_LABEL_LENGTH) THROW(ReportedBoundsError); name=(unsigned char *)g_malloc(strlen(host)+1+len+1+200); ptr=name; memcpy(ptr, host, strlen(host)); ptr+=strlen(host); *ptr++=':'; tvb_memcpy(tvb, ptr, offset+4, len); ptr+=len; *ptr=0; nfs_name_snoop_add_name(civ->xid, tvb, -1, (gint)strlen(name), 0, 0, name); } } offset = dissect_rpc_string(tvb,tree,hf_mount_path,offset,&mountpoint); col_append_fstr(pinfo->cinfo, COL_INFO," %s", mountpoint); return offset; } /* RFC 1094, Page 25,26 */ static int dissect_mount1_mnt_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { offset = dissect_fhstatus(tvb,offset,pinfo,tree); return offset; } /* RFC 1094, Page 26 */ /* RFC 1813, Page 110 */ static int dissect_mountlist(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { proto_item* lock_item = NULL; proto_tree* lock_tree = NULL; int old_offset = offset; const char* hostname; const char* directory; if (tree) { lock_item = proto_tree_add_item(tree, hf_mount_mountlist, tvb, offset, -1, ENC_NA); if (lock_item) lock_tree = proto_item_add_subtree(lock_item, ett_mount_mountlist); } offset = dissect_rpc_string(tvb, lock_tree, hf_mount_mountlist_hostname, offset, &hostname); offset = dissect_rpc_string(tvb, lock_tree, hf_mount_mountlist_directory, offset, &directory); if (lock_item) { /* now we have a nicer string */ proto_item_set_text(lock_item, "Mount List Entry: %s:%s", hostname, directory); /* now we know, that mountlist is shorter */ proto_item_set_len(lock_item, offset - old_offset); } return offset; } /* RFC 1094, Page 26 */ /* RFC 1813, Page 110 */ static int dissect_mount_dump_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_mountlist); return offset; } /* RFC 1094, Page 26 */ /* RFC 1813, Page 110 */ static int dissect_group(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { int str_len; if (group_names_len < MAX_GROUP_NAME_LIST - 5) { str_len=tvb_get_nstringz(tvb,offset+4, MAX_GROUP_NAME_LIST-5-group_names_len, group_name_list+group_names_len); if((group_names_len>=(MAX_GROUP_NAME_LIST-5))||(str_len<0)){ g_snprintf(group_name_list+(MAX_GROUP_NAME_LIST-5), 5, "..."); group_names_len=MAX_GROUP_NAME_LIST - 1; } else { group_names_len+=str_len; group_name_list[group_names_len++]=' '; } group_name_list[group_names_len]=0; } offset = dissect_rpc_string(tvb, tree, hf_mount_groups_group, offset, NULL); return offset; } /* RFC 1094, Page 26 */ /* RFC 1813, Page 113 */ static int dissect_exportlist(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { proto_item* exportlist_item = NULL; proto_tree* exportlist_tree = NULL; int old_offset = offset; int groups_offset; proto_item* groups_item = NULL; proto_item* groups_tree = NULL; const char* directory; group_name_list[0]=0; group_names_len=0; if (tree) { exportlist_item = proto_tree_add_item(tree, hf_mount_exportlist, tvb, offset, -1, ENC_NA); if (exportlist_item) exportlist_tree = proto_item_add_subtree(exportlist_item, ett_mount_exportlist); } offset = dissect_rpc_string(tvb, exportlist_tree, hf_mount_exportlist_directory, offset, &directory); groups_offset = offset; if (tree) { groups_item = proto_tree_add_item(exportlist_tree, hf_mount_groups, tvb, offset, -1, ENC_NA); if (groups_item) groups_tree = proto_item_add_subtree(groups_item, ett_mount_groups); } offset = dissect_rpc_list(tvb, pinfo, groups_tree, offset, dissect_group); if (groups_item) { /* mark empty lists */ if (offset - groups_offset == 4) { proto_item_set_text(groups_item, "Groups: empty"); } /* now we know, that groups is shorter */ proto_item_set_len(groups_item, offset - groups_offset); } if (exportlist_item) { /* now we have a nicer string */ proto_item_set_text(exportlist_item, "Export List Entry: %s -> %s", directory,group_name_list); /* now we know, that exportlist is shorter */ proto_item_set_len(exportlist_item, offset - old_offset); } return offset; } /* RFC 1094, Page 26 */ /* RFC 1813, Page 113 */ static int dissect_mount_export_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_exportlist); return offset; } #define OFFS_MASK 32 /* offset of the "pc_mask" field */ #define PC_ERROR_ALL 0x0001 #define PC_ERROR_LINK_MAX 0x0002 #define PC_ERROR_MAX_CANON 0x0004 #define PC_ERROR_MAX_INPUT 0x0008 #define PC_ERROR_NAME_MAX 0x0010 #define PC_ERROR_PATH_MAX 0x0020 #define PC_ERROR_PIPE_BUF 0x0040 #define PC_CHOWN_RESTRICTED 0x0080 #define PC_NO_TRUNC 0x0100 #define PC_ERROR_VDISABLE 0x0200 static const true_false_string tos_error_all = { "All info invalid", "Some or all info valid" }; static const true_false_string tos_error_link_max = { "LINK_MAX invalid", "LINK_MAX valid" }; static const true_false_string tos_error_max_canon = { "MAX_CANON invalid", "MAX_CANON valid" }; static const true_false_string tos_error_max_input = { "MAX_INPUT invalid", "MAX_INPUT valid" }; static const true_false_string tos_error_name_max = { "NAME_MAX invalid", "NAME_MAX valid" }; static const true_false_string tos_error_path_max = { "PATH_MAX invalid", "PATH_MAX valid" }; static const true_false_string tos_error_pipe_buf = { "PIPE_BUF invalid", "PIPE_BUF valid" }; static const true_false_string tos_chown_restricted = { "Only a privileged user can change the ownership of a file", "Users may give away their own files" }; static const true_false_string tos_no_trunc = { "File names that are too long will get an error", "File names that are too long will be truncated" }; static const true_false_string tos_error_vdisable = { "VDISABLE invalid", "VDISABLE valid" }; static int dissect_mount_pathconf_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { guint32 pc_mask; proto_item *lock_item; proto_tree *lock_tree; /* * Extract the mask first, so we know which other fields the * server was able to return to us. */ pc_mask = tvb_get_ntohl(tvb, offset+OFFS_MASK) & 0xffff; if (!(pc_mask & (PC_ERROR_LINK_MAX|PC_ERROR_ALL))) { if (tree) { dissect_rpc_uint32(tvb,tree,hf_mount_pathconf_link_max,offset); } } offset += 4; if (!(pc_mask & (PC_ERROR_MAX_CANON|PC_ERROR_ALL))) { if (tree) { proto_tree_add_item(tree, hf_mount_pathconf_max_canon,tvb,offset+2,2, tvb_get_ntohs(tvb,offset)&0xffff); } } offset += 4; if (!(pc_mask & (PC_ERROR_MAX_INPUT|PC_ERROR_ALL))) { if (tree) { proto_tree_add_item(tree, hf_mount_pathconf_max_input,tvb,offset+2,2, tvb_get_ntohs(tvb,offset)&0xffff); } } offset += 4; if (!(pc_mask & (PC_ERROR_NAME_MAX|PC_ERROR_ALL))) { if (tree) { proto_tree_add_item(tree, hf_mount_pathconf_name_max,tvb,offset+2,2, tvb_get_ntohs(tvb,offset)&0xffff); } } offset += 4; if (!(pc_mask & (PC_ERROR_PATH_MAX|PC_ERROR_ALL))) { if (tree) { proto_tree_add_item(tree, hf_mount_pathconf_path_max,tvb,offset+2,2, tvb_get_ntohs(tvb,offset)&0xffff); } } offset += 4; if (!(pc_mask & (PC_ERROR_PIPE_BUF|PC_ERROR_ALL))) { if (tree) { proto_tree_add_item(tree, hf_mount_pathconf_pipe_buf,tvb,offset+2,2, tvb_get_ntohs(tvb,offset)&0xffff); } } offset += 4; offset += 4; /* skip "pc_xxx" pad field */ if (!(pc_mask & (PC_ERROR_VDISABLE|PC_ERROR_ALL))) { if (tree) { proto_tree_add_item(tree, hf_mount_pathconf_vdisable,tvb,offset+3,1, tvb_get_ntohs(tvb,offset)&0xffff); } } offset += 4; if (tree) { lock_item = proto_tree_add_item(tree, hf_mount_pathconf_mask, tvb, offset+2, 2, ENC_BIG_ENDIAN); lock_tree = proto_item_add_subtree(lock_item, ett_mount_pathconf_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_error_all, tvb, offset + 2, 2, pc_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_error_link_max, tvb, offset + 2, 2, pc_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_error_max_canon, tvb, offset + 2, 2, pc_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_error_max_input, tvb, offset + 2, 2, pc_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_error_name_max, tvb, offset + 2, 2, pc_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_error_path_max, tvb, offset + 2, 2, pc_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_error_pipe_buf, tvb, offset + 2, 2, pc_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_chown_restricted, tvb, offset + 2, 2, pc_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_no_trunc, tvb, offset + 2, 2, pc_mask); proto_tree_add_boolean(lock_tree, hf_mount_pathconf_error_vdisable, tvb, offset + 2, 2, pc_mask); } offset += 8; return offset; } /* RFC 1813, Page 107 */ static int dissect_mountstat3(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, int offset, int hfindex, guint32 *status) { guint32 mountstat3; mountstat3 = tvb_get_ntohl(tvb, offset); if(mountstat3){ col_append_fstr( pinfo->cinfo, COL_INFO, " Error:%s", val_to_str(mountstat3, mount3_mountstat3, "Unknown (0x%08X)")); } offset = dissect_rpc_uint32(tvb,tree,hfindex,offset); *status = mountstat3; return offset; } /* RFC 1831, Page 109 */ static int dissect_mount3_mnt_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 status; guint32 auth_flavors; guint32 auth_flavor; guint32 auth_flavor_i; offset = dissect_mountstat3(pinfo,tvb,tree,offset,hf_mount3_status,&status); switch (status) { case 0: offset = dissect_nfs3_fh(tvb,offset,pinfo,tree,"fhandle",NULL); auth_flavors = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(tree,hf_mount_flavors, tvb, offset, 4, auth_flavors); offset += 4; for (auth_flavor_i = 0 ; auth_flavor_i < auth_flavors ; auth_flavor_i++) { auth_flavor = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(tree,hf_mount_flavor, tvb, offset, 4, auth_flavor); offset += 4; } break; default: /* void */ break; } return offset; } static int dissect_sgi_exportlist(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { proto_item* exportlist_item = NULL; proto_tree* exportlist_tree = NULL; int old_offset = offset; const char* directory, *options; if (tree) { exportlist_item = proto_tree_add_item(tree, hf_mount_exportlist, tvb, offset, -1, ENC_NA); if (exportlist_item) exportlist_tree = proto_item_add_subtree(exportlist_item, ett_mount_exportlist); } offset = dissect_rpc_string(tvb, exportlist_tree, hf_mount_exportlist_directory, offset, &directory); offset = dissect_rpc_bool(tvb, exportlist_tree, hf_mount_has_options, offset); offset = dissect_rpc_string(tvb, exportlist_tree, hf_mount_options, offset, &options); if (exportlist_item) { /* now we have a nicer string */ proto_item_set_text(exportlist_item, "Export List Entry: %s %s", directory, options); /* now we know, that exportlist is shorter */ proto_item_set_len(exportlist_item, offset - old_offset); } return offset; } static int dissect_mount_exportlist_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { offset = dissect_rpc_list(tvb, pinfo, tree, offset, dissect_sgi_exportlist); return offset; } #define ST_RDONLY 0x00000001 #define ST_NOSUID 0x00000002 #define ST_NOTRUNC 0x00000004 #define ST_NODEV 0x20000000 #define ST_GRPID 0x40000000 #define ST_LOCAL 0x80000000 static const true_false_string tos_st_rdonly = { "Read-only file system", "Read/Write file system" }; static const true_false_string tos_st_nosuid = { "Does not support setuid/setgid semantics", "Supports setuid/setgid semantics" }; static const true_false_string tos_st_notrunc = { "Does not truncate filenames longer than NAME_MAX", "Truncates filenames longer than NAME_MAX" }; static const true_false_string tos_st_nodev = { "Disallows opening of device files", "Allows opening of device files" }; static const true_false_string tos_st_grpid = { "Group ID assigned from directory", "Group ID not assigned from directory" }; static const true_false_string tos_st_local = { "File system is local", "File system is not local" }; static int dissect_mount_statvfs_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { proto_item *flag_item; proto_tree *flag_tree; guint32 statvfs_flags; statvfs_flags = tvb_get_ntohl(tvb, offset+52); if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_bsize, offset); } offset += 4; if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_frsize, offset); } offset += 4; if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_blocks, offset); } offset += 4; if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_bfree, offset); } offset += 4; if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_bavail, offset); } offset += 4; if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_files, offset); } offset += 4; if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_ffree, offset); } offset += 4; if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_favail, offset); } offset += 4; if (tree) { dissect_rpc_bytes(tvb, tree, hf_mount_statvfs_basetype, offset, 16, TRUE, NULL); } offset += 16; if (tree) { dissect_rpc_bytes(tvb, tree, hf_mount_statvfs_fstr, offset, 32, FALSE, NULL); } offset += 32; if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_fsid, offset); } offset += 4; if (tree) { flag_item = proto_tree_add_item(tree, hf_mount_statvfs_flag, tvb, offset, 4, ENC_BIG_ENDIAN); if (flag_item) { flag_tree = proto_item_add_subtree(flag_item, ett_mount_statvfs_flag); proto_tree_add_boolean(flag_tree, hf_mount_statvfs_flag_rdonly, tvb, offset, 4, statvfs_flags); proto_tree_add_boolean(flag_tree, hf_mount_statvfs_flag_nosuid, tvb, offset, 4, statvfs_flags); proto_tree_add_boolean(flag_tree, hf_mount_statvfs_flag_notrunc, tvb, offset, 4, statvfs_flags); proto_tree_add_boolean(flag_tree, hf_mount_statvfs_flag_nodev, tvb, offset, 4, statvfs_flags); proto_tree_add_boolean(flag_tree, hf_mount_statvfs_flag_grpid, tvb, offset, 4, statvfs_flags); proto_tree_add_boolean(flag_tree, hf_mount_statvfs_flag_local, tvb, offset, 4, statvfs_flags); } } offset += 4; if (tree) { dissect_rpc_uint32(tvb, tree, hf_mount_statvfs_namemax, offset); } offset += 4; return offset; } /* proc number, "proc name", dissect_request, dissect_reply */ /* NULL as function pointer means: type of arguments is "void". */ /* Mount protocol version 1, RFC 1094 */ static const vsff mount1_proc[] = { { 0, "NULL", NULL, NULL }, { MOUNTPROC_MNT, "MNT", dissect_mount_dirpath_call, dissect_mount1_mnt_reply }, { MOUNTPROC_DUMP, "DUMP", NULL, dissect_mount_dump_reply }, { MOUNTPROC_UMNT, "UMNT", dissect_mount_dirpath_call, NULL }, { MOUNTPROC_UMNTALL, "UMNTALL", NULL, NULL }, { MOUNTPROC_EXPORT, "EXPORT", NULL, dissect_mount_export_reply }, { MOUNTPROC_EXPORTALL, "EXPORTALL", NULL, dissect_mount_export_reply }, { 0, NULL, NULL, NULL } }; static const value_string mount1_proc_vals[] = { { 0, "NULL" }, { MOUNTPROC_MNT, "MNT" }, { MOUNTPROC_DUMP, "DUMP" }, { MOUNTPROC_UMNT, "UMNT" }, { MOUNTPROC_UMNTALL, "UMNTALL" }, { MOUNTPROC_EXPORT, "EXPORT" }, { MOUNTPROC_EXPORTALL, "EXPORTALL" }, { 0, NULL } }; /* end of mount version 1 */ /* Mount protocol version 2, private communication from somebody at Sun; mount V2 is V1 plus MOUNTPROC_PATHCONF to fetch information for the POSIX "pathconf()" call. */ static const vsff mount2_proc[] = { { 0, "NULL", NULL, NULL }, { MOUNTPROC_MNT, "MNT", dissect_mount_dirpath_call, dissect_mount1_mnt_reply }, { MOUNTPROC_DUMP, "DUMP", NULL, dissect_mount_dump_reply }, { MOUNTPROC_UMNT, "UMNT", dissect_mount_dirpath_call, NULL }, { MOUNTPROC_UMNTALL, "UMNTALL", NULL, NULL }, { MOUNTPROC_EXPORT, "EXPORT", NULL, dissect_mount_export_reply }, { MOUNTPROC_EXPORTALL, "EXPORTALL", NULL, dissect_mount_export_reply }, { MOUNTPROC_PATHCONF, "PATHCONF", dissect_mount_dirpath_call, dissect_mount_pathconf_reply }, { 0, NULL, NULL, NULL } }; static const value_string mount2_proc_vals[] = { { 0, "NULL" }, { MOUNTPROC_MNT, "MNT" }, { MOUNTPROC_DUMP, "DUMP" }, { MOUNTPROC_UMNT, "UMNT" }, { MOUNTPROC_UMNTALL, "UMNTALL" }, { MOUNTPROC_EXPORT, "EXPORT" }, { MOUNTPROC_EXPORTALL, "EXPORTALL" }, { MOUNTPROC_PATHCONF, "PATHCONF" }, { 0, NULL } }; /* end of mount version 2 */ /* Mount protocol version 3, RFC 1813 */ static const vsff mount3_proc[] = { { 0, "NULL", NULL, NULL }, { MOUNTPROC_MNT, "MNT", dissect_mount_dirpath_call, dissect_mount3_mnt_reply }, { MOUNTPROC_DUMP, "DUMP", NULL, dissect_mount_dump_reply }, { MOUNTPROC_UMNT, "UMNT", dissect_mount_dirpath_call, NULL }, { MOUNTPROC_UMNTALL, "UMNTALL", NULL, NULL }, { MOUNTPROC_EXPORT, "EXPORT", NULL, dissect_mount_export_reply }, { 0, NULL, NULL, NULL } }; static const value_string mount3_proc_vals[] = { { 0, "NULL" }, { MOUNTPROC_MNT, "MNT" }, { MOUNTPROC_DUMP, "DUMP" }, { MOUNTPROC_UMNT, "UMNT" }, { MOUNTPROC_UMNTALL, "UMNTALL" }, { MOUNTPROC_EXPORT, "EXPORT" }, { 0, NULL } }; /* end of Mount protocol version 3 */ /* SGI mount protocol version 1; actually the same as v1 plus MOUNTPROC_EXPORTLIST and MOUNTPROC_STATVFS */ static const vsff sgi_mount1_proc[] = { { 0, "NULL", NULL, NULL }, { MOUNTPROC_MNT, "MNT", dissect_mount_dirpath_call, dissect_mount1_mnt_reply }, { MOUNTPROC_DUMP, "DUMP", NULL, dissect_mount_dump_reply }, { MOUNTPROC_UMNT, "UMNT", dissect_mount_dirpath_call, NULL }, { MOUNTPROC_UMNTALL, "UMNTALL", NULL, NULL }, { MOUNTPROC_EXPORT, "EXPORT", NULL, dissect_mount_export_reply }, { MOUNTPROC_EXPORTALL, "EXPORTALL", NULL, dissect_mount_export_reply }, { MOUNTPROC_EXPORTLIST,"EXPORTLIST", NULL, dissect_mount_exportlist_reply }, { MOUNTPROC_STATVFS, "STATVFS", dissect_mount_dirpath_call, dissect_mount_statvfs_reply }, { 0, NULL, NULL, NULL } }; static const value_string sgi_mount1_proc_vals[] = { { 0, "NULL" }, { MOUNTPROC_MNT, "MNT" }, { MOUNTPROC_DUMP, "DUMP" }, { MOUNTPROC_UMNT, "UMNT" }, { MOUNTPROC_UMNTALL, "UMNTALL" }, { MOUNTPROC_EXPORT, "EXPORT" }, { MOUNTPROC_EXPORTALL, "EXPORTALL" }, { MOUNTPROC_EXPORTLIST, "EXPORTLIST" }, { MOUNTPROC_STATVFS, "STATVFS" }, { 0, NULL } }; /* end of SGI mount protocol version 1 */ void proto_register_mount(void) { static hf_register_info hf[] = { { &hf_mount_procedure_v1, { "V1 Procedure", "mount.procedure_v1", FT_UINT32, BASE_DEC, VALS(mount1_proc_vals), 0, NULL, HFILL }}, { &hf_mount_procedure_v2, { "V2 Procedure", "mount.procedure_v2", FT_UINT32, BASE_DEC, VALS(mount2_proc_vals), 0, NULL, HFILL }}, { &hf_mount_procedure_v3, { "V3 Procedure", "mount.procedure_v3", FT_UINT32, BASE_DEC, VALS(mount3_proc_vals), 0, NULL, HFILL }}, { &hf_sgi_mount_procedure_v1, { "SGI V1 procedure", "mount.procedure_sgi_v1", FT_UINT32, BASE_DEC, VALS(sgi_mount1_proc_vals), 0, NULL, HFILL }}, { &hf_mount_path, { "Path", "mount.path", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount3_status, { "Status", "mount.status", FT_UINT32, BASE_DEC, VALS(mount3_mountstat3), 0, NULL, HFILL }}, { &hf_mount_mountlist_hostname, { "Hostname", "mount.dump.hostname", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount_mountlist_directory, { "Directory", "mount.dump.directory", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount_mountlist, { "Mount List Entry", "mount.dump.entry", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount_groups_group, { "Group", "mount.export.group", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount_groups, { "Groups", "mount.export.groups", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount_has_options, { "Has options", "mount.export.has_options", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_mount_options, { "Options", "mount.export.options", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount_exportlist_directory, { "Directory", "mount.export.directory", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount_exportlist, { "Export List Entry", "mount.export.entry", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount_pathconf_link_max, { "Maximum number of links to a file", "mount.pathconf.link_max", FT_UINT32, BASE_DEC, NULL, 0, "Maximum number of links allowed to a file", HFILL }}, { &hf_mount_pathconf_max_canon, { "Maximum terminal input line length", "mount.pathconf.max_canon", FT_UINT16, BASE_DEC, NULL, 0, "Max tty input line length", HFILL }}, { &hf_mount_pathconf_max_input, { "Terminal input buffer size", "mount.pathconf.max_input", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_mount_pathconf_name_max, { "Maximum file name length", "mount.pathconf.name_max", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_mount_pathconf_path_max, { "Maximum path name length", "mount.pathconf.path_max", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_mount_pathconf_pipe_buf, { "Pipe buffer size", "mount.pathconf.pipe_buf", FT_UINT16, BASE_DEC, NULL, 0, "Maximum amount of data that can be written atomically to a pipe", HFILL }}, { &hf_mount_pathconf_vdisable, { "VDISABLE character", "mount.pathconf.vdisable_char", FT_UINT8, BASE_HEX, NULL, 0, "Character value to disable a terminal special character", HFILL }}, { &hf_mount_pathconf_mask, { "Reply error/status bits", "mount.pathconf.mask", FT_UINT16, BASE_HEX, NULL, 0, "Bit mask with error and status bits", HFILL }}, { &hf_mount_pathconf_error_all, { "ERROR_ALL", "mount.pathconf.mask.error_all", FT_BOOLEAN, 16, TFS(&tos_error_all), PC_ERROR_ALL, NULL, HFILL }}, { &hf_mount_pathconf_error_link_max, { "ERROR_LINK_MAX", "mount.pathconf.mask.error_link_max", FT_BOOLEAN, 16, TFS(&tos_error_link_max), PC_ERROR_LINK_MAX, NULL, HFILL }}, { &hf_mount_pathconf_error_max_canon, { "ERROR_MAX_CANON", "mount.pathconf.mask.error_max_canon", FT_BOOLEAN, 16, TFS(&tos_error_max_canon), PC_ERROR_MAX_CANON, NULL, HFILL }}, { &hf_mount_pathconf_error_max_input, { "ERROR_MAX_INPUT", "mount.pathconf.mask.error_max_input", FT_BOOLEAN, 16, TFS(&tos_error_max_input), PC_ERROR_MAX_INPUT, NULL, HFILL }}, { &hf_mount_pathconf_error_name_max, { "ERROR_NAME_MAX", "mount.pathconf.mask.error_name_max", FT_BOOLEAN, 16, TFS(&tos_error_name_max), PC_ERROR_NAME_MAX, NULL, HFILL }}, { &hf_mount_pathconf_error_path_max, { "ERROR_PATH_MAX", "mount.pathconf.mask.error_path_max", FT_BOOLEAN, 16, TFS(&tos_error_path_max), PC_ERROR_PATH_MAX, NULL, HFILL }}, { &hf_mount_pathconf_error_pipe_buf, { "ERROR_PIPE_BUF", "mount.pathconf.mask.error_pipe_buf", FT_BOOLEAN, 16, TFS(&tos_error_pipe_buf), PC_ERROR_PIPE_BUF, NULL, HFILL }}, { &hf_mount_pathconf_chown_restricted, { "CHOWN_RESTRICTED", "mount.pathconf.mask.chown_restricted", FT_BOOLEAN, 16, TFS(&tos_chown_restricted), PC_CHOWN_RESTRICTED, NULL, HFILL }}, { &hf_mount_pathconf_no_trunc, { "NO_TRUNC", "mount.pathconf.mask.no_trunc", FT_BOOLEAN, 16, TFS(&tos_no_trunc), PC_NO_TRUNC, NULL, HFILL }}, { &hf_mount_pathconf_error_vdisable, { "ERROR_VDISABLE", "mount.pathconf.mask.error_vdisable", FT_BOOLEAN, 16, TFS(&tos_error_vdisable), PC_ERROR_VDISABLE, NULL, HFILL }}, { &hf_mount_statvfs_bsize, { "Block size", "mount.statvfs.f_bsize", FT_UINT32, BASE_DEC, NULL, 0, "File system block size", HFILL }}, { &hf_mount_statvfs_frsize, { "Fragment size", "mount.statvfs.f_frsize", FT_UINT32, BASE_DEC, NULL, 0, "File system fragment size", HFILL }}, { &hf_mount_statvfs_blocks, { "Blocks", "mount.statvfs.f_blocks", FT_UINT32, BASE_DEC, NULL, 0, "Total fragment sized blocks", HFILL }}, { &hf_mount_statvfs_bfree, { "Blocks Free", "mount.statvfs.f_bfree", FT_UINT32, BASE_DEC, NULL, 0, "Free fragment sized blocks", HFILL }}, { &hf_mount_statvfs_bavail, { "Blocks Available", "mount.statvfs.f_bavail", FT_UINT32, BASE_DEC, NULL, 0, "Available fragment sized blocks", HFILL }}, { &hf_mount_statvfs_files, { "Files", "mount.statvfs.f_files", FT_UINT32, BASE_DEC, NULL, 0, "Total files/inodes", HFILL }}, { &hf_mount_statvfs_ffree, { "Files Free", "mount.statvfs.f_ffree", FT_UINT32, BASE_DEC, NULL, 0, "Free files/inodes", HFILL }}, { &hf_mount_statvfs_favail, { "Files Available", "mount.statvfs.f_favail", FT_UINT32, BASE_DEC, NULL, 0, "Available files/inodes", HFILL }}, { &hf_mount_statvfs_fsid, { "File system ID", "mount.statvfs.f_fsid", FT_UINT32, BASE_DEC, NULL, 0, "File system identifier", HFILL }}, { &hf_mount_statvfs_basetype, { "Type", "mount.statvfs.f_basetype", FT_STRING, BASE_NONE, NULL, 0, "File system type", HFILL }}, { &hf_mount_statvfs_flag, { "Flags", "mount.statvfs.f_flag", FT_UINT32, BASE_HEX, NULL, 0, "Flags bit-mask", HFILL }}, { &hf_mount_statvfs_flag_rdonly, { "ST_RDONLY", "mount.statvfs.f_flag.st_rdonly", FT_BOOLEAN, 32, TFS(&tos_st_rdonly), ST_RDONLY, NULL, HFILL }}, { &hf_mount_statvfs_flag_nosuid, { "ST_NOSUID", "mount.statvfs.f_flag.st_nosuid", FT_BOOLEAN, 32, TFS(&tos_st_nosuid), ST_NOSUID, NULL, HFILL }}, { &hf_mount_statvfs_flag_notrunc, { "ST_NOTRUNC", "mount.statvfs.f_flag.st_notrunc", FT_BOOLEAN, 32, TFS(&tos_st_notrunc), ST_NOTRUNC, NULL, HFILL }}, { &hf_mount_statvfs_flag_nodev, { "ST_NODEV", "mount.statvfs.f_flag.st_nodev", FT_BOOLEAN, 32, TFS(&tos_st_nodev), ST_NODEV, NULL, HFILL }}, { &hf_mount_statvfs_flag_grpid, { "ST_GRPID", "mount.statvfs.f_flag.st_grpid", FT_BOOLEAN, 32, TFS(&tos_st_grpid), ST_GRPID, NULL, HFILL }}, { &hf_mount_statvfs_flag_local, { "ST_LOCAL", "mount.statvfs.f_flag.st_local", FT_BOOLEAN, 32, TFS(&tos_st_local), ST_LOCAL, NULL, HFILL }}, { &hf_mount_statvfs_namemax, { "Maximum file name length", "mount.statvfs.f_namemax", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_mount_statvfs_fstr, { "File system specific string", "mount.statvfs.f_fstr", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mount_flavors, { "Flavors", "mount.flavors", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_mount_flavor, { "Flavor", "mount.flavor", FT_UINT32, BASE_DEC, VALS(rpc_auth_flavor), 0, NULL, HFILL }}, }; static gint *ett[] = { &ett_mount, &ett_mount_mountlist, &ett_mount_groups, &ett_mount_exportlist, &ett_mount_pathconf_mask, &ett_mount_statvfs_flag, }; proto_mount = proto_register_protocol("Mount Service", "MOUNT", "mount"); proto_sgi_mount = proto_register_protocol("SGI Mount Service", "SGI MOUNT", "sgimount"); proto_register_field_array(proto_mount, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } void proto_reg_handoff_mount(void) { /* Register the protocol as RPC */ rpc_init_prog(proto_mount, MOUNT_PROGRAM, ett_mount); rpc_init_prog(proto_sgi_mount, SGI_MOUNT_PROGRAM, ett_mount); /* Register the procedure tables */ rpc_init_proc_table(MOUNT_PROGRAM, 1, mount1_proc, hf_mount_procedure_v1); rpc_init_proc_table(MOUNT_PROGRAM, 2, mount2_proc, hf_mount_procedure_v2); rpc_init_proc_table(MOUNT_PROGRAM, 3, mount3_proc, hf_mount_procedure_v3); rpc_init_proc_table(SGI_MOUNT_PROGRAM, 1, sgi_mount1_proc, hf_sgi_mount_procedure_v1); }
gpl-2.0
lakid/libaria
java/com/mobilerobots/Aria/ArJoyVec3f.java
2914
/* Adept MobileRobots Robotics Interface for Applications (ARIA) Copyright (C) 2004-2005 ActivMedia Robotics LLC Copyright (C) 2006-2010 MobileRobots Inc. Copyright (C) 2011-2014 Adept Technology 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA If you wish to redistribute ARIA under different terms, contact Adept MobileRobots for information about a commercial version of ARIA at [email protected] or Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960 */ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ package com.mobilerobots.Aria; public class ArJoyVec3f { /* (begin code from javabody typemap) */ private long swigCPtr; protected boolean swigCMemOwn; /* for internal use by swig only */ public ArJoyVec3f(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = cPtr; } /* for internal use by swig only */ public static long getCPtr(ArJoyVec3f obj) { return (obj == null) ? 0 : obj.swigCPtr; } /* (end code from javabody typemap) */ protected void finalize() { delete(); } public synchronized void delete() { if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; AriaJavaJNI.delete_ArJoyVec3f(swigCPtr); } swigCPtr = 0; } } public void setX(double value) { AriaJavaJNI.ArJoyVec3f_x_set(swigCPtr, this, value); } public double getX() { return AriaJavaJNI.ArJoyVec3f_x_get(swigCPtr, this); } public void setY(double value) { AriaJavaJNI.ArJoyVec3f_y_set(swigCPtr, this, value); } public double getY() { return AriaJavaJNI.ArJoyVec3f_y_get(swigCPtr, this); } public void setZ(double value) { AriaJavaJNI.ArJoyVec3f_z_set(swigCPtr, this, value); } public double getZ() { return AriaJavaJNI.ArJoyVec3f_z_get(swigCPtr, this); } public ArJoyVec3f() { this(AriaJavaJNI.new_ArJoyVec3f(), true); } }
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c91718579.lua
3238
--ゴゴゴアリステラ&デクシア function c91718579.initial_effect(c) --untargetable local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetCondition(c91718579.tgcon) e1:SetValue(c91718579.atlimit) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x59)) e2:SetCondition(c91718579.tgcon) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --effect gain local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_BE_MATERIAL) e3:SetCondition(c91718579.effcon) e3:SetOperation(c91718579.effop) c:RegisterEffect(e3) end function c91718579.cfilter(c) return c:IsFaceup() and c:IsSetCard(0x59) end function c91718579.tgcon(e) return Duel.IsExistingMatchingCard(c91718579.cfilter,0,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end function c91718579.atlimit(e,c) return c:IsFaceup() and c:IsSetCard(0x59) end function c91718579.effcon(e,tp,eg,ep,ev,re,r,rp) local mg=e:GetHandler():GetReasonCard():GetMaterial() return r==REASON_XYZ and mg:IsExists(Card.IsSetCard,mg:GetCount(),nil,0x59) end function c91718579.effop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,91718579) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(rc) e1:SetDescription(aux.Stringid(91718579,0)) e1:SetCategory(CATEGORY_POSITION+CATEGORY_DEFCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c91718579.poscon) e1:SetTarget(c91718579.postg) e1:SetOperation(c91718579.posop) e1:SetReset(RESET_EVENT+0x1fe0000) rc:RegisterEffect(e1,true) if not rc:IsType(TYPE_EFFECT) then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_ADD_TYPE) e2:SetValue(TYPE_EFFECT) e2:SetReset(RESET_EVENT+0x1fe0000) rc:RegisterEffect(e2,true) end end function c91718579.poscon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_XYZ end function c91718579.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsPosition(POS_FACEUP_ATTACK) end if chk==0 then return Duel.IsExistingTarget(Card.IsPosition,tp,0,LOCATION_MZONE,1,nil,POS_FACEUP_ATTACK) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,Card.IsPosition,tp,0,LOCATION_MZONE,1,1,nil,POS_FACEUP_ATTACK) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function c91718579.posop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsDefensePos() or not tc:IsRelateToEffect(e) then return end if Duel.ChangePosition(tc,POS_FACEUP_DEFENSE)==0 then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_DEFENSE_FINAL) e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetValue(0) tc:RegisterEffect(e1) end
gpl-2.0
afaerber/qemu-cpu
block/qed-table.c
8769
/* * QEMU Enhanced Disk Format Table I/O * * Copyright IBM, Corp. 2010 * * Authors: * Stefan Hajnoczi <[email protected]> * Anthony Liguori <[email protected]> * * This work is licensed under the terms of the GNU LGPL, version 2 or later. * See the COPYING.LIB file in the top-level directory. * */ #include "qemu/osdep.h" #include "trace.h" #include "qemu/sockets.h" /* for EINPROGRESS on Windows */ #include "qed.h" #include "qemu/bswap.h" typedef struct { GenericCB gencb; BDRVQEDState *s; QEDTable *table; struct iovec iov; QEMUIOVector qiov; } QEDReadTableCB; static void qed_read_table_cb(void *opaque, int ret) { QEDReadTableCB *read_table_cb = opaque; QEDTable *table = read_table_cb->table; int noffsets = read_table_cb->qiov.size / sizeof(uint64_t); int i; /* Handle I/O error */ if (ret) { goto out; } /* Byteswap offsets */ for (i = 0; i < noffsets; i++) { table->offsets[i] = le64_to_cpu(table->offsets[i]); } out: /* Completion */ trace_qed_read_table_cb(read_table_cb->s, read_table_cb->table, ret); gencb_complete(&read_table_cb->gencb, ret); } static void qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, BlockCompletionFunc *cb, void *opaque) { QEDReadTableCB *read_table_cb = gencb_alloc(sizeof(*read_table_cb), cb, opaque); QEMUIOVector *qiov = &read_table_cb->qiov; trace_qed_read_table(s, offset, table); read_table_cb->s = s; read_table_cb->table = table; read_table_cb->iov.iov_base = table->offsets, read_table_cb->iov.iov_len = s->header.cluster_size * s->header.table_size, qemu_iovec_init_external(qiov, &read_table_cb->iov, 1); bdrv_aio_readv(s->bs->file->bs, offset / BDRV_SECTOR_SIZE, qiov, qiov->size / BDRV_SECTOR_SIZE, qed_read_table_cb, read_table_cb); } typedef struct { GenericCB gencb; BDRVQEDState *s; QEDTable *orig_table; QEDTable *table; bool flush; /* flush after write? */ struct iovec iov; QEMUIOVector qiov; } QEDWriteTableCB; static void qed_write_table_cb(void *opaque, int ret) { QEDWriteTableCB *write_table_cb = opaque; trace_qed_write_table_cb(write_table_cb->s, write_table_cb->orig_table, write_table_cb->flush, ret); if (ret) { goto out; } if (write_table_cb->flush) { /* We still need to flush first */ write_table_cb->flush = false; bdrv_aio_flush(write_table_cb->s->bs, qed_write_table_cb, write_table_cb); return; } out: qemu_vfree(write_table_cb->table); gencb_complete(&write_table_cb->gencb, ret); } /** * Write out an updated part or all of a table * * @s: QED state * @offset: Offset of table in image file, in bytes * @table: Table * @index: Index of first element * @n: Number of elements * @flush: Whether or not to sync to disk * @cb: Completion function * @opaque: Argument for completion function */ static void qed_write_table(BDRVQEDState *s, uint64_t offset, QEDTable *table, unsigned int index, unsigned int n, bool flush, BlockCompletionFunc *cb, void *opaque) { QEDWriteTableCB *write_table_cb; unsigned int sector_mask = BDRV_SECTOR_SIZE / sizeof(uint64_t) - 1; unsigned int start, end, i; size_t len_bytes; trace_qed_write_table(s, offset, table, index, n); /* Calculate indices of the first and one after last elements */ start = index & ~sector_mask; end = (index + n + sector_mask) & ~sector_mask; len_bytes = (end - start) * sizeof(uint64_t); write_table_cb = gencb_alloc(sizeof(*write_table_cb), cb, opaque); write_table_cb->s = s; write_table_cb->orig_table = table; write_table_cb->flush = flush; write_table_cb->table = qemu_blockalign(s->bs, len_bytes); write_table_cb->iov.iov_base = write_table_cb->table->offsets; write_table_cb->iov.iov_len = len_bytes; qemu_iovec_init_external(&write_table_cb->qiov, &write_table_cb->iov, 1); /* Byteswap table */ for (i = start; i < end; i++) { uint64_t le_offset = cpu_to_le64(table->offsets[i]); write_table_cb->table->offsets[i - start] = le_offset; } /* Adjust for offset into table */ offset += start * sizeof(uint64_t); bdrv_aio_writev(s->bs->file->bs, offset / BDRV_SECTOR_SIZE, &write_table_cb->qiov, write_table_cb->qiov.size / BDRV_SECTOR_SIZE, qed_write_table_cb, write_table_cb); } /** * Propagate return value from async callback */ static void qed_sync_cb(void *opaque, int ret) { *(int *)opaque = ret; } int qed_read_l1_table_sync(BDRVQEDState *s) { int ret = -EINPROGRESS; qed_read_table(s, s->header.l1_table_offset, s->l1_table, qed_sync_cb, &ret); while (ret == -EINPROGRESS) { aio_poll(bdrv_get_aio_context(s->bs), true); } return ret; } void qed_write_l1_table(BDRVQEDState *s, unsigned int index, unsigned int n, BlockCompletionFunc *cb, void *opaque) { BLKDBG_EVENT(s->bs->file, BLKDBG_L1_UPDATE); qed_write_table(s, s->header.l1_table_offset, s->l1_table, index, n, false, cb, opaque); } int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, unsigned int n) { int ret = -EINPROGRESS; qed_write_l1_table(s, index, n, qed_sync_cb, &ret); while (ret == -EINPROGRESS) { aio_poll(bdrv_get_aio_context(s->bs), true); } return ret; } typedef struct { GenericCB gencb; BDRVQEDState *s; uint64_t l2_offset; QEDRequest *request; } QEDReadL2TableCB; static void qed_read_l2_table_cb(void *opaque, int ret) { QEDReadL2TableCB *read_l2_table_cb = opaque; QEDRequest *request = read_l2_table_cb->request; BDRVQEDState *s = read_l2_table_cb->s; CachedL2Table *l2_table = request->l2_table; uint64_t l2_offset = read_l2_table_cb->l2_offset; if (ret) { /* can't trust loaded L2 table anymore */ qed_unref_l2_cache_entry(l2_table); request->l2_table = NULL; } else { l2_table->offset = l2_offset; qed_commit_l2_cache_entry(&s->l2_cache, l2_table); /* This is guaranteed to succeed because we just committed the entry * to the cache. */ request->l2_table = qed_find_l2_cache_entry(&s->l2_cache, l2_offset); assert(request->l2_table != NULL); } gencb_complete(&read_l2_table_cb->gencb, ret); } void qed_read_l2_table(BDRVQEDState *s, QEDRequest *request, uint64_t offset, BlockCompletionFunc *cb, void *opaque) { QEDReadL2TableCB *read_l2_table_cb; qed_unref_l2_cache_entry(request->l2_table); /* Check for cached L2 entry */ request->l2_table = qed_find_l2_cache_entry(&s->l2_cache, offset); if (request->l2_table) { cb(opaque, 0); return; } request->l2_table = qed_alloc_l2_cache_entry(&s->l2_cache); request->l2_table->table = qed_alloc_table(s); read_l2_table_cb = gencb_alloc(sizeof(*read_l2_table_cb), cb, opaque); read_l2_table_cb->s = s; read_l2_table_cb->l2_offset = offset; read_l2_table_cb->request = request; BLKDBG_EVENT(s->bs->file, BLKDBG_L2_LOAD); qed_read_table(s, offset, request->l2_table->table, qed_read_l2_table_cb, read_l2_table_cb); } int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offset) { int ret = -EINPROGRESS; qed_read_l2_table(s, request, offset, qed_sync_cb, &ret); while (ret == -EINPROGRESS) { aio_poll(bdrv_get_aio_context(s->bs), true); } return ret; } void qed_write_l2_table(BDRVQEDState *s, QEDRequest *request, unsigned int index, unsigned int n, bool flush, BlockCompletionFunc *cb, void *opaque) { BLKDBG_EVENT(s->bs->file, BLKDBG_L2_UPDATE); qed_write_table(s, request->l2_table->offset, request->l2_table->table, index, n, flush, cb, opaque); } int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request, unsigned int index, unsigned int n, bool flush) { int ret = -EINPROGRESS; qed_write_l2_table(s, request, index, n, flush, qed_sync_cb, &ret); while (ret == -EINPROGRESS) { aio_poll(bdrv_get_aio_context(s->bs), true); } return ret; }
gpl-2.0
zimmermant/dlvo_lammps
doc/html/write_data.html
12901
<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>write_data command &mdash; LAMMPS documentation</title> <link rel="stylesheet" href="_static/css/theme.css" type="text/css" /> <link rel="stylesheet" href="_static/sphinxcontrib-images/LightBox2/lightbox2/css/lightbox.css" type="text/css" /> <link rel="top" title="LAMMPS documentation" href="index.html"/> <script src="_static/js/modernizr.min.js"></script> </head> <body class="wy-body-for-nav" role="document"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-nav-search"> <a href="Manual.html" class="icon icon-home"> LAMMPS </a> <div role="search"> <form id="rtd-search-form" class="wy-form" action="search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <ul> <li class="toctree-l1"><a class="reference internal" href="Section_intro.html">1. Introduction</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_start.html">2. Getting Started</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_commands.html">3. Commands</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_packages.html">4. Packages</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_accelerate.html">5. Accelerating LAMMPS performance</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_howto.html">6. How-to discussions</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_example.html">7. Example problems</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_perf.html">8. Performance &amp; scalability</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_tools.html">9. Additional tools</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_modify.html">10. Modifying &amp; extending LAMMPS</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_python.html">11. Python interface to LAMMPS</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_errors.html">12. Errors</a></li> <li class="toctree-l1"><a class="reference internal" href="Section_history.html">13. Future and history</a></li> </ul> </div> &nbsp; </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="Manual.html">LAMMPS</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="Manual.html">Docs</a> &raquo;</li> <li>write_data command</li> <li class="wy-breadcrumbs-aside"> <a href="http://lammps.sandia.gov">Website</a> <a href="Section_commands.html#comm">Commands</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <div class="section" id="write-data-command"> <span id="index-0"></span><h1>write_data command</h1> <div class="section" id="syntax"> <h2>Syntax</h2> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">write_data</span> <span class="n">file</span> <span class="n">keyword</span> <span class="n">value</span> <span class="o">...</span> </pre></div> </div> <ul class="simple"> <li>file = name of data file to write out</li> <li>zero or more keyword/value pairs may be appended</li> <li>keyword = <em>pair</em> or <em>nocoeff</em></li> </ul> <pre class="literal-block"> <em>nocoeff</em> = do not write out force field info <em>pair</em> value = <em>ii</em> or <em>ij</em> <em>ii</em> = write one line of pair coefficient info per atom type <em>ij</em> = write one line of pair coefficient info per IJ atom type pair </pre> </div> <div class="section" id="examples"> <h2>Examples</h2> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">write_data</span> <span class="n">data</span><span class="o">.</span><span class="n">polymer</span> <span class="n">write_data</span> <span class="n">data</span><span class="o">.*</span> </pre></div> </div> </div> <div class="section" id="description"> <h2>Description</h2> <p>Write a data file in text format of the current state of the simulation. Data files can be read by the <a class="reference internal" href="read_data.html"><span class="doc">read data</span></a> command to begin a simulation. The <a class="reference internal" href="read_data.html"><span class="doc">read_data</span></a> command also describes their format.</p> <p>Similar to <a class="reference internal" href="dump.html"><span class="doc">dump</span></a> files, the data filename can contain a &#8220;*&#8221; wild-card character. The &#8220;*&#8221; is replaced with the current timestep value.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">The write-data command is not yet fully implemented in two respects. First, most pair styles do not yet write their coefficient information into the data file. This means you will need to specify that information in your input script that reads the data file, via the <a class="reference internal" href="pair_coeff.html"><span class="doc">pair_coeff</span></a> command. Second, a few of the <a class="reference internal" href="atom_style.html"><span class="doc">atom styles</span></a> (body, ellipsoid, line, tri) that store auxiliary &#8220;bonus&#8221; information about aspherical particles, do not yet write the bonus info into the data file. Both these functionalities will be added to the write_data command later.</p> </div> <p>Because a data file is in text format, if you use a data file written out by this command to restart a simulation, the initial state of the new run will be slightly different than the final state of the old run (when the file was written) which was represented internally by LAMMPS in binary format. A new simulation which reads the data file will thus typically diverge from a simulation that continued in the original input script.</p> <p>If you want to do more exact restarts, using binary files, see the <a class="reference internal" href="restart.html"><span class="doc">restart</span></a>, <a class="reference internal" href="write_restart.html"><span class="doc">write_restart</span></a>, and <a class="reference internal" href="read_restart.html"><span class="doc">read_restart</span></a> commands. You can also convert binary restart files to text data files, after a simulation has run, using the <a class="reference internal" href="Section_start.html#start-7"><span class="std std-ref">-r command-line switch</span></a>.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">Only limited information about a simulation is stored in a data file. For example, no information about atom <a class="reference internal" href="group.html"><span class="doc">groups</span></a> and <a class="reference internal" href="fix.html"><span class="doc">fixes</span></a> are stored. <a class="reference internal" href="read_restart.html"><span class="doc">Binary restart files</span></a> store more information.</p> </div> <p>Bond interactions (angle, etc) that have been turned off by the <a class="reference internal" href="fix_shake.html"><span class="doc">fix shake</span></a> or <a class="reference internal" href="delete_bonds.html"><span class="doc">delete_bonds</span></a> command will be written to a data file as if they are turned on. This means they will need to be turned off again in a new run after the data file is read.</p> <p>Bonds that are broken (e.g. by a bond-breaking potential) are not written to the data file. Thus these bonds will not exist when the data file is read.</p> <hr class="docutils" /> <p>The <em>nocoeff</em> keyword requests that no force field parameters should be written to the data file. This can be very helpful, if one wants to make significant changes to the force field or if the parameters are read in separately anyway, e.g. from an include file.</p> <p>The <em>pair</em> keyword lets you specify in what format the pair coefficient information is written into the data file. If the value is specified as <em>ii</em>, then one line per atom type is written, to specify the coefficients for each of the I=J interactions. This means that no cross-interactions for I != J will be specified in the data file and the pair style will apply its mixing rule, as documented on individual <a class="reference internal" href="pair_style.html"><span class="doc">pair_style</span></a> doc pages. Of course this behavior can be overridden in the input script after reading the data file, by specifying additional <a class="reference internal" href="pair_coeff.html"><span class="doc">pair_coeff</span></a> commands for any desired I,J pairs.</p> <p>If the value is specified as <em>ij</em>, then one line of coefficients is written for all I,J pairs where I &lt;= J. These coefficients will include any specific settings made in the input script up to that point. The presence of these I != J coefficients in the data file will effectively turn off the default mixing rule for the pair style. Again, the coefficient values in the data file can can be overridden in the input script after reading the data file, by specifying additional <a class="reference internal" href="pair_coeff.html"><span class="doc">pair_coeff</span></a> commands for any desired I,J pairs.</p> </div> <hr class="docutils" /> <div class="section" id="restrictions"> <h2>Restrictions</h2> <p>This command requires inter-processor communication to migrate atoms before the data file is written. This means that your system must be ready to perform a simulation before using this command (force fields setup, atom masses initialized, etc).</p> </div> <div class="section" id="related-commands"> <h2>Related commands</h2> <p><a class="reference internal" href="read_data.html"><span class="doc">read_data</span></a>, <a class="reference internal" href="write_restart.html"><span class="doc">write_restart</span></a></p> </div> <div class="section" id="default"> <h2>Default</h2> <p>The option defaults are pair = ii.</p> </div> </div> </div> </div> <footer> <hr/> <div role="contentinfo"> <p> &copy; Copyright 2013 Sandia Corporation. </p> </div> Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT:'./', VERSION:'', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script type="text/javascript" src="_static/sphinxcontrib-images/LightBox2/lightbox2/js/jquery-1.11.0.min.js"></script> <script type="text/javascript" src="_static/sphinxcontrib-images/LightBox2/lightbox2/js/lightbox.min.js"></script> <script type="text/javascript" src="_static/sphinxcontrib-images/LightBox2/lightbox2-customize/jquery-noconflict.js"></script> <script type="text/javascript" src="_static/js/theme.js"></script> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.StickyNav.enable(); }); </script> </body> </html>
gpl-2.0
swsachith/ANDROPHSY
solr/docs/solr-langid/index.html
2738
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc on Thu Apr 09 10:38:54 MDT 2015 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>Solr 5.1.0 API</title> <script type="text/javascript"> targetPage = "" + window.location.search; if (targetPage != "" && targetPage != "undefined") targetPage = targetPage.substring(1); if (targetPage.indexOf(":") != -1 || (targetPage != "" && !validURL(targetPage))) targetPage = "undefined"; function validURL(url) { try { url = decodeURIComponent(url); } catch (error) { return false; } var pos = url.indexOf(".html"); if (pos == -1 || pos != url.length - 5) return false; var allowNumber = false; var allowSep = false; var seenDot = false; for (var i = 0; i < url.length - 5; i++) { var ch = url.charAt(i); if ('a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '$' || ch == '_' || ch.charCodeAt(0) > 127) { allowNumber = true; allowSep = true; } else if ('0' <= ch && ch <= '9' || ch == '-') { if (!allowNumber) return false; } else if (ch == '/' || ch == '.') { if (!allowSep) return false; allowNumber = false; allowSep = false; if (ch == '.') seenDot = true; if (ch == '/' && seenDot) return false; } else { return false; } } return true; } function loadFrames() { if (targetPage != "" && targetPage != "undefined") top.classFrame.location = top.targetPage; } </script> </head> <frameset cols="20%,80%" title="Documentation frame" onload="top.loadFrames()"> <frame src="allclasses-frame.html" name="packageFrame" title="All classes and interfaces (except non-static nested types)"> <frame src="overview-summary.html" name="classFrame" title="Package, class and interface descriptions" scrolling="yes"> <noframes> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <h2>Frame Alert</h2> <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> </noframes> </frameset> </html>
gpl-2.0
knil-sama/YADDW
lib/apache-jena-2.12.1/javadoc-arq/com/hp/hpl/jena/sparql/class-use/ARQException.html
20644
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_45) on Thu Oct 02 16:39:53 BST 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>Uses of Class com.hp.hpl.jena.sparql.ARQException (Apache Jena ARQ)</title> <meta name="date" content="2014-10-02"> <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="Uses of Class com.hp.hpl.jena.sparql.ARQException (Apache Jena ARQ)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <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><a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">Class</a></li> <li class="navBarCell1Rev">Use</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</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?com/hp/hpl/jena/sparql/class-use/ARQException.html" target="_top">Frames</a></li> <li><a href="ARQException.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class com.hp.hpl.jena.sparql.ARQException" class="title">Uses of Class<br>com.hp.hpl.jena.sparql.ARQException</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.query">com.hp.hpl.jena.query</a></td> <td class="colLast"> <div class="block">ARQ - A query engine for Jena, implementing SPARQL.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.sparql">com.hp.hpl.jena.sparql</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.sparql.core">com.hp.hpl.jena.sparql.core</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.sparql.engine.http">com.hp.hpl.jena.sparql.engine.http</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.sparql.expr">com.hp.hpl.jena.sparql.expr</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.sparql.resultset">com.hp.hpl.jena.sparql.resultset</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.sparql.sse">com.hp.hpl.jena.sparql.sse</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.update">com.hp.hpl.jena.update</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="com.hp.hpl.jena.query"> <!-- --> </a> <h3>Uses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/query/package-summary.html">com.hp.hpl.jena.query</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/query/package-summary.html">com.hp.hpl.jena.query</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/query/QueryBuildException.html" title="class in com.hp.hpl.jena.query">QueryBuildException</a></strong></code> <div class="block">QueryBuildException is exception for all excpetions during query execution construction.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/query/QueryCancelledException.html" title="class in com.hp.hpl.jena.query">QueryCancelledException</a></strong></code> <div class="block">Indicate that a query execution has been cancelled and the operation can't be called</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/query/QueryException.html" title="class in com.hp.hpl.jena.query">QueryException</a></strong></code> <div class="block">QueryException is root exception for all (intentional) exceptions associated with query parsing and execution.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/query/QueryExecException.html" title="class in com.hp.hpl.jena.query">QueryExecException</a></strong></code> <div class="block">QueryExecException indicates a condition encountered during query evaluation.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/query/QueryFatalException.html" title="class in com.hp.hpl.jena.query">QueryFatalException</a></strong></code> <div class="block">QueryFatalException is such that the query aborts do to some problem (this might be an internal error or something in the way the query builds or executes).</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/query/QueryParseException.html" title="class in com.hp.hpl.jena.query">QueryParseException</a></strong></code> <div class="block">QueryParseException is root exception for all (intentional) exceptions from the various parsers where the error is to do with the syntax of a query.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.sparql"> <!-- --> </a> <h3>Uses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/package-summary.html">com.hp.hpl.jena.sparql</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/package-summary.html">com.hp.hpl.jena.sparql</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/ARQInternalErrorException.html" title="class in com.hp.hpl.jena.sparql">ARQInternalErrorException</a></strong></code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/ARQNotImplemented.html" title="class in com.hp.hpl.jena.sparql">ARQNotImplemented</a></strong></code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.sparql.core"> <!-- --> </a> <h3>Uses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/core/package-summary.html">com.hp.hpl.jena.sparql.core</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/core/package-summary.html">com.hp.hpl.jena.sparql.core</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/core/QueryCheckException.html" title="class in com.hp.hpl.jena.sparql.core">QueryCheckException</a></strong></code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.sparql.engine.http"> <!-- --> </a> <h3>Uses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/engine/http/package-summary.html">com.hp.hpl.jena.sparql.engine.http</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/engine/http/package-summary.html">com.hp.hpl.jena.sparql.engine.http</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/engine/http/QueryExceptionHTTP.html" title="class in com.hp.hpl.jena.sparql.engine.http">QueryExceptionHTTP</a></strong></code> <div class="block">Exception class for all operations in the SPARQL client library.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.sparql.expr"> <!-- --> </a> <h3>Uses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/expr/package-summary.html">com.hp.hpl.jena.sparql.expr</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/expr/package-summary.html">com.hp.hpl.jena.sparql.expr</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/expr/ExprEvalException.html" title="class in com.hp.hpl.jena.sparql.expr">ExprEvalException</a></strong></code> <div class="block">Exception for a dynamic evaluation exception.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/expr/ExprEvalTypeException.html" title="class in com.hp.hpl.jena.sparql.expr">ExprEvalTypeException</a></strong></code> <div class="block">Exception for a dynamic evaluation exception due to wrong type.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/expr/ExprException.html" title="class in com.hp.hpl.jena.sparql.expr">ExprException</a></strong></code> <div class="block">The root of all expression exceptions</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/expr/ExprNotComparableException.html" title="class in com.hp.hpl.jena.sparql.expr">ExprNotComparableException</a></strong></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/expr/ExprTypeException.html" title="class in com.hp.hpl.jena.sparql.expr">ExprTypeException</a></strong></code> <div class="block">Exception for a dynamic evaluation exception caused by a type mismatch.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/expr/ExprUndefException.html" title="class in com.hp.hpl.jena.sparql.expr">ExprUndefException</a></strong></code> <div class="block">Exception for an undefined expression (including unbound variable)</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/expr/VariableNotBoundException.html" title="class in com.hp.hpl.jena.sparql.expr">VariableNotBoundException</a></strong></code> <div class="block">Exception for an undefined expression (including unbound variable)</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.sparql.resultset"> <!-- --> </a> <h3>Uses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/resultset/package-summary.html">com.hp.hpl.jena.sparql.resultset</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/resultset/package-summary.html">com.hp.hpl.jena.sparql.resultset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/resultset/ResultSetException.html" title="class in com.hp.hpl.jena.sparql.resultset">ResultSetException</a></strong></code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.sparql.sse"> <!-- --> </a> <h3>Uses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/sse/package-summary.html">com.hp.hpl.jena.sparql.sse</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/sparql/sse/package-summary.html">com.hp.hpl.jena.sparql.sse</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/sparql/sse/SSEParseException.html" title="class in com.hp.hpl.jena.sparql.sse">SSEParseException</a></strong></code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.update"> <!-- --> </a> <h3>Uses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/update/package-summary.html">com.hp.hpl.jena.update</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">ARQException</a> in <a href="../../../../../../com/hp/hpl/jena/update/package-summary.html">com.hp.hpl.jena.update</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../com/hp/hpl/jena/update/UpdateException.html" title="class in com.hp.hpl.jena.update">UpdateException</a></strong></code> <div class="block">Exception root for SPARQL Update</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_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><a href="../../../../../../com/hp/hpl/jena/sparql/ARQException.html" title="class in com.hp.hpl.jena.sparql">Class</a></li> <li class="navBarCell1Rev">Use</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</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?com/hp/hpl/jena/sparql/class-use/ARQException.html" target="_top">Frames</a></li> <li><a href="ARQException.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Licenced under the Apache License, Version 2.0</small></p> </body> </html>
gpl-2.0
skyHALud/codenameone
Ports/iOSPort/xmlvm/src/xmlvm2objc/compat-lib/java/org/xmlvm/iphone/SKRequest.java
1255
/* Copyright (c) 2002-2011 by XMLVM.org * * Project Info: http://www.xmlvm.org * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. */ package org.xmlvm.iphone; import org.xmlvm.XMLVMSkeletonOnly; @XMLVMSkeletonOnly public abstract class SKRequest extends NSObject { private SKRequestDelegate delegate; public void start() { } public void cancel() { } public SKRequestDelegate getDelegate() { return delegate; } public void setDelegate(SKRequestDelegate delegate) { this.delegate = delegate; } }
gpl-2.0
Saarlonz/Ilch-2.0
application/modules/sample/models/Sample.php
126
<?php /** * @copyright Ilch 2.0 * @package ilch */ namespace Modules\Sample\Models; class Sample extends \Ilch\Model { }
gpl-2.0
ShevT/android_kernel_d1_p1
drivers/video/omap2/dss/hdmi_panel.c
12117
/* * hdmi_panel.c * * HDMI library support functions for TI OMAP4 processors. * * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/ * Authors: Mythri P k <[email protected]> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ /*============================================================================== ÐÞ¶©ÀúÊ· ÎÊÌâµ¥ºÅ ÐÞ¸ÄÈË ÈÕÆÚ Ô­Òò ==============================================================================*/ #include <linux/kernel.h> #include <linux/err.h> #include <linux/io.h> #include <linux/mutex.h> #include <linux/module.h> #include <video/omapdss.h> #include <linux/switch.h> #include "dss.h" #include <video/hdmi_ti_4xxx_ip.h> static struct { struct mutex hdmi_lock; struct switch_dev hpd_switch; } hdmi; extern int audio_channel_max; static ssize_t hdmi_deepcolor_show(struct device *dev, struct device_attribute *attr, char *buf) { int r; r = omapdss_hdmi_get_deepcolor(); return snprintf(buf, PAGE_SIZE, "%d\n", r); } static ssize_t hdmi_deepcolor_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { unsigned long deep_color; int r = kstrtoul(buf, 0, &deep_color); if (r || deep_color > 2) return -EINVAL; omapdss_hdmi_set_deepcolor(deep_color); return size; } static ssize_t hdmi_edid_show(struct device *dev, struct device_attribute *attr, char *buf) { return omapdss_hdmi_get_edid(buf); } static ssize_t hdmi_audio_channel_show(struct device *dev, struct device_attribute *attr, char *buf) { int r; r = audio_channel_max; return snprintf(buf, PAGE_SIZE, "%d\n", r); } static ssize_t hdmi_s3d_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { int r; ssize_t size; r = omapdss_hdmi_get_s3d_mode(); switch (r) { case HDMI_FRAME_PACKING: size = snprintf(buf, PAGE_SIZE, "frame_packing\n"); break; case HDMI_FIELD_ALTERNATIVE: size = snprintf(buf, PAGE_SIZE, "field_alternative\n"); break; case HDMI_LINE_ALTERNATIVE: size = snprintf(buf, PAGE_SIZE, "line_alternative\n"); break; case HDMI_SIDE_BY_SIDE_FULL: size = snprintf(buf, PAGE_SIZE, "side_by_side_full\n"); break; case HDMI_L_DEPTH: size = snprintf(buf, PAGE_SIZE, "l_depth\n"); break; case HDMI_L_DEPTH_GFX_GFX_DEPTH: size = snprintf(buf, PAGE_SIZE, "l_depth_gfx_depth\n"); break; case HDMI_TOPBOTTOM: size = snprintf(buf, PAGE_SIZE, "top_bottom\n"); break; case HDMI_SIDE_BY_SIDE_HALF: size = snprintf(buf, PAGE_SIZE, "side_by_side_half\n"); break; default: return -EINVAL; } return size; } static ssize_t hdmi_s3d_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { unsigned long s3d_mode; int r = kstrtoul(buf, 0, &s3d_mode); if (r) return -EINVAL; switch (s3d_mode) { case HDMI_FRAME_PACKING: case HDMI_FIELD_ALTERNATIVE: case HDMI_LINE_ALTERNATIVE: case HDMI_SIDE_BY_SIDE_FULL: case HDMI_L_DEPTH: case HDMI_L_DEPTH_GFX_GFX_DEPTH: case HDMI_TOPBOTTOM: case HDMI_SIDE_BY_SIDE_HALF: omapdss_hdmi_set_s3d_mode(s3d_mode); break; default: return -EINVAL; } return size; } static ssize_t hdmi_s3d_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { int enable; int r = kstrtoint(buf, 0, &enable); if (r) return -EINVAL; enable = !!enable; omapdss_hdmi_enable_s3d(enable); return size; } static ssize_t hdmi_s3d_enable_show(struct device *dev, struct device_attribute *attr, char *buf) { int r; r = omapdss_hdmi_get_s3d_enable(); return snprintf(buf, PAGE_SIZE, "%d\n", r); } static DEVICE_ATTR(s3d_enable, S_IRUGO | S_IWUSR, hdmi_s3d_enable_show, hdmi_s3d_enable_store); static DEVICE_ATTR(s3d_type, S_IRUGO | S_IWUSR, hdmi_s3d_mode_show, hdmi_s3d_mode_store); static DEVICE_ATTR(edid, S_IRUGO, hdmi_edid_show, NULL); static DEVICE_ATTR(deepcolor, S_IRUGO | S_IWUSR, hdmi_deepcolor_show, hdmi_deepcolor_store); static DEVICE_ATTR(audio_channel, S_IRUGO | S_IWUSR, hdmi_audio_channel_show, NULL); static struct attribute *hdmi_panel_attrs[] = { &dev_attr_s3d_enable.attr, &dev_attr_s3d_type.attr, &dev_attr_edid.attr, &dev_attr_deepcolor.attr, &dev_attr_audio_channel.attr, NULL, }; static struct attribute_group hdmi_panel_attr_group = { .attrs = hdmi_panel_attrs, }; static int hdmi_panel_probe(struct omap_dss_device *dssdev) { DSSDBG("ENTER hdmi_panel_probe\n"); dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS; /* * Initialize the timings to 640 * 480 * This is only for framebuffer update not for TV timing setting * Setting TV timing will be done only on enable */ if (dssdev->panel.timings.x_res == 0) dssdev->panel.timings = (struct omap_video_timings) {640, 480, 31746, 128, 24, 29, 9, 40, 2}; /* sysfs entry to provide user space control to set deepcolor mode */ if (sysfs_create_group(&dssdev->dev.kobj, &hdmi_panel_attr_group)) DSSERR("failed to create sysfs entries\n"); DSSDBG("hdmi_panel_probe x_res= %d y_res = %d\n", dssdev->panel.timings.x_res, dssdev->panel.timings.y_res); return 0; } static void hdmi_panel_remove(struct omap_dss_device *dssdev) { sysfs_remove_group(&dssdev->dev.kobj, &hdmi_panel_attr_group); } static int hdmi_panel_enable(struct omap_dss_device *dssdev) { int r = 0; DSSDBG("ENTER hdmi_panel_enable\n"); mutex_lock(&hdmi.hdmi_lock); if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { r = -EINVAL; goto err; } r = omapdss_hdmi_display_enable(dssdev); if (r) { DSSERR("failed to power on\n"); goto err; } dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; hdmi_inform_power_on_to_cec(true); err: mutex_unlock(&hdmi.hdmi_lock); return r; } static void hdmi_panel_disable(struct omap_dss_device *dssdev) { mutex_lock(&hdmi.hdmi_lock); hdmi_inform_power_on_to_cec(false); if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) omapdss_hdmi_display_disable(dssdev); dssdev->state = OMAP_DSS_DISPLAY_DISABLED; mutex_unlock(&hdmi.hdmi_lock); } static int hdmi_panel_suspend(struct omap_dss_device *dssdev) { int r = 0; mutex_lock(&hdmi.hdmi_lock); if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { r = -EINVAL; goto err; } dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; omapdss_hdmi_display_disable(dssdev); err: mutex_unlock(&hdmi.hdmi_lock); return r; } static int hdmi_panel_resume(struct omap_dss_device *dssdev) { int r = 0; mutex_lock(&hdmi.hdmi_lock); if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) goto err; dssdev->state = OMAP_DSS_DISPLAY_DISABLED; err: mutex_unlock(&hdmi.hdmi_lock); hdmi_panel_hpd_handler(hdmi_get_current_hpd()); return r; } enum { HPD_STATE_OFF, HPD_STATE_START, HPD_STATE_EDID_TRYLAST = HPD_STATE_START + 5, }; static struct hpd_worker_data { struct delayed_work dwork; atomic_t state; } hpd_work; static struct workqueue_struct *my_workq; static void hdmi_hotplug_detect_worker(struct work_struct *work) { struct hpd_worker_data *d = container_of(work, typeof(*d), dwork.work); struct omap_dss_device *dssdev = NULL; int state = atomic_read(&d->state); int match(struct omap_dss_device *dssdev, void *arg) { return sysfs_streq(dssdev->name , "hdmi"); } dssdev = omap_dss_find_device(NULL, match); pr_err("in hpd work %d, state=%d\n", state, dssdev->state); if (dssdev == NULL) return; mutex_lock(&hdmi.hdmi_lock); if (state == HPD_STATE_OFF) { switch_set_state(&hdmi.hpd_switch, 0); hdmi_inform_hpd_to_cec(false); if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { mutex_unlock(&hdmi.hdmi_lock); dssdev->driver->disable(dssdev); omapdss_hdmi_enable_s3d(false); mutex_lock(&hdmi.hdmi_lock); } goto done; } else { if (state == HPD_STATE_START) { mutex_unlock(&hdmi.hdmi_lock); dssdev->driver->enable(dssdev); mutex_lock(&hdmi.hdmi_lock); } else if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || hdmi.hpd_switch.state) { /* powered down after enable - skip EDID read */ goto done; } else if (hdmi_read_edid(&dssdev->panel.timings)) { /* get monspecs from edid */ hdmi_get_monspecs(&dssdev->panel.monspecs); pr_info("panel size %d by %d\n", dssdev->panel.monspecs.max_x, dssdev->panel.monspecs.max_y); dssdev->panel.width_in_um = dssdev->panel.monspecs.max_x * 10000; dssdev->panel.height_in_um = dssdev->panel.monspecs.max_y * 10000; hdmi_inform_hpd_to_cec(true); switch_set_state(&hdmi.hpd_switch, 1); goto done; } else if (state == HPD_STATE_EDID_TRYLAST){ pr_info("Failed to read EDID after %d times. Giving up.", state - HPD_STATE_START); goto done; } if (atomic_add_unless(&d->state, 1, HPD_STATE_OFF)) queue_delayed_work(my_workq, &d->dwork, msecs_to_jiffies(60)); } done: mutex_unlock(&hdmi.hdmi_lock); } int hdmi_panel_hpd_handler(int hpd) { __cancel_delayed_work(&hpd_work.dwork); atomic_set(&hpd_work.state, hpd ? HPD_STATE_START : HPD_STATE_OFF); queue_delayed_work(my_workq, &hpd_work.dwork, msecs_to_jiffies(hpd ? 40 : 30)); return 0; } static void hdmi_get_timings(struct omap_dss_device *dssdev, struct omap_video_timings *timings) { mutex_lock(&hdmi.hdmi_lock); *timings = dssdev->panel.timings; mutex_unlock(&hdmi.hdmi_lock); } static void hdmi_set_timings(struct omap_dss_device *dssdev, struct omap_video_timings *timings) { DSSDBG("hdmi_set_timings\n"); mutex_lock(&hdmi.hdmi_lock); dssdev->panel.timings = *timings; if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) omapdss_hdmi_display_set_timing(dssdev); mutex_unlock(&hdmi.hdmi_lock); } static int hdmi_check_timings(struct omap_dss_device *dssdev, struct omap_video_timings *timings) { int r = 0; DSSDBG("hdmi_check_timings\n"); mutex_lock(&hdmi.hdmi_lock); r = omapdss_hdmi_display_check_timing(dssdev, timings); if (r) { DSSERR("Timing cannot be applied\n"); goto err; } err: mutex_unlock(&hdmi.hdmi_lock); return r; } static int hdmi_get_modedb(struct omap_dss_device *dssdev, struct fb_videomode *modedb, int modedb_len) { struct fb_monspecs *specs = &dssdev->panel.monspecs; if (specs->modedb_len < modedb_len) modedb_len = specs->modedb_len; memcpy(modedb, specs->modedb, sizeof(*modedb) * modedb_len); return modedb_len; } static void hdmi_get_resolution(struct omap_dss_device *dssdev, u16 *xres, u16 *yres) { *xres = dssdev->panel.timings.x_res; *yres = dssdev->panel.timings.y_res; } static enum omap_dss_update_mode hdmi_get_update_mode( struct omap_dss_device *dssdev) { return OMAP_DSS_UPDATE_MANUAL; } static struct omap_dss_driver hdmi_driver = { .probe = hdmi_panel_probe, .remove = hdmi_panel_remove, .enable = hdmi_panel_enable, .disable = hdmi_panel_disable, .suspend = hdmi_panel_suspend, .resume = hdmi_panel_resume, .get_timings = hdmi_get_timings, .set_timings = hdmi_set_timings, .check_timings = hdmi_check_timings, .get_resolution = hdmi_get_resolution, .get_modedb = hdmi_get_modedb, .set_mode = omapdss_hdmi_display_set_mode, .get_update_mode = hdmi_get_update_mode, .driver = { .name = "hdmi_panel", .owner = THIS_MODULE, }, }; int hdmi_panel_init(void) { mutex_init(&hdmi.hdmi_lock); hdmi.hpd_switch.name = "hdmi"; switch_dev_register(&hdmi.hpd_switch); my_workq = create_singlethread_workqueue("hdmi_hotplug"); INIT_DELAYED_WORK(&hpd_work.dwork, hdmi_hotplug_detect_worker); omap_dss_register_driver(&hdmi_driver); return 0; } void hdmi_panel_exit(void) { destroy_workqueue(my_workq); omap_dss_unregister_driver(&hdmi_driver); switch_dev_unregister(&hdmi.hpd_switch); }
gpl-2.0
mrimp/SM-N910T_Kernel
drivers/char/diag/diagchar_core.c
73393
/* Copyright (c) 2008-2014, The Linux Foundation. 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 version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include <linux/slab.h> #include <linux/init.h> #include <linux/module.h> #include <linux/cdev.h> #include <linux/fs.h> #include <linux/device.h> #include <linux/delay.h> #include <linux/uaccess.h> #include <linux/diagchar.h> #include <linux/platform_device.h> #include <linux/sched.h> #include <linux/ratelimit.h> #ifdef CONFIG_DIAG_OVER_USB #include <mach/usbdiag.h> #endif #include <asm/current.h> #include "diagchar_hdlc.h" #include "diagmem.h" #include "diagchar.h" #include "diagfwd.h" #include "diagfwd_cntl.h" #include "diag_dci.h" #ifdef CONFIG_DIAGFWD_BRIDGE_CODE #include "diagfwd_hsic.h" #include "diagfwd_smux.h" #endif #include <linux/timer.h> #include "diag_debugfs.h" #include "diag_masks.h" #include "diagfwd_bridge.h" #include <linux/coresight-stm.h> #include <linux/kernel.h> #ifdef CONFIG_COMPAT #include <linux/compat.h> #endif MODULE_DESCRIPTION("Diag Char Driver"); MODULE_LICENSE("GPL v2"); MODULE_VERSION("1.0"); #define MIN_SIZ_ALLOW 4 #define INIT 1 #define EXIT -1 struct diagchar_dev *driver; struct diagchar_priv { int pid; }; /* The following variables can be specified by module options */ /* for copy buffer */ static unsigned int itemsize = 4096; /*Size of item in the mempool */ static unsigned int poolsize = 12; /*Number of items in the mempool */ /* for hdlc buffer */ static unsigned int itemsize_hdlc = 8192; /*Size of item in the mempool */ static unsigned int poolsize_hdlc = 10; /*Number of items in the mempool */ /* for user buffer */ static unsigned int itemsize_user = 8192; /*Size of item in the mempool */ static unsigned int poolsize_user = 8; /*Number of items in the mempool */ /* for write structure buffer */ /*Size of item in the mempool */ static unsigned int itemsize_write_struct = sizeof(struct diag_request); static unsigned int poolsize_write_struct = 10;/* Num of items in the mempool */ /* For the dci memory pool */ static unsigned int itemsize_dci = IN_BUF_SIZE; /*Size of item in the mempool */ static unsigned int poolsize_dci = 10; /*Number of items in the mempool */ /* This is the max number of user-space clients supported at initialization*/ static unsigned int max_clients = 15; static unsigned int threshold_client_limit = 30; /* This is the maximum number of pkt registrations supported at initialization*/ int diag_max_reg = 600; int diag_threshold_reg = 750; /* Timer variables */ static struct timer_list drain_timer; static int timer_in_progress; void *buf_hdlc; module_param(itemsize, uint, 0); module_param(poolsize, uint, 0); module_param(max_clients, uint, 0); int diag_debug_lvl = DIAG_DEBUG_HIGH; void *diag_ipc_log; /* delayed_rsp_id 0 represents no delay in the response. Any other number means that the diag packet has a delayed response. */ static uint16_t delayed_rsp_id = 1; #define DIAGPKT_MAX_DELAYED_RSP 0xFFFF static int diag_switch_logging(int requested_mode); /* returns the next delayed rsp id - rollsover the id if wrapping is enabled. */ uint16_t diagpkt_next_delayed_rsp_id(uint16_t rspid) { if (rspid < DIAGPKT_MAX_DELAYED_RSP) rspid++; else { if (wrap_enabled) { rspid = 1; wrap_count++; } else rspid = DIAGPKT_MAX_DELAYED_RSP; } delayed_rsp_id = rspid; return delayed_rsp_id; } #define COPY_USER_SPACE_OR_EXIT(buf, data, length) \ do { \ if ((count < ret+length) || (copy_to_user(buf, \ (void *)&data, length))) { \ ret = -EFAULT; \ goto exit; \ } \ ret += length; \ } while (0) static void drain_timer_func(unsigned long data) { queue_work(driver->diag_wq , &(driver->diag_drain_work)); } void diag_drain_work_fn(struct work_struct *work) { int err = 0; timer_in_progress = 0; mutex_lock(&driver->diagchar_mutex); if (buf_hdlc) { err = diag_device_write(buf_hdlc, APPS_DATA, NULL); if (err) diagmem_free(driver, buf_hdlc, POOL_TYPE_HDLC); buf_hdlc = NULL; #ifdef DIAG_DEBUG pr_debug("diag: Number of bytes written " "from timer is %d ", driver->used); #endif driver->used = 0; } mutex_unlock(&driver->diagchar_mutex); } void check_drain_timer(void) { int ret = 0; if (!timer_in_progress) { timer_in_progress = 1; ret = mod_timer(&drain_timer, jiffies + msecs_to_jiffies(500)); } } static void diag_clear_local_tbl(void) { int i; for (i = 0; i < driver->buf_tbl_size; i++) { if (driver->buf_tbl[i].buf) { diagmem_free(driver, (unsigned char *) driver->buf_tbl[i].buf, POOL_TYPE_HDLC); driver->buf_tbl[i].buf = 0; } driver->buf_tbl[i].length = 0; } } #ifdef CONFIG_DIAGFWD_BRIDGE_CODE void diag_clear_hsic_tbl(void) { int i, j; /* Clear for all active HSIC bridges */ for (j = 0; j < MAX_HSIC_DATA_CH; j++) { if (diag_hsic[j].hsic_ch) { diag_hsic[j].num_hsic_buf_tbl_entries = 0; for (i = 0; i < diag_hsic[j].poolsize_hsic_write; i++) { if (diag_hsic[j].hsic_buf_tbl[i].buf) { /* Return the buffer to the pool */ diagmem_free(driver, (unsigned char *) (diag_hsic[j].hsic_buf_tbl[i]. buf), j+POOL_TYPE_HSIC); diag_hsic[j].hsic_buf_tbl[i].buf = 0; } diag_hsic[j].hsic_buf_tbl[i].length = 0; } } } } #else void diag_clear_hsic_tbl(void) { } #endif void diag_add_client(int i, struct file *file) { struct diagchar_priv *diagpriv_data; driver->client_map[i].pid = current->tgid; diagpriv_data = kmalloc(sizeof(struct diagchar_priv), GFP_KERNEL); if (diagpriv_data) diagpriv_data->pid = current->tgid; file->private_data = diagpriv_data; strlcpy(driver->client_map[i].name, current->comm, 20); driver->client_map[i].name[19] = '\0'; } static int diagchar_open(struct inode *inode, struct file *file) { int i = 0; void *temp; if (driver) { mutex_lock(&driver->diagchar_mutex); for (i = 0; i < driver->num_clients; i++) if (driver->client_map[i].pid == 0) break; if (i < driver->num_clients) { diag_add_client(i, file); } else { if (i < threshold_client_limit) { driver->num_clients++; temp = krealloc(driver->client_map , (driver->num_clients) * sizeof(struct diag_client_map), GFP_KERNEL); if (!temp) goto fail; else driver->client_map = temp; temp = krealloc(driver->data_ready , (driver->num_clients) * sizeof(int), GFP_KERNEL); if (!temp) goto fail; else driver->data_ready = temp; diag_add_client(i, file); } else { mutex_unlock(&driver->diagchar_mutex); pr_alert("Max client limit for DIAG reached\n"); pr_info("Cannot open handle %s" " %d", current->comm, current->tgid); for (i = 0; i < driver->num_clients; i++) pr_debug("%d) %s PID=%d", i, driver-> client_map[i].name, driver->client_map[i].pid); return -ENOMEM; } } driver->data_ready[i] = 0x0; driver->data_ready[i] |= MSG_MASKS_TYPE; driver->data_ready[i] |= EVENT_MASKS_TYPE; driver->data_ready[i] |= LOG_MASKS_TYPE; driver->data_ready[i] |= DCI_LOG_MASKS_TYPE; driver->data_ready[i] |= DCI_EVENT_MASKS_TYPE; if (driver->ref_count == 0) diagmem_init(driver); driver->ref_count++; mutex_unlock(&driver->diagchar_mutex); return 0; } return -ENOMEM; fail: mutex_unlock(&driver->diagchar_mutex); driver->num_clients--; pr_alert("diag: Insufficient memory for new client"); return -ENOMEM; } static int diagchar_close(struct inode *inode, struct file *file) { int i = -1; struct diagchar_priv *diagpriv_data = file->private_data; struct diag_dci_client_tbl *dci_entry = NULL; unsigned long flags; pr_debug("diag: process exit %s\n", current->comm); if (!(file->private_data)) { pr_alert("diag: Invalid file pointer"); return -ENOMEM; } if (!driver) return -ENOMEM; /* clean up any DCI registrations, if this is a DCI client * This will specially help in case of ungraceful exit of any DCI client * This call will remove any pending registrations of such client */ dci_entry = dci_lookup_client_entry_pid(current->pid); if (dci_entry) diag_dci_deinit_client(dci_entry); /* If the exiting process is the socket process */ mutex_lock(&driver->diagchar_mutex); if (driver->socket_process && (driver->socket_process->tgid == current->tgid)) { driver->socket_process = NULL; diag_update_proc_vote(DIAG_PROC_MEMORY_DEVICE, VOTE_DOWN, ALL_PROC); } if (driver->callback_process && (driver->callback_process->tgid == current->tgid)) { driver->callback_process = NULL; diag_update_proc_vote(DIAG_PROC_MEMORY_DEVICE, VOTE_DOWN, ALL_PROC); } mutex_unlock(&driver->diagchar_mutex); #ifdef CONFIG_DIAG_OVER_USB /* If the SD logging process exits, change logging to USB mode */ if (driver->logging_process_id == current->tgid) { if (driver->rsp_buf_busy) { /* * This happens when the logging process did not get a * chance to read the last response. Clear the busy flag * for the response buffer. */ spin_lock_irqsave(&driver->rsp_buf_busy_lock, flags); driver->rsp_buf_busy = 0; spin_unlock_irqrestore(&driver->rsp_buf_busy_lock, flags); pr_debug("diag: In %s, Resetting rsp_buf_busy explicitly due to pid: %d\n", __func__, current->tgid); } diag_update_proc_vote(DIAG_PROC_MEMORY_DEVICE, VOTE_DOWN, ALL_PROC); diag_switch_logging(USB_MODE); diag_ws_reset(DIAG_WS_MD); } #endif /* DIAG over USB */ /* Delete the pkt response table entry for the exiting process */ for (i = 0; i < diag_max_reg; i++) if (driver->table[i].process_id == current->tgid) driver->table[i].process_id = 0; mutex_lock(&driver->diagchar_mutex); driver->ref_count--; /* On Client exit, try to destroy all 5 pools */ diagmem_exit(driver, POOL_TYPE_COPY); diagmem_exit(driver, POOL_TYPE_HDLC); diagmem_exit(driver, POOL_TYPE_USER); diagmem_exit(driver, POOL_TYPE_WRITE_STRUCT); diagmem_exit(driver, POOL_TYPE_DCI); for (i = 0; i < driver->num_clients; i++) { if (NULL != diagpriv_data && diagpriv_data->pid == driver->client_map[i].pid) { driver->client_map[i].pid = 0; kfree(diagpriv_data); diagpriv_data = NULL; break; } } mutex_unlock(&driver->diagchar_mutex); return 0; } int diag_find_polling_reg(int i) { uint16_t subsys_id, cmd_code_lo, cmd_code_hi; subsys_id = driver->table[i].subsys_id; cmd_code_lo = driver->table[i].cmd_code_lo; cmd_code_hi = driver->table[i].cmd_code_hi; if (driver->table[i].cmd_code == 0xFF) { if (subsys_id == 0xFF && cmd_code_hi >= 0x0C && cmd_code_lo <= 0x0C) return 1; if (subsys_id == 0x04 && cmd_code_hi >= 0x0E && cmd_code_lo <= 0x0E) return 1; else if (subsys_id == 0x08 && cmd_code_hi >= 0x02 && cmd_code_lo <= 0x02) return 1; else if (subsys_id == 0x32 && cmd_code_hi >= 0x03 && cmd_code_lo <= 0x03) return 1; else if (subsys_id == 0x57 && cmd_code_hi >= 0x0E && cmd_code_lo <= 0x0E) return 1; } return 0; } void diag_clear_reg(int peripheral) { int i; mutex_lock(&driver->diagchar_mutex); /* reset polling flag */ driver->polling_reg_flag = 0; for (i = 0; i < diag_max_reg; i++) { if (driver->table[i].client_id == peripheral) driver->table[i].process_id = 0; } /* re-scan the registration table */ for (i = 0; i < diag_max_reg; i++) { if (driver->table[i].process_id != 0 && diag_find_polling_reg(i) == 1) { driver->polling_reg_flag = 1; break; } } mutex_unlock(&driver->diagchar_mutex); } int diag_add_reg(int j, struct bindpkt_params *params, unsigned int *count_entries) { if (j < 0 || j >= diag_max_reg || !params || !count_entries) return -EINVAL; driver->table[j].cmd_code = params->cmd_code; driver->table[j].subsys_id = params->subsys_id; driver->table[j].cmd_code_lo = params->cmd_code_lo; driver->table[j].cmd_code_hi = params->cmd_code_hi; /* check if incoming reg is polling & polling is yet not registered */ if (driver->polling_reg_flag == 0) if (diag_find_polling_reg(j) == 1) driver->polling_reg_flag = 1; if (params->proc_id == APPS_PROC) { driver->table[j].process_id = current->tgid; driver->table[j].client_id = APPS_DATA; } else { driver->table[j].process_id = NON_APPS_PROC; driver->table[j].client_id = params->client_id; } (*count_entries)++; return 1; } void diag_get_timestamp(char *time_str) { struct timeval t; struct tm broken_tm; do_gettimeofday(&t); if (!time_str) return; time_to_tm(t.tv_sec, 0, &broken_tm); scnprintf(time_str, DIAG_TS_SIZE, "%d:%d:%d:%ld", broken_tm.tm_hour, broken_tm.tm_min, broken_tm.tm_sec, t.tv_usec); } static int diag_get_remote(int remote_info) { int val = (remote_info < 0) ? -remote_info : remote_info; int remote_val; switch (val) { case MDM: case MDM2: case QSC: remote_val = -remote_info; break; default: remote_val = 0; break; } return remote_val; } #ifdef CONFIG_DIAGFWD_BRIDGE_CODE uint16_t diag_get_remote_device_mask(void) { uint16_t remote_dev = 0; int i; /* Check for MDM processor */ for (i = 0; i < MAX_HSIC_DATA_CH; i++) if (diag_hsic[i].hsic_inited) remote_dev |= 1 << i; /* Check for QSC processor */ if (driver->diag_smux_enabled) remote_dev |= 1 << SMUX; return remote_dev; } int diag_copy_remote(char __user *buf, size_t count, int *pret, int *pnum_data) { int i; int index; int exit_stat = 1; int ret = *pret; int num_data = *pnum_data; int remote_token; int copy_data = 0; unsigned long spin_lock_flags; struct diag_write_device hsic_buf_tbl[NUM_HSIC_BUF_TBL_ENTRIES]; remote_token = diag_get_remote(MDM); for (index = 0; index < MAX_HSIC_DATA_CH; index++) { if (!diag_hsic[index].hsic_inited) { remote_token--; continue; } spin_lock_irqsave(&diag_hsic[index].hsic_spinlock, spin_lock_flags); for (i = 0; i < diag_hsic[index].poolsize_hsic_write; i++) { hsic_buf_tbl[i].buf = diag_hsic[index].hsic_buf_tbl[i].buf; diag_hsic[index].hsic_buf_tbl[i].buf = 0; hsic_buf_tbl[i].length = diag_hsic[index].hsic_buf_tbl[i].length; diag_hsic[index].hsic_buf_tbl[i].length = 0; } diag_hsic[index].num_hsic_buf_tbl_entries = 0; spin_unlock_irqrestore(&diag_hsic[index].hsic_spinlock, spin_lock_flags); for (i = 0; i < diag_hsic[index].poolsize_hsic_write; i++) { if (hsic_buf_tbl[i].length > 0) { pr_debug("diag: HSIC copy to user, i: %d, buf: %p, len: %d\n", i, hsic_buf_tbl[i].buf, hsic_buf_tbl[i].length); num_data++; diag_ws_on_copy(DIAG_WS_MD); copy_data = 1; /* Copy the negative token */ if (copy_to_user(buf+ret, &remote_token, 4)) { num_data--; goto drop_hsic; } ret += 4; /* Copy the length of data being passed */ if (copy_to_user(buf+ret, (void *)&(hsic_buf_tbl[i].length), 4)) { num_data--; goto drop_hsic; } ret += 4; /* Copy the actual data being passed */ if (copy_to_user(buf+ret, (void *)hsic_buf_tbl[i].buf, hsic_buf_tbl[i].length)) { ret -= 4; num_data--; goto drop_hsic; } ret += hsic_buf_tbl[i].length; drop_hsic: /* Return the buffer to the pool */ diagmem_free(driver, (unsigned char *)(hsic_buf_tbl[i].buf), index+POOL_TYPE_HSIC); /* Call the write complete function */ diagfwd_write_complete_hsic(NULL, index); } } remote_token--; } if (driver->in_busy_smux == 1) { remote_token = diag_get_remote(QSC); num_data++; /* Copy the negative token of data being passed */ COPY_USER_SPACE_OR_EXIT(buf+ret, remote_token, 4); /* Copy the length of data being passed */ COPY_USER_SPACE_OR_EXIT(buf+ret, (driver->write_ptr_mdm->length), 4); /* Copy the actual data being passed */ COPY_USER_SPACE_OR_EXIT(buf+ret, *(driver->buf_in_smux), driver->write_ptr_mdm->length); pr_debug("diag: SMUX data copied\n"); driver->in_busy_smux = 0; } exit_stat = 0; if (copy_data) diag_ws_on_copy_complete(DIAG_WS_MD); exit: *pret = ret; *pnum_data = num_data; return exit_stat; } #else inline uint16_t diag_get_remote_device_mask(void) { return 0; } inline int diag_copy_remote(char __user *buf, size_t count, int *pret, int *pnum_data) { return 0; } #endif static int diag_copy_dci(char __user *buf, size_t count, struct diag_dci_client_tbl *entry, int *pret) { int total_data_len = 0; int ret = 0; int exit_stat = 1; struct diag_dci_buffer_t *buf_entry, *temp; struct diag_smd_info *smd_info = NULL; if (!buf || !entry || !pret) return exit_stat; ret = *pret; ret += 4; mutex_lock(&entry->write_buf_mutex); list_for_each_entry_safe(buf_entry, temp, &entry->list_write_buf, buf_track) { list_del(&buf_entry->buf_track); mutex_lock(&buf_entry->data_mutex); if ((buf_entry->data_len > 0) && (buf_entry->in_busy) && (buf_entry->data)) { if (copy_to_user(buf+ret, (void *)buf_entry->data, buf_entry->data_len)) goto drop; ret += buf_entry->data_len; total_data_len += buf_entry->data_len; diag_ws_on_copy(DIAG_WS_DCI); drop: buf_entry->in_busy = 0; buf_entry->data_len = 0; buf_entry->in_list = 0; if (buf_entry->buf_type == DCI_BUF_CMD) { if (buf_entry->data_source == APPS_DATA) { mutex_unlock(&buf_entry->data_mutex); continue; } if (driver->separate_cmdrsp[ buf_entry->data_source]) { smd_info = &driver->smd_dci_cmd[ buf_entry->data_source]; } else { smd_info = &driver->smd_dci[ buf_entry->data_source]; } smd_info->in_busy_1 = 0; mutex_unlock(&buf_entry->data_mutex); continue; } else if (buf_entry->buf_type == DCI_BUF_SECONDARY) { diagmem_free(driver, buf_entry->data, POOL_TYPE_DCI); buf_entry->data = NULL; mutex_unlock(&buf_entry->data_mutex); kfree(buf_entry); continue; } } mutex_unlock(&buf_entry->data_mutex); } if (total_data_len > 0) { /* Copy the total data length */ COPY_USER_SPACE_OR_EXIT(buf+8, total_data_len, 4); ret -= 4; /* * Flush any read that is currently pending on DCI data and * command channnels. This will ensure that the next read is not * missed. */ flush_workqueue(driver->diag_dci_wq); diag_ws_on_copy_complete(DIAG_WS_DCI); } else { pr_debug("diag: In %s, Trying to copy ZERO bytes, total_data_len: %d\n", __func__, total_data_len); } entry->in_service = 0; exit_stat = 0; exit: mutex_unlock(&entry->write_buf_mutex); *pret = ret; return exit_stat; } static int diag_command_reg(struct bindpkt_params_per_process *pkt_params) { int retval = -EINVAL; int i = 0, j; void *temp_buf; unsigned int count_entries = 0, interim_count = 0; struct bindpkt_params *params; struct bindpkt_params *head_params; if (!pkt_params) return -EINVAL; if ((UINT_MAX/sizeof(struct bindpkt_params)) < pkt_params->count) { pr_warn("diag: integer overflow while multiply\n"); return -EFAULT; } head_params = kzalloc(pkt_params->count*sizeof(struct bindpkt_params), GFP_KERNEL); if (ZERO_OR_NULL_PTR(head_params)) { pr_err("diag: unable to alloc memory\n"); return -ENOMEM; } else { params = head_params; } if (copy_from_user(params, pkt_params->params, pkt_params->count*sizeof(struct bindpkt_params))) { kfree(head_params); return -EFAULT; } mutex_lock(&driver->diagchar_mutex); for (i = 0; i < diag_max_reg; i++) { if (driver->table[i].process_id == 0) { retval = diag_add_reg(i, params, &count_entries); if (retval == 1 && pkt_params->count > count_entries) { params++; } else { kfree(head_params); mutex_unlock(&driver->diagchar_mutex); return retval; } } } if (i < diag_threshold_reg) { /* Increase table size by amount required */ if (pkt_params->count >= count_entries) { interim_count = pkt_params->count - count_entries; } else { pr_warn("diag: error in params count\n"); kfree(head_params); mutex_unlock(&driver->diagchar_mutex); return -EFAULT; } if (UINT_MAX - diag_max_reg >= interim_count) { diag_max_reg += interim_count; } else { pr_warn("diag: Integer overflow\n"); kfree(head_params); mutex_unlock(&driver->diagchar_mutex); return -EFAULT; } /* Make sure size doesnt go beyond threshold */ if (diag_max_reg > diag_threshold_reg) { diag_max_reg = diag_threshold_reg; pr_err("diag: best case memory allocation\n"); } if (UINT_MAX/sizeof(struct diag_master_table) < diag_max_reg) { pr_warn("diag: integer overflow\n"); kfree(head_params); mutex_unlock(&driver->diagchar_mutex); return -EFAULT; } temp_buf = krealloc(driver->table, diag_max_reg*sizeof(struct diag_master_table), GFP_KERNEL); if (!temp_buf) { pr_err("diag: Insufficient memory for reg.\n"); if (pkt_params->count >= count_entries) { interim_count = pkt_params->count - count_entries; } else { pr_warn("diag: params count error\n"); kfree(head_params); mutex_unlock(&driver->diagchar_mutex); return -EFAULT; } if (diag_max_reg >= interim_count) { diag_max_reg -= interim_count; } else { pr_warn("diag: Integer underflow\n"); kfree(head_params); mutex_unlock(&driver->diagchar_mutex); return -EFAULT; } kfree(head_params); mutex_unlock(&driver->diagchar_mutex); return 0; } else { driver->table = temp_buf; } for (j = i; j < diag_max_reg; j++) { retval = diag_add_reg(j, params, &count_entries); if (retval == 1 && pkt_params->count > count_entries) { params++; } else { kfree(head_params); mutex_unlock(&driver->diagchar_mutex); return retval; } } kfree(head_params); mutex_unlock(&driver->diagchar_mutex); } else { kfree(head_params); mutex_unlock(&driver->diagchar_mutex); pr_err("Max size reached, Pkt Registration failed for Process %d", current->tgid); } retval = 0; return retval; } #ifdef CONFIG_DIAGFWD_BRIDGE_CODE void diag_cmp_logging_modes_diagfwd_bridge(int old_mode, int new_mode) { if (old_mode == MEMORY_DEVICE_MODE && new_mode == NO_LOGGING_MODE) { diagfwd_disconnect_bridge(0); diag_clear_local_tbl(); diag_clear_hsic_tbl(); } else if (old_mode == NO_LOGGING_MODE && new_mode == MEMORY_DEVICE_MODE) { int i; for (i = 0; i < MAX_HSIC_DATA_CH; i++) if (diag_hsic[i].hsic_inited) diag_hsic[i].hsic_data_requested = driver->real_time_mode ? 1 : 0; diagfwd_connect_bridge(0); } else if (old_mode == USB_MODE && new_mode == NO_LOGGING_MODE) { diagfwd_disconnect_bridge(0); } else if (old_mode == NO_LOGGING_MODE && new_mode == USB_MODE) { diagfwd_connect_bridge(0); } else if (old_mode == USB_MODE && new_mode == MEMORY_DEVICE_MODE) { if (driver->real_time_mode) diagfwd_cancel_hsic(REOPEN_HSIC); else diagfwd_cancel_hsic(DONT_REOPEN_HSIC); diagfwd_connect_bridge(0); } else if (old_mode == MEMORY_DEVICE_MODE && new_mode == USB_MODE) { diag_clear_local_tbl(); diag_clear_hsic_tbl(); diagfwd_cancel_hsic(REOPEN_HSIC); diagfwd_connect_bridge(0); } } #else void diag_cmp_logging_modes_diagfwd_bridge(int old_mode, int new_mode) { } #endif static int diag_ioctl_get_delay_rsp_id( struct diagpkt_delay_params *delay_params) { int result = -EINVAL; int interim_size = 0; uint16_t interim_rsp_id; if ((delay_params->rsp_ptr) && (delay_params->size == sizeof(delayed_rsp_id)) && (delay_params->num_bytes_ptr)) { interim_rsp_id = diagpkt_next_delayed_rsp_id( delayed_rsp_id); if (copy_to_user((void __user *)delay_params->rsp_ptr, &interim_rsp_id, sizeof(uint16_t))) return -EFAULT; interim_size = sizeof(delayed_rsp_id); if (copy_to_user( (void __user *)delay_params->num_bytes_ptr, &interim_size, sizeof(int))) return -EFAULT; result = 0; } return result; } static int diag_switch_logging(int requested_mode) { int success = -EINVAL; int temp = 0, status = 0; switch (requested_mode) { case USB_MODE: case MEMORY_DEVICE_MODE: case NO_LOGGING_MODE: case UART_MODE: case SOCKET_MODE: case CALLBACK_MODE: break; default: pr_err("diag: In %s, request to switch to invalid mode: %d\n", __func__, requested_mode); return -EINVAL; } if (requested_mode == driver->logging_mode) { if (requested_mode != MEMORY_DEVICE_MODE || driver->real_time_mode) pr_info_ratelimited("diag: Already in logging mode change requested, mode: %d\n", driver->logging_mode); return 0; } if (requested_mode != MEMORY_DEVICE_MODE) diag_update_real_time_vote(DIAG_PROC_MEMORY_DEVICE, MODE_REALTIME, ALL_PROC); else diag_update_proc_vote(DIAG_PROC_MEMORY_DEVICE, VOTE_UP, ALL_PROC); if (!(requested_mode == MEMORY_DEVICE_MODE && driver->logging_mode == USB_MODE)) queue_work(driver->diag_real_time_wq, &driver->diag_real_time_work); mutex_lock(&driver->diagchar_mutex); temp = driver->logging_mode; driver->logging_mode = requested_mode; if (driver->logging_mode == MEMORY_DEVICE_MODE) { diag_clear_local_tbl(); diag_clear_hsic_tbl(); driver->mask_check = 1; if (driver->socket_process) { /* * Notify the socket logging process that we * are switching to MEMORY_DEVICE_MODE */ status = send_sig(SIGCONT, driver->socket_process, 0); if (status) { pr_err("diag: %s, Error notifying ", __func__); pr_err("socket process, status: %d\n", status); } } } else if (driver->logging_mode == SOCKET_MODE) { driver->socket_process = current; } else if (driver->logging_mode == CALLBACK_MODE) { driver->callback_process = current; } if (driver->logging_mode == UART_MODE || driver->logging_mode == SOCKET_MODE || driver->logging_mode == CALLBACK_MODE) { diag_clear_local_tbl(); diag_clear_hsic_tbl(); driver->mask_check = 0; driver->logging_mode = MEMORY_DEVICE_MODE; } driver->logging_process_id = current->tgid; if (temp == MEMORY_DEVICE_MODE && driver->logging_mode == NO_LOGGING_MODE) { diag_reset_smd_data(RESET_AND_NO_QUEUE); diag_cmp_logging_modes_diagfwd_bridge(temp, driver->logging_mode); } else if (temp == NO_LOGGING_MODE && driver->logging_mode == MEMORY_DEVICE_MODE) { diag_reset_smd_data(RESET_AND_QUEUE); diag_cmp_logging_modes_diagfwd_bridge(temp, driver->logging_mode); } else if (temp == USB_MODE && driver->logging_mode == NO_LOGGING_MODE) { diagfwd_disconnect(); diag_cmp_logging_modes_diagfwd_bridge(temp, driver->logging_mode); } else if (temp == NO_LOGGING_MODE && driver->logging_mode == USB_MODE) { diagfwd_connect(); diag_cmp_logging_modes_diagfwd_bridge(temp, driver->logging_mode); } else if (temp == USB_MODE && driver->logging_mode == MEMORY_DEVICE_MODE) { diagfwd_disconnect(); diag_reset_smd_data(RESET_AND_QUEUE); diag_cmp_logging_modes_diagfwd_bridge(temp, driver->logging_mode); } else if (temp == MEMORY_DEVICE_MODE && driver->logging_mode == USB_MODE) { diagfwd_connect(); diag_cmp_logging_modes_diagfwd_bridge(temp, driver->logging_mode); } mutex_unlock(&driver->diagchar_mutex); success = 1; return success; } static int diag_ioctl_dci_reg(unsigned long ioarg) { int result = -EINVAL; struct diag_dci_reg_tbl_t dci_reg_params; if (copy_from_user(&dci_reg_params, (void __user *)ioarg, sizeof(struct diag_dci_reg_tbl_t))) return -EFAULT; result = diag_dci_register_client(&dci_reg_params); return result; } static int diag_ioctl_dci_health_stats(unsigned long ioarg) { int result = -EINVAL; struct diag_dci_health_stats_proc stats; if (copy_from_user(&stats, (void __user *)ioarg, sizeof(struct diag_dci_health_stats_proc))) return -EFAULT; result = diag_dci_copy_health_stats(&stats); if (result == DIAG_DCI_NO_ERROR) { if (copy_to_user((void __user *)ioarg, &stats, sizeof(struct diag_dci_health_stats_proc))) return -EFAULT; } return result; } static int diag_ioctl_dci_log_status(unsigned long ioarg) { struct diag_log_event_stats le_stats; struct diag_dci_client_tbl *dci_client = NULL; if (copy_from_user(&le_stats, (void __user *)ioarg, sizeof(struct diag_log_event_stats))) return -EFAULT; dci_client = diag_dci_get_client_entry(le_stats.client_id); if (!dci_client) return DIAG_DCI_NOT_SUPPORTED; le_stats.is_set = diag_dci_query_log_mask(dci_client, le_stats.code); if (copy_to_user((void __user *)ioarg, &le_stats, sizeof(struct diag_log_event_stats))) return -EFAULT; return DIAG_DCI_NO_ERROR; } static int diag_ioctl_dci_event_status(unsigned long ioarg) { struct diag_log_event_stats le_stats; struct diag_dci_client_tbl *dci_client = NULL; if (copy_from_user(&le_stats, (void __user *)ioarg, sizeof(struct diag_log_event_stats))) return -EFAULT; dci_client = diag_dci_get_client_entry(le_stats.client_id); if (!dci_client) return DIAG_DCI_NOT_SUPPORTED; le_stats.is_set = diag_dci_query_event_mask(dci_client, le_stats.code); if (copy_to_user((void __user *)ioarg, &le_stats, sizeof(struct diag_log_event_stats))) return -EFAULT; return DIAG_DCI_NO_ERROR; } static int diag_ioctl_lsm_deinit(void) { int i; for (i = 0; i < driver->num_clients; i++) if (driver->client_map[i].pid == current->tgid) break; if (i == driver->num_clients) return -EINVAL; driver->data_ready[i] |= DEINIT_TYPE; wake_up_interruptible(&driver->wait_q); return 1; } static int diag_ioctl_vote_real_time(unsigned long ioarg) { int real_time = 0; struct real_time_vote_t vote; struct diag_dci_client_tbl *dci_client = NULL; if (copy_from_user(&vote, (void __user *)ioarg, sizeof(struct real_time_vote_t))) return -EFAULT; driver->real_time_update_busy++; if (vote.proc == DIAG_PROC_DCI) { dci_client = diag_dci_get_client_entry(vote.client_id); if (!dci_client) { driver->real_time_update_busy--; return DIAG_DCI_NOT_SUPPORTED; } diag_dci_set_real_time(dci_client, vote.real_time_vote); real_time = diag_dci_get_cumulative_real_time( dci_client->client_info.token); diag_update_real_time_vote(vote.proc, real_time, dci_client->client_info.token); } else { real_time = vote.real_time_vote; diag_update_real_time_vote(vote.proc, real_time, ALL_PROC); } queue_work(driver->diag_real_time_wq, &driver->diag_real_time_work); return 0; } static int diag_ioctl_get_real_time(unsigned long ioarg) { int result = -EINVAL; int real_time = 0; int retry_count = 0; int timer = 0; struct real_time_query_t rt_query; if (copy_from_user(&rt_query, (void __user *)ioarg, sizeof(struct real_time_query_t))) return -EFAULT; while (retry_count < 3) { if (driver->real_time_update_busy > 0) { retry_count++; /* * The value 10000 was chosen empirically as an * optimum value in order to give the work in * diag_real_time_wq to complete processing. */ for (timer = 0; timer < 5; timer++) usleep_range(10000, 10100); } else { if (rt_query.proc < 0 || rt_query.proc >= DIAG_NUM_PROC) { pr_err("diag: Invalid proc %d in %s\n", rt_query.proc, __func__); return -EINVAL; } real_time = driver->real_time_mode[rt_query.proc]; if (copy_to_user((void __user *)ioarg, &rt_query, sizeof(struct real_time_query_t))) return -EFAULT; result = 0; break; } } return result; } static int diag_ioctl_dci_support(unsigned long ioarg) { struct diag_dci_peripherals_t dci_support; int result = -EINVAL; if (copy_from_user(&dci_support, (void __user *)ioarg, sizeof(struct diag_dci_peripherals_t))) return -EFAULT; result = diag_dci_get_support_list(&dci_support); if (result == DIAG_DCI_NO_ERROR) if (copy_to_user((void __user *)ioarg, &dci_support, sizeof(struct diag_dci_peripherals_t))) return -EFAULT; return result; } #ifdef CONFIG_COMPAT struct diagpkt_delay_params_compat { compat_uptr_t rsp_ptr; int size; compat_uptr_t num_bytes_ptr; }; struct bindpkt_params_per_process_compat { /* Name of the synchronization object associated with this proc */ char sync_obj_name[MAX_SYNC_OBJ_NAME_SIZE]; uint32_t count; /* Number of entries in this bind */ compat_uptr_t params; /* first bind params */ }; long diagchar_compat_ioctl(struct file *filp, unsigned int iocmd, unsigned long ioarg) { int result = -EINVAL; int req_logging_mode = 0; int client_id = 0; uint16_t remote_dev; struct bindpkt_params_per_process pkt_params; struct bindpkt_params_per_process_compat pkt_params_compat; struct diagpkt_delay_params_compat delay_params_compat; struct diagpkt_delay_params delay_params; struct diag_dci_client_tbl *dci_client = NULL; switch (iocmd) { case DIAG_IOCTL_COMMAND_REG: if (copy_from_user(&pkt_params_compat, (void __user *)ioarg, sizeof(struct bindpkt_params_per_process_compat))) { return -EFAULT; } strlcpy(pkt_params.sync_obj_name, pkt_params_compat.sync_obj_name, MAX_SYNC_OBJ_NAME_SIZE); pkt_params.count = pkt_params_compat.count; pkt_params.params = (struct bindpkt_params *)(uintptr_t) pkt_params_compat.params; result = diag_command_reg(&pkt_params); break; case DIAG_IOCTL_GET_DELAYED_RSP_ID: if (copy_from_user(&delay_params_compat, (void __user *)ioarg, sizeof(struct diagpkt_delay_params_compat))) return -EFAULT; delay_params.rsp_ptr = (void *)(uintptr_t)delay_params_compat.rsp_ptr; delay_params.size = delay_params_compat.size; delay_params.num_bytes_ptr = (int *)(uintptr_t)delay_params_compat.num_bytes_ptr; result = diag_ioctl_get_delay_rsp_id(&delay_params); break; case DIAG_IOCTL_DCI_REG: result = diag_ioctl_dci_reg(ioarg); break; case DIAG_IOCTL_DCI_DEINIT: if (copy_from_user((void *)&client_id, (void __user *)ioarg, sizeof(int))) return -EFAULT; dci_client = diag_dci_get_client_entry(client_id); if (!dci_client) return DIAG_DCI_NOT_SUPPORTED; result = diag_dci_deinit_client(dci_client); break; case DIAG_IOCTL_DCI_SUPPORT: result = diag_ioctl_dci_support(ioarg); break; case DIAG_IOCTL_DCI_HEALTH_STATS: result = diag_ioctl_dci_health_stats(ioarg); break; case DIAG_IOCTL_DCI_LOG_STATUS: result = diag_ioctl_dci_log_status(ioarg); break; case DIAG_IOCTL_DCI_EVENT_STATUS: result = diag_ioctl_dci_event_status(ioarg); break; case DIAG_IOCTL_DCI_CLEAR_LOGS: if (copy_from_user((void *)&client_id, (void __user *)ioarg, sizeof(int))) return -EFAULT; result = diag_dci_clear_log_mask(client_id); break; case DIAG_IOCTL_DCI_CLEAR_EVENTS: if (copy_from_user(&client_id, (void __user *)ioarg, sizeof(int))) return -EFAULT; result = diag_dci_clear_event_mask(client_id); break; case DIAG_IOCTL_LSM_DEINIT: result = diag_ioctl_lsm_deinit(); break; case DIAG_IOCTL_SWITCH_LOGGING: if (copy_from_user((void *)&req_logging_mode, (void __user *)ioarg, sizeof(int))) return -EFAULT; result = diag_switch_logging(req_logging_mode); break; case DIAG_IOCTL_REMOTE_DEV: remote_dev = diag_get_remote_device_mask(); if (copy_to_user((void __user *)ioarg, &remote_dev, sizeof(uint16_t))) result = -EFAULT; else result = 1; break; case DIAG_IOCTL_VOTE_REAL_TIME: result = diag_ioctl_vote_real_time(ioarg); break; case DIAG_IOCTL_GET_REAL_TIME: result = diag_ioctl_get_real_time(ioarg); break; } return result; } #endif long diagchar_ioctl(struct file *filp, unsigned int iocmd, unsigned long ioarg) { int result = -EINVAL; int req_logging_mode = 0; int client_id = 0; uint16_t remote_dev; struct bindpkt_params_per_process pkt_params; struct diagpkt_delay_params delay_params; struct diag_dci_client_tbl *dci_client = NULL; switch (iocmd) { case DIAG_IOCTL_COMMAND_REG: if (copy_from_user(&pkt_params, (void __user *)ioarg, sizeof(struct bindpkt_params_per_process))) { return -EFAULT; } result = diag_command_reg(&pkt_params); break; case DIAG_IOCTL_GET_DELAYED_RSP_ID: if (copy_from_user(&delay_params, (void __user *)ioarg, sizeof(struct diagpkt_delay_params))) return -EFAULT; result = diag_ioctl_get_delay_rsp_id(&delay_params); break; case DIAG_IOCTL_DCI_REG: result = diag_ioctl_dci_reg(ioarg); break; case DIAG_IOCTL_DCI_DEINIT: if (copy_from_user((void *)&client_id, (void __user *)ioarg, sizeof(int))) return -EFAULT; dci_client = diag_dci_get_client_entry(client_id); if (!dci_client) return DIAG_DCI_NOT_SUPPORTED; result = diag_dci_deinit_client(dci_client); break; case DIAG_IOCTL_DCI_SUPPORT: result = diag_ioctl_dci_support(ioarg); break; case DIAG_IOCTL_DCI_HEALTH_STATS: result = diag_ioctl_dci_health_stats(ioarg); break; case DIAG_IOCTL_DCI_LOG_STATUS: result = diag_ioctl_dci_log_status(ioarg); break; case DIAG_IOCTL_DCI_EVENT_STATUS: result = diag_ioctl_dci_event_status(ioarg); break; case DIAG_IOCTL_DCI_CLEAR_LOGS: if (copy_from_user((void *)&client_id, (void __user *)ioarg, sizeof(int))) return -EFAULT; result = diag_dci_clear_log_mask(client_id); break; case DIAG_IOCTL_DCI_CLEAR_EVENTS: if (copy_from_user(&client_id, (void __user *)ioarg, sizeof(int))) return -EFAULT; result = diag_dci_clear_event_mask(client_id); break; case DIAG_IOCTL_LSM_DEINIT: result = diag_ioctl_lsm_deinit(); break; case DIAG_IOCTL_SWITCH_LOGGING: if (copy_from_user((void *)&req_logging_mode, (void __user *)ioarg, sizeof(int))) return -EFAULT; result = diag_switch_logging(req_logging_mode); break; case DIAG_IOCTL_REMOTE_DEV: remote_dev = diag_get_remote_device_mask(); if (copy_to_user((void __user *)ioarg, &remote_dev, sizeof(uint16_t))) result = -EFAULT; else result = 1; break; case DIAG_IOCTL_VOTE_REAL_TIME: result = diag_ioctl_vote_real_time(ioarg); break; case DIAG_IOCTL_GET_REAL_TIME: result = diag_ioctl_get_real_time(ioarg); break; } return result; } static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct diag_dci_client_tbl *entry; struct list_head *start, *temp; int index = -1, i = 0, ret = 0; int num_data = 0, data_type; int remote_token; int exit_stat; int copy_dci_data = 0; int copy_data = 0; unsigned long flags; for (i = 0; i < driver->num_clients; i++) if (driver->client_map[i].pid == current->tgid) index = i; if (index == -1) { pr_err("diag: Client PID not found in table"); return -EINVAL; } if (!buf) { pr_err("diag: bad address from user side\n"); return -EFAULT; } wait_event_interruptible(driver->wait_q, driver->data_ready[index]); mutex_lock(&driver->diagchar_mutex); if ((driver->data_ready[index] & USER_SPACE_DATA_TYPE) && (driver-> logging_mode == MEMORY_DEVICE_MODE)) { remote_token = 0; pr_debug("diag: process woken up\n"); /*Copy the type of data being passed*/ data_type = driver->data_ready[index] & USER_SPACE_DATA_TYPE; driver->data_ready[index] ^= USER_SPACE_DATA_TYPE; COPY_USER_SPACE_OR_EXIT(buf, data_type, 4); /* place holder for number of data field */ ret += 4; spin_lock_irqsave(&driver->rsp_buf_busy_lock, flags); if (driver->rsp_write_ptr->length > 0) { if (copy_to_user(buf+ret, (void *)&(driver->rsp_write_ptr->length), sizeof(int))) goto drop_rsp; ret += sizeof(int); if (copy_to_user(buf+ret, (void *)(driver->rsp_write_ptr->buf), driver->rsp_write_ptr->length)) { ret -= sizeof(int); goto drop_rsp; } num_data++; ret += driver->rsp_write_ptr->length; drop_rsp: driver->rsp_write_ptr->length = 0; driver->rsp_buf_busy = 0; } spin_unlock_irqrestore(&driver->rsp_buf_busy_lock, flags); for (i = 0; i < driver->buf_tbl_size; i++) { if (driver->buf_tbl[i].length > 0) { #ifdef DIAG_DEBUG pr_debug("diag: WRITING the buf address and length is %p , %d\n", driver->buf_tbl[i].buf, driver->buf_tbl[i].length); #endif num_data++; /* Copy the length of data being passed */ if (copy_to_user(buf+ret, (void *)&(driver-> buf_tbl[i].length), 4)) { num_data--; goto drop; } ret += 4; /* Copy the actual data being passed */ if (copy_to_user(buf+ret, (void *)driver-> buf_tbl[i].buf, driver->buf_tbl[i].length)) { ret -= 4; num_data--; goto drop; } ret += driver->buf_tbl[i].length; drop: #ifdef DIAG_DEBUG pr_debug("diag: DEQUEUE buf address and length is %p, %d\n", driver->buf_tbl[i].buf, driver->buf_tbl[i].length); #endif diagmem_free(driver, (unsigned char *) (driver->buf_tbl[i].buf), POOL_TYPE_HDLC); driver->buf_tbl[i].length = 0; driver->buf_tbl[i].buf = 0; } } /* Copy peripheral data */ for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) { struct diag_smd_info *data = &driver->smd_data[i]; if (data->in_busy_1 == 1) { num_data++; /*Copy the length of data being passed*/ COPY_USER_SPACE_OR_EXIT(buf+ret, (data->write_ptr_1->length), 4); /*Copy the actual data being passed*/ COPY_USER_SPACE_OR_EXIT(buf+ret, *(data->buf_in_1), data->write_ptr_1->length); spin_lock_irqsave(&data->in_busy_lock, flags); data->in_busy_1 = 0; spin_unlock_irqrestore(&data->in_busy_lock, flags); diag_ws_on_copy(DIAG_WS_MD); copy_data = 1; } if (data->in_busy_2 == 1) { num_data++; /*Copy the length of data being passed*/ COPY_USER_SPACE_OR_EXIT(buf+ret, (data->write_ptr_2->length), 4); /*Copy the actual data being passed*/ COPY_USER_SPACE_OR_EXIT(buf+ret, *(data->buf_in_2), data->write_ptr_2->length); spin_lock_irqsave(&data->in_busy_lock, flags); data->in_busy_2 = 0; spin_unlock_irqrestore(&data->in_busy_lock, flags); diag_ws_on_copy(DIAG_WS_MD); copy_data = 1; } } if (driver->supports_separate_cmdrsp) { for (i = 0; i < NUM_SMD_CMD_CHANNELS; i++) { struct diag_smd_info *data = &driver->smd_cmd[i]; if (!driver->separate_cmdrsp[i]) continue; if (data->in_busy_1 == 1) { num_data++; /*Copy the length of data being passed*/ COPY_USER_SPACE_OR_EXIT(buf+ret, (data->write_ptr_1->length), 4); /*Copy the actual data being passed*/ COPY_USER_SPACE_OR_EXIT(buf+ret, *(data->buf_in_1), data->write_ptr_1->length); data->in_busy_1 = 0; } } } /* Copy date from remote processors */ exit_stat = diag_copy_remote(buf, count, &ret, &num_data); if (exit_stat == 1) goto exit; /* copy number of data fields */ COPY_USER_SPACE_OR_EXIT(buf+4, num_data, 4); ret -= 4; for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) { if (driver->smd_data[i].ch) queue_work(driver->smd_data[i].wq, &(driver->smd_data[i].diag_read_smd_work)); } APPEND_DEBUG('n'); goto exit; } else if (driver->data_ready[index] & USER_SPACE_DATA_TYPE) { /* In case, the thread wakes up and the logging mode is not memory device any more, the condition needs to be cleared */ driver->data_ready[index] ^= USER_SPACE_DATA_TYPE; } if (driver->data_ready[index] & DEINIT_TYPE) { /*Copy the type of data being passed*/ data_type = driver->data_ready[index] & DEINIT_TYPE; COPY_USER_SPACE_OR_EXIT(buf, data_type, 4); driver->data_ready[index] ^= DEINIT_TYPE; goto exit; } if (driver->data_ready[index] & MSG_MASKS_TYPE) { /*Copy the type of data being passed*/ data_type = driver->data_ready[index] & MSG_MASKS_TYPE; COPY_USER_SPACE_OR_EXIT(buf, data_type, 4); COPY_USER_SPACE_OR_EXIT(buf+4, *(driver->msg_masks), MSG_MASK_SIZE); driver->data_ready[index] ^= MSG_MASKS_TYPE; goto exit; } if (driver->data_ready[index] & EVENT_MASKS_TYPE) { /*Copy the type of data being passed*/ data_type = driver->data_ready[index] & EVENT_MASKS_TYPE; COPY_USER_SPACE_OR_EXIT(buf, data_type, 4); COPY_USER_SPACE_OR_EXIT(buf+4, *(driver->event_masks), EVENT_MASK_SIZE); driver->data_ready[index] ^= EVENT_MASKS_TYPE; goto exit; } if (driver->data_ready[index] & LOG_MASKS_TYPE) { /*Copy the type of data being passed*/ data_type = driver->data_ready[index] & LOG_MASKS_TYPE; COPY_USER_SPACE_OR_EXIT(buf, data_type, 4); COPY_USER_SPACE_OR_EXIT(buf+4, *(driver->log_masks), LOG_MASK_SIZE); driver->data_ready[index] ^= LOG_MASKS_TYPE; goto exit; } if (driver->data_ready[index] & PKT_TYPE) { /*Copy the type of data being passed*/ data_type = driver->data_ready[index] & PKT_TYPE; COPY_USER_SPACE_OR_EXIT(buf, data_type, 4); COPY_USER_SPACE_OR_EXIT(buf+4, *(driver->pkt_buf), driver->pkt_length); driver->data_ready[index] ^= PKT_TYPE; driver->in_busy_pktdata = 0; goto exit; } if (driver->data_ready[index] & DCI_PKT_TYPE) { /* Copy the type of data being passed */ data_type = driver->data_ready[index] & DCI_PKT_TYPE; COPY_USER_SPACE_OR_EXIT(buf, data_type, 4); COPY_USER_SPACE_OR_EXIT(buf+4, *(driver->dci_pkt_buf), driver->dci_pkt_length); driver->data_ready[index] ^= DCI_PKT_TYPE; driver->in_busy_dcipktdata = 0; goto exit; } if (driver->data_ready[index] & DCI_EVENT_MASKS_TYPE) { /*Copy the type of data being passed*/ data_type = driver->data_ready[index] & DCI_EVENT_MASKS_TYPE; COPY_USER_SPACE_OR_EXIT(buf, data_type, 4); COPY_USER_SPACE_OR_EXIT(buf+4, driver->num_dci_client, 4); COPY_USER_SPACE_OR_EXIT(buf + 8, (dci_ops_tbl[DCI_LOCAL_PROC]. event_mask_composite), DCI_EVENT_MASK_SIZE); driver->data_ready[index] ^= DCI_EVENT_MASKS_TYPE; goto exit; } if (driver->data_ready[index] & DCI_LOG_MASKS_TYPE) { /*Copy the type of data being passed*/ data_type = driver->data_ready[index] & DCI_LOG_MASKS_TYPE; COPY_USER_SPACE_OR_EXIT(buf, data_type, 4); COPY_USER_SPACE_OR_EXIT(buf+4, driver->num_dci_client, 4); COPY_USER_SPACE_OR_EXIT(buf+8, (dci_ops_tbl[DCI_LOCAL_PROC]. log_mask_composite), DCI_LOG_MASK_SIZE); driver->data_ready[index] ^= DCI_LOG_MASKS_TYPE; goto exit; } if (driver->data_ready[index] & DCI_DATA_TYPE) { /* Copy the type of data being passed */ data_type = driver->data_ready[index] & DCI_DATA_TYPE; driver->data_ready[index] ^= DCI_DATA_TYPE; list_for_each_safe(start, temp, &driver->dci_client_list) { entry = list_entry(start, struct diag_dci_client_tbl, track); if (entry->client->tgid != current->tgid) continue; if (!entry->in_service) continue; COPY_USER_SPACE_OR_EXIT(buf + ret, data_type, sizeof(int)); COPY_USER_SPACE_OR_EXIT(buf + ret, entry->client_info.token, sizeof(int)); DIAG_LOG(DIAG_DEBUG_HIGH, "[%s] + copying dci data to user\n", __func__); copy_dci_data = 1; exit_stat = diag_copy_dci(buf, count, entry, &ret); DIAG_LOG(DIAG_DEBUG_HIGH, "[%s] - copying dci data to user, exit_stat: %d\n", __func__, exit_stat); if (exit_stat == 1) goto exit; } for (i = 0; i < NUM_SMD_DCI_CHANNELS; i++) { if (driver->smd_dci[i].ch) { queue_work(driver->diag_dci_wq, &(driver->smd_dci[i].diag_read_smd_work)); } } if (driver->supports_separate_cmdrsp) { for (i = 0; i < NUM_SMD_DCI_CMD_CHANNELS; i++) { if (!driver->separate_cmdrsp[i]) continue; if (driver->smd_dci_cmd[i].ch) { queue_work(driver->diag_dci_wq, &(driver->smd_dci_cmd[i]. diag_read_smd_work)); } } } goto exit; } exit: if (copy_data) { /* * Flush any work that is currently pending on the data * channels. This will ensure that the next read is not missed. */ for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) flush_workqueue(driver->smd_data[i].wq); wake_up(&driver->smd_wait_q); diag_ws_on_copy_complete(DIAG_WS_MD); } if (copy_dci_data) DIAG_LOG(DIAG_DEBUG_HIGH, "[%s] - finished copying data in this iteration\n", __func__); mutex_unlock(&driver->diagchar_mutex); return ret; } static ssize_t diagchar_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { int err, ret = 0, pkt_type, token_offset = 0; int remote_proc = 0, data_type; uint8_t index; #ifdef DIAG_DEBUG int length = 0, i; #endif struct diag_send_desc_type send = { NULL, NULL, DIAG_STATE_START, 0 }; struct diag_hdlc_dest_type enc = { NULL, NULL, 0 }; void *buf_copy = NULL; void *user_space_data = NULL; unsigned int payload_size; index = 0; /* Get the packet type F3/log/event/Pkt response */ err = copy_from_user((&pkt_type), buf, 4); if (err) { pr_alert("diag: copy failed for pkt_type\n"); return -EAGAIN; } /* First 4 bytes indicate the type of payload - ignore these */ if (count < 4) { pr_err("diag: Client sending short data\n"); return -EBADMSG; } payload_size = count - 4; if (payload_size > USER_SPACE_DATA) { pr_err("diag: Dropping packet, packet payload size crosses 8KB limit. Current payload size %d\n", payload_size); driver->dropped_count++; return -EBADMSG; } #ifdef CONFIG_DIAG_OVER_USB if (driver->logging_mode == NO_LOGGING_MODE || (!((pkt_type == DCI_DATA_TYPE) || ((pkt_type & (DATA_TYPE_DCI_LOG | DATA_TYPE_DCI_EVENT)) == 0)) && (driver->logging_mode == USB_MODE) && (!driver->usb_connected))) { /*Drop the diag payload */ return -EIO; } #endif /* DIAG over USB */ if (pkt_type == DCI_DATA_TYPE) { user_space_data = diagmem_alloc(driver, payload_size, POOL_TYPE_USER); if (!user_space_data) { driver->dropped_count++; return -ENOMEM; } err = copy_from_user(user_space_data, buf + 4, payload_size); if (err) { pr_alert("diag: copy failed for DCI data\n"); diagmem_free(driver, user_space_data, POOL_TYPE_USER); user_space_data = NULL; return DIAG_DCI_SEND_DATA_FAIL; } err = diag_process_dci_transaction(user_space_data, payload_size); diagmem_free(driver, user_space_data, POOL_TYPE_USER); user_space_data = NULL; return err; } if (pkt_type == CALLBACK_DATA_TYPE) { if (payload_size > driver->itemsize) { pr_err("diag: Dropping packet, invalid packet size. Current payload size %d\n", payload_size); driver->dropped_count++; return -EBADMSG; } buf_copy = diagmem_alloc(driver, payload_size, POOL_TYPE_COPY); if (!buf_copy) { driver->dropped_count++; return -ENOMEM; } err = copy_from_user(buf_copy, buf + 4, payload_size); if (err) { pr_err("diag: copy failed for user space data\n"); diagmem_free(driver, buf_copy, POOL_TYPE_COPY); buf_copy = NULL; return -EIO; } /* Check for proc_type */ remote_proc = diag_get_remote(*(int *)buf_copy); if (!remote_proc) { wait_event_interruptible(driver->wait_q, (driver->in_busy_pktdata == 0)); ret = diag_process_apps_pkt(buf_copy, payload_size); diagmem_free(driver, buf_copy, POOL_TYPE_COPY); buf_copy = NULL; return ret; } /* The packet is for the remote processor */ if (payload_size <= MIN_SIZ_ALLOW) { pr_err("diag: Integer underflow in %s, payload size: %d", __func__, payload_size); return -EBADMSG; } token_offset = 4; payload_size -= 4; buf += 4; /* Perform HDLC encoding on incoming data */ send.state = DIAG_STATE_START; send.pkt = (void *)(buf_copy + token_offset); send.last = (void *)(buf_copy + token_offset - 1 + payload_size); send.terminate = 1; mutex_lock(&driver->diagchar_mutex); if (!buf_hdlc) buf_hdlc = diagmem_alloc(driver, HDLC_OUT_BUF_SIZE, POOL_TYPE_HDLC); if (!buf_hdlc) { ret = -ENOMEM; driver->used = 0; goto fail_free_copy; } if (HDLC_OUT_BUF_SIZE < (2 * payload_size) + 3) { pr_err("diag: Dropping packet, HDLC encoded packet payload size crosses buffer limit. Current payload size %d\n", ((2*payload_size) + 3)); driver->dropped_count++; ret = -EBADMSG; goto fail_free_hdlc; } enc.dest = buf_hdlc + driver->used; enc.dest_last = (void *)(buf_hdlc + driver->used + (2 * payload_size) + token_offset - 1); diag_hdlc_encode(&send, &enc); #ifdef CONFIG_DIAGFWD_BRIDGE_CODE /* send masks to All 9k */ if ((remote_proc >= MDM) && (remote_proc <= MDM2)) { index = remote_proc - MDM; if (diag_hsic[index].hsic_ch && (payload_size > 0)) { /* wait sending mask updates * if HSIC ch not ready */ while (diag_hsic[index].in_busy_hsic_write) { wait_event_interruptible(driver->wait_q, (diag_hsic[index]. in_busy_hsic_write != 1)); } diag_hsic[index].in_busy_hsic_write = 1; diag_hsic[index].in_busy_hsic_read_on_device = 0; err = diag_bridge_write( hsic_data_bridge_map[index], (char *)buf_hdlc, payload_size + 3); if (err) { pr_err("diag: err sending mask to MDM: %d\n", err); /* * If the error is recoverable, then * clear the write flag, so we will * resubmit a write on the next frame. * Otherwise, don't resubmit a write * on the next frame. */ if ((-ESHUTDOWN) != err) diag_hsic[index]. in_busy_hsic_write = 0; } } } if (driver->diag_smux_enabled && (remote_proc == QSC) && driver->lcid) { if (payload_size > 0) { err = msm_smux_write(driver->lcid, NULL, (char *)buf_hdlc, payload_size + 3); if (err) { pr_err("diag:send mask to MDM err %d", err); ret = err; } } } #endif goto fail_free_hdlc; } if (pkt_type == USER_SPACE_DATA_TYPE) { err = copy_from_user(driver->user_space_data_buf, buf + 4, payload_size); if (err) { pr_err("diag: copy failed for user space data\n"); return -EIO; } /* Check for proc_type */ remote_proc = diag_get_remote(*(int *)driver->user_space_data_buf); if (remote_proc) { if (payload_size <= MIN_SIZ_ALLOW) { pr_err("diag: Integer underflow in %s, payload size: %d", __func__, payload_size); return -EBADMSG; } token_offset = 4; payload_size -= 4; buf += 4; } /* Check masks for On-Device logging */ if (driver->mask_check) { if (!mask_request_validate(driver->user_space_data_buf + token_offset)) { pr_alert("diag: mask request Invalid\n"); return -EFAULT; } } buf = buf + 4; #ifdef DIAG_DEBUG pr_debug("diag: user space data %d\n", payload_size); for (i = 0; i < payload_size; i++) pr_debug("\t %x", *((driver->user_space_data_buf + token_offset)+i)); #endif #ifdef CONFIG_DIAGFWD_BRIDGE_CODE /* send masks to All 9k */ if ((remote_proc >= MDM) && (remote_proc <= MDM2) && (payload_size > 0)) { index = remote_proc - MDM; /* * If hsic data is being requested for this remote * processor and its hsic in not open */ if (!diag_hsic[index].hsic_device_opened) { diag_hsic[index].hsic_data_requested = 1; connect_bridge(0, index); } if (diag_hsic[index].hsic_ch) { /* wait sending mask updates * if HSIC ch not ready */ while (diag_hsic[index].in_busy_hsic_write) { wait_event_interruptible(driver->wait_q, (diag_hsic[index]. in_busy_hsic_write != 1)); } diag_hsic[index].in_busy_hsic_write = 1; diag_hsic[index].in_busy_hsic_read_on_device = 0; err = diag_bridge_write( hsic_data_bridge_map[index], driver->user_space_data_buf + token_offset, payload_size); if (err) { pr_err("diag: err sending mask to MDM: %d\n", err); /* * If the error is recoverable, then * clear the write flag, so we will * resubmit a write on the next frame. * Otherwise, don't resubmit a write * on the next frame. */ if ((-ESHUTDOWN) != err) diag_hsic[index]. in_busy_hsic_write = 0; } } } if (driver->diag_smux_enabled && (remote_proc == QSC) && driver->lcid) { if (payload_size > 0) { err = msm_smux_write(driver->lcid, NULL, driver->user_space_data_buf + token_offset, payload_size); if (err) { pr_err("diag:send mask to MDM err %d", err); return err; } } } #endif /* send masks to 8k now */ if (!remote_proc) diag_process_hdlc((void *) (driver->user_space_data_buf + token_offset), payload_size); return 0; } if (payload_size > itemsize) { pr_err("diag: Dropping packet, packet payload size crosses" "4KB limit. Current payload size %d\n", payload_size); driver->dropped_count++; return -EBADMSG; } buf_copy = diagmem_alloc(driver, payload_size, POOL_TYPE_COPY); if (!buf_copy) { driver->dropped_count++; return -ENOMEM; } err = copy_from_user(buf_copy, buf + 4, payload_size); if (err) { printk(KERN_INFO "diagchar : copy_from_user failed\n"); diagmem_free(driver, buf_copy, POOL_TYPE_COPY); buf_copy = NULL; return -EFAULT; } data_type = pkt_type & (DATA_TYPE_DCI_LOG | DATA_TYPE_DCI_EVENT | DCI_PKT_TYPE); if (data_type) { diag_process_apps_dci_read_data(data_type, buf_copy, payload_size); if (pkt_type & DATA_TYPE_DCI_LOG) pkt_type ^= DATA_TYPE_DCI_LOG; else if (pkt_type & DATA_TYPE_DCI_EVENT) { pkt_type ^= DATA_TYPE_DCI_EVENT; } else { pkt_type ^= DCI_PKT_TYPE; diagmem_free(driver, buf_copy, POOL_TYPE_COPY); return 0; } /* * If the data is not headed for normal processing or the usb * is unplugged and we are in usb mode */ if ((pkt_type != DATA_TYPE_LOG && pkt_type != DATA_TYPE_EVENT) || ((driver->logging_mode == USB_MODE) && (!driver->usb_connected))) { diagmem_free(driver, buf_copy, POOL_TYPE_COPY); return 0; } } if (driver->stm_state[APPS_DATA] && (pkt_type >= DATA_TYPE_EVENT && pkt_type <= DATA_TYPE_LOG)) { int stm_size = 0; stm_size = stm_log_inv_ts(OST_ENTITY_DIAG, 0, buf_copy, payload_size); if (stm_size == 0) pr_debug("diag: In %s, stm_log_inv_ts returned size of 0\n", __func__); diagmem_free(driver, buf_copy, POOL_TYPE_COPY); return 0; } #ifdef DIAG_DEBUG printk(KERN_DEBUG "data is -->\n"); for (i = 0; i < payload_size; i++) printk(KERN_DEBUG "\t %x \t", *(((unsigned char *)buf_copy)+i)); #endif send.state = DIAG_STATE_START; send.pkt = buf_copy; send.last = (void *)(buf_copy + payload_size - 1); send.terminate = 1; #ifdef DIAG_DEBUG pr_debug("diag: Already used bytes in buffer %d, and" " incoming payload size is %d\n", driver->used, payload_size); printk(KERN_DEBUG "hdlc encoded data is -->\n"); for (i = 0; i < payload_size + 8; i++) { printk(KERN_DEBUG "\t %x \t", *(((unsigned char *)buf_hdlc)+i)); if (*(((unsigned char *)buf_hdlc)+i) != 0x7e) length++; } #endif mutex_lock(&driver->diagchar_mutex); if (!buf_hdlc) buf_hdlc = diagmem_alloc(driver, HDLC_OUT_BUF_SIZE, POOL_TYPE_HDLC); if (!buf_hdlc) { ret = -ENOMEM; driver->used = 0; goto fail_free_copy; } if (HDLC_OUT_BUF_SIZE < (2*payload_size) + 3) { pr_err("diag: Dropping packet, HDLC encoded packet payload size crosses buffer limit. Current payload size %d\n", ((2*payload_size) + 3)); driver->dropped_count++; ret = -EBADMSG; goto fail_free_hdlc; } if (HDLC_OUT_BUF_SIZE - driver->used <= (2*payload_size) + 3) { err = diag_device_write(buf_hdlc, APPS_DATA, NULL); if (err) { ret = -EIO; goto fail_free_hdlc; } buf_hdlc = NULL; driver->used = 0; buf_hdlc = diagmem_alloc(driver, HDLC_OUT_BUF_SIZE, POOL_TYPE_HDLC); if (!buf_hdlc) { ret = -ENOMEM; goto fail_free_copy; } } enc.dest = buf_hdlc + driver->used; enc.dest_last = (void *)(buf_hdlc + driver->used + 2*payload_size + 3); diag_hdlc_encode(&send, &enc); /* This is to check if after HDLC encoding, we are still within the limits of aggregation buffer. If not, we write out the current buffer and start aggregation in a newly allocated buffer */ if ((uintptr_t)enc.dest >= (uintptr_t)(buf_hdlc + HDLC_OUT_BUF_SIZE)) { err = diag_device_write(buf_hdlc, APPS_DATA, NULL); if (err) { ret = -EIO; goto fail_free_hdlc; } buf_hdlc = NULL; driver->used = 0; buf_hdlc = diagmem_alloc(driver, HDLC_OUT_BUF_SIZE, POOL_TYPE_HDLC); if (!buf_hdlc) { ret = -ENOMEM; goto fail_free_copy; } enc.dest = buf_hdlc + driver->used; enc.dest_last = (void *)(buf_hdlc + driver->used + (2*payload_size) + 3); diag_hdlc_encode(&send, &enc); } driver->used = ((uintptr_t)enc.dest - (uintptr_t)buf_hdlc < HDLC_OUT_BUF_SIZE) ? ((uintptr_t)enc.dest - (uintptr_t)buf_hdlc) : HDLC_OUT_BUF_SIZE; if (pkt_type == DATA_TYPE_RESPONSE) { err = diag_device_write(buf_hdlc, APPS_DATA, NULL); if (err) { ret = -EIO; goto fail_free_hdlc; } buf_hdlc = NULL; driver->used = 0; } diagmem_free(driver, buf_copy, POOL_TYPE_COPY); buf_copy = NULL; mutex_unlock(&driver->diagchar_mutex); check_drain_timer(); return 0; fail_free_hdlc: diagmem_free(driver, buf_hdlc, POOL_TYPE_HDLC); buf_hdlc = NULL; driver->used = 0; diagmem_free(driver, buf_copy, POOL_TYPE_COPY); buf_copy = NULL; mutex_unlock(&driver->diagchar_mutex); return ret; fail_free_copy: diagmem_free(driver, buf_copy, POOL_TYPE_COPY); buf_copy = NULL; mutex_unlock(&driver->diagchar_mutex); return ret; } void diag_ws_init() { driver->dci_ws.ref_count = 0; driver->dci_ws.copy_count = 0; spin_lock_init(&driver->dci_ws.lock); driver->md_ws.ref_count = 0; driver->md_ws.copy_count = 0; spin_lock_init(&driver->md_ws.lock); spin_lock_init(&driver->ws_lock); } void diag_ws_on_notify() { /* * Do not deal with reference count here as there can be spurious * interrupts. */ pm_stay_awake(driver->diag_dev); } void diag_ws_on_read(int type, int pkt_len) { unsigned long flags; struct diag_ws_ref_t *ws_ref = NULL; switch (type) { case DIAG_WS_DCI: ws_ref = &driver->dci_ws; break; case DIAG_WS_MD: ws_ref = &driver->md_ws; break; default: pr_err_ratelimited("diag: In %s, invalid type: %d\n", __func__, type); return; } spin_lock_irqsave(&ws_ref->lock, flags); if (pkt_len > 0) { ws_ref->ref_count++; } else { if (ws_ref->ref_count < 1) { ws_ref->ref_count = 0; ws_ref->copy_count = 0; } diag_ws_release(); } spin_unlock_irqrestore(&ws_ref->lock, flags); } void diag_ws_on_copy(int type) { unsigned long flags; struct diag_ws_ref_t *ws_ref = NULL; switch (type) { case DIAG_WS_DCI: ws_ref = &driver->dci_ws; break; case DIAG_WS_MD: ws_ref = &driver->md_ws; break; default: pr_err_ratelimited("diag: In %s, invalid type: %d\n", __func__, type); return; } spin_lock_irqsave(&ws_ref->lock, flags); ws_ref->copy_count++; spin_unlock_irqrestore(&ws_ref->lock, flags); } void diag_ws_on_copy_fail(int type) { unsigned long flags; struct diag_ws_ref_t *ws_ref = NULL; switch (type) { case DIAG_WS_DCI: ws_ref = &driver->dci_ws; break; case DIAG_WS_MD: ws_ref = &driver->md_ws; break; default: pr_err_ratelimited("diag: In %s, invalid type: %d\n", __func__, type); return; } spin_lock_irqsave(&ws_ref->lock, flags); ws_ref->ref_count--; spin_unlock_irqrestore(&ws_ref->lock, flags); diag_ws_release(); } void diag_ws_on_copy_complete(int type) { unsigned long flags; struct diag_ws_ref_t *ws_ref = NULL; switch (type) { case DIAG_WS_DCI: ws_ref = &driver->dci_ws; break; case DIAG_WS_MD: ws_ref = &driver->md_ws; break; default: pr_err_ratelimited("diag: In %s, invalid type: %d\n", __func__, type); return; } spin_lock_irqsave(&ws_ref->lock, flags); ws_ref->ref_count -= ws_ref->copy_count; if (ws_ref->ref_count < 1) ws_ref->ref_count = 0; ws_ref->copy_count = 0; spin_unlock_irqrestore(&ws_ref->lock, flags); diag_ws_release(); } void diag_ws_reset(int type) { unsigned long flags; struct diag_ws_ref_t *ws_ref = NULL; switch (type) { case DIAG_WS_DCI: ws_ref = &driver->dci_ws; break; case DIAG_WS_MD: ws_ref = &driver->md_ws; break; default: pr_err_ratelimited("diag: In %s, invalid type: %d\n", __func__, type); return; } spin_lock_irqsave(&ws_ref->lock, flags); ws_ref->ref_count = 0; ws_ref->copy_count = 0; spin_unlock_irqrestore(&ws_ref->lock, flags); diag_ws_release(); } void diag_ws_release() { unsigned long flags; spin_lock_irqsave(&driver->ws_lock, flags); if (driver->dci_ws.ref_count == 0 && driver->md_ws.ref_count == 0) pm_relax(driver->diag_dev); spin_unlock_irqrestore(&driver->ws_lock, flags); } static int diag_real_time_info_init(void) { int i; if (!driver) return -EIO; for (i = 0; i < DIAG_NUM_PROC; i++) { driver->real_time_mode[i] = 1; driver->proc_rt_vote_mask[i] |= DIAG_PROC_DCI; driver->proc_rt_vote_mask[i] |= DIAG_PROC_MEMORY_DEVICE; } driver->real_time_update_busy = 0; driver->proc_active_mask = 0; driver->diag_real_time_wq = create_singlethread_workqueue( "diag_real_time_wq"); if (!driver->diag_real_time_wq) return -ENOMEM; INIT_WORK(&(driver->diag_real_time_work), diag_real_time_work_fn); mutex_init(&driver->real_time_mutex); return 0; } int mask_request_validate(unsigned char mask_buf[]) { uint8_t packet_id; uint8_t subsys_id; uint16_t ss_cmd; packet_id = mask_buf[0]; if (packet_id == 0x4B) { subsys_id = mask_buf[1]; ss_cmd = *(uint16_t *)(mask_buf + 2); /* Packets with SSID which are allowed */ switch (subsys_id) { case 0x04: /* DIAG_SUBSYS_WCDMA */ if ((ss_cmd == 0) || (ss_cmd == 0xF)) return 1; break; case 0x08: /* DIAG_SUBSYS_GSM */ if ((ss_cmd == 0) || (ss_cmd == 0x1)) return 1; break; case 0x09: /* DIAG_SUBSYS_UMTS */ case 0x0F: /* DIAG_SUBSYS_CM */ if (ss_cmd == 0) return 1; break; case 0x0C: /* DIAG_SUBSYS_OS */ if ((ss_cmd == 2) || (ss_cmd == 0x100)) return 1; /* MPU and APU */ break; case 0x12: /* DIAG_SUBSYS_DIAG_SERV */ if ((ss_cmd == 0) || (ss_cmd == 0x6) || (ss_cmd == 0x7)) return 1; break; case 0x13: /* DIAG_SUBSYS_FS */ if ((ss_cmd == 0) || (ss_cmd == 0x1)) return 1; break; default: return 0; break; } } else { switch (packet_id) { case 0x00: /* Version Number */ case 0x0C: /* CDMA status packet */ case 0x1C: /* Diag Version */ case 0x1D: /* Time Stamp */ case 0x60: /* Event Report Control */ case 0x63: /* Status snapshot */ case 0x73: /* Logging Configuration */ case 0x7C: /* Extended build ID */ case 0x7D: /* Extended Message configuration */ case 0x81: /* Event get mask */ case 0x82: /* Set the event mask */ return 1; break; default: return 0; break; } } return 0; } static const struct file_operations diagcharfops = { .owner = THIS_MODULE, .read = diagchar_read, .write = diagchar_write, #ifdef CONFIG_COMPAT .compat_ioctl = diagchar_compat_ioctl, #endif .unlocked_ioctl = diagchar_ioctl, .open = diagchar_open, .release = diagchar_close }; static int diagchar_setup_cdev(dev_t devno) { int err; cdev_init(driver->cdev, &diagcharfops); driver->cdev->owner = THIS_MODULE; driver->cdev->ops = &diagcharfops; err = cdev_add(driver->cdev, devno, 1); if (err) { printk(KERN_INFO "diagchar cdev registration failed !\n\n"); return -1; } driver->diagchar_class = class_create(THIS_MODULE, "diag"); if (IS_ERR(driver->diagchar_class)) { printk(KERN_ERR "Error creating diagchar class.\n"); return -1; } driver->diag_dev = device_create(driver->diagchar_class, NULL, devno, (void *)driver, "diag"); if (!driver->diag_dev) return -EIO; driver->diag_dev->power.wakeup = wakeup_source_register("DIAG_WS"); return 0; } static int diagchar_cleanup(void) { if (driver) { if (driver->cdev) { /* TODO - Check if device exists before deleting */ device_destroy(driver->diagchar_class, MKDEV(driver->major, driver->minor_start)); cdev_del(driver->cdev); } if (!IS_ERR(driver->diagchar_class)) class_destroy(driver->diagchar_class); kfree(driver); } return 0; } #ifdef CONFIG_DIAGFWD_BRIDGE_CODE static void diag_connect_work_fn(struct work_struct *w) { diagfwd_connect_bridge(1); } static void diag_disconnect_work_fn(struct work_struct *w) { diagfwd_disconnect_bridge(1); } #endif #ifdef CONFIG_DIAGFWD_BRIDGE_CODE void diagfwd_bridge_fn(int type) { if (type == EXIT) { diagfwd_bridge_exit(); diagfwd_bridge_dci_exit(); } } #else inline void diagfwd_bridge_fn(int type) { } #endif static int __init diagchar_init(void) { dev_t dev; int error, ret; pr_debug("diagfwd initializing ..\n"); ret = 0; driver = kzalloc(sizeof(struct diagchar_dev) + 5, GFP_KERNEL); if (!driver) return -ENOMEM; #ifdef CONFIG_DIAGFWD_BRIDGE_CODE diag_bridge = kzalloc(MAX_BRIDGES_DATA * sizeof(struct diag_bridge_dev), GFP_KERNEL); if (!diag_bridge) { pr_warn("diag: could not allocate memory for bridges\n"); goto fail; } diag_bridge_dci = kzalloc(MAX_BRIDGES_DCI * sizeof(struct diag_bridge_dci_dev), GFP_KERNEL); if (!diag_bridge_dci) { pr_warn("diag: could not allocate memory for dci bridges\n"); goto fail_diag_bridge; } diag_hsic = kzalloc(MAX_HSIC_DATA_CH * sizeof(struct diag_hsic_dev), GFP_KERNEL); if (!diag_hsic) { pr_warn("diag: could not allocate memory for hsic ch\n"); goto fail_diag_bridge_dci; } diag_hsic_dci = kzalloc(MAX_HSIC_DCI_CH * sizeof(struct diag_hsic_dci_dev), GFP_KERNEL); if (!diag_hsic_dci) { pr_warn("diag: could not allocate memory for hsic dci ch\n"); goto fail_diag_hsic; } #endif driver->used = 0; timer_in_progress = 0; driver->debug_flag = 1; driver->dci_state = DIAG_DCI_NO_ERROR; setup_timer(&drain_timer, drain_timer_func, 1234); driver->itemsize = itemsize; driver->poolsize = poolsize; driver->itemsize_hdlc = itemsize_hdlc; driver->poolsize_hdlc = poolsize_hdlc; driver->itemsize_user = itemsize_user; driver->poolsize_user = poolsize_user; driver->itemsize_write_struct = itemsize_write_struct; driver->poolsize_write_struct = poolsize_write_struct; driver->itemsize_dci = itemsize_dci; driver->poolsize_dci = poolsize_dci; driver->num_clients = max_clients; driver->logging_mode = USB_MODE; driver->socket_process = NULL; driver->callback_process = NULL; driver->mask_check = 0; driver->in_busy_pktdata = 0; driver->in_busy_dcipktdata = 0; mutex_init(&driver->diagchar_mutex); init_waitqueue_head(&driver->wait_q); init_waitqueue_head(&driver->smd_wait_q); INIT_WORK(&(driver->diag_drain_work), diag_drain_work_fn); diag_ipc_log = ipc_log_context_create(DIAG_IPC_LOG_PAGES, "diag"); if (!diag_ipc_log) pr_err("diag: failed to create IPC logging context\n"); diag_ws_init(); ret = diag_real_time_info_init(); if (ret) goto fail_diag_hsic_dci; ret = diag_debugfs_init(); if (ret) goto fail_diag_hsic_dci; ret = diag_masks_init(); if (ret) goto fail_diag_hsic_dci; ret = diagfwd_init(); if (ret) goto fail_diag_hsic_dci; #ifdef CONFIG_DIAGFWD_BRIDGE_CODE ret = diagfwd_bridge_init(HSIC_DATA_CH); if (ret) goto fail_diag_hsic_dci; ret = diagfwd_bridge_init(HSIC_DATA_CH_2); if (ret) goto fail_diag_hsic_dci; ret = diagfwd_bridge_dci_init(HSIC_DCI_CH); if (ret) goto fail_diag_hsic_dci; ret = diagfwd_bridge_dci_init(HSIC_DCI_CH_2); if (ret) goto fail_diag_hsic_dci; /* register HSIC device */ ret = platform_driver_register(&msm_hsic_ch_driver); if (ret) { pr_err("diag: could not register HSIC device, ret: %d\n", ret); goto fail_diag_hsic_dci; } ret = diagfwd_bridge_init(SMUX); if (ret) goto fail_diag_hsic_dci; INIT_WORK(&(driver->diag_connect_work), diag_connect_work_fn); INIT_WORK(&(driver->diag_disconnect_work), diag_disconnect_work_fn); #endif ret = diagfwd_cntl_init(); if (ret) goto fail_diag_hsic_dci; driver->dci_state = diag_dci_init(); pr_debug("diagchar initializing ..\n"); driver->num = 1; driver->name = ((void *)driver) + sizeof(struct diagchar_dev); strlcpy(driver->name, "diag", 4); /* Get major number from kernel and initialize */ error = alloc_chrdev_region(&dev, driver->minor_start, driver->num, driver->name); if (!error) { driver->major = MAJOR(dev); driver->minor_start = MINOR(dev); } else { pr_err("diag: Major number not allocated\n"); goto fail_diag_hsic_dci; } driver->cdev = cdev_alloc(); if (!driver->cdev) goto fail_alloc_cdev; error = diagchar_setup_cdev(dev); if (error) goto fail_setup_cdev; pr_debug("diagchar initialized now"); return 0; fail_setup_cdev: cdev_del(driver->cdev); fail_alloc_cdev: unregister_chrdev_region(dev, driver->num); fail_diag_hsic_dci: kfree(diag_hsic_dci); fail_diag_hsic: kfree(diag_hsic); fail_diag_bridge_dci: kfree(diag_bridge_dci); fail_diag_bridge: kfree(diag_bridge); fail: pr_err("diagchar is not initialized, ret: %d\n", ret); diag_debugfs_cleanup(); diagchar_cleanup(); diagfwd_exit(); diagfwd_cntl_exit(); diag_dci_exit(); diag_masks_exit(); diagfwd_bridge_fn(EXIT); kfree(driver); return -1; } static void diagchar_exit(void) { printk(KERN_INFO "diagchar exiting ..\n"); /* On Driver exit, send special pool type to ensure no memory leaks */ diagmem_exit(driver, POOL_TYPE_ALL); diagfwd_exit(); diagfwd_cntl_exit(); diag_dci_exit(); diag_masks_exit(); diagfwd_bridge_fn(EXIT); diag_debugfs_cleanup(); diagchar_cleanup(); printk(KERN_INFO "done diagchar exit\n"); } module_init(diagchar_init); module_exit(diagchar_exit);
gpl-2.0
phra/802_21
boost_1_49_0/doc/html/boost/accumulators/as_weighted_feature_tag_id570643.html
6037
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Struct template as_weighted_feature&lt;tag::relative_tail_variate_means&lt; LeftRight, VariateType, VariateTag &gt;&gt;</title> <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../../accumulators/reference.html#header.boost.accumulators.statistics.tail_variate_means_hpp" title="Header &lt;boost/accumulators/statistics/tail_variate_means.hpp&gt;"> <link rel="prev" href="feature_of_tag_absolute_id570609.html" title="Struct template feature_of&lt;tag::absolute_weighted_tail_variate_means&lt; LeftRight, VariateType, VariateTag &gt;&gt;"> <link rel="next" href="feature_of_tag_relative_id570680.html" title="Struct template feature_of&lt;tag::relative_weighted_tail_variate_means&lt; LeftRight, VariateType, VariateTag &gt;&gt;"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> <td align="center"><a href="../../../../index.html">Home</a></td> <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="feature_of_tag_absolute_id570609.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../accumulators/reference.html#header.boost.accumulators.statistics.tail_variate_means_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="feature_of_tag_relative_id570680.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="refentry"> <a name="boost.accumulators.as_weighted_feature_tag_id570643"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Struct template as_weighted_feature&lt;tag::relative_tail_variate_means&lt; LeftRight, VariateType, VariateTag &gt;&gt;</span></h2> <p>boost::accumulators::as_weighted_feature&lt;tag::relative_tail_variate_means&lt; LeftRight, VariateType, VariateTag &gt;&gt;</p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../accumulators/reference.html#header.boost.accumulators.statistics.tail_variate_means_hpp" title="Header &lt;boost/accumulators/statistics/tail_variate_means.hpp&gt;">boost/accumulators/statistics/tail_variate_means.hpp</a>&gt; </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> LeftRight<span class="special">,</span> <span class="keyword">typename</span> VariateType<span class="special">,</span> <span class="keyword">typename</span> VariateTag<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="as_weighted_feature_tag_id570643.html" title="Struct template as_weighted_feature&lt;tag::relative_tail_variate_means&lt; LeftRight, VariateType, VariateTag &gt;&gt;">as_weighted_feature</a><span class="special">&lt;</span><span class="identifier">tag</span><span class="special">::</span><span class="identifier">relative_tail_variate_means</span><span class="special">&lt;</span> <span class="identifier">LeftRight</span><span class="special">,</span> <span class="identifier">VariateType</span><span class="special">,</span> <span class="identifier">VariateTag</span> <span class="special">&gt;</span><span class="special">&gt;</span> <span class="special">{</span> <span class="comment">// types</span> <span class="keyword">typedef</span> <a class="link" href="tag/relative_weighted_tail__id576957.html" title="Struct template relative_weighted_tail_variate_means">tag::relative_weighted_tail_variate_means</a><span class="special">&lt;</span> <span class="identifier">LeftRight</span><span class="special">,</span> <span class="identifier">VariateType</span><span class="special">,</span> <span class="identifier">VariateTag</span> <span class="special">&gt;</span> <a name="boost.accumulators.as_weighted_feature_tag_id570643.type"></a><span class="identifier">type</span><span class="special">;</span> <span class="special">}</span><span class="special">;</span></pre></div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2005, 2006 Eric Niebler<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="feature_of_tag_absolute_id570609.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../accumulators/reference.html#header.boost.accumulators.statistics.tail_variate_means_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="feature_of_tag_relative_id570680.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
gpl-2.0
kriwil/OpenX
www/delivery/lg.php
107769
<?php /* +---------------------------------------------------------------------------+ | OpenX v2.8 | | ========== | | | | Copyright (c) 2003-2009 OpenX Limited | | For contact details, see: http://www.openx.org/ | | | | 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. | | | | This program is distributed in the hope that it will be useful, | | but WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | GNU General Public License for more details. | | | | You should have received a copy of the GNU General Public License | | along with this program; if not, write to the Free Software | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | +---------------------------------------------------------------------------+ $Id: template.php 79311 2011-11-03 21:18:14Z chris.nutting $ */ /** * * This is autogenerated merged delivery file which contains all files * from delivery merged into one output file. * * !!!Warning!!! * * Do not edit this file. If you need to do any changes to any delivery PHP file * checkout sourcecode from the svn repository, do a necessary changes inside * "delivery_dev" folder and regenerate delivery files using command: * # php rebuild.php * * For more information on ant generator or if you want to check why we do this * check out the documentation wiki page: * https://developer.openx.org/wiki/display/COMM/Using+Ant#UsingAnt-Generatingoptimizeddelivery * */ function parseDeliveryIniFile($configPath = null, $configFile = null, $sections = true) { if (!$configPath) { $configPath = MAX_PATH . '/var'; } if ($configFile) { $configFile = '.' . $configFile; } $host = OX_getHostName(); $configFileName = $configPath . '/' . $host . $configFile . '.conf.php'; $conf = @parse_ini_file($configFileName, $sections); if (isset($conf['realConfig'])) { $realconf = @parse_ini_file(MAX_PATH . '/var/' . $conf['realConfig'] . '.conf.php', $sections); $conf = mergeConfigFiles($realconf, $conf); } if (!empty($conf)) { return $conf; } elseif ($configFile === '.plugin') { $pluginType = basename($configPath); $defaultConfig = MAX_PATH . '/plugins/' . $pluginType . '/default.plugin.conf.php'; $conf = @parse_ini_file($defaultConfig, $sections); if ($conf !== false) { return $conf; } echo "OpenX could not read the default configuration file for the {$pluginType} plugin"; exit(1); } $configFileName = $configPath . '/default' . $configFile . '.conf.php'; $conf = @parse_ini_file($configFileName, $sections); if (isset($conf['realConfig'])) { $conf = @parse_ini_file(MAX_PATH . '/var/' . $conf['realConfig'] . '.conf.php', $sections); } if (!empty($conf)) { return $conf; } if (file_exists(MAX_PATH . '/var/INSTALLED')) { echo "OpenX has been installed, but no configuration file was found.\n"; exit(1); } echo "OpenX has not been installed yet -- please read the INSTALL.txt file.\n"; exit(1); } if (!function_exists('mergeConfigFiles')) { function mergeConfigFiles($realConfig, $fakeConfig) { foreach ($fakeConfig as $key => $value) { if (is_array($value)) { if (!isset($realConfig[$key])) { $realConfig[$key] = array(); } $realConfig[$key] = mergeConfigFiles($realConfig[$key], $value); } else { if (isset($realConfig[$key]) && is_array($realConfig[$key])) { $realConfig[$key][0] = $value; } else { if (isset($realConfig) && !is_array($realConfig)) { $temp = $realConfig; $realConfig = array(); $realConfig[0] = $temp; } $realConfig[$key] = $value; } } } unset($realConfig['realConfig']); return $realConfig; } } function OX_getMinimumRequiredMemory($limit = null) { if ($limit == 'maintenance') { return 134217728; } return 134217728; } function OX_getMemoryLimitSizeInBytes() { $phpMemoryLimit = ini_get('memory_limit'); if (empty($phpMemoryLimit) || $phpMemoryLimit == -1) { return -1; } $aSize = array( 'G' => 1073741824, 'M' => 1048576, 'K' => 1024 ); $phpMemoryLimitInBytes = $phpMemoryLimit; foreach($aSize as $type => $multiplier) { $pos = strpos($phpMemoryLimit, $type); if (!$pos) { $pos = strpos($phpMemoryLimit, strtolower($type)); } if ($pos) { $phpMemoryLimitInBytes = substr($phpMemoryLimit, 0, $pos) * $multiplier; } } return $phpMemoryLimitInBytes; } function OX_checkMemoryCanBeSet() { $phpMemoryLimitInBytes = OX_getMemoryLimitSizeInBytes(); if ($phpMemoryLimitInBytes == -1) { return true; } OX_increaseMemoryLimit($phpMemoryLimitInBytes + 1); $newPhpMemoryLimitInBytes = OX_getMemoryLimitSizeInBytes(); $memoryCanBeSet = ($phpMemoryLimitInBytes != $newPhpMemoryLimitInBytes); @ini_set('memory_limit', $phpMemoryLimitInBytes); return $memoryCanBeSet; } function OX_increaseMemoryLimit($setMemory) { $phpMemoryLimitInBytes = OX_getMemoryLimitSizeInBytes(); if ($phpMemoryLimitInBytes == -1) { return true; } if ($setMemory > $phpMemoryLimitInBytes) { if (@ini_set('memory_limit', $setMemory) === false) { return false; } } return true; } function setupConfigVariables() { $GLOBALS['_MAX']['MAX_DELIVERY_MULTIPLE_DELIMITER'] = '|'; $GLOBALS['_MAX']['MAX_COOKIELESS_PREFIX'] = '__'; $GLOBALS['_MAX']['thread_id'] = uniqid(); $GLOBALS['_MAX']['SSL_REQUEST'] = false; if ( (!empty($_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT'] == $GLOBALS['_MAX']['CONF']['openads']['sslPort'])) || (!empty($_SERVER['HTTPS']) && ((strtolower($_SERVER['HTTPS']) == 'on') || ($_SERVER['HTTPS'] == 1))) || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && (strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https')) || (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && (strtolower($_SERVER['HTTP_X_FORWARDED_SSL']) == 'on')) || (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && (strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) == 'on')) || (!empty($_SERVER['FRONT-END-HTTPS']) && (strtolower($_SERVER['FRONT-END-HTTPS']) == 'on')) ) { $GLOBALS['_MAX']['SSL_REQUEST'] = true; } $GLOBALS['_MAX']['MAX_RAND'] = isset($GLOBALS['_MAX']['CONF']['priority']['randmax']) ? $GLOBALS['_MAX']['CONF']['priority']['randmax'] : 2147483647; list($micro_seconds, $seconds) = explode(" ", microtime()); $GLOBALS['_MAX']['NOW_ms'] = round(1000 *((float)$micro_seconds + (float)$seconds)); if (substr($_SERVER['SCRIPT_NAME'], -11) != 'install.php') { $GLOBALS['serverTimezone'] = date_default_timezone_get(); OA_setTimeZoneUTC(); } } function setupServerVariables() { if (empty($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; if (!empty($_SERVER['QUERY_STRING'])) { $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; } } } function setupDeliveryConfigVariables() { if (!defined('MAX_PATH')) { define('MAX_PATH', dirname(__FILE__).'/../..'); } if (!defined('OX_PATH')) { define('OX_PATH', MAX_PATH); } if (!defined('LIB_PATH')) { define('LIB_PATH', MAX_PATH. DIRECTORY_SEPARATOR. 'lib'. DIRECTORY_SEPARATOR. 'OX'); } if ( !(isset($GLOBALS['_MAX']['CONF']))) { $GLOBALS['_MAX']['CONF'] = parseDeliveryIniFile(); } setupConfigVariables(); } function OA_setTimeZone($timezone) { date_default_timezone_set($timezone); $GLOBALS['_DATE_TIMEZONE_DEFAULT'] = $timezone; } function OA_setTimeZoneUTC() { OA_setTimeZone('UTC'); } function OA_setTimeZoneLocal() { $tz = !empty($GLOBALS['_MAX']['PREF']['timezone']) ? $GLOBALS['_MAX']['PREF']['timezone'] : 'GMT'; OA_setTimeZone($tz); } function OX_getHostName() { if (!empty($_SERVER['HTTP_HOST'])) { $host = explode(':', $_SERVER['HTTP_HOST']); $host = $host[0]; } else if (!empty($_SERVER['SERVER_NAME'])) { $host = explode(':', $_SERVER['SERVER_NAME']); $host = $host[0]; } return $host; } function OX_getHostNameWithPort() { if (!empty($_SERVER['HTTP_HOST'])) { $host = $_SERVER['HTTP_HOST']; } else if (!empty($_SERVER['SERVER_NAME'])) { $host = $_SERVER['SERVER_NAME']; } return $host; } function setupIncludePath() { static $checkIfAlreadySet; if (isset($checkIfAlreadySet)) { return; } $checkIfAlreadySet = true; $oxPearPath = MAX_PATH . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pear'; $oxZendPath = MAX_PATH . DIRECTORY_SEPARATOR . 'lib'; set_include_path($oxPearPath . PATH_SEPARATOR . $oxZendPath . PATH_SEPARATOR . get_include_path()); } OX_increaseMemoryLimit(OX_getMinimumRequiredMemory()); if (!defined('E_DEPRECATED')) { define('E_DEPRECATED', 0); } setupServerVariables(); setupDeliveryConfigVariables(); $conf = $GLOBALS['_MAX']['CONF']; $GLOBALS['_OA']['invocationType'] = array_search(basename($_SERVER['SCRIPT_FILENAME']), $conf['file']); if (!empty($conf['debug']['production'])) { error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED); } else { error_reporting(E_ALL ^ E_DEPRECATED); } $file = '/lib/max/Delivery/common.php'; $GLOBALS['_MAX']['FILES'][$file] = true; $file = '/lib/max/Delivery/cookie.php'; $GLOBALS['_MAX']['FILES'][$file] = true; $GLOBALS['_MAX']['COOKIE']['LIMITATIONS']['arrCappingCookieNames'] = array(); if (!is_callable('MAX_cookieSet')) { if (!empty($conf['cookie']['plugin']) && is_readable(MAX_PATH . "/plugins/cookieStorage/{$conf['cookie']['plugin']}.delivery.php")) { include MAX_PATH . "/plugins/cookieStorage/{$conf['cookie']['plugin']}.delivery.php"; } else { function MAX_cookieSet($name, $value, $expire, $path = '/', $domain = null) { return MAX_cookieClientCookieSet($name, $value, $expire, $path, $domain); } function MAX_cookieUnset($name) { return MAX_cookieClientCookieUnset($name); } function MAX_cookieFlush() { return MAX_cookieClientCookieFlush(); } function MAX_cookieLoad() { return true; } } } function MAX_cookieAdd($name, $value, $expire = 0) { if (!isset($GLOBALS['_MAX']['COOKIE']['CACHE'])) { $GLOBALS['_MAX']['COOKIE']['CACHE'] = array(); } $GLOBALS['_MAX']['COOKIE']['CACHE'][$name] = array($value, $expire); } function MAX_cookieSetViewerIdAndRedirect($viewerId) { $aConf = $GLOBALS['_MAX']['CONF']; MAX_cookieAdd($aConf['var']['viewerId'], $viewerId, _getTimeYearFromNow()); MAX_cookieFlush(); if ($GLOBALS['_MAX']['SSL_REQUEST']) { $url = MAX_commonConstructSecureDeliveryUrl(basename($_SERVER['SCRIPT_NAME'])); } else { $url = MAX_commonConstructDeliveryUrl(basename($_SERVER['SCRIPT_NAME'])); } $url .= "?{$aConf['var']['cookieTest']}=1&" . $_SERVER['QUERY_STRING']; MAX_header("Location: {$url}"); exit; } function _getTimeThirtyDaysFromNow() { return MAX_commonGetTimeNow() + 2592000; } function _getTimeYearFromNow() { return MAX_commonGetTimeNow() + 31536000; } function _getTimeYearAgo() { return MAX_commonGetTimeNow() - 31536000; } function MAX_cookieUnpackCapping() { $conf = $GLOBALS['_MAX']['CONF']; $cookieNames = $GLOBALS['_MAX']['COOKIE']['LIMITATIONS']['arrCappingCookieNames']; if (!is_array($cookieNames)) return; foreach ($cookieNames as $cookieName) { if (!empty($_COOKIE[$cookieName])) { if (!is_array($_COOKIE[$cookieName])) { $output = array(); $data = explode('_', $_COOKIE[$cookieName]); foreach ($data as $pair) { list($name, $value) = explode('.', $pair); $output[$name] = $value; } $_COOKIE[$cookieName] = $output; } } if (!empty($_COOKIE['_' . $cookieName]) && is_array($_COOKIE['_' . $cookieName])) { foreach ($_COOKIE['_' . $cookieName] as $adId => $cookie) { if (_isBlockCookie($cookieName)) { $_COOKIE[$cookieName][$adId] = $cookie; } else { if (isset($_COOKIE[$cookieName][$adId])) { $_COOKIE[$cookieName][$adId] += $cookie; } else { $_COOKIE[$cookieName][$adId] = $cookie; } } MAX_cookieUnset("_{$cookieName}[{$adId}]"); } } } } function _isBlockCookie($cookieName) { return in_array($cookieName, array( $GLOBALS['_MAX']['CONF']['var']['blockAd'], $GLOBALS['_MAX']['CONF']['var']['blockCampaign'], $GLOBALS['_MAX']['CONF']['var']['blockZone'], $GLOBALS['_MAX']['CONF']['var']['lastView'], $GLOBALS['_MAX']['CONF']['var']['lastClick'], $GLOBALS['_MAX']['CONF']['var']['blockLoggingClick'], )); } function MAX_cookieGetUniqueViewerId($create = true) { static $uniqueViewerId = null; if(!is_null($uniqueViewerId)) { return $uniqueViewerId; } $conf = $GLOBALS['_MAX']['CONF']; if (isset($_COOKIE[$conf['var']['viewerId']])) { $uniqueViewerId = $_COOKIE[$conf['var']['viewerId']]; } elseif ($create) { $uniqueViewerId = md5(uniqid('', true)); $GLOBALS['_MAX']['COOKIE']['newViewerId'] = true; } return $uniqueViewerId; } function MAX_cookieGetCookielessViewerID() { if (empty($_SERVER['REMOTE_ADDR']) || empty($_SERVER['HTTP_USER_AGENT'])) { return ''; } $cookiePrefix = $GLOBALS['_MAX']['MAX_COOKIELESS_PREFIX']; return $cookiePrefix . substr(md5($_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT']), 0, 32-(strlen($cookiePrefix))); } function MAX_Delivery_cookie_cappingOnRequest() { if (isset($GLOBALS['_OA']['invocationType']) && ($GLOBALS['_OA']['invocationType'] == 'xmlrpc' || $GLOBALS['_OA']['invocationType'] == 'view') ) { return true; } return !$GLOBALS['_MAX']['CONF']['logging']['adImpressions']; } function MAX_Delivery_cookie_setCapping($type, $id, $block = 0, $cap = 0, $sessionCap = 0) { $conf = $GLOBALS['_MAX']['CONF']; $setBlock = false; if ($cap > 0) { $expire = MAX_commonGetTimeNow() + $conf['cookie']['permCookieSeconds']; if (!isset($_COOKIE[$conf['var']['cap' . $type]][$id])) { $value = 1; $setBlock = true; } else if ($_COOKIE[$conf['var']['cap' . $type]][$id] >= $cap) { $value = -$_COOKIE[$conf['var']['cap' . $type]][$id]+1; $setBlock = true; } else { $value = 1; } MAX_cookieAdd("_{$conf['var']['cap' . $type]}[{$id}]", $value, $expire); } if ($sessionCap > 0) { if (!isset($_COOKIE[$conf['var']['sessionCap' . $type]][$id])) { $value = 1; $setBlock = true; } else if ($_COOKIE[$conf['var']['sessionCap' . $type]][$id] >= $sessionCap) { $value = -$_COOKIE[$conf['var']['sessionCap' . $type]][$id]+1; $setBlock = true; } else { $value = 1; } MAX_cookieAdd("_{$conf['var']['sessionCap' . $type]}[{$id}]", $value, 0); } if ($block > 0 || $setBlock) { MAX_cookieAdd("_{$conf['var']['block' . $type]}[{$id}]", MAX_commonGetTimeNow(), _getTimeThirtyDaysFromNow()); } } function MAX_cookieClientCookieSet($name, $value, $expire, $path = '/', $domain = null) { if (isset($GLOBALS['_OA']['invocationType']) && $GLOBALS['_OA']['invocationType'] == 'xmlrpc') { if (!isset($GLOBALS['_OA']['COOKIE']['XMLRPC_CACHE'])) { $GLOBALS['_OA']['COOKIE']['XMLRPC_CACHE'] = array(); } $GLOBALS['_OA']['COOKIE']['XMLRPC_CACHE'][$name] = array($value, $expire); } else { @setcookie($name, $value, $expire, $path, $domain); } } function MAX_cookieClientCookieUnset($name) { $conf = $GLOBALS['_MAX']['CONF']; $domain = (!empty($conf['cookie']['domain'])) ? $conf['cookie']['domain'] : null; MAX_cookieSet($name, false, _getTimeYearAgo(), '/', $domain); MAX_cookieSet(str_replace('_', '%5F', urlencode($name)), false, _getTimeYearAgo(), '/', $domain); } function MAX_cookieClientCookieFlush() { $conf = $GLOBALS['_MAX']['CONF']; MAX_cookieSendP3PHeaders(); if (!empty($GLOBALS['_MAX']['COOKIE']['CACHE'])) { reset($GLOBALS['_MAX']['COOKIE']['CACHE']); while (list($name,$v) = each ($GLOBALS['_MAX']['COOKIE']['CACHE'])) { list($value, $expire) = $v; if ($name == $conf['var']['viewerId']) { MAX_cookieClientCookieSet($name, $value, $expire, '/', (!empty($conf['cookie']['domain']) ? $conf['cookie']['domain'] : null)); } else { MAX_cookieSet($name, $value, $expire, '/', (!empty($conf['cookie']['domain']) ? $conf['cookie']['domain'] : null)); } } $GLOBALS['_MAX']['COOKIE']['CACHE'] = array(); } $cookieNames = $GLOBALS['_MAX']['COOKIE']['LIMITATIONS']['arrCappingCookieNames']; if (!is_array($cookieNames)) return; $maxCookieSize = !empty($conf['cookie']['maxCookieSize']) ? $conf['cookie']['maxCookieSize'] : 2048; foreach ($cookieNames as $cookieName) { if (empty($_COOKIE["_{$cookieName}"])) { continue; } switch ($cookieName) { case $conf['var']['blockAd'] : case $conf['var']['blockCampaign'] : case $conf['var']['blockZone'] : $expire = _getTimeThirtyDaysFromNow(); break; case $conf['var']['lastClick'] : case $conf['var']['lastView'] : case $conf['var']['capAd'] : case $conf['var']['capCampaign'] : case $conf['var']['capZone'] : $expire = _getTimeYearFromNow(); break; case $conf['var']['sessionCapCampaign'] : case $conf['var']['sessionCapAd'] : case $conf['var']['sessionCapZone'] : $expire = 0; break; } if (!empty($_COOKIE[$cookieName]) && is_array($_COOKIE[$cookieName])) { $data = array(); foreach ($_COOKIE[$cookieName] as $adId => $value) { $data[] = "{$adId}.{$value}"; } while (strlen(implode('_', $data)) > $maxCookieSize) { $data = array_slice($data, 1); } MAX_cookieSet($cookieName, implode('_', $data), $expire, '/', (!empty($conf['cookie']['domain']) ? $conf['cookie']['domain'] : null)); } } } function MAX_cookieSendP3PHeaders() { if ($GLOBALS['_MAX']['CONF']['p3p']['policies']) { MAX_header("P3P: ". _generateP3PHeader()); } } function _generateP3PHeader() { $conf = $GLOBALS['_MAX']['CONF']; $p3p_header = ''; if ($conf['p3p']['policies']) { if ($conf['p3p']['policyLocation'] != '') { $p3p_header .= " policyref=\"".$conf['p3p']['policyLocation']."\""; } if ($conf['p3p']['policyLocation'] != '' && $conf['p3p']['compactPolicy'] != '') { $p3p_header .= ", "; } if ($conf['p3p']['compactPolicy'] != '') { $p3p_header .= " CP=\"".$conf['p3p']['compactPolicy']."\""; } } return $p3p_header; } $file = '/lib/max/Delivery/remotehost.php'; $GLOBALS['_MAX']['FILES'][$file] = true; function MAX_remotehostSetInfo($run = false) { if (empty($GLOBALS['_OA']['invocationType']) || $run || ($GLOBALS['_OA']['invocationType'] != 'xmlrpc')) { MAX_remotehostProxyLookup(); MAX_remotehostReverseLookup(); MAX_remotehostSetGeoInfo(); } } function MAX_remotehostProxyLookup() { $conf = $GLOBALS['_MAX']['CONF']; if ($conf['logging']['proxyLookup']) { OX_Delivery_logMessage('checking remote host proxy', 7); $proxy = false; if (!empty($_SERVER['HTTP_VIA']) || !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $proxy = true; } elseif (!empty($_SERVER['REMOTE_HOST'])) { $aProxyHosts = array( 'proxy', 'cache', 'inktomi' ); foreach ($aProxyHosts as $proxyName) { if (strpos($_SERVER['REMOTE_HOST'], $proxyName) !== false) { $proxy = true; break; } } } if ($proxy) { OX_Delivery_logMessage('proxy detected', 7); $aHeaders = array( 'HTTP_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP' ); foreach ($aHeaders as $header) { if (!empty($_SERVER[$header])) { $ip = $_SERVER[$header]; break; } } if (!empty($ip)) { foreach (explode(',', $ip) as $ip) { $ip = trim($ip); if (($ip != 'unknown') && (!MAX_remotehostPrivateAddress($ip))) { $_SERVER['REMOTE_ADDR'] = $ip; $_SERVER['REMOTE_HOST'] = ''; $_SERVER['HTTP_VIA'] = ''; OX_Delivery_logMessage('real address set to '.$ip, 7); break; } } } } } } function MAX_remotehostReverseLookup() { if (empty($_SERVER['REMOTE_HOST'])) { if ($GLOBALS['_MAX']['CONF']['logging']['reverseLookup']) { $_SERVER['REMOTE_HOST'] = @gethostbyaddr($_SERVER['REMOTE_ADDR']); } else { $_SERVER['REMOTE_HOST'] = $_SERVER['REMOTE_ADDR']; } } } function MAX_remotehostSetGeoInfo() { if (!function_exists('parseDeliveryIniFile')) { } $aConf = $GLOBALS['_MAX']['CONF']; $type = (!empty($aConf['geotargeting']['type'])) ? $aConf['geotargeting']['type'] : null; if (!is_null($type) && $type != 'none') { $aComponent = explode(':', $aConf['geotargeting']['type']); if (!empty($aComponent[1]) && (!empty($aConf['pluginGroupComponents'][$aComponent[1]]))) { $GLOBALS['_MAX']['CLIENT_GEO'] = OX_Delivery_Common_hook('getGeoInfo', array(), $type); } } } function MAX_remotehostPrivateAddress($ip) { setupIncludePath(); require_once 'Net/IPv4.php'; $aPrivateNetworks = array( '10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', '127.0.0.0/24' ); foreach ($aPrivateNetworks as $privateNetwork) { if (Net_IPv4::ipInNetwork($ip, $privateNetwork)) { return true; } } return false; } $file = '/lib/max/Delivery/log.php'; $GLOBALS['_MAX']['FILES'][$file] = true; $file = '/lib/max/Dal/Delivery.php'; $GLOBALS['_MAX']['FILES'][$file] = true; $file = '/lib/OA/Dal/Delivery.php'; $GLOBALS['_MAX']['FILES'][$file] = true; function OA_Dal_Delivery_getAccountTZs() { $aConf = $GLOBALS['_MAX']['CONF']; $query = " SELECT value FROM ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['application_variable'])." WHERE name = 'admin_account_id' "; $res = OA_Dal_Delivery_query($query); if (is_resource($res) && OA_Dal_Delivery_numRows($res)) { $adminAccountId = (int)OA_Dal_Delivery_result($res, 0, 0); } else { $adminAccountId = false; } $query = " SELECT a.account_id AS account_id, apa.value AS timezone FROM ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['accounts'])." AS a JOIN ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['account_preference_assoc'])." AS apa ON (apa.account_id = a.account_id) JOIN ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['preferences'])." AS p ON (p.preference_id = apa.preference_id) WHERE a.account_type IN ('ADMIN', 'MANAGER') AND p.preference_name = 'timezone' "; $res = OA_Dal_Delivery_query($query); $aResult = array( 'adminAccountId' => $adminAccountId, 'aAccounts' => array() ); if (is_resource($res)) { while ($row = OA_Dal_Delivery_fetchAssoc($res)) { $accountId = (int)$row['account_id']; if ($accountId === $adminAccountId) { $aResult['default'] = $row['timezone']; } else { $aResult['aAccounts'][$accountId] = $row['timezone']; } } } if (empty($aResult['default'])) { $aResult['default'] = 'UTC'; } return $aResult; } function OA_Dal_Delivery_getZoneInfo($zoneid) { $aConf = $GLOBALS['_MAX']['CONF']; $zoneid = (int)$zoneid; $query = " SELECT z.zoneid AS zone_id, z.zonename AS name, z.delivery AS type, z.description AS description, z.width AS width, z.height AS height, z.chain AS chain, z.prepend AS prepend, z.append AS append, z.appendtype AS appendtype, z.forceappend AS forceappend, z.inventory_forecast_type AS inventory_forecast_type, z.block AS block_zone, z.capping AS cap_zone, z.session_capping AS session_cap_zone, z.show_capped_no_cookie AS show_capped_no_cookie_zone, z.ext_adselection AS ext_adselection, z.affiliateid AS publisher_id, a.agencyid AS agency_id, a.account_id AS trafficker_account_id, m.account_id AS manager_account_id FROM ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['zones'])." AS z, ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['affiliates'])." AS a, ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['agency'])." AS m WHERE z.zoneid = {$zoneid} AND z.affiliateid = a.affiliateid AND a.agencyid = m.agencyid"; $rZoneInfo = OA_Dal_Delivery_query($query); if (!is_resource($rZoneInfo)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false; } $aZoneInfo = OA_Dal_Delivery_fetchAssoc($rZoneInfo); $query = " SELECT p.preference_id AS preference_id, p.preference_name AS preference_name FROM {$aConf['table']['prefix']}{$aConf['table']['preferences']} AS p WHERE p.preference_name = 'default_banner_image_url' OR p.preference_name = 'default_banner_destination_url'"; $rPreferenceInfo = OA_Dal_Delivery_query($query); if (!is_resource($rPreferenceInfo)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false; } if (OA_Dal_Delivery_numRows($rPreferenceInfo) != 2) { return $aZoneInfo; } $aPreferenceInfo = OA_Dal_Delivery_fetchAssoc($rPreferenceInfo); $variableName = $aPreferenceInfo['preference_name'] . '_id'; $$variableName = $aPreferenceInfo['preference_id']; $aPreferenceInfo = OA_Dal_Delivery_fetchAssoc($rPreferenceInfo); $variableName = $aPreferenceInfo['preference_name'] . '_id'; $$variableName = $aPreferenceInfo['preference_id']; $query = " SELECT 'default_banner_destination_url_trafficker' AS item, apa.value AS value FROM ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['account_preference_assoc'])." AS apa WHERE apa.account_id = {$aZoneInfo['trafficker_account_id']} AND apa.preference_id = $default_banner_destination_url_id UNION SELECT 'default_banner_destination_url_manager' AS item, apa.value AS value FROM ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['account_preference_assoc'])." AS apa WHERE apa.account_id = {$aZoneInfo['manager_account_id']} AND apa.preference_id = $default_banner_destination_url_id UNION SELECT 'default_banner_image_url_trafficker' AS item, apa.value AS value FROM ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['account_preference_assoc'])." AS apa WHERE apa.account_id = {$aZoneInfo['trafficker_account_id']} AND apa.preference_id = $default_banner_image_url_id UNION SELECT 'default_banner_image_url_manager' AS item, apa.value AS value FROM ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['account_preference_assoc'])." AS apa WHERE apa.account_id = {$aZoneInfo['manager_account_id']} AND apa.preference_id = $default_banner_image_url_id UNION SELECT 'default_banner_image_url_admin' AS item, apa.value AS value FROM ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['account_preference_assoc'])." AS apa, ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['accounts'])." AS a WHERE apa.account_id = a.account_id AND a.account_type = 'ADMIN' AND apa.preference_id = $default_banner_image_url_id UNION SELECT 'default_banner_destination_url_admin' AS item, apa.value AS value FROM ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['account_preference_assoc'])." AS apa, ".OX_escapeIdentifier($aConf['table']['prefix'].$aConf['table']['accounts'])." AS a WHERE apa.account_id = a.account_id AND a.account_type = 'ADMIN' AND apa.preference_id = $default_banner_destination_url_id"; $rDefaultBannerInfo = OA_Dal_Delivery_query($query); if (!is_resource($rDefaultBannerInfo)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false; } if (OA_Dal_Delivery_numRows($rDefaultBannerInfo) == 0) { if ($aConf['defaultBanner']['imageUrl'] != '') { $aZoneInfo['default_banner_image_url'] = $aConf['defaultBanner']['imageUrl']; } return $aZoneInfo; } $aDefaultImageURLs = array(); $aDefaultDestinationURLs = array(); while ($aRow = OA_Dal_Delivery_fetchAssoc($rDefaultBannerInfo)) { if (stristr($aRow['item'], 'default_banner_image_url')) { $aDefaultImageURLs[$aRow['item']] = $aRow['value']; } else if (stristr($aRow['item'], 'default_banner_destination_url')) { $aDefaultDestinationURLs[$aRow['item']] = $aRow['value']; } } $aTypes = array( 0 => 'admin', 1 => 'manager', 2 => 'trafficker' ); foreach ($aTypes as $type) { if (isset($aDefaultImageURLs['default_banner_image_url_' . $type])) { $aZoneInfo['default_banner_image_url'] = $aDefaultImageURLs['default_banner_image_url_' . $type]; } if (isset($aDefaultDestinationURLs['default_banner_destination_url_' . $type])) { $aZoneInfo['default_banner_destination_url'] = $aDefaultDestinationURLs['default_banner_destination_url_' . $type]; } } return $aZoneInfo; } function OA_Dal_Delivery_getPublisherZones($publisherid) { $conf = $GLOBALS['_MAX']['CONF']; $publisherid = (int)$publisherid; $rZones = OA_Dal_Delivery_query(" SELECT z.zoneid AS zone_id, z.affiliateid AS publisher_id, z.zonename AS name, z.delivery AS type FROM ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['zones'])." AS z WHERE z.affiliateid={$publisherid} "); if (!is_resource($rZones)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false; } while ($aZone = OA_Dal_Delivery_fetchAssoc($rZones)) { $aZones[$aZone['zone_id']] = $aZone; } return ($aZones); } function OA_Dal_Delivery_getZoneLinkedAds($zoneid) { $conf = $GLOBALS['_MAX']['CONF']; $zoneid = (int)$zoneid; $aRows = OA_Dal_Delivery_getZoneInfo($zoneid); $aRows['xAds'] = array(); $aRows['ads'] = array(); $aRows['lAds'] = array(); $aRows['eAds'] = array(); $aRows['count_active'] = 0; $aRows['zone_companion'] = false; $aRows['count_active'] = 0; $totals = array( 'xAds' => 0, 'ads' => 0, 'lAds' => 0 ); $query = " SELECT d.bannerid AS ad_id, d.campaignid AS placement_id, d.status AS status, d.description AS name, d.storagetype AS type, d.contenttype AS contenttype, d.pluginversion AS pluginversion, d.filename AS filename, d.imageurl AS imageurl, d.htmltemplate AS htmltemplate, d.htmlcache AS htmlcache, d.width AS width, d.height AS height, d.weight AS weight, d.seq AS seq, d.target AS target, d.url AS url, d.alt AS alt, d.statustext AS statustext, d.bannertext AS bannertext, d.adserver AS adserver, d.block AS block_ad, d.capping AS cap_ad, d.session_capping AS session_cap_ad, d.compiledlimitation AS compiledlimitation, d.acl_plugins AS acl_plugins, d.prepend AS prepend, d.append AS append, d.bannertype AS bannertype, d.alt_filename AS alt_filename, d.alt_imageurl AS alt_imageurl, d.alt_contenttype AS alt_contenttype, d.parameters AS parameters, d.transparent AS transparent, d.ext_bannertype AS ext_bannertype, az.priority AS priority, az.priority_factor AS priority_factor, az.to_be_delivered AS to_be_delivered, c.campaignid AS campaign_id, c.priority AS campaign_priority, c.weight AS campaign_weight, c.companion AS campaign_companion, c.block AS block_campaign, c.capping AS cap_campaign, c.session_capping AS session_cap_campaign, c.show_capped_no_cookie AS show_capped_no_cookie, c.clientid AS client_id, c.expire_time AS expire_time, c.revenue_type AS revenue_type, c.ecpm_enabled AS ecpm_enabled, c.ecpm AS ecpm, c.clickwindow AS clickwindow, c.viewwindow AS viewwindow, m.advertiser_limitation AS advertiser_limitation, a.account_id AS account_id, z.affiliateid AS affiliate_id, a.agencyid as agency_id FROM ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['banners'])." AS d JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['ad_zone_assoc'])." AS az ON (d.bannerid = az.ad_id) JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['zones'])." AS z ON (az.zone_id = z.zoneid) JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['campaigns'])." AS c ON (c.campaignid = d.campaignid) LEFT JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['clients'])." AS m ON (m.clientid = c.clientid) LEFT JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['agency'])." AS a ON (a.agencyid = m.agencyid) WHERE az.zone_id = {$zoneid} AND d.status <= 0 AND c.status <= 0 "; $rAds = OA_Dal_Delivery_query($query); if (!is_resource($rAds)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } $aConversionLinkedCreatives = MAX_cacheGetTrackerLinkedCreatives(); while ($aAd = OA_Dal_Delivery_fetchAssoc($rAds)) { $aAd['tracker_status'] = (!empty($aConversionLinkedCreatives[$aAd['ad_id']]['status'])) ? $aConversionLinkedCreatives[$aAd['ad_id']]['status'] : null; if ($aAd['campaign_priority'] == -1) { $aRows['xAds'][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } elseif ($aAd['campaign_priority'] == 0) { $aRows['lAds'][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } elseif ($aAd['campaign_priority'] == -2) { $aRows['eAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } else { $aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } if ($aAd['campaign_companion'] == 1) { $aRows['zone_companion'][] = $aAd['placement_id']; } } if (is_array($aRows['xAds'])) { $totals['xAds'] = _setPriorityFromWeights($aRows['xAds']); } if (is_array($aRows['ads'])) { $totals['ads'] = _getTotalPrioritiesByCP($aRows['ads']); } if (is_array($aRows['eAds'])) { $totals['eAds'] = _getTotalPrioritiesByCP($aRows['eAds']); } if (is_array($aRows['lAds'])) { $totals['lAds'] = _setPriorityFromWeights($aRows['lAds']); } $aRows['priority'] = $totals; return $aRows; } function OA_Dal_Delivery_getZoneLinkedAdInfos($zoneid) { $conf = $GLOBALS['_MAX']['CONF']; $zoneid = (int)$zoneid; $aRows['xAds'] = array(); $aRows['ads'] = array(); $aRows['lAds'] = array(); $aRows['eAds'] = array(); $aRows['zone_companion'] = false; $aRows['count_active'] = 0; $query = "SELECT " ."d.bannerid AS ad_id, " ."d.campaignid AS placement_id, " ."d.status AS status, " ."d.width AS width, " ."d.ext_bannertype AS ext_bannertype, " ."d.height AS height, " ."d.storagetype AS type, " ."d.contenttype AS contenttype, " ."d.weight AS weight, " ."d.adserver AS adserver, " ."d.block AS block_ad, " ."d.capping AS cap_ad, " ."d.session_capping AS session_cap_ad, " ."d.compiledlimitation AS compiledlimitation, " ."d.acl_plugins AS acl_plugins, " ."d.alt_filename AS alt_filename, " ."az.priority AS priority, " ."az.priority_factor AS priority_factor, " ."az.to_be_delivered AS to_be_delivered, " ."c.campaignid AS campaign_id, " ."c.priority AS campaign_priority, " ."c.weight AS campaign_weight, " ."c.companion AS campaign_companion, " ."c.block AS block_campaign, " ."c.capping AS cap_campaign, " ."c.session_capping AS session_cap_campaign, " ."c.show_capped_no_cookie AS show_capped_no_cookie, " ."c.clientid AS client_id, " ."c.expire_time AS expire_time, " ."c.revenue_type AS revenue_type, " ."c.ecpm_enabled AS ecpm_enabled, " ."c.ecpm AS ecpm, " ."ct.status AS tracker_status, " .OX_Dal_Delivery_regex("d.htmlcache", "src\\s?=\\s?[\\'\"]http:")." AS html_ssl_unsafe, " .OX_Dal_Delivery_regex("d.imageurl", "^http:")." AS url_ssl_unsafe " ."FROM " .OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['banners'])." AS d JOIN " .OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['ad_zone_assoc'])." AS az ON (d.bannerid = az.ad_id) JOIN " .OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['campaigns'])." AS c ON (c.campaignid = d.campaignid) LEFT JOIN " .OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['campaigns_trackers'])." AS ct ON (ct.campaignid = c.campaignid) " ."WHERE " ."az.zone_id = {$zoneid} " ."AND " ."d.status <= 0 " ."AND " ."c.status <= 0 "; $rAds = OA_Dal_Delivery_query($query); if (!is_resource($rAds)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } while ($aAd = OA_Dal_Delivery_fetchAssoc($rAds)) { if ($aAd['campaign_priority'] == -1) { $aRows['xAds'][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } elseif ($aAd['campaign_priority'] == 0) { $aRows['lAds'][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } elseif ($aAd['campaign_priority'] == -2) { $aRows['eAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } else { $aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } if ($aAd['campaign_companion'] == 1) { $aRows['zone_companion'][] = $aAd['placement_id']; } } return $aRows; } function OA_Dal_Delivery_getLinkedAdInfos($search, $campaignid = '', $lastpart = true) { $conf = $GLOBALS['_MAX']['CONF']; $campaignid = (int)$campaignid; if ($campaignid > 0) { $precondition = " AND d.campaignid = '".$campaignid."' "; } else { $precondition = ''; } $aRows['xAds'] = array(); $aRows['ads'] = array(); $aRows['lAds'] = array(); $aRows['count_active'] = 0; $aRows['zone_companion'] = false; $aRows['count_active'] = 0; $totals = array( 'xAds' => 0, 'ads' => 0, 'lAds' => 0 ); $query = OA_Dal_Delivery_buildAdInfoQuery($search, $lastpart, $precondition); $rAds = OA_Dal_Delivery_query($query); if (!is_resource($rAds)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } while ($aAd = OA_Dal_Delivery_fetchAssoc($rAds)) { if ($aAd['campaign_priority'] == -1) { $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight']; $aRows['xAds'][$aAd['ad_id']] = $aAd; $aRows['count_active']++; $totals['xAds'] += $aAd['priority']; } elseif ($aAd['campaign_priority'] == 0) { $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight']; $aRows['lAds'][$aAd['ad_id']] = $aAd; $aRows['count_active']++; $totals['lAds'] += $aAd['priority']; } elseif ($aAd['campaign_priority'] == -2) { $aRows['eAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } else { $aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } } return $aRows; } function OA_Dal_Delivery_getLinkedAds($search, $campaignid = '', $lastpart = true) { $conf = $GLOBALS['_MAX']['CONF']; $campaignid = (int)$campaignid; if ($campaignid > 0) { $precondition = " AND d.campaignid = '".$campaignid."' "; } else { $precondition = ''; } $aRows['xAds'] = array(); $aRows['ads'] = array(); $aRows['lAds'] = array(); $aRows['count_active'] = 0; $aRows['zone_companion'] = false; $aRows['count_active'] = 0; $totals = array( 'xAds' => 0, 'ads' => 0, 'lAds' => 0 ); $query = OA_Dal_Delivery_buildQuery($search, $lastpart, $precondition); $rAds = OA_Dal_Delivery_query($query); if (!is_resource($rAds)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } $aConversionLinkedCreatives = MAX_cacheGetTrackerLinkedCreatives(); while ($aAd = OA_Dal_Delivery_fetchAssoc($rAds)) { $aAd['tracker_status'] = (!empty($aConversionLinkedCreatives[$aAd['ad_id']]['status'])) ? $aConversionLinkedCreatives[$aAd['ad_id']]['status'] : null; if ($aAd['campaign_priority'] == -1) { $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight']; $aRows['xAds'][$aAd['ad_id']] = $aAd; $aRows['count_active']++; $totals['xAds'] += $aAd['priority']; } elseif ($aAd['campaign_priority'] == 0) { $aAd['priority'] = $aAd['campaign_weight'] * $aAd['weight']; $aRows['lAds'][$aAd['ad_id']] = $aAd; $aRows['count_active']++; $totals['lAds'] += $aAd['priority']; } elseif ($aAd['campaign_priority'] == -2) { $aRows['eAds'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } else { $aRows['ads'][$aAd['campaign_priority']][$aAd['ad_id']] = $aAd; $aRows['count_active']++; } } if (isset($aRows['xAds']) && is_array($aRows['xAds'])) { $totals['xAds'] = _setPriorityFromWeights($aRows['xAds']); } if (isset($aRows['ads']) && is_array($aRows['ads'])) { if (isset($aRows['lAds']) && is_array($aRows['lAds']) && count($aRows['lAds']) > 0) { $totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], true); } else { $totals['ads'] = _getTotalPrioritiesByCP($aRows['ads'], false); } } if (is_array($aRows['eAds'])) { $totals['eAds'] = _getTotalPrioritiesByCP($aRows['eAds']); } if (isset($aRows['lAds']) && is_array($aRows['lAds'])) { $totals['lAds'] = _setPriorityFromWeights($aRows['lAds']); } $aRows['priority'] = $totals; return $aRows; } function OA_Dal_Delivery_getAd($ad_id) { $conf = $GLOBALS['_MAX']['CONF']; $ad_id = (int)$ad_id; $query = " SELECT d.bannerid AS ad_id, d.campaignid AS placement_id, d.status AS status, d.description AS name, d.storagetype AS type, d.contenttype AS contenttype, d.pluginversion AS pluginversion, d.filename AS filename, d.imageurl AS imageurl, d.htmltemplate AS htmltemplate, d.htmlcache AS htmlcache, d.width AS width, d.height AS height, d.weight AS weight, d.seq AS seq, d.target AS target, d.url AS url, d.alt AS alt, d.statustext AS statustext, d.bannertext AS bannertext, d.adserver AS adserver, d.block AS block_ad, d.capping AS cap_ad, d.session_capping AS session_cap_ad, d.compiledlimitation AS compiledlimitation, d.acl_plugins AS acl_plugins, d.prepend AS prepend, d.append AS append, d.bannertype AS bannertype, d.alt_filename AS alt_filename, d.alt_imageurl AS alt_imageurl, d.alt_contenttype AS alt_contenttype, d.parameters AS parameters, d.transparent AS transparent, d.ext_bannertype AS ext_bannertype, c.campaignid AS campaign_id, c.block AS block_campaign, c.capping AS cap_campaign, c.session_capping AS session_cap_campaign, c.show_capped_no_cookie AS show_capped_no_cookie, m.clientid AS client_id, c.clickwindow AS clickwindow, c.viewwindow AS viewwindow, m.advertiser_limitation AS advertiser_limitation, m.agencyid AS agency_id FROM ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['banners'])." AS d, ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['campaigns'])." AS c, ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['clients'])." AS m WHERE d.bannerid={$ad_id} AND d.campaignid = c.campaignid AND m.clientid = c.clientid "; $rAd = OA_Dal_Delivery_query($query); if (!is_resource($rAd)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } else { return (OA_Dal_Delivery_fetchAssoc($rAd)); } } function OA_Dal_Delivery_getChannelLimitations($channelid) { $conf = $GLOBALS['_MAX']['CONF']; $channelid = (int)$channelid; $rLimitation = OA_Dal_Delivery_query(" SELECT acl_plugins,compiledlimitation FROM ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['channel'])." WHERE channelid={$channelid}"); if (!is_resource($rLimitation)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } $limitations = OA_Dal_Delivery_fetchAssoc($rLimitation); return $limitations; } function OA_Dal_Delivery_getCreative($filename) { $conf = $GLOBALS['_MAX']['CONF']; $rCreative = OA_Dal_Delivery_query(" SELECT contents, t_stamp FROM ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['images'])." WHERE filename = '".OX_escapeString($filename)."' "); if (!is_resource($rCreative)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } else { $aResult = OA_Dal_Delivery_fetchAssoc($rCreative); $aResult['t_stamp'] = strtotime($aResult['t_stamp'] . ' GMT'); return ($aResult); } } function OA_Dal_Delivery_getTracker($trackerid) { $conf = $GLOBALS['_MAX']['CONF']; $trackerid = (int)$trackerid; $rTracker = OA_Dal_Delivery_query(" SELECT t.clientid AS advertiser_id, t.trackerid AS tracker_id, t.trackername AS name, t.variablemethod AS variablemethod, t.description AS description, t.viewwindow AS viewwindow, t.clickwindow AS clickwindow, t.blockwindow AS blockwindow, t.appendcode AS appendcode FROM ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['trackers'])." AS t WHERE t.trackerid={$trackerid} "); if (!is_resource($rTracker)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } else { return (OA_Dal_Delivery_fetchAssoc($rTracker)); } } function OA_Dal_Delivery_getTrackerLinkedCreatives($trackerid = null) { $aConf = $GLOBALS['_MAX']['CONF']; $trackerid = (int)$trackerid; $rCreatives = OA_Dal_Delivery_query(" SELECT b.bannerid AS ad_id, b.campaignid AS placement_id, c.viewwindow AS view_window, c.clickwindow AS click_window, ct.status AS status, t.type AS tracker_type FROM {$aConf['table']['prefix']}{$aConf['table']['banners']} AS b, {$aConf['table']['prefix']}{$aConf['table']['campaigns_trackers']} AS ct, {$aConf['table']['prefix']}{$aConf['table']['campaigns']} AS c, {$aConf['table']['prefix']}{$aConf['table']['trackers']} AS t WHERE ct.trackerid=t.trackerid AND c.campaignid=b.campaignid AND b.campaignid = ct.campaignid " . ((!empty($trackerid)) ? ' AND t.trackerid='.$trackerid : '') . " "); if (!is_resource($rCreatives)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } else { $output = array(); while ($aRow = OA_Dal_Delivery_fetchAssoc($rCreatives)) { $output[$aRow['ad_id']] = $aRow; } return $output; } } function OA_Dal_Delivery_getTrackerVariables($trackerid) { $conf = $GLOBALS['_MAX']['CONF']; $trackerid = (int)$trackerid; $rVariables = OA_Dal_Delivery_query(" SELECT v.variableid AS variable_id, v.trackerid AS tracker_id, v.name AS name, v.datatype AS type, purpose AS purpose, reject_if_empty AS reject_if_empty, is_unique AS is_unique, unique_window AS unique_window, v.variablecode AS variablecode FROM ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['variables'])." AS v WHERE v.trackerid={$trackerid} "); if (!is_resource($rVariables)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } else { $output = array(); while ($aRow = OA_Dal_Delivery_fetchAssoc($rVariables)) { $output[$aRow['variable_id']] = $aRow; } return $output; } } function OA_Dal_Delivery_getMaintenanceInfo() { $conf = $GLOBALS['_MAX']['CONF']; $result = OA_Dal_Delivery_query(" SELECT value AS maintenance_timestamp FROM ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['application_variable'])." WHERE name = 'maintenance_timestamp' "); if (!is_resource($result)) { return (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) ? OA_DELIVERY_CACHE_FUNCTION_ERROR : null; } else { $result = OA_Dal_Delivery_fetchAssoc($result); return $result['maintenance_timestamp']; } } function OA_Dal_Delivery_buildQuery($part, $lastpart, $precondition) { $conf = $GLOBALS['_MAX']['CONF']; $aColumns = array( 'd.bannerid AS ad_id', 'd.campaignid AS placement_id', 'd.status AS status', 'd.description AS name', 'd.storagetype AS type', 'd.contenttype AS contenttype', 'd.pluginversion AS pluginversion', 'd.filename AS filename', 'd.imageurl AS imageurl', 'd.htmltemplate AS htmltemplate', 'd.htmlcache AS htmlcache', 'd.width AS width', 'd.height AS height', 'd.weight AS weight', 'd.seq AS seq', 'd.target AS target', 'd.url AS url', 'd.alt AS alt', 'd.statustext AS statustext', 'd.bannertext AS bannertext', 'd.adserver AS adserver', 'd.block AS block_ad', 'd.capping AS cap_ad', 'd.session_capping AS session_cap_ad', 'd.compiledlimitation AS compiledlimitation', 'd.acl_plugins AS acl_plugins', 'd.prepend AS prepend', 'd.append AS append', 'd.bannertype AS bannertype', 'd.alt_filename AS alt_filename', 'd.alt_imageurl AS alt_imageurl', 'd.alt_contenttype AS alt_contenttype', 'd.parameters AS parameters', 'd.transparent AS transparent', 'd.ext_bannertype AS ext_bannertype', 'az.priority AS priority', 'az.priority_factor AS priority_factor', 'az.to_be_delivered AS to_be_delivered', 'm.campaignid AS campaign_id', 'm.priority AS campaign_priority', 'm.weight AS campaign_weight', 'm.companion AS campaign_companion', 'm.block AS block_campaign', 'm.capping AS cap_campaign', 'm.session_capping AS session_cap_campaign', 'm.show_capped_no_cookie AS show_capped_no_cookie', 'm.clickwindow AS clickwindow', 'm.viewwindow AS viewwindow', 'cl.clientid AS client_id', 'm.expire_time AS expire_time', 'm.revenue_type AS revenue_type', 'm.ecpm_enabled AS ecpm_enabled', 'm.ecpm AS ecpm', 'cl.advertiser_limitation AS advertiser_limitation', 'a.account_id AS account_id', 'a.agencyid AS agency_id' ); $aTables = array( "".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['banners'])." AS d", "JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['campaigns'])." AS m ON (d.campaignid = m.campaignid) ", "JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['clients'])." AS cl ON (m.clientid = cl.clientid) ", "JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['ad_zone_assoc'])." AS az ON (d.bannerid = az.ad_id)" ); $select = " az.zone_id = 0 AND m.status <= 0 AND d.status <= 0"; if ($precondition != '') $select .= " $precondition "; if ($part != '') { $conditions = ''; $onlykeywords = true; $part_array = explode(',', $part); for ($k=0; $k < count($part_array); $k++) { if (substr($part_array[$k], 0, 1) == '+' || substr($part_array[$k], 0, 1) == '_') { $operator = 'AND'; $part_array[$k] = substr($part_array[$k], 1); } elseif (substr($part_array[$k], 0, 1) == '-') { $operator = 'NOT'; $part_array[$k] = substr($part_array[$k], 1); } else $operator = 'OR'; if($part_array[$k] != '' && $part_array[$k] != ' ') { if(preg_match('#^(?:size:)?([0-9]+x[0-9]+)$#', $part_array[$k], $m)) { list($width, $height) = explode('x', $m[1]); if ($operator == 'OR') $conditions .= "OR (d.width = $width AND d.height = $height) "; elseif ($operator == 'AND') $conditions .= "AND (d.width = $width AND d.height = $height) "; else $conditions .= "AND (d.width != $width OR d.height != $height) "; $onlykeywords = false; } elseif (substr($part_array[$k],0,6) == 'width:') { $part_array[$k] = substr($part_array[$k], 6); if ($part_array[$k] != '' && $part_array[$k] != ' ') { if (is_int(strpos($part_array[$k], '-'))) { list($min, $max) = explode('-', $part_array[$k]); if ($min == '') $min = 1; if ($max == '') { if ($operator == 'OR') $conditions .= "OR d.width >= '".trim($min)."' "; elseif ($operator == 'AND') $conditions .= "AND d.width >= '".trim($min)."' "; else $conditions .= "AND d.width < '".trim($min)."' "; } if ($max != '') { if ($operator == 'OR') $conditions .= "OR (d.width >= '".trim($min)."' AND d.width <= '".trim($max)."') "; elseif ($operator == 'AND') $conditions .= "AND (d.width >= '".trim($min)."' AND d.width <= '".trim($max)."') "; else $conditions .= "AND (d.width < '".trim($min)."' OR d.width > '".trim($max)."') "; } } else { if ($operator == 'OR') $conditions .= "OR d.width = '".trim($part_array[$k])."' "; elseif ($operator == 'AND') $conditions .= "AND d.width = '".trim($part_array[$k])."' "; else $conditions .= "AND d.width != '".trim($part_array[$k])."' "; } } $onlykeywords = false; } elseif (substr($part_array[$k],0,7) == 'height:') { $part_array[$k] = substr($part_array[$k], 7); if ($part_array[$k] != '' && $part_array[$k] != ' ') { if (is_int(strpos($part_array[$k], '-'))) { list($min, $max) = explode('-', $part_array[$k]); if ($min == '') $min = 1; if ($max == '') { if ($operator == 'OR') $conditions .= "OR d.height >= '".trim($min)."' "; elseif ($operator == 'AND') $conditions .= "AND d.height >= '".trim($min)."' "; else $conditions .= "AND d.height < '".trim($min)."' "; } if ($max != '') { if ($operator == 'OR') $conditions .= "OR (d.height >= '".trim($min)."' AND d.height <= '".trim($max)."') "; elseif ($operator == 'AND') $conditions .= "AND (d.height >= '".trim($min)."' AND d.height <= '".trim($max)."') "; else $conditions .= "AND (d.height < '".trim($min)."' OR d.height > '".trim($max)."') "; } } else { if ($operator == 'OR') $conditions .= "OR d.height = '".trim($part_array[$k])."' "; elseif ($operator == 'AND') $conditions .= "AND d.height = '".trim($part_array[$k])."' "; else $conditions .= "AND d.height != '".trim($part_array[$k])."' "; } } $onlykeywords = false; } elseif (preg_match('#^(?:(?:bannerid|adid|ad_id):)?([0-9]+)$#', $part_array[$k], $m)) { $part_array[$k] = $m[1]; if ($part_array[$k]) { if ($operator == 'OR') $conditions .= "OR d.bannerid='".$part_array[$k]."' "; elseif ($operator == 'AND') $conditions .= "AND d.bannerid='".$part_array[$k]."' "; else $conditions .= "AND d.bannerid!='".$part_array[$k]."' "; } $onlykeywords = false; } elseif (preg_match('#^(?:(?:clientid|campaignid|placementid|placement_id):)?([0-9]+)$#', $part_array[$k], $m)) { $part_array[$k] = $m[1]; if ($part_array[$k]) { if ($operator == 'OR') $conditions .= "OR d.campaignid='".trim($part_array[$k])."' "; elseif ($operator == 'AND') $conditions .= "AND d.campaignid='".trim($part_array[$k])."' "; else $conditions .= "AND d.campaignid!='".trim($part_array[$k])."' "; } $onlykeywords = false; } elseif (substr($part_array[$k], 0, 7) == 'format:') { $part_array[$k] = substr($part_array[$k], 7); if($part_array[$k] != '' && $part_array[$k] != ' ') { if ($operator == 'OR') $conditions .= "OR d.contenttype='".trim($part_array[$k])."' "; elseif ($operator == 'AND') $conditions .= "AND d.contenttype='".trim($part_array[$k])."' "; else $conditions .= "AND d.contenttype!='".trim($part_array[$k])."' "; } $onlykeywords = false; } elseif($part_array[$k] == 'html') { if ($operator == 'OR') $conditions .= "OR d.storagetype='html' "; elseif ($operator == 'AND') $conditions .= "AND d.storagetype='html' "; else $conditions .= "AND d.storagetype!='html' "; $onlykeywords = false; } elseif($part_array[$k] == 'textad') { if ($operator == 'OR') $conditions .= "OR d.storagetype='txt' "; elseif ($operator == 'AND') $conditions .= "AND d.storagetype='txt' "; else $conditions .= "AND d.storagetype!='txt' "; $onlykeywords = false; } else { $conditions .= OA_Dal_Delivery_getKeywordCondition($operator, $part_array[$k]); } } } $conditions = strstr($conditions, ' '); if ($lastpart == true && $onlykeywords == true) $conditions .= OA_Dal_Delivery_getKeywordCondition('OR', 'global'); if ($conditions != '') $select .= ' AND ('.$conditions.') '; } $columns = implode(",\n ", $aColumns); $tables = implode("\n ", $aTables); $leftJoin = " LEFT JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['clients'])." AS c ON (c.clientid = m.clientid) LEFT JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['agency'])." AS a ON (a.agencyid = c.agencyid) "; $query = "SELECT\n " . $columns . "\nFROM\n " . $tables . $leftJoin . "\nWHERE " . $select; return $query; } function OA_Dal_Delivery_buildAdInfoQuery($part, $lastpart, $precondition) { $conf = $GLOBALS['_MAX']['CONF']; $aColumns = array( 'd.bannerid AS ad_id', 'd.campaignid AS placement_id', 'd.status AS status', 'd.storagetype AS type', 'd.contenttype AS contenttype', 'd.weight AS weight', 'd.width AS width', 'd.ext_bannertype AS ext_bannertype', 'd.height AS height', 'd.adserver AS adserver', 'd.block AS block_ad', 'd.capping AS cap_ad', 'd.session_capping AS session_cap_ad', 'd.compiledlimitation AS compiledlimitation', 'd.acl_plugins AS acl_plugins', 'd.alt_filename AS alt_filename', 'az.priority AS priority', 'az.priority_factor AS priority_factor', 'az.to_be_delivered AS to_be_delivered', 'm.campaignid AS campaign_id', 'm.priority AS campaign_priority', 'm.weight AS campaign_weight', 'm.companion AS campaign_companion', 'm.block AS block_campaign', 'm.capping AS cap_campaign', 'm.session_capping AS session_cap_campaign', 'm.show_capped_no_cookie AS show_capped_no_cookie', 'cl.clientid AS client_id', 'm.expire_time AS expire_time', 'm.revenue_type AS revenue_type', 'm.ecpm_enabled AS ecpm_enabled', 'm.ecpm AS ecpm', 'ct.status AS tracker_status', OX_Dal_Delivery_regex("d.htmlcache", "src\\s?=\\s?[\\'\"]http:")." AS html_ssl_unsafe", OX_Dal_Delivery_regex("d.imageurl", "^http:")." AS url_ssl_unsafe", ); $aTables = array( "".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['banners'])." AS d", "JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['ad_zone_assoc'])." AS az ON (d.bannerid = az.ad_id)", "JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['campaigns'])." AS m ON (m.campaignid = d.campaignid) ", ); $select = " az.zone_id = 0 AND m.status <= 0 AND d.status <= 0"; if ($precondition != '') $select .= " $precondition "; if ($part != '') { $conditions = ''; $onlykeywords = true; $part_array = explode(',', $part); for ($k=0; $k < count($part_array); $k++) { if (substr($part_array[$k], 0, 1) == '+' || substr($part_array[$k], 0, 1) == '_') { $operator = 'AND'; $part_array[$k] = substr($part_array[$k], 1); } elseif (substr($part_array[$k], 0, 1) == '-') { $operator = 'NOT'; $part_array[$k] = substr($part_array[$k], 1); } else $operator = 'OR'; if($part_array[$k] != '' && $part_array[$k] != ' ') { if(preg_match('#^(?:size:)?([0-9]+x[0-9]+)$#', $part_array[$k], $m)) { list($width, $height) = explode('x', $m[1]); if ($operator == 'OR') $conditions .= "OR (d.width = $width AND d.height = $height) "; elseif ($operator == 'AND') $conditions .= "AND (d.width = $width AND d.height = $height) "; else $conditions .= "AND (d.width != $width OR d.height != $height) "; $onlykeywords = false; } elseif (substr($part_array[$k],0,6) == 'width:') { $part_array[$k] = substr($part_array[$k], 6); if ($part_array[$k] != '' && $part_array[$k] != ' ') { if (is_int(strpos($part_array[$k], '-'))) { list($min, $max) = explode('-', $part_array[$k]); if ($min == '') $min = 1; if ($max == '') { if ($operator == 'OR') $conditions .= "OR d.width >= '".trim($min)."' "; elseif ($operator == 'AND') $conditions .= "AND d.width >= '".trim($min)."' "; else $conditions .= "AND d.width < '".trim($min)."' "; } if ($max != '') { if ($operator == 'OR') $conditions .= "OR (d.width >= '".trim($min)."' AND d.width <= '".trim($max)."') "; elseif ($operator == 'AND') $conditions .= "AND (d.width >= '".trim($min)."' AND d.width <= '".trim($max)."') "; else $conditions .= "AND (d.width < '".trim($min)."' OR d.width > '".trim($max)."') "; } } else { if ($operator == 'OR') $conditions .= "OR d.width = '".trim($part_array[$k])."' "; elseif ($operator == 'AND') $conditions .= "AND d.width = '".trim($part_array[$k])."' "; else $conditions .= "AND d.width != '".trim($part_array[$k])."' "; } } $onlykeywords = false; } elseif (substr($part_array[$k],0,7) == 'height:') { $part_array[$k] = substr($part_array[$k], 7); if ($part_array[$k] != '' && $part_array[$k] != ' ') { if (is_int(strpos($part_array[$k], '-'))) { list($min, $max) = explode('-', $part_array[$k]); if ($min == '') $min = 1; if ($max == '') { if ($operator == 'OR') $conditions .= "OR d.height >= '".trim($min)."' "; elseif ($operator == 'AND') $conditions .= "AND d.height >= '".trim($min)."' "; else $conditions .= "AND d.height < '".trim($min)."' "; } if ($max != '') { if ($operator == 'OR') $conditions .= "OR (d.height >= '".trim($min)."' AND d.height <= '".trim($max)."') "; elseif ($operator == 'AND') $conditions .= "AND (d.height >= '".trim($min)."' AND d.height <= '".trim($max)."') "; else $conditions .= "AND (d.height < '".trim($min)."' OR d.height > '".trim($max)."') "; } } else { if ($operator == 'OR') $conditions .= "OR d.height = '".trim($part_array[$k])."' "; elseif ($operator == 'AND') $conditions .= "AND d.height = '".trim($part_array[$k])."' "; else $conditions .= "AND d.height != '".trim($part_array[$k])."' "; } } $onlykeywords = false; } elseif (preg_match('#^(?:(?:bannerid|adid|ad_id):)?([0-9]+)$#', $part_array[$k], $m)) { $part_array[$k] = $m[1]; if ($part_array[$k]) { if ($operator == 'OR') $conditions .= "OR d.bannerid='".$part_array[$k]."' "; elseif ($operator == 'AND') $conditions .= "AND d.bannerid='".$part_array[$k]."' "; else $conditions .= "AND d.bannerid!='".$part_array[$k]."' "; } $onlykeywords = false; } elseif (preg_match('#^(?:(?:clientid|campaignid|placementid|placement_id):)?([0-9]+)$#', $part_array[$k], $m)) { $part_array[$k] = $m[1]; if ($part_array[$k]) { if ($operator == 'OR') $conditions .= "OR d.campaignid='".trim($part_array[$k])."' "; elseif ($operator == 'AND') $conditions .= "AND d.campaignid='".trim($part_array[$k])."' "; else $conditions .= "AND d.campaignid!='".trim($part_array[$k])."' "; } $onlykeywords = false; } elseif (substr($part_array[$k], 0, 7) == 'format:') { $part_array[$k] = substr($part_array[$k], 7); if($part_array[$k] != '' && $part_array[$k] != ' ') { if ($operator == 'OR') $conditions .= "OR d.contenttype='".trim($part_array[$k])."' "; elseif ($operator == 'AND') $conditions .= "AND d.contenttype='".trim($part_array[$k])."' "; else $conditions .= "AND d.contenttype!='".trim($part_array[$k])."' "; } $onlykeywords = false; } elseif($part_array[$k] == 'html') { if ($operator == 'OR') $conditions .= "OR d.storagetype='html' "; elseif ($operator == 'AND') $conditions .= "AND d.storagetype='html' "; else $conditions .= "AND d.storagetype!='html' "; $onlykeywords = false; } elseif($part_array[$k] == 'textad') { if ($operator == 'OR') $conditions .= "OR d.storagetype='txt' "; elseif ($operator == 'AND') $conditions .= "AND d.storagetype='txt' "; else $conditions .= "AND d.storagetype!='txt' "; $onlykeywords = false; } else { $conditions .= OA_Dal_Delivery_getKeywordCondition($operator, $part_array[$k]); } } } $conditions = strstr($conditions, ' '); if ($lastpart == true && $onlykeywords == true) $conditions .= OA_Dal_Delivery_getKeywordCondition('OR', 'global'); if ($conditions != '') $select .= ' AND ('.$conditions.') '; } $columns = implode(",\n ", $aColumns); $tables = implode("\n ", $aTables); $leftJoin = " LEFT JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['campaigns_trackers'])." AS ct ON (ct.campaignid = m.campaignid) LEFT JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['clients'])." AS cl ON (cl.clientid = m.clientid) LEFT JOIN ".OX_escapeIdentifier($conf['table']['prefix'].$conf['table']['agency'])." AS a ON (a.agencyid = cl.agencyid) "; $query = "SELECT\n " . $columns . "\nFROM\n " . $tables . $leftJoin . "\nWHERE " . $select; return $query; } function _setPriorityFromWeights(&$aAds) { if (!count($aAds)) { return 0; } $aCampaignWeights = array(); $aCampaignAdWeight = array(); foreach ($aAds as $v) { if (!isset($aCampaignWeights[$v['placement_id']])) { $aCampaignWeights[$v['placement_id']] = $v['campaign_weight']; $aCampaignAdWeight[$v['placement_id']] = 0; } $aCampaignAdWeight[$v['placement_id']] += $v['weight']; } foreach ($aCampaignWeights as $k => $v) { if ($aCampaignAdWeight[$k]) { $aCampaignWeights[$k] /= $aCampaignAdWeight[$k]; } } $totalPri = 0; foreach ($aAds as $k => $v) { $aAds[$k]['priority'] = $aCampaignWeights[$v['placement_id']] * $v['weight']; $totalPri += $aAds[$k]['priority']; } if ($totalPri) { foreach ($aAds as $k => $v) { $aAds[$k]['priority'] /= $totalPri; } return 1; } return 0; } function _getTotalPrioritiesByCP($aAdsByCP, $includeBlank = true) { $totals = array(); $total_priority_cp = array(); $blank_priority = 1; foreach ($aAdsByCP as $campaign_priority => $aAds) { $total_priority_cp[$campaign_priority] = 0; foreach ($aAds as $key => $aAd) { $blank_priority -= (double)$aAd['priority']; if ($aAd['to_be_delivered']) { $priority = $aAd['priority'] * $aAd['priority_factor']; } else { $priority = 0.00001; } $total_priority_cp[$campaign_priority] += $priority; } } $total_priority = 0; if ($includeBlank) { $total_priority = $blank_priority <= 1e-15 ? 0 : $blank_priority; } ksort($total_priority_cp); foreach($total_priority_cp as $campaign_priority => $priority) { $total_priority += $priority; if ($total_priority) { $totals[$campaign_priority] = $priority / $total_priority; } else { $totals[$campaign_priority] = 0; } } return $totals; } function MAX_Dal_Delivery_Include() { static $included; if (isset($included)) { return; } $included = true; $conf = $GLOBALS['_MAX']['CONF']; if (isset($conf['origin']['type']) && is_readable(MAX_PATH . '/lib/OA/Dal/Delivery/' . strtolower($conf['origin']['type']) . '.php')) { require(MAX_PATH . '/lib/OA/Dal/Delivery/' . strtolower($conf['origin']['type']) . '.php'); } else { require(MAX_PATH . '/lib/OA/Dal/Delivery/' . strtolower($conf['database']['type']) . '.php'); } } function MAX_trackerbuildJSVariablesScript($trackerid, $conversionInfo, $trackerJsCode = null) { $conf = $GLOBALS['_MAX']['CONF']; $buffer = ''; $url = MAX_commonGetDeliveryUrl($conf['file']['conversionvars']); $tracker = MAX_cacheGetTracker($trackerid); $variables = MAX_cacheGetTrackerVariables($trackerid); $variableQuerystring = ''; if (empty($trackerJsCode)) { $trackerJsCode = md5(uniqid('', true)); } else { $tracker['variablemethod'] = 'default'; } if (!empty($variables)) { if ($tracker['variablemethod'] == 'dom') { $buffer .= " function MAX_extractTextDom(o) { var txt = ''; if (o.nodeType == 3) { txt = o.data; } else { for (var i = 0; i < o.childNodes.length; i++) { txt += MAX_extractTextDom(o.childNodes[i]); } } return txt; } function MAX_TrackVarDom(id, v) { if (max_trv[id][v]) { return; } var o = document.getElementById(v); if (o) { max_trv[id][v] = escape(o.tagName == 'INPUT' ? o.value : MAX_extractTextDom(o)); } }"; $funcName = 'MAX_TrackVarDom'; } elseif ($tracker['variablemethod'] == 'default') { $buffer .= " function MAX_TrackVarDefault(id, v) { if (max_trv[id][v]) { return; } if (typeof(window[v]) == undefined) { return; } max_trv[id][v] = window[v]; }"; $funcName = 'MAX_TrackVarDefault'; } else { $buffer .= " function MAX_TrackVarJs(id, v, c) { if (max_trv[id][v]) { return; } if (typeof(window[v]) == undefined) { return; } if (typeof(c) != 'undefined') { eval(c); } max_trv[id][v] = window[v]; }"; $funcName = 'MAX_TrackVarJs'; } $buffer .= " if (!max_trv) { var max_trv = new Array(); } if (!max_trv['{$trackerJsCode}']) { max_trv['{$trackerJsCode}'] = new Array(); }"; foreach($variables as $key => $variable) { $variableQuerystring .= "&{$variable['name']}=\"+max_trv['{$trackerJsCode}']['{$variable['name']}']+\""; if ($tracker['variablemethod'] == 'custom') { $buffer .= " {$funcName}('{$trackerJsCode}', '{$variable['name']}', '".addcslashes($variable['variablecode'], "'")."');"; } else { $buffer .= " {$funcName}('{$trackerJsCode}', '{$variable['name']}');"; } } if (!empty($variableQuerystring)) { $conversionInfoParams = array(); foreach ($conversionInfo as $plugin => $pluginData) { if (is_array($pluginData)) { foreach ($pluginData as $key => $value) { $conversionInfoParams[] = $key . '=' . urlencode($value); } } } $conversionInfoParams = '&' . implode('&', $conversionInfoParams); $buffer .= " document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\"); document.write (\"$url?trackerid=$trackerid{$conversionInfoParams}{$variableQuerystring}'\");"; $buffer .= "\n\tdocument.write (\"><\\/scr\"+\"ipt>\");"; } } if(!empty($tracker['appendcode'])) { $tracker['appendcode'] = preg_replace('/("\?trackerid=\d+&amp;inherit)=1/', '$1='.$trackerJsCode, $tracker['appendcode']); $jscode = MAX_javascriptToHTML($tracker['appendcode'], "MAX_{$trackerid}_appendcode"); $jscode = preg_replace("/\{m3_trackervariable:(.+?)\}/", "\"+max_trv['{$trackerJsCode}']['$1']+\"", $jscode); $buffer .= "\n".preg_replace('/^/m', "\t", $jscode)."\n"; } if (empty($buffer)) { $buffer = "document.write(\"\");"; } return $buffer; } function MAX_trackerCheckForValidAction($trackerid) { $aTrackerLinkedAds = MAX_cacheGetTrackerLinkedCreatives($trackerid); if (empty($aTrackerLinkedAds)) { return false; } $aPossibleActions = _getActionTypes(); $now = MAX_commonGetTimeNow(); $aConf = $GLOBALS['_MAX']['CONF']; $aMatchingActions = array(); foreach ($aTrackerLinkedAds as $creativeId => $aLinkedInfo) { foreach ($aPossibleActions as $actionId => $action) { if (!empty($aLinkedInfo[$action . '_window']) && !empty($_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId])) { if (stristr($_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId], ' ')) { list($value, $extra) = explode(' ', $_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId], 2); $_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId] = $value; } else { $extra = ''; } list($lastAction, $zoneId) = explode('-', $_COOKIE[$aConf['var']['last' . ucfirst($action)]][$creativeId]); $lastAction = MAX_commonUnCompressInt($lastAction); $lastSeenSecondsAgo = $now - $lastAction; if ($lastSeenSecondsAgo <= $aLinkedInfo[$action . '_window'] && $lastSeenSecondsAgo > 0) { $aMatchingActions[$lastSeenSecondsAgo] = array( 'action_type' => $actionId, 'tracker_type' => $aLinkedInfo['tracker_type'], 'status' => $aLinkedInfo['status'], 'cid' => $creativeId, 'zid' => $zoneId, 'dt' => $lastAction, 'window' => $aLinkedInfo[$action . '_window'], 'extra' => $extra, ); } } } } if (empty($aMatchingActions)) { return false; } ksort($aMatchingActions); return array_shift($aMatchingActions); } function _getActionTypes() { return array(0 => 'view', 1 => 'click'); } function _getTrackerTypes() { return array(1 => 'sale', 2 => 'lead', 3 => 'signup'); } function MAX_Delivery_log_logAdRequest($adId, $zoneId, $aAd = array()) { if (empty($GLOBALS['_MAX']['CONF']['logging']['adRequests'])) { return true; } OX_Delivery_Common_hook('logRequest', array($adId, $zoneId, $aAd, _viewersHostOkayToLog($adId, $zoneId))); } function MAX_Delivery_log_logAdImpression($adId, $zoneId) { if (empty($GLOBALS['_MAX']['CONF']['logging']['adImpressions'])) { return true; } OX_Delivery_Common_hook('logImpression', array($adId, $zoneId, _viewersHostOkayToLog($adId, $zoneId))); } function MAX_Delivery_log_logAdClick($adId, $zoneId) { if (empty($GLOBALS['_MAX']['CONF']['logging']['adClicks'])) { return true; } OX_Delivery_Common_hook('logClick', array($adId, $zoneId, _viewersHostOkayToLog($adId, $zoneId))); } function MAX_Delivery_log_logConversion($trackerId, $aConversion) { if (empty($GLOBALS['_MAX']['CONF']['logging']['trackerImpressions'])) { return true; } $aConf = $GLOBALS['_MAX']['CONF']; if (!empty($aConf['lb']['enabled'])) { $aConf['rawDatabase']['host'] = $_SERVER['SERVER_ADDR']; } else { $aConf['rawDatabase']['host'] = 'singleDB'; } if (isset($aConf['rawDatabase']['serverRawIp'])) { $serverRawIp = $aConf['rawDatabase']['serverRawIp']; } else { $serverRawIp = $aConf['rawDatabase']['host']; } $aConversionInfo = OX_Delivery_Common_hook('logConversion', array($trackerId, $serverRawIp, $aConversion, _viewersHostOkayToLog(null, null, $trackerId))); if (is_array($aConversionInfo)) { return $aConversionInfo; } return false; } function MAX_Delivery_log_logVariableValues($aVariables, $trackerId, $serverConvId, $serverRawIp) { $aConf = $GLOBALS['_MAX']['CONF']; foreach ($aVariables as $aVariable) { if (isset($_GET[$aVariable['name']])) { $value = $_GET[$aVariable['name']]; if (!strlen($value) || $value == 'undefined') { unset($aVariables[$aVariable['variable_id']]); continue; } switch ($aVariable['type']) { case 'int': case 'numeric': $value = preg_replace('/[^0-9.]/', '', $value); $value = floatval($value); break; case 'date': if (!empty($value)) { $value = date('Y-m-d H:i:s', strtotime($value)); } else { $value = ''; } break; } } else { unset($aVariables[$aVariable['variable_id']]); continue; } $aVariables[$aVariable['variable_id']]['value'] = $value; } if (count($aVariables)) { OX_Delivery_Common_hook('logConversionVariable', array($aVariables, $trackerId, $serverConvId, $serverRawIp, _viewersHostOkayToLog(null, null, $trackerId))); } } function _viewersHostOkayToLog($adId=0, $zoneId=0, $trackerId=0) { $aConf = $GLOBALS['_MAX']['CONF']; $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $okToLog = true; if (!empty($aConf['logging']['enforceUserAgents'])) { $aKnownBrowsers = explode('|', strtolower($aConf['logging']['enforceUserAgents'])); $allowed = false; foreach ($aKnownBrowsers as $browser) { if (strpos($agent, $browser) !== false) { $allowed = true; break; } } OX_Delivery_logMessage('user-agent browser : '.$agent.' is '.($allowed ? '' : 'not ').'allowed', 7); if (!$allowed) { $GLOBALS['_MAX']['EVENT_FILTER_FLAGS'][] = 'enforceUserAgents'; $okToLog = false; } } if (!empty($aConf['logging']['ignoreUserAgents'])) { $aKnownBots = explode('|', strtolower($aConf['logging']['ignoreUserAgents'])); foreach ($aKnownBots as $bot) { if (strpos($agent, $bot) !== false) { OX_Delivery_logMessage('user-agent '.$agent.' is a known bot '.$bot, 7); $GLOBALS['_MAX']['EVENT_FILTER_FLAGS'][] = 'ignoreUserAgents'; $okToLog = false; } } } if (!empty($aConf['logging']['ignoreHosts'])) { $hosts = str_replace(',', '|', $aConf['logging']['ignoreHosts']); $hosts = '#^('.$hosts.')$#i'; $hosts = str_replace('.', '\.', $hosts); $hosts = str_replace('*', '[^.]+', $hosts); if (preg_match($hosts, $_SERVER['REMOTE_ADDR'])) { OX_Delivery_logMessage('viewer\'s ip is in the ignore list '.$_SERVER['REMOTE_ADDR'], 7); $GLOBALS['_MAX']['EVENT_FILTER_FLAGS'][] = 'ignoreHosts_ip'; $okToLog = false; } if (preg_match($hosts, $_SERVER['REMOTE_HOST'])) { OX_Delivery_logMessage('viewer\'s host is in the ignore list '.$_SERVER['REMOTE_HOST'], 7); $GLOBALS['_MAX']['EVENT_FILTER_FLAGS'][] = 'ignoreHosts_host'; $okToLog = false; } } if ($okToLog) OX_Delivery_logMessage('viewer\'s host is OK to log', 7); $result = OX_Delivery_Common_Hook('filterEvent', array($adId, $zoneId, $trackerId)); if (!empty($result) && is_array($result)) { foreach ($result as $pci => $value) { if ($value == true) { $GLOBALS['_MAX']['EVENT_FILTER_FLAGS'][] = $pci; $okToLog = false; } } } return $okToLog; } function MAX_Delivery_log_getArrGetVariable($name) { $varName = $GLOBALS['_MAX']['CONF']['var'][$name]; return isset($_GET[$varName]) ? explode($GLOBALS['_MAX']['MAX_DELIVERY_MULTIPLE_DELIMITER'], $_GET[$varName]) : array(); } function MAX_Delivery_log_ensureIntegerSet(&$aArray, $index) { if (!is_array($aArray)) { $aArray = array(); } if (empty($aArray[$index])) { $aArray[$index] = 0; } else { if (!is_integer($aArray[$index])) { $aArray[$index] = intval($aArray[$index]); } } } function MAX_Delivery_log_setAdLimitations($index, $aAds, $aCaps) { _setLimitations('Ad', $index, $aAds, $aCaps); } function MAX_Delivery_log_setCampaignLimitations($index, $aCampaigns, $aCaps) { _setLimitations('Campaign', $index, $aCampaigns, $aCaps); } function MAX_Delivery_log_setZoneLimitations($index, $aZones, $aCaps) { _setLimitations('Zone', $index, $aZones, $aCaps); } function MAX_Delivery_log_setLastAction($index, $aAdIds, $aZoneIds, $aSetLastSeen, $action = 'view') { $aConf = $GLOBALS['_MAX']['CONF']; if (!empty($aSetLastSeen[$index])) { $cookieData = MAX_commonCompressInt(MAX_commonGetTimeNow()) . "-" . $aZoneIds[$index]; $conversionParams = OX_Delivery_Common_hook('addConversionParams', array(&$index, &$aAdIds, &$aZoneIds, &$aSetLastSeen, &$action, &$cookieData)); if (!empty($conversionParams) && is_array($conversionParams)) { foreach ($conversionParams as $params) { if (!empty($params) && is_array($params)) { foreach ($params as $key => $value) { $cookieData .= " {$value}"; } } } } MAX_cookieAdd("_{$aConf['var']['last' . ucfirst($action)]}[{$aAdIds[$index]}]", $cookieData, _getTimeThirtyDaysFromNow()); } } function MAX_Delivery_log_setClickBlocked($index, $aAdIds) { $aConf = $GLOBALS['_MAX']['CONF']; MAX_cookieAdd("_{$aConf['var']['blockLoggingClick']}[{$aAdIds[$index]}]", MAX_commonCompressInt(MAX_commonGetTimeNow()), _getTimeThirtyDaysFromNow()); } function MAX_Delivery_log_isClickBlocked($adId, $aBlockLoggingClick) { if (isset($GLOBALS['conf']['logging']['blockAdClicksWindow']) && $GLOBALS['conf']['logging']['blockAdClicksWindow'] != 0) { if (isset($aBlockLoggingClick[$adId])) { $endBlock = MAX_commonUnCompressInt($aBlockLoggingClick[$adId]) + $GLOBALS['conf']['logging']['blockAdClicksWindow']; if ($endBlock >= MAX_commonGetTimeNow()) { OX_Delivery_logMessage('adID '.$adId.' click is still blocked by block logging window ', 7); return true; } } } return false; } function _setLimitations($type, $index, $aItems, $aCaps) { MAX_Delivery_log_ensureIntegerSet($aCaps['block'], $index); MAX_Delivery_log_ensureIntegerSet($aCaps['capping'], $index); MAX_Delivery_log_ensureIntegerSet($aCaps['session_capping'], $index); MAX_Delivery_cookie_setCapping( $type, $aItems[$index], $aCaps['block'][$index], $aCaps['capping'][$index], $aCaps['session_capping'][$index] ); } function MAX_commonGetDeliveryUrl($file = null) { $conf = $GLOBALS['_MAX']['CONF']; if ($GLOBALS['_MAX']['SSL_REQUEST']) { $url = MAX_commonConstructSecureDeliveryUrl($file); } else { $url = MAX_commonConstructDeliveryUrl($file); } return $url; } function MAX_commonConstructDeliveryUrl($file) { $conf = $GLOBALS['_MAX']['CONF']; return 'http://' . $conf['webpath']['delivery'] . '/' . $file; } function MAX_commonConstructSecureDeliveryUrl($file) { $conf = $GLOBALS['_MAX']['CONF']; if ($conf['openads']['sslPort'] != 443) { $path = preg_replace('#/#', ':' . $conf['openads']['sslPort'] . '/', $conf['webpath']['deliverySSL'], 1); } else { $path = $conf['webpath']['deliverySSL']; } return 'https://' . $path . '/' . $file; } function MAX_commonConstructPartialDeliveryUrl($file, $ssl = false) { $conf = $GLOBALS['_MAX']['CONF']; if ($ssl) { return '//' . $conf['webpath']['deliverySSL'] . '/' . $file; } else { return '//' . $conf['webpath']['delivery'] . '/' . $file; } } function MAX_commonRemoveSpecialChars(&$var) { static $magicQuotes; if (!isset($magicQuotes)) { $magicQuotes = get_magic_quotes_gpc(); } if (isset($var)) { if (!is_array($var)) { if ($magicQuotes) { $var = stripslashes($var); } $var = strip_tags($var); $var = str_replace(array("\n", "\r"), array('', ''), $var); $var = trim($var); } else { array_walk($var, 'MAX_commonRemoveSpecialChars'); } } } function MAX_commonConvertEncoding($content, $toEncoding, $fromEncoding = 'UTF-8', $aExtensions = null) { if (($toEncoding == $fromEncoding) || empty($toEncoding)) { return $content; } if (!isset($aExtensions) || !is_array($aExtensions)) { $aExtensions = array('iconv', 'mbstring', 'xml'); } if (is_array($content)) { foreach ($content as $key => $value) { $content[$key] = MAX_commonConvertEncoding($value, $toEncoding, $fromEncoding, $aExtensions); } return $content; } else { $toEncoding = strtoupper($toEncoding); $fromEncoding = strtoupper($fromEncoding); $aMap = array(); $aMap['mbstring']['WINDOWS-1255'] = 'ISO-8859-8'; $aMap['xml']['ISO-8859-15'] = 'ISO-8859-1'; $converted = false; foreach ($aExtensions as $extension) { $mappedFromEncoding = isset($aMap[$extension][$fromEncoding]) ? $aMap[$extension][$fromEncoding] : $fromEncoding; $mappedToEncoding = isset($aMap[$extension][$toEncoding]) ? $aMap[$extension][$toEncoding] : $toEncoding; switch ($extension) { case 'iconv': if (function_exists('iconv')) { $converted = @iconv($mappedFromEncoding, $mappedToEncoding, $content); } break; case 'mbstring': if (function_exists('mb_convert_encoding')) { $converted = @mb_convert_encoding($content, $mappedToEncoding, $mappedFromEncoding); } break; case 'xml': if (function_exists('utf8_encode')) { if ($mappedToEncoding == 'UTF-8' && $mappedFromEncoding == 'ISO-8859-1') { $converted = utf8_encode($content); } elseif ($mappedToEncoding == 'ISO-8859-1' && $mappedFromEncoding == 'UTF-8') { $converted = utf8_decode($content); } } break; } } return $converted ? $converted : $content; } } function MAX_commonSendContentTypeHeader($type = 'text/html', $charset = null) { $header = 'Content-type: ' . $type; if (!empty($charset) && preg_match('/^[a-zA-Z0-9_-]+$/D', $charset)) { $header .= '; charset=' . $charset; } MAX_header($header); } function MAX_commonSetNoCacheHeaders() { MAX_header('Pragma: no-cache'); MAX_header('Cache-Control: private, max-age=0, no-cache'); MAX_header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); } function MAX_commonAddslashesRecursive($a) { if (is_array($a)) { reset($a); while (list($k,$v) = each($a)) { $a[$k] = MAX_commonAddslashesRecursive($v); } reset ($a); return ($a); } else { return is_null($a) ? null : addslashes($a); } } function MAX_commonRegisterGlobalsArray($args = array()) { static $magic_quotes_gpc; if (!isset($magic_quotes_gpc)) { $magic_quotes_gpc = ini_get('magic_quotes_gpc'); } $found = false; foreach($args as $key) { if (isset($_GET[$key])) { $value = $_GET[$key]; $found = true; } if (isset($_POST[$key])) { $value = $_POST[$key]; $found = true; } if ($found) { if (!$magic_quotes_gpc) { if (!is_array($value)) { $value = addslashes($value); } else { $value = MAX_commonAddslashesRecursive($value); } } $GLOBALS[$key] = $value; $found = false; } } } function MAX_commonDeriveSource($source) { return MAX_commonEncrypt(trim(urldecode($source))); } function MAX_commonEncrypt($string) { $convert = ''; if (isset($string) && substr($string,1,4) != 'obfs' && $GLOBALS['_MAX']['CONF']['delivery']['obfuscate']) { $strLen = strlen($string); for ($i=0; $i < $strLen; $i++) { $dec = ord(substr($string,$i,1)); if (strlen($dec) == 2) { $dec = 0 . $dec; } $dec = 324 - $dec; $convert .= $dec; } $convert = '{obfs:' . $convert . '}'; return ($convert); } else { return $string; } } function MAX_commonDecrypt($string) { $conf = $GLOBALS['_MAX']['CONF']; $convert = ''; if (isset($string) && substr($string,1,4) == 'obfs' && $conf['delivery']['obfuscate']) { $strLen = strlen($string); for ($i=6; $i < $strLen-1; $i = $i+3) { $dec = substr($string,$i,3); $dec = 324 - $dec; $dec = chr($dec); $convert .= $dec; } return ($convert); } else { return($string); } } function MAX_commonInitVariables() { MAX_commonRegisterGlobalsArray(array('context', 'source', 'target', 'withText', 'withtext', 'ct0', 'what', 'loc', 'referer', 'zoneid', 'campaignid', 'bannerid', 'clientid', 'charset')); global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset; if (isset($withText) && !isset($withtext)) $withtext = $withText; $withtext = (isset($withtext) && is_numeric($withtext) ? $withtext : 0 ); $ct0 = (isset($ct0) ? $ct0 : '' ); $context = (isset($context) ? $context : array() ); $target = (isset($target) && (!empty($target)) && (!strpos($target , chr(32))) ? $target : '' ); $charset = (isset($charset) && (!empty($charset)) && (!strpos($charset, chr(32))) ? $charset : 'UTF-8' ); $bannerid = (isset($bannerid) && is_numeric($bannerid) ? $bannerid : '' ); $campaignid = (isset($campaignid) && is_numeric($campaignid) ? $campaignid : '' ); $clientid = (isset($clientid) && is_numeric($clientid) ? $clientid : '' ); $zoneid = (isset($zoneid) && is_numeric($zoneid) ? $zoneid : '' ); if (!isset($what)) { if (!empty($bannerid)) { $what = 'bannerid:'.$bannerid; } elseif (!empty($campaignid)) { $what = 'campaignid:'.$campaignid; } elseif (!empty($zoneid)) { $what = 'zone:'.$zoneid; } else { $what = ''; } } elseif (preg_match('/^([a-z]+):(\d+)$/', $what, $matches)) { switch ($matches[1]) { case 'zoneid': case 'zone': $zoneid = $matches[2]; break; case 'bannerid': $bannerid = $matches[2]; break; case 'campaignid': $campaignid = $matches[2]; break; case 'clientid': $clientid = $matches[2]; break; } } if (!isset($clientid)) $clientid = ''; if (empty($campaignid)) $campaignid = $clientid; $source = MAX_commonDeriveSource($source); if (!empty($loc)) { $loc = stripslashes($loc); } elseif (!empty($_SERVER['HTTP_REFERER'])) { $loc = $_SERVER['HTTP_REFERER']; } else { $loc = ''; } if (!empty($referer)) { $_SERVER['HTTP_REFERER'] = stripslashes($referer); } else { if (isset($_SERVER['HTTP_REFERER'])) unset($_SERVER['HTTP_REFERER']); } $GLOBALS['_MAX']['COOKIE']['LIMITATIONS']['arrCappingCookieNames'] = array( $GLOBALS['_MAX']['CONF']['var']['blockAd'], $GLOBALS['_MAX']['CONF']['var']['capAd'], $GLOBALS['_MAX']['CONF']['var']['sessionCapAd'], $GLOBALS['_MAX']['CONF']['var']['blockCampaign'], $GLOBALS['_MAX']['CONF']['var']['capCampaign'], $GLOBALS['_MAX']['CONF']['var']['sessionCapCampaign'], $GLOBALS['_MAX']['CONF']['var']['blockZone'], $GLOBALS['_MAX']['CONF']['var']['capZone'], $GLOBALS['_MAX']['CONF']['var']['sessionCapZone'], $GLOBALS['_MAX']['CONF']['var']['lastClick'], $GLOBALS['_MAX']['CONF']['var']['lastView'], $GLOBALS['_MAX']['CONF']['var']['blockLoggingClick'], ); if (strtolower($charset) == 'unicode') { $charset = 'utf-8'; } } function MAX_commonDisplay1x1() { MAX_header('Content-Type: image/gif'); MAX_header('Content-Length: 43'); echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=='); } function MAX_commonGetTimeNow() { if (!isset($GLOBALS['_MAX']['NOW'])) { $GLOBALS['_MAX']['NOW'] = time(); } return $GLOBALS['_MAX']['NOW']; } function MAX_getRandomNumber($length = 10) { return substr(md5(uniqid(time(), true)), 0, $length); } function MAX_header($value) { header($value); } function MAX_redirect($url) { if (!preg_match('/^(?:javascript|data):/i', $url)) { header('Location: '.$url); MAX_sendStatusCode(302); } } function MAX_sendStatusCode($iStatusCode) { $aConf = $GLOBALS['_MAX']['CONF']; $arr = array( 100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => '[Unused]', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported' ); if (isset($arr[$iStatusCode])) { $text = $iStatusCode . ' ' . $arr[$iStatusCode]; if (!empty($aConf['delivery']['cgiForceStatusHeader']) && strpos(php_sapi_name(), 'cgi') !== 0) { MAX_header('Status: ' . $text); } else { MAX_header($_SERVER["SERVER_PROTOCOL"] .' ' . $text); } } } function MAX_commonPackContext($context = array()) { $include = array(); $exclude = array(); foreach ($context as $idx => $value) { reset($value); list($key, $value) = each($value); list($item,$id) = explode(':', $value); switch ($item) { case 'campaignid': $value = 'c:' . $id; break; case 'clientid': $value = 'a:' . $id; break; case 'bannerid': $value = 'b:' . $id; break; case 'companionid': $value = 'p:' . $id; break; } switch ($key) { case '!=': $exclude[$value] = true; break; case '==': $include[$value] = true; break; } } $exclude = array_keys($exclude); $include = array_keys($include); return base64_encode(implode('#', $exclude) . '|' . implode('#', $include)); } function MAX_commonUnpackContext($context = '') { list($exclude,$include) = explode('|', base64_decode($context)); return array_merge(_convertContextArray('!=', explode('#', $exclude)), _convertContextArray('==', explode('#', $include))); } function MAX_commonCompressInt($int) { return base_convert($int, 10, 36); } function MAX_commonUnCompressInt($string) { return base_convert($string, 36, 10); } function _convertContextArray($key, $array) { $unpacked = array(); foreach ($array as $value) { if (empty($value)) { continue; } list($item, $id) = explode(':', $value); switch ($item) { case 'c': $unpacked[] = array($key => 'campaignid:' . $id); break; case 'a': $unpacked[] = array($key => 'clientid:' . $id); break; case 'b': $unpacked[] = array($key => 'bannerid:' . $id); break; case 'p': $unpacked[] = array($key => 'companionid:'.$id); break; } } return $unpacked; } function OX_Delivery_Common_hook($hookName, $aParams = array(), $functionName = '') { $return = null; if (!empty($functionName)) { $aParts = explode(':', $functionName); if (count($aParts) === 3) { $functionName = OX_Delivery_Common_getFunctionFromComponentIdentifier($functionName, $hookName); } if (function_exists($functionName)) { $return = call_user_func_array($functionName, $aParams); } } else { if (!empty($GLOBALS['_MAX']['CONF']['deliveryHooks'][$hookName])) { $return = array(); $hooks = explode('|', $GLOBALS['_MAX']['CONF']['deliveryHooks'][$hookName]); foreach ($hooks as $identifier) { $functionName = OX_Delivery_Common_getFunctionFromComponentIdentifier($identifier, $hookName); if (function_exists($functionName)) { OX_Delivery_logMessage('calling on '.$functionName, 7); $return[$identifier] = call_user_func_array($functionName, $aParams); } } } } return $return; } function OX_Delivery_Common_getFunctionFromComponentIdentifier($identifier, $hook = null) { $aInfo = explode(':', $identifier); $functionName = 'Plugin_' . implode('_', $aInfo) . '_Delivery' . (!empty($hook) ? '_' . $hook : ''); if (!function_exists($functionName)) { if (!empty($GLOBALS['_MAX']['CONF']['pluginSettings']['useMergedFunctions'])) _includeDeliveryPluginFile('/var/cache/' . OX_getHostName() . '_mergedDeliveryFunctions.php'); if (!function_exists($functionName)) { _includeDeliveryPluginFile($GLOBALS['_MAX']['CONF']['pluginPaths']['plugins'] . '/' . implode('/', $aInfo) . '.delivery.php'); if (!function_exists($functionName)) { _includeDeliveryPluginFile('/lib/OX/Extension/' . $aInfo[0] . '/' . $aInfo[0] . 'Delivery.php'); $functionName = 'Plugin_' . $aInfo[0] . '_delivery'; if (!empty($hook) && function_exists($functionName . '_' . $hook)) { $functionName .= '_' . $hook; } } } } return $functionName; } function _includeDeliveryPluginFile($fileName) { if (!in_array($fileName, array_keys($GLOBALS['_MAX']['FILES']))) { $GLOBALS['_MAX']['FILES'][$fileName] = true; if (file_exists(MAX_PATH . $fileName)) { include MAX_PATH . $fileName; } } } function OX_Delivery_logMessage($message, $priority = 6) { $conf = $GLOBALS['_MAX']['CONF']; if (empty($conf['deliveryLog']['enabled'])) return true; $priorityLevel = is_numeric($conf['deliveryLog']['priority']) ? $conf['deliveryLog']['priority'] : 6; if ($priority > $priorityLevel && empty($_REQUEST[$conf['var']['trace']])) { return true; } error_log('[' . date('r') . "] {$conf['log']['ident']}-delivery-{$GLOBALS['_MAX']['thread_id']}: {$message}\n", 3, MAX_PATH . '/var/' . $conf['deliveryLog']['name']); OX_Delivery_Common_hook('logMessage', array($message, $priority)); return true; } $file = '/lib/max/Delivery/cache.php'; $GLOBALS['_MAX']['FILES'][$file] = true; define ('OA_DELIVERY_CACHE_FUNCTION_ERROR', 'Function call returned an error'); $GLOBALS['OA_Delivery_Cache'] = array( 'prefix' => 'deliverycache_', 'host' => OX_getHostName(), 'expiry' => $GLOBALS['_MAX']['CONF']['delivery']['cacheExpire'] ); function OA_Delivery_Cache_fetch($name, $isHash = false, $expiryTime = null) { $filename = OA_Delivery_Cache_buildFileName($name, $isHash); $aCacheVar = OX_Delivery_Common_hook( 'cacheRetrieve', array($filename), $GLOBALS['_MAX']['CONF']['delivery']['cacheStorePlugin'] ); if ($aCacheVar !== false) { if ($aCacheVar['cache_name'] != $name) { OX_Delivery_logMessage("Cache ERROR: {$name} != {$aCacheVar['cache_name']}", 7); return false; } if ($expiryTime === null) { $expiryTime = $GLOBALS['OA_Delivery_Cache']['expiry']; } $now = MAX_commonGetTimeNow(); if ( (isset($aCacheVar['cache_time']) && $aCacheVar['cache_time'] + $expiryTime < $now) || (isset($aCacheVar['cache_expire']) && $aCacheVar['cache_expire'] < $now) ) { OA_Delivery_Cache_store($name, $aCacheVar['cache_contents'], $isHash); OX_Delivery_logMessage("Cache EXPIRED: {$name}", 7); return false; } OX_Delivery_logMessage("Cache HIT: {$name}", 7); return $aCacheVar['cache_contents']; } OX_Delivery_logMessage("Cache MISS {$name}", 7); return false; } function OA_Delivery_Cache_store($name, $cache, $isHash = false, $expireAt = null) { if ($cache === OA_DELIVERY_CACHE_FUNCTION_ERROR) { return false; } $filename = OA_Delivery_Cache_buildFileName($name, $isHash); $aCacheVar = array(); $aCacheVar['cache_contents'] = $cache; $aCacheVar['cache_name'] = $name; $aCacheVar['cache_time'] = MAX_commonGetTimeNow(); $aCacheVar['cache_expire'] = $expireAt; return OX_Delivery_Common_hook( 'cacheStore', array($filename, $aCacheVar), $GLOBALS['_MAX']['CONF']['delivery']['cacheStorePlugin'] ); } function OA_Delivery_Cache_store_return($name, $cache, $isHash = false, $expireAt = null) { OX_Delivery_Common_hook( 'preCacheStore_'.OA_Delivery_Cache_getHookName($name), array($name, &$cache) ); if (OA_Delivery_Cache_store($name, $cache, $isHash, $expireAt)) { return $cache; } $currentCache = OA_Delivery_Cache_fetch($name, $isHash); if ($currentCache === false) { return $cache; } return $currentCache; } function OA_Delivery_Cache_getHookName($name) { $pos = strpos($name, '^'); return $pos ? substr($name, 0, $pos) : substr($name, 0, strpos($name, '@')); } function OA_Delivery_Cache_buildFileName($name, $isHash = false) { if(!$isHash) { $name = md5($name); } return $GLOBALS['OA_Delivery_Cache']['prefix'].$name.'.php'; } function OA_Delivery_Cache_getName($functionName) { $args = func_get_args(); $args[0] = strtolower(str_replace('MAX_cacheGet', '', $args[0])); return join('^', $args).'@'.$GLOBALS['OA_Delivery_Cache']['host']; } function MAX_cacheGetAd($ad_id, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $ad_id); if (!$cached || ($aRows = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aRows = OA_Dal_Delivery_getAd($ad_id); $aRows = OA_Delivery_Cache_store_return($sName, $aRows); } return $aRows; } function MAX_cacheGetAccountTZs($cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__); if (!$cached || ($aResult = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aResult = OA_Dal_Delivery_getAccountTZs(); $aResult = OA_Delivery_Cache_store_return($sName, $aResult); } return $aResult; } function MAX_cacheGetZoneLinkedAds($zoneId, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $zoneId); if (!$cached || ($aRows = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aRows = OA_Dal_Delivery_getZoneLinkedAds($zoneId); $aRows = OA_Delivery_Cache_store_return($sName, $aRows); } return $aRows; } function MAX_cacheGetZoneLinkedAdInfos($zoneId, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $zoneId); if (!$cached || ($aRows = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aRows = OA_Dal_Delivery_getZoneLinkedAdInfos($zoneId); $aRows = OA_Delivery_Cache_store_return($sName, $aRows); } return $aRows; } function MAX_cacheGetZoneInfo($zoneId, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $zoneId); if (!$cached || ($aRows = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aRows = OA_Dal_Delivery_getZoneInfo($zoneId); $aRows = OA_Delivery_Cache_store_return($sName, $aRows); } return $aRows; } function MAX_cacheGetLinkedAds($search, $campaignid, $laspart, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $search, $campaignid, $laspart); if (!$cached || ($aAds = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aAds = OA_Dal_Delivery_getLinkedAds($search, $campaignid, $laspart); $aAds = OA_Delivery_Cache_store_return($sName, $aAds); } return $aAds; } function MAX_cacheGetLinkedAdInfos($search, $campaignid, $laspart, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $search, $campaignid, $laspart); if (!$cached || ($aAds = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aAds = OA_Dal_Delivery_getLinkedAdInfos($search, $campaignid, $laspart); $aAds = OA_Delivery_Cache_store_return($sName, $aAds); } return $aAds; } function MAX_cacheGetCreative($filename, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $filename); if (!$cached || ($aCreative = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aCreative = OA_Dal_Delivery_getCreative($filename); $aCreative['contents'] = addslashes(serialize($aCreative['contents'])); $aCreative = OA_Delivery_Cache_store_return($sName, $aCreative); } $aCreative['contents'] = unserialize(stripslashes($aCreative['contents'])); return $aCreative; } function MAX_cacheGetTracker($trackerid, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $trackerid); if (!$cached || ($aTracker = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aTracker = OA_Dal_Delivery_getTracker($trackerid); $aTracker = OA_Delivery_Cache_store_return($sName, $aTracker); } return $aTracker; } function MAX_cacheGetTrackerLinkedCreatives($trackerid = null, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $trackerid); if (!$cached || ($aTracker = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aTracker = OA_Dal_Delivery_getTrackerLinkedCreatives($trackerid); $aTracker = OA_Delivery_Cache_store_return($sName, $aTracker); } return $aTracker; } function MAX_cacheGetTrackerVariables($trackerid, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $trackerid); if (!$cached || ($aVariables = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $aVariables = OA_Dal_Delivery_getTrackerVariables($trackerid); $aVariables = OA_Delivery_Cache_store_return($sName, $aVariables); } return $aVariables; } function MAX_cacheCheckIfMaintenanceShouldRun($cached = true) { $interval = $GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] * 60; $delay = intval(($GLOBALS['_MAX']['CONF']['maintenance']['operationInterval'] / 12) * 60); $now = MAX_commonGetTimeNow(); $today = strtotime(date('Y-m-d'), $now); $nextRunTime = $today + (floor(($now - $today) / $interval) + 1) * $interval + $delay; if ($nextRunTime - $now > $interval) { $nextRunTime -= $interval; } $cName = OA_Delivery_Cache_getName(__FUNCTION__); if (!$cached || ($lastRunTime = OA_Delivery_Cache_fetch($cName)) === false) { MAX_Dal_Delivery_Include(); $lastRunTime = OA_Dal_Delivery_getMaintenanceInfo(); if ($lastRunTime >= $nextRunTime - $delay) { $nextRunTime += $interval; } OA_Delivery_Cache_store($cName, $lastRunTime, false, $nextRunTime); } return $lastRunTime < $nextRunTime - $interval; } function MAX_cacheGetChannelLimitations($channelid, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $channelid); if (!$cached || ($limitations = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $limitations = OA_Dal_Delivery_getChannelLimitations($channelid); $limitations = OA_Delivery_Cache_store_return($sName, $limitations); } return $limitations; } function MAX_cacheGetGoogleJavaScript($cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__); if (!$cached || ($output = OA_Delivery_Cache_fetch($sName)) === false) { $file = '/lib/max/Delivery/google.php'; if(!isset($GLOBALS['_MAX']['FILES'][$file])) { include MAX_PATH . $file; } $output = MAX_googleGetJavaScript(); $output = OA_Delivery_Cache_store_return($sName, $output); } return $output; } function OA_cacheGetPublisherZones($affiliateid, $cached = true) { $sName = OA_Delivery_Cache_getName(__FUNCTION__, $affiliateid); if (!$cached || ($output = OA_Delivery_Cache_fetch($sName)) === false) { MAX_Dal_Delivery_Include(); $output = OA_Dal_Delivery_getPublisherZones($affiliateid); $output = OA_Delivery_Cache_store_return($sName, $output); } return $output; } OX_Delivery_logMessage('starting delivery script: ' . basename($_SERVER['REQUEST_URI']), 7); if (!empty($_REQUEST[$conf['var']['trace']])) { OX_Delivery_logMessage('trace enabled: ' . $_REQUEST[$conf['var']['trace']], 7); } MAX_remotehostSetInfo(); MAX_commonInitVariables(); MAX_cookieLoad(); MAX_cookieUnpackCapping(); if (empty($GLOBALS['_OA']['invocationType']) || $GLOBALS['_OA']['invocationType'] != 'xmlrpc') { OX_Delivery_Common_hook('postInit'); } function MAX_querystringConvertParams() { $conf = $GLOBALS['_MAX']['CONF']; $qs = $_SERVER['QUERY_STRING']; $dest = false; $destStr = $conf['var']['dest'] . '='; $pos = strpos($qs, $destStr); if ($pos === false) { $destStr = 'dest='; $pos = strpos($qs, $destStr); } if ($pos !== false) { $dest = urldecode(substr($qs, $pos + strlen($destStr))); $qs = substr($qs, 0, $pos); } $aGet = array(); $paramStr = $conf['var']['params'] . '='; $paramPos = strpos($qs, $paramStr); if (is_numeric($paramPos)) { $qs = urldecode(substr($qs, $paramPos + strlen($paramStr))); $delim = $qs{0}; if (is_numeric($delim)) { $delim = substr($qs, 1, $delim); } $qs = substr($qs, strlen($delim) + 1); MAX_querystringParseStr($qs, $aGet, $delim); $qPos = isset($aGet[$conf['var']['dest']]) ? strpos($aGet[$conf['var']['dest']], '?') : false; $aPos = isset($aGet[$conf['var']['dest']]) ? strpos($aGet[$conf['var']['dest']], '&') : false; if ($aPos && !$qPos) { $desturl = substr($aGet[$conf['var']['dest']], 0, $aPos); $destparams = substr($aGet[$conf['var']['dest']], $aPos+1); $aGet[$conf['var']['dest']] = $desturl . '?' . $destparams; } } else { parse_str($qs, $aGet); } if ($dest !== false) { $aGet[$conf['var']['dest']] = $dest; } $n = isset($_GET[$conf['var']['n']]) ? $_GET[$conf['var']['n']] : ''; if (empty($n)) { $n = isset($aGet[$conf['var']['n']]) ? $aGet[$conf['var']['n']] : ''; } if (!empty($n) && !empty($_COOKIE[$conf['var']['vars']][$n])) { $aVars = unserialize(stripslashes($_COOKIE[$conf['var']['vars']][$n])); foreach ($aVars as $name => $value) { if (!isset($_GET[$name])) { $aGet[$name] = $value; } } } $_GET = $aGet; $_REQUEST = $_GET + $_POST + $_COOKIE; } function MAX_querystringGetDestinationUrl($adId = null) { $conf = $GLOBALS['_MAX']['CONF']; $dest = isset($_REQUEST[$conf['var']['dest']]) ? $_REQUEST[$conf['var']['dest']] : ''; if (empty($dest) && !empty($adId)) { $aAd = MAX_cacheGetAd($adId); if (!empty($aAd)) { $dest = $aAd['url']; } } if (empty($dest)) { return; } $aVariables = array(); $aValidVariables = array_values($conf['var']); $componentParams = OX_Delivery_Common_hook('addUrlParams', array(array('bannerid' => $adId))); if (!empty($componentParams) && is_array($componentParams)) { foreach ($componentParams as $params) { if (!empty($params) && is_array($params)) { foreach ($params as $key => $value) { $aValidVariables[] = $key; } } } } $destParams = parse_url($dest); if (!empty($destParams['query'])) { $destQuery = explode('&', $destParams['query']); if (!empty($destQuery)) { foreach ($destQuery as $destPair) { list($destName, $destValue) = explode('=', $destPair); $aValidVariables[] = $destName; } } } foreach ($_GET as $name => $value) { if (!in_array($name, $aValidVariables)) { $aVariables[] = $name . '=' . $value; } } foreach ($_POST as $name => $value) { if (!in_array($name, $aValidVariables)) { $aVariables[] = $name . '=' . $value; } } if (!empty($aVariables)) { $dest .= ((strpos($dest, '?') > 0) ? '&' : '?') . implode('&', $aVariables); } return $dest; } function MAX_querystringParseStr($qs, &$aArr, $delim = '&') { $aArr = $_GET; $aElements = explode($delim, $qs); foreach($aElements as $element) { $len = strpos($element, '='); if ($len !== false) { $name = substr($element, 0, $len); $value = substr($element, $len+1); $aArr[$name] = urldecode($value); } } } MAX_commonSetNoCacheHeaders(); MAX_commonRemoveSpecialChars($_REQUEST); $viewerId = MAX_cookieGetUniqueViewerId(); MAX_cookieAdd($conf['var']['viewerId'], $viewerId, _getTimeYearFromNow()); $aAdIds = MAX_Delivery_log_getArrGetVariable('adId'); $aCampaignIds = MAX_Delivery_log_getArrGetVariable('campaignId'); $aCreativeIds = MAX_Delivery_log_getArrGetVariable('creativeId'); $aZoneIds = MAX_Delivery_log_getArrGetVariable('zoneId'); $aCapAd['block'] = MAX_Delivery_log_getArrGetVariable('blockAd'); $aCapAd['capping'] = MAX_Delivery_log_getArrGetVariable('capAd'); $aCapAd['session_capping'] = MAX_Delivery_log_getArrGetVariable('sessionCapAd'); $aCapCampaign['block'] = MAX_Delivery_log_getArrGetVariable('blockCampaign'); $aCapCampaign['capping'] = MAX_Delivery_log_getArrGetVariable('capCampaign'); $aCapCampaign['session_capping'] = MAX_Delivery_log_getArrGetVariable('sessionCapCampaign'); $aCapZone['block'] = MAX_Delivery_log_getArrGetVariable('blockZone'); $aCapZone['capping'] = MAX_Delivery_log_getArrGetVariable('capZone'); $aCapZone['session_capping'] = MAX_Delivery_log_getArrGetVariable('sessionCapZone'); $aSetLastSeen = MAX_Delivery_log_getArrGetVariable('lastView'); $countAdIds = count($aAdIds); for ($index = 0; $index < $countAdIds; $index++) { MAX_Delivery_log_ensureIntegerSet($aAdIds, $index); MAX_Delivery_log_ensureIntegerSet($aCampaignIds, $index); MAX_Delivery_log_ensureIntegerSet($aCreativeIds, $index); MAX_Delivery_log_ensureIntegerSet($aZoneIds, $index); if ($aAdIds[$index] >= -1) { $adId = $aAdIds[$index]; if ($GLOBALS['_MAX']['CONF']['logging']['adImpressions']) { MAX_Delivery_log_logAdImpression($adId, $aZoneIds[$index]); } if ($aAdIds[$index] == $adId) { MAX_Delivery_log_setAdLimitations($index, $aAdIds, $aCapAd); MAX_Delivery_log_setCampaignLimitations($index, $aCampaignIds, $aCapCampaign); MAX_Delivery_log_setLastAction($index, $aAdIds, $aZoneIds, $aSetLastSeen); if ($aZoneIds[$index] != 0) { MAX_Delivery_log_setZoneLimitations($index, $aZoneIds, $aCapZone); } } } } MAX_cookieFlush(); MAX_querystringConvertParams(); if (!empty($_REQUEST[$GLOBALS['_MAX']['CONF']['var']['dest']])) { MAX_redirect($_REQUEST[$GLOBALS['_MAX']['CONF']['var']['dest']]); } else { MAX_commonDisplay1x1(); } if (!empty($GLOBALS['_MAX']['CONF']['maintenance']['autoMaintenance']) && empty($GLOBALS['_MAX']['CONF']['lb']['enabled'])) { if (MAX_cacheCheckIfMaintenanceShouldRun()) { include MAX_PATH . '/lib/OA/Maintenance/Auto.php'; OA_Maintenance_Auto::run(); } } ?>
gpl-2.0
MoKee/android_kernel_sony_fuji-common
drivers/md/raid1.c
80085
/* * raid1.c : Multiple Devices driver for Linux * * Copyright (C) 1999, 2000, 2001 Ingo Molnar, Red Hat * * Copyright (C) 1996, 1997, 1998 Ingo Molnar, Miguel de Icaza, Gadi Oxman * * RAID-1 management functions. * * Better read-balancing code written by Mika Kuoppala <[email protected]>, 2000 * * Fixes to reconstruction by Jakob Østergaard" <[email protected]> * Various fixes by Neil Brown <[email protected]> * * Changes by Peter T. Breuer <[email protected]> 31/1/2003 to support * bitmapped intelligence in resync: * * - bitmap marked during normal i/o * - bitmap used to skip nondirty blocks during sync * * Additions to bitmap code, (C) 2003-2004 Paul Clements, SteelEye Technology: * - persistent bitmap code * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * You should have received a copy of the GNU General Public License * (for example /usr/src/linux/COPYING); if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/slab.h> #include <linux/delay.h> #include <linux/blkdev.h> #include <linux/module.h> #include <linux/seq_file.h> #include <linux/ratelimit.h> #include "md.h" #include "raid1.h" #include "bitmap.h" /* * Number of guaranteed r1bios in case of extreme VM load: */ #define NR_RAID1_BIOS 256 /* When there are this many requests queue to be written by * the raid1 thread, we become 'congested' to provide back-pressure * for writeback. */ static int max_queued_requests = 1024; static void allow_barrier(struct r1conf *conf); static void lower_barrier(struct r1conf *conf); static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data) { struct pool_info *pi = data; int size = offsetof(struct r1bio, bios[pi->raid_disks]); /* allocate a r1bio with room for raid_disks entries in the bios array */ return kzalloc(size, gfp_flags); } static void r1bio_pool_free(void *r1_bio, void *data) { kfree(r1_bio); } #define RESYNC_BLOCK_SIZE (64*1024) //#define RESYNC_BLOCK_SIZE PAGE_SIZE #define RESYNC_SECTORS (RESYNC_BLOCK_SIZE >> 9) #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) #define RESYNC_WINDOW (2048*1024) static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) { struct pool_info *pi = data; struct page *page; struct r1bio *r1_bio; struct bio *bio; int i, j; r1_bio = r1bio_pool_alloc(gfp_flags, pi); if (!r1_bio) return NULL; /* * Allocate bios : 1 for reading, n-1 for writing */ for (j = pi->raid_disks ; j-- ; ) { bio = bio_kmalloc(gfp_flags, RESYNC_PAGES); if (!bio) goto out_free_bio; r1_bio->bios[j] = bio; } /* * Allocate RESYNC_PAGES data pages and attach them to * the first bio. * If this is a user-requested check/repair, allocate * RESYNC_PAGES for each bio. */ if (test_bit(MD_RECOVERY_REQUESTED, &pi->mddev->recovery)) j = pi->raid_disks; else j = 1; while(j--) { bio = r1_bio->bios[j]; for (i = 0; i < RESYNC_PAGES; i++) { page = alloc_page(gfp_flags); if (unlikely(!page)) goto out_free_pages; bio->bi_io_vec[i].bv_page = page; bio->bi_vcnt = i+1; } } /* If not user-requests, copy the page pointers to all bios */ if (!test_bit(MD_RECOVERY_REQUESTED, &pi->mddev->recovery)) { for (i=0; i<RESYNC_PAGES ; i++) for (j=1; j<pi->raid_disks; j++) r1_bio->bios[j]->bi_io_vec[i].bv_page = r1_bio->bios[0]->bi_io_vec[i].bv_page; } r1_bio->master_bio = NULL; return r1_bio; out_free_pages: for (j=0 ; j < pi->raid_disks; j++) for (i=0; i < r1_bio->bios[j]->bi_vcnt ; i++) put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page); j = -1; out_free_bio: while (++j < pi->raid_disks) bio_put(r1_bio->bios[j]); r1bio_pool_free(r1_bio, data); return NULL; } static void r1buf_pool_free(void *__r1_bio, void *data) { struct pool_info *pi = data; int i,j; struct r1bio *r1bio = __r1_bio; for (i = 0; i < RESYNC_PAGES; i++) for (j = pi->raid_disks; j-- ;) { if (j == 0 || r1bio->bios[j]->bi_io_vec[i].bv_page != r1bio->bios[0]->bi_io_vec[i].bv_page) safe_put_page(r1bio->bios[j]->bi_io_vec[i].bv_page); } for (i=0 ; i < pi->raid_disks; i++) bio_put(r1bio->bios[i]); r1bio_pool_free(r1bio, data); } static void put_all_bios(struct r1conf *conf, struct r1bio *r1_bio) { int i; for (i = 0; i < conf->raid_disks * 2; i++) { struct bio **bio = r1_bio->bios + i; if (!BIO_SPECIAL(*bio)) bio_put(*bio); *bio = NULL; } } static void free_r1bio(struct r1bio *r1_bio) { struct r1conf *conf = r1_bio->mddev->private; put_all_bios(conf, r1_bio); mempool_free(r1_bio, conf->r1bio_pool); } static void put_buf(struct r1bio *r1_bio) { struct r1conf *conf = r1_bio->mddev->private; int i; for (i = 0; i < conf->raid_disks * 2; i++) { struct bio *bio = r1_bio->bios[i]; if (bio->bi_end_io) rdev_dec_pending(conf->mirrors[i].rdev, r1_bio->mddev); } mempool_free(r1_bio, conf->r1buf_pool); lower_barrier(conf); } static void reschedule_retry(struct r1bio *r1_bio) { unsigned long flags; struct mddev *mddev = r1_bio->mddev; struct r1conf *conf = mddev->private; spin_lock_irqsave(&conf->device_lock, flags); list_add(&r1_bio->retry_list, &conf->retry_list); conf->nr_queued ++; spin_unlock_irqrestore(&conf->device_lock, flags); wake_up(&conf->wait_barrier); md_wakeup_thread(mddev->thread); } /* * raid_end_bio_io() is called when we have finished servicing a mirrored * operation and are ready to return a success/failure code to the buffer * cache layer. */ static void call_bio_endio(struct r1bio *r1_bio) { struct bio *bio = r1_bio->master_bio; int done; struct r1conf *conf = r1_bio->mddev->private; if (bio->bi_phys_segments) { unsigned long flags; spin_lock_irqsave(&conf->device_lock, flags); bio->bi_phys_segments--; done = (bio->bi_phys_segments == 0); spin_unlock_irqrestore(&conf->device_lock, flags); } else done = 1; if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) clear_bit(BIO_UPTODATE, &bio->bi_flags); if (done) { bio_endio(bio, 0); /* * Wake up any possible resync thread that waits for the device * to go idle. */ allow_barrier(conf); } } static void raid_end_bio_io(struct r1bio *r1_bio) { struct bio *bio = r1_bio->master_bio; /* if nobody has done the final endio yet, do it now */ if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) { pr_debug("raid1: sync end %s on sectors %llu-%llu\n", (bio_data_dir(bio) == WRITE) ? "write" : "read", (unsigned long long) bio->bi_sector, (unsigned long long) bio->bi_sector + (bio->bi_size >> 9) - 1); call_bio_endio(r1_bio); } free_r1bio(r1_bio); } /* * Update disk head position estimator based on IRQ completion info. */ static inline void update_head_pos(int disk, struct r1bio *r1_bio) { struct r1conf *conf = r1_bio->mddev->private; conf->mirrors[disk].head_position = r1_bio->sector + (r1_bio->sectors); } /* * Find the disk number which triggered given bio */ static int find_bio_disk(struct r1bio *r1_bio, struct bio *bio) { int mirror; struct r1conf *conf = r1_bio->mddev->private; int raid_disks = conf->raid_disks; for (mirror = 0; mirror < raid_disks * 2; mirror++) if (r1_bio->bios[mirror] == bio) break; BUG_ON(mirror == raid_disks * 2); update_head_pos(mirror, r1_bio); return mirror; } static void raid1_end_read_request(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); struct r1bio *r1_bio = bio->bi_private; int mirror; struct r1conf *conf = r1_bio->mddev->private; mirror = r1_bio->read_disk; /* * this branch is our 'one mirror IO has finished' event handler: */ update_head_pos(mirror, r1_bio); if (uptodate) set_bit(R1BIO_Uptodate, &r1_bio->state); else { /* If all other devices have failed, we want to return * the error upwards rather than fail the last device. * Here we redefine "uptodate" to mean "Don't want to retry" */ unsigned long flags; spin_lock_irqsave(&conf->device_lock, flags); if (r1_bio->mddev->degraded == conf->raid_disks || (r1_bio->mddev->degraded == conf->raid_disks-1 && !test_bit(Faulty, &conf->mirrors[mirror].rdev->flags))) uptodate = 1; spin_unlock_irqrestore(&conf->device_lock, flags); } if (uptodate) raid_end_bio_io(r1_bio); else { /* * oops, read error: */ char b[BDEVNAME_SIZE]; printk_ratelimited( KERN_ERR "md/raid1:%s: %s: " "rescheduling sector %llu\n", mdname(conf->mddev), bdevname(conf->mirrors[mirror].rdev->bdev, b), (unsigned long long)r1_bio->sector); set_bit(R1BIO_ReadError, &r1_bio->state); reschedule_retry(r1_bio); } rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); } static void close_write(struct r1bio *r1_bio) { /* it really is the end of this request */ if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { /* free extra copy of the data pages */ int i = r1_bio->behind_page_count; while (i--) safe_put_page(r1_bio->behind_bvecs[i].bv_page); kfree(r1_bio->behind_bvecs); r1_bio->behind_bvecs = NULL; } /* clear the bitmap if all writes complete successfully */ bitmap_endwrite(r1_bio->mddev->bitmap, r1_bio->sector, r1_bio->sectors, !test_bit(R1BIO_Degraded, &r1_bio->state), test_bit(R1BIO_BehindIO, &r1_bio->state)); md_write_end(r1_bio->mddev); } static void r1_bio_write_done(struct r1bio *r1_bio) { if (!atomic_dec_and_test(&r1_bio->remaining)) return; if (test_bit(R1BIO_WriteError, &r1_bio->state)) reschedule_retry(r1_bio); else { close_write(r1_bio); if (test_bit(R1BIO_MadeGood, &r1_bio->state)) reschedule_retry(r1_bio); else raid_end_bio_io(r1_bio); } } static void raid1_end_write_request(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); struct r1bio *r1_bio = bio->bi_private; int mirror, behind = test_bit(R1BIO_BehindIO, &r1_bio->state); struct r1conf *conf = r1_bio->mddev->private; struct bio *to_put = NULL; mirror = find_bio_disk(r1_bio, bio); /* * 'one mirror IO has finished' event handler: */ if (!uptodate) { set_bit(WriteErrorSeen, &conf->mirrors[mirror].rdev->flags); if (!test_and_set_bit(WantReplacement, &conf->mirrors[mirror].rdev->flags)) set_bit(MD_RECOVERY_NEEDED, & conf->mddev->recovery); set_bit(R1BIO_WriteError, &r1_bio->state); } else { /* * Set R1BIO_Uptodate in our master bio, so that we * will return a good error code for to the higher * levels even if IO on some other mirrored buffer * fails. * * The 'master' represents the composite IO operation * to user-side. So if something waits for IO, then it * will wait for the 'master' bio. */ sector_t first_bad; int bad_sectors; r1_bio->bios[mirror] = NULL; to_put = bio; set_bit(R1BIO_Uptodate, &r1_bio->state); /* Maybe we can clear some bad blocks. */ if (is_badblock(conf->mirrors[mirror].rdev, r1_bio->sector, r1_bio->sectors, &first_bad, &bad_sectors)) { r1_bio->bios[mirror] = IO_MADE_GOOD; set_bit(R1BIO_MadeGood, &r1_bio->state); } } if (behind) { if (test_bit(WriteMostly, &conf->mirrors[mirror].rdev->flags)) atomic_dec(&r1_bio->behind_remaining); /* * In behind mode, we ACK the master bio once the I/O * has safely reached all non-writemostly * disks. Setting the Returned bit ensures that this * gets done only once -- we don't ever want to return * -EIO here, instead we'll wait */ if (atomic_read(&r1_bio->behind_remaining) >= (atomic_read(&r1_bio->remaining)-1) && test_bit(R1BIO_Uptodate, &r1_bio->state)) { /* Maybe we can return now */ if (!test_and_set_bit(R1BIO_Returned, &r1_bio->state)) { struct bio *mbio = r1_bio->master_bio; pr_debug("raid1: behind end write sectors" " %llu-%llu\n", (unsigned long long) mbio->bi_sector, (unsigned long long) mbio->bi_sector + (mbio->bi_size >> 9) - 1); call_bio_endio(r1_bio); } } } if (r1_bio->bios[mirror] == NULL) rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); /* * Let's see if all mirrored write operations have finished * already. */ r1_bio_write_done(r1_bio); if (to_put) bio_put(to_put); } /* * This routine returns the disk from which the requested read should * be done. There is a per-array 'next expected sequential IO' sector * number - if this matches on the next IO then we use the last disk. * There is also a per-disk 'last know head position' sector that is * maintained from IRQ contexts, both the normal and the resync IO * completion handlers update this position correctly. If there is no * perfect sequential match then we pick the disk whose head is closest. * * If there are 2 mirrors in the same 2 devices, performance degrades * because position is mirror, not device based. * * The rdev for the device selected will have nr_pending incremented. */ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sectors) { const sector_t this_sector = r1_bio->sector; int sectors; int best_good_sectors; int start_disk; int best_disk; int i; sector_t best_dist; struct md_rdev *rdev; int choose_first; rcu_read_lock(); /* * Check if we can balance. We can balance on the whole * device if no resync is going on, or below the resync window. * We take the first readable disk when above the resync window. */ retry: sectors = r1_bio->sectors; best_disk = -1; best_dist = MaxSector; best_good_sectors = 0; if (conf->mddev->recovery_cp < MaxSector && (this_sector + sectors >= conf->next_resync)) { choose_first = 1; start_disk = 0; } else { choose_first = 0; start_disk = conf->last_used; } for (i = 0 ; i < conf->raid_disks * 2 ; i++) { sector_t dist; sector_t first_bad; int bad_sectors; int disk = start_disk + i; if (disk >= conf->raid_disks) disk -= conf->raid_disks; rdev = rcu_dereference(conf->mirrors[disk].rdev); if (r1_bio->bios[disk] == IO_BLOCKED || rdev == NULL || test_bit(Unmerged, &rdev->flags) || test_bit(Faulty, &rdev->flags)) continue; if (!test_bit(In_sync, &rdev->flags) && rdev->recovery_offset < this_sector + sectors) continue; if (test_bit(WriteMostly, &rdev->flags)) { /* Don't balance among write-mostly, just * use the first as a last resort */ if (best_disk < 0) { if (is_badblock(rdev, this_sector, sectors, &first_bad, &bad_sectors)) { if (first_bad < this_sector) /* Cannot use this */ continue; best_good_sectors = first_bad - this_sector; } else best_good_sectors = sectors; best_disk = disk; } continue; } /* This is a reasonable device to use. It might * even be best. */ if (is_badblock(rdev, this_sector, sectors, &first_bad, &bad_sectors)) { if (best_dist < MaxSector) /* already have a better device */ continue; if (first_bad <= this_sector) { /* cannot read here. If this is the 'primary' * device, then we must not read beyond * bad_sectors from another device.. */ bad_sectors -= (this_sector - first_bad); if (choose_first && sectors > bad_sectors) sectors = bad_sectors; if (best_good_sectors > sectors) best_good_sectors = sectors; } else { sector_t good_sectors = first_bad - this_sector; if (good_sectors > best_good_sectors) { best_good_sectors = good_sectors; best_disk = disk; } if (choose_first) break; } continue; } else best_good_sectors = sectors; dist = abs(this_sector - conf->mirrors[disk].head_position); if (choose_first /* Don't change to another disk for sequential reads */ || conf->next_seq_sect == this_sector || dist == 0 /* If device is idle, use it */ || atomic_read(&rdev->nr_pending) == 0) { best_disk = disk; break; } if (dist < best_dist) { best_dist = dist; best_disk = disk; } } if (best_disk >= 0) { rdev = rcu_dereference(conf->mirrors[best_disk].rdev); if (!rdev) goto retry; atomic_inc(&rdev->nr_pending); if (test_bit(Faulty, &rdev->flags)) { /* cannot risk returning a device that failed * before we inc'ed nr_pending */ rdev_dec_pending(rdev, conf->mddev); goto retry; } sectors = best_good_sectors; conf->next_seq_sect = this_sector + sectors; conf->last_used = best_disk; } rcu_read_unlock(); *max_sectors = sectors; return best_disk; } static int raid1_mergeable_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *biovec) { struct mddev *mddev = q->queuedata; struct r1conf *conf = mddev->private; sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev); int max = biovec->bv_len; if (mddev->merge_check_needed) { int disk; rcu_read_lock(); for (disk = 0; disk < conf->raid_disks * 2; disk++) { struct md_rdev *rdev = rcu_dereference( conf->mirrors[disk].rdev); if (rdev && !test_bit(Faulty, &rdev->flags)) { struct request_queue *q = bdev_get_queue(rdev->bdev); if (q->merge_bvec_fn) { bvm->bi_sector = sector + rdev->data_offset; bvm->bi_bdev = rdev->bdev; max = min(max, q->merge_bvec_fn( q, bvm, biovec)); } } } rcu_read_unlock(); } return max; } int md_raid1_congested(struct mddev *mddev, int bits) { struct r1conf *conf = mddev->private; int i, ret = 0; if ((bits & (1 << BDI_async_congested)) && conf->pending_count >= max_queued_requests) return 1; rcu_read_lock(); for (i = 0; i < conf->raid_disks * 2; i++) { struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); if (rdev && !test_bit(Faulty, &rdev->flags)) { struct request_queue *q = bdev_get_queue(rdev->bdev); BUG_ON(!q); /* Note the '|| 1' - when read_balance prefers * non-congested targets, it can be removed */ if ((bits & (1<<BDI_async_congested)) || 1) ret |= bdi_congested(&q->backing_dev_info, bits); else ret &= bdi_congested(&q->backing_dev_info, bits); } } rcu_read_unlock(); return ret; } EXPORT_SYMBOL_GPL(md_raid1_congested); static int raid1_congested(void *data, int bits) { struct mddev *mddev = data; return mddev_congested(mddev, bits) || md_raid1_congested(mddev, bits); } static void flush_pending_writes(struct r1conf *conf) { /* Any writes that have been queued but are awaiting * bitmap updates get flushed here. */ spin_lock_irq(&conf->device_lock); if (conf->pending_bio_list.head) { struct bio *bio; bio = bio_list_get(&conf->pending_bio_list); conf->pending_count = 0; spin_unlock_irq(&conf->device_lock); /* flush any pending bitmap writes to * disk before proceeding w/ I/O */ bitmap_unplug(conf->mddev->bitmap); wake_up(&conf->wait_barrier); while (bio) { /* submit pending writes */ struct bio *next = bio->bi_next; bio->bi_next = NULL; generic_make_request(bio); bio = next; } } else spin_unlock_irq(&conf->device_lock); } /* Barriers.... * Sometimes we need to suspend IO while we do something else, * either some resync/recovery, or reconfigure the array. * To do this we raise a 'barrier'. * The 'barrier' is a counter that can be raised multiple times * to count how many activities are happening which preclude * normal IO. * We can only raise the barrier if there is no pending IO. * i.e. if nr_pending == 0. * We choose only to raise the barrier if no-one is waiting for the * barrier to go down. This means that as soon as an IO request * is ready, no other operations which require a barrier will start * until the IO request has had a chance. * * So: regular IO calls 'wait_barrier'. When that returns there * is no backgroup IO happening, It must arrange to call * allow_barrier when it has finished its IO. * backgroup IO calls must call raise_barrier. Once that returns * there is no normal IO happeing. It must arrange to call * lower_barrier when the particular background IO completes. */ #define RESYNC_DEPTH 32 static void raise_barrier(struct r1conf *conf) { spin_lock_irq(&conf->resync_lock); /* Wait until no block IO is waiting */ wait_event_lock_irq(conf->wait_barrier, !conf->nr_waiting, conf->resync_lock, ); /* block any new IO from starting */ conf->barrier++; /* Now wait for all pending IO to complete */ wait_event_lock_irq(conf->wait_barrier, !conf->nr_pending && conf->barrier < RESYNC_DEPTH, conf->resync_lock, ); spin_unlock_irq(&conf->resync_lock); } static void lower_barrier(struct r1conf *conf) { unsigned long flags; BUG_ON(conf->barrier <= 0); spin_lock_irqsave(&conf->resync_lock, flags); conf->barrier--; spin_unlock_irqrestore(&conf->resync_lock, flags); wake_up(&conf->wait_barrier); } static void wait_barrier(struct r1conf *conf) { spin_lock_irq(&conf->resync_lock); if (conf->barrier) { conf->nr_waiting++; /* Wait for the barrier to drop. * However if there are already pending * requests (preventing the barrier from * rising completely), and the * pre-process bio queue isn't empty, * then don't wait, as we need to empty * that queue to get the nr_pending * count down. */ wait_event_lock_irq(conf->wait_barrier, !conf->barrier || (conf->nr_pending && current->bio_list && !bio_list_empty(current->bio_list)), conf->resync_lock, ); conf->nr_waiting--; } conf->nr_pending++; spin_unlock_irq(&conf->resync_lock); } static void allow_barrier(struct r1conf *conf) { unsigned long flags; spin_lock_irqsave(&conf->resync_lock, flags); conf->nr_pending--; spin_unlock_irqrestore(&conf->resync_lock, flags); wake_up(&conf->wait_barrier); } static void freeze_array(struct r1conf *conf) { /* stop syncio and normal IO and wait for everything to * go quite. * We increment barrier and nr_waiting, and then * wait until nr_pending match nr_queued+1 * This is called in the context of one normal IO request * that has failed. Thus any sync request that might be pending * will be blocked by nr_pending, and we need to wait for * pending IO requests to complete or be queued for re-try. * Thus the number queued (nr_queued) plus this request (1) * must match the number of pending IOs (nr_pending) before * we continue. */ spin_lock_irq(&conf->resync_lock); conf->barrier++; conf->nr_waiting++; wait_event_lock_irq(conf->wait_barrier, conf->nr_pending == conf->nr_queued+1, conf->resync_lock, flush_pending_writes(conf)); spin_unlock_irq(&conf->resync_lock); } static void unfreeze_array(struct r1conf *conf) { /* reverse the effect of the freeze */ spin_lock_irq(&conf->resync_lock); conf->barrier--; conf->nr_waiting--; wake_up(&conf->wait_barrier); spin_unlock_irq(&conf->resync_lock); } /* duplicate the data pages for behind I/O */ static void alloc_behind_pages(struct bio *bio, struct r1bio *r1_bio) { int i; struct bio_vec *bvec; struct bio_vec *bvecs = kzalloc(bio->bi_vcnt * sizeof(struct bio_vec), GFP_NOIO); if (unlikely(!bvecs)) return; bio_for_each_segment(bvec, bio, i) { bvecs[i] = *bvec; bvecs[i].bv_page = alloc_page(GFP_NOIO); if (unlikely(!bvecs[i].bv_page)) goto do_sync_io; memcpy(kmap(bvecs[i].bv_page) + bvec->bv_offset, kmap(bvec->bv_page) + bvec->bv_offset, bvec->bv_len); kunmap(bvecs[i].bv_page); kunmap(bvec->bv_page); } r1_bio->behind_bvecs = bvecs; r1_bio->behind_page_count = bio->bi_vcnt; set_bit(R1BIO_BehindIO, &r1_bio->state); return; do_sync_io: for (i = 0; i < bio->bi_vcnt; i++) if (bvecs[i].bv_page) put_page(bvecs[i].bv_page); kfree(bvecs); pr_debug("%dB behind alloc failed, doing sync I/O\n", bio->bi_size); } static void make_request(struct mddev *mddev, struct bio * bio) { struct r1conf *conf = mddev->private; struct mirror_info *mirror; struct r1bio *r1_bio; struct bio *read_bio; int i, disks; struct bitmap *bitmap; unsigned long flags; const int rw = bio_data_dir(bio); const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); struct md_rdev *blocked_rdev; int plugged; int first_clone; int sectors_handled; int max_sectors; /* * Register the new request and wait if the reconstruction * thread has put up a bar for new requests. * Continue immediately if no resync is active currently. */ md_write_start(mddev, bio); /* wait on superblock update early */ if (bio_data_dir(bio) == WRITE && bio->bi_sector + bio->bi_size/512 > mddev->suspend_lo && bio->bi_sector < mddev->suspend_hi) { /* As the suspend_* range is controlled by * userspace, we want an interruptible * wait. */ DEFINE_WAIT(w); for (;;) { flush_signals(current); prepare_to_wait(&conf->wait_barrier, &w, TASK_INTERRUPTIBLE); if (bio->bi_sector + bio->bi_size/512 <= mddev->suspend_lo || bio->bi_sector >= mddev->suspend_hi) break; schedule(); } finish_wait(&conf->wait_barrier, &w); } wait_barrier(conf); bitmap = mddev->bitmap; /* * make_request() can abort the operation when READA is being * used and no empty request is available. * */ r1_bio = mempool_alloc(conf->r1bio_pool, GFP_NOIO); r1_bio->master_bio = bio; r1_bio->sectors = bio->bi_size >> 9; r1_bio->state = 0; r1_bio->mddev = mddev; r1_bio->sector = bio->bi_sector; /* We might need to issue multiple reads to different * devices if there are bad blocks around, so we keep * track of the number of reads in bio->bi_phys_segments. * If this is 0, there is only one r1_bio and no locking * will be needed when requests complete. If it is * non-zero, then it is the number of not-completed requests. */ bio->bi_phys_segments = 0; clear_bit(BIO_SEG_VALID, &bio->bi_flags); if (rw == READ) { /* * read balancing logic: */ int rdisk; read_again: rdisk = read_balance(conf, r1_bio, &max_sectors); if (rdisk < 0) { /* couldn't find anywhere to read from */ raid_end_bio_io(r1_bio); return; } mirror = conf->mirrors + rdisk; if (test_bit(WriteMostly, &mirror->rdev->flags) && bitmap) { /* Reading from a write-mostly device must * take care not to over-take any writes * that are 'behind' */ wait_event(bitmap->behind_wait, atomic_read(&bitmap->behind_writes) == 0); } r1_bio->read_disk = rdisk; read_bio = bio_clone_mddev(bio, GFP_NOIO, mddev); md_trim_bio(read_bio, r1_bio->sector - bio->bi_sector, max_sectors); r1_bio->bios[rdisk] = read_bio; read_bio->bi_sector = r1_bio->sector + mirror->rdev->data_offset; read_bio->bi_bdev = mirror->rdev->bdev; read_bio->bi_end_io = raid1_end_read_request; read_bio->bi_rw = READ | do_sync; read_bio->bi_private = r1_bio; if (max_sectors < r1_bio->sectors) { /* could not read all from this device, so we will * need another r1_bio. */ sectors_handled = (r1_bio->sector + max_sectors - bio->bi_sector); r1_bio->sectors = max_sectors; spin_lock_irq(&conf->device_lock); if (bio->bi_phys_segments == 0) bio->bi_phys_segments = 2; else bio->bi_phys_segments++; spin_unlock_irq(&conf->device_lock); /* Cannot call generic_make_request directly * as that will be queued in __make_request * and subsequent mempool_alloc might block waiting * for it. So hand bio over to raid1d. */ reschedule_retry(r1_bio); r1_bio = mempool_alloc(conf->r1bio_pool, GFP_NOIO); r1_bio->master_bio = bio; r1_bio->sectors = (bio->bi_size >> 9) - sectors_handled; r1_bio->state = 0; r1_bio->mddev = mddev; r1_bio->sector = bio->bi_sector + sectors_handled; goto read_again; } else generic_make_request(read_bio); return; } /* * WRITE: */ if (conf->pending_count >= max_queued_requests) { md_wakeup_thread(mddev->thread); wait_event(conf->wait_barrier, conf->pending_count < max_queued_requests); } /* first select target devices under rcu_lock and * inc refcount on their rdev. Record them by setting * bios[x] to bio * If there are known/acknowledged bad blocks on any device on * which we have seen a write error, we want to avoid writing those * blocks. * This potentially requires several writes to write around * the bad blocks. Each set of writes gets it's own r1bio * with a set of bios attached. */ plugged = mddev_check_plugged(mddev); disks = conf->raid_disks * 2; retry_write: blocked_rdev = NULL; rcu_read_lock(); max_sectors = r1_bio->sectors; for (i = 0; i < disks; i++) { struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); if (rdev && unlikely(test_bit(Blocked, &rdev->flags))) { atomic_inc(&rdev->nr_pending); blocked_rdev = rdev; break; } r1_bio->bios[i] = NULL; if (!rdev || test_bit(Faulty, &rdev->flags) || test_bit(Unmerged, &rdev->flags)) { if (i < conf->raid_disks) set_bit(R1BIO_Degraded, &r1_bio->state); continue; } atomic_inc(&rdev->nr_pending); if (test_bit(WriteErrorSeen, &rdev->flags)) { sector_t first_bad; int bad_sectors; int is_bad; is_bad = is_badblock(rdev, r1_bio->sector, max_sectors, &first_bad, &bad_sectors); if (is_bad < 0) { /* mustn't write here until the bad block is * acknowledged*/ set_bit(BlockedBadBlocks, &rdev->flags); blocked_rdev = rdev; break; } if (is_bad && first_bad <= r1_bio->sector) { /* Cannot write here at all */ bad_sectors -= (r1_bio->sector - first_bad); if (bad_sectors < max_sectors) /* mustn't write more than bad_sectors * to other devices yet */ max_sectors = bad_sectors; rdev_dec_pending(rdev, mddev); /* We don't set R1BIO_Degraded as that * only applies if the disk is * missing, so it might be re-added, * and we want to know to recover this * chunk. * In this case the device is here, * and the fact that this chunk is not * in-sync is recorded in the bad * block log */ continue; } if (is_bad) { int good_sectors = first_bad - r1_bio->sector; if (good_sectors < max_sectors) max_sectors = good_sectors; } } r1_bio->bios[i] = bio; } rcu_read_unlock(); if (unlikely(blocked_rdev)) { /* Wait for this device to become unblocked */ int j; for (j = 0; j < i; j++) if (r1_bio->bios[j]) rdev_dec_pending(conf->mirrors[j].rdev, mddev); r1_bio->state = 0; allow_barrier(conf); md_wait_for_blocked_rdev(blocked_rdev, mddev); wait_barrier(conf); goto retry_write; } if (max_sectors < r1_bio->sectors) { /* We are splitting this write into multiple parts, so * we need to prepare for allocating another r1_bio. */ r1_bio->sectors = max_sectors; spin_lock_irq(&conf->device_lock); if (bio->bi_phys_segments == 0) bio->bi_phys_segments = 2; else bio->bi_phys_segments++; spin_unlock_irq(&conf->device_lock); } sectors_handled = r1_bio->sector + max_sectors - bio->bi_sector; atomic_set(&r1_bio->remaining, 1); atomic_set(&r1_bio->behind_remaining, 0); first_clone = 1; for (i = 0; i < disks; i++) { struct bio *mbio; if (!r1_bio->bios[i]) continue; mbio = bio_clone_mddev(bio, GFP_NOIO, mddev); md_trim_bio(mbio, r1_bio->sector - bio->bi_sector, max_sectors); if (first_clone) { /* do behind I/O ? * Not if there are too many, or cannot * allocate memory, or a reader on WriteMostly * is waiting for behind writes to flush */ if (bitmap && (atomic_read(&bitmap->behind_writes) < mddev->bitmap_info.max_write_behind) && !waitqueue_active(&bitmap->behind_wait)) alloc_behind_pages(mbio, r1_bio); bitmap_startwrite(bitmap, r1_bio->sector, r1_bio->sectors, test_bit(R1BIO_BehindIO, &r1_bio->state)); first_clone = 0; } if (r1_bio->behind_bvecs) { struct bio_vec *bvec; int j; /* Yes, I really want the '__' version so that * we clear any unused pointer in the io_vec, rather * than leave them unchanged. This is important * because when we come to free the pages, we won't * know the original bi_idx, so we just free * them all */ __bio_for_each_segment(bvec, mbio, j, 0) bvec->bv_page = r1_bio->behind_bvecs[j].bv_page; if (test_bit(WriteMostly, &conf->mirrors[i].rdev->flags)) atomic_inc(&r1_bio->behind_remaining); } r1_bio->bios[i] = mbio; mbio->bi_sector = (r1_bio->sector + conf->mirrors[i].rdev->data_offset); mbio->bi_bdev = conf->mirrors[i].rdev->bdev; mbio->bi_end_io = raid1_end_write_request; mbio->bi_rw = WRITE | do_flush_fua | do_sync; mbio->bi_private = r1_bio; atomic_inc(&r1_bio->remaining); spin_lock_irqsave(&conf->device_lock, flags); bio_list_add(&conf->pending_bio_list, mbio); conf->pending_count++; spin_unlock_irqrestore(&conf->device_lock, flags); } /* Mustn't call r1_bio_write_done before this next test, * as it could result in the bio being freed. */ if (sectors_handled < (bio->bi_size >> 9)) { r1_bio_write_done(r1_bio); /* We need another r1_bio. It has already been counted * in bio->bi_phys_segments */ r1_bio = mempool_alloc(conf->r1bio_pool, GFP_NOIO); r1_bio->master_bio = bio; r1_bio->sectors = (bio->bi_size >> 9) - sectors_handled; r1_bio->state = 0; r1_bio->mddev = mddev; r1_bio->sector = bio->bi_sector + sectors_handled; goto retry_write; } r1_bio_write_done(r1_bio); /* In case raid1d snuck in to freeze_array */ wake_up(&conf->wait_barrier); if (do_sync || !bitmap || !plugged) md_wakeup_thread(mddev->thread); } static void status(struct seq_file *seq, struct mddev *mddev) { struct r1conf *conf = mddev->private; int i; seq_printf(seq, " [%d/%d] [", conf->raid_disks, conf->raid_disks - mddev->degraded); rcu_read_lock(); for (i = 0; i < conf->raid_disks; i++) { struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); seq_printf(seq, "%s", rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_"); } rcu_read_unlock(); seq_printf(seq, "]"); } static void error(struct mddev *mddev, struct md_rdev *rdev) { char b[BDEVNAME_SIZE]; struct r1conf *conf = mddev->private; /* * If it is not operational, then we have already marked it as dead * else if it is the last working disks, ignore the error, let the * next level up know. * else mark the drive as failed */ if (test_bit(In_sync, &rdev->flags) && (conf->raid_disks - mddev->degraded) == 1) { /* * Don't fail the drive, act as though we were just a * normal single drive. * However don't try a recovery from this drive as * it is very likely to fail. */ conf->recovery_disabled = mddev->recovery_disabled; return; } set_bit(Blocked, &rdev->flags); if (test_and_clear_bit(In_sync, &rdev->flags)) { unsigned long flags; spin_lock_irqsave(&conf->device_lock, flags); mddev->degraded++; set_bit(Faulty, &rdev->flags); spin_unlock_irqrestore(&conf->device_lock, flags); /* * if recovery is running, make sure it aborts. */ set_bit(MD_RECOVERY_INTR, &mddev->recovery); } else set_bit(Faulty, &rdev->flags); set_bit(MD_CHANGE_DEVS, &mddev->flags); printk(KERN_ALERT "md/raid1:%s: Disk failure on %s, disabling device.\n" "md/raid1:%s: Operation continuing on %d devices.\n", mdname(mddev), bdevname(rdev->bdev, b), mdname(mddev), conf->raid_disks - mddev->degraded); } static void print_conf(struct r1conf *conf) { int i; printk(KERN_DEBUG "RAID1 conf printout:\n"); if (!conf) { printk(KERN_DEBUG "(!conf)\n"); return; } printk(KERN_DEBUG " --- wd:%d rd:%d\n", conf->raid_disks - conf->mddev->degraded, conf->raid_disks); rcu_read_lock(); for (i = 0; i < conf->raid_disks; i++) { char b[BDEVNAME_SIZE]; struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); if (rdev) printk(KERN_DEBUG " disk %d, wo:%d, o:%d, dev:%s\n", i, !test_bit(In_sync, &rdev->flags), !test_bit(Faulty, &rdev->flags), bdevname(rdev->bdev,b)); } rcu_read_unlock(); } static void close_sync(struct r1conf *conf) { wait_barrier(conf); allow_barrier(conf); mempool_destroy(conf->r1buf_pool); conf->r1buf_pool = NULL; } static int raid1_spare_active(struct mddev *mddev) { int i; struct r1conf *conf = mddev->private; int count = 0; unsigned long flags; /* * Find all failed disks within the RAID1 configuration * and mark them readable. * Called under mddev lock, so rcu protection not needed. */ for (i = 0; i < conf->raid_disks; i++) { struct md_rdev *rdev = conf->mirrors[i].rdev; struct md_rdev *repl = conf->mirrors[conf->raid_disks + i].rdev; if (repl && repl->recovery_offset == MaxSector && !test_bit(Faulty, &repl->flags) && !test_and_set_bit(In_sync, &repl->flags)) { /* replacement has just become active */ if (!rdev || !test_and_clear_bit(In_sync, &rdev->flags)) count++; if (rdev) { /* Replaced device not technically * faulty, but we need to be sure * it gets removed and never re-added */ set_bit(Faulty, &rdev->flags); sysfs_notify_dirent_safe( rdev->sysfs_state); } } if (rdev && rdev->recovery_offset == MaxSector && !test_bit(Faulty, &rdev->flags) && !test_and_set_bit(In_sync, &rdev->flags)) { count++; sysfs_notify_dirent_safe(rdev->sysfs_state); } } spin_lock_irqsave(&conf->device_lock, flags); mddev->degraded -= count; spin_unlock_irqrestore(&conf->device_lock, flags); print_conf(conf); return count; } static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev) { struct r1conf *conf = mddev->private; int err = -EEXIST; int mirror = 0; struct mirror_info *p; int first = 0; int last = conf->raid_disks - 1; struct request_queue *q = bdev_get_queue(rdev->bdev); if (mddev->recovery_disabled == conf->recovery_disabled) return -EBUSY; if (rdev->raid_disk >= 0) first = last = rdev->raid_disk; if (q->merge_bvec_fn) { set_bit(Unmerged, &rdev->flags); mddev->merge_check_needed = 1; } for (mirror = first; mirror <= last; mirror++) { p = conf->mirrors+mirror; if (!p->rdev) { disk_stack_limits(mddev->gendisk, rdev->bdev, rdev->data_offset << 9); p->head_position = 0; rdev->raid_disk = mirror; err = 0; /* As all devices are equivalent, we don't need a full recovery * if this was recently any drive of the array */ if (rdev->saved_raid_disk < 0) conf->fullsync = 1; rcu_assign_pointer(p->rdev, rdev); break; } if (test_bit(WantReplacement, &p->rdev->flags) && p[conf->raid_disks].rdev == NULL) { /* Add this device as a replacement */ clear_bit(In_sync, &rdev->flags); set_bit(Replacement, &rdev->flags); rdev->raid_disk = mirror; err = 0; conf->fullsync = 1; rcu_assign_pointer(p[conf->raid_disks].rdev, rdev); break; } } if (err == 0 && test_bit(Unmerged, &rdev->flags)) { /* Some requests might not have seen this new * merge_bvec_fn. We must wait for them to complete * before merging the device fully. * First we make sure any code which has tested * our function has submitted the request, then * we wait for all outstanding requests to complete. */ synchronize_sched(); raise_barrier(conf); lower_barrier(conf); clear_bit(Unmerged, &rdev->flags); } md_integrity_add_rdev(rdev, mddev); print_conf(conf); return err; } static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev) { struct r1conf *conf = mddev->private; int err = 0; int number = rdev->raid_disk; struct mirror_info *p = conf->mirrors+ number; if (rdev != p->rdev) p = conf->mirrors + conf->raid_disks + number; print_conf(conf); if (rdev == p->rdev) { if (test_bit(In_sync, &rdev->flags) || atomic_read(&rdev->nr_pending)) { err = -EBUSY; goto abort; } /* Only remove non-faulty devices if recovery * is not possible. */ if (!test_bit(Faulty, &rdev->flags) && mddev->recovery_disabled != conf->recovery_disabled && mddev->degraded < conf->raid_disks) { err = -EBUSY; goto abort; } p->rdev = NULL; synchronize_rcu(); if (atomic_read(&rdev->nr_pending)) { /* lost the race, try later */ err = -EBUSY; p->rdev = rdev; goto abort; } else if (conf->mirrors[conf->raid_disks + number].rdev) { /* We just removed a device that is being replaced. * Move down the replacement. We drain all IO before * doing this to avoid confusion. */ struct md_rdev *repl = conf->mirrors[conf->raid_disks + number].rdev; raise_barrier(conf); clear_bit(Replacement, &repl->flags); p->rdev = repl; conf->mirrors[conf->raid_disks + number].rdev = NULL; lower_barrier(conf); clear_bit(WantReplacement, &rdev->flags); } else clear_bit(WantReplacement, &rdev->flags); err = md_integrity_register(mddev); } abort: print_conf(conf); return err; } static void end_sync_read(struct bio *bio, int error) { struct r1bio *r1_bio = bio->bi_private; update_head_pos(r1_bio->read_disk, r1_bio); /* * we have read a block, now it needs to be re-written, * or re-read if the read failed. * We don't do much here, just schedule handling by raid1d */ if (test_bit(BIO_UPTODATE, &bio->bi_flags)) set_bit(R1BIO_Uptodate, &r1_bio->state); if (atomic_dec_and_test(&r1_bio->remaining)) reschedule_retry(r1_bio); } static void end_sync_write(struct bio *bio, int error) { int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); struct r1bio *r1_bio = bio->bi_private; struct mddev *mddev = r1_bio->mddev; struct r1conf *conf = mddev->private; int mirror=0; sector_t first_bad; int bad_sectors; mirror = find_bio_disk(r1_bio, bio); if (!uptodate) { sector_t sync_blocks = 0; sector_t s = r1_bio->sector; long sectors_to_go = r1_bio->sectors; /* make sure these bits doesn't get cleared. */ do { bitmap_end_sync(mddev->bitmap, s, &sync_blocks, 1); s += sync_blocks; sectors_to_go -= sync_blocks; } while (sectors_to_go > 0); set_bit(WriteErrorSeen, &conf->mirrors[mirror].rdev->flags); if (!test_and_set_bit(WantReplacement, &conf->mirrors[mirror].rdev->flags)) set_bit(MD_RECOVERY_NEEDED, & mddev->recovery); set_bit(R1BIO_WriteError, &r1_bio->state); } else if (is_badblock(conf->mirrors[mirror].rdev, r1_bio->sector, r1_bio->sectors, &first_bad, &bad_sectors) && !is_badblock(conf->mirrors[r1_bio->read_disk].rdev, r1_bio->sector, r1_bio->sectors, &first_bad, &bad_sectors) ) set_bit(R1BIO_MadeGood, &r1_bio->state); if (atomic_dec_and_test(&r1_bio->remaining)) { int s = r1_bio->sectors; if (test_bit(R1BIO_MadeGood, &r1_bio->state) || test_bit(R1BIO_WriteError, &r1_bio->state)) reschedule_retry(r1_bio); else { put_buf(r1_bio); md_done_sync(mddev, s, uptodate); } } } static int r1_sync_page_io(struct md_rdev *rdev, sector_t sector, int sectors, struct page *page, int rw) { if (sync_page_io(rdev, sector, sectors << 9, page, rw, false)) /* success */ return 1; if (rw == WRITE) { set_bit(WriteErrorSeen, &rdev->flags); if (!test_and_set_bit(WantReplacement, &rdev->flags)) set_bit(MD_RECOVERY_NEEDED, & rdev->mddev->recovery); } /* need to record an error - either for the block or the device */ if (!rdev_set_badblocks(rdev, sector, sectors, 0)) md_error(rdev->mddev, rdev); return 0; } static int fix_sync_read_error(struct r1bio *r1_bio) { /* Try some synchronous reads of other devices to get * good data, much like with normal read errors. Only * read into the pages we already have so we don't * need to re-issue the read request. * We don't need to freeze the array, because being in an * active sync request, there is no normal IO, and * no overlapping syncs. * We don't need to check is_badblock() again as we * made sure that anything with a bad block in range * will have bi_end_io clear. */ struct mddev *mddev = r1_bio->mddev; struct r1conf *conf = mddev->private; struct bio *bio = r1_bio->bios[r1_bio->read_disk]; sector_t sect = r1_bio->sector; int sectors = r1_bio->sectors; int idx = 0; while(sectors) { int s = sectors; int d = r1_bio->read_disk; int success = 0; struct md_rdev *rdev; int start; if (s > (PAGE_SIZE>>9)) s = PAGE_SIZE >> 9; do { if (r1_bio->bios[d]->bi_end_io == end_sync_read) { /* No rcu protection needed here devices * can only be removed when no resync is * active, and resync is currently active */ rdev = conf->mirrors[d].rdev; if (sync_page_io(rdev, sect, s<<9, bio->bi_io_vec[idx].bv_page, READ, false)) { success = 1; break; } } d++; if (d == conf->raid_disks * 2) d = 0; } while (!success && d != r1_bio->read_disk); if (!success) { char b[BDEVNAME_SIZE]; int abort = 0; /* Cannot read from anywhere, this block is lost. * Record a bad block on each device. If that doesn't * work just disable and interrupt the recovery. * Don't fail devices as that won't really help. */ printk(KERN_ALERT "md/raid1:%s: %s: unrecoverable I/O read error" " for block %llu\n", mdname(mddev), bdevname(bio->bi_bdev, b), (unsigned long long)r1_bio->sector); for (d = 0; d < conf->raid_disks * 2; d++) { rdev = conf->mirrors[d].rdev; if (!rdev || test_bit(Faulty, &rdev->flags)) continue; if (!rdev_set_badblocks(rdev, sect, s, 0)) abort = 1; } if (abort) { conf->recovery_disabled = mddev->recovery_disabled; set_bit(MD_RECOVERY_INTR, &mddev->recovery); md_done_sync(mddev, r1_bio->sectors, 0); put_buf(r1_bio); return 0; } /* Try next page */ sectors -= s; sect += s; idx++; continue; } start = d; /* write it back and re-read */ while (d != r1_bio->read_disk) { if (d == 0) d = conf->raid_disks * 2; d--; if (r1_bio->bios[d]->bi_end_io != end_sync_read) continue; rdev = conf->mirrors[d].rdev; if (r1_sync_page_io(rdev, sect, s, bio->bi_io_vec[idx].bv_page, WRITE) == 0) { r1_bio->bios[d]->bi_end_io = NULL; rdev_dec_pending(rdev, mddev); } } d = start; while (d != r1_bio->read_disk) { if (d == 0) d = conf->raid_disks * 2; d--; if (r1_bio->bios[d]->bi_end_io != end_sync_read) continue; rdev = conf->mirrors[d].rdev; if (r1_sync_page_io(rdev, sect, s, bio->bi_io_vec[idx].bv_page, READ) != 0) atomic_add(s, &rdev->corrected_errors); } sectors -= s; sect += s; idx ++; } set_bit(R1BIO_Uptodate, &r1_bio->state); set_bit(BIO_UPTODATE, &bio->bi_flags); return 1; } static int process_checks(struct r1bio *r1_bio) { /* We have read all readable devices. If we haven't * got the block, then there is no hope left. * If we have, then we want to do a comparison * and skip the write if everything is the same. * If any blocks failed to read, then we need to * attempt an over-write */ struct mddev *mddev = r1_bio->mddev; struct r1conf *conf = mddev->private; int primary; int i; int vcnt; for (primary = 0; primary < conf->raid_disks * 2; primary++) if (r1_bio->bios[primary]->bi_end_io == end_sync_read && test_bit(BIO_UPTODATE, &r1_bio->bios[primary]->bi_flags)) { r1_bio->bios[primary]->bi_end_io = NULL; rdev_dec_pending(conf->mirrors[primary].rdev, mddev); break; } r1_bio->read_disk = primary; vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9); for (i = 0; i < conf->raid_disks * 2; i++) { int j; struct bio *pbio = r1_bio->bios[primary]; struct bio *sbio = r1_bio->bios[i]; int size; if (r1_bio->bios[i]->bi_end_io != end_sync_read) continue; if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) { for (j = vcnt; j-- ; ) { struct page *p, *s; p = pbio->bi_io_vec[j].bv_page; s = sbio->bi_io_vec[j].bv_page; if (memcmp(page_address(p), page_address(s), sbio->bi_io_vec[j].bv_len)) break; } } else j = 0; if (j >= 0) mddev->resync_mismatches += r1_bio->sectors; if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && test_bit(BIO_UPTODATE, &sbio->bi_flags))) { /* No need to write to this device. */ sbio->bi_end_io = NULL; rdev_dec_pending(conf->mirrors[i].rdev, mddev); continue; } /* fixup the bio for reuse */ sbio->bi_vcnt = vcnt; sbio->bi_size = r1_bio->sectors << 9; sbio->bi_idx = 0; sbio->bi_phys_segments = 0; sbio->bi_flags &= ~(BIO_POOL_MASK - 1); sbio->bi_flags |= 1 << BIO_UPTODATE; sbio->bi_next = NULL; sbio->bi_sector = r1_bio->sector + conf->mirrors[i].rdev->data_offset; sbio->bi_bdev = conf->mirrors[i].rdev->bdev; size = sbio->bi_size; for (j = 0; j < vcnt ; j++) { struct bio_vec *bi; bi = &sbio->bi_io_vec[j]; bi->bv_offset = 0; if (size > PAGE_SIZE) bi->bv_len = PAGE_SIZE; else bi->bv_len = size; size -= PAGE_SIZE; memcpy(page_address(bi->bv_page), page_address(pbio->bi_io_vec[j].bv_page), PAGE_SIZE); } } return 0; } static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio) { struct r1conf *conf = mddev->private; int i; int disks = conf->raid_disks * 2; struct bio *bio, *wbio; bio = r1_bio->bios[r1_bio->read_disk]; if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) /* ouch - failed to read all of that. */ if (!fix_sync_read_error(r1_bio)) return; if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) if (process_checks(r1_bio) < 0) return; /* * schedule writes */ atomic_set(&r1_bio->remaining, 1); for (i = 0; i < disks ; i++) { wbio = r1_bio->bios[i]; if (wbio->bi_end_io == NULL || (wbio->bi_end_io == end_sync_read && (i == r1_bio->read_disk || !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)))) continue; wbio->bi_rw = WRITE; wbio->bi_end_io = end_sync_write; atomic_inc(&r1_bio->remaining); md_sync_acct(conf->mirrors[i].rdev->bdev, wbio->bi_size >> 9); generic_make_request(wbio); } if (atomic_dec_and_test(&r1_bio->remaining)) { /* if we're here, all write(s) have completed, so clean up */ md_done_sync(mddev, r1_bio->sectors, 1); put_buf(r1_bio); } } /* * This is a kernel thread which: * * 1. Retries failed read operations on working mirrors. * 2. Updates the raid superblock when problems encounter. * 3. Performs writes following reads for array synchronising. */ static void fix_read_error(struct r1conf *conf, int read_disk, sector_t sect, int sectors) { struct mddev *mddev = conf->mddev; while(sectors) { int s = sectors; int d = read_disk; int success = 0; int start; struct md_rdev *rdev; if (s > (PAGE_SIZE>>9)) s = PAGE_SIZE >> 9; do { /* Note: no rcu protection needed here * as this is synchronous in the raid1d thread * which is the thread that might remove * a device. If raid1d ever becomes multi-threaded.... */ sector_t first_bad; int bad_sectors; rdev = conf->mirrors[d].rdev; if (rdev && test_bit(In_sync, &rdev->flags) && is_badblock(rdev, sect, s, &first_bad, &bad_sectors) == 0 && sync_page_io(rdev, sect, s<<9, conf->tmppage, READ, false)) success = 1; else { d++; if (d == conf->raid_disks * 2) d = 0; } } while (!success && d != read_disk); if (!success) { /* Cannot read from anywhere - mark it bad */ struct md_rdev *rdev = conf->mirrors[read_disk].rdev; if (!rdev_set_badblocks(rdev, sect, s, 0)) md_error(mddev, rdev); break; } /* write it back and re-read */ start = d; while (d != read_disk) { if (d==0) d = conf->raid_disks * 2; d--; rdev = conf->mirrors[d].rdev; if (rdev && test_bit(In_sync, &rdev->flags)) r1_sync_page_io(rdev, sect, s, conf->tmppage, WRITE); } d = start; while (d != read_disk) { char b[BDEVNAME_SIZE]; if (d==0) d = conf->raid_disks * 2; d--; rdev = conf->mirrors[d].rdev; if (rdev && test_bit(In_sync, &rdev->flags)) { if (r1_sync_page_io(rdev, sect, s, conf->tmppage, READ)) { atomic_add(s, &rdev->corrected_errors); printk(KERN_INFO "md/raid1:%s: read error corrected " "(%d sectors at %llu on %s)\n", mdname(mddev), s, (unsigned long long)(sect + rdev->data_offset), bdevname(rdev->bdev, b)); } } } sectors -= s; sect += s; } } static void bi_complete(struct bio *bio, int error) { complete((struct completion *)bio->bi_private); } static int submit_bio_wait(int rw, struct bio *bio) { struct completion event; rw |= REQ_SYNC; init_completion(&event); bio->bi_private = &event; bio->bi_end_io = bi_complete; submit_bio(rw, bio); wait_for_completion(&event); return test_bit(BIO_UPTODATE, &bio->bi_flags); } static int narrow_write_error(struct r1bio *r1_bio, int i) { struct mddev *mddev = r1_bio->mddev; struct r1conf *conf = mddev->private; struct md_rdev *rdev = conf->mirrors[i].rdev; int vcnt, idx; struct bio_vec *vec; /* bio has the data to be written to device 'i' where * we just recently had a write error. * We repeatedly clone the bio and trim down to one block, * then try the write. Where the write fails we record * a bad block. * It is conceivable that the bio doesn't exactly align with * blocks. We must handle this somehow. * * We currently own a reference on the rdev. */ int block_sectors; sector_t sector; int sectors; int sect_to_write = r1_bio->sectors; int ok = 1; if (rdev->badblocks.shift < 0) return 0; block_sectors = 1 << rdev->badblocks.shift; sector = r1_bio->sector; sectors = ((sector + block_sectors) & ~(sector_t)(block_sectors - 1)) - sector; if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { vcnt = r1_bio->behind_page_count; vec = r1_bio->behind_bvecs; idx = 0; while (vec[idx].bv_page == NULL) idx++; } else { vcnt = r1_bio->master_bio->bi_vcnt; vec = r1_bio->master_bio->bi_io_vec; idx = r1_bio->master_bio->bi_idx; } while (sect_to_write) { struct bio *wbio; if (sectors > sect_to_write) sectors = sect_to_write; /* Write at 'sector' for 'sectors'*/ wbio = bio_alloc_mddev(GFP_NOIO, vcnt, mddev); memcpy(wbio->bi_io_vec, vec, vcnt * sizeof(struct bio_vec)); wbio->bi_sector = r1_bio->sector; wbio->bi_rw = WRITE; wbio->bi_vcnt = vcnt; wbio->bi_size = r1_bio->sectors << 9; wbio->bi_idx = idx; md_trim_bio(wbio, sector - r1_bio->sector, sectors); wbio->bi_sector += rdev->data_offset; wbio->bi_bdev = rdev->bdev; if (submit_bio_wait(WRITE, wbio) == 0) /* failure! */ ok = rdev_set_badblocks(rdev, sector, sectors, 0) && ok; bio_put(wbio); sect_to_write -= sectors; sector += sectors; sectors = block_sectors; } return ok; } static void handle_sync_write_finished(struct r1conf *conf, struct r1bio *r1_bio) { int m; int s = r1_bio->sectors; for (m = 0; m < conf->raid_disks * 2 ; m++) { struct md_rdev *rdev = conf->mirrors[m].rdev; struct bio *bio = r1_bio->bios[m]; if (bio->bi_end_io == NULL) continue; if (test_bit(BIO_UPTODATE, &bio->bi_flags) && test_bit(R1BIO_MadeGood, &r1_bio->state)) { rdev_clear_badblocks(rdev, r1_bio->sector, s); } if (!test_bit(BIO_UPTODATE, &bio->bi_flags) && test_bit(R1BIO_WriteError, &r1_bio->state)) { if (!rdev_set_badblocks(rdev, r1_bio->sector, s, 0)) md_error(conf->mddev, rdev); } } put_buf(r1_bio); md_done_sync(conf->mddev, s, 1); } static void handle_write_finished(struct r1conf *conf, struct r1bio *r1_bio) { int m; for (m = 0; m < conf->raid_disks * 2 ; m++) if (r1_bio->bios[m] == IO_MADE_GOOD) { struct md_rdev *rdev = conf->mirrors[m].rdev; rdev_clear_badblocks(rdev, r1_bio->sector, r1_bio->sectors); rdev_dec_pending(rdev, conf->mddev); } else if (r1_bio->bios[m] != NULL) { /* This drive got a write error. We need to * narrow down and record precise write * errors. */ if (!narrow_write_error(r1_bio, m)) { md_error(conf->mddev, conf->mirrors[m].rdev); /* an I/O failed, we can't clear the bitmap */ set_bit(R1BIO_Degraded, &r1_bio->state); } rdev_dec_pending(conf->mirrors[m].rdev, conf->mddev); } if (test_bit(R1BIO_WriteError, &r1_bio->state)) close_write(r1_bio); raid_end_bio_io(r1_bio); } static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio) { int disk; int max_sectors; struct mddev *mddev = conf->mddev; struct bio *bio; char b[BDEVNAME_SIZE]; struct md_rdev *rdev; clear_bit(R1BIO_ReadError, &r1_bio->state); /* we got a read error. Maybe the drive is bad. Maybe just * the block and we can fix it. * We freeze all other IO, and try reading the block from * other devices. When we find one, we re-write * and check it that fixes the read error. * This is all done synchronously while the array is * frozen */ if (mddev->ro == 0) { freeze_array(conf); fix_read_error(conf, r1_bio->read_disk, r1_bio->sector, r1_bio->sectors); unfreeze_array(conf); } else md_error(mddev, conf->mirrors[r1_bio->read_disk].rdev); bio = r1_bio->bios[r1_bio->read_disk]; bdevname(bio->bi_bdev, b); read_more: disk = read_balance(conf, r1_bio, &max_sectors); if (disk == -1) { printk(KERN_ALERT "md/raid1:%s: %s: unrecoverable I/O" " read error for block %llu\n", mdname(mddev), b, (unsigned long long)r1_bio->sector); raid_end_bio_io(r1_bio); } else { const unsigned long do_sync = r1_bio->master_bio->bi_rw & REQ_SYNC; if (bio) { r1_bio->bios[r1_bio->read_disk] = mddev->ro ? IO_BLOCKED : NULL; bio_put(bio); } r1_bio->read_disk = disk; bio = bio_clone_mddev(r1_bio->master_bio, GFP_NOIO, mddev); md_trim_bio(bio, r1_bio->sector - bio->bi_sector, max_sectors); r1_bio->bios[r1_bio->read_disk] = bio; rdev = conf->mirrors[disk].rdev; printk_ratelimited(KERN_ERR "md/raid1:%s: redirecting sector %llu" " to other mirror: %s\n", mdname(mddev), (unsigned long long)r1_bio->sector, bdevname(rdev->bdev, b)); bio->bi_sector = r1_bio->sector + rdev->data_offset; bio->bi_bdev = rdev->bdev; bio->bi_end_io = raid1_end_read_request; bio->bi_rw = READ | do_sync; bio->bi_private = r1_bio; if (max_sectors < r1_bio->sectors) { /* Drat - have to split this up more */ struct bio *mbio = r1_bio->master_bio; int sectors_handled = (r1_bio->sector + max_sectors - mbio->bi_sector); r1_bio->sectors = max_sectors; spin_lock_irq(&conf->device_lock); if (mbio->bi_phys_segments == 0) mbio->bi_phys_segments = 2; else mbio->bi_phys_segments++; spin_unlock_irq(&conf->device_lock); generic_make_request(bio); bio = NULL; r1_bio = mempool_alloc(conf->r1bio_pool, GFP_NOIO); r1_bio->master_bio = mbio; r1_bio->sectors = (mbio->bi_size >> 9) - sectors_handled; r1_bio->state = 0; set_bit(R1BIO_ReadError, &r1_bio->state); r1_bio->mddev = mddev; r1_bio->sector = mbio->bi_sector + sectors_handled; goto read_more; } else generic_make_request(bio); } } static void raid1d(struct mddev *mddev) { struct r1bio *r1_bio; unsigned long flags; struct r1conf *conf = mddev->private; struct list_head *head = &conf->retry_list; struct blk_plug plug; md_check_recovery(mddev); blk_start_plug(&plug); for (;;) { if (atomic_read(&mddev->plug_cnt) == 0) flush_pending_writes(conf); spin_lock_irqsave(&conf->device_lock, flags); if (list_empty(head)) { spin_unlock_irqrestore(&conf->device_lock, flags); break; } r1_bio = list_entry(head->prev, struct r1bio, retry_list); list_del(head->prev); conf->nr_queued--; spin_unlock_irqrestore(&conf->device_lock, flags); mddev = r1_bio->mddev; conf = mddev->private; if (test_bit(R1BIO_IsSync, &r1_bio->state)) { if (test_bit(R1BIO_MadeGood, &r1_bio->state) || test_bit(R1BIO_WriteError, &r1_bio->state)) handle_sync_write_finished(conf, r1_bio); else sync_request_write(mddev, r1_bio); } else if (test_bit(R1BIO_MadeGood, &r1_bio->state) || test_bit(R1BIO_WriteError, &r1_bio->state)) handle_write_finished(conf, r1_bio); else if (test_bit(R1BIO_ReadError, &r1_bio->state)) handle_read_error(conf, r1_bio); else /* just a partial read to be scheduled from separate * context */ generic_make_request(r1_bio->bios[r1_bio->read_disk]); cond_resched(); if (mddev->flags & ~(1<<MD_CHANGE_PENDING)) md_check_recovery(mddev); } blk_finish_plug(&plug); } static int init_resync(struct r1conf *conf) { int buffs; buffs = RESYNC_WINDOW / RESYNC_BLOCK_SIZE; BUG_ON(conf->r1buf_pool); conf->r1buf_pool = mempool_create(buffs, r1buf_pool_alloc, r1buf_pool_free, conf->poolinfo); if (!conf->r1buf_pool) return -ENOMEM; conf->next_resync = 0; return 0; } /* * perform a "sync" on one "block" * * We need to make sure that no normal I/O request - particularly write * requests - conflict with active sync requests. * * This is achieved by tracking pending requests and a 'barrier' concept * that can be installed to exclude normal IO requests. */ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster) { struct r1conf *conf = mddev->private; struct r1bio *r1_bio; struct bio *bio; sector_t max_sector, nr_sectors; int disk = -1; int i; int wonly = -1; int write_targets = 0, read_targets = 0; sector_t sync_blocks; int still_degraded = 0; int good_sectors = RESYNC_SECTORS; int min_bad = 0; /* number of sectors that are bad in all devices */ if (!conf->r1buf_pool) if (init_resync(conf)) return 0; max_sector = mddev->dev_sectors; if (sector_nr >= max_sector) { /* If we aborted, we need to abort the * sync on the 'current' bitmap chunk (there will * only be one in raid1 resync. * We can find the current addess in mddev->curr_resync */ if (mddev->curr_resync < max_sector) /* aborted */ bitmap_end_sync(mddev->bitmap, mddev->curr_resync, &sync_blocks, 1); else /* completed sync */ conf->fullsync = 0; bitmap_close_sync(mddev->bitmap); close_sync(conf); return 0; } if (mddev->bitmap == NULL && mddev->recovery_cp == MaxSector && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery) && conf->fullsync == 0) { *skipped = 1; return max_sector - sector_nr; } /* before building a request, check if we can skip these blocks.. * This call the bitmap_start_sync doesn't actually record anything */ if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 1) && !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { /* We can skip this block, and probably several more */ *skipped = 1; return sync_blocks; } /* * If there is non-resync activity waiting for a turn, * and resync is going fast enough, * then let it though before starting on this new sync request. */ if (!go_faster && conf->nr_waiting) msleep_interruptible(1000); bitmap_cond_end_sync(mddev->bitmap, sector_nr); r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); raise_barrier(conf); conf->next_resync = sector_nr; rcu_read_lock(); /* * If we get a correctably read error during resync or recovery, * we might want to read from a different device. So we * flag all drives that could conceivably be read from for READ, * and any others (which will be non-In_sync devices) for WRITE. * If a read fails, we try reading from something else for which READ * is OK. */ r1_bio->mddev = mddev; r1_bio->sector = sector_nr; r1_bio->state = 0; set_bit(R1BIO_IsSync, &r1_bio->state); for (i = 0; i < conf->raid_disks * 2; i++) { struct md_rdev *rdev; bio = r1_bio->bios[i]; /* take from bio_init */ bio->bi_next = NULL; bio->bi_flags &= ~(BIO_POOL_MASK-1); bio->bi_flags |= 1 << BIO_UPTODATE; bio->bi_rw = READ; bio->bi_vcnt = 0; bio->bi_idx = 0; bio->bi_phys_segments = 0; bio->bi_size = 0; bio->bi_end_io = NULL; bio->bi_private = NULL; rdev = rcu_dereference(conf->mirrors[i].rdev); if (rdev == NULL || test_bit(Faulty, &rdev->flags)) { if (i < conf->raid_disks) still_degraded = 1; } else if (!test_bit(In_sync, &rdev->flags)) { bio->bi_rw = WRITE; bio->bi_end_io = end_sync_write; write_targets ++; } else { /* may need to read from here */ sector_t first_bad = MaxSector; int bad_sectors; if (is_badblock(rdev, sector_nr, good_sectors, &first_bad, &bad_sectors)) { if (first_bad > sector_nr) good_sectors = first_bad - sector_nr; else { bad_sectors -= (sector_nr - first_bad); if (min_bad == 0 || min_bad > bad_sectors) min_bad = bad_sectors; } } if (sector_nr < first_bad) { if (test_bit(WriteMostly, &rdev->flags)) { if (wonly < 0) wonly = i; } else { if (disk < 0) disk = i; } bio->bi_rw = READ; bio->bi_end_io = end_sync_read; read_targets++; } } if (bio->bi_end_io) { atomic_inc(&rdev->nr_pending); bio->bi_sector = sector_nr + rdev->data_offset; bio->bi_bdev = rdev->bdev; bio->bi_private = r1_bio; } } rcu_read_unlock(); if (disk < 0) disk = wonly; r1_bio->read_disk = disk; if (read_targets == 0 && min_bad > 0) { /* These sectors are bad on all InSync devices, so we * need to mark them bad on all write targets */ int ok = 1; for (i = 0 ; i < conf->raid_disks * 2 ; i++) if (r1_bio->bios[i]->bi_end_io == end_sync_write) { struct md_rdev *rdev = conf->mirrors[i].rdev; ok = rdev_set_badblocks(rdev, sector_nr, min_bad, 0 ) && ok; } set_bit(MD_CHANGE_DEVS, &mddev->flags); *skipped = 1; put_buf(r1_bio); if (!ok) { /* Cannot record the badblocks, so need to * abort the resync. * If there are multiple read targets, could just * fail the really bad ones ??? */ conf->recovery_disabled = mddev->recovery_disabled; set_bit(MD_RECOVERY_INTR, &mddev->recovery); return 0; } else return min_bad; } if (min_bad > 0 && min_bad < good_sectors) { /* only resync enough to reach the next bad->good * transition */ good_sectors = min_bad; } if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) && read_targets > 0) /* extra read targets are also write targets */ write_targets += read_targets-1; if (write_targets == 0 || read_targets == 0) { /* There is nowhere to write, so all non-sync * drives must be failed - so we are finished */ sector_t rv = max_sector - sector_nr; *skipped = 1; put_buf(r1_bio); return rv; } if (max_sector > mddev->resync_max) max_sector = mddev->resync_max; /* Don't do IO beyond here */ if (max_sector > sector_nr + good_sectors) max_sector = sector_nr + good_sectors; nr_sectors = 0; sync_blocks = 0; do { struct page *page; int len = PAGE_SIZE; if (sector_nr + (len>>9) > max_sector) len = (max_sector - sector_nr) << 9; if (len == 0) break; if (sync_blocks == 0) { if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, still_degraded) && !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) break; BUG_ON(sync_blocks < (PAGE_SIZE>>9)); if ((len >> 9) > sync_blocks) len = sync_blocks<<9; } for (i = 0 ; i < conf->raid_disks * 2; i++) { bio = r1_bio->bios[i]; if (bio->bi_end_io) { page = bio->bi_io_vec[bio->bi_vcnt].bv_page; if (bio_add_page(bio, page, len, 0) == 0) { /* stop here */ bio->bi_io_vec[bio->bi_vcnt].bv_page = page; while (i > 0) { i--; bio = r1_bio->bios[i]; if (bio->bi_end_io==NULL) continue; /* remove last page from this bio */ bio->bi_vcnt--; bio->bi_size -= len; bio->bi_flags &= ~(1<< BIO_SEG_VALID); } goto bio_full; } } } nr_sectors += len>>9; sector_nr += len>>9; sync_blocks -= (len>>9); } while (r1_bio->bios[disk]->bi_vcnt < RESYNC_PAGES); bio_full: r1_bio->sectors = nr_sectors; /* For a user-requested sync, we read all readable devices and do a * compare */ if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { atomic_set(&r1_bio->remaining, read_targets); for (i = 0; i < conf->raid_disks * 2; i++) { bio = r1_bio->bios[i]; if (bio->bi_end_io == end_sync_read) { md_sync_acct(bio->bi_bdev, nr_sectors); generic_make_request(bio); } } } else { atomic_set(&r1_bio->remaining, 1); bio = r1_bio->bios[r1_bio->read_disk]; md_sync_acct(bio->bi_bdev, nr_sectors); generic_make_request(bio); } return nr_sectors; } static sector_t raid1_size(struct mddev *mddev, sector_t sectors, int raid_disks) { if (sectors) return sectors; return mddev->dev_sectors; } static struct r1conf *setup_conf(struct mddev *mddev) { struct r1conf *conf; int i; struct mirror_info *disk; struct md_rdev *rdev; int err = -ENOMEM; conf = kzalloc(sizeof(struct r1conf), GFP_KERNEL); if (!conf) goto abort; conf->mirrors = kzalloc(sizeof(struct mirror_info) * mddev->raid_disks * 2, GFP_KERNEL); if (!conf->mirrors) goto abort; conf->tmppage = alloc_page(GFP_KERNEL); if (!conf->tmppage) goto abort; conf->poolinfo = kzalloc(sizeof(*conf->poolinfo), GFP_KERNEL); if (!conf->poolinfo) goto abort; conf->poolinfo->raid_disks = mddev->raid_disks * 2; conf->r1bio_pool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, r1bio_pool_free, conf->poolinfo); if (!conf->r1bio_pool) goto abort; conf->poolinfo->mddev = mddev; err = -EINVAL; spin_lock_init(&conf->device_lock); rdev_for_each(rdev, mddev) { int disk_idx = rdev->raid_disk; if (disk_idx >= mddev->raid_disks || disk_idx < 0) continue; if (test_bit(Replacement, &rdev->flags)) disk = conf->mirrors + conf->raid_disks + disk_idx; else disk = conf->mirrors + disk_idx; if (disk->rdev) goto abort; disk->rdev = rdev; disk->head_position = 0; } conf->raid_disks = mddev->raid_disks; conf->mddev = mddev; INIT_LIST_HEAD(&conf->retry_list); spin_lock_init(&conf->resync_lock); init_waitqueue_head(&conf->wait_barrier); bio_list_init(&conf->pending_bio_list); conf->pending_count = 0; conf->recovery_disabled = mddev->recovery_disabled - 1; err = -EIO; conf->last_used = -1; for (i = 0; i < conf->raid_disks * 2; i++) { disk = conf->mirrors + i; if (i < conf->raid_disks && disk[conf->raid_disks].rdev) { /* This slot has a replacement. */ if (!disk->rdev) { /* No original, just make the replacement * a recovering spare */ disk->rdev = disk[conf->raid_disks].rdev; disk[conf->raid_disks].rdev = NULL; } else if (!test_bit(In_sync, &disk->rdev->flags)) /* Original is not in_sync - bad */ goto abort; } if (!disk->rdev || !test_bit(In_sync, &disk->rdev->flags)) { disk->head_position = 0; if (disk->rdev) conf->fullsync = 1; } else if (conf->last_used < 0) /* * The first working device is used as a * starting point to read balancing. */ conf->last_used = i; } if (conf->last_used < 0) { printk(KERN_ERR "md/raid1:%s: no operational mirrors\n", mdname(mddev)); goto abort; } err = -ENOMEM; conf->thread = md_register_thread(raid1d, mddev, NULL); if (!conf->thread) { printk(KERN_ERR "md/raid1:%s: couldn't allocate thread\n", mdname(mddev)); goto abort; } return conf; abort: if (conf) { if (conf->r1bio_pool) mempool_destroy(conf->r1bio_pool); kfree(conf->mirrors); safe_put_page(conf->tmppage); kfree(conf->poolinfo); kfree(conf); } return ERR_PTR(err); } static int stop(struct mddev *mddev); static int run(struct mddev *mddev) { struct r1conf *conf; int i; struct md_rdev *rdev; int ret; if (mddev->level != 1) { printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n", mdname(mddev), mddev->level); return -EIO; } if (mddev->reshape_position != MaxSector) { printk(KERN_ERR "md/raid1:%s: reshape_position set but not supported\n", mdname(mddev)); return -EIO; } /* * copy the already verified devices into our private RAID1 * bookkeeping area. [whatever we allocate in run(), * should be freed in stop()] */ if (mddev->private == NULL) conf = setup_conf(mddev); else conf = mddev->private; if (IS_ERR(conf)) return PTR_ERR(conf); rdev_for_each(rdev, mddev) { if (!mddev->gendisk) continue; disk_stack_limits(mddev->gendisk, rdev->bdev, rdev->data_offset << 9); } mddev->degraded = 0; for (i=0; i < conf->raid_disks; i++) if (conf->mirrors[i].rdev == NULL || !test_bit(In_sync, &conf->mirrors[i].rdev->flags) || test_bit(Faulty, &conf->mirrors[i].rdev->flags)) mddev->degraded++; if (conf->raid_disks - mddev->degraded == 1) mddev->recovery_cp = MaxSector; if (mddev->recovery_cp != MaxSector) printk(KERN_NOTICE "md/raid1:%s: not clean" " -- starting background reconstruction\n", mdname(mddev)); printk(KERN_INFO "md/raid1:%s: active with %d out of %d mirrors\n", mdname(mddev), mddev->raid_disks - mddev->degraded, mddev->raid_disks); /* * Ok, everything is just fine now */ mddev->thread = conf->thread; conf->thread = NULL; mddev->private = conf; md_set_array_sectors(mddev, raid1_size(mddev, 0, 0)); if (mddev->queue) { mddev->queue->backing_dev_info.congested_fn = raid1_congested; mddev->queue->backing_dev_info.congested_data = mddev; blk_queue_merge_bvec(mddev->queue, raid1_mergeable_bvec); } ret = md_integrity_register(mddev); if (ret) stop(mddev); return ret; } static int stop(struct mddev *mddev) { struct r1conf *conf = mddev->private; struct bitmap *bitmap = mddev->bitmap; /* wait for behind writes to complete */ if (bitmap && atomic_read(&bitmap->behind_writes) > 0) { printk(KERN_INFO "md/raid1:%s: behind writes in progress - waiting to stop.\n", mdname(mddev)); /* need to kick something here to make sure I/O goes? */ wait_event(bitmap->behind_wait, atomic_read(&bitmap->behind_writes) == 0); } raise_barrier(conf); lower_barrier(conf); md_unregister_thread(&mddev->thread); if (conf->r1bio_pool) mempool_destroy(conf->r1bio_pool); kfree(conf->mirrors); kfree(conf->poolinfo); kfree(conf); mddev->private = NULL; return 0; } static int raid1_resize(struct mddev *mddev, sector_t sectors) { /* no resync is happening, and there is enough space * on all devices, so we can resize. * We need to make sure resync covers any new space. * If the array is shrinking we should possibly wait until * any io in the removed space completes, but it hardly seems * worth it. */ md_set_array_sectors(mddev, raid1_size(mddev, sectors, 0)); if (mddev->array_sectors > raid1_size(mddev, sectors, 0)) return -EINVAL; set_capacity(mddev->gendisk, mddev->array_sectors); revalidate_disk(mddev->gendisk); if (sectors > mddev->dev_sectors && mddev->recovery_cp > mddev->dev_sectors) { mddev->recovery_cp = mddev->dev_sectors; set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); } mddev->dev_sectors = sectors; mddev->resync_max_sectors = sectors; return 0; } static int raid1_reshape(struct mddev *mddev) { /* We need to: * 1/ resize the r1bio_pool * 2/ resize conf->mirrors * * We allocate a new r1bio_pool if we can. * Then raise a device barrier and wait until all IO stops. * Then resize conf->mirrors and swap in the new r1bio pool. * * At the same time, we "pack" the devices so that all the missing * devices have the higher raid_disk numbers. */ mempool_t *newpool, *oldpool; struct pool_info *newpoolinfo; struct mirror_info *newmirrors; struct r1conf *conf = mddev->private; int cnt, raid_disks; unsigned long flags; int d, d2, err; /* Cannot change chunk_size, layout, or level */ if (mddev->chunk_sectors != mddev->new_chunk_sectors || mddev->layout != mddev->new_layout || mddev->level != mddev->new_level) { mddev->new_chunk_sectors = mddev->chunk_sectors; mddev->new_layout = mddev->layout; mddev->new_level = mddev->level; return -EINVAL; } err = md_allow_write(mddev); if (err) return err; raid_disks = mddev->raid_disks + mddev->delta_disks; if (raid_disks < conf->raid_disks) { cnt=0; for (d= 0; d < conf->raid_disks; d++) if (conf->mirrors[d].rdev) cnt++; if (cnt > raid_disks) return -EBUSY; } newpoolinfo = kmalloc(sizeof(*newpoolinfo), GFP_KERNEL); if (!newpoolinfo) return -ENOMEM; newpoolinfo->mddev = mddev; newpoolinfo->raid_disks = raid_disks * 2; newpool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, r1bio_pool_free, newpoolinfo); if (!newpool) { kfree(newpoolinfo); return -ENOMEM; } newmirrors = kzalloc(sizeof(struct mirror_info) * raid_disks * 2, GFP_KERNEL); if (!newmirrors) { kfree(newpoolinfo); mempool_destroy(newpool); return -ENOMEM; } raise_barrier(conf); /* ok, everything is stopped */ oldpool = conf->r1bio_pool; conf->r1bio_pool = newpool; for (d = d2 = 0; d < conf->raid_disks; d++) { struct md_rdev *rdev = conf->mirrors[d].rdev; if (rdev && rdev->raid_disk != d2) { sysfs_unlink_rdev(mddev, rdev); rdev->raid_disk = d2; sysfs_unlink_rdev(mddev, rdev); if (sysfs_link_rdev(mddev, rdev)) printk(KERN_WARNING "md/raid1:%s: cannot register rd%d\n", mdname(mddev), rdev->raid_disk); } if (rdev) newmirrors[d2++].rdev = rdev; } kfree(conf->mirrors); conf->mirrors = newmirrors; kfree(conf->poolinfo); conf->poolinfo = newpoolinfo; spin_lock_irqsave(&conf->device_lock, flags); mddev->degraded += (raid_disks - conf->raid_disks); spin_unlock_irqrestore(&conf->device_lock, flags); conf->raid_disks = mddev->raid_disks = raid_disks; mddev->delta_disks = 0; conf->last_used = 0; /* just make sure it is in-range */ lower_barrier(conf); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); mempool_destroy(oldpool); return 0; } static void raid1_quiesce(struct mddev *mddev, int state) { struct r1conf *conf = mddev->private; switch(state) { case 2: /* wake for suspend */ wake_up(&conf->wait_barrier); break; case 1: raise_barrier(conf); break; case 0: lower_barrier(conf); break; } } static void *raid1_takeover(struct mddev *mddev) { /* raid1 can take over: * raid5 with 2 devices, any layout or chunk size */ if (mddev->level == 5 && mddev->raid_disks == 2) { struct r1conf *conf; mddev->new_level = 1; mddev->new_layout = 0; mddev->new_chunk_sectors = 0; conf = setup_conf(mddev); if (!IS_ERR(conf)) conf->barrier = 1; return conf; } return ERR_PTR(-EINVAL); } static struct md_personality raid1_personality = { .name = "raid1", .level = 1, .owner = THIS_MODULE, .make_request = make_request, .run = run, .stop = stop, .status = status, .error_handler = error, .hot_add_disk = raid1_add_disk, .hot_remove_disk= raid1_remove_disk, .spare_active = raid1_spare_active, .sync_request = sync_request, .resize = raid1_resize, .size = raid1_size, .check_reshape = raid1_reshape, .quiesce = raid1_quiesce, .takeover = raid1_takeover, }; static int __init raid_init(void) { return register_md_personality(&raid1_personality); } static void raid_exit(void) { unregister_md_personality(&raid1_personality); } module_init(raid_init); module_exit(raid_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("RAID1 (mirroring) personality for MD"); MODULE_ALIAS("md-personality-3"); /* RAID1 */ MODULE_ALIAS("md-raid1"); MODULE_ALIAS("md-level-1"); module_param(max_queued_requests, int, S_IRUGO|S_IWUSR);
gpl-2.0
sunnyden/reactos
dll/win32/ws2_32/src/bhook.c
3310
/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS WinSock 2 API * FILE: dll/win32/ws2_32_new/src/bhook.c * PURPOSE: Blocking Hook support for 1.x clients * PROGRAMMER: Alex Ionescu ([email protected]) */ /* INCLUDES ******************************************************************/ #include <ws2_32.h> #define NDEBUG #include <debug.h> /* FUNCTIONS *****************************************************************/ /* * @implemented */ INT WSAAPI WSACancelBlockingCall(VOID) { PWSPROCESS Process; PWSTHREAD Thread; INT ErrorCode; DPRINT("WSACancelBlockingCall\n"); /* Call the prolog */ ErrorCode = WsApiProlog(&Process, &Thread); if (ErrorCode != ERROR_SUCCESS) { /* Fail */ SetLastError(ErrorCode); return SOCKET_ERROR; } /* Make sure this isn't a 2.2 client */ if (LOBYTE(Process->Version) >= 2) { /* Only valid for 1.x */ SetLastError(WSAEOPNOTSUPP); return SOCKET_ERROR; } /* Cancel the call */ ErrorCode = WsThreadCancelBlockingCall(Thread); if (ErrorCode != ERROR_SUCCESS) { /* Fail */ SetLastError(ErrorCode); return SOCKET_ERROR; } /* Return success */ return ERROR_SUCCESS; } /* * @implemented */ BOOL WSAAPI WSAIsBlocking(VOID) { PWSPROCESS Process; PWSTHREAD Thread; INT ErrorCode; DPRINT("WSAIsBlocking\n"); /* Call the prolog */ ErrorCode = WsApiProlog(&Process, &Thread); if (ErrorCode != ERROR_SUCCESS) { /* Fail unless its because we're busy */ if (ErrorCode != WSAEINPROGRESS) return FALSE; } /* Return the value from the thread */ return Thread->Blocking; } /* * @implemented */ FARPROC WSAAPI WSASetBlockingHook(IN FARPROC lpBlockFunc) { PWSPROCESS Process; PWSTHREAD Thread; INT ErrorCode; DPRINT("WSASetBlockingHook: %p\n", lpBlockFunc); /* Call the prolog */ ErrorCode = WsApiProlog(&Process, &Thread); if (ErrorCode != ERROR_SUCCESS) { /* Fail */ SetLastError(ErrorCode); return NULL; } /* Make sure this isn't a 2.2 client */ if (LOBYTE(Process->Version) >= 2) { /* Only valid for 1.x */ SetLastError(WSAEOPNOTSUPP); return NULL; } /* Make sure the pointer is safe */ if (IsBadCodePtr(lpBlockFunc)) { /* Invalid pointer */ SetLastError(WSAEFAULT); return NULL; } /* Set the blocking hook and return the previous one */ return WsThreadSetBlockingHook(Thread, lpBlockFunc); } /* * @implemented */ INT WSAAPI WSAUnhookBlockingHook(VOID) { PWSPROCESS Process; PWSTHREAD Thread; INT ErrorCode; DPRINT("WSAUnhookBlockingHook\n"); /* Call the prolog */ ErrorCode = WsApiProlog(&Process, &Thread); if (ErrorCode != ERROR_SUCCESS) { /* Fail */ SetLastError(ErrorCode); return SOCKET_ERROR; } /* Make sure this isn't a 2.2 client */ if (LOBYTE(Process->Version) >= 2) { /* Only valid for 1.x */ SetLastError(WSAEOPNOTSUPP); return SOCKET_ERROR; } /* Set the blocking hook and return the previous one */ return WsThreadUnhookBlockingHook(Thread); }
gpl-2.0
iegor/kdenetwork
kopete/plugins/smpppdcs/libsmpppdclient/smpppdunsettled.cpp
5200
/* smpppdunsettled.cpp Copyright (c) 2006 by Heiko Schaefer <[email protected]> Kopete (c) 2002-2006 by the Kopete developers <[email protected]> ************************************************************************* * * * 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; version 2 of the License. * * * ************************************************************************* */ #include <cstdlib> #include <openssl/md5.h> #include <qregexp.h> #include <kdebug.h> #include <kstreamsocket.h> #include "smpppdready.h" #include "smpppdunsettled.h" using namespace SMPPPD; Unsettled * Unsettled::m_instance = NULL; Unsettled::Unsettled() {} Unsettled::~Unsettled() {} Unsettled * Unsettled::instance() { if(!m_instance) { m_instance = new Unsettled(); } return m_instance; } bool Unsettled::connect(Client * client, const QString& server, uint port) { if(!socket(client) || socket(client)->state() != KNetwork::KStreamSocket::Connected || socket(client)->state() != KNetwork::KStreamSocket::Connecting) { QString resolvedServer = server; changeState(client, Ready::instance()); disconnect(client); // since a lookup on a non-existant host can take a lot of time we // try to get the IP of server before and we do the lookup ourself KNetwork::KResolver resolver(server); resolver.start(); if(resolver.wait(500)) { KNetwork::KResolverResults results = resolver.results(); if(!results.empty()) { QString ip = results[0].address().asInet().ipAddress().toString(); kdDebug(14312) << k_funcinfo << "Found IP-Address for " << server << ": " << ip << endl; resolvedServer = ip; } else { kdWarning(14312) << k_funcinfo << "No IP-Address found for " << server << endl; return false; } } else { kdWarning(14312) << k_funcinfo << "Looking up hostname timed out, consider to use IP or correct host" << endl; return false; } setSocket(client, new KNetwork::KStreamSocket(resolvedServer, QString::number(port))); socket(client)->setBlocking(TRUE); if(!socket(client)->connect()) { kdDebug(14312) << k_funcinfo << "Socket Error: " << KNetwork::KStreamSocket::errorString(socket(client)->error()) << endl; } else { kdDebug(14312) << k_funcinfo << "Successfully connected to smpppd \"" << server << ":" << port << "\"" << endl; static QString verRex = "^SuSE Meta pppd \\(smpppd\\), Version (.*)$"; static QString clgRex = "^challenge = (.*)$"; QRegExp ver(verRex); QRegExp clg(clgRex); QString response = read(client)[0]; if(response != QString::null && ver.exactMatch(response)) { setServerID(client, response); setServerVersion(client, ver.cap(1)); changeState(client, Ready::instance()); return true; } else if(response != QString::null && clg.exactMatch(response)) { if(password(client) != QString::null) { // we are challenged, ok, respond write(client, QString("response = %1\n").arg(make_response(clg.cap(1).stripWhiteSpace(), password(client))).latin1()); response = read(client)[0]; if(ver.exactMatch(response)) { setServerID(client, response); setServerVersion(client, ver.cap(1)); return true; } else { kdWarning(14312) << k_funcinfo << "SMPPPD responded: " << response << endl; changeState(client, Ready::instance()); disconnect(client); } } else { kdWarning(14312) << k_funcinfo << "SMPPPD requested a challenge, but no password was supplied!" << endl; changeState(client, Ready::instance()); disconnect(client); } } } } return false; } QString Unsettled::make_response(const QString& chex, const QString& password) const { int size = chex.length (); if (size & 1) return "error"; size >>= 1; // convert challenge from hex to bin QString cbin; for (int i = 0; i < size; i++) { QString tmp = chex.mid (2 * i, 2); cbin.append ((char) strtol (tmp.ascii (), 0, 16)); } // calculate response unsigned char rbin[MD5_DIGEST_LENGTH]; MD5state_st md5; MD5_Init (&md5); MD5_Update (&md5, cbin.ascii (), size); MD5_Update (&md5, password.ascii(), password.length ()); MD5_Final (rbin, &md5); // convert response from bin to hex QString rhex; for (int i = 0; i < MD5_DIGEST_LENGTH; i++) { char buffer[3]; snprintf (buffer, 3, "%02x", rbin[i]); rhex.append (buffer); } return rhex; }
gpl-2.0
joachimwieland/xcsoar-jwieland
src/Engine/Navigation/GeoPoint.cpp
2269
/* Copyright_License { XCSoar Glide Computer - http://www.xcsoar.org/ Copyright (C) 2000-2011 The XCSoar Project A detailed list of copyright holders can be found in the file "AUTHORS". 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. } */ #include "Navigation/GeoPoint.hpp" #include "Navigation/Geometry/GeoVector.hpp" #include "Math/Earth.hpp" GeoPoint GeoPoint::parametric(const GeoPoint &delta, const fixed t) const { return (*this) + delta * t; } GeoPoint GeoPoint::interpolate(const GeoPoint &end, const fixed t) const { return (*this) + (end - (*this)) * t; } fixed GeoPoint::distance(const GeoPoint &other) const { return ::Distance(*this, other); } Angle GeoPoint::bearing(const GeoPoint &other) const { return ::Bearing(*this, other); } GeoVector GeoPoint::distance_bearing(const GeoPoint &other) const { GeoVector gv; ::DistanceBearing(*this, other, &gv.Distance, &gv.Bearing); return gv; } fixed GeoPoint::projected_distance(const GeoPoint &from, const GeoPoint &to) const { return ::ProjectedDistance(from, to, *this); } bool GeoPoint::equals(const GeoPoint &other) const { return (Longitude == other.Longitude) && (Latitude == other.Latitude); } bool GeoPoint::sort(const GeoPoint &sp) const { if (Longitude < sp.Longitude) return false; else if (Longitude == sp.Longitude) return Latitude > sp.Latitude; else return true; } GeoPoint GeoPoint::intermediate_point(const GeoPoint &destination, const fixed distance) const { return ::IntermediatePoint(*this, destination, distance); }
gpl-2.0
ipwndev/DSLinux-Mirror
user/coreutils/src/lib/i-ring.c
1846
/* a simple ring buffer Copyright (C) 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* written by Jim Meyering */ #include <config.h> #include "i-ring.h" #include <stdlib.h> void i_ring_init (I_ring *ir, int default_val) { int i; ir->ir_empty = true; ir->ir_front = 0; ir->ir_back = 0; for (i = 0; i < I_RING_SIZE; i++) ir->ir_data[i] = default_val; ir->ir_default_val = default_val; } bool i_ring_empty (I_ring const *ir) { return ir->ir_empty; } int i_ring_push (I_ring *ir, int val) { unsigned int dest_idx = (ir->ir_front + !ir->ir_empty) % I_RING_SIZE; int old_val = ir->ir_data[dest_idx]; ir->ir_data[dest_idx] = val; ir->ir_front = dest_idx; if (dest_idx == ir->ir_back) ir->ir_back = (ir->ir_back + !ir->ir_empty) % I_RING_SIZE; ir->ir_empty = false; return old_val; } int i_ring_pop (I_ring *ir) { int top_val; if (i_ring_empty (ir)) abort (); top_val = ir->ir_data[ir->ir_front]; ir->ir_data[ir->ir_front] = ir->ir_default_val; if (ir->ir_front == ir->ir_back) ir->ir_empty = true; else ir->ir_front = ((ir->ir_front + I_RING_SIZE - 1) % I_RING_SIZE); return top_val; }
gpl-2.0
ipwndev/DSLinux-Mirror
user/picoc/tests/29_array_address.c
56
char a[10]; strcpy(a, "abcdef"); printf("%s\n", &a[1]);
gpl-2.0
ericogr/docker-mongodb-replica-shard-test
mongod/Dockerfile
430
FROM ubuntu:14.04.2 RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 RUN echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list # Instalar mongo RUN apt-get update RUN apt-get install -y mongodb-org # criar diretório de dados para o mongo RUN mkdir -p /data/db EXPOSE 27017 ENTRYPOINT ["usr/bin/mongod"]
gpl-2.0
mviitanen/marsmod
mcp/src/minecraft_server/net/minecraft/world/gen/structure/MapGenVillage.java
5468
package net.minecraft.world.gen.structure; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Map.Entry; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; public class MapGenVillage extends MapGenStructure { /** A list of all the biomes villages can spawn in. */ public static final List villageSpawnBiomes = Arrays.asList(new BiomeGenBase[] {BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.field_150588_X}); /** World terrain type, 0 for normal, 1 for flat map */ private int terrainType; private int field_82665_g; private int field_82666_h; private static final String __OBFID = "CL_00000514"; public MapGenVillage() { this.field_82665_g = 32; this.field_82666_h = 8; } public MapGenVillage(Map p_i2093_1_) { this(); Iterator var2 = p_i2093_1_.entrySet().iterator(); while (var2.hasNext()) { Entry var3 = (Entry)var2.next(); if (((String)var3.getKey()).equals("size")) { this.terrainType = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.terrainType, 0); } else if (((String)var3.getKey()).equals("distance")) { this.field_82665_g = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.field_82665_g, this.field_82666_h + 1); } } } public String func_143025_a() { return "Village"; } protected boolean canSpawnStructureAtCoords(int p_75047_1_, int p_75047_2_) { int var3 = p_75047_1_; int var4 = p_75047_2_; if (p_75047_1_ < 0) { p_75047_1_ -= this.field_82665_g - 1; } if (p_75047_2_ < 0) { p_75047_2_ -= this.field_82665_g - 1; } int var5 = p_75047_1_ / this.field_82665_g; int var6 = p_75047_2_ / this.field_82665_g; Random var7 = this.worldObj.setRandomSeed(var5, var6, 10387312); var5 *= this.field_82665_g; var6 *= this.field_82665_g; var5 += var7.nextInt(this.field_82665_g - this.field_82666_h); var6 += var7.nextInt(this.field_82665_g - this.field_82666_h); if (var3 == var5 && var4 == var6) { boolean var8 = this.worldObj.getWorldChunkManager().areBiomesViable(var3 * 16 + 8, var4 * 16 + 8, 0, villageSpawnBiomes); if (var8) { return true; } } return false; } protected StructureStart getStructureStart(int p_75049_1_, int p_75049_2_) { return new MapGenVillage.Start(this.worldObj, this.rand, p_75049_1_, p_75049_2_, this.terrainType); } public static class Start extends StructureStart { private boolean hasMoreThanTwoComponents; private static final String __OBFID = "CL_00000515"; public Start() {} public Start(World p_i2092_1_, Random p_i2092_2_, int p_i2092_3_, int p_i2092_4_, int p_i2092_5_) { super(p_i2092_3_, p_i2092_4_); List var6 = StructureVillagePieces.getStructureVillageWeightedPieceList(p_i2092_2_, p_i2092_5_); StructureVillagePieces.Start var7 = new StructureVillagePieces.Start(p_i2092_1_.getWorldChunkManager(), 0, p_i2092_2_, (p_i2092_3_ << 4) + 2, (p_i2092_4_ << 4) + 2, var6, p_i2092_5_); this.components.add(var7); var7.buildComponent(var7, this.components, p_i2092_2_); List var8 = var7.field_74930_j; List var9 = var7.field_74932_i; int var10; while (!var8.isEmpty() || !var9.isEmpty()) { StructureComponent var11; if (var8.isEmpty()) { var10 = p_i2092_2_.nextInt(var9.size()); var11 = (StructureComponent)var9.remove(var10); var11.buildComponent(var7, this.components, p_i2092_2_); } else { var10 = p_i2092_2_.nextInt(var8.size()); var11 = (StructureComponent)var8.remove(var10); var11.buildComponent(var7, this.components, p_i2092_2_); } } this.updateBoundingBox(); var10 = 0; Iterator var13 = this.components.iterator(); while (var13.hasNext()) { StructureComponent var12 = (StructureComponent)var13.next(); if (!(var12 instanceof StructureVillagePieces.Road)) { ++var10; } } this.hasMoreThanTwoComponents = var10 > 2; } public boolean isSizeableStructure() { return this.hasMoreThanTwoComponents; } public void func_143022_a(NBTTagCompound p_143022_1_) { super.func_143022_a(p_143022_1_); p_143022_1_.setBoolean("Valid", this.hasMoreThanTwoComponents); } public void func_143017_b(NBTTagCompound p_143017_1_) { super.func_143017_b(p_143017_1_); this.hasMoreThanTwoComponents = p_143017_1_.getBoolean("Valid"); } } }
gpl-2.0
jwebcat/git-contrib
builtin/branch.c
26811
/* * Builtin "git branch" * * Copyright (c) 2006 Kristian Høgsberg <[email protected]> * Based on git-branch.sh by Junio C Hamano. */ #include "cache.h" #include "color.h" #include "refs.h" #include "commit.h" #include "builtin.h" #include "remote.h" #include "parse-options.h" #include "branch.h" #include "diff.h" #include "revision.h" #include "string-list.h" #include "column.h" #include "utf8.h" static const char * const builtin_branch_usage[] = { N_("git branch [options] [-r | -a] [--merged | --no-merged]"), N_("git branch [options] [-l] [-f] <branchname> [<start-point>]"), N_("git branch [options] [-r] (-d | -D) <branchname>..."), N_("git branch [options] (-m | -M) [<oldbranch>] <newbranch>"), NULL }; #define REF_LOCAL_BRANCH 0x01 #define REF_REMOTE_BRANCH 0x02 static const char *head; static unsigned char head_sha1[20]; static int branch_use_color = -1; static char branch_colors[][COLOR_MAXLEN] = { GIT_COLOR_RESET, GIT_COLOR_NORMAL, /* PLAIN */ GIT_COLOR_RED, /* REMOTE */ GIT_COLOR_NORMAL, /* LOCAL */ GIT_COLOR_GREEN, /* CURRENT */ }; enum color_branch { BRANCH_COLOR_RESET = 0, BRANCH_COLOR_PLAIN = 1, BRANCH_COLOR_REMOTE = 2, BRANCH_COLOR_LOCAL = 3, BRANCH_COLOR_CURRENT = 4 }; static enum merge_filter { NO_FILTER = 0, SHOW_NOT_MERGED, SHOW_MERGED } merge_filter; static unsigned char merge_filter_ref[20]; static struct string_list output = STRING_LIST_INIT_DUP; static unsigned int colopts; static int parse_branch_color_slot(const char *var, int ofs) { if (!strcasecmp(var+ofs, "plain")) return BRANCH_COLOR_PLAIN; if (!strcasecmp(var+ofs, "reset")) return BRANCH_COLOR_RESET; if (!strcasecmp(var+ofs, "remote")) return BRANCH_COLOR_REMOTE; if (!strcasecmp(var+ofs, "local")) return BRANCH_COLOR_LOCAL; if (!strcasecmp(var+ofs, "current")) return BRANCH_COLOR_CURRENT; return -1; } static int git_branch_config(const char *var, const char *value, void *cb) { if (!prefixcmp(var, "column.")) return git_column_config(var, value, "branch", &colopts); if (!strcmp(var, "color.branch")) { branch_use_color = git_config_colorbool(var, value); return 0; } if (!prefixcmp(var, "color.branch.")) { int slot = parse_branch_color_slot(var, 13); if (slot < 0) return 0; if (!value) return config_error_nonbool(var); color_parse(value, var, branch_colors[slot]); return 0; } return git_color_default_config(var, value, cb); } static const char *branch_get_color(enum color_branch ix) { if (want_color(branch_use_color)) return branch_colors[ix]; return ""; } static int branch_merged(int kind, const char *name, struct commit *rev, struct commit *head_rev) { /* * This checks whether the merge bases of branch and HEAD (or * the other branch this branch builds upon) contains the * branch, which means that the branch has already been merged * safely to HEAD (or the other branch). */ struct commit *reference_rev = NULL; const char *reference_name = NULL; void *reference_name_to_free = NULL; int merged; if (kind == REF_LOCAL_BRANCH) { struct branch *branch = branch_get(name); unsigned char sha1[20]; if (branch && branch->merge && branch->merge[0] && branch->merge[0]->dst && (reference_name = reference_name_to_free = resolve_refdup(branch->merge[0]->dst, sha1, 1, NULL)) != NULL) reference_rev = lookup_commit_reference(sha1); } if (!reference_rev) reference_rev = head_rev; merged = in_merge_bases(rev, reference_rev); /* * After the safety valve is fully redefined to "check with * upstream, if any, otherwise with HEAD", we should just * return the result of the in_merge_bases() above without * any of the following code, but during the transition period, * a gentle reminder is in order. */ if ((head_rev != reference_rev) && in_merge_bases(rev, head_rev) != merged) { if (merged) warning(_("deleting branch '%s' that has been merged to\n" " '%s', but not yet merged to HEAD."), name, reference_name); else warning(_("not deleting branch '%s' that is not yet merged to\n" " '%s', even though it is merged to HEAD."), name, reference_name); } free(reference_name_to_free); return merged; } static int check_branch_commit(const char *branchname, const char *refname, unsigned char *sha1, struct commit *head_rev, int kinds, int force) { struct commit *rev = lookup_commit_reference(sha1); if (!rev) { error(_("Couldn't look up commit object for '%s'"), refname); return -1; } if (!force && !branch_merged(kinds, branchname, rev, head_rev)) { error(_("The branch '%s' is not fully merged.\n" "If you are sure you want to delete it, " "run 'git branch -D %s'."), branchname, branchname); return -1; } return 0; } static void delete_branch_config(const char *branchname) { struct strbuf buf = STRBUF_INIT; strbuf_addf(&buf, "branch.%s", branchname); if (git_config_rename_section(buf.buf, NULL) < 0) warning(_("Update of config-file failed")); strbuf_release(&buf); } static int delete_branches(int argc, const char **argv, int force, int kinds, int quiet) { struct commit *head_rev = NULL; unsigned char sha1[20]; char *name = NULL; const char *fmt; int i; int ret = 0; int remote_branch = 0; struct strbuf bname = STRBUF_INIT; switch (kinds) { case REF_REMOTE_BRANCH: fmt = "refs/remotes/%s"; /* For subsequent UI messages */ remote_branch = 1; force = 1; break; case REF_LOCAL_BRANCH: fmt = "refs/heads/%s"; break; default: die(_("cannot use -a with -d")); } if (!force) { head_rev = lookup_commit_reference(head_sha1); if (!head_rev) die(_("Couldn't look up commit object for HEAD")); } for (i = 0; i < argc; i++, strbuf_release(&bname)) { const char *target; int flags = 0; strbuf_branchname(&bname, argv[i]); if (kinds == REF_LOCAL_BRANCH && !strcmp(head, bname.buf)) { error(_("Cannot delete the branch '%s' " "which you are currently on."), bname.buf); ret = 1; continue; } free(name); name = mkpathdup(fmt, bname.buf); target = resolve_ref_unsafe(name, sha1, 0, &flags); if (!target || (!(flags & REF_ISSYMREF) && is_null_sha1(sha1))) { error(remote_branch ? _("remote branch '%s' not found.") : _("branch '%s' not found."), bname.buf); ret = 1; continue; } if (!(flags & REF_ISSYMREF) && check_branch_commit(bname.buf, name, sha1, head_rev, kinds, force)) { ret = 1; continue; } if (delete_ref(name, sha1, REF_NODEREF)) { error(remote_branch ? _("Error deleting remote branch '%s'") : _("Error deleting branch '%s'"), bname.buf); ret = 1; continue; } if (!quiet) { printf(remote_branch ? _("Deleted remote branch %s (was %s).\n") : _("Deleted branch %s (was %s).\n"), bname.buf, (flags & REF_ISSYMREF) ? target : find_unique_abbrev(sha1, DEFAULT_ABBREV)); } delete_branch_config(bname.buf); } free(name); return(ret); } struct ref_item { char *name; char *dest; unsigned int kind, width; struct commit *commit; }; struct ref_list { struct rev_info revs; int index, alloc, maxwidth, verbose, abbrev; struct ref_item *list; struct commit_list *with_commit; int kinds; }; static char *resolve_symref(const char *src, const char *prefix) { unsigned char sha1[20]; int flag; const char *dst, *cp; dst = resolve_ref_unsafe(src, sha1, 0, &flag); if (!(dst && (flag & REF_ISSYMREF))) return NULL; if (prefix && (cp = skip_prefix(dst, prefix))) dst = cp; return xstrdup(dst); } struct append_ref_cb { struct ref_list *ref_list; const char **pattern; int ret; }; static int match_patterns(const char **pattern, const char *refname) { if (!*pattern) return 1; /* no pattern always matches */ while (*pattern) { if (!fnmatch(*pattern, refname, 0)) return 1; pattern++; } return 0; } static int append_ref(const char *refname, const unsigned char *sha1, int flags, void *cb_data) { struct append_ref_cb *cb = (struct append_ref_cb *)(cb_data); struct ref_list *ref_list = cb->ref_list; struct ref_item *newitem; struct commit *commit; int kind, i; const char *prefix, *orig_refname = refname; static struct { int kind; const char *prefix; int pfxlen; } ref_kind[] = { { REF_LOCAL_BRANCH, "refs/heads/", 11 }, { REF_REMOTE_BRANCH, "refs/remotes/", 13 }, }; /* Detect kind */ for (i = 0; i < ARRAY_SIZE(ref_kind); i++) { prefix = ref_kind[i].prefix; if (strncmp(refname, prefix, ref_kind[i].pfxlen)) continue; kind = ref_kind[i].kind; refname += ref_kind[i].pfxlen; break; } if (ARRAY_SIZE(ref_kind) <= i) return 0; /* Don't add types the caller doesn't want */ if ((kind & ref_list->kinds) == 0) return 0; if (!match_patterns(cb->pattern, refname)) return 0; commit = NULL; if (ref_list->verbose || ref_list->with_commit || merge_filter != NO_FILTER) { commit = lookup_commit_reference_gently(sha1, 1); if (!commit) { cb->ret = error(_("branch '%s' does not point at a commit"), refname); return 0; } /* Filter with with_commit if specified */ if (!is_descendant_of(commit, ref_list->with_commit)) return 0; if (merge_filter != NO_FILTER) add_pending_object(&ref_list->revs, (struct object *)commit, refname); } ALLOC_GROW(ref_list->list, ref_list->index + 1, ref_list->alloc); /* Record the new item */ newitem = &(ref_list->list[ref_list->index++]); newitem->name = xstrdup(refname); newitem->kind = kind; newitem->commit = commit; newitem->width = utf8_strwidth(refname); newitem->dest = resolve_symref(orig_refname, prefix); /* adjust for "remotes/" */ if (newitem->kind == REF_REMOTE_BRANCH && ref_list->kinds != REF_REMOTE_BRANCH) newitem->width += 8; if (newitem->width > ref_list->maxwidth) ref_list->maxwidth = newitem->width; return 0; } static void free_ref_list(struct ref_list *ref_list) { int i; for (i = 0; i < ref_list->index; i++) { free(ref_list->list[i].name); free(ref_list->list[i].dest); } free(ref_list->list); } static int ref_cmp(const void *r1, const void *r2) { struct ref_item *c1 = (struct ref_item *)(r1); struct ref_item *c2 = (struct ref_item *)(r2); if (c1->kind != c2->kind) return c1->kind - c2->kind; return strcmp(c1->name, c2->name); } static void fill_tracking_info(struct strbuf *stat, const char *branch_name, int show_upstream_ref) { int ours, theirs; char *ref = NULL; struct branch *branch = branch_get(branch_name); if (!stat_tracking_info(branch, &ours, &theirs)) { if (branch && branch->merge && branch->merge[0]->dst && show_upstream_ref) strbuf_addf(stat, "[%s] ", shorten_unambiguous_ref(branch->merge[0]->dst, 0)); return; } if (show_upstream_ref) ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0); if (!ours) { if (ref) strbuf_addf(stat, _("[%s: behind %d]"), ref, theirs); else strbuf_addf(stat, _("[behind %d]"), theirs); } else if (!theirs) { if (ref) strbuf_addf(stat, _("[%s: ahead %d]"), ref, ours); else strbuf_addf(stat, _("[ahead %d]"), ours); } else { if (ref) strbuf_addf(stat, _("[%s: ahead %d, behind %d]"), ref, ours, theirs); else strbuf_addf(stat, _("[ahead %d, behind %d]"), ours, theirs); } strbuf_addch(stat, ' '); free(ref); } static int matches_merge_filter(struct commit *commit) { int is_merged; if (merge_filter == NO_FILTER) return 1; is_merged = !!(commit->object.flags & UNINTERESTING); return (is_merged == (merge_filter == SHOW_MERGED)); } static void add_verbose_info(struct strbuf *out, struct ref_item *item, int verbose, int abbrev) { struct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT; const char *sub = _(" **** invalid ref ****"); struct commit *commit = item->commit; if (commit && !parse_commit(commit)) { pp_commit_easy(CMIT_FMT_ONELINE, commit, &subject); sub = subject.buf; } if (item->kind == REF_LOCAL_BRANCH) fill_tracking_info(&stat, item->name, verbose > 1); strbuf_addf(out, " %s %s%s", find_unique_abbrev(item->commit->object.sha1, abbrev), stat.buf, sub); strbuf_release(&stat); strbuf_release(&subject); } static void print_ref_item(struct ref_item *item, int maxwidth, int verbose, int abbrev, int current, char *prefix) { char c; int color; struct commit *commit = item->commit; struct strbuf out = STRBUF_INIT, name = STRBUF_INIT; if (!matches_merge_filter(commit)) return; switch (item->kind) { case REF_LOCAL_BRANCH: color = BRANCH_COLOR_LOCAL; break; case REF_REMOTE_BRANCH: color = BRANCH_COLOR_REMOTE; break; default: color = BRANCH_COLOR_PLAIN; break; } c = ' '; if (current) { c = '*'; color = BRANCH_COLOR_CURRENT; } strbuf_addf(&name, "%s%s", prefix, item->name); if (verbose) { int utf8_compensation = strlen(name.buf) - utf8_strwidth(name.buf); strbuf_addf(&out, "%c %s%-*s%s", c, branch_get_color(color), maxwidth + utf8_compensation, name.buf, branch_get_color(BRANCH_COLOR_RESET)); } else strbuf_addf(&out, "%c %s%s%s", c, branch_get_color(color), name.buf, branch_get_color(BRANCH_COLOR_RESET)); if (item->dest) strbuf_addf(&out, " -> %s", item->dest); else if (verbose) /* " f7c0c00 [ahead 58, behind 197] vcs-svn: drop obj_pool.h" */ add_verbose_info(&out, item, verbose, abbrev); if (column_active(colopts)) { assert(!verbose && "--column and --verbose are incompatible"); string_list_append(&output, out.buf); } else { printf("%s\n", out.buf); } strbuf_release(&name); strbuf_release(&out); } static int calc_maxwidth(struct ref_list *refs) { int i, w = 0; for (i = 0; i < refs->index; i++) { if (!matches_merge_filter(refs->list[i].commit)) continue; if (refs->list[i].width > w) w = refs->list[i].width; } return w; } static void show_detached(struct ref_list *ref_list) { struct commit *head_commit = lookup_commit_reference_gently(head_sha1, 1); if (head_commit && is_descendant_of(head_commit, ref_list->with_commit)) { struct ref_item item; item.name = xstrdup(_("(no branch)")); item.width = utf8_strwidth(item.name); item.kind = REF_LOCAL_BRANCH; item.dest = NULL; item.commit = head_commit; if (item.width > ref_list->maxwidth) ref_list->maxwidth = item.width; print_ref_item(&item, ref_list->maxwidth, ref_list->verbose, ref_list->abbrev, 1, ""); free(item.name); } } static int print_ref_list(int kinds, int detached, int verbose, int abbrev, struct commit_list *with_commit, const char **pattern) { int i; struct append_ref_cb cb; struct ref_list ref_list; memset(&ref_list, 0, sizeof(ref_list)); ref_list.kinds = kinds; ref_list.verbose = verbose; ref_list.abbrev = abbrev; ref_list.with_commit = with_commit; if (merge_filter != NO_FILTER) init_revisions(&ref_list.revs, NULL); cb.ref_list = &ref_list; cb.pattern = pattern; cb.ret = 0; for_each_rawref(append_ref, &cb); if (merge_filter != NO_FILTER) { struct commit *filter; filter = lookup_commit_reference_gently(merge_filter_ref, 0); if (!filter) die(_("object '%s' does not point to a commit"), sha1_to_hex(merge_filter_ref)); filter->object.flags |= UNINTERESTING; add_pending_object(&ref_list.revs, (struct object *) filter, ""); ref_list.revs.limited = 1; prepare_revision_walk(&ref_list.revs); if (verbose) ref_list.maxwidth = calc_maxwidth(&ref_list); } qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp); detached = (detached && (kinds & REF_LOCAL_BRANCH)); if (detached && match_patterns(pattern, "HEAD")) show_detached(&ref_list); for (i = 0; i < ref_list.index; i++) { int current = !detached && (ref_list.list[i].kind == REF_LOCAL_BRANCH) && !strcmp(ref_list.list[i].name, head); char *prefix = (kinds != REF_REMOTE_BRANCH && ref_list.list[i].kind == REF_REMOTE_BRANCH) ? "remotes/" : ""; print_ref_item(&ref_list.list[i], ref_list.maxwidth, verbose, abbrev, current, prefix); } free_ref_list(&ref_list); if (cb.ret) error(_("some refs could not be read")); return cb.ret; } static void rename_branch(const char *oldname, const char *newname, int force) { struct strbuf oldref = STRBUF_INIT, newref = STRBUF_INIT, logmsg = STRBUF_INIT; struct strbuf oldsection = STRBUF_INIT, newsection = STRBUF_INIT; int recovery = 0; int clobber_head_ok; if (!oldname) die(_("cannot rename the current branch while not on any.")); if (strbuf_check_branch_ref(&oldref, oldname)) { /* * Bad name --- this could be an attempt to rename a * ref that we used to allow to be created by accident. */ if (ref_exists(oldref.buf)) recovery = 1; else die(_("Invalid branch name: '%s'"), oldname); } /* * A command like "git branch -M currentbranch currentbranch" cannot * cause the worktree to become inconsistent with HEAD, so allow it. */ clobber_head_ok = !strcmp(oldname, newname); validate_new_branchname(newname, &newref, force, clobber_head_ok); strbuf_addf(&logmsg, "Branch: renamed %s to %s", oldref.buf, newref.buf); if (rename_ref(oldref.buf, newref.buf, logmsg.buf)) die(_("Branch rename failed")); strbuf_release(&logmsg); if (recovery) warning(_("Renamed a misnamed branch '%s' away"), oldref.buf + 11); /* no need to pass logmsg here as HEAD didn't really move */ if (!strcmp(oldname, head) && create_symref("HEAD", newref.buf, NULL)) die(_("Branch renamed to %s, but HEAD is not updated!"), newname); strbuf_addf(&oldsection, "branch.%s", oldref.buf + 11); strbuf_release(&oldref); strbuf_addf(&newsection, "branch.%s", newref.buf + 11); strbuf_release(&newref); if (git_config_rename_section(oldsection.buf, newsection.buf) < 0) die(_("Branch is renamed, but update of config-file failed")); strbuf_release(&oldsection); strbuf_release(&newsection); } static int opt_parse_merge_filter(const struct option *opt, const char *arg, int unset) { merge_filter = ((opt->long_name[0] == 'n') ? SHOW_NOT_MERGED : SHOW_MERGED); if (unset) merge_filter = SHOW_NOT_MERGED; /* b/c for --no-merged */ if (!arg) arg = "HEAD"; if (get_sha1(arg, merge_filter_ref)) die(_("malformed object name %s"), arg); return 0; } static const char edit_description[] = "BRANCH_DESCRIPTION"; static int edit_branch_description(const char *branch_name) { FILE *fp; int status; struct strbuf buf = STRBUF_INIT; struct strbuf name = STRBUF_INIT; read_branch_desc(&buf, branch_name); if (!buf.len || buf.buf[buf.len-1] != '\n') strbuf_addch(&buf, '\n'); strbuf_commented_addf(&buf, "Please edit the description for the branch\n" " %s\n" "Lines starting with '%c' will be stripped.\n", branch_name, comment_line_char); fp = fopen(git_path(edit_description), "w"); if ((fwrite(buf.buf, 1, buf.len, fp) < buf.len) || fclose(fp)) { strbuf_release(&buf); return error(_("could not write branch description template: %s"), strerror(errno)); } strbuf_reset(&buf); if (launch_editor(git_path(edit_description), &buf, NULL)) { strbuf_release(&buf); return -1; } stripspace(&buf, 1); strbuf_addf(&name, "branch.%s.description", branch_name); status = git_config_set(name.buf, buf.len ? buf.buf : NULL); strbuf_release(&name); strbuf_release(&buf); return status; } int cmd_branch(int argc, const char **argv, const char *prefix) { int delete = 0, rename = 0, force_create = 0, list = 0; int verbose = 0, abbrev = -1, detached = 0; int reflog = 0, edit_description = 0; int quiet = 0, unset_upstream = 0; const char *new_upstream = NULL; enum branch_track track; int kinds = REF_LOCAL_BRANCH; struct commit_list *with_commit = NULL; struct option options[] = { OPT_GROUP(N_("Generic options")), OPT__VERBOSE(&verbose, N_("show hash and subject, give twice for upstream branch")), OPT__QUIET(&quiet, N_("suppress informational messages")), OPT_SET_INT('t', "track", &track, N_("set up tracking mode (see git-pull(1))"), BRANCH_TRACK_EXPLICIT), OPT_SET_INT( 0, "set-upstream", &track, N_("change upstream info"), BRANCH_TRACK_OVERRIDE), OPT_STRING('u', "set-upstream-to", &new_upstream, "upstream", "change the upstream info"), OPT_BOOLEAN(0, "unset-upstream", &unset_upstream, "Unset the upstream info"), OPT__COLOR(&branch_use_color, N_("use colored output")), OPT_SET_INT('r', "remotes", &kinds, N_("act on remote-tracking branches"), REF_REMOTE_BRANCH), { OPTION_CALLBACK, 0, "contains", &with_commit, N_("commit"), N_("print only branches that contain the commit"), PARSE_OPT_LASTARG_DEFAULT, parse_opt_with_commit, (intptr_t)"HEAD", }, { OPTION_CALLBACK, 0, "with", &with_commit, N_("commit"), N_("print only branches that contain the commit"), PARSE_OPT_HIDDEN | PARSE_OPT_LASTARG_DEFAULT, parse_opt_with_commit, (intptr_t) "HEAD", }, OPT__ABBREV(&abbrev), OPT_GROUP(N_("Specific git-branch actions:")), OPT_SET_INT('a', "all", &kinds, N_("list both remote-tracking and local branches"), REF_REMOTE_BRANCH | REF_LOCAL_BRANCH), OPT_BIT('d', "delete", &delete, N_("delete fully merged branch"), 1), OPT_BIT('D', NULL, &delete, N_("delete branch (even if not merged)"), 2), OPT_BIT('m', "move", &rename, N_("move/rename a branch and its reflog"), 1), OPT_BIT('M', NULL, &rename, N_("move/rename a branch, even if target exists"), 2), OPT_BOOLEAN(0, "list", &list, N_("list branch names")), OPT_BOOLEAN('l', "create-reflog", &reflog, N_("create the branch's reflog")), OPT_BOOLEAN(0, "edit-description", &edit_description, N_("edit the description for the branch")), OPT__FORCE(&force_create, N_("force creation (when already exists)")), { OPTION_CALLBACK, 0, "no-merged", &merge_filter_ref, N_("commit"), N_("print only not merged branches"), PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NONEG, opt_parse_merge_filter, (intptr_t) "HEAD", }, { OPTION_CALLBACK, 0, "merged", &merge_filter_ref, N_("commit"), N_("print only merged branches"), PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NONEG, opt_parse_merge_filter, (intptr_t) "HEAD", }, OPT_COLUMN(0, "column", &colopts, N_("list branches in columns")), OPT_END(), }; if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_branch_usage, options); git_config(git_branch_config, NULL); track = git_branch_track; head = resolve_refdup("HEAD", head_sha1, 0, NULL); if (!head) die(_("Failed to resolve HEAD as a valid ref.")); if (!strcmp(head, "HEAD")) { detached = 1; } else { if (prefixcmp(head, "refs/heads/")) die(_("HEAD not found below refs/heads!")); head += 11; } hashcpy(merge_filter_ref, head_sha1); argc = parse_options(argc, argv, prefix, options, builtin_branch_usage, 0); if (!delete && !rename && !edit_description && !new_upstream && !unset_upstream && argc == 0) list = 1; if (with_commit || merge_filter != NO_FILTER) list = 1; if (!!delete + !!rename + !!force_create + !!list + !!new_upstream + !!unset_upstream > 1) usage_with_options(builtin_branch_usage, options); if (abbrev == -1) abbrev = DEFAULT_ABBREV; finalize_colopts(&colopts, -1); if (verbose) { if (explicitly_enable_column(colopts)) die(_("--column and --verbose are incompatible")); colopts = 0; } if (delete) { if (!argc) die(_("branch name required")); return delete_branches(argc, argv, delete > 1, kinds, quiet); } else if (list) { int ret = print_ref_list(kinds, detached, verbose, abbrev, with_commit, argv); print_columns(&output, colopts, NULL); string_list_clear(&output, 0); return ret; } else if (edit_description) { const char *branch_name; struct strbuf branch_ref = STRBUF_INIT; if (!argc) { if (detached) die(_("Cannot give description to detached HEAD")); branch_name = head; } else if (argc == 1) branch_name = argv[0]; else die(_("cannot edit description of more than one branch")); strbuf_addf(&branch_ref, "refs/heads/%s", branch_name); if (!ref_exists(branch_ref.buf)) { strbuf_release(&branch_ref); if (!argc) return error(_("No commit on branch '%s' yet."), branch_name); else return error(_("No branch named '%s'."), branch_name); } strbuf_release(&branch_ref); if (edit_branch_description(branch_name)) return 1; } else if (rename) { if (argc == 1) rename_branch(head, argv[0], rename > 1); else if (argc == 2) rename_branch(argv[0], argv[1], rename > 1); else die(_("too many branches for a rename operation")); } else if (new_upstream) { struct branch *branch = branch_get(argv[0]); if (!ref_exists(branch->refname)) die(_("branch '%s' does not exist"), branch->name); /* * create_branch takes care of setting up the tracking * info and making sure new_upstream is correct */ create_branch(head, branch->name, new_upstream, 0, 0, 0, quiet, BRANCH_TRACK_OVERRIDE); } else if (unset_upstream) { struct branch *branch = branch_get(argv[0]); struct strbuf buf = STRBUF_INIT; if (!branch_has_merge_config(branch)) { die(_("Branch '%s' has no upstream information"), branch->name); } strbuf_addf(&buf, "branch.%s.remote", branch->name); git_config_set_multivar(buf.buf, NULL, NULL, 1); strbuf_reset(&buf); strbuf_addf(&buf, "branch.%s.merge", branch->name); git_config_set_multivar(buf.buf, NULL, NULL, 1); strbuf_release(&buf); } else if (argc > 0 && argc <= 2) { struct branch *branch = branch_get(argv[0]); int branch_existed = 0, remote_tracking = 0; struct strbuf buf = STRBUF_INIT; if (kinds != REF_LOCAL_BRANCH) die(_("-a and -r options to 'git branch' do not make sense with a branch name")); if (track == BRANCH_TRACK_OVERRIDE) fprintf(stderr, _("The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to\n")); strbuf_addf(&buf, "refs/remotes/%s", branch->name); remote_tracking = ref_exists(buf.buf); strbuf_release(&buf); branch_existed = ref_exists(branch->refname); create_branch(head, argv[0], (argc == 2) ? argv[1] : head, force_create, reflog, 0, quiet, track); /* * We only show the instructions if the user gave us * one branch which doesn't exist locally, but is the * name of a remote-tracking branch. */ if (argc == 1 && track == BRANCH_TRACK_OVERRIDE && !branch_existed && remote_tracking) { fprintf(stderr, _("\nIf you wanted to make '%s' track '%s', do this:\n\n"), head, branch->name); fprintf(stderr, _(" git branch -d %s\n"), branch->name); fprintf(stderr, _(" git branch --set-upstream-to %s\n"), branch->name); } } else usage_with_options(builtin_branch_usage, options); return 0; }
gpl-2.0
poondog/kangaroo-m7-mkIII
include/linux/mfd/pm8xxx/misc.h
3783
/* * Copyright (c) 2011-2012, The Linux Foundation. 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 version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __MFD_PM8XXX_MISC_H__ #define __MFD_PM8XXX_MISC_H__ #include <linux/err.h> #define PM8XXX_MISC_DEV_NAME "pm8xxx-misc" struct pm8xxx_misc_platform_data { int priority; }; enum pm8xxx_uart_path_sel { UART_NONE, UART_TX1_RX1, UART_TX2_RX2, UART_TX3_RX3, }; enum pm8xxx_coincell_chg_voltage { PM8XXX_COINCELL_VOLTAGE_3p2V = 1, PM8XXX_COINCELL_VOLTAGE_3p1V, PM8XXX_COINCELL_VOLTAGE_3p0V, PM8XXX_COINCELL_VOLTAGE_2p5V = 16 }; enum pm8xxx_coincell_chg_resistor { PM8XXX_COINCELL_RESISTOR_2100_OHMS, PM8XXX_COINCELL_RESISTOR_1700_OHMS, PM8XXX_COINCELL_RESISTOR_1200_OHMS, PM8XXX_COINCELL_RESISTOR_800_OHMS }; enum pm8xxx_coincell_chg_state { PM8XXX_COINCELL_CHG_DISABLE, PM8XXX_COINCELL_CHG_ENABLE }; struct pm8xxx_coincell_chg { enum pm8xxx_coincell_chg_state state; enum pm8xxx_coincell_chg_voltage voltage; enum pm8xxx_coincell_chg_resistor resistor; }; enum pm8xxx_smpl_delay { PM8XXX_SMPL_DELAY_0p5, PM8XXX_SMPL_DELAY_1p0, PM8XXX_SMPL_DELAY_1p5, PM8XXX_SMPL_DELAY_2p0, }; enum pm8xxx_pon_config { PM8XXX_DISABLE_HARD_RESET = 0, PM8XXX_SHUTDOWN_ON_HARD_RESET, PM8XXX_RESTART_ON_HARD_RESET, }; enum pm8xxx_aux_clk_id { CLK_MP3_1, CLK_MP3_2, }; enum pm8xxx_aux_clk_div { XO_DIV_NONE, XO_DIV_1, XO_DIV_2, XO_DIV_4, XO_DIV_8, XO_DIV_16, XO_DIV_32, XO_DIV_64, }; enum pm8xxx_hsed_bias { PM8XXX_HSED_BIAS0, PM8XXX_HSED_BIAS1, PM8XXX_HSED_BIAS2, }; #if defined(CONFIG_MFD_PM8XXX_MISC) || defined(CONFIG_MFD_PM8XXX_MISC_MODULE) int pm8xxx_reset_pwr_off(int reset); int pm8xxx_uart_gpio_mux_ctrl(enum pm8xxx_uart_path_sel uart_path_sel); int pm8xxx_coincell_chg_config(struct pm8xxx_coincell_chg *chg_config); int pm8xxx_smpl_control(int enable); int pm8xxx_smpl_set_delay(enum pm8xxx_smpl_delay delay); int pm8xxx_watchdog_reset_control(int enable); int pm8xxx_hard_reset_config(enum pm8xxx_pon_config config); int pm8xxx_stay_on(void); int pm8xxx_preload_dVdd(void); int pm8xxx_usb_id_pullup(int enable); int pm8xxx_aux_clk_control(enum pm8xxx_aux_clk_id clk_id, enum pm8xxx_aux_clk_div divider, bool enable); int pm8xxx_hsed_bias_control(enum pm8xxx_hsed_bias bias, bool enable); #else static inline int pm8xxx_reset_pwr_off(int reset) { return -ENODEV; } static inline int pm8xxx_uart_gpio_mux_ctrl(enum pm8xxx_uart_path_sel uart_path_sel) { return -ENODEV; } static inline int pm8xxx_coincell_chg_config(struct pm8xxx_coincell_chg *chg_config) { return -ENODEV; } static inline int pm8xxx_smpl_set_delay(enum pm8xxx_smpl_delay delay) { return -ENODEV; } static inline int pm8xxx_smpl_control(int enable) { return -ENODEV; } static inline int pm8xxx_watchdog_reset_control(int enable) { return -ENODEV; } static inline int pm8xxx_hard_reset_config(enum pm8xxx_pon_config config) { return -ENODEV; } static inline int pm8xxx_stay_on(void) { return -ENODEV; } static inline int pm8xxx_preload_dVdd(void) { return -ENODEV; } static inline int pm8xxx_usb_id_pullup(int enable) { return -ENODEV; } static inline int pm8xxx_aux_clk_control(enum pm8xxx_aux_clk_id clk_id, enum pm8xxx_aux_clk_div divider, bool enable) { return -ENODEV; } static inline int pm8xxx_hsed_bias_control(enum pm8xxx_hsed_bias bias, bool enable) { return -ENODEV; } #endif #endif
gpl-2.0
sschiesser/ASK_server
MacOSX10.6/System/Library/Frameworks/WebKit.framework/Versions/A/Headers/DOMHTMLAnchorElement.h
2747
/* * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <[email protected]> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <WebKit/DOMHTMLElement.h> #if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3 @class NSString; @class NSURL; @interface DOMHTMLAnchorElement : DOMHTMLElement @property(copy) NSString *accessKey; @property(copy) NSString *charset; @property(copy) NSString *coords; @property(copy) NSString *href; @property(copy) NSString *hreflang; @property(copy) NSString *name; @property(copy) NSString *rel; @property(copy) NSString *rev; @property(copy) NSString *shape; @property(copy) NSString *target; @property(copy) NSString *type; @property(readonly, copy) NSString *hashName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; @property(readonly, copy) NSString *host AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; @property(readonly, copy) NSString *hostname AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; @property(readonly, copy) NSString *pathname AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; @property(readonly, copy) NSString *port AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; @property(readonly, copy) NSString *protocol AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; @property(readonly, copy) NSString *search AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; @property(readonly, copy) NSString *text AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; @property(readonly, copy) NSURL *absoluteLinkURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; @end #endif
gpl-2.0
ENG-SYSTEMS/Kob-Eye
Skins/Axenergie/Modules/Default/formChildren.md
3692
[!OngletNum+=1!] [OBJ [!O::Module!]|[!Enf::objectName!]|E] [!E::setView()!] [IF [!E::Interface!]=FormDetail] [!container:=!] [!interface:=FormDetail.json!] [ELSE] [!container:="containerID":"tabNav"!] [IF [!E::Interface!]][!interface:=[!E::Interface!].json!][ELSE][!interface:=FormBase.json!][/IF] [/IF] [!select:=Id!] [!columns:={"type":"column","dataField":"Id","headerText":"ID","visible":0}!] [!EL:=[!E::getElementsByAttribute(list,,1)!]!] [IF [!EL!]=][!EL:=[!E::getSearchOrder()!]!][/IF] [STORPROC [!EL!]|P] [ORDER list|ASC] [!select+=,[!P::name!]!] [!columns+=,{"type":"column","dataField":"[!P::name!]","headerText":!] [IF [!P::listDescr!]][!columns+="[!P::listDescr!]"!][ELSE][IF [!P::description!]][!columns+="[!P::description!]"!][ELSE][!columns+="[!P::name!]"!][/IF][/IF] [!cf:=!] [SWITCH [!P::type!]|=] [CASE date] [!cf:=date!][!cw:=60!] [/CASE] [CASE boolean] [!cf:=boolean!][!cw:=24!][!columns+=,"setStyle":{"paddingLeft":1,"paddingRight":1}!] [/CASE] [CASE image] [!cf:=image!][!cw:=60!] [/CASE] [CASE price] [!cf:=2dec!][!cw:=80!] [/CASE] [CASE float] [!cw:=80!] [/CASE] [CASE int] [!cw:=50!] [/CASE] [CASE text] [!cw:=300!] [/CASE] [DEFAULT] [!cw:=150!] [/DEFAULT] [/SWITCH] [IF [!P::format!]][!cf:=[!P::format!]!][/IF] [IF [!cf!]][!columns+=,"format":"[!cf!]"!][/IF] [IF [!P::listWidth!]][!columns+=,"width":[!P::listWidth!]!][ELSE][!columns+=,"width":[!cw!]!][/IF] [!columns+=}!] [/ORDER] [/STORPROC] [!columns+=,{"type":"column","width":0}!] [IF [!cat!]>0],[/IF] {"type":"VBox","minHeight":1, "id":"firstTab[!OngletNum!]", "percentWidth":100, "percentHeight":100,"label":"[IF [!Enf::childdescription!]][!Enf::childdescription!][ELSE][!Enf::objectName!][/IF]","localProxy":1,"setStyle":{"verticalGap":0}, "components":[ {"type":"HBox","percentWidth":100, "setStyle":{"horizontalGap":4,"borderStyle":"none","dropShadowEnabled":0,"backgroundColor":"#dedede","paddingTop":1,"paddingBottom":1,"paddingRight":4,"paddingLeft":4}, "components":[ {"type":"ImageButton","image":"iconNew","width":26,"height":26,"cornerRadius":13,"borderWidth":1,"id":"new:[!OngletNum!]"}, {"type":"ImageButton","image":"open","width":26,"height":26,"cornerRadius":13,"borderWidth":1,"id":"edit:[!OngletNum!]"}, {"type":"ImageButton","image":"iconDelete","width":26,"height":26,"cornerRadius":13,"borderWidth":1,"id":"delete:[!OngletNum!]"} // {"type":"Button","label":"$__New__$","id":"new:[!OngletNum!]","width":80}, // {"type":"Button","label":"$__Edit__$","id":"edit:[!OngletNum!]","width":80}, // {"type":"Button","label":"$__Delete__$","id":"delete:[!OngletNum!]","width":80} ] }, {"type":"AdvancedDataGrid","id":"DG:[!OngletNum!]","percentWidth":100,"percentHeight":100,"rowHeight":20,"variableRowHeight":1, // "kobeyeClass":{"dirtyParent":1,"objectClass":"[!Enf::objectName!]"[IF [!Enf::useKeyName!]],"keyName":"[!Enf::name!]"[/IF],"form":"[!interface!]"}, "kobeyeClass":{"dirtyParent":1,"formModule":"[!Enf::objectModule!]","objectClass":"[!Enf::objectName!]","keyName":"[!Enf::name!]","form":"[!interface!]"}, "events":[ {"type":"start","action":"loadValues","params":{"needsParentId":1}}, {"type":"dblclick","action":"invoke","method":"loadFormWithID","params":{[!container!]}}, {"type":"proxy", "triggers":[ {"trigger":"new:[!OngletNum!]","action":"invoke","method":"createForm","params":{[!container!]}}, {"trigger":"edit:[!OngletNum!]","action":"invoke","method":"loadFormWithID","params":{[!container!]}}, {"trigger":"delete:[!OngletNum!]","action":"invoke","method":"deleteWithID"} ]} ], "columns":[ [!columns!] ]} ]} [!cat+=1!]
gpl-2.0
ZephyrSurfer/dolphin
Source/Core/VideoCommon/CommandProcessor.cpp
25741
// Copyright 2008 Dolphin Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "VideoCommon/CommandProcessor.h" #include <atomic> #include <cstring> #include <fmt/format.h> #include "Common/Assert.h" #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" #include "Common/Flag.h" #include "Common/Logging/Log.h" #include "Core/ConfigManager.h" #include "Core/CoreTiming.h" #include "Core/HW/GPFifo.h" #include "Core/HW/MMIO.h" #include "Core/HW/ProcessorInterface.h" #include "Core/System.h" #include "VideoCommon/Fifo.h" namespace CommandProcessor { static CoreTiming::EventType* et_UpdateInterrupts; // TODO(ector): Warn on bbox read/write // STATE_TO_SAVE SCPFifoStruct fifo; static UCPStatusReg m_CPStatusReg; static UCPCtrlReg m_CPCtrlReg; static UCPClearReg m_CPClearReg; static u16 m_bboxleft; static u16 m_bboxtop; static u16 m_bboxright; static u16 m_bboxbottom; static u16 m_tokenReg; static Common::Flag s_interrupt_set; static Common::Flag s_interrupt_waiting; static bool s_is_fifo_error_seen = false; static bool IsOnThread() { return Core::System::GetInstance().IsDualCoreMode(); } static void UpdateInterrupts_Wrapper(u64 userdata, s64 cyclesLate) { UpdateInterrupts(userdata); } void SCPFifoStruct::Init() { CPBase = 0; CPEnd = 0; CPHiWatermark = 0; CPLoWatermark = 0; CPReadWriteDistance = 0; CPWritePointer = 0; CPReadPointer = 0; CPBreakpoint = 0; SafeCPReadPointer = 0; bFF_GPLinkEnable = 0; bFF_GPReadEnable = 0; bFF_BPEnable = 0; bFF_BPInt = 0; bFF_Breakpoint.store(0, std::memory_order_relaxed); bFF_HiWatermark.store(0, std::memory_order_relaxed); bFF_HiWatermarkInt.store(0, std::memory_order_relaxed); bFF_LoWatermark.store(0, std::memory_order_relaxed); bFF_LoWatermarkInt.store(0, std::memory_order_relaxed); s_is_fifo_error_seen = false; } void SCPFifoStruct::DoState(PointerWrap& p) { p.Do(CPBase); p.Do(CPEnd); p.Do(CPHiWatermark); p.Do(CPLoWatermark); p.Do(CPReadWriteDistance); p.Do(CPWritePointer); p.Do(CPReadPointer); p.Do(CPBreakpoint); p.Do(SafeCPReadPointer); p.Do(bFF_GPLinkEnable); p.Do(bFF_GPReadEnable); p.Do(bFF_BPEnable); p.Do(bFF_BPInt); p.Do(bFF_Breakpoint); p.Do(bFF_LoWatermarkInt); p.Do(bFF_HiWatermarkInt); p.Do(bFF_LoWatermark); p.Do(bFF_HiWatermark); } void DoState(PointerWrap& p) { p.DoPOD(m_CPStatusReg); p.DoPOD(m_CPCtrlReg); p.DoPOD(m_CPClearReg); p.Do(m_bboxleft); p.Do(m_bboxtop); p.Do(m_bboxright); p.Do(m_bboxbottom); p.Do(m_tokenReg); fifo.DoState(p); p.Do(s_interrupt_set); p.Do(s_interrupt_waiting); } static inline void WriteLow(std::atomic<u32>& reg, u16 lowbits) { reg.store((reg.load(std::memory_order_relaxed) & 0xFFFF0000) | lowbits, std::memory_order_relaxed); } static inline void WriteHigh(std::atomic<u32>& reg, u16 highbits) { reg.store((reg.load(std::memory_order_relaxed) & 0x0000FFFF) | (static_cast<u32>(highbits) << 16), std::memory_order_relaxed); } void Init() { m_CPStatusReg.Hex = 0; m_CPStatusReg.CommandIdle = 1; m_CPStatusReg.ReadIdle = 1; m_CPCtrlReg.Hex = 0; m_CPClearReg.Hex = 0; m_bboxleft = 0; m_bboxtop = 0; m_bboxright = 640; m_bboxbottom = 480; m_tokenReg = 0; fifo.Init(); s_interrupt_set.Clear(); s_interrupt_waiting.Clear(); et_UpdateInterrupts = CoreTiming::RegisterEvent("CPInterrupt", UpdateInterrupts_Wrapper); } u32 GetPhysicalAddressMask() { // Physical addresses in CP seem to ignore some of the upper bits (depending on platform) // This can be observed in CP MMIO registers by setting to 0xffffffff and then reading back. return SConfig::GetInstance().bWii ? 0x1fffffff : 0x03ffffff; } void RegisterMMIO(MMIO::Mapping* mmio, u32 base) { constexpr u16 WMASK_NONE = 0x0000; constexpr u16 WMASK_ALL = 0xffff; constexpr u16 WMASK_LO_ALIGN_32BIT = 0xffe0; const u16 WMASK_HI_RESTRICT = GetPhysicalAddressMask() >> 16; struct { u32 addr; u16* ptr; bool readonly; // FIFO mmio regs in the range [cc000020-cc00003e] have certain bits that always read as 0 // For _LO registers in this range, only bits 0xffe0 can be set // For _HI registers in this range, only bits 0x03ff can be set on GCN and 0x1fff on Wii u16 wmask; } directly_mapped_vars[] = { {FIFO_TOKEN_REGISTER, &m_tokenReg, false, WMASK_ALL}, // Bounding box registers are read only. {FIFO_BOUNDING_BOX_LEFT, &m_bboxleft, true, WMASK_NONE}, {FIFO_BOUNDING_BOX_RIGHT, &m_bboxright, true, WMASK_NONE}, {FIFO_BOUNDING_BOX_TOP, &m_bboxtop, true, WMASK_NONE}, {FIFO_BOUNDING_BOX_BOTTOM, &m_bboxbottom, true, WMASK_NONE}, {FIFO_BASE_LO, MMIO::Utils::LowPart(&fifo.CPBase), false, WMASK_LO_ALIGN_32BIT}, {FIFO_BASE_HI, MMIO::Utils::HighPart(&fifo.CPBase), false, WMASK_HI_RESTRICT}, {FIFO_END_LO, MMIO::Utils::LowPart(&fifo.CPEnd), false, WMASK_LO_ALIGN_32BIT}, {FIFO_END_HI, MMIO::Utils::HighPart(&fifo.CPEnd), false, WMASK_HI_RESTRICT}, {FIFO_HI_WATERMARK_LO, MMIO::Utils::LowPart(&fifo.CPHiWatermark), false, WMASK_LO_ALIGN_32BIT}, {FIFO_HI_WATERMARK_HI, MMIO::Utils::HighPart(&fifo.CPHiWatermark), false, WMASK_HI_RESTRICT}, {FIFO_LO_WATERMARK_LO, MMIO::Utils::LowPart(&fifo.CPLoWatermark), false, WMASK_LO_ALIGN_32BIT}, {FIFO_LO_WATERMARK_HI, MMIO::Utils::HighPart(&fifo.CPLoWatermark), false, WMASK_HI_RESTRICT}, // FIFO_RW_DISTANCE has some complex read code different for // single/dual core. {FIFO_WRITE_POINTER_LO, MMIO::Utils::LowPart(&fifo.CPWritePointer), false, WMASK_LO_ALIGN_32BIT}, {FIFO_WRITE_POINTER_HI, MMIO::Utils::HighPart(&fifo.CPWritePointer), false, WMASK_HI_RESTRICT}, // FIFO_READ_POINTER has different code for single/dual core. }; for (auto& mapped_var : directly_mapped_vars) { mmio->Register(base | mapped_var.addr, MMIO::DirectRead<u16>(mapped_var.ptr), mapped_var.readonly ? MMIO::InvalidWrite<u16>() : MMIO::DirectWrite<u16>(mapped_var.ptr, mapped_var.wmask)); } mmio->Register(base | FIFO_BP_LO, MMIO::DirectRead<u16>(MMIO::Utils::LowPart(&fifo.CPBreakpoint)), MMIO::ComplexWrite<u16>([](u32, u16 val) { WriteLow(fifo.CPBreakpoint, val & WMASK_LO_ALIGN_32BIT); })); mmio->Register(base | FIFO_BP_HI, MMIO::DirectRead<u16>(MMIO::Utils::HighPart(&fifo.CPBreakpoint)), MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](u32, u16 val) { WriteHigh(fifo.CPBreakpoint, val & WMASK_HI_RESTRICT); })); // Timing and metrics MMIOs are stubbed with fixed values. struct { u32 addr; u16 value; } metrics_mmios[] = { {XF_RASBUSY_L, 0}, {XF_RASBUSY_H, 0}, {XF_CLKS_L, 0}, {XF_CLKS_H, 0}, {XF_WAIT_IN_L, 0}, {XF_WAIT_IN_H, 0}, {XF_WAIT_OUT_L, 0}, {XF_WAIT_OUT_H, 0}, {VCACHE_METRIC_CHECK_L, 0}, {VCACHE_METRIC_CHECK_H, 0}, {VCACHE_METRIC_MISS_L, 0}, {VCACHE_METRIC_MISS_H, 0}, {VCACHE_METRIC_STALL_L, 0}, {VCACHE_METRIC_STALL_H, 0}, {CLKS_PER_VTX_OUT, 4}, }; for (auto& metrics_mmio : metrics_mmios) { mmio->Register(base | metrics_mmio.addr, MMIO::Constant<u16>(metrics_mmio.value), MMIO::InvalidWrite<u16>()); } mmio->Register(base | STATUS_REGISTER, MMIO::ComplexRead<u16>([](u32) { Fifo::SyncGPUForRegisterAccess(); SetCpStatusRegister(); return m_CPStatusReg.Hex; }), MMIO::InvalidWrite<u16>()); mmio->Register(base | CTRL_REGISTER, MMIO::DirectRead<u16>(&m_CPCtrlReg.Hex), MMIO::ComplexWrite<u16>([](u32, u16 val) { UCPCtrlReg tmp(val); m_CPCtrlReg.Hex = tmp.Hex; SetCpControlRegister(); Fifo::RunGpu(); })); mmio->Register(base | CLEAR_REGISTER, MMIO::DirectRead<u16>(&m_CPClearReg.Hex), MMIO::ComplexWrite<u16>([](u32, u16 val) { UCPClearReg tmp(val); m_CPClearReg.Hex = tmp.Hex; SetCpClearRegister(); Fifo::RunGpu(); })); mmio->Register(base | PERF_SELECT, MMIO::InvalidRead<u16>(), MMIO::Nop<u16>()); // Some MMIOs have different handlers for single core vs. dual core mode. mmio->Register( base | FIFO_RW_DISTANCE_LO, IsOnThread() ? MMIO::ComplexRead<u16>([](u32) { if (fifo.CPWritePointer.load(std::memory_order_relaxed) >= fifo.SafeCPReadPointer.load(std::memory_order_relaxed)) { return static_cast<u16>(fifo.CPWritePointer.load(std::memory_order_relaxed) - fifo.SafeCPReadPointer.load(std::memory_order_relaxed)); } else { return static_cast<u16>(fifo.CPEnd.load(std::memory_order_relaxed) - fifo.SafeCPReadPointer.load(std::memory_order_relaxed) + fifo.CPWritePointer.load(std::memory_order_relaxed) - fifo.CPBase.load(std::memory_order_relaxed) + 32); } }) : MMIO::DirectRead<u16>(MMIO::Utils::LowPart(&fifo.CPReadWriteDistance)), MMIO::DirectWrite<u16>(MMIO::Utils::LowPart(&fifo.CPReadWriteDistance), WMASK_LO_ALIGN_32BIT)); mmio->Register(base | FIFO_RW_DISTANCE_HI, IsOnThread() ? MMIO::ComplexRead<u16>([](u32) { Fifo::SyncGPUForRegisterAccess(); if (fifo.CPWritePointer.load(std::memory_order_relaxed) >= fifo.SafeCPReadPointer.load(std::memory_order_relaxed)) { return (fifo.CPWritePointer.load(std::memory_order_relaxed) - fifo.SafeCPReadPointer.load(std::memory_order_relaxed)) >> 16; } else { return (fifo.CPEnd.load(std::memory_order_relaxed) - fifo.SafeCPReadPointer.load(std::memory_order_relaxed) + fifo.CPWritePointer.load(std::memory_order_relaxed) - fifo.CPBase.load(std::memory_order_relaxed) + 32) >> 16; } }) : MMIO::ComplexRead<u16>([](u32) { Fifo::SyncGPUForRegisterAccess(); return fifo.CPReadWriteDistance.load(std::memory_order_relaxed) >> 16; }), MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](u32, u16 val) { Fifo::SyncGPUForRegisterAccess(); WriteHigh(fifo.CPReadWriteDistance, val & WMASK_HI_RESTRICT); Fifo::RunGpu(); })); mmio->Register( base | FIFO_READ_POINTER_LO, IsOnThread() ? MMIO::DirectRead<u16>(MMIO::Utils::LowPart(&fifo.SafeCPReadPointer)) : MMIO::DirectRead<u16>(MMIO::Utils::LowPart(&fifo.CPReadPointer)), MMIO::DirectWrite<u16>(MMIO::Utils::LowPart(&fifo.CPReadPointer), WMASK_LO_ALIGN_32BIT)); mmio->Register(base | FIFO_READ_POINTER_HI, IsOnThread() ? MMIO::ComplexRead<u16>([](u32) { Fifo::SyncGPUForRegisterAccess(); return fifo.SafeCPReadPointer.load(std::memory_order_relaxed) >> 16; }) : MMIO::ComplexRead<u16>([](u32) { Fifo::SyncGPUForRegisterAccess(); return fifo.CPReadPointer.load(std::memory_order_relaxed) >> 16; }), IsOnThread() ? MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](u32, u16 val) { Fifo::SyncGPUForRegisterAccess(); WriteHigh(fifo.CPReadPointer, val & WMASK_HI_RESTRICT); fifo.SafeCPReadPointer.store(fifo.CPReadPointer.load(std::memory_order_relaxed), std::memory_order_relaxed); }) : MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](u32, u16 val) { Fifo::SyncGPUForRegisterAccess(); WriteHigh(fifo.CPReadPointer, val & WMASK_HI_RESTRICT); })); } void GatherPipeBursted() { SetCPStatusFromCPU(); // if we aren't linked, we don't care about gather pipe data if (!m_CPCtrlReg.GPLinkEnable) { if (IsOnThread() && !Fifo::UseDeterministicGPUThread()) { // In multibuffer mode is not allowed write in the same FIFO attached to the GPU. // Fix Pokemon XD in DC mode. if ((ProcessorInterface::Fifo_CPUEnd == fifo.CPEnd.load(std::memory_order_relaxed)) && (ProcessorInterface::Fifo_CPUBase == fifo.CPBase.load(std::memory_order_relaxed)) && fifo.CPReadWriteDistance.load(std::memory_order_relaxed) > 0) { Fifo::FlushGpu(); } } Fifo::RunGpu(); return; } // update the fifo pointer if (fifo.CPWritePointer.load(std::memory_order_relaxed) == fifo.CPEnd.load(std::memory_order_relaxed)) { fifo.CPWritePointer.store(fifo.CPBase, std::memory_order_relaxed); } else { fifo.CPWritePointer.fetch_add(GATHER_PIPE_SIZE, std::memory_order_relaxed); } if (m_CPCtrlReg.GPReadEnable && m_CPCtrlReg.GPLinkEnable) { ProcessorInterface::Fifo_CPUWritePointer = fifo.CPWritePointer.load(std::memory_order_relaxed); ProcessorInterface::Fifo_CPUBase = fifo.CPBase.load(std::memory_order_relaxed); ProcessorInterface::Fifo_CPUEnd = fifo.CPEnd.load(std::memory_order_relaxed); } // If the game is running close to overflowing, make the exception checking more frequent. if (fifo.bFF_HiWatermark.load(std::memory_order_relaxed) != 0) CoreTiming::ForceExceptionCheck(0); fifo.CPReadWriteDistance.fetch_add(GATHER_PIPE_SIZE, std::memory_order_seq_cst); Fifo::RunGpu(); ASSERT_MSG(COMMANDPROCESSOR, fifo.CPReadWriteDistance.load(std::memory_order_relaxed) <= fifo.CPEnd.load(std::memory_order_relaxed) - fifo.CPBase.load(std::memory_order_relaxed), "FIFO is overflowed by GatherPipe !\nCPU thread is too fast!"); // check if we are in sync ASSERT_MSG(COMMANDPROCESSOR, fifo.CPWritePointer.load(std::memory_order_relaxed) == ProcessorInterface::Fifo_CPUWritePointer, "FIFOs linked but out of sync"); ASSERT_MSG(COMMANDPROCESSOR, fifo.CPBase.load(std::memory_order_relaxed) == ProcessorInterface::Fifo_CPUBase, "FIFOs linked but out of sync"); ASSERT_MSG(COMMANDPROCESSOR, fifo.CPEnd.load(std::memory_order_relaxed) == ProcessorInterface::Fifo_CPUEnd, "FIFOs linked but out of sync"); } void UpdateInterrupts(u64 userdata) { if (userdata) { s_interrupt_set.Set(); DEBUG_LOG_FMT(COMMANDPROCESSOR, "Interrupt set"); ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true); } else { s_interrupt_set.Clear(); DEBUG_LOG_FMT(COMMANDPROCESSOR, "Interrupt cleared"); ProcessorInterface::SetInterrupt(INT_CAUSE_CP, false); } CoreTiming::ForceExceptionCheck(0); s_interrupt_waiting.Clear(); Fifo::RunGpu(); } void UpdateInterruptsFromVideoBackend(u64 userdata) { if (!Fifo::UseDeterministicGPUThread()) CoreTiming::ScheduleEvent(0, et_UpdateInterrupts, userdata, CoreTiming::FromThread::NON_CPU); } bool IsInterruptWaiting() { return s_interrupt_waiting.IsSet(); } void SetCPStatusFromGPU() { // breakpoint const bool breakpoint = fifo.bFF_Breakpoint.load(std::memory_order_relaxed); if (fifo.bFF_BPEnable.load(std::memory_order_relaxed) != 0) { if (fifo.CPBreakpoint.load(std::memory_order_relaxed) == fifo.CPReadPointer.load(std::memory_order_relaxed)) { if (!breakpoint) { DEBUG_LOG_FMT(COMMANDPROCESSOR, "Hit breakpoint at {}", fifo.CPReadPointer.load(std::memory_order_relaxed)); fifo.bFF_Breakpoint.store(1, std::memory_order_relaxed); } } else { if (breakpoint) { DEBUG_LOG_FMT(COMMANDPROCESSOR, "Cleared breakpoint at {}", fifo.CPReadPointer.load(std::memory_order_relaxed)); fifo.bFF_Breakpoint.store(0, std::memory_order_relaxed); } } } else { if (breakpoint) { DEBUG_LOG_FMT(COMMANDPROCESSOR, "Cleared breakpoint at {}", fifo.CPReadPointer.load(std::memory_order_relaxed)); fifo.bFF_Breakpoint = false; } } // overflow & underflow check fifo.bFF_HiWatermark.store( (fifo.CPReadWriteDistance.load(std::memory_order_relaxed) > fifo.CPHiWatermark), std::memory_order_relaxed); fifo.bFF_LoWatermark.store( (fifo.CPReadWriteDistance.load(std::memory_order_relaxed) < fifo.CPLoWatermark), std::memory_order_relaxed); bool bpInt = fifo.bFF_Breakpoint.load(std::memory_order_relaxed) && fifo.bFF_BPInt.load(std::memory_order_relaxed); bool ovfInt = fifo.bFF_HiWatermark.load(std::memory_order_relaxed) && fifo.bFF_HiWatermarkInt.load(std::memory_order_relaxed); bool undfInt = fifo.bFF_LoWatermark.load(std::memory_order_relaxed) && fifo.bFF_LoWatermarkInt.load(std::memory_order_relaxed); bool interrupt = (bpInt || ovfInt || undfInt) && m_CPCtrlReg.GPReadEnable; if (interrupt != s_interrupt_set.IsSet() && !s_interrupt_waiting.IsSet()) { u64 userdata = interrupt ? 1 : 0; if (IsOnThread()) { if (!interrupt || bpInt || undfInt || ovfInt) { // Schedule the interrupt asynchronously s_interrupt_waiting.Set(); CommandProcessor::UpdateInterruptsFromVideoBackend(userdata); } } else { CommandProcessor::UpdateInterrupts(userdata); } } } void SetCPStatusFromCPU() { // overflow & underflow check fifo.bFF_HiWatermark.store( (fifo.CPReadWriteDistance.load(std::memory_order_relaxed) > fifo.CPHiWatermark), std::memory_order_relaxed); fifo.bFF_LoWatermark.store( (fifo.CPReadWriteDistance.load(std::memory_order_relaxed) < fifo.CPLoWatermark), std::memory_order_relaxed); bool bpInt = fifo.bFF_Breakpoint.load(std::memory_order_relaxed) && fifo.bFF_BPInt.load(std::memory_order_relaxed); bool ovfInt = fifo.bFF_HiWatermark.load(std::memory_order_relaxed) && fifo.bFF_HiWatermarkInt.load(std::memory_order_relaxed); bool undfInt = fifo.bFF_LoWatermark.load(std::memory_order_relaxed) && fifo.bFF_LoWatermarkInt.load(std::memory_order_relaxed); bool interrupt = (bpInt || ovfInt || undfInt) && m_CPCtrlReg.GPReadEnable; if (interrupt != s_interrupt_set.IsSet() && !s_interrupt_waiting.IsSet()) { u64 userdata = interrupt ? 1 : 0; if (IsOnThread()) { if (!interrupt || bpInt || undfInt || ovfInt) { s_interrupt_set.Set(interrupt); DEBUG_LOG_FMT(COMMANDPROCESSOR, "Interrupt set"); ProcessorInterface::SetInterrupt(INT_CAUSE_CP, interrupt); } } else { CommandProcessor::UpdateInterrupts(userdata); } } } void SetCpStatusRegister() { // Here always there is one fifo attached to the GPU m_CPStatusReg.Breakpoint = fifo.bFF_Breakpoint.load(std::memory_order_relaxed); m_CPStatusReg.ReadIdle = !fifo.CPReadWriteDistance.load(std::memory_order_relaxed) || (fifo.CPReadPointer.load(std::memory_order_relaxed) == fifo.CPWritePointer.load(std::memory_order_relaxed)); m_CPStatusReg.CommandIdle = !fifo.CPReadWriteDistance.load(std::memory_order_relaxed) || Fifo::AtBreakpoint() || !fifo.bFF_GPReadEnable.load(std::memory_order_relaxed); m_CPStatusReg.UnderflowLoWatermark = fifo.bFF_LoWatermark.load(std::memory_order_relaxed); m_CPStatusReg.OverflowHiWatermark = fifo.bFF_HiWatermark.load(std::memory_order_relaxed); DEBUG_LOG_FMT(COMMANDPROCESSOR, "\t Read from STATUS_REGISTER : {:04x}", m_CPStatusReg.Hex); DEBUG_LOG_FMT( COMMANDPROCESSOR, "(r) status: iBP {} | fReadIdle {} | fCmdIdle {} | iOvF {} | iUndF {}", m_CPStatusReg.Breakpoint ? "ON" : "OFF", m_CPStatusReg.ReadIdle ? "ON" : "OFF", m_CPStatusReg.CommandIdle ? "ON" : "OFF", m_CPStatusReg.OverflowHiWatermark ? "ON" : "OFF", m_CPStatusReg.UnderflowLoWatermark ? "ON" : "OFF"); } void SetCpControlRegister() { fifo.bFF_BPInt.store(m_CPCtrlReg.BPInt, std::memory_order_relaxed); fifo.bFF_BPEnable.store(m_CPCtrlReg.BPEnable, std::memory_order_relaxed); fifo.bFF_HiWatermarkInt.store(m_CPCtrlReg.FifoOverflowIntEnable, std::memory_order_relaxed); fifo.bFF_LoWatermarkInt.store(m_CPCtrlReg.FifoUnderflowIntEnable, std::memory_order_relaxed); fifo.bFF_GPLinkEnable.store(m_CPCtrlReg.GPLinkEnable, std::memory_order_relaxed); if (fifo.bFF_GPReadEnable.load(std::memory_order_relaxed) && !m_CPCtrlReg.GPReadEnable) { fifo.bFF_GPReadEnable.store(m_CPCtrlReg.GPReadEnable, std::memory_order_relaxed); Fifo::FlushGpu(); } else { fifo.bFF_GPReadEnable = m_CPCtrlReg.GPReadEnable; } DEBUG_LOG_FMT(COMMANDPROCESSOR, "\t GPREAD {} | BP {} | Int {} | OvF {} | UndF {} | LINK {}", fifo.bFF_GPReadEnable.load(std::memory_order_relaxed) ? "ON" : "OFF", fifo.bFF_BPEnable.load(std::memory_order_relaxed) ? "ON" : "OFF", fifo.bFF_BPInt.load(std::memory_order_relaxed) ? "ON" : "OFF", m_CPCtrlReg.FifoOverflowIntEnable ? "ON" : "OFF", m_CPCtrlReg.FifoUnderflowIntEnable ? "ON" : "OFF", m_CPCtrlReg.GPLinkEnable ? "ON" : "OFF"); } // NOTE: We intentionally don't emulate this function at the moment. // We don't emulate proper GP timing anyway at the moment, so it would just slow down emulation. void SetCpClearRegister() { } void HandleUnknownOpcode(u8 cmd_byte, const u8* buffer, bool preprocess) { // Datel software uses 0x01 during startup, and Mario Party 5's Wiggler capsule // accidentally uses 0x01-0x03 due to sending 4 more vertices than intended. // Hardware testing indicates that 0x01-0x07 do nothing, so to avoid annoying the user with // spurious popups, we don't create a panic alert in those cases. Other unknown opcodes // (such as 0x18) seem to result in hangs. if (!s_is_fifo_error_seen && cmd_byte > 0x07) { s_is_fifo_error_seen = true; // TODO(Omega): Maybe dump FIFO to file on this error PanicAlertFmtT("GFX FIFO: Unknown Opcode ({0:#04x} @ {1}, preprocess={2}).\n" "This means one of the following:\n" "* The emulated GPU got desynced, disabling dual core can help\n" "* Command stream corrupted by some spurious memory bug\n" "* This really is an unknown opcode (unlikely)\n" "* Some other sort of bug\n\n" "Further errors will be sent to the Video Backend log and\n" "Dolphin will now likely crash or hang. Enjoy.", cmd_byte, fmt::ptr(buffer), preprocess); PanicAlertFmt("Illegal command {:02x}\n" "CPBase: {:#010x}\n" "CPEnd: {:#010x}\n" "CPHiWatermark: {:#010x}\n" "CPLoWatermark: {:#010x}\n" "CPReadWriteDistance: {:#010x}\n" "CPWritePointer: {:#010x}\n" "CPReadPointer: {:#010x}\n" "CPBreakpoint: {:#010x}\n" "bFF_GPReadEnable: {}\n" "bFF_BPEnable: {}\n" "bFF_BPInt: {}\n" "bFF_Breakpoint: {}\n" "bFF_GPLinkEnable: {}\n" "bFF_HiWatermarkInt: {}\n" "bFF_LoWatermarkInt: {}\n", cmd_byte, fifo.CPBase.load(std::memory_order_relaxed), fifo.CPEnd.load(std::memory_order_relaxed), fifo.CPHiWatermark, fifo.CPLoWatermark, fifo.CPReadWriteDistance.load(std::memory_order_relaxed), fifo.CPWritePointer.load(std::memory_order_relaxed), fifo.CPReadPointer.load(std::memory_order_relaxed), fifo.CPBreakpoint.load(std::memory_order_relaxed), fifo.bFF_GPReadEnable.load(std::memory_order_relaxed) ? "true" : "false", fifo.bFF_BPEnable.load(std::memory_order_relaxed) ? "true" : "false", fifo.bFF_BPInt.load(std::memory_order_relaxed) ? "true" : "false", fifo.bFF_Breakpoint.load(std::memory_order_relaxed) ? "true" : "false", fifo.bFF_GPLinkEnable.load(std::memory_order_relaxed) ? "true" : "false", fifo.bFF_HiWatermarkInt.load(std::memory_order_relaxed) ? "true" : "false", fifo.bFF_LoWatermarkInt.load(std::memory_order_relaxed) ? "true" : "false"); } // We always generate this log message, though we only generate the panic alerts once. ERROR_LOG_FMT(VIDEO, "FIFO: Unknown Opcode ({:#04x} @ {}, preprocessing = {})", cmd_byte, fmt::ptr(buffer), preprocess ? "yes" : "no"); } } // namespace CommandProcessor
gpl-2.0
undecided/synergy
lib/platform/CXWindowsClipboardAnyBitmapConverter.cpp
5164
/* * synergy -- mouse and keyboard sharing utility * Copyright (C) 2004 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file COPYING that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include "CXWindowsClipboardAnyBitmapConverter.h" // BMP info header structure struct CBMPInfoHeader { public: UInt32 biSize; SInt32 biWidth; SInt32 biHeight; UInt16 biPlanes; UInt16 biBitCount; UInt32 biCompression; UInt32 biSizeImage; SInt32 biXPelsPerMeter; SInt32 biYPelsPerMeter; UInt32 biClrUsed; UInt32 biClrImportant; }; // BMP is little-endian static void toLE(UInt8*& dst, UInt16 src) { dst[0] = static_cast<UInt8>(src & 0xffu); dst[1] = static_cast<UInt8>((src >> 8) & 0xffu); dst += 2; } static void toLE(UInt8*& dst, SInt32 src) { dst[0] = static_cast<UInt8>(src & 0xffu); dst[1] = static_cast<UInt8>((src >> 8) & 0xffu); dst[2] = static_cast<UInt8>((src >> 16) & 0xffu); dst[3] = static_cast<UInt8>((src >> 24) & 0xffu); dst += 4; } static void toLE(UInt8*& dst, UInt32 src) { dst[0] = static_cast<UInt8>(src & 0xffu); dst[1] = static_cast<UInt8>((src >> 8) & 0xffu); dst[2] = static_cast<UInt8>((src >> 16) & 0xffu); dst[3] = static_cast<UInt8>((src >> 24) & 0xffu); dst += 4; } static inline UInt16 fromLEU16(const UInt8* data) { return static_cast<UInt16>(data[0]) | (static_cast<UInt16>(data[1]) << 8); } static inline SInt32 fromLES32(const UInt8* data) { return static_cast<SInt32>(static_cast<UInt32>(data[0]) | (static_cast<UInt32>(data[1]) << 8) | (static_cast<UInt32>(data[2]) << 16) | (static_cast<UInt32>(data[3]) << 24)); } static inline UInt32 fromLEU32(const UInt8* data) { return static_cast<UInt32>(data[0]) | (static_cast<UInt32>(data[1]) << 8) | (static_cast<UInt32>(data[2]) << 16) | (static_cast<UInt32>(data[3]) << 24); } // // CXWindowsClipboardAnyBitmapConverter // CXWindowsClipboardAnyBitmapConverter::CXWindowsClipboardAnyBitmapConverter() { // do nothing } CXWindowsClipboardAnyBitmapConverter::~CXWindowsClipboardAnyBitmapConverter() { // do nothing } IClipboard::EFormat CXWindowsClipboardAnyBitmapConverter::getFormat() const { return IClipboard::kBitmap; } int CXWindowsClipboardAnyBitmapConverter::getDataSize() const { return 8; } CString CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const CString& bmp) const { // fill BMP info header with native-endian data CBMPInfoHeader infoHeader; const UInt8* rawBMPInfoHeader = reinterpret_cast<const UInt8*>(bmp.data()); infoHeader.biSize = fromLEU32(rawBMPInfoHeader + 0); infoHeader.biWidth = fromLES32(rawBMPInfoHeader + 4); infoHeader.biHeight = fromLES32(rawBMPInfoHeader + 8); infoHeader.biPlanes = fromLEU16(rawBMPInfoHeader + 12); infoHeader.biBitCount = fromLEU16(rawBMPInfoHeader + 14); infoHeader.biCompression = fromLEU32(rawBMPInfoHeader + 16); infoHeader.biSizeImage = fromLEU32(rawBMPInfoHeader + 20); infoHeader.biXPelsPerMeter = fromLES32(rawBMPInfoHeader + 24); infoHeader.biYPelsPerMeter = fromLES32(rawBMPInfoHeader + 28); infoHeader.biClrUsed = fromLEU32(rawBMPInfoHeader + 32); infoHeader.biClrImportant = fromLEU32(rawBMPInfoHeader + 36); // check that format is acceptable if (infoHeader.biSize != 40 || infoHeader.biWidth == 0 || infoHeader.biHeight == 0 || infoHeader.biPlanes != 0 || infoHeader.biCompression != 0 || (infoHeader.biBitCount != 24 && infoHeader.biBitCount != 32)) { return CString(); } // convert to image format const UInt8* rawBMPPixels = rawBMPInfoHeader + 40; if (infoHeader.biBitCount == 24) { return doBGRFromIClipboard(rawBMPPixels, infoHeader.biWidth, infoHeader.biHeight); } else { return doBGRAFromIClipboard(rawBMPPixels, infoHeader.biWidth, infoHeader.biHeight); } } CString CXWindowsClipboardAnyBitmapConverter::toIClipboard(const CString& image) const { // convert to raw BMP data UInt32 w, h, depth; CString rawBMP = doToIClipboard(image, w, h, depth); if (rawBMP.empty() || w == 0 || h == 0 || (depth != 24 && depth != 32)) { return CString(); } // fill BMP info header with little-endian data UInt8 infoHeader[40]; UInt8* dst = infoHeader; toLE(dst, static_cast<UInt32>(40)); toLE(dst, static_cast<SInt32>(w)); toLE(dst, static_cast<SInt32>(h)); toLE(dst, static_cast<UInt16>(1)); toLE(dst, static_cast<UInt16>(depth)); toLE(dst, static_cast<UInt32>(0)); // BI_RGB toLE(dst, static_cast<UInt32>(image.size())); toLE(dst, static_cast<SInt32>(2834)); // 72 dpi toLE(dst, static_cast<SInt32>(2834)); // 72 dpi toLE(dst, static_cast<UInt32>(0)); toLE(dst, static_cast<UInt32>(0)); // construct image return CString(reinterpret_cast<const char*>(infoHeader), sizeof(infoHeader)) + rawBMP; }
gpl-2.0
mdr78/Linux-3.8.7-galileo
include/linux/mfd/intel_qrk_gip.h
2590
/* * Copyright(c) 2013-2015 Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ /* * Intel Quark GIP (GPIO/I2C) driver */ #ifndef __INTEL_QRKGIP_H__ #define __INTEL_QRKGIP_H__ #include <linux/i2c.h> #include <linux/mfd/intel_qrk_gip_pdata.h> #include <linux/pci.h> #include "../../drivers/i2c/busses/i2c-designware-core.h" /* PCI BAR for register base address */ #define GIP_I2C_BAR 0 #define GIP_GPIO_BAR 1 /** * intel_qrk_gpio_probe * * @param pdev: Pointer to GIP PCI device * @return 0 success < 0 failure * * Perform GPIO-specific probing on behalf of the top-level GIP driver. */ int intel_qrk_gpio_probe(struct pci_dev *pdev); /** * intel_qrk_gpio_remove * * @param pdev: Pointer to GIP PCI device * * Perform GPIO-specific resource release on behalf of the top-level GIP driver. */ void intel_qrk_gpio_remove(struct pci_dev *pdev); /** * intel_qrk_gpio_isr * * @param irq: IRQ number to be served * @param dev_id: used to distinguish the device (for shared interrupts) * * Perform GPIO-specific ISR of the top-level GIP driver. */ irqreturn_t intel_qrk_gpio_isr(int irq, void *dev_id); /** * intel_qrk_gpio_save_state * * Save GPIO register state for system-wide suspend events and mask out * interrupts. */ void intel_qrk_gpio_save_state(void); /** * intel_qrk_gpio_restore_state * * Restore GPIO register state for system-wide resume events and clear out * spurious interrupts. */ void intel_qrk_gpio_restore_state(void); /** * intel_qrk_i2c_probe * @param pdev: Pointer to GIP PCI device * @param drvdata: private driver data * @param pdata: GIP platform-specific settings * @return 0 success < 0 failure * * Perform I2C-specific probing on behalf of the top-level GIP driver. */ int intel_qrk_i2c_probe(struct pci_dev *pdev, struct dw_i2c_dev **drvdata, struct intel_qrk_gip_pdata *pdata); /** * intel_qrk_i2c_remove * @param pdev: Pointer to GIP PCI device * @param dev: Pointer to I2C private data * * Perform I2C-specific resource release on behalf of the top-level GIP driver. */ void intel_qrk_i2c_remove(struct pci_dev *pdev, struct dw_i2c_dev *dev); #endif /* __INTEL_QRKGIP_H__ */
gpl-2.0
mixaceh/openyu-mix.j
openyu-mix-core/src/main/java/org/openyu/mix/sasang/vo/Outcome.java
1183
package org.openyu.mix.sasang.vo; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.openyu.mix.app.vo.Prize; import org.openyu.commons.bean.IdBean; import org.openyu.commons.bean.ProbabilityBean; import org.openyu.commons.enumz.IntEnum; import com.sun.xml.bind.AnyTypeAdapter; /** * 開出的結果 */ @XmlJavaTypeAdapter(AnyTypeAdapter.class) public interface Outcome extends IdBean, ProbabilityBean { String KEY = Outcome.class.getName(); /** * 結果類別 * */ public enum OutcomeType implements IntEnum { /** * 都不相同 */ STAND_ALONE(1), /** * 兩個相同 */ SAME_TWO(2), /** * 三個相同 */ SAME_THREE(3), // ; private final int value; private OutcomeType(int value) { this.value = value; } public int getValue() { return value; } } /** * 開出的獎 * * @return */ Prize getPrize(); void setPrize(Prize prize); /** * 結果類別 * * @return */ OutcomeType getOutcomeType(); void setOutcomeType(OutcomeType outcomeType); /** * 機率 * * @return */ double getProbability(); void setProbability(double probability); }
gpl-2.0
yuwata/dracut
test/TEST-40-NBD/server-init.sh
1587
#!/bin/sh exec </dev/console >/dev/console 2>&1 set -x export PATH=/sbin:/bin:/usr/sbin:/usr/bin export TERM=linux export PS1='nbdtest-server:\w\$ ' stty sane echo "made it to the rootfs!" echo server > /proc/sys/kernel/hostname wait_for_if_link() { local cnt=0 local li while [ $cnt -lt 600 ]; do li=$(ip -o link show dev $1 2>/dev/null) [ -n "$li" ] && return 0 if [[ $2 ]]; then li=$(ip -o link show dev $2 2>/dev/null) [ -n "$li" ] && return 0 fi sleep 0.1 cnt=$(($cnt+1)) done return 1 } wait_for_if_up() { local cnt=0 local li while [ $cnt -lt 200 ]; do li=$(ip -o link show up dev $1) [ -n "$li" ] && return 0 sleep 0.1 cnt=$(($cnt+1)) done return 1 } wait_for_route_ok() { local cnt=0 while [ $cnt -lt 200 ]; do li=$(ip route show) [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0 sleep 0.1 cnt=$(($cnt+1)) done return 1 } linkup() { wait_for_if_link $1 2>/dev/null\ && ip link set $1 up 2>/dev/null\ && wait_for_if_up $1 2>/dev/null } wait_for_if_link eth0 ens3 ip addr add 127.0.0.1/8 dev lo ip link set lo up ip link set dev eth0 name ens3 ip addr add 192.168.50.1/24 dev ens3 linkup ens3 modprobe af_packet nbd-server >/var/lib/dhcpd/dhcpd.leases chmod 777 /var/lib/dhcpd/dhcpd.leases dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases & echo "Serving NBD disks" while :; do [ -n "$(jobs -rp)" ] && echo > /dev/watchdog sleep 10 done mount -n -o remount,ro / poweroff -f
gpl-2.0
RAOF/thermal_daemon
src/thd_cdev_order_parser.cpp
2571
/* * thd_cdev_order_parser.cpp: Specify cdev order * * Copyright (C) 2012 Intel Corporation. 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 version * 2 or later as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * * * Author Name <[email protected]> * */ #include "thd_cdev_order_parser.h" #include "thd_sys_fs.h" cthd_cdev_order_parse::cthd_cdev_order_parse() :doc(NULL), root_element(NULL) { std::string name = TDCONFDIR; filename=name+"/""thermal-cdev-order.xml"; } int cthd_cdev_order_parse::parser_init() { doc = xmlReadFile(filename.c_str(), NULL, 0); if (doc == NULL) { thd_log_warn("error: could not parse file %s\n", filename.c_str()); return THD_ERROR; } root_element = xmlDocGetRootElement(doc); if (root_element == NULL) { thd_log_warn("error: could not get root element \n"); return THD_ERROR; } return THD_SUCCESS; } int cthd_cdev_order_parse::start_parse() { parse(root_element, doc); return THD_SUCCESS; } void cthd_cdev_order_parse::parser_deinit() { xmlFreeDoc(doc); xmlCleanupParser(); } int cthd_cdev_order_parse::parse_new_cdev(xmlNode * a_node, xmlDoc *doc) { xmlNode *cur_node = NULL; for (cur_node = a_node; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { thd_log_info("node type: Element, name: %s value: %s\n", cur_node->name, xmlNodeListGetString(doc, cur_node->xmlChildrenNode, 1)); cdev_order_list.push_back(xmlNodeListGetString(doc, cur_node->xmlChildrenNode, 1)); } } return THD_SUCCESS; } int cthd_cdev_order_parse::parse(xmlNode * a_node, xmlDoc *doc) { xmlNode *cur_node = NULL; for (cur_node = a_node; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (!strcmp((const char*)cur_node->name, "CoolingDeviceOrder")) { parse_new_cdev(cur_node->children, doc); } } } return THD_SUCCESS; } int cthd_cdev_order_parse::get_order_list(std::vector <std::string> &list) { list = cdev_order_list; return 0; }
gpl-2.0
engelsystem/engelsystem
tests/Unit/Mail/MailerServiceProviderTest.php
5660
<?php namespace Engelsystem\Test\Unit\Mail; use Engelsystem\Application; use Engelsystem\Config\Config; use Engelsystem\Mail\EngelsystemMailer; use Engelsystem\Mail\Mailer; use Engelsystem\Mail\MailerServiceProvider; use Engelsystem\Mail\Transport\LogTransport; use Engelsystem\Test\Unit\ServiceProviderTest; use InvalidArgumentException; use Psr\Log\LoggerInterface; use Symfony\Component\Mailer\Mailer as SymfonyMailer; use Symfony\Component\Mailer\Transport\SendmailTransport; use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; use Symfony\Component\Mailer\Transport\TransportInterface; class MailerServiceProviderTest extends ServiceProviderTest { /** @var array */ protected $defaultConfig = [ 'app_name' => 'Engelsystem App', 'email' => [ 'driver' => 'mail', 'from' => [ 'name' => 'Engelsystem', 'address' => '[email protected]', ], 'sendmail' => '/opt/bin/sendmail -bs', ], ]; /** @var array */ protected $smtpConfig = [ 'email' => [ 'driver' => 'smtp', 'host' => 'mail.foo.bar', 'port' => 587, 'tls' => true, 'username' => 'foobar', 'password' => 'LoremIpsum123', ], ]; /** * @covers \Engelsystem\Mail\MailerServiceProvider::register */ public function testRegister() { $app = $this->getApplication(); $serviceProvider = new MailerServiceProvider($app); $serviceProvider->register(); $this->assertExistsInContainer(['mailer.transport', TransportInterface::class], $app); $this->assertExistsInContainer(['mailer.symfony', SymfonyMailer::class], $app); $this->assertExistsInContainer(['mailer', EngelsystemMailer::class, Mailer::class], $app); /** @var EngelsystemMailer $mailer */ $mailer = $app->get('mailer'); $this->assertEquals('Engelsystem App', $mailer->getSubjectPrefix()); $this->assertEquals('Engelsystem', $mailer->getFromName()); $this->assertEquals('[email protected]', $mailer->getFromAddress()); /** @var SendmailTransport $transport */ $transport = $app->get('mailer.transport'); $this->assertInstanceOf(SendmailTransport::class, $transport); } /** * @return array */ public function provideTransports() { return [ [LogTransport::class, ['email' => ['driver' => 'log']]], [SendmailTransport::class, ['email' => ['driver' => 'mail']]], [SendmailTransport::class, ['email' => ['driver' => 'sendmail']]], [ EsmtpTransport::class, $this->smtpConfig, ], ]; } /** * @covers \Engelsystem\Mail\MailerServiceProvider::getTransport * @param string $class * @param array $emailConfig * @dataProvider provideTransports */ public function testGetTransport($class, $emailConfig = []) { $app = $this->getApplication($emailConfig); $serviceProvider = new MailerServiceProvider($app); $serviceProvider->register(); $transport = $app->get('mailer.transport'); $this->assertInstanceOf($class, $transport); } /** * @covers \Engelsystem\Mail\MailerServiceProvider::getTransport */ public function testGetTransportNotFound() { $app = $this->getApplication(['email' => ['driver' => 'foo-bar-batz']]); $this->expectException(InvalidArgumentException::class); $serviceProvider = new MailerServiceProvider($app); $serviceProvider->register(); } /** * @covers \Engelsystem\Mail\MailerServiceProvider::getSmtpTransport */ public function testGetSmtpTransport() { $app = $this->getApplication($this->smtpConfig); $serviceProvider = new MailerServiceProvider($app); $serviceProvider->register(); /** @var EsmtpTransport $transport */ $transport = $app->get('mailer.transport'); $this->assertEquals($this->smtpConfig['email']['username'], $transport->getUsername()); $this->assertEquals($this->smtpConfig['email']['password'], $transport->getPassword()); } /** * @param array $configuration * @return Application */ protected function getApplication($configuration = []): Application { $app = new Application(); $configuration = new Config(array_replace_recursive($this->defaultConfig, $configuration)); $app->instance('config', $configuration); $logger = $this->getMockForAbstractClass(LoggerInterface::class); $app->instance(LoggerInterface::class, $logger); return $app; } /** * @param string[] $abstracts * @param Application $container */ protected function assertExistsInContainer($abstracts, $container) { $first = array_shift($abstracts); $this->assertContainerHas($first, $container); foreach ($abstracts as $abstract) { $this->assertContainerHas($abstract, $container); $this->assertEquals($container->get($first), $container->get($abstract)); } } /** * @param string $abstract * @param Application $container */ protected function assertContainerHas($abstract, $container) { $this->assertTrue( $container->has($abstract) || $container->hasMethodBinding($abstract), sprintf('Container does not contain abstract %s', $abstract) ); } }
gpl-2.0
pulse-project/mmc-core
web/modules/xmppmaster/xmppmaster/machine_xmpp_detail.php
1270
<?php /* * (c) 2017 Siveo, http://www.siveo.net * * $Id$ * * This file is part of MMC, http://www.siveo.net * * MMC 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. * * MMC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * File xmppmaster/machine_xmpp_detail.php */ // recupere information machine //print_r($_GET); extract($_GET); ?> <?php //print_r($_GET); $cn = explode ( "/", $machine)[1]; $machinexmpp = xmlrpc_getMachinefromjid($machine); header('Location: main.php?module=base&submod=computers&action=glpitabs&cn='.urlencode($cn).'&objectUUID='.urlencode($machinexmpp['uuid_inventorymachine'])); exit(); /* echo "<pre>"; print_r($machinexmpp); echo "</pre>";*/ ?>
gpl-2.0
QuantiModo/quantimodo-android-chrome-ios-web-app
plain-javascript-client/test/generated/model/PostUserSettingsDataResponse.spec.js
2975
var expect = require('expect.js'); var Quantimodo = require('../../index'); var instance; beforeEach(function(){ instance = new Quantimodo.PostUserSettingsDataResponse(); }); describe('PostUserSettingsDataResponse', function(){ it('should create an instance of PostUserSettingsDataResponse', function(){ // uncomment below and update the code to test PostUserSettingsDataResponse //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be.a(Quantimodo.PostUserSettingsDataResponse); }); it('should have the property purchaseId (base name: "purchaseId")', function(){ // uncomment below and update the code to test the property purchaseId //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be(); }); it('should have the property description (base name: "description")', function(){ // uncomment below and update the code to test the property description //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be(); }); it('should have the property summary (base name: "summary")', function(){ // uncomment below and update the code to test the property summary //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be(); }); it('should have the property errors (base name: "errors")', function(){ // uncomment below and update the code to test the property errors //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be(); }); it('should have the property status (base name: "status")', function(){ // uncomment below and update the code to test the property status //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be(); }); it('should have the property success (base name: "success")', function(){ // uncomment below and update the code to test the property success //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be(); }); it('should have the property code (base name: "code")', function(){ // uncomment below and update the code to test the property code //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be(); }); it('should have the property link (base name: "link")', function(){ // uncomment below and update the code to test the property link //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be(); }); it('should have the property card (base name: "card")', function(){ // uncomment below and update the code to test the property card //var instance = new Quantimodo.PostUserSettingsDataResponse(); //expect(instance).to.be(); }); });
gpl-2.0
howtomakeaturn/nomadic
public/modules/nomadicore/css/style.css
3531
body { font-size: 14px; font-family: Arial, "文泉驛正黑", "WenQuanYi Zen Hei", "儷黑 Pro", "LiHei Pro", "微軟正黑體", "Microsoft JhengHei", "標楷體", DFKai-SB, sans-serif; } @media (min-width: 768px) { body { font-size: 15px; } } .row.no-padding > [class*='col-'] { padding-right:0; padding-left:0; } .row.small-padding { margin-left: -5px; margin-right: -5px; } .row.small-padding > [class*='col-'] { padding-right:5px; padding-left:5px; } td { cursor: pointer; } th { cursor: pointer; font-size: 12px; } td.-small { width: 80px; } td.-medium { width: 120px; } td.-large { width: 230px; } .blue { color: #2196F3; } .yellow { color: #FFC107; } .grey { color: #757575; } .note { margin-top: 5px; } .minor { font-size: 14px; } .modal .n { color: #757575; padding: 0px 10px; margin-bottom: 10px; } .rating-box { margin-bottom: 10px; } .rating-box > .name { text-overflow:ellipsis; overflow:hidden; white-space:nowrap; width: calc(100% - 45px); display: inline-block; } .rating-box > .value { float: right; } .newlabel { display: inline-block; background-color: #00BCD4; padding-left: 7px; padding-right: 7px; color: white; margin-right: 2px; } .donatedlabel { display: inline-block; background-color: #2196F3; padding-left: 7px; padding-right: 7px; color: white; margin-right: 2px; } .cafe-tag { display: inline-block; padding: 5px 10px; background-color: #EEEEEE; color: #616161; margin-bottom: 5px; border-radius: 3px; } .cafe-tag:hover { cursor: pointer; background-color: #E0E0E0; color: #616161; text-decoration: none; } .city-box { text-align: center; margin-bottom: 10px; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; background-color: #F5F5F5; border-radius: 5px; } .city-box .name { font-size: 16px; } @media (min-width: 768px) { .city-box .name { font-size: 18px; } } .city-box a { } .city-box .navigation { margin-top: 5px; margin-bottom: 5px; } .city-box .info { font-size: 12px; color: #9e9e9e; } .city-box .green { color: #4CAF50; font-weight: bold; } .city-box .blue { color: #42A5F5; font-weight: bold; } .city-box .orange { color: #FF9800; font-weight: bold; } .city-box .yellow { font-weight: bold; } ._thumbnail { position: relative; width: 150px; height: 150px; overflow: hidden; display: inline-block; } @media (min-width: 768px) { ._thumbnail { width: 280px; height: 280px; } } ._thumbnail img.photo { position: absolute; left: 50%; top: 50%; height: 100%; width: auto; -webkit-transform: translate(-50%,-50%); -ms-transform: translate(-50%,-50%); transform: translate(-50%,-50%); } ._thumbnail img.photo.portrait { width: 100%; height: auto; } ._thumbnail img.photo:hover { cursor: pointer; } ._thumbnail.-small { width: 90px; height: 90px; } @media (min-width: 768px) { ._thumbnail.-small { width: 115px; height: 115px; } } .seo-link { color: #333; } .seo-link:hover { cursor: pointer; } @media (min-width: 768px) { .cafe-modal .modal-dialog { width: 700px; } .cafe-modal .modal-header, .cafe-modal .modal-body, .cafe-modal .modal-footer { padding-left: 30px; padding-right: 30px; } }
gpl-2.0
nerilex/avr-crypto-lib
hfal/hfal-test.h
1110
/* hfal-test.h */ /* This file is part of the AVR-Crypto-Lib. Copyright (C) 2006-2015 Daniel Otte ([email protected]) 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * \file hfal-test.h * \author Daniel Otte * \email [email protected] * \date 2009-05-10 * \license GPLv3 or later * */ #ifndef HFAL_TEST_H_ #define HFAL_TEST_H_ #include "hashfunction_descriptor.h" #include <stdint.h> void hfal_test(const hfdesc_t *hd, void *msg, uint32_t length_b); #endif /* HFAL_TEST_H_ */
gpl-2.0
bitflipper1/bitfliptech.com
wp-content/themes/ta-pluton/css/pluton-ie7.css
51592
[class^="icon-"], [class*=" icon-"] { font-family: 'pluton'; font-style: normal; font-weight: normal; /* fix buttons height */ line-height: 1em; /* you can be more comfortable with increased icons size */ /* font-size: 120%; */ } .icon-glass { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe800;&nbsp;'); } .icon-music { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe801;&nbsp;'); } .icon-search { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe802;&nbsp;'); } .icon-mail { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe803;&nbsp;'); } .icon-mail-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe804;&nbsp;'); } .icon-mail-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe805;&nbsp;'); } .icon-heart { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe806;&nbsp;'); } .icon-heart-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe807;&nbsp;'); } .icon-star { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe808;&nbsp;'); } .icon-star-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe809;&nbsp;'); } .icon-star-half { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80a;&nbsp;'); } .icon-star-half-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80b;&nbsp;'); } .icon-user { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80c;&nbsp;'); } .icon-users { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80d;&nbsp;'); } .icon-male { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80e;&nbsp;'); } .icon-female { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe80f;&nbsp;'); } .icon-child { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe810;&nbsp;'); } .icon-video { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe811;&nbsp;'); } .icon-videocam { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe812;&nbsp;'); } .icon-picture { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe813;&nbsp;'); } .icon-camera { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe814;&nbsp;'); } .icon-camera-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe815;&nbsp;'); } .icon-th-large { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe816;&nbsp;'); } .icon-th { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe817;&nbsp;'); } .icon-th-list { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe818;&nbsp;'); } .icon-ok { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe819;&nbsp;'); } .icon-ok-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe81a;&nbsp;'); } .icon-ok-circled2 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe81b;&nbsp;'); } .icon-ok-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe81c;&nbsp;'); } .icon-cancel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe81d;&nbsp;'); } .icon-cancel-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe81e;&nbsp;'); } .icon-cancel-circled2 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe81f;&nbsp;'); } .icon-plus { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe820;&nbsp;'); } .icon-plus-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe821;&nbsp;'); } .icon-plus-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe822;&nbsp;'); } .icon-plus-squared-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe823;&nbsp;'); } .icon-minus { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe824;&nbsp;'); } .icon-minus-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe825;&nbsp;'); } .icon-minus-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe826;&nbsp;'); } .icon-minus-squared-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe827;&nbsp;'); } .icon-help { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe828;&nbsp;'); } .icon-help-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe829;&nbsp;'); } .icon-info-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe82a;&nbsp;'); } .icon-info { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe82b;&nbsp;'); } .icon-home { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe82c;&nbsp;'); } .icon-link { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe82d;&nbsp;'); } .icon-unlink { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe82e;&nbsp;'); } .icon-link-ext { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe82f;&nbsp;'); } .icon-link-ext-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe830;&nbsp;'); } .icon-attach { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe831;&nbsp;'); } .icon-lock { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe832;&nbsp;'); } .icon-lock-open { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe833;&nbsp;'); } .icon-lock-open-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe834;&nbsp;'); } .icon-pin { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe835;&nbsp;'); } .icon-eye { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe836;&nbsp;'); } .icon-eye-off { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe837;&nbsp;'); } .icon-tag { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe838;&nbsp;'); } .icon-tags { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe839;&nbsp;'); } .icon-bookmark { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe83a;&nbsp;'); } .icon-bookmark-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe83b;&nbsp;'); } .icon-flag { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe83c;&nbsp;'); } .icon-flag-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe83d;&nbsp;'); } .icon-flag-checkered { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe83e;&nbsp;'); } .icon-thumbs-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe83f;&nbsp;'); } .icon-thumbs-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe840;&nbsp;'); } .icon-thumbs-up-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe841;&nbsp;'); } .icon-thumbs-down-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe842;&nbsp;'); } .icon-download { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe843;&nbsp;'); } .icon-upload { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe844;&nbsp;'); } .icon-download-cloud { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe845;&nbsp;'); } .icon-upload-cloud { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe846;&nbsp;'); } .icon-reply { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe847;&nbsp;'); } .icon-reply-all { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe848;&nbsp;'); } .icon-forward { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe849;&nbsp;'); } .icon-quote-left { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe84a;&nbsp;'); } .icon-quote-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe84b;&nbsp;'); } .icon-code { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe84c;&nbsp;'); } .icon-export { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe84d;&nbsp;'); } .icon-export-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe84e;&nbsp;'); } .icon-share { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe84f;&nbsp;'); } .icon-share-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe850;&nbsp;'); } .icon-pencil { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe851;&nbsp;'); } .icon-pencil-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe852;&nbsp;'); } .icon-edit { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe853;&nbsp;'); } .icon-print { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe854;&nbsp;'); } .icon-retweet { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe855;&nbsp;'); } .icon-keyboard { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe856;&nbsp;'); } .icon-gamepad { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe857;&nbsp;'); } .icon-comment { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe858;&nbsp;'); } .icon-chat { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe859;&nbsp;'); } .icon-comment-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe85a;&nbsp;'); } .icon-chat-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe85b;&nbsp;'); } .icon-bell { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe85c;&nbsp;'); } .icon-bell-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe85d;&nbsp;'); } .icon-bell-off { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe85e;&nbsp;'); } .icon-bell-off-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe85f;&nbsp;'); } .icon-attention-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe860;&nbsp;'); } .icon-attention { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe861;&nbsp;'); } .icon-attention-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe862;&nbsp;'); } .icon-location { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe863;&nbsp;'); } .icon-direction { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe864;&nbsp;'); } .icon-compass { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe865;&nbsp;'); } .icon-trash { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe866;&nbsp;'); } .icon-trash-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe867;&nbsp;'); } .icon-doc { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe868;&nbsp;'); } .icon-docs { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe869;&nbsp;'); } .icon-doc-text { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe86a;&nbsp;'); } .icon-doc-inv { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe86b;&nbsp;'); } .icon-doc-text-inv { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe86c;&nbsp;'); } .icon-file-pdf { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe86d;&nbsp;'); } .icon-file-word { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe86e;&nbsp;'); } .icon-file-excel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe86f;&nbsp;'); } .icon-file-powerpoint { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe870;&nbsp;'); } .icon-file-image { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe871;&nbsp;'); } .icon-file-archive { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe872;&nbsp;'); } .icon-file-audio { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe873;&nbsp;'); } .icon-file-video { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe874;&nbsp;'); } .icon-file-code { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe875;&nbsp;'); } .icon-folder { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe876;&nbsp;'); } .icon-folder-open { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe877;&nbsp;'); } .icon-folder-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe878;&nbsp;'); } .icon-folder-open-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe879;&nbsp;'); } .icon-box { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe87a;&nbsp;'); } .icon-rss { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe87b;&nbsp;'); } .icon-rss-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe87c;&nbsp;'); } .icon-phone { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe87d;&nbsp;'); } .icon-phone-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe87e;&nbsp;'); } .icon-fax { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe87f;&nbsp;'); } .icon-menu { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe880;&nbsp;'); } .icon-cog { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe881;&nbsp;'); } .icon-cog-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe882;&nbsp;'); } .icon-wrench { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe883;&nbsp;'); } .icon-sliders { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe884;&nbsp;'); } .icon-basket { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe885;&nbsp;'); } .icon-calendar { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe886;&nbsp;'); } .icon-calendar-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe887;&nbsp;'); } .icon-login { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe888;&nbsp;'); } .icon-logout { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe889;&nbsp;'); } .icon-mic { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe88a;&nbsp;'); } .icon-mute { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe88b;&nbsp;'); } .icon-volume-off { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe88c;&nbsp;'); } .icon-volume-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe88d;&nbsp;'); } .icon-volume-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe88e;&nbsp;'); } .icon-headphones { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe88f;&nbsp;'); } .icon-clock { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe890;&nbsp;'); } .icon-lightbulb { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe891;&nbsp;'); } .icon-block { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe892;&nbsp;'); } .icon-resize-full { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe893;&nbsp;'); } .icon-resize-full-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe894;&nbsp;'); } .icon-resize-small { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe895;&nbsp;'); } .icon-resize-vertical { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe896;&nbsp;'); } .icon-resize-horizontal { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe897;&nbsp;'); } .icon-move { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe898;&nbsp;'); } .icon-zoom-in { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe899;&nbsp;'); } .icon-zoom-out { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe89a;&nbsp;'); } .icon-down-circled2 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe89b;&nbsp;'); } .icon-up-circled2 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe89c;&nbsp;'); } .icon-left-circled2 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe89d;&nbsp;'); } .icon-right-circled2 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe89e;&nbsp;'); } .icon-down-dir { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe89f;&nbsp;'); } .icon-up-dir { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a0;&nbsp;'); } .icon-left-dir { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a1;&nbsp;'); } .icon-right-dir { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a2;&nbsp;'); } .icon-down-open { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a3;&nbsp;'); } .icon-left-open { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a4;&nbsp;'); } .icon-right-open { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a5;&nbsp;'); } .icon-up-open { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a6;&nbsp;'); } .icon-angle-left { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a7;&nbsp;'); } .icon-angle-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a8;&nbsp;'); } .icon-angle-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8a9;&nbsp;'); } .icon-angle-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8aa;&nbsp;'); } .icon-angle-circled-left { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ab;&nbsp;'); } .icon-angle-circled-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ac;&nbsp;'); } .icon-angle-circled-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ad;&nbsp;'); } .icon-angle-circled-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ae;&nbsp;'); } .icon-angle-double-left { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8af;&nbsp;'); } .icon-angle-double-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b0;&nbsp;'); } .icon-angle-double-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b1;&nbsp;'); } .icon-angle-double-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b2;&nbsp;'); } .icon-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b3;&nbsp;'); } .icon-left { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b4;&nbsp;'); } .icon-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b5;&nbsp;'); } .icon-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b6;&nbsp;'); } .icon-down-big { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b7;&nbsp;'); } .icon-left-big { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b8;&nbsp;'); } .icon-right-big { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8b9;&nbsp;'); } .icon-up-big { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ba;&nbsp;'); } .icon-right-hand { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8bb;&nbsp;'); } .icon-left-hand { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8bc;&nbsp;'); } .icon-up-hand { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8bd;&nbsp;'); } .icon-down-hand { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8be;&nbsp;'); } .icon-left-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8bf;&nbsp;'); } .icon-right-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c0;&nbsp;'); } .icon-up-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c1;&nbsp;'); } .icon-down-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c2;&nbsp;'); } .icon-cw { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c3;&nbsp;'); } .icon-ccw { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c4;&nbsp;'); } .icon-arrows-cw { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c5;&nbsp;'); } .icon-level-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c6;&nbsp;'); } .icon-level-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c7;&nbsp;'); } .icon-shuffle { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c8;&nbsp;'); } .icon-exchange { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8c9;&nbsp;'); } .icon-history { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ca;&nbsp;'); } .icon-expand { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8cb;&nbsp;'); } .icon-collapse { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8cc;&nbsp;'); } .icon-expand-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8cd;&nbsp;'); } .icon-collapse-left { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ce;&nbsp;'); } .icon-play { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8cf;&nbsp;'); } .icon-play-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d0;&nbsp;'); } .icon-play-circled2 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d1;&nbsp;'); } .icon-stop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d2;&nbsp;'); } .icon-pause { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d3;&nbsp;'); } .icon-to-end { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d4;&nbsp;'); } .icon-to-end-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d5;&nbsp;'); } .icon-to-start { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d6;&nbsp;'); } .icon-to-start-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d7;&nbsp;'); } .icon-fast-fw { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d8;&nbsp;'); } .icon-fast-bw { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8d9;&nbsp;'); } .icon-eject { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8da;&nbsp;'); } .icon-target { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8db;&nbsp;'); } .icon-signal { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8dc;&nbsp;'); } .icon-wifi { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8dd;&nbsp;'); } .icon-award { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8de;&nbsp;'); } .icon-desktop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8df;&nbsp;'); } .icon-laptop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e0;&nbsp;'); } .icon-tablet { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e1;&nbsp;'); } .icon-mobile { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e2;&nbsp;'); } .icon-inbox { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e3;&nbsp;'); } .icon-globe { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e4;&nbsp;'); } .icon-sun { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e5;&nbsp;'); } .icon-cloud { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e6;&nbsp;'); } .icon-flash { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e7;&nbsp;'); } .icon-moon { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e8;&nbsp;'); } .icon-umbrella { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8e9;&nbsp;'); } .icon-flight { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ea;&nbsp;'); } .icon-fighter-jet { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8eb;&nbsp;'); } .icon-paper-plane { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ec;&nbsp;'); } .icon-paper-plane-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ed;&nbsp;'); } .icon-space-shuttle { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ee;&nbsp;'); } .icon-leaf { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ef;&nbsp;'); } .icon-font { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f0;&nbsp;'); } .icon-bold { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f1;&nbsp;'); } .icon-italic { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f2;&nbsp;'); } .icon-header { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f3;&nbsp;'); } .icon-paragraph { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f4;&nbsp;'); } .icon-text-height { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f5;&nbsp;'); } .icon-text-width { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f6;&nbsp;'); } .icon-align-left { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f7;&nbsp;'); } .icon-align-center { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f8;&nbsp;'); } .icon-align-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8f9;&nbsp;'); } .icon-align-justify { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8fa;&nbsp;'); } .icon-list { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8fb;&nbsp;'); } .icon-indent-left { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8fc;&nbsp;'); } .icon-indent-right { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8fd;&nbsp;'); } .icon-list-bullet { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8fe;&nbsp;'); } .icon-list-numbered { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe8ff;&nbsp;'); } .icon-strike { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe900;&nbsp;'); } .icon-underline { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe901;&nbsp;'); } .icon-superscript { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe902;&nbsp;'); } .icon-subscript { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe903;&nbsp;'); } .icon-table { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe904;&nbsp;'); } .icon-columns { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe905;&nbsp;'); } .icon-crop { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe906;&nbsp;'); } .icon-scissors { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe907;&nbsp;'); } .icon-paste { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe908;&nbsp;'); } .icon-briefcase { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe909;&nbsp;'); } .icon-suitcase { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe90a;&nbsp;'); } .icon-ellipsis { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe90b;&nbsp;'); } .icon-ellipsis-vert { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe90c;&nbsp;'); } .icon-off { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe90d;&nbsp;'); } .icon-road { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe90e;&nbsp;'); } .icon-list-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe90f;&nbsp;'); } .icon-qrcode { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe910;&nbsp;'); } .icon-barcode { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe911;&nbsp;'); } .icon-book { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe912;&nbsp;'); } .icon-ajust { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe913;&nbsp;'); } .icon-tint { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe914;&nbsp;'); } .icon-toggle-off { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe915;&nbsp;'); } .icon-toggle-on { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe916;&nbsp;'); } .icon-check { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe917;&nbsp;'); } .icon-check-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe918;&nbsp;'); } .icon-circle { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe919;&nbsp;'); } .icon-circle-empty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe91a;&nbsp;'); } .icon-circle-thin { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe91b;&nbsp;'); } .icon-circle-notch { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe91c;&nbsp;'); } .icon-dot-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe91d;&nbsp;'); } .icon-asterisk { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe91e;&nbsp;'); } .icon-gift { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe91f;&nbsp;'); } .icon-fire { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe920;&nbsp;'); } .icon-magnet { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe921;&nbsp;'); } .icon-chart-bar { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe922;&nbsp;'); } .icon-chart-area { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe923;&nbsp;'); } .icon-chart-pie { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe924;&nbsp;'); } .icon-chart-line { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe925;&nbsp;'); } .icon-ticket { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe926;&nbsp;'); } .icon-credit-card { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe927;&nbsp;'); } .icon-floppy { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe928;&nbsp;'); } .icon-megaphone { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe929;&nbsp;'); } .icon-hdd { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe92a;&nbsp;'); } .icon-key { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe92b;&nbsp;'); } .icon-fork { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe92c;&nbsp;'); } .icon-rocket { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe92d;&nbsp;'); } .icon-bug { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe92e;&nbsp;'); } .icon-certificate { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe92f;&nbsp;'); } .icon-tasks { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe930;&nbsp;'); } .icon-filter { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe931;&nbsp;'); } .icon-beaker { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe932;&nbsp;'); } .icon-magic { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe933;&nbsp;'); } .icon-cab { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe934;&nbsp;'); } .icon-taxi { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe935;&nbsp;'); } .icon-truck { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe936;&nbsp;'); } .icon-bus { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe937;&nbsp;'); } .icon-bicycle { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe938;&nbsp;'); } .icon-money { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe939;&nbsp;'); } .icon-euro { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe93a;&nbsp;'); } .icon-pound { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe93b;&nbsp;'); } .icon-dollar { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe93c;&nbsp;'); } .icon-rupee { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe93d;&nbsp;'); } .icon-yen { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe93e;&nbsp;'); } .icon-rouble { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe93f;&nbsp;'); } .icon-shekel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe940;&nbsp;'); } .icon-try { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe941;&nbsp;'); } .icon-won { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe942;&nbsp;'); } .icon-bitcoin { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe943;&nbsp;'); } .icon-sort { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe944;&nbsp;'); } .icon-sort-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe945;&nbsp;'); } .icon-sort-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe946;&nbsp;'); } .icon-sort-alt-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe947;&nbsp;'); } .icon-sort-alt-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe948;&nbsp;'); } .icon-sort-name-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe949;&nbsp;'); } .icon-sort-name-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe94a;&nbsp;'); } .icon-sort-number-up { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe94b;&nbsp;'); } .icon-sort-number-down { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe94c;&nbsp;'); } .icon-hammer { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe94d;&nbsp;'); } .icon-gauge { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe94e;&nbsp;'); } .icon-sitemap { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe94f;&nbsp;'); } .icon-spinner { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe950;&nbsp;'); } .icon-coffee { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe951;&nbsp;'); } .icon-food { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe952;&nbsp;'); } .icon-beer { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe953;&nbsp;'); } .icon-user-md { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe954;&nbsp;'); } .icon-stethoscope { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe955;&nbsp;'); } .icon-ambulance { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe956;&nbsp;'); } .icon-medkit { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe957;&nbsp;'); } .icon-h-sigh { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe958;&nbsp;'); } .icon-hospital { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe959;&nbsp;'); } .icon-building { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95a;&nbsp;'); } .icon-building-filled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95b;&nbsp;'); } .icon-bank { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95c;&nbsp;'); } .icon-smile { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95d;&nbsp;'); } .icon-frown { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95e;&nbsp;'); } .icon-meh { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe95f;&nbsp;'); } .icon-anchor { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe960;&nbsp;'); } .icon-terminal { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe961;&nbsp;'); } .icon-eraser { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe962;&nbsp;'); } .icon-puzzle { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe963;&nbsp;'); } .icon-shield { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe964;&nbsp;'); } .icon-extinguisher { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe965;&nbsp;'); } .icon-bullseye { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe966;&nbsp;'); } .icon-wheelchair { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe967;&nbsp;'); } .icon-language { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe968;&nbsp;'); } .icon-graduation-cap { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe969;&nbsp;'); } .icon-paw { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe96a;&nbsp;'); } .icon-spoon { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe96b;&nbsp;'); } .icon-cube { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe96c;&nbsp;'); } .icon-cubes { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe96d;&nbsp;'); } .icon-recycle { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe96e;&nbsp;'); } .icon-tree { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe96f;&nbsp;'); } .icon-database { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe970;&nbsp;'); } .icon-lifebuoy { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe971;&nbsp;'); } .icon-rebel { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe972;&nbsp;'); } .icon-empire { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe973;&nbsp;'); } .icon-bomb { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe974;&nbsp;'); } .icon-soccer-ball { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe975;&nbsp;'); } .icon-tty { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe976;&nbsp;'); } .icon-binoculars { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe977;&nbsp;'); } .icon-plug { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe978;&nbsp;'); } .icon-newspaper { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe979;&nbsp;'); } .icon-calc { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe97a;&nbsp;'); } .icon-copyright { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe97b;&nbsp;'); } .icon-at { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe97c;&nbsp;'); } .icon-eyedropper { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe97d;&nbsp;'); } .icon-brush { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe97e;&nbsp;'); } .icon-birthday { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe97f;&nbsp;'); } .icon-cc-visa { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe980;&nbsp;'); } .icon-cc-mastercard { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe981;&nbsp;'); } .icon-cc-discover { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe982;&nbsp;'); } .icon-cc-amex { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe983;&nbsp;'); } .icon-cc-paypal { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe984;&nbsp;'); } .icon-cc-stripe { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe985;&nbsp;'); } .icon-adn { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe986;&nbsp;'); } .icon-android { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe987;&nbsp;'); } .icon-angellist { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe988;&nbsp;'); } .icon-apple { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe989;&nbsp;'); } .icon-behance { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe98a;&nbsp;'); } .icon-behance-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe98b;&nbsp;'); } .icon-bitbucket { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe98c;&nbsp;'); } .icon-bitbucket-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe98d;&nbsp;'); } .icon-cc { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe98e;&nbsp;'); } .icon-codeopen { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe98f;&nbsp;'); } .icon-css3 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe990;&nbsp;'); } .icon-delicious { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe991;&nbsp;'); } .icon-deviantart { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe992;&nbsp;'); } .icon-digg { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe993;&nbsp;'); } .icon-dribbble { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe994;&nbsp;'); } .icon-dropbox { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe995;&nbsp;'); } .icon-drupal { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe996;&nbsp;'); } .icon-facebook { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe997;&nbsp;'); } .icon-facebook-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe998;&nbsp;'); } .icon-flickr { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe999;&nbsp;'); } .icon-foursquare { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe99a;&nbsp;'); } .icon-git-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe99b;&nbsp;'); } .icon-git { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe99c;&nbsp;'); } .icon-github { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe99d;&nbsp;'); } .icon-github-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe99e;&nbsp;'); } .icon-github-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe99f;&nbsp;'); } .icon-gittip { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a0;&nbsp;'); } .icon-google { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a1;&nbsp;'); } .icon-gplus { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a2;&nbsp;'); } .icon-gplus-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a3;&nbsp;'); } .icon-gwallet { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a4;&nbsp;'); } .icon-hacker-news { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a5;&nbsp;'); } .icon-html5 { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a6;&nbsp;'); } .icon-instagramm { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a7;&nbsp;'); } .icon-ioxhost { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a8;&nbsp;'); } .icon-joomla { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9a9;&nbsp;'); } .icon-jsfiddle { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9aa;&nbsp;'); } .icon-lastfm { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9ab;&nbsp;'); } .icon-lastfm-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9ac;&nbsp;'); } .icon-linkedin-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9ad;&nbsp;'); } .icon-linux { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9ae;&nbsp;'); } .icon-linkedin { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9af;&nbsp;'); } .icon-maxcdn { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b0;&nbsp;'); } .icon-meanpath { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b1;&nbsp;'); } .icon-openid { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b2;&nbsp;'); } .icon-pagelines { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b3;&nbsp;'); } .icon-paypal { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b4;&nbsp;'); } .icon-pied-piper-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b5;&nbsp;'); } .icon-pied-piper-alt { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b6;&nbsp;'); } .icon-pinterest-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b7;&nbsp;'); } .icon-pinterest-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b8;&nbsp;'); } .icon-qq { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9b9;&nbsp;'); } .icon-reddit { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9ba;&nbsp;'); } .icon-reddit-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9bb;&nbsp;'); } .icon-renren { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9bc;&nbsp;'); } .icon-skype { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9bd;&nbsp;'); } .icon-slack { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9be;&nbsp;'); } .icon-slideshare { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9bf;&nbsp;'); } .icon-spotify { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c0;&nbsp;'); } .icon-twitch { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c1;&nbsp;'); } .icon-twitter-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c2;&nbsp;'); } .icon-twitter { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c3;&nbsp;'); } .icon-vimeo-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c4;&nbsp;'); } .icon-vine { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c5;&nbsp;'); } .icon-vkontakte { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c6;&nbsp;'); } .icon-wechat { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c7;&nbsp;'); } .icon-weibo { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c8;&nbsp;'); } .icon-wordpress { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9c9;&nbsp;'); } .icon-stackexchange { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9ca;&nbsp;'); } .icon-stackoverflow { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9cb;&nbsp;'); } .icon-steam { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9cc;&nbsp;'); } .icon-steam-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9cd;&nbsp;'); } .icon-stumbleupon { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9ce;&nbsp;'); } .icon-stumbleupon-circled { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9cf;&nbsp;'); } .icon-tencent-weibo { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d0;&nbsp;'); } .icon-trello { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d1;&nbsp;'); } .icon-tumblr { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d2;&nbsp;'); } .icon-tumblr-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d3;&nbsp;'); } .icon-xing { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d4;&nbsp;'); } .icon-xing-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d5;&nbsp;'); } .icon-yelp { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d6;&nbsp;'); } .icon-youtube { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d7;&nbsp;'); } .icon-yahoo { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d8;&nbsp;'); } .icon-youtube-squared { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9d9;&nbsp;'); } .icon-youtube-play { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9da;&nbsp;'); } .icon-blank { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9db;&nbsp;'); } .icon-lemon { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9dc;&nbsp;'); } .icon-windows { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9dd;&nbsp;'); } .icon-soundcloud { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe9de;&nbsp;'); }
gpl-2.0
AshishNaik021/iimisac-d8
modules/photos/photos_access/css/photos_access.node.form.css
49
.photos_access-hidden-field { display: none; }
gpl-2.0
TrampolineRTOS/trampoline
tests/functional/autosar_sts_s2/error_instance4.c
2014
/** * @file autosar_sts_s2/error_instance4.c * * @section desc File description * * @section copyright Copyright * * Trampoline Test Suite * * Trampoline Test Suite is copyright (c) IRCCyN 2005-2007 * Trampoline Test Suite is protected by the French intellectual property law. * * 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; version 2 * of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * @section infos File informations * * $Date$ * $Rev$ * $Author$ * $URL$ */ /*Instance 4 of error*/ #include "Os.h" DeclareScheduleTable(INVALID_SCHEDULETABLE); /*test case:test the reaction of the system called with an activation of a task*/ static void test_error_instance4(void) { StatusType result_inst_1; SCHEDULING_CHECK_INIT(8); result_inst_1 = OSErrorGetServiceId(); SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8,INVALID_SCHEDULETABLE , OSError_SyncScheduleTable_ScheduleTableID()); SCHEDULING_CHECK_AND_EQUAL_INT_FIRST(8,1 , OSError_SyncScheduleTable_value()); SCHEDULING_CHECK_AND_EQUAL_INT(8,OSServiceId_SyncScheduleTable, result_inst_1); } /*create the test suite with all the test cases*/ TestRef AutosarSTSTest_seq2_error_instance4(void) { EMB_UNIT_TESTFIXTURES(fixtures) { new_TestFixture("test_error_instance4",test_error_instance4) }; EMB_UNIT_TESTCALLER(AutosarSTSTest,"AutosarSTSTest_sequence2",NULL,NULL,fixtures); return (TestRef)&AutosarSTSTest; } /* End of file autosar_sts_s2/error_instance4.c */
gpl-2.0
yaii/yai
src/sp-item.cpp
59315
/** \file * Base class for visual SVG elements */ /* * Authors: * Lauris Kaplinski <[email protected]> * bulia byak <[email protected]> * Johan Engelen <[email protected]> * Abhishek Sharma * Jon A. Cruz <[email protected]> * * Copyright (C) 2001-2006 authors * Copyright (C) 2001 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information */ /** \class SPItem * * SPItem is an abstract base class for all graphic (visible) SVG nodes. It * is a subclass of SPObject, with great deal of specific functionality. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "sp-item.h" #include "svg/svg.h" #include "print.h" #include "display/drawing-item.h" #include "attributes.h" #include "document.h" #include "uri.h" #include "inkscape.h" #include "desktop.h" #include "desktop-handles.h" #include "style.h" #include <glibmm/i18n.h> #include "sp-root.h" #include "sp-clippath.h" #include "sp-mask.h" #include "sp-rect.h" #include "sp-use.h" #include "sp-text.h" #include "sp-textpath.h" #include "sp-item-rm-unsatisfied-cns.h" #include "sp-pattern.h" #include "sp-paint-server.h" #include "sp-switch.h" #include "sp-guide-constraint.h" #include "gradient-chemistry.h" #include "preferences.h" #include "conn-avoid-ref.h" #include "conditions.h" #include "sp-filter-reference.h" #include "filter-chemistry.h" #include "sp-guide.h" #include "sp-title.h" #include "sp-desc.h" #include "util/find-last-if.h" #include "util/reverse-list.h" #include <2geom/rect.h> #include <2geom/affine.h> #include <2geom/transforms.h> #include "xml/repr.h" #include "extract-uri.h" #include "helper/geom.h" #include "live_effects/lpeobject.h" #include "live_effects/effect.h" #include "live_effects/lpeobject-reference.h" #include "util/units.h" #define noSP_ITEM_DEBUG_IDLE static SPItemView* sp_item_view_list_remove(SPItemView *list, SPItemView *view); SPItem::SPItem() : SPObject() { this->sensitive = 0; this->clip_ref = NULL; this->avoidRef = NULL; this->_is_evaluated = false; this->stop_paint = 0; this->_evaluated_status = StatusUnknown; this->bbox_valid = 0; this->freeze_stroke_width = false; this->transform_center_x = 0; this->transform_center_y = 0; this->display = NULL; this->mask_ref = NULL; sensitive = TRUE; bbox_valid = FALSE; transform_center_x = 0; transform_center_y = 0; _is_evaluated = true; _evaluated_status = StatusUnknown; transform = Geom::identity(); doc_bbox = Geom::OptRect(); freeze_stroke_width = false; display = NULL; clip_ref = new SPClipPathReference(this); clip_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(clip_ref_changed), this)); mask_ref = new SPMaskReference(this); mask_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(mask_ref_changed), this)); style->signal_fill_ps_changed.connect(sigc::bind(sigc::ptr_fun(fill_ps_ref_changed), this)); style->signal_stroke_ps_changed.connect(sigc::bind(sigc::ptr_fun(stroke_ps_ref_changed), this)); avoidRef = new SPAvoidRef(this); } SPItem::~SPItem() { } bool SPItem::isVisibleAndUnlocked() const { return (!isHidden() && !isLocked()); } bool SPItem::isVisibleAndUnlocked(unsigned display_key) const { return (!isHidden(display_key) && !isLocked()); } bool SPItem::isLocked() const { for (SPObject const *o = this; o != NULL; o = o->parent) { if (SP_IS_ITEM(o) && !(SP_ITEM(o)->sensitive)) { return true; } } return false; } void SPItem::setLocked(bool locked) { setAttribute("sodipodi:insensitive", ( locked ? "1" : NULL )); updateRepr(); } bool SPItem::isHidden() const { if (!isEvaluated()) return true; return style->display.computed == SP_CSS_DISPLAY_NONE; } void SPItem::setHidden(bool hide) { style->display.set = TRUE; style->display.value = ( hide ? SP_CSS_DISPLAY_NONE : SP_CSS_DISPLAY_INLINE ); style->display.computed = style->display.value; style->display.inherit = FALSE; updateRepr(); } bool SPItem::isHidden(unsigned display_key) const { if (!isEvaluated()) return true; for ( SPItemView *view(display) ; view ; view = view->next ) { if ( view->key == display_key ) { g_assert(view->arenaitem != NULL); for ( Inkscape::DrawingItem *arenaitem = view->arenaitem ; arenaitem ; arenaitem = arenaitem->parent() ) { if (!arenaitem->visible()) { return true; } } return false; } } return true; } void SPItem::setEvaluated(bool evaluated) { _is_evaluated = evaluated; _evaluated_status = StatusSet; } void SPItem::resetEvaluated() { if ( StatusCalculated == _evaluated_status ) { _evaluated_status = StatusUnknown; bool oldValue = _is_evaluated; if ( oldValue != isEvaluated() ) { requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } } if ( StatusSet == _evaluated_status ) { if (SP_IS_SWITCH(parent)) { SP_SWITCH(parent)->resetChildEvaluated(); } } } bool SPItem::isEvaluated() const { if ( StatusUnknown == _evaluated_status ) { _is_evaluated = sp_item_evaluate(this); _evaluated_status = StatusCalculated; } return _is_evaluated; } /** * Returns something suitable for the `Hide' checkbox in the Object Properties dialog box. * Corresponds to setExplicitlyHidden. */ bool SPItem::isExplicitlyHidden() const { return (style->display.set && style->display.value == SP_CSS_DISPLAY_NONE); } /** * Sets the display CSS property to `hidden' if \a val is true, * otherwise makes it unset */ void SPItem::setExplicitlyHidden(bool val) { style->display.set = val; style->display.value = ( val ? SP_CSS_DISPLAY_NONE : SP_CSS_DISPLAY_INLINE ); style->display.computed = style->display.value; updateRepr(); } /** * Sets the transform_center_x and transform_center_y properties to retain the rotation center */ void SPItem::setCenter(Geom::Point const &object_centre) { document->ensureUpToDate(); // Copied from DocumentProperties::onDocUnitChange() gdouble viewscale = 1.0; Geom::Rect vb = this->document->getRoot()->viewBox; if ( !vb.hasZeroArea() ) { gdouble viewscale_w = this->document->getWidth().value("px") / vb.width(); gdouble viewscale_h = this->document->getHeight().value("px")/ vb.height(); viewscale = std::min(viewscale_h, viewscale_w); } // FIXME this is seriously wrong Geom::OptRect bbox = desktopGeometricBounds(); if (bbox) { // object centre is document coordinates (i.e. in pixels), so we need to consider the viewbox // to translate to user units; transform_center_x/y is in user units transform_center_x = (object_centre[Geom::X] - bbox->midpoint()[Geom::X])/viewscale; if (Geom::are_near(transform_center_x, 0)) // rounding error transform_center_x = 0; transform_center_y = (object_centre[Geom::Y] - bbox->midpoint()[Geom::Y])/viewscale; if (Geom::are_near(transform_center_y, 0)) // rounding error transform_center_y = 0; } } void SPItem::unsetCenter() { transform_center_x = 0; transform_center_y = 0; } bool SPItem::isCenterSet() const { return (transform_center_x != 0 || transform_center_y != 0); } // Get the item's transformation center in document coordinates (i.e. in pixels) Geom::Point SPItem::getCenter() const { document->ensureUpToDate(); // Copied from DocumentProperties::onDocUnitChange() gdouble viewscale = 1.0; Geom::Rect vb = this->document->getRoot()->viewBox; if ( !vb.hasZeroArea() ) { gdouble viewscale_w = this->document->getWidth().value("px") / vb.width(); gdouble viewscale_h = this->document->getHeight().value("px")/ vb.height(); viewscale = std::min(viewscale_h, viewscale_w); } // FIXME this is seriously wrong Geom::OptRect bbox = desktopGeometricBounds(); if (bbox) { // transform_center_x/y are stored in user units, so we have to take the viewbox into account to translate to document coordinates return bbox->midpoint() + Geom::Point (transform_center_x*viewscale, transform_center_y*viewscale); } else { return Geom::Point(0, 0); // something's wrong! } } void SPItem::scaleCenter(Geom::Scale const &sc) { transform_center_x *= sc[Geom::X]; transform_center_y *= sc[Geom::Y]; } namespace { bool is_item(SPObject const &object) { return SP_IS_ITEM(&object); } } void SPItem::raiseToTop() { using Inkscape::Algorithms::find_last_if; SPObject *topmost=find_last_if<SPObject::SiblingIterator>( next, NULL, &is_item ); if (topmost) { getRepr()->parent()->changeOrder( getRepr(), topmost->getRepr() ); } } void SPItem::raiseOne() { SPObject *next_higher=std::find_if<SPObject::SiblingIterator>( next, NULL, &is_item ); if (next_higher) { Inkscape::XML::Node *ref = next_higher->getRepr(); getRepr()->parent()->changeOrder(getRepr(), ref); } } void SPItem::lowerOne() { using Inkscape::Util::MutableList; using Inkscape::Util::reverse_list; MutableList<SPObject &> next_lower=std::find_if( reverse_list<SPObject::SiblingIterator>( parent->firstChild(), this ), MutableList<SPObject &>(), &is_item ); if (next_lower) { ++next_lower; Inkscape::XML::Node *ref = ( next_lower ? next_lower->getRepr() : NULL ); getRepr()->parent()->changeOrder(getRepr(), ref); } } void SPItem::lowerToBottom() { using Inkscape::Algorithms::find_last_if; using Inkscape::Util::MutableList; using Inkscape::Util::reverse_list; MutableList<SPObject &> bottom=find_last_if( reverse_list<SPObject::SiblingIterator>( parent->firstChild(), this ), MutableList<SPObject &>(), &is_item ); if (bottom) { ++bottom; Inkscape::XML::Node *ref = ( bottom ? bottom->getRepr() : NULL ); getRepr()->parent()->changeOrder(getRepr(), ref); } } /* * Move this SPItem into or after another SPItem in the doc * \param target - the SPItem to move into or after * \param intoafter - move to after the target (false), move inside (sublayer) of the target (true) */ void SPItem::moveTo(SPItem *target, gboolean intoafter) { Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : NULL ); Inkscape::XML::Node *our_ref = getRepr(); gboolean first = FALSE; if (target_ref == our_ref) { // Move to ourself ignore return; } if (!target_ref) { // Assume move to the "first" in the top node, find the top node target_ref = our_ref; while (target_ref->parent() != target_ref->root()) { target_ref = target_ref->parent(); } first = TRUE; } if (intoafter) { // Move this inside of the target at the end our_ref->parent()->removeChild(our_ref); target_ref->addChild(our_ref, NULL); } else if (target_ref->parent() != our_ref->parent()) { // Change in parent, need to remove and add our_ref->parent()->removeChild(our_ref); target_ref->parent()->addChild(our_ref, target_ref); } else if (!first) { // Same parent, just move our_ref->parent()->changeOrder(our_ref, target_ref); } if (first && parent) { // If "first" ensure it appears after the defs etc lowerToBottom(); return; } } void SPItem::build(SPDocument *document, Inkscape::XML::Node *repr) { SPItem* object = this; object->readAttr( "style" ); object->readAttr( "transform" ); object->readAttr( "clip-path" ); object->readAttr( "mask" ); object->readAttr( "sodipodi:insensitive" ); object->readAttr( "sodipodi:nonprintable" ); object->readAttr( "inkscape:transform-center-x" ); object->readAttr( "inkscape:transform-center-y" ); object->readAttr( "inkscape:connector-avoid" ); object->readAttr( "inkscape:connection-points" ); SPObject::build(document, repr); } void SPItem::release() { SPItem* item = this; // Note: do this here before the clip_ref is deleted, since calling // ensureUpToDate() for triggered routing may reference // the deleted clip_ref. delete item->avoidRef; // we do NOT disconnect from the changed signal of those before deletion. // The destructor will call *_ref_changed with NULL as the new value, // which will cause the hide() function to be called. delete item->clip_ref; delete item->mask_ref; SPObject::release(); SPPaintServer *fill_ps = style->getFillPaintServer(); SPPaintServer *stroke_ps = style->getStrokePaintServer(); while (item->display) { if (fill_ps) { fill_ps->hide(item->display->arenaitem->key()); } if (stroke_ps) { stroke_ps->hide(item->display->arenaitem->key()); } item->display = sp_item_view_list_remove(item->display, item->display); } //item->_transformed_signal.~signal(); } void SPItem::set(unsigned int key, gchar const* value) { SPItem *item = this; SPItem* object = item; switch (key) { case SP_ATTR_TRANSFORM: { Geom::Affine t; if (value && sp_svg_transform_read(value, &t)) { item->set_item_transform(t); } else { item->set_item_transform(Geom::identity()); } break; } case SP_PROP_CLIP_PATH: { gchar *uri = extract_uri(value); if (uri) { try { item->clip_ref->attach(Inkscape::URI(uri)); } catch (Inkscape::BadURIException &e) { g_warning("%s", e.what()); item->clip_ref->detach(); } g_free(uri); } else { item->clip_ref->detach(); } break; } case SP_PROP_MASK: { gchar *uri = extract_uri(value); if (uri) { try { item->mask_ref->attach(Inkscape::URI(uri)); } catch (Inkscape::BadURIException &e) { g_warning("%s", e.what()); item->mask_ref->detach(); } g_free(uri); } else { item->mask_ref->detach(); } break; } case SP_ATTR_SODIPODI_INSENSITIVE: item->sensitive = !value; for (SPItemView *v = item->display; v != NULL; v = v->next) { v->arenaitem->setSensitive(item->sensitive); } break; case SP_ATTR_CONNECTOR_AVOID: item->avoidRef->setAvoid(value); break; case SP_ATTR_TRANSFORM_CENTER_X: if (value) { item->transform_center_x = g_strtod(value, NULL); } else { item->transform_center_x = 0; } object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_TRANSFORM_CENTER_Y: if (value) { item->transform_center_y = g_strtod(value, NULL); } else { item->transform_center_y = 0; } object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; case SP_PROP_SYSTEM_LANGUAGE: case SP_PROP_REQUIRED_FEATURES: case SP_PROP_REQUIRED_EXTENSIONS: { item->resetEvaluated(); // pass to default handler } default: if (SP_ATTRIBUTE_IS_CSS(key)) { sp_style_read_from_object(object->style, object); object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } else { SPObject::set(key, value); } break; } } void SPItem::clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item) { item->bbox_valid = FALSE; // force a re-evaluation if (old_clip) { SPItemView *v; /* Hide clippath */ for (v = item->display; v != NULL; v = v->next) { SP_CLIPPATH(old_clip)->hide(v->arenaitem->key()); } } if (SP_IS_CLIPPATH(clip)) { Geom::OptRect bbox = item->geometricBounds(); for (SPItemView *v = item->display; v != NULL; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new(3)); } Inkscape::DrawingItem *ai = SP_CLIPPATH(clip)->show( v->arenaitem->drawing(), v->arenaitem->key()); v->arenaitem->setClip(ai); SP_CLIPPATH(clip)->setBBox(v->arenaitem->key(), bbox); clip->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } } } void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item) { if (old_mask) { /* Hide mask */ for (SPItemView *v = item->display; v != NULL; v = v->next) { SP_MASK(old_mask)->sp_mask_hide(v->arenaitem->key()); } } if (SP_IS_MASK(mask)) { Geom::OptRect bbox = item->geometricBounds(); for (SPItemView *v = item->display; v != NULL; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new(3)); } Inkscape::DrawingItem *ai = SP_MASK(mask)->sp_mask_show( v->arenaitem->drawing(), v->arenaitem->key()); v->arenaitem->setMask(ai); SP_MASK(mask)->sp_mask_set_bbox(v->arenaitem->key(), bbox); mask->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } } } void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { SPPaintServer *old_fill_ps = SP_PAINT_SERVER(old_ps); if (old_fill_ps) { for (SPItemView *v =item->display; v != NULL; v = v->next) { old_fill_ps->hide(v->arenaitem->key()); } } SPPaintServer *new_fill_ps = SP_PAINT_SERVER(ps); if (new_fill_ps) { Geom::OptRect bbox = item->geometricBounds(); for (SPItemView *v = item->display; v != NULL; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new(3)); } Inkscape::DrawingPattern *pi = new_fill_ps->show( v->arenaitem->drawing(), v->arenaitem->key(), bbox); v->arenaitem->setFillPattern(pi); if (pi) { new_fill_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } } } } void SPItem::stroke_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { SPPaintServer *old_stroke_ps = SP_PAINT_SERVER(old_ps); if (old_stroke_ps) { for (SPItemView *v =item->display; v != NULL; v = v->next) { old_stroke_ps->hide(v->arenaitem->key()); } } SPPaintServer *new_stroke_ps = SP_PAINT_SERVER(ps); if (new_stroke_ps) { Geom::OptRect bbox = item->geometricBounds(); for (SPItemView *v = item->display; v != NULL; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new(3)); } Inkscape::DrawingPattern *pi = new_stroke_ps->show( v->arenaitem->drawing(), v->arenaitem->key(), bbox); v->arenaitem->setStrokePattern(pi); if (pi) { new_stroke_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } } } } void SPItem::update(SPCtx* /*ctx*/, guint flags) { SPItem *item = this; SPItem* object = item; // SPObject::onUpdate(ctx, flags); // any of the modifications defined in sp-object.h might change bbox, // so we invalidate it unconditionally item->bbox_valid = FALSE; if (flags & (SP_OBJECT_CHILD_MODIFIED_FLAG | SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG)) { if (flags & SP_OBJECT_MODIFIED_FLAG) { for (SPItemView *v = item->display; v != NULL; v = v->next) { v->arenaitem->setTransform(item->transform); } } SPClipPath *clip_path = item->clip_ref ? item->clip_ref->getObject() : NULL; SPMask *mask = item->mask_ref ? item->mask_ref->getObject() : NULL; if ( clip_path || mask ) { Geom::OptRect bbox = item->geometricBounds(); if (clip_path) { for (SPItemView *v = item->display; v != NULL; v = v->next) { clip_path->setBBox(v->arenaitem->key(), bbox); } } if (mask) { for (SPItemView *v = item->display; v != NULL; v = v->next) { mask->sp_mask_set_bbox(v->arenaitem->key(), bbox); } } } if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = item->display; v != NULL; v = v->next) { v->arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(object->style->opacity.value)); v->arenaitem->setAntialiasing(object->style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES); v->arenaitem->setIsolation( object->style->isolation.value ); v->arenaitem->setBlendMode( object->style->mix_blend_mode.value ); v->arenaitem->setVisible(!item->isHidden()); } } } /* Update bounding box in user space, used for filter and objectBoundingBox units */ if (item->style->filter.set && item->display) { Geom::OptRect item_bbox = item->geometricBounds(); SPItemView *itemview = item->display; do { if (itemview->arenaitem) itemview->arenaitem->setItemBounds(item_bbox); } while ( (itemview = itemview->next) ); } // Update libavoid with item geometry (for connector routing). if (item->avoidRef) item->avoidRef->handleSettingChange(); } void SPItem::modified(unsigned int /*flags*/) { } Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPItem *item = this; SPItem* object = item; // in the case of SP_OBJECT_WRITE_BUILD, the item should always be newly created, // so we need to add any children from the underlying object to the new repr if (flags & SP_OBJECT_WRITE_BUILD) { GSList *l = NULL; for (SPObject *child = object->firstChild(); child != NULL; child = child->next ) { if (SP_IS_TITLE(child) || SP_IS_DESC(child)) { Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) { l = g_slist_prepend (l, crepr); } } } while (l) { repr->addChild((Inkscape::XML::Node *) l->data, NULL); Inkscape::GC::release((Inkscape::XML::Node *) l->data); l = g_slist_remove (l, l->data); } } else { for (SPObject *child = object->firstChild() ; child != NULL; child = child->next ) { if (SP_IS_TITLE(child) || SP_IS_DESC(child)) { child->updateRepr(flags); } } } gchar *c = sp_svg_transform_write(item->transform); repr->setAttribute("transform", c); g_free(c); if (flags & SP_OBJECT_WRITE_EXT) { repr->setAttribute("sodipodi:insensitive", ( item->sensitive ? NULL : "true" )); if (item->transform_center_x != 0) sp_repr_set_svg_double (repr, "inkscape:transform-center-x", item->transform_center_x); else repr->setAttribute ("inkscape:transform-center-x", NULL); if (item->transform_center_y != 0) sp_repr_set_svg_double (repr, "inkscape:transform-center-y", item->transform_center_y); else repr->setAttribute ("inkscape:transform-center-y", NULL); } if (item->clip_ref){ if (item->clip_ref->getObject()) { gchar *uri = item->clip_ref->getURI()->toString(); const gchar *value = g_strdup_printf ("url(%s)", uri); repr->setAttribute ("clip-path", value); g_free ((void *) value); g_free ((void *) uri); } } if (item->mask_ref){ if (item->mask_ref->getObject()) { gchar *uri = item->mask_ref->getURI()->toString(); const gchar *value = g_strdup_printf ("url(%s)", uri); repr->setAttribute ("mask", value); g_free ((void *) value); g_free ((void *) uri); } } SPObject::write(xml_doc, repr, flags); return repr; } // CPPIFY: make pure virtual Geom::OptRect SPItem::bbox(Geom::Affine const & /*transform*/, SPItem::BBoxType /*type*/) const { //throw; return Geom::OptRect(); } /** * Get item's geometric bounding box in this item's coordinate system. * * The geometric bounding box includes only the path, disregarding all style attributes. */ Geom::OptRect SPItem::geometricBounds(Geom::Affine const &transform) const { Geom::OptRect bbox; // call the subclass method // CPPIFY //bbox = this->bbox(transform, SPItem::GEOMETRIC_BBOX); bbox = const_cast<SPItem*>(this)->bbox(transform, SPItem::GEOMETRIC_BBOX); return bbox; } /** * Get item's visual bounding box in this item's coordinate system. * * The visual bounding box includes the stroke and the filter region. */ Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform) const { using Geom::X; using Geom::Y; Geom::OptRect bbox; if ( style && style->filter.href && style->getFilter() && SP_IS_FILTER(style->getFilter())) { // call the subclass method // CPPIFY //bbox = this->bbox(Geom::identity(), SPItem::VISUAL_BBOX); bbox = const_cast<SPItem*>(this)->bbox(Geom::identity(), SPItem::GEOMETRIC_BBOX); // see LP Bug 1229971 SPFilter *filter = SP_FILTER(style->getFilter()); // default filer area per the SVG spec: SVGLength x, y, w, h; Geom::Point minp, maxp; x.set(SVGLength::PERCENT, -0.10, 0); y.set(SVGLength::PERCENT, -0.10, 0); w.set(SVGLength::PERCENT, 1.20, 0); h.set(SVGLength::PERCENT, 1.20, 0); // if area is explicitly set, override: if (filter->x._set) x = filter->x; if (filter->y._set) y = filter->y; if (filter->width._set) w = filter->width; if (filter->height._set) h = filter->height; double len_x = bbox ? bbox->width() : 0; double len_y = bbox ? bbox->height() : 0; x.update(12, 6, len_x); y.update(12, 6, len_y); w.update(12, 6, len_x); h.update(12, 6, len_y); if (filter->filterUnits == SP_FILTER_UNITS_OBJECTBOUNDINGBOX && bbox) { minp[X] = bbox->left() + x.computed * (x.unit == SVGLength::PERCENT ? 1.0 : len_x); maxp[X] = minp[X] + w.computed * (w.unit == SVGLength::PERCENT ? 1.0 : len_x); minp[Y] = bbox->top() + y.computed * (y.unit == SVGLength::PERCENT ? 1.0 : len_y); maxp[Y] = minp[Y] + h.computed * (h.unit == SVGLength::PERCENT ? 1.0 : len_y); } else if (filter->filterUnits == SP_FILTER_UNITS_USERSPACEONUSE) { minp[X] = x.computed; maxp[X] = minp[X] + w.computed; minp[Y] = y.computed; maxp[Y] = minp[Y] + h.computed; } bbox = Geom::OptRect(minp, maxp); *bbox *= transform; } else { // call the subclass method // CPPIFY //bbox = this->bbox(transform, SPItem::VISUAL_BBOX); bbox = const_cast<SPItem*>(this)->bbox(transform, SPItem::VISUAL_BBOX); } if (clip_ref->getObject()) { SP_ITEM(clip_ref->getOwner())->bbox_valid = FALSE; // LP Bug 1349018 bbox.intersectWith(SP_CLIPPATH(clip_ref->getObject())->geometricBounds(transform)); } return bbox; } Geom::OptRect SPItem::bounds(BBoxType type, Geom::Affine const &transform) const { if (type == GEOMETRIC_BBOX) { return geometricBounds(transform); } else { return visualBounds(transform); } } /** Get item's geometric bbox in document coordinate system. * Document coordinates are the default coordinates of the root element: * the origin is at the top left, X grows to the right and Y grows downwards. */ Geom::OptRect SPItem::documentGeometricBounds() const { return geometricBounds(i2doc_affine()); } /// Get item's visual bbox in document coordinate system. Geom::OptRect SPItem::documentVisualBounds() const { if (!bbox_valid) { doc_bbox = visualBounds(i2doc_affine()); bbox_valid = true; } return doc_bbox; } Geom::OptRect SPItem::documentBounds(BBoxType type) const { if (type == GEOMETRIC_BBOX) { return documentGeometricBounds(); } else { return documentVisualBounds(); } } /** Get item's geometric bbox in desktop coordinate system. * Desktop coordinates should be user defined. Currently they are hardcoded: * origin is at bottom left, X grows to the right and Y grows upwards. */ Geom::OptRect SPItem::desktopGeometricBounds() const { return geometricBounds(i2dt_affine()); } /// Get item's visual bbox in desktop coordinate system. Geom::OptRect SPItem::desktopVisualBounds() const { /// @fixme hardcoded desktop transform Geom::Affine m = Geom::Scale(1, -1) * Geom::Translate(0, document->getHeight().value("px")); Geom::OptRect ret = documentVisualBounds(); if (ret) *ret *= m; return ret; } Geom::OptRect SPItem::desktopPreferredBounds() const { if (Inkscape::Preferences::get()->getInt("/tools/bounding_box") == 0) { return desktopBounds(SPItem::VISUAL_BBOX); } else { return desktopBounds(SPItem::GEOMETRIC_BBOX); } } Geom::OptRect SPItem::desktopBounds(BBoxType type) const { if (type == GEOMETRIC_BBOX) { return desktopGeometricBounds(); } else { return desktopVisualBounds(); } } unsigned int SPItem::pos_in_parent() const { g_assert(parent != NULL); g_assert(SP_IS_OBJECT(parent)); unsigned int pos = 0; for ( SPObject *iter = parent->firstChild() ; iter ; iter = iter->next) { if (iter == this) { return pos; } if (SP_IS_ITEM(iter)) { pos++; } } g_assert_not_reached(); return 0; } // CPPIFY: make pure virtual, see below! void SPItem::snappoints(std::vector<Inkscape::SnapCandidatePoint> & /*p*/, Inkscape::SnapPreferences const */*snapprefs*/) const { //throw; } /* This will only be called if the derived class doesn't override this. * see for example sp_genericellipse_snappoints in sp-ellipse.cpp * We don't know what shape we could be dealing with here, so we'll just * do nothing */ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const { // Get the snappoints of the item // CPPIFY //this->snappoints(p, snapprefs); const_cast<SPItem*>(this)->snappoints(p, snapprefs); // Get the snappoints at the item's center if (snapprefs != NULL && snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER)) { p.push_back(Inkscape::SnapCandidatePoint(getCenter(), Inkscape::SNAPSOURCE_ROTATION_CENTER, Inkscape::SNAPTARGET_ROTATION_CENTER)); } // Get the snappoints of clipping paths and mask, if any std::list<SPObject const *> clips_and_masks; clips_and_masks.push_back(clip_ref->getObject()); clips_and_masks.push_back(mask_ref->getObject()); SPDesktop *desktop = inkscape_active_desktop(); for (std::list<SPObject const *>::const_iterator o = clips_and_masks.begin(); o != clips_and_masks.end(); ++o) { if (*o) { // obj is a group object, the children are the actual clippers for (SPObject *child = (*o)->children ; child ; child = child->next) { if (SP_IS_ITEM(child)) { std::vector<Inkscape::SnapCandidatePoint> p_clip_or_mask; // Please note the recursive call here! SP_ITEM(child)->getSnappoints(p_clip_or_mask, snapprefs); // Take into account the transformation of the item being clipped or masked for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator p_orig = p_clip_or_mask.begin(); p_orig != p_clip_or_mask.end(); ++p_orig) { // All snappoints are in desktop coordinates, but the item's transformation is // in document coordinates. Hence the awkward construction below Geom::Point pt = desktop->dt2doc((*p_orig).getPoint()) * i2dt_affine(); p.push_back(Inkscape::SnapCandidatePoint(pt, (*p_orig).getSourceType(), (*p_orig).getTargetType())); } } } } } } // CPPIFY: make pure virtual void SPItem::print(SPPrintContext* /*ctx*/) { //throw; } void SPItem::invoke_print(SPPrintContext *ctx) { if ( !isHidden() ) { if (!transform.isIdentity() || style->opacity.value != SP_SCALE24_MAX) { sp_print_bind(ctx, transform, SP_SCALE24_TO_FLOAT(style->opacity.value)); this->print(ctx); sp_print_release(ctx); } else { this->print(ctx); } } } const char* SPItem::displayName() const { return _("Object"); } gchar* SPItem::description() const { return g_strdup(""); } /** * Returns a string suitable for status bar, formatted in pango markup language. * * Must be freed by caller. */ gchar *SPItem::detailedDescription() const { gchar* s = g_strdup_printf("<b>%s</b> %s", this->displayName(), this->description()); if (s && clip_ref->getObject()) { gchar *snew = g_strdup_printf (_("%s; <i>clipped</i>"), s); g_free (s); s = snew; } if (s && mask_ref->getObject()) { gchar *snew = g_strdup_printf (_("%s; <i>masked</i>"), s); g_free (s); s = snew; } if ( style && style->filter.href && style->filter.href->getObject() ) { const gchar *label = style->filter.href->getObject()->label(); gchar *snew = 0; if (label) { snew = g_strdup_printf (_("%s; <i>filtered (%s)</i>"), s, _(label)); } else { snew = g_strdup_printf (_("%s; <i>filtered</i>"), s); } g_free (s); s = snew; } return s; } /** * Returns true if the item is filtered, false otherwise. Used with groups/lists to determine how many, or if any, are filtered * */ bool SPItem::isFiltered() const { return (style && style->filter.href && style->filter.href->getObject()); } /** * Allocates unique integer keys. * \param numkeys Number of keys required. * \return First allocated key; hence if the returned key is n * you can use n, n + 1, ..., n + (numkeys - 1) */ unsigned SPItem::display_key_new(unsigned numkeys) { static unsigned dkey = 0; dkey += numkeys; return dkey - numkeys; } // CPPIFY: make pure virtual Inkscape::DrawingItem* SPItem::show(Inkscape::Drawing& /*drawing*/, unsigned int /*key*/, unsigned int /*flags*/) { //throw; return 0; } Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned key, unsigned flags) { Inkscape::DrawingItem *ai = NULL; ai = this->show(drawing, key, flags); if (ai != NULL) { Geom::OptRect item_bbox = geometricBounds(); display = sp_item_view_new_prepend(display, this, flags, key, ai); ai->setTransform(transform); ai->setOpacity(SP_SCALE24_TO_FLOAT(style->opacity.value)); ai->setIsolation( style->isolation.value ); ai->setBlendMode( style->mix_blend_mode.value ); //ai->setCompositeOperator( style->composite_op.value ); ai->setVisible(!isHidden()); ai->setSensitive(sensitive); if (clip_ref->getObject()) { SPClipPath *cp = clip_ref->getObject(); if (!display->arenaitem->key()) { display->arenaitem->setKey(display_key_new(3)); } int clip_key = display->arenaitem->key(); // Show and set clip Inkscape::DrawingItem *ac = cp->show(drawing, clip_key); ai->setClip(ac); // Update bbox, in case the clip uses bbox units SP_CLIPPATH(cp)->setBBox(clip_key, item_bbox); cp->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } if (mask_ref->getObject()) { SPMask *mask = mask_ref->getObject(); if (!display->arenaitem->key()) { display->arenaitem->setKey(display_key_new(3)); } int mask_key = display->arenaitem->key(); // Show and set mask Inkscape::DrawingItem *ac = mask->sp_mask_show(drawing, mask_key); ai->setMask(ac); // Update bbox, in case the mask uses bbox units SP_MASK(mask)->sp_mask_set_bbox(mask_key, item_bbox); mask->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } SPPaintServer *fill_ps = style->getFillPaintServer(); if (fill_ps) { if (!display->arenaitem->key()) { display->arenaitem->setKey(display_key_new(3)); } int fill_key = display->arenaitem->key(); Inkscape::DrawingPattern *ap = fill_ps->show(drawing, fill_key, item_bbox); ai->setFillPattern(ap); if (ap) { fill_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } } SPPaintServer *stroke_ps = style->getStrokePaintServer(); if (stroke_ps) { if (!display->arenaitem->key()) { display->arenaitem->setKey(display_key_new(3)); } int stroke_key = display->arenaitem->key(); Inkscape::DrawingPattern *ap = stroke_ps->show(drawing, stroke_key, item_bbox); ai->setStrokePattern(ap); if (ap) { stroke_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } } ai->setData(this); ai->setItemBounds(geometricBounds()); } return ai; } // CPPIFY: make pure virtual void SPItem::hide(unsigned int /*key*/) { //throw; } void SPItem::invoke_hide(unsigned key) { this->hide(key); SPItemView *ref = NULL; SPItemView *v = display; while (v != NULL) { SPItemView *next = v->next; if (v->key == key) { if (clip_ref->getObject()) { (clip_ref->getObject())->hide(v->arenaitem->key()); v->arenaitem->setClip(NULL); } if (mask_ref->getObject()) { mask_ref->getObject()->sp_mask_hide(v->arenaitem->key()); v->arenaitem->setMask(NULL); } SPPaintServer *fill_ps = style->getFillPaintServer(); if (fill_ps) { fill_ps->hide(v->arenaitem->key()); } SPPaintServer *stroke_ps = style->getStrokePaintServer(); if (stroke_ps) { stroke_ps->hide(v->arenaitem->key()); } if (!ref) { display = v->next; } else { ref->next = v->next; } delete v->arenaitem; g_free(v); } else { ref = v; } v = next; } } // Adjusters void SPItem::adjust_pattern(Geom::Affine const &postmul, bool set, PatternTransform pt) { bool fill = (pt == TRANSFORM_FILL || pt == TRANSFORM_BOTH); if (fill && style && (style->fill.isPaintserver())) { SPObject *server = style->getFillPaintServer(); if ( SP_IS_PATTERN(server) ) { SPPattern *pattern = sp_pattern_clone_if_necessary(this, SP_PATTERN(server), "fill"); sp_pattern_transform_multiply(pattern, postmul, set); } } bool stroke = (pt == TRANSFORM_STROKE || pt == TRANSFORM_BOTH); if (stroke && style && (style->stroke.isPaintserver())) { SPObject *server = style->getStrokePaintServer(); if ( SP_IS_PATTERN(server) ) { SPPattern *pattern = sp_pattern_clone_if_necessary(this, SP_PATTERN(server), "stroke"); sp_pattern_transform_multiply(pattern, postmul, set); } } } void SPItem::adjust_gradient( Geom::Affine const &postmul, bool set ) { if ( style && style->fill.isPaintserver() ) { SPPaintServer *server = style->getFillPaintServer(); if ( SP_IS_GRADIENT(server) ) { /** * \note Bbox units for a gradient are generally a bad idea because * with them, you cannot preserve the relative position of the * object and its gradient after rotation or skew. So now we * convert them to userspace units which are easy to keep in sync * just by adding the object's transform to gradientTransform. * \todo FIXME: convert back to bbox units after transforming with * the item, so as to preserve the original units. */ SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), this, "fill" ); sp_gradient_transform_multiply( gradient, postmul, set ); } } if ( style && style->stroke.isPaintserver() ) { SPPaintServer *server = style->getStrokePaintServer(); if ( SP_IS_GRADIENT(server) ) { SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), this, "stroke"); sp_gradient_transform_multiply( gradient, postmul, set ); } } } void SPItem::adjust_stroke( gdouble ex ) { if (freeze_stroke_width) { return; } SPStyle *style = this->style; if (style && !style->stroke.isNone() && !Geom::are_near(ex, 1.0, Geom::EPSILON)) { style->stroke_width.computed *= ex; style->stroke_width.set = TRUE; if ( !style->stroke_dasharray.values.empty() ) { for (unsigned i = 0; i < style->stroke_dasharray.values.size(); i++) { style->stroke_dasharray.values[i] *= ex; } style->stroke_dashoffset.value *= ex; } updateRepr(); } } /** * Find out the inverse of previous transform of an item (from its repr) */ static Geom::Affine sp_item_transform_repr (SPItem *item) { Geom::Affine t_old(Geom::identity()); gchar const *t_attr = item->getRepr()->attribute("transform"); if (t_attr) { Geom::Affine t; if (sp_svg_transform_read(t_attr, &t)) { t_old = t; } } return t_old; } /** * Recursively scale stroke width in \a item and its children by \a expansion. */ void SPItem::adjust_stroke_width_recursive(double expansion) { adjust_stroke (expansion); // A clone's child is the ghost of its original - we must not touch it, skip recursion if ( !SP_IS_USE(this) ) { for ( SPObject *o = children; o; o = o->getNext() ) { if (SP_IS_ITEM(o)) { SP_ITEM(o)->adjust_stroke_width_recursive(expansion); } } } } void SPItem::freeze_stroke_width_recursive(bool freeze) { freeze_stroke_width = freeze; // A clone's child is the ghost of its original - we must not touch it, skip recursion if ( !SP_IS_USE(this) ) { for ( SPObject *o = children; o; o = o->getNext() ) { if (SP_IS_ITEM(o)) { SP_ITEM(o)->freeze_stroke_width_recursive(freeze); } } } } /** * Recursively adjust rx and ry of rects. */ static void sp_item_adjust_rects_recursive(SPItem *item, Geom::Affine advertized_transform) { if (SP_IS_RECT (item)) { SP_RECT(item)->compensateRxRy(advertized_transform); } for (SPObject *o = item->children; o != NULL; o = o->next) { if (SP_IS_ITEM(o)) sp_item_adjust_rects_recursive(SP_ITEM(o), advertized_transform); } } /** * Recursively compensate pattern or gradient transform. */ void SPItem::adjust_paint_recursive (Geom::Affine advertized_transform, Geom::Affine t_ancestors, bool is_pattern) { // _Before_ full pattern/gradient transform: t_paint * t_item * t_ancestors // _After_ full pattern/gradient transform: t_paint_new * t_item * t_ancestors * advertised_transform // By equating these two expressions we get t_paint_new = t_paint * paint_delta, where: Geom::Affine t_item = sp_item_transform_repr (this); Geom::Affine paint_delta = t_item * t_ancestors * advertized_transform * t_ancestors.inverse() * t_item.inverse(); // Within text, we do not fork gradients, and so must not recurse to avoid double compensation; // also we do not recurse into clones, because a clone's child is the ghost of its original - // we must not touch it if (!(this && (SP_IS_TEXT(this) || SP_IS_USE(this)))) { for (SPObject *o = children; o != NULL; o = o->next) { if (SP_IS_ITEM(o)) { // At the level of the transformed item, t_ancestors is identity; // below it, it is the accmmulated chain of transforms from this level to the top level SP_ITEM(o)->adjust_paint_recursive (advertized_transform, t_item * t_ancestors, is_pattern); } } } // We recursed into children first, and are now adjusting this object second; // this is so that adjustments in a tree are done from leaves up to the root, // and paintservers on leaves inheriting their values from ancestors could adjust themselves properly // before ancestors themselves are adjusted, probably differently (bug 1286535) if (is_pattern) { adjust_pattern(paint_delta); } else { adjust_gradient(paint_delta); } } void SPItem::adjust_livepatheffect (Geom::Affine const &postmul, bool set) { if ( SP_IS_LPE_ITEM(this) ) { SPLPEItem *lpeitem = SP_LPE_ITEM (this); if ( lpeitem->hasPathEffect() ) { lpeitem->forkPathEffectsIfNecessary(); // now that all LPEs are forked_if_necessary, we can apply the transform PathEffectList effect_list = lpeitem->getEffectList(); for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it) { LivePathEffectObject *lpeobj = (*it)->lpeobject; if (lpeobj && lpeobj->get_lpe()) { Inkscape::LivePathEffect::Effect * effect = lpeobj->get_lpe(); effect->transform_multiply(postmul, set); } } } } } // CPPIFY:: make pure virtual? // Not all SPItems must necessarily have a set transform method! Geom::Affine SPItem::set_transform(Geom::Affine const &transform) { // throw; return transform; } /** * Set a new transform on an object. * * Compensate for stroke scaling and gradient/pattern fill transform, if * necessary. Call the object's set_transform method if transforms are * stored optimized. Send _transformed_signal. Invoke _write method so that * the repr is updated with the new transform. */ void SPItem::doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &transform, Geom::Affine const *adv, bool compensate) { g_return_if_fail(repr != NULL); // calculate the relative transform, if not given by the adv attribute Geom::Affine advertized_transform; if (adv != NULL) { advertized_transform = *adv; } else { advertized_transform = sp_item_transform_repr (this).inverse() * transform; } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (compensate) { // recursively compensating for stroke scaling will not always work, because it can be scaled to zero or infinite // from which we cannot ever recover by applying an inverse scale; therefore we temporarily block any changes // to the strokewidth in such a case instead, and unblock these after the transformation // (as reported in https://bugs.launchpad.net/inkscape/+bug/825840/comments/4) if (!prefs->getBool("/options/transform/stroke", true)) { double const expansion = 1. / advertized_transform.descrim(); if (expansion < 1e-9 || expansion > 1e9) { freeze_stroke_width_recursive(true); // This will only work if the item has a set_transform method (in this method adjust_stroke() will be called) // We will still have to apply the inverse scaling to other items, not having a set_transform method // such as ellipses and stars // PS: We cannot use this freeze_stroke_width_recursive() trick in all circumstances. For example, it will // break pasting objects within their group (because in such a case the transformation of the group will affect // the strokewidth, and has to be compensated for. See https://bugs.launchpad.net/inkscape/+bug/959223/comments/10) } else { adjust_stroke_width_recursive(expansion); } } // recursively compensate rx/ry of a rect if requested if (!prefs->getBool("/options/transform/rectcorners", true)) { sp_item_adjust_rects_recursive(this, advertized_transform); } // recursively compensate pattern fill if it's not to be transformed if (!prefs->getBool("/options/transform/pattern", true)) { adjust_paint_recursive (advertized_transform.inverse(), Geom::identity(), true); } /// \todo FIXME: add the same else branch as for gradients below, to convert patterns to userSpaceOnUse as well /// recursively compensate gradient fill if it's not to be transformed if (!prefs->getBool("/options/transform/gradient", true)) { adjust_paint_recursive (advertized_transform.inverse(), Geom::identity(), false); } else { // this converts the gradient/pattern fill/stroke, if any, to userSpaceOnUse; we need to do // it here _before_ the new transform is set, so as to use the pre-transform bbox adjust_paint_recursive (Geom::identity(), Geom::identity(), false); } } // endif(compensate) gint preserve = prefs->getBool("/options/preservetransform/value", 0); Geom::Affine transform_attr (transform); // CPPIFY: check this code. // If onSetTransform is not overridden, CItem::onSetTransform will return the transform it was given as a parameter. // onSetTransform cannot be pure due to the fact that not all visible Items are transformable. if ( // run the object's set_transform (i.e. embed transform) only if: SP_IS_TEXT_TEXTPATH(this) || (!preserve && // user did not chose to preserve all transforms (!clip_ref || !clip_ref->getObject()) && // the object does not have a clippath (!mask_ref || !mask_ref->getObject()) && // the object does not have a mask !(!transform.isTranslation() && style && style->getFilter())) // the object does not have a filter, or the transform is translation (which is supposed to not affect filters) ) { transform_attr = this->set_transform(transform); if (freeze_stroke_width) { freeze_stroke_width_recursive(false); } } else { if (freeze_stroke_width) { freeze_stroke_width_recursive(false); if (compensate) { if (!prefs->getBool("/options/transform/stroke", true)) { // Recursively compensate for stroke scaling, depending on user preference // (As to why we need to do this, see the comment a few lines above near the freeze_stroke_width_recursive(true) call) double const expansion = 1. / advertized_transform.descrim(); adjust_stroke_width_recursive(expansion); } } } } set_item_transform(transform_attr); // Note: updateRepr comes before emitting the transformed signal since // it causes clone SPUse's copy of the original object to brought up to // date with the original. Otherwise, sp_use_bbox returns incorrect // values if called in code handling the transformed signal. updateRepr(); // send the relative transform with a _transformed_signal _transformed_signal.emit(&advertized_transform, this); } // CPPIFY: see below, do not make pure? gint SPItem::event(SPEvent* /*event*/) { return FALSE; } gint SPItem::emitEvent(SPEvent &event) { return this->event(&event); } /** * Sets item private transform (not propagated to repr), without compensating stroke widths, * gradients, patterns as sp_item_write_transform does. */ void SPItem::set_item_transform(Geom::Affine const &transform_matrix) { if (!Geom::are_near(transform_matrix, transform, 1e-18)) { transform = transform_matrix; /* The SP_OBJECT_USER_MODIFIED_FLAG_B is used to mark the fact that it's only a transformation. It's apparently not used anywhere else. */ requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_USER_MODIFIED_FLAG_B); sp_item_rm_unsatisfied_cns(*this); } } //void SPItem::convert_to_guides() const { // // CPPIFY: If not overridden, call SPItem::convert_to_guides() const, see below! // this->convert_to_guides(); //} /** * \pre \a ancestor really is an ancestor (\>=) of \a object, or NULL. * ("Ancestor (\>=)" here includes as far as \a object itself.) */ Geom::Affine i2anc_affine(SPObject const *object, SPObject const *const ancestor) { Geom::Affine ret(Geom::identity()); g_return_val_if_fail(object != NULL, ret); /* stop at first non-renderable ancestor */ while ( object != ancestor && SP_IS_ITEM(object) ) { if (SP_IS_ROOT(object)) { ret *= SP_ROOT(object)->c2p; } else { ret *= SP_ITEM(object)->transform; } object = object->parent; } return ret; } Geom::Affine i2i_affine(SPObject const *src, SPObject const *dest) { g_return_val_if_fail(src != NULL && dest != NULL, Geom::identity()); SPObject const *ancestor = src->nearestCommonAncestor(dest); return i2anc_affine(src, ancestor) * i2anc_affine(dest, ancestor).inverse(); } Geom::Affine SPItem::getRelativeTransform(SPObject const *dest) const { return i2i_affine(this, dest); } /** * Returns the accumulated transformation of the item and all its ancestors, including root's viewport. * \pre (item != NULL) and SP_IS_ITEM(item). */ Geom::Affine SPItem::i2doc_affine() const { return i2anc_affine(this, NULL); } /** * Returns the transformation from item to desktop coords */ Geom::Affine SPItem::i2dt_affine() const { Geom::Affine ret; SPDesktop const *desktop = inkscape_active_desktop(); if ( desktop ) { ret = i2doc_affine() * desktop->doc2dt(); } else { // TODO temp code to prevent crashing on command-line launch: ret = i2doc_affine() * Geom::Scale(1, -1) * Geom::Translate(0, document->getHeight().value("px")); } return ret; } void SPItem::set_i2d_affine(Geom::Affine const &i2dt) { Geom::Affine dt2p; /* desktop to item parent transform */ if (parent) { dt2p = static_cast<SPItem *>(parent)->i2dt_affine().inverse(); } else { SPDesktop *dt = inkscape_active_desktop(); dt2p = dt->dt2doc(); } Geom::Affine const i2p( i2dt * dt2p ); set_item_transform(i2p); } /** * should rather be named "sp_item_d2i_affine" to match "sp_item_i2d_affine" (or vice versa) */ Geom::Affine SPItem::dt2i_affine() const { /* fixme: Implement the right way (Lauris) */ return i2dt_affine().inverse(); } /* Item views */ SPItemView *SPItem::sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, Inkscape::DrawingItem *drawing_item) { g_assert(item != NULL); g_assert(SP_IS_ITEM(item)); g_assert(drawing_item != NULL); SPItemView *new_view = g_new(SPItemView, 1); new_view->next = list; new_view->flags = flags; new_view->key = key; new_view->arenaitem = drawing_item; return new_view; } static SPItemView* sp_item_view_list_remove(SPItemView *list, SPItemView *view) { SPItemView *ret = list; if (view == list) { ret = list->next; } else { SPItemView *prev; prev = list; while (prev->next != view) prev = prev->next; prev->next = view->next; } delete view->arenaitem; g_free(view); return ret; } /** * Return the arenaitem corresponding to the given item in the display * with the given key */ Inkscape::DrawingItem *SPItem::get_arenaitem(unsigned key) { for ( SPItemView *iv = display ; iv ; iv = iv->next ) { if ( iv->key == key ) { return iv->arenaitem; } } return NULL; } int sp_item_repr_compare_position(SPItem const *first, SPItem const *second) { return sp_repr_compare_position(first->getRepr(), second->getRepr()); } SPItem const *sp_item_first_item_child(SPObject const *obj) { return sp_item_first_item_child( const_cast<SPObject *>(obj) ); } SPItem *sp_item_first_item_child(SPObject *obj) { SPItem *child = 0; for ( SPObject *iter = obj->firstChild() ; iter ; iter = iter->next ) { if ( SP_IS_ITEM(iter) ) { child = SP_ITEM(iter); break; } } return child; } void SPItem::convert_to_guides() const { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int prefs_bbox = prefs->getInt("/tools/bounding_box", 0); Geom::OptRect bbox = (prefs_bbox == 0) ? desktopVisualBounds() : desktopGeometricBounds(); if (!bbox) { g_warning ("Cannot determine item's bounding box during conversion to guides.\n"); return; } std::list<std::pair<Geom::Point, Geom::Point> > pts; Geom::Point A((*bbox).min()); Geom::Point C((*bbox).max()); Geom::Point B(A[Geom::X], C[Geom::Y]); Geom::Point D(C[Geom::X], A[Geom::Y]); pts.push_back(std::make_pair(A, B)); pts.push_back(std::make_pair(B, C)); pts.push_back(std::make_pair(C, D)); pts.push_back(std::make_pair(D, A)); sp_guide_pt_pairs_to_guides(document, pts); } /* Local Variables: mode:c++ c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
gpl-2.0
carlobar/uclinux_leon3_UD
linux-2.0.x/include/asm-armnommu/arch-arc/irq.h
1967
/* * include/asm-arm/arch-arc/irq.h * * Copyright (C) 1996 Russell King * * Changelog: * 24-09-1996 RMK Created * 10-10-1996 RMK Brought up to date with arch-sa110eval * 05-11-1996 RMK Changed interrupt numbers & uses new inb/outb macros */ #define BUILD_IRQ(s,n,m) \ void IRQ##n##_interrupt(void); \ void fast_IRQ##n##_interrupt(void); \ void bad_IRQ##n##_interrupt(void); \ void probe_IRQ##n##_interrupt(void); /* * The timer is a special interrupt */ #define IRQ5_interrupt timer_IRQ_interrupt #define IRQ_INTERRUPT(n) IRQ##n##_interrupt #define FAST_INTERRUPT(n) fast_IRQ##n##_interrupt #define BAD_INTERRUPT(n) bad_IRQ##n##_interrupt #define PROBE_INTERRUPT(n) probe_IRQ##n##_interrupt static __inline__ void mask_irq(unsigned int irq) { extern void ecard_disableirq (unsigned int); extern void ecard_disablefiq (unsigned int); unsigned char mask = 1 << (irq & 7); switch (irq >> 3) { case 0: outb(inb(IOC_IRQMASKA) & ~mask, IOC_IRQMASKA); break; case 1: outb(inb(IOC_IRQMASKB) & ~mask, IOC_IRQMASKB); break; case 4: ecard_disableirq (irq & 7); break; case 8: outb(inb(IOC_FIQMASK) & ~mask, IOC_FIQMASK); break; case 12: ecard_disablefiq (irq & 7); } } static __inline__ void unmask_irq(unsigned int irq) { extern void ecard_enableirq (unsigned int); extern void ecard_enablefiq (unsigned int); unsigned char mask = 1 << (irq & 7); switch (irq >> 3) { case 0: outb(inb(IOC_IRQMASKA) | mask, IOC_IRQMASKA); break; case 1: outb(inb(IOC_IRQMASKB) | mask, IOC_IRQMASKB); break; case 4: ecard_enableirq (irq & 7); break; case 8: outb(inb(IOC_FIQMASK) | mask, IOC_FIQMASK); break; case 12: ecard_enablefiq (irq & 7); } } static __inline__ unsigned long get_enabled_irqs(void) { return inb(IOC_IRQMASKA) | inb(IOC_IRQMASKB) << 8; } static __inline__ void irq_init_irq(void) { outb(0, IOC_IRQMASKA); outb(0, IOC_IRQMASKB); outb(0, IOC_FIQMASK); }
gpl-2.0
ysuarez/Evergreen-Customizations
Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm
26287
package OpenILS::WWW::TemplateBatchBibUpdate; use strict; use warnings; use bytes; use Apache2::Log; use Apache2::Const -compile => qw(OK REDIRECT DECLINED NOT_FOUND :log); use APR::Const -compile => qw(:error SUCCESS); use APR::Table; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::RequestUtil; use CGI; use Data::Dumper; use Text::CSV; use OpenSRF::EX qw(:try); use OpenSRF::Utils qw/:datetime/; use OpenSRF::Utils::Cache; use OpenSRF::System; use OpenSRF::AppSession; use XML::LibXML; use XML::LibXSLT; use Encode; use Unicode::Normalize; use OpenILS::Utils::Fieldmapper; use OpenSRF::Utils::Logger qw/$logger/; use MARC::Record; use MARC::File::XML ( BinaryEncoding => 'UTF-8' ); use UNIVERSAL::require; our @formats = qw/USMARC UNIMARC XML BRE/; # set the bootstrap config and template include directory when # this module is loaded my $bootstrap; sub import { my $self = shift; $bootstrap = shift; } sub child_init { OpenSRF::System->bootstrap_client( config_file => $bootstrap ); Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL")); } sub handler { my $r = shift; my $cgi = new CGI; my $authid = $cgi->cookie('ses') || $cgi->param('ses'); my $usr = verify_login($authid); return show_template($r) unless ($usr); my $template = $cgi->param('template'); return show_template($r) unless ($template); my $rsource = $cgi->param('recordSource'); # find some IDs ... my @records; if ($rsource eq 'r') { @records = map { $_ ? ($_) : () } $cgi->param('recid'); } if ($rsource eq 'c') { # try for a file my $file = $cgi->param('idfile'); if ($file) { my $col = $cgi->param('idcolumn') || 0; my $csv = new Text::CSV; while (<$file>) { $csv->parse($_); my @data = $csv->fields; my $id = $data[$col]; $id =~ s/\D+//o; next unless ($id); push @records, $id; } } } my $e = OpenSRF::AppSession->connect('open-ils.cstore'); $e->request('open-ils.cstore.transaction.begin')->gather(1); $e->request('open-ils.cstore.set_audit_info', $authid, $usr->id, $usr->wsid)->gather(1); # still no records ... my $container = $cgi->param('containerid'); if ($rsource eq 'b') { if ($container) { my $bucket = $e->request( 'open-ils.cstore.direct.container.biblio_record_entry_bucket.retrieve', $container )->gather(1); unless($bucket) { $e->request('open-ils.cstore.transaction.rollback')->gather(1); $e->disconnect; $r->log->error("No such bucket $container"); $logger->error("No such bucket $container"); return Apache2::Const::NOT_FOUND; } my $recs = $e->request( 'open-ils.cstore.direct.container.biblio_record_entry_bucket_item.search.atomic', { bucket => $container } )->gather(1); @records = map { ($_->target_biblio_record_entry) } @$recs; } } unless (@records) { $e->request('open-ils.cstore.transaction.rollback')->gather(1); $e->disconnect; return show_template($r); } # we have a template and some record ids, so... # insert the template record my $min_id = $e->request( 'open-ils.cstore.json_query', { select => { bre => [{ column => 'id', transform => 'min', aggregate => 1}] }, from => 'bre' } )->gather(1)->{id} - 1; warn "new template bib id = $min_id\n"; my $tmpl_rec = Fieldmapper::biblio::record_entry->new; $tmpl_rec->id($min_id); $tmpl_rec->deleted('t'); $tmpl_rec->active('f'); $tmpl_rec->marc($template); $tmpl_rec->creator($usr->id); $tmpl_rec->editor($usr->id); warn "about to create bib $min_id\n"; $e->request('open-ils.cstore.direct.biblio.record_entry.create', $tmpl_rec )->gather(1); # create the new container for the records and the template my $bucket = Fieldmapper::container::biblio_record_entry_bucket->new; $bucket->owner($usr->id); $bucket->btype('template_merge'); my $bname = $cgi->param('bname') || 'Temporary Merge Bucket '. localtime() . ' ' . $usr->id; $bucket->name($bname); $bucket = $e->request('open-ils.cstore.direct.container.biblio_record_entry_bucket.create', $bucket )->gather(1); # create items in the bucket my $item = Fieldmapper::container::biblio_record_entry_bucket_item->new; $item->bucket($bucket->id); $item->target_biblio_record_entry($min_id); $e->request('open-ils.cstore.direct.container.biblio_record_entry_bucket_item.create', $item )->gather(1); my %seen; for my $r (@records) { next if ($seen{$r}); $item->target_biblio_record_entry($r); $e->request('open-ils.cstore.direct.container.biblio_record_entry_bucket_item.create', $item )->gather(1); $seen{$r}++; } $e->request('open-ils.cstore.transaction.commit')->gather(1); $e->disconnect; # fire the background bucket processor my $cache_key = OpenSRF::AppSession ->create('open-ils.cat') ->request('open-ils.cat.container.template_overlay.background', $authid, $bucket->id) ->gather(1); return show_processing_template($r, $bucket->id, \@records, $cache_key); } sub verify_login { my $auth_token = shift; return undef unless $auth_token; my $user = OpenSRF::AppSession ->create("open-ils.auth") ->request( "open-ils.auth.session.retrieve", $auth_token ) ->gather(1); if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) { return undef; } return $user if ref($user); return undef; } sub show_processing_template { my $r = shift; my $bid = shift; my $recs = shift; my $cache_key = shift; my $rec_string = @$recs; $r->content_type('text/html'); $r->print(<<HTML); <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Merging records...</title> <style type="text/css"> \@import '/js/dojo/dojo/resources/dojo.css'; \@import '/js/dojo/dijit/themes/tundra/tundra.css'; .hide_me { display: none; visibility: hidden; } th { font-weight: bold; } </style> <script type="text/javascript"> var djConfig= { isDebug: false, parseOnLoad: true, AutoIDL: ['aou','aout','pgt','au','cbreb'] } </script> <script src='/js/dojo/dojo/dojo.js'></script> <!-- <script src="/js/dojo/dojo/openils_dojo.js"></script> --> <script type="text/javascript"> dojo.require('fieldmapper.AutoIDL'); dojo.require('fieldmapper.dojoData'); dojo.require('openils.User'); dojo.require('openils.CGI'); dojo.require('openils.widget.ProgressDialog'); var cgi = new openils.CGI(); var u = new openils.User({ authcookie : 'ses' }); dojo.addOnLoad(function () { progress_dialog.show(true); progress_dialog.update({maximum:$rec_string}); var interval; interval = setInterval( function() { fieldmapper.standardRequest( ['open-ils.actor','open-ils.actor.anon_cache.get_value'], { async : false, params: [ u.authtoken, 'res_list' ], onerror : function (r) { progress_dialog.hide(); }, onresponse : function (r) { var counter = { success : 0, fail : 0, total : 0 }; dojo.forEach( openils.Util.readResponse(r), function(x) { if (x.complete) { clearInterval(interval); progress_dialog.hide(); if (x.success == 't') dojo.byId('complete_msg').innerHTML = 'Overlay completed successfully'; else dojo.byId('complete_msg').innerHTML = 'Overlay did not complet successfully'; } else { counter.total++; switch (x.success) { case 't': counter.success++; break; default: counter.fail++; break; } } }); // update the progress dialog progress_dialog.update({progress:counter.total}); dojo.byId('success_count').innerHTML = counter.success; dojo.byId('fail_count').innerHTML = counter.fail; dojo.byId('total_count').innerHTML = counter.total; } } ); }, 1000); }); </script> </head> <body style="margin:10px;" class='tundra'> <div class="hide_me"><div dojoType="openils.widget.ProgressDialog" jsId="progress_dialog"></div></div> <table style="width:100%; margin-top:100px;"> <th> <td>Status</td> <td>Record Count</td> </th> <tr> <td>Success</td> <td id='success_count'></td> </tr> <tr> <td>Failure</td> <td id='fail_count'></td> </tr> <tr> <td></td> <td id='total_count'></td> </tr> </table> <div id='complete_msg'></div> </body> </html> HTML return Apache2::Const::OK; } sub show_template { my $r = shift; $r->content_type('text/html'); $r->print(<<'HTML'); <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Merge Template Builder</title> <style type="text/css"> @import '/js/dojo/dojo/resources/dojo.css'; @import '/js/dojo/dijit/themes/tundra/tundra.css'; .hide_me { display: none; visibility: hidden; } table.ruleTable th { padding: 5px; border-collapse: collapse; border-bottom: solid 1px gray; font-weight: bold; } table.ruleTable td { padding: 5px; border-collapse: collapse; border-bottom: solid 1px gray; } </style> <script type="text/javascript"> var djConfig= { isDebug: false, parseOnLoad: true, AutoIDL: ['aou','aout','pgt','au','cbreb'] } </script> <script src='/js/dojo/dojo/dojo.js'></script> <!-- <script src="/js/dojo/dojo/openils_dojo.js"></script> --> <script type="text/javascript"> dojo.require('dojo.data.ItemFileReadStore'); dojo.require('dijit.form.Form'); dojo.require('dijit.form.NumberSpinner'); dojo.require('dijit.form.FilteringSelect'); dojo.require('dijit.form.TextBox'); dojo.require('dijit.form.Textarea'); dojo.require('dijit.form.Button'); dojo.require('MARC.Batch'); dojo.require('fieldmapper.AutoIDL'); dojo.require('fieldmapper.dojoData'); dojo.require('openils.User'); dojo.require('openils.CGI'); var cgi = new openils.CGI(); var u = new openils.User({ authcookie : 'ses' }); var bucketStore = new dojo.data.ItemFileReadStore( { data : cbreb.toStoreData( fieldmapper.standardRequest( ['open-ils.actor','open-ils.actor.container.retrieve_by_class.authoritative'], [u.authtoken, u.user.id(), 'biblio', 'staff_client'] ) ) } ); function render_preview () { var rec = ruleset_to_record(); dojo.byId('marcPreview').innerHTML = rec.toBreaker(); } function render_from_template () { var kid_number = dojo.byId('ruleList').childNodes.length; var clone = dojo.query('*[name=ruleTable]', dojo.byId('ruleTemplate'))[0].cloneNode(true); var typeSelect = dojo.query('*[name=typeSelect]',clone).instantiate(dijit.form.FilteringSelect, { onChange : function (val) { switch (val) { case 'a': case 'r': dijit.byNode(dojo.query('*[name=marcDataContainer] .dijit',clone)[0]).attr('disabled',false); break; default : dijit.byNode(dojo.query('*[name=marcDataContainer] .dijit',clone)[0]).attr('disabled',true); }; render_preview(); } })[0]; var marcData = dojo.query('*[name=marcData]',clone).instantiate(dijit.form.TextBox, { onChange : render_preview })[0]; var tag = dojo.query('*[name=tag]',clone).instantiate(dijit.form.TextBox, { onChange : function (newtag) { var md = dijit.byNode(dojo.query('*[name=marcDataContainer] .dijit',clone)[0]); var current_marc = md.attr('value'); if (newtag.length == 3) { if (current_marc.length == 0) newtag += ' \\\\'; if (current_marc.substr(0,3) != newtag) current_marc = newtag + current_marc.substr(3); } md.attr('value', current_marc); render_preview(); } })[0]; var sf = dojo.query('*[name=sf]',clone).instantiate(dijit.form.TextBox, { onChange : function (newsf) { var md = dijit.byNode(dojo.query('*[name=marcDataContainer] .dijit',clone)[0]); var current_marc = md.attr('value'); var sf_list = newsf.split(''); for (var i in sf_list) { var re = '\\$' + sf_list[i]; if (current_marc.match(re)) continue; current_marc += '$' + sf_list[i]; } md.attr('value', current_marc); render_preview(); } })[0]; var matchSF = dojo.query('*[name=matchSF]',clone).instantiate(dijit.form.TextBox, { onChange : render_preview })[0]; var matchRE = dojo.query('*[name=matchRE]',clone).instantiate(dijit.form.TextBox, { onChange : render_preview })[0]; var removeButton = dojo.query('*[name=removeButton]',clone).instantiate(dijit.form.Button, { onClick : function() { dojo.addClass( dojo.byId('ruleList').childNodes[kid_number], 'hide_me' ); render_preview(); } })[0]; dojo.place(clone,'ruleList'); } function ruleset_to_record () { var rec = new MARC.Record ({ delimiter : '$' }); dojo.forEach( dojo.query('#ruleList *[name=ruleTable]').filter( function (node) { if (node.className.match(/hide_me/)) return false; return true; }), function (tbl) { var rule_tag = new MARC.Field ({ tag : '905', ind1 : ' ', ind2 : ' ' }); var rule_txt = dijit.byNode(dojo.query('*[name=tagContainer] .dijit',tbl)[0]).attr('value'); rule_txt += dijit.byNode(dojo.query('*[name=sfContainer] .dijit',tbl)[0]).attr('value'); var reSF = dijit.byNode(dojo.query('*[name=matchSFContainer] .dijit',tbl)[0]).attr('value'); if (reSF) { var reRE = dijit.byNode(dojo.query('*[name=matchREContainer] .dijit',tbl)[0]).attr('value'); rule_txt += '[' + reSF + '~' + reRE + ']'; } var rtype = dijit.byNode(dojo.query('*[name=typeSelectContainer] .dijit',tbl)[0]).attr('value'); rule_tag.addSubfields( rtype, rule_txt ) rec.appendFields( rule_tag ); if (rtype == 'a' || rtype == 'r') { rec.appendFields( new MARC.Record ({ delimiter : '$', marcbreaker : dijit.byNode(dojo.query('*[name=marcDataContainer] .dijit',tbl)[0]).attr('value') }).fields[0] ); } } ); return rec; } </script> </head> <body style="margin:10px;" class='tundra'> <div dojoType="dijit.form.Form" id="myForm" jsId="myForm" encType="multipart/form-data" action="" method="POST"> <script type='dojo/method' event='onSubmit'> var rec = ruleset_to_record(); if (rec.subfield('905','r') == '') { // no-op to force replace mode rec.appendFields( new MARC.Field ({ tag : '905', ind1 : ' ', ind2 : ' ', subfields : [['r','901c']] }) ); } dojo.byId('template_value').value = rec.toXmlString(); return true; </script> <input type='hidden' id='template_value' name='template'/> <label for='inputTypeSelect'>Record source:</label> <select name='recordSource' dojoType='dijit.form.FilteringSelect'> <script type='dojo/method' event='onChange' args="val"> switch (val) { case 'b': dojo.removeClass('bucketListContainer','hide_me'); dojo.addClass('csvContainer','hide_me'); dojo.addClass('recordContainer','hide_me'); break; case 'c': dojo.addClass('bucketListContainer','hide_me'); dojo.removeClass('csvContainer','hide_me'); dojo.addClass('recordContainer','hide_me'); break; case 'r': dojo.addClass('bucketListContainer','hide_me'); dojo.addClass('csvContainer','hide_me'); dojo.removeClass('recordContainer','hide_me'); break; }; </script> <script type='dojo/method' event='postCreate'> if (cgi.param('recordSource')) { this.attr('value',cgi.param('recordSource')); this.onChange(cgi.param('recordSource')); } </script> <option value='b'>a Bucket</option> <option value='c'>a CSV File</option> <option value='r'>a specific record ID</option> </select> <table style='margin:10px; margin-bottom:20px;'> <!-- <tr> <th>Merge template name (optional):</th> <td><input id='bucketName' jsId='bucketName' type='text' dojoType='dijit.form.TextBox' name='bname' value=''/></td> </tr> --> <tr class='' id='bucketListContainer'> <td>Bucket named: <div name='containerid' jsId='bucketList' dojoType='dijit.form.FilteringSelect' store='bucketStore' searchAttr='name' id='bucketList'> <script type='dojo/method' event='postCreate'> if (cgi.param('containerid')) this.attr('value',cgi.param('containerid')); </script> </div> </td> </tr> <tr class='hide_me' id='csvContainer'> <td> Column <input style='width:75px;' type='text' dojoType='dijit.form.NumberSpinner' name='idcolumn' value='0' constraints='{min:0,max:100,places:0}' /> of: <input id='idfile' type="file" name="idfile"/> <br/> <br/> Columns are numbered starting at 0. For instance, when looking at a CSV file in Excel, the column labeled A is the same as column 0, and the column labeled B is the same as column 1. </td> </tr> <tr class='hide_me' id='recordContainer'> <td>Record ID: <input dojoType='dijit.form.TextBox' name='recid' style='width:75px;' type='text' value=''/></td> </tr> </table> <button type="submit" dojoType='dijit.form.Button'>GO!</button> (After setting up your template below.) <br/> <br/> </div> <!-- end of the form --> <hr/> <table style='width: 100%'> <tr> <td style='width: 50%'><div id='ruleList'></div></td> <td valign='top'>Update Template Preview:<br/><pre id='marcPreview'></pre></td> </tr> </table> <button dojoType='dijit.form.Button'>Add Merge Rule <script type='dojo/connect' event='onClick'>render_from_template()</script> <script type='dojo/method' event='postCreate'>render_from_template()</script> </button> <div class='hide_me' id='ruleTemplate'> <div name='ruleTable'> <table class='ruleTable'> <tbody> <tr> <th style="text-align:center;">Rule Setup</th> <th style="text-align:center;">Data</th> <th style="text-align:center;">Help</th> </tr> <tr> <th>Action (Rule Type)</th> <td name='typeSelectContainer'> <select name='typeSelect'> <option value='r'>Replace</option> <option value='a'>Add</option> <option value='d'>Delete</option> </select> </td> <td>How to change the existing records</td> </tr> <tr> <th>MARC Tag</th> <td name='tagContainer'><input style='with: 2em;' name='tag' type='text'></input</td> <td>Three characters, no spaces, no indicators, etc. eg: 245</td> </td> <tr> <th>Subfields (optional)</th> <td name='sfContainer'><input name='sf' type='text'/></td> <td>No spaces, no delimiters, eg: abcnp</td> </tr> <tr> <th>MARC Data</th> <td name='marcDataContainer'><input name='marcData' type='text'/></td> <td>MARC-Breaker formatted data with indicators and subfield delimiters, eg:<br/>245 04$aThe End</td> </tr> <tr> <th colspan='3' style='padding-top: 20px; text-align: center;'>Advanced Matching Restriction (Optional)</th> </tr> <tr> <th>Subfield</th> <td name='matchSFContainer'><input style='with: 2em;' name='matchSF' type='text'></input</td> <td>A single subfield code, no delimiters, eg: a</td> <tr> <th>Regular Expression</th> <td name='matchREContainer'><input name='matchRE' type='text'/></td> <td>See <a href="http://perldoc.perl.org/perlre.html#Regular-Expressions" target="_blank">the Perl documentation</a> for an explanation of Regular Expressions. </td> </tr> <tr> <td colspan='3' style='padding-top: 20px; text-align: center;'> <button name='removeButton'>Remove this Template Rule</button> </td> </tr> </tbody> </table> <hr/> </div> </div> </body> </html> HTML return Apache2::Const::OK; } 1;
gpl-2.0
arnekolja/ext-jh_magnificpopup
Resources/Private/Templates/TypoScript/Default.html
1957
;(function($) { $('{selector}').each(function() { $(this).magnificPopup({ delegate: 'a:isImageFile', tClose: '<f:translate key="tClose" extensionName="JhMagnificpopup"></f:translate>', type: 'image', tLoading: '<f:translate key="tLoading" extensionName="JhMagnificpopup"></f:translate>', mainClass: '<f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.mainClass" />', gallery: { enabled: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.galleryEnabled" />, preload: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.galleryPreload" />, navigateByImgClick: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.galleryNavigateByImgClick" />, arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', tPrev: '<f:translate key="tPrev" extensionName="JhMagnificpopup"></f:translate>', tNext: '<f:translate key="tNext" extensionName="JhMagnificpopup"></f:translate>', tCounter: '<f:translate key="tCounter" extensionName="JhMagnificpopup"></f:translate>' }, image: { cursor: '<f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.imageCursor" />', titleSrc: 'title', verticalGap: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.imageVerticalGap" />, verticalFit: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.imageVerticalFit" />, tError: '<f:translate key="tError" extensionName="JhMagnificpopup"></f:translate>' }, removalDelay: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.removalDelay" /> }); }); })(window.jQuery || window.Zepto);
gpl-2.0
thierry4cta/makingtheconnection
sites/all/themes/adaptivetheme/at_core/layouts/panels/two_brick/two_brick.admin.css
306
#panels-dnd-main .region {margin-bottom: 5px;} #panels-dnd-main.region-twocol-brick-left-above, #panels-dnd-main .region-twocol-brick-left-below {float: left; width: 49.75%;} #panels-dnd-main .region-twocol-brick-right-above, #panels-dnd-main .region-twocol-brick-right-below {float: right; width: 49.75%;}
gpl-2.0
ignisf/clarion
db/migrate/20171022182011_create_feedbacks.rb
435
class CreateFeedbacks < ActiveRecord::Migration[4.2] def change create_table :feedbacks do |t| t.references :feedback_receiving, index: {name: :feedbacks_polymorphic_index}, polymorphic: true, null: false t.string :author_email t.integer :rating, null: false t.text :comment, null: false t.string :ip_address t.string :session_id, index: true t.timestamps null: false end end end
gpl-2.0
oshepherd/openttd-progsigs
src/pathfinder/yapf/yapf_common.hpp
7218
/* $Id$ */ /* * This file is part of OpenTTD. * OpenTTD 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, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. */ /** @file yapf_common.hpp Commonly used classes for YAPF. */ #ifndef YAPF_COMMON_HPP #define YAPF_COMMON_HPP /** YAPF origin provider base class - used when origin is one tile / multiple trackdirs */ template <class Types> class CYapfOriginTileT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Node::Key Key; ///< key to hash tables protected: TileIndex m_orgTile; ///< origin tile TrackdirBits m_orgTrackdirs; ///< origin trackdir mask /** to access inherited path finder */ FORCEINLINE Tpf& Yapf() { return *static_cast<Tpf*>(this); } public: /** Set origin tile / trackdir mask */ void SetOrigin(TileIndex tile, TrackdirBits trackdirs) { m_orgTile = tile; m_orgTrackdirs = trackdirs; } /** Called when YAPF needs to place origin nodes into open list */ void PfSetStartupNodes() { bool is_choice = (KillFirstBit(m_orgTrackdirs) != TRACKDIR_BIT_NONE); for (TrackdirBits tdb = m_orgTrackdirs; tdb != TRACKDIR_BIT_NONE; tdb = KillFirstBit(tdb)) { Trackdir td = (Trackdir)FindFirstBit2x64(tdb); Node& n1 = Yapf().CreateNewNode(); n1.Set(NULL, m_orgTile, td, is_choice); Yapf().AddStartupNode(n1); } } }; /** YAPF origin provider base class - used when there are two tile/trackdir origins */ template <class Types> class CYapfOriginTileTwoWayT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Node::Key Key; ///< key to hash tables protected: TileIndex m_orgTile; ///< first origin tile Trackdir m_orgTd; ///< first origin trackdir TileIndex m_revTile; ///< second (reversed) origin tile Trackdir m_revTd; ///< second (reversed) origin trackdir int m_reverse_penalty; ///< penalty to be added for using the reversed origin bool m_treat_first_red_two_way_signal_as_eol; ///< in some cases (leaving station) we need to handle first two-way signal differently /** to access inherited path finder */ FORCEINLINE Tpf& Yapf() { return *static_cast<Tpf*>(this); } public: /** set origin (tiles, trackdirs, etc.) */ void SetOrigin(TileIndex tile, Trackdir td, TileIndex tiler = INVALID_TILE, Trackdir tdr = INVALID_TRACKDIR, int reverse_penalty = 0, bool treat_first_red_two_way_signal_as_eol = true) { m_orgTile = tile; m_orgTd = td; m_revTile = tiler; m_revTd = tdr; m_reverse_penalty = reverse_penalty; m_treat_first_red_two_way_signal_as_eol = treat_first_red_two_way_signal_as_eol; } /** Called when YAPF needs to place origin nodes into open list */ void PfSetStartupNodes() { if (m_orgTile != INVALID_TILE && m_orgTd != INVALID_TRACKDIR) { Node& n1 = Yapf().CreateNewNode(); n1.Set(NULL, m_orgTile, m_orgTd, false); Yapf().AddStartupNode(n1); } if (m_revTile != INVALID_TILE && m_revTd != INVALID_TRACKDIR) { Node& n2 = Yapf().CreateNewNode(); n2.Set(NULL, m_revTile, m_revTd, false); n2.m_cost = m_reverse_penalty; Yapf().AddStartupNode(n2); } } /** return true if first two-way signal should be treated as dead end */ FORCEINLINE bool TreatFirstRedTwoWaySignalAsEOL() { return Yapf().PfGetSettings().rail_firstred_twoway_eol && m_treat_first_red_two_way_signal_as_eol; } }; /** YAPF destination provider base class - used when destination is single tile / multiple trackdirs */ template <class Types> class CYapfDestinationTileT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::NodeList::Titem Node; ///< this will be our node type typedef typename Node::Key Key; ///< key to hash tables protected: TileIndex m_destTile; ///< destination tile TrackdirBits m_destTrackdirs; ///< destination trackdir mask public: /** set the destination tile / more trackdirs */ void SetDestination(TileIndex tile, TrackdirBits trackdirs) { m_destTile = tile; m_destTrackdirs = trackdirs; } protected: /** to access inherited path finder */ Tpf& Yapf() { return *static_cast<Tpf*>(this); } public: /** Called by YAPF to detect if node ends in the desired destination */ FORCEINLINE bool PfDetectDestination(Node& n) { bool bDest = (n.m_key.m_tile == m_destTile) && ((m_destTrackdirs & TrackdirToTrackdirBits(n.GetTrackdir())) != TRACKDIR_BIT_NONE); return bDest; } /** Called by YAPF to calculate cost estimate. Calculates distance to the destination * adds it to the actual cost from origin and stores the sum to the Node::m_estimate */ inline bool PfCalcEstimate(Node& n) { static const int dg_dir_to_x_offs[] = {-1, 0, 1, 0}; static const int dg_dir_to_y_offs[] = {0, 1, 0, -1}; if (PfDetectDestination(n)) { n.m_estimate = n.m_cost; return true; } TileIndex tile = n.GetTile(); DiagDirection exitdir = TrackdirToExitdir(n.GetTrackdir()); int x1 = 2 * TileX(tile) + dg_dir_to_x_offs[(int)exitdir]; int y1 = 2 * TileY(tile) + dg_dir_to_y_offs[(int)exitdir]; int x2 = 2 * TileX(m_destTile); int y2 = 2 * TileY(m_destTile); int dx = abs(x1 - x2); int dy = abs(y1 - y2); int dmin = min(dx, dy); int dxy = abs(dx - dy); int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2); n.m_estimate = n.m_cost + d; assert(n.m_estimate >= n.m_parent->m_estimate); return true; } }; /** YAPF template that uses Ttypes template argument to determine all YAPF * components (base classes) from which the actual YAPF is composed. * For example classes consult: CYapfRail_TypesT template and its instantiations: * CYapfRail1, CYapfRail2, CYapfRail3, CYapfAnyDepotRail1, CYapfAnyDepotRail2, CYapfAnyDepotRail3 */ template <class Ttypes> class CYapfT : public Ttypes::PfBase ///< Instance of CYapfBaseT - main YAPF loop and support base class , public Ttypes::PfCost ///< Cost calculation provider base class , public Ttypes::PfCache ///< Segment cost cache provider , public Ttypes::PfOrigin ///< Origin (tile or two-tile origin) , public Ttypes::PfDestination ///< Destination detector and distance (estimate) calculation provider , public Ttypes::PfFollow ///< Node follower (stepping provider) { }; #endif /* YAPF_COMMON_HPP */
gpl-2.0
pliablepixels/ZoneMinder
web/skins/classic/views/js/controlpreset.js
332
function updateLabel() { var form = $('contentForm'); var preset_ddm = form.elements['preset']; var presetIndex = preset_ddm[preset_ddm.selectedIndex].value; if ( labels[presetIndex] ) { form.newLabel.value = labels[presetIndex]; } else { form.newLabel.value = ''; } } window.addEvent('domready', updateLabel);
gpl-2.0
samdroid-apps/paint-activity
test_fill.py
304
import fill import array a = array.array('I') a.append(1) a.append(1) a.append(3) a.append(2) a.append(2) a.append(2) a.append(2) a.append(2) a.append(2) a.append(2) a.append(2) a.append(2) print "before", a b = fill.fill(a, 2, 2, 3, 3, 4278190080) print "after", b print "after 2", array.array('I', b)
gpl-2.0
rdunning0823/tophat
src/Device/Declaration.hpp
2530
/* Copyright_License { Top Hat Soaring Glide Computer - http://www.tophatsoaring.org/ Copyright (C) 2000-2016 The Top Hat Soaring Project A detailed list of copyright holders can be found in the file "AUTHORS". 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. } */ #ifndef XCSOAR_DEVICE_DECLARATION_HPP #define XCSOAR_DEVICE_DECLARATION_HPP #include "Geo/GeoPoint.hpp" #include "Engine/Waypoint/Waypoint.hpp" #include "Util/StaticString.hxx" #include "Compiler.h" #include <vector> #include <tchar.h> struct LoggerSettings; struct Plane; class OrderedTask; class OrderedTaskPoint; struct Declaration { struct TurnPoint { enum Shape { CYLINDER, SECTOR, LINE, DAEC_KEYHOLE }; Waypoint waypoint; Shape shape; unsigned radius; TurnPoint(const Waypoint &_waypoint) :waypoint(_waypoint), shape(CYLINDER), radius(1500) {} TurnPoint(const OrderedTaskPoint &tp); }; StaticString<64> pilot_name; StaticString<32> aircraft_type; StaticString<32> aircraft_registration; StaticString<8> competition_id; std::vector<TurnPoint> turnpoints; Declaration(const LoggerSettings &logger_settings, const Plane &plane, const OrderedTask* task); void Append(const Waypoint &waypoint) { turnpoints.push_back(waypoint); } const Waypoint &GetWaypoint(unsigned i) const { return turnpoints[i].waypoint; } const Waypoint &GetFirstWaypoint() const { return turnpoints.front().waypoint; } const Waypoint &GetLastWaypoint() const { return turnpoints.back().waypoint; } gcc_pure const TCHAR *GetName(const unsigned i) const { return turnpoints[i].waypoint.name.c_str(); } const GeoPoint &GetLocation(const unsigned i) const { return turnpoints[i].waypoint.location; } gcc_pure unsigned Size() const { return turnpoints.size(); } }; #endif
gpl-2.0
rsathishkumar/edtx
themes/porto/master/rtl/css/demos/rtl-demo-shop-7.css
108326
body { font-size: 13px; line-height: 1.5; } h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: #313131; line-height: 1.35; margin: 0 0 15px; text-transform: none; letter-spacing: 0 !important; } h1, .h1 { font-size: 22px; margin-bottom: 20px; } h2, .h2 { font-size: 20px; margin-bottom: 20px; } h3, .h3 { font-size: 18px; } h4, .h4 { font-size: 16px; } h5, .h5 { font-size: 14px; } h6, .h6 { font-size: 12px; } p { line-height: 1.5; } a { -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; } hr.medium { margin: 33px 0; } .heading-text-color { color: #777 !important; } .text-primary { color: #65829d; } .text-color { color: #777 !important; } h2.word-rotator-title .word-rotate { line-height: 35px; max-height: 35px; margin-bottom: -10px; } @media (min-width: 992px) { .col-md-9 { padding-left: 12px; } .col-md-9.col-md-push-3 { padding-left: 15px; padding-right: 12px; } .col-md-9 + .col-md-3 { padding-right: 12px; } .col-md-9 + .col-md-3.col-md-pull-9 { padding-right: 15px; padding-left: 12px; } } @font-face { font-family: "minicart-font"; src: url("../fonts/minicart-font.eot?v=1.0"); src: url("../fonts/minicart-font.eot?#iefix&v=1.0") format("embedded-opentype"), url("../fonts/minicart-font.woff?v=1.0") format("woff"), url("../fonts/minicart-font.ttf?v=1.0") format("truetype"), url("../fonts/minicart-font.svg?v=1.0#minicart-font") format("svg"); font-weight: normal; font-style: normal; } .minicart-icon:before { font-family: "minicart-font" !important; font-style: normal !important; font-weight: normal !important; font-variant: normal !important; text-transform: none !important; speak: none; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .minicart-icon:before { content: "\e800"; } @media (max-width: 991px) { #header { min-height: auto !important; } } #header .header-top { margin-top: 0; padding: 5.5px 0; background-color: #65829d; border-bottom: none; color: #fff; } #header .header-top p { color: #fff; margin: 3px 0 3px 20px; text-align: right; float: left; font-size: 11px; line-height: 19px; text-transform: uppercase; } #header .top-menu { display: block; padding: 0; margin: 3px 0; list-style: none; } #header .top-menu li { display: inline; font-size: 11px; padding: 0 10px; text-transform: uppercase; line-height: 19px; border-right: 1px solid #ccc; } @media (min-width: 992px) { #header .top-menu li { padding-right: 15px; padding-right: 15px; } } #header .top-menu li a { display: inline-block; color: #fff; } #header .top-menu li:last-child { padding-left: 0; } @media (max-width: 767px) { #header .top-menu { display: none; position: absolute; min-width: 94px; left: 0; text-align: left; top: 100%; margin: 0; padding: 4px 0; background-color: #fff; border: 1px solid #ccc; border-radius: 0; box-shadow: 0 0 2px rgba(0, 0, 0, 0.1); } #header .top-menu li { display: block; padding: 2px 9px; line-height: 1; border-right: none; } #header .top-menu li:last-child { padding-left: 9px; } #header .top-menu li a { font-size: 11px; line-height: 1; color: #777; text-decoartion: none; } #header .top-menu li:hover { background-color: #ccc; } #header .top-menu li:hover a { color: #fff; } } #header .top-menu-area { position: relative; float: left; display: block; } #header .top-menu-area > a { display: inline-block; font-size: 11px; line-height: 24px; color: #fff; padding-right: 10px; padding-left: 0; text-transform: uppercase; } #header .top-menu-area > a:hover, #header .top-menu-area > a:focus { text-decoration: none; } #header .top-menu-area > a i { margin-right: 4px; } @media (min-width: 768px) { #header .top-menu-area > a { display: none; } } @media (max-width: 420px) { #header .top-menu-area > a { padding-right: 6px; } #header .top-menu-area > a i { margin-right: 3px; } } @media (max-width: 767px) { #header .top-menu-area:hover .top-menu, #header .top-menu-area:focus .top-menu { display: block; } } #header .welcome-msg { margin: 3px 0 3px 20px; text-align: right; float: left; font-size: 11px; line-height: 19px; text-transform: uppercase; } @media (max-width: 991px) { #header .welcome-msg { display: none; } } #header .dropdowns-container { float: right; } #header .dropdowns-container:after { content: ''; display: table; clear: both; } #header .header-dropdown { position: relative; float: right; } #header .header-dropdown > a { display: inline-block; font-size: 11px; line-height: 24px; color: #fff; padding-right: 10px; padding-left: 15px; } #header .header-dropdown > a i { margin-right: 4px; } @media (max-width: 420px) { #header .header-dropdown > a { padding-right: 5px; padding-left: 10px; } #header .header-dropdown > a i { margin-right: 3px; } } #header .header-dropdown:first-child > a { padding-right: 0; } #header .header-dropdown a { text-transform: uppercase; } #header .header-dropdown a img { display: inline-block; max-width: 16px; height: auto; vertical-align: middle; margin-left: 6px; margin-top: -2px; } #header .header-dropdown a:hover, #header .header-dropdown a:focus { text-decoration: none; } #header .header-dropdown .header-dropdownmenu { list-style: none; display: none; position: absolute; right: 0; top: 100%; margin: 0; padding: 4px 0; background-color: #fff; border: 1px solid #ccc; border-radius: 0; box-shadow: 0 0 2px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 0 0 2px rgba(0, 0, 0, 0.1); } #header .header-dropdown .header-dropdownmenu li { padding: 2px 9px; line-height: 1; } #header .header-dropdown .header-dropdownmenu li a { font-size: 11px; line-height: 1; color: #777; } #header .header-dropdown .header-dropdownmenu li a img { margin-top: -3px; } #header .header-dropdown .header-dropdownmenu li:hover { background-color: #ccc; } #header .header-dropdown .header-dropdownmenu li:hover a { color: #fff; } #header .header-dropdown.lang-dropdown .header-dropdownmenu { min-width: 98px; } #header .header-dropdown:hover .header-dropdownmenu, #header .header-dropdown:focus .header-dropdownmenu { display: block; } #header .header-dropdown + .header-dropdown, #header .header-dropdown + .compare-dropdown { margin-right: 7px; } #header .header-dropdown + .header-dropdown:before, #header .header-dropdown + .compare-dropdown:before { content: ''; display: inline-block; vertical-align: middle; width: 1px; height: 14px; position: absolute; right: -7px; top: 50%; margin-top: -7px; background-color: #ccc; } @media (max-width: 420px) { #header .header-dropdown + .header-dropdown, #header .header-dropdown + .compare-dropdown { margin-right: 4px; } #header .header-dropdown + .header-dropdown:before, #header .header-dropdown + .compare-dropdown:before { right: -5px; } } #header .compare-dropdown { position: relative; float: right; } @media (max-width: 350px) { #header .compare-dropdown { display: none; } } #header .compare-dropdown > a { display: inline-block; font-size: 11px; line-height: 24px; color: #65829d; padding-right: 7px; padding-left: 15px; text-transform: uppercase; } @media (max-width: 420px) { #header .compare-dropdown > a { padding-right: 5px; padding-left: 10px; } } #header .compare-dropdown > a i { margin-top: -2px; } #header .compare-dropdown > a:hover, #header .compare-dropdown > a:focus { text-decoration: none; } #header .compare-dropdown .compare-dropdownmenu .dropdownmenu-wrapper { padding: 20px; } #header .compare-dropdown .compare-dropdownmenu .dropdownmenu-wrapper .empty { margin: 0; float: none; font-size: 11px; line-height: 1.5; } #header .compare-dropdown .compare-dropdownmenu .dropdownmenu-wrapper .compare-products { list-style: none; padding: 0; margin: 0; } #header .compare-dropdown .compare-dropdownmenu .dropdownmenu-wrapper .compare-products .product { position: relative; padding: 5px 0; margin: 0; } #header .compare-dropdown .compare-dropdownmenu .dropdownmenu-wrapper .compare-products .product-name { font-weight: 400; font-size: 11px; text-transform: uppercase; margin: 0; } #header .compare-dropdown .compare-dropdownmenu .dropdownmenu-wrapper .compare-actions { margin-top: 20px; } #header .compare-dropdown .compare-dropdownmenu .dropdownmenu-wrapper .compare-actions:after { content: ''; display: table; clear: both; } #header .compare-dropdown .compare-dropdownmenu .dropdownmenu-wrapper .compare-actions .action-link { display: inline-block; float: right; line-height: 32px; color: #777; } #header .compare-dropdown .compare-dropdownmenu .dropdownmenu-wrapper .compare-actions .btn { float: left; font-size: 14px; padding-top: 6px; padding-bottom: 6px; min-width: 120px; border: none; } @media (min-width: 768px) { #header .compare-dropdown:hover .compare-dropdownmenu, #header .compare-dropdown:focus .compare-dropdownmenu { display: block; } } #header .header-body { border-top: 5px solid #56738e; border-bottom: none; padding: 0; -webkit-transition: none; -moz-transition: none; transition: none; } #header .header-logo img { margin: 0 0 0 3px; -webkit-transition: none; -moz-transition: none; transition: none; } #header .header-container { padding-top: 28px; padding-bottom: 28px; } #header .header-container.header-nav { padding: 0; background-color: transparent; } #header .cart-area { float: left; vertical-align: middle; margin-top: 5px; } @media (max-width: 991px) { #header .cart-area { margin-top: 5.5px; } } #header .cart-dropdown { position: relative; display: inline-block; vertical-align: middle; padding-left: 7px; padding-right: 7px; } #header .cart-dropdown .cart-dropdown-icon { position: relative; display: inline-block; height: 40px; padding: 0; line-height: 40px; text-align: center; top: -1px; color: #fff; text-decoration: none !important; -webkit-transition: none; -moz-transition: none; transition: none; } #header .cart-dropdown .cart-dropdown-icon i { font-size: 35px; color: #65829d; } #header .cart-dropdown .cart-dropdown-icon .cart-info { position: absolute; width: 100%; text-align: center; top: 50%; margin-top: -4px; right: 0; padding: 0; display: block; line-height: 1; } #header .cart-dropdown .cart-dropdown-icon .cart-info .cart-qty { font-size: 14px; font-weight: 600; } #header .cart-dropdown .cart-dropdown-icon .cart-info .cart-text { displaY: none; font-size: 12px; font-weight: 400; } #header .cart-dropdown .cart-dropdownmenu .cart-empty { padding: 20px 0; text-align: center; } #header .cart-dropdown .cart-dropdownmenu .cart-products { padding: 0 20px; } #header .cart-dropdown .cart-dropdownmenu .product.product-sm { position: relative; padding: 20px 0; border-bottom: 1px solid #eee; } #header .cart-dropdown .cart-dropdownmenu .product.product-sm .product-image-area { padding: 0; border: none; border-radius: 0; width: 80px; margin: 0; } #header .cart-dropdown .cart-dropdownmenu .product.product-sm .product-image-area .product-image { border-radius: 0; } #header .cart-dropdown .cart-dropdownmenu .product.product-sm .product-details-area { float: none; margin: 0 0 0 90px; padding: 0; } #header .cart-dropdown .cart-dropdownmenu .product.product-sm .btn-remove { top: 28px; } @media (max-width: 350px) { #header .cart-dropdown .cart-dropdownmenu .product.product-sm .btn-remove { top: 50%; margin-top: -11.5px; } } #header .cart-dropdown .cart-dropdownmenu .product.product-sm .product-name { font-size: 13px; margin: 10px 0; } #header .cart-dropdown .cart-dropdownmenu .product.product-sm .cart-qty-price { color: #65829d; } #header .cart-dropdown .cart-dropdownmenu .cart-totals { padding: 10px 20px; text-align: center; font-size: 18px; font-weight: 700; } #header .cart-dropdown .cart-dropdownmenu .cart-totals span { color: #65829d; } #header .cart-dropdown .cart-dropdownmenu .cart-actions { font-size: 0; padding: 0 20px 15px; border-radius: 0 0 0 0; } #header .cart-dropdown .cart-dropdownmenu .cart-actions .btn { width: 128px; text-align: center; border: none; padding-top: 6px; padding-bottom: 6px; } @media (max-width: 350px) { #header .cart-dropdown .cart-dropdownmenu .cart-actions .btn { display: block; width: 100%; } } #header .cart-dropdown .cart-dropdownmenu .cart-actions .btn + .btn { margin-right: 4px; } @media (max-width: 350px) { #header .cart-dropdown .cart-dropdownmenu .cart-actions .btn + .btn { margin-right: 0; margin-top: 4px; } } #header .cart-dropdown:hover .cart-dropdownmenu, #header .cart-dropdown:focus .cart-dropdownmenu { display: block; } #header .compare-dropdownmenu, #header .cart-dropdownmenu { display: none; position: absolute; right: 0; top: 100%; width: 300px; padding-top: 10px; z-index: 100; color: #777; } @media (max-width: 350px) { #header .compare-dropdownmenu, #header .cart-dropdownmenu { width: 240px; } } #header .compare-dropdownmenu .btn-remove, #header .cart-dropdownmenu .btn-remove { position: absolute; top: 0; left: 0; display: block; width: 23px; height: 23px; overflow: hidden; padding: 5px 0; font-size: 13px; line-height: 1; text-align: center; color: #777; } #header .compare-dropdownmenu .btn-remove:hover, #header .compare-dropdownmenu .btn-remove:focus, #header .cart-dropdownmenu .btn-remove:hover, #header .cart-dropdownmenu .btn-remove:focus { opacity: 0.9; } #header .compare-dropdownmenu .dropdownmenu-wrapper, #header .cart-dropdownmenu .dropdownmenu-wrapper { border-top: 6px solid #65829d; background-color: #fff; border-radius: 0 0 0 0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); } #header .compare-dropdownmenu .dropdownmenu-wrapper:before, #header .cart-dropdownmenu .dropdownmenu-wrapper:before { content: ""; position: absolute; border: 10px solid transparent; border-bottom-color: #65829d; display: block; right: 15px; top: -10px; } #header .compare-dropdownmenu.right, #header .compare-dropdownmenu.pull-right, #header .cart-dropdownmenu.right, #header .cart-dropdownmenu.pull-right { float: none !important; right: auto; left: 0; } #header .compare-dropdownmenu.right .dropdownmenu-wrapper:before, #header .compare-dropdownmenu.pull-right .dropdownmenu-wrapper:before, #header .cart-dropdownmenu.right .dropdownmenu-wrapper:before, #header .cart-dropdownmenu.pull-right .dropdownmenu-wrapper:before { right: auto; left: 15px; } #header .custom-block { display: inline-block; text-align: center; font-size: 14px; line-height: 39px; font-weight: 400; vertical-align: middle; color: #777; margin-left: 10px; } @media (max-width: 1199px) { #header .custom-block { display: none; } } #header .custom-block i { margin-left: 5px; } #header .custom-block .split { display: inline-block; height: 14px; width: 1px; border-left: 1px solid #ccc; margin: 0 10px; vertical-align: middle; } #header .custom-block a { font-size: 12px; color: #777; } #header .header-search { position: relative; float: right; margin: 0 0 0 25px; font-size: 0; line-height: 1; padding: 0; border: none; } @media (max-width: 991px) { #header .header-search { float: left; margin-left: 15px; } } @media (max-width: 767px) { #header .header-search { margin-left: 10px; } } @media (max-width: 360px) { #header .header-search { margin-right: 0; margin-left: 3px; } } #header .header-search .search-toggle { display: inline-block; font-size: 13px; line-height: 50px; min-width: 25px; text-align: center; color: #777; -webkit-transition: none; -moz-transition: none; transition: none; } #header .header-search form { display: inline-block; width: 0; } #header .header-search .header-search-wrapper { position: absolute; right: -50px; top: 100%; z-index: 20; display: none; overflow: visible; border: 5px solid #ccc; border-radius: 0; background-color: #fff; width: 100%; min-width: 250px; padding-left: 40px; width: 450px; } #header .header-search .header-search-wrapper.open { display: block; } #header .header-search .header-search-wrapper:before { content: ""; display: block; position: absolute; right: 45px; top: -25px; z-index: 20; width: 20px; height: 20px; border: 10px solid transparent; border-bottom-color: #ccc; } #header .header-search .header-search-wrapper:after { content: ''; display: table; clear: both; } @media (max-width: 991px) { #header .header-search .header-search-wrapper { right: auto; left: -50px; } #header .header-search .header-search-wrapper:before { right: auto; left: 45px; } } @media (max-width: 480px) { #header .header-search .header-search-wrapper { width: 300px; } } @media (max-width: 350px) { #header .header-search .header-search-wrapper { width: 240px; } } #header .header-search .header-search-wrapper .form-control, #header .header-search .header-search-wrapper select { float: right; height: 35px; font-family: Arial; font-size: 13px; background-color: #fff; margin: 0; } #header .header-search .header-search-wrapper .form-control { padding: 7.5px 15px; color: #777; width: 100%; margin: 0; line-height: 20px; border-radius: 0 0 0 0; box-shadow: none; border: none; } #header .header-search .header-search-wrapper select { position: absolute; left: 36px; width: 130px; border: 1px solid #ccc; border-top: 0; border-bottom: 0; line-height: 35px; color: #777; padding: 0; padding-right: 10px; border-radius: 0; -moz-appearance: none; -webkit-appearance: none; } @media (max-width: 350px) { #header .header-search .header-search-wrapper select { width: 110px; } } #header .header-search .header-search-wrapper .btn.btn-default { position: absolute; right: auto; left: 0; top: 0; width: 36px; height: 35px; color: #777; background-color: transparent; font-size: 14px; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer; border-radius: 0 0 0 0; } #header .header-search .header-search-wrapper .btn.btn-default:hover, #header .header-search .header-search-wrapper .btn.btn-default:focus { color: #65829d; background-color: transparent; } #header .header-nav-main { display: none; float: right; margin-top: 10px; } @media (min-width: 992px) { #header .header-nav-main { min-height: 30px; display: block; } } #header .header-nav-main nav { height: 30px; border-radius: 0; background-color: transparent; } #header .header-nav-main nav > ul > li > a.dropdown-toggle { -webkit-transition: none; -moz-transition: none; transition: none; color: #65829d; padding: 5px 15px 5px 25px; } #header .header-nav-main nav > ul > li > a.dropdown-toggle:after { font-size: inherit; content: "\f107"; left: 12px; top: 5px; } #header .header-nav-main nav > ul > li > a { -webkit-transition: none; -moz-transition: none; transition: none; color: #65829d; padding: 5px 15px; } #header .header-nav-main nav > ul > li:hover > a.dropdown-toggle, #header .header-nav-main nav > ul > li.open #header .header-nav-main nav > ul > li.dropdown:hover > a.dropdown-toggle, #header .header-nav-main nav > ul > li.dropdown.open > a.dropdown-toggle { padding-bottom: 5px; } #header .header-nav-main nav > ul > li.dropdown .dropdown-menu { border-left: none; border-right: none; border-bottom: none; margin-top: 0; } #header .header-nav-main nav > ul > li.dropdown .dropdown-menu li a { border-bottom: none; } #header .header-nav-main nav > ul > li.dropdown .dropdown-menu li.dropdown-submenu > a:after { content: "\f105"; font-family: FontAwesome; font-size: inherit; border: none; margin: 0; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu { border-radius: 0 0 0 0; padding: 0; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content { padding: 10px 20px 20px; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .row, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .row { margin-left: -15px; margin-left: -15px; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ul, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ol, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ul, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ol { list-style: none; margin: 0; padding: 5px 0; right: 100%; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ul li, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ol li, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ul li, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ol li { line-height: 22px; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ul li a, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ol li a, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ul li a, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ol li a { padding: 0; margin: 0; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ul li a:hover, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ul li a:focus, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ol li a:hover, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ol li a:focus, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ul li a:hover, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ul li a:focus, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ol li a:hover, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ol li a:focus { text-decoration: underline; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ul li:hover a, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ol li:hover a, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ul li:hover a, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content ol li:hover a { background-color: transparent; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .dropdown-mega-sub-title, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .dropdown-mega-sub-title { display: block; font-size: 14px; font-weight: 600; padding: 0; text-transform: uppercase; line-height: 1.5; margin-top: 10px; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .cat-img, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .cat-img { display: block; padding: 0; margin-top: 15px; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .cat-img img, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .cat-img img { display: block; max-width: 100%; height: auto; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .dropdown-mega-top, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .dropdown-mega-top { padding: 4px 0 8px; border-bottom: 1px solid #eee; color: #000; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .dropdown-mega-top a, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .dropdown-mega-top span, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .dropdown-mega-top a, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .dropdown-mega-top span { font-size: 12px; font-weight: 400; color: #000; text-transform: uppercase; padding: 0; margin-left: 15px; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .dropdown-mega-top span, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .dropdown-mega-top span { font-weight: 700; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .menu-banner-area, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .menu-banner-area { position: relative; text-align: center; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .menu-banner-area img, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .menu-banner-area img { display: inline-block; max-width: 100%; height: auto; margin: 20px auto 0; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header { position: absolute; top: -35px; right: -15px; text-align: right; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header h3, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header h3 { font-size: 23px; font-weight: 600; color: #fff; background-color: #2e2e2e; line-height: 1; padding: 6px 8px 6px 50px; margin-bottom: 15px; text-transform: uppercase; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header .btn, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header .btn { font-size: 13px; padding: 5px 8px 5px 7px; color: #fff; border: 0; font-size: 13px; min-width: 109px; text-align: center; text-transform: uppercase; border-radius: 0; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header .btn:hover, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header .btn:focus, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header .btn:hover, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header .btn:focus { opacity: 0.9; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header .btn i, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .menu-banner-area .menu-banner-header .btn i { margin-right: 4px; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content .menu-banner-area p, #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu .dropdown-mega-content .menu-banner-area p { position: absolute; bottom: 8px; width: 60%; text-align: center; right: 50px; line-height: 14px; font-size: 13px; margin-bottom: 0; } #header .header-nav-main nav > ul > li.dropdown-mega-small > .dropdown-menu { width: 600px; } #header .header-nav-main nav > ul > li.dropdown-mega-small .mega-banner-bg img { position: absolute; left: 10px; top: -10px; height: 273px; width: auto; max-width: none; z-index: -1; border-radius: 0; } #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ul li, #header .header-nav-main nav > ul > li.dropdown-mega > .dropdown-menu .dropdown-mega-content ol li { line-height: 23px; } #header .header-nav-main nav > ul > li:hover > a, #header .header-nav-main nav > ul > li.open > a, #header .header-nav-main nav > ul > li.active > a, #header .header-nav-main nav > ul > li.dropdown-full-color.dropdown-primary:hover > a, #header .header-nav-main nav > ul > li.dropdown-full-color.dropdown-primary.open > a, #header .header-nav-main nav > ul > li.dropdown-full-color.dropdown-primary.active > a { color: #fff; background-color: #65829d; } #header .header-nav-main nav > ul > li:hover > a:hover, #header .header-nav-main nav > ul > li:hover > a:focus, #header .header-nav-main nav > ul > li.open > a:hover, #header .header-nav-main nav > ul > li.open > a:focus, #header .header-nav-main nav > ul > li.active > a:hover, #header .header-nav-main nav > ul > li.active > a:focus, #header .header-nav-main nav > ul > li.dropdown-full-color.dropdown-primary:hover > a:hover, #header .header-nav-main nav > ul > li.dropdown-full-color.dropdown-primary:hover > a:focus, #header .header-nav-main nav > ul > li.dropdown-full-color.dropdown-primary.open > a:hover, #header .header-nav-main nav > ul > li.dropdown-full-color.dropdown-primary.open > a:focus, #header .header-nav-main nav > ul > li.dropdown-full-color.dropdown-primary.active > a:hover, #header .header-nav-main nav > ul > li.dropdown-full-color.dropdown-primary.active > a:focus { color: #fff; background-color: #65829d; } #header .header-nav-main nav > ul > li .dropdown-menu > li:hover > a { background-color: #f4f4f4; } #header .header-nav-main nav > ul > li .dropdown-menu > li:hover > a:hover, #header .header-nav-main nav > ul > li .dropdown-menu > li:hover > a:focus { background-color: #f4f4f4; } .sticky-header-active #header .header-container { padding-top: 7px; padding-bottom: 7px; } .sticky-header-active #header .header-column:first-child { width: 90px; } .sticky-header-active #header .header-column:last-child { width: calc(100% - 90px); } .sticky-header-active #header .header-body { min-height: 46px; } .sticky-header-active #header .header-nav-main { margin: 1px 0 0; } .sticky-header-active #header .header-search { margin-left: 20px; } .sticky-header-active #header .header-search > a { line-height: 32px; } .sticky-header-active #header .header-search .header-search-wrapper { margin-top: 5px; } .sticky-header-active #header .header-logo img { width: auto; height: 32px; margin-left: 0; } .sticky-header-active #header .cart-area { margin-top: 0; } .sticky-header-active #header .cart-area .custom-block { display: none; } .sticky-header-active #header .cart-area .cart-dropdown { line-height: 1; } .sticky-header-active #header .cart-area .cart-dropdown .cart-dropdown-icon { height: 32px; line-height: 32px; margin-top: 0; } .sticky-header-active #header .cart-area .cart-dropdown .cart-dropdown-icon i { font-size: 31px; } .sticky-header-active #header .cart-area .cart-dropdown .cart-dropdown-icon .cart-info .cart-qty { font-size: 12px; } .tip { color: #fff; position: relative; display: inline-block; font-size: 9px; font-weight: 400; padding: 2px; z-index: 1; border-radius: 0; line-height: 1; margin: 0 10px 0 0; vertical-align: middle; text-transform: uppercase; } #mainNav .dropdown-menu li .tip { margin-top: -2px; } .tip:before { content: ""; position: absolute; right: auto; left: 100%; top: 50%; margin-top: -4px; border: 3px solid transparent; } .tip.tip-new { background-color: #0cc485 !important; } .tip.tip-new:before { border-left-color: #0cc485 !important; } .tip.tip-hot { background-color: #eb2771 !important; } .tip.tip-hot:before { border-left-color: #eb2771 !important; } #mainNav > li > a .tip { position: absolute; top: -7px; left: 10px; } #mainNav > li > a .tip:before { position: absolute; right: 3px; top: 100%; width: 3px; height: 3px; margin: 0; border-color: transparent !important; } #mainNav > li > a .tip.tip-new:before { border-top-color: #0cc485 !important; } #mainNav > li > a .tip.tip-hot:before { border-top-color: #eb2771 !important; } .body { position: relative; right: 0; -webkit-transition: right 0.3s; -moz-transition: right 0.3s; transition: right 0.3s; } .mmenu-toggle-btn { display: block; width: 30px; height: auto; font-size: 20px; line-height: 40px; text-align: center; padding: 0; float: left; margin: 5.5px 0 5.5px 10px; vertical-align: middle; color: #777; } @media (min-width: 992px) { .mmenu-toggle-btn { display: none; } } @media (max-width: 767px) { .mmenu-toggle-btn { margin-left: 5px; } } .mmenu-toggle-btn:hover, .mmenu-toggle-btn:focus { color: #777; text-decoration: none; } .mobile-nav { display: block !important; position: fixed; top: 0; right: -250px; z-index: 999; width: 250px; height: 100%; overflow-y: scroll; padding: 20px 15px; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; background-color: #151515; } .mobile-side-menu { list-style: none; margin: 0; padding: 0; } .mobile-side-menu > li > a { text-transform: uppercase; } .mobile-side-menu li { display: block; position: relative; } .mobile-side-menu li:after { content: ''; display: table; clear: both; } .mobile-side-menu li a { display: block; font-size: 14px; line-height: 40px; background-color: transparent; color: #fff; border: 0; padding: 0 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; text-decoration: none !important; } .mobile-side-menu li a:after { content: ''; display: table; clear: both; } .mobile-side-menu li ul { display: none; padding: 0; margin: 0; list-style: none; } .mobile-side-menu li li a { margin-right: 10px; font-size: 12px; } .mobile-side-menu li li a:before { font: normal normal 16px/40px "FontAwesome"; text-decoration: inherit; content: "\f105"; -webkit-font-smoothing: antialiased; float: right; margin-left: 10px; } .mobile-side-menu li li li a { margin-right: 20px; } .mobile-side-menu li .mmenu-toggle { position: absolute; top: 0; left: 0; display: block; color: #fff; background-color: transparent; cursor: pointer; font-size: 0; width: 40px; height: 40px; margin-top: 1px; -webkit-transition: all 0.2s ease; -moz-transition: all 0.2s ease; transition: all 0.2s ease; } .mobile-side-menu li .mmenu-toggle:after { content: "\f196"; font-family: 'FontAwesome'; text-rendering: auto; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; cursor: pointer; width: 19px; height: 19px; font-size: 19px; line-height: 19px; display: block; position: absolute; right: 10px; top: 11px; } .mobile-side-menu li.open > .mmenu-toggle:after { content: "\f147"; } #mobile-menu-overlay { position: fixed; right: 0; top: 0; width: 100%; height: 100%; background-color: #000; z-index: 998; opacity: 0; visibility: hidden; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; } .mmenu-open #mobile-menu-overlay { opacity: .15; visibility: visible; } .mmenu-open.body { right: 250px; } .mmenu-open #mobile-menu-overlay { opacity: 0.15; visibility: visible; } .mmenu-open .mobile-nav { right: 0; } .social-icons li { box-shadow: none; } .social-icons li a { background: transparent; } .mfp-bg { background-color: rgba(255, 255, 255, 0.5); } .newsletter-popup { max-width: 700px; height: 324px; background: #f1f1f1; padding: 40px 40px 25px; border-top: 4px solid #65829d; border-radius: 0; margin-right: auto; margin-left: auto; position: relative; background-repeat: no-repeat; background-position: center center; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); } .newsletter-popup-content { max-width: 300px; text-align: center; } .newsletter-popup-content .btn, .newsletter-popup-content .form-control { font-size: 13px; padding-top: 7px; padding-bottom: 7px; } .newsletter-popup-content .form-control { height: 34px; } .newsletter-popup h2 { font-weight: 700; color: #313131; font-size: 16px; line-height: 1; margin: 30px 0 12px; } .newsletter-popup p { font-size: 13px; line-height: 1.4; color: #444; } .newsletter-popup form { margin: 0 0 8px; } .newsletter-subscribe { font-size: 11px; text-align: right; } .newsletter-subscribe .checkbox { margin-top: 15px; } .newsletter-subscribe input { margin-top: 2px; } .newsletter-subscribe label { font-size: 11px; } .mfp-close-btn-in .newsletter-popup .mfp-close { color: #65829d; font-weight: 700; opacity: 0.85; top: -5px; } .banner { display: block; position: relative; margin-bottom: 15px; } .banner a { display: block; } .banner img { display: block; width: 100%; height: auto; border-radius: 0; } .banner:before { content: ""; width: 100%; height: 100%; position: absolute; right: 0; top: 0; background-color: #000; opacity: 0; visibility: hidden; -webkit-transition: all 0.2s; -moz-transition: all 0.2s; transition: all 0.2s; border-radius: 0; } .banner:hover:before { visibility: visible; opacity: 0.1; } .banners-container { margin-bottom: 25px; } @media (min-width: 768px) { .banners-container .row { margin-left: -4px; margin-right: -4px; } .banners-container .row [class*="col-"] { padding-left: 4px; padding-right: 4px; } .banners-container .banner { margin-bottom: 8px; } } .banners-container .banner-ribbon { position: absolute; left: 0; top: 0; color: #fff; width: 33.5%; height: 22.3%; } .banners-container .banner-ribbon:before { content: ""; position: absolute; left: 0; top: 0; border: 150px solid #65829d; border-left: 0; border-bottom: 0; border-right: 200px solid transparent; } @media (max-width: 991px) { .banners-container .banner-ribbon:before { border-top-width: 130px; border-right-width: 150px; } } @media (max-width: 480px) { .banners-container .banner-ribbon:before { border-top-width: 120px; border-right-width: 130px; } } .banners-container .banner-ribbon .ribbon-content { position: absolute; left: 9%; top: 10%; width: 90%; text-align: left; } .banners-container .banner-ribbon .ribbon-content span { font-size: 14px; font-weight: 300; font-style: normal; color: #fff; margin-left: 26%; text-transform: uppercase; } .banners-container .banner-ribbon .ribbon-content h3 { font-size: 33px; line-height: 1; margin: 0; font-weight: 700; color: #fff; } .banners-container .banner-ribbon .ribbon-content h4 { font-weight: 600; color: #fff; font-size: 18px; line-height: 1; margin: 3px 0 0; text-transform: uppercase; } @media (max-width: 991px) { .banners-container .banner-ribbon .ribbon-content span { font-size: 13px; } .banners-container .banner-ribbon .ribbon-content h3 { font-size: 28px; } .banners-container .banner-ribbon .ribbon-content h4 { font-size: 16px; } } @media (max-width: 480px) { .banners-container .banner-ribbon .ribbon-content span { font-size: 11px; } .banners-container .banner-ribbon .ribbon-content h3 { font-size: 24px; } .banners-container .banner-ribbon .ribbon-content h4 { font-size: 14px; } } .banners-container .banner-content { position: absolute; } .banners-container .banner-content.v1 { position: absolute; left: 15%; bottom: 14%; text-align: left; } .banners-container .banner-content.v1 h2 { font-size: 70px; line-height: 1; font-weight: 600; font-style: italic; color: #fff; margin-bottom: 0; text-transform: uppercase; } .banners-container .banner-content.v1 h2 strong { font-weight: 800; } .banners-container .banner-content.v1 p { font-size: 29px; line-height: 1; margin-bottom: 10px; margin-left: 4px; font-weight: 300; color: #fff; } .banners-container .banner-content.v1 p strong { font-weight: 600; } .banners-container .banner-content.v1 a { font-size: 16px; margin-left: 5px; color: #65829d; } .banners-container .banner-content.v2 { position: absolute; left: 10%; top: 5%; text-align: left; } .banners-container .banner-content.v2 h3 { font-weight: 400; color: #121213; font-size: 29px; line-height: 1; margin-bottom: 5px; } .banners-container .banner-content.v2 h2 { font-weight: 800; color: #121213; margin-bottom: 10px; font-size: 29px; line-height: 1; text-transform: uppercase; } .banners-container .banner-content.v2 a { font-size: 16px; color: #121213; margin: 0; } .banners-container .banner-content.v3 { position: absolute; left: 11.55%; top: 25%; text-align: left; } .banners-container .banner-content.v3 p { font-size: 16px; font-weight: 700; color: #313131; line-height: 1; margin-bottom: 5px; text-transform: uppercase; } .banners-container .banner-content.v3 p:first-child { font-weight: 300; } .banners-container .banner-content.v3 h4 { font-weight: 400; color: #888; font-size: 23px; line-height: 1; margin-top: 20px; margin-bottom: 0; } .banners-container .banner-content.v3 h3 { font-weight: 400; color: #65829d; font-size: 38px; line-height: 1; margin-bottom: 15px; } .banners-container .banner-content.v3 h3 span { font-size: 25px; line-height: 1; } .banners-container .banner-content.v3 a { font-size: 16px; margin-left: 5px; color: #65829d; } .banners-container .banner-content.v4 { position: absolute; right: 0; top: 17%; text-align: center; width: 100%; } .banners-container .banner-content.v4 h2 { font-weight: 300; color: #000; font-size: 34px; line-height: 1.2; margin: 0; margin-bottom: 15px; } .banners-container .banner-content.v4 h2 strong { font-weight: 600; } .banners-container .banner-content.v4 p { font-weight: 300; color: #000; opacity: 0.7; filter: alpha(opacity=70); font-style: italic; font-size: 20px; line-height: 1.2; margin-bottom: 17px; } .banners-container .banner-content.v4 .btn { display: inline-block; font-size: 13px; margin: 0; border: 0; padding: 6px 12px 6px 10px; } .banners-container .banner-content.v4 .btn i { margin-right: 2px; } @media (min-width: 992px) and (max-width: 1199px) { .banners-container .banner-content.v1 h2 { font-size: 55px; } .banners-container .banner-content.v1 p { font-size: 23px; margin-left: 3px; } .banners-container .banner-content.v1 a { font-size: 15px; } .banners-container .banner-content.v2 h3 { font-size: 22px; } .banners-container .banner-content.v2 h2 { font-size: 22px; } .banners-container .banner-content.v2 a { font-size: 15px; } .banners-container .banner-content.v3 p { font-size: 12px; } .banners-container .banner-content.v3 h4 { font-size: 17px; margin-top: 15px; } .banners-container .banner-content.v3 h3 { font-size: 29px; margin-bottom: 12px; } .banners-container .banner-content.v3 h3 span { font-size: 20px; } .banners-container .banner-content.v3 a { font-size: 15px; } .banners-container .banner-content.v4 h2 { font-size: 29px; margin-bottom: 12px; } .banners-container .banner-content.v4 p { font-size: 17px; margin-bottom: 11px; } .banners-container .banner-content.v4 .btn { font-size: 11px; } } @media (min-width: 768px) and (max-width: 991px) { .banners-container .banner-content.v1 h2 { font-size: 42px; } .banners-container .banner-content.v1 p { font-size: 18px; margin-bottom: 6px; margin-left: 2px; } .banners-container .banner-content.v1 a { font-size: 14px; } .banners-container .banner-content.v2 h3 { font-size: 17px; } .banners-container .banner-content.v2 h2 { font-size: 17px; } .banners-container .banner-content.v2 a { font-size: 14px; } .banners-container .banner-content.v3 p { font-size: 9px; margin-bottom: 3px; } .banners-container .banner-content.v3 h4 { font-size: 13px; margin-top: 12px; } .banners-container .banner-content.v3 h3 { font-size: 22px; margin-bottom: 9px; } .banners-container .banner-content.v3 h3 span { font-size: 15px; } .banners-container .banner-content.v3 a { font-size: 14px; margin-left: 5px; } .banners-container .banner-content.v4 h2 { font-size: 21px; margin-bottom: 9px; } .banners-container .banner-content.v4 p { font-size: 14px; margin-bottom: 7px; } .banners-container .banner-content.v4 .btn { font-size: 10px; padding: 4px 6px 6px 5px; } } @media (max-width: 480px) { .banners-container .banner-content.v1 h2 { font-size: 25px; } .banners-container .banner-content.v1 p { font-size: 17px; margin-bottom: 6px; margin-left: 3px; } .banners-container .banner-content.v1 a { font-size: 14px; } .banners-container .banner-content.v2 h3 { font-size: 28px; } .banners-container .banner-content.v2 h2 { font-size: 28px; } .banners-container .banner-content.v2 a { font-size: 14px; } .banners-container .banner-content.v3 p { font-size: 16px; margin-bottom: 5px; } .banners-container .banner-content.v3 h4 { font-size: 22px; margin-top: 15px; } .banners-container .banner-content.v3 h3 { font-size: 37px; margin-bottom: 10px; } .banners-container .banner-content.v3 h3 span { font-size: 25px; } .banners-container .banner-content.v3 a { font-size: 14px; } .banners-container .banner-content.v4 h2 { font-size: 32px; margin-bottom: 15px; } .banners-container .banner-content.v4 p { font-size: 20px; margin-bottom: 10px; } .banners-container .banner-content.v4 .btn { font-size: 14px; padding: 4px 10px 4px 8px; } } .client { display: block; margin-bottom: 15px; } .client img { width: auto !important; max-width: 100% !important; } .slider-title { position: relative; margin: 0 0 20px; font-size: 16px; line-height: 1.1; font-weight: 700; color: #313131; text-transform: uppercase; } .slider-title .inline-title { background-color: #fff; padding-left: 20px; position: relative; z-index: 2; } .slider-title .line { display: block; height: 1px; position: relative; width: calc( 100% - 50px); right: 0; bottom: 0.55em; background-image: -webkit-linear-gradient(right, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 70%, transparent 100%); background-image: linear-gradient(to left, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2) 70%, transparent 100%); z-index: 1; } .slider-title .view-all { position: absolute; left: 0; top: 50%; -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); -o-transform: translateY(-50%); transform: translateY(-50%); color: #65829d; font-size: 13px; line-height: inherit; font-weight: 400; text-transform: capitalize; } .slider-title:after { content: ''; display: table; clear: both; } .slider-title.text-center > .inline-title { padding: 0 20px; } .slider-title.text-center .line { background-image: -webkit-linear-gradient(right, transparent, rgba(0, 0, 0, 0.2), transparent); background-image: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.2), transparent); } @media (max-width: 320px) { .slider-title .line { display: none; } } .cat-box { overflow: hidden; margin-bottom: 0; } .cat-box a { display: block; } .cat-box img { display: block; width: 100%; height: auto; -webkit-transition: all 0.5s ease; -moz-transition: all 0.5s ease; transition: all 0.5s ease; } .cat-box h3 { display: inline-block; position: absolute; bottom: 13px; right: 50%; -webkit-transform: translateX(-50%); -moz-transform: translateX(-50%); -ms-transform: translateX(-50%); -o-transform: translateX(-50%); transform: translateX(-50%); background-color: rgba(23, 23, 23, 0.9); font-size: 20px; color: #fff; font-weight: 800; line-height: 37px; padding: 0 10px; text-transform: uppercase; white-space: nowrap; } .cat-box:hover img { -webkit-transform: scale(1.2); -moz-transform: scale(1.2); -ms-transform: scale(1.2); -o-transform: scale(1.2); transform: scale(1.2); } .recent-posts-carousel .row { margin-left: -10px; margin-right: -10px; } .recent-posts-carousel .row [class*="col-"] { padding-left: 10px; padding-right: 10px; } .recent-posts-carousel .post .post-image { margin-bottom: 15px; } .recent-posts-carousel .post .post-image .img-thumbnail { padding: 2px; display: block; } .recent-posts-carousel .post h2 { font-weight: 400; min-height: 55px; } .recent-posts-carousel .post .post-content { font-size: 14px; } .recent-posts-carousel .post .post-content p { margin-bottom: 10px; } .recent-posts-carousel .post .btn.btn-link { padding: 0; font-size: 16px; font-weight: 300; } .testimonial { margin-bottom: 0; } .owl-carousel .owl-nav { top: -40px; width: auto; left: 5px; margin: 0; line-height: 1; } .owl-carousel .owl-nav .owl-prev, .owl-carousel .owl-nav .owl-next { position: static; left: auto; right: auto; width: auto; height: auto; background-color: transparent !important; font-size: 18px; line-height: 1; min-width: 22px; color: #65829d !important; padding: 0; margin: 0; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; } .owl-carousel .owl-nav .owl-prev:hover, .owl-carousel .owl-nav .owl-prev:focus, .owl-carousel .owl-nav .owl-next:hover, .owl-carousel .owl-nav .owl-next:focus { background-color: transparent !important; color: #7891a9 !important; } .owl-theme .owl-dots .owl-dot span { width: 8px; height: 8px; } .tparrows.custom { background: transparent; text-shadow: 0 0 3px rgba(255, 255, 255, 0.5); } .tparrows.custom:hover { background: transparent; } .tparrows.custom:before { color: #65829d; font-size: 40px; } .page-header { border: none; padding: 6.5px 0; min-height: 0; margin-bottom: 20px; } .page-header .breadcrumb { margin: 0; } .page-header .breadcrumb > li { font-size: 13px; text-transform: capitalize; } .page-header .breadcrumb > li > a { color: #fff; } .page-header .breadcrumb > li > a:hover, .page-header .breadcrumb > li > a:ocus { color: #fff; } .page-header .breadcrumb > li.active { color: #fff; } .page-header .breadcrumb > li + li:before { content: '\f054'; font-size: 12px; opacity: 1; color: #fff; } .about-container { font-size: 14px; } .about-container p { line-height: 1.7; } .fullwidth-banner { position: relative; min-height: 150px; background-size: cover; background-position: center center; } @media (min-width: 600px) { .fullwidth-banner { min-height: 200px; } } @media (min-width: 768px) { .fullwidth-banner { min-height: 350px; } } .fullwidth-banner > div { position: absolute; z-index: 1; top: 50%; width: 100%; text-align: center; -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); -o-transform: translateY(-50%); transform: translateY(-50%); } .fullwidth-banner > div h2 { color: #fff; margin: 0; font-weight: 600; font-size: 24px; line-height: 1.1; } @media (min-width: 600px) { .fullwidth-banner > div h2 { font-size: 30px; } } @media (min-width: 768px) { .fullwidth-banner > div h2 { font-size: 45px; } } .fullwidth-banner > div h2 strong { font-weight: 800; } .fullwidth-banner > div p { font-weight: 300; font-size: 16px; display: none; margin: 0; color: #fff; } @media (min-width: 768px) { .fullwidth-banner > div p { display: block; } } .fullwidth-banner:after { content: ""; display: block; position: absolute; width: 100%; height: 100%; right: 0; top: 0; background-color: #393733; opacity: .65; filter: alpha(opacity=65); } .boxed-banner-carosel { margin-bottom: 25px; } .boxed-banner-carosel .boxed-banner { margin-bottom: 0; } .boxed-banner-carosel .owl-dots { position: absolute; right: 0; left: 0; bottom: 6px; } .boxed-banner { position: relative; margin-bottom: 25px; } .boxed-banner > img { display: block; height: auto; width: 100%; border-radius: 0; } .boxed-banner .banner-content { position: absolute; right: 5%; top: 37%; } .boxed-banner .banner-content h2 { color: #2b2b2b; margin: 0; font-weight: 400; font-size: 14px; line-height: 1.1; } @media (min-width: 600px) { .boxed-banner .banner-content h2 { font-size: 24px; } } @media (min-width: 768px) { .boxed-banner .banner-content h2 { font-size: 28px; margin-bottom: 6px; } } @media (min-width: 992px) { .boxed-banner .banner-content h2 { font-size: 35px; margin-bottom: 10px; } } .boxed-banner .banner-content p { font-weight: 400; display: none; margin: 0; color: #2b2b2b; max-width: 280px; } @media (min-width: 768px) { .boxed-banner .banner-content p { display: block; font-size: 12px; } } @media (min-width: 992px) { .boxed-banner .banner-content p { font-size: 16px; } } .boxed-banner .banner-content img { display: inline-block; max-width: 50%; width: auto; vertical-align: middle; } @media (min-width: 768px) { .boxed-banner .banner-content img { max-width: 100%; } } .boxed-banner .banner-content .shop-now { margin-right: 10px; font-size: 10px; color: #2b2b2b; vertical-align: middle; } @media (min-width: 480px) { .boxed-banner .banner-content .shop-now { font-size: 12px; } } @media (min-width: 768px) { .boxed-banner .banner-content .shop-now { margin-right: 15px; font-size: 14px; } } @media (min-width: 992px) { .boxed-banner .banner-content .shop-now { margin-right: 20px; font-size: 16px; } } .toolbar-bottom { text-align: center; margin-top: 20px; } .toolbar-bottom .toolbar { display: inline-block; } .toolbar { margin-bottom: 8px; } .toolbar .sorter:after { content: ''; display: table; clear: both; } .toolbar .sorter .sort-by { float: right; margin-left: 15px; margin-bottom: 4px; } .toolbar .sorter .sort-by a img { margin-top: -4px; } .toolbar .sorter .limiter { float: left; } .toolbar .sorter label { font-weight: 400; margin-left: 5px; color: #777; font-size: 13px; vertical-align: middle; } .toolbar .sorter select { background: #fff; border: 1px solid #ccc; padding: 2px 8px; height: 26px; color: #777; font-size: 13px; border-radius: 0; } .toolbar .sorter .view-mode { float: right; margin-left: 10px; line-height: 29px; height: 30px; } .toolbar .sorter .view-mode i { font-size: 14px; border: 1px solid #ccc; background-color: #fff; color: #ccc; width: 26px; height: 26px; line-height: 24px; display: inline-block; text-align: center; border-radius: 0; vertical-align: top; } .toolbar .sorter .view-mode span i, .toolbar .sorter .view-mode span:hover i, .toolbar .sorter .view-mode span:focus i { color: #fff; background-color: #65829d; border-color: #65829d; } .toolbar .sorter .view-mode a:hover i, .toolbar .sorter .view-mode a:focus i { color: #fff; background-color: #65829d; border-color: #65829d; } .toolbar .sorter .pagination { float: left; margin: 0 8px 5px 0; } .toolbar .sorter .pagination a, .toolbar .sorter .pagination span { border-radius: 0; min-width: 26px; padding: 3px 6px; margin-right: 5px; text-align: center; } .products-grid { list-style: none; padding: 0; margin: 0 -10px 0; } .products-grid:after { content: ''; display: table; clear: both; } .products-grid li { width: 100%; padding: 10px 10px 0; } .products-grid.columns6 { margin: 0 -5px; } .products-grid.columns6 li { padding-left: 5px; padding-right: 5px; } .products-grid.columns7 { margin: 0 -4px; } .products-grid.columns7 li { padding-left: 4px; padding-right: 4px; } .products-grid.columns8 { margin: 0 -3px; } .products-grid.columns8 li { padding-left: 3px; padding-right: 3px; } @media (min-width: 480px) { .products-grid li { float: right; width: 50%; } .products-grid li:nth-child(2n+1) { clear: right; } .products-grid.columns5 li, .products-grid.columns6 li, .products-grid.columns7 li, .products-grid.columns8 li { width: 33.33%; } .products-grid.columns5 li:nth-child(2n+1), .products-grid.columns6 li:nth-child(2n+1), .products-grid.columns7 li:nth-child(2n+1), .products-grid.columns8 li:nth-child(2n+1) { clear: none; } .products-grid.columns5 li:nth-child(3n+1), .products-grid.columns6 li:nth-child(3n+1), .products-grid.columns7 li:nth-child(3n+1), .products-grid.columns8 li:nth-child(3n+1) { clear: right; } } @media (min-width: 768px) { .products-grid.columns3 li, .products-grid.columns4 li { width: 33.33%; } .products-grid.columns3 li:nth-child(2n+1), .products-grid.columns4 li:nth-child(2n+1) { clear: none; } .products-grid.columns3 li:nth-child(3n+1), .products-grid.columns4 li:nth-child(3n+1) { clear: right; } .products-grid.columns5 li, .products-grid.columns6 li, .products-grid.columns7 li, .products-grid.columns8 li { width: 25%; } .products-grid.columns5 li:nth-child(3n+1), .products-grid.columns6 li:nth-child(3n+1), .products-grid.columns7 li:nth-child(3n+1), .products-grid.columns8 li:nth-child(3n+1) { clear: none; } .products-grid.columns5 li:nth-child(4n+1), .products-grid.columns6 li:nth-child(4n+1), .products-grid.columns7 li:nth-child(4n+1), .products-grid.columns8 li:nth-child(4n+1) { clear: right; } } @media (min-width: 992px) { .products-grid.columns6 li, .products-grid.columns7 li, .products-grid.columns8 li { width: 20%; } .products-grid.columns6 li:nth-child(4n+1), .products-grid.columns7 li:nth-child(4n+1), .products-grid.columns8 li:nth-child(4n+1) { clear: none; } .products-grid.columns6 li:nth-child(5n+1), .products-grid.columns7 li:nth-child(5n+1), .products-grid.columns8 li:nth-child(5n+1) { clear: right; } } @media (min-width: 1200px) { .products-grid.columns4 li { width: 25%; } .products-grid.columns4 li:nth-child(3n+1) { clear: none; } .products-grid.columns4 li:nth-child(4n+1) { clear: right; } .products-grid.columns5 li { width: 20%; } .products-grid.columns5 li:nth-child(4n+1) { clear: none; } .products-grid.columns5 li:nth-child(5n+1) { clear: right; } .products-grid.columns6 li { width: 16.66%; } .products-grid.columns6 li:nth-child(5n+1) { clear: none; } .products-grid.columns6 li:nth-child(6n+1) { clear: right; } .products-grid.columns7 li { width: 14.25%; } .products-grid.columns7 li:nth-child(5n+1) { clear: none; } .products-grid.columns7 li:nth-child(7n+1) { clear: right; } .products-grid.columns8 li { width: 12.5%; } .products-grid.columns8 li:nth-child(5n+1) { clear: none; } .products-grid.columns8 li:nth-child(8n+1) { clear: right; } } .products-list { list-style: none; padding: 0; margin: 0 -10px 0; } .products-list li { padding: 10px; width: 100%; } .product { position: relative; } .product .product-image-area { overflow: hidden; position: relative; padding: 0; background-color: #fff; border-radius: 0; } .product .product-image-area .product-image { display: block; overflow: hidden; position: relative; border-radius: 0; } .product .product-image-area .product-image img { display: block; width: 100%; height: auto; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; } .product .product-image-area .product-image .product-hover-image { position: absolute; right: 0; top: 0; opacity: 0; visibility: hidden; } .product .product-image-area .product-actions { position: absolute; width: 100%; bottom: 15px; right: 0; text-align: right; padding: 0 10px; visibility: hidden; opacity: 0; -webkit-transition: opacity 0.2s; -moz-transition: opacity 0.2s; transition: opacity 0.2s; } .product .product-image-area .product-actions .addtocart, .product .product-image-area .product-actions .comparelink, .product .product-image-area .product-actions .addtowishlist { opacity: 1; visibility: visible; right: auto; left: auto; width: 32px; height: 32px; line-height: 30px; font-size: 17px; background-color: #fff; -webkit-transition: all 0.2s; -moz-transition: all 0.2s; transition: all 0.2s; text-align: center; margin-top: 0; margin-bottom: 0; } .product .product-quickview { position: absolute; left: 0; top: 0; background-color: #65829d; color: #fff; padding: 10px; z-index: 9; border-radius: 0 0; opacity: 0; visibility: hidden; -webkit-transition: all 0.1s; -moz-transition: all 0.1s; transition: all 0.1s; font-size: 12px; line-height: 1.4; } .product .product-quickview span { margin-right: 2px; } .product .product-quickview:hover, .product .product-quickview:focus { opacity: 0.9 !important; color: #fff; text-decoration: none; } .product .product-quickview:hover span, .product .product-quickview:focus span { text-decoration: underline; } .product .product-label { position: absolute; left: 10px; top: 10px; color: #fff; line-height: 1; z-index: 5; text-align: center; } .product .product-label + .product-label { top: 40px; } .product .product-label span { display: block; position: relative; padding: 7px 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; border-radius: 0; } .product .product-label span.discount { background-color: #e27c7c; } .product .product-label span.new { background-color: #62b959; } .product .product-details-area { padding: 10px; text-align: center; } .product .product-details-area .product-actions { margin: 0 -10px; } .product .product-name { color: #777; font-weight: 400; font-size: 14px; margin: 0 0 3px; } .product .product-name a { color: #777; } .product .product-name a:hover, .product .product-name a:focus { color: #65829d; text-decoration: none; } .product:hover .product-image-area .product-actions { visibility: visible; opacity: 1; } .product:hover .product-image-area .product-actions .addtocart { color: #65829d; background-color: #fff; border: 1px solid #65829d; } .product:hover .product-image-area .product-actions .addtocart:hover, .product:hover .product-image-area .product-actions .addtocart:focus { color: #fff; border-color: #65829d; background-color: #65829d; } .product:hover .product-image-area .product-image .product-hover-image { visibility: visible; opacity: 1; } .product:hover .product-quickview { visibility: visible; opacity: 1; } .product-ratings { font-size: 11px; line-height: 1.25; background: url(../../img/demos/shop/rating-bar.png) center no-repeat; height: 14px; margin: 7px 0 6px; } .product-ratings .ratings-box { position: relative; display: inline-block; margin-top: 1.5px; overflow: hidden; width: 64px; height: 11px; font-size: 0; line-height: 0; text-indent: -999em; } .product-ratings .ratings-box:before { font-family: "FontAwesome"; content: "\f005\20\f005\20\f005\20\f005\20\f005"; width: 64px; height: 11px; color: #c3c5c9; display: block; font-size: 11px; line-height: 11px; } .product-ratings .ratings-box .rating { float: right; height: 11px; position: absolute; right: 0; top: 0; overflow: hidden; } .product-ratings .ratings-box .rating:before { font-family: "FontAwesome"; content: "\f005\20\f005\20\f005\20\f005\20\f005"; width: 64px; height: 11px; color: #ffc600; display: block; font-size: 11px; line-height: 11px; } .product-price-box { font-size: 0; margin: 5px 0 3px; } .product-price-box .old-price, .product-price-box .product-price { display: inline-block; vertical-align: middle; font-weight: 600; } .product-price-box .old-price { color: #999; font-size: 14px; text-decoration: line-through; } .product-price-box .old-price + .product-price { margin-right: 6px; } .product-price-box .product-price { font-size: 20px; color: #444; } .product-actions a { display: inline-block; position: relative; margin: 10px 1px; vertical-align: middle; border-radius: 0; text-align: center; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; } .product-actions a:hover, .product-actions a:focus { text-decoration: none; } .product-actions a.addtocart { color: #333; background-color: #fff; font-size: 14px; padding: 0 8px 0 10px; height: 32px; line-height: 30px; border: 1px solid #ccc; } .product-actions a.addtocart i { font-size: 15px; margin-left: 2px; } .product:hover .product-actions a.addtocart { background-color: #65829d; border-color: #65829d; color: #fff; } .product-actions a.addtocart.outofstock { padding: 0 10px; cursor: default; } .product:hover .product-actions a.addtocart.outofstock { color: #333 !important; background-color: #fff !important; border-color: #ccc !important; } .product-actions a.addtowishlist, .product-actions a.comparelink, .product-actions a.quickview { font-size: 17px; height: 32px; width: 32px; line-height: 32px; background-color: transparent; visibility: hidden; opacity: 0; } .hide-addtolinks .product-actions a.addtowishlist, .hide-addtolinks .product-actions a.comparelink, .hide-addtolinks .product-actions a.quickview { display: none; } .product-actions a.addtowishlist { left: -37px; color: #ed4949; border: 1px solid #ed4949; } .product-actions a.addtowishlist:hover { color: #fff; background-color: #ed4949; } .product:hover .product-actions a.addtowishlist { visibility: visible; opacity: 1; left: 0; } .product-actions a.comparelink { right: -37px; color: #52b9b5; border: 1px solid #52b9b5; } .product-actions a.comparelink:hover { color: #fff; background-color: #52b9b5; } .product:hover .product-actions a.comparelink { visibility: visible; opacity: 1; right: 0; } .product-actions a.quickview { visibility: visible; opacity: 1; color: #65829d; border: 1px solid #65829d; } .product-actions a.quickview:hover { color: #fff; background-color: #65829d; } .product.product-list:after { content: ''; display: table; clear: both; } .product.product-list .product-details-area { text-align: right; padding: 0 20px; } .product.product-list .product-short-desc { font-size: 14px; line-height: 1.5; } .product.product-list .product-ratings { background: none; margin-bottom: 10px; } .product.product-list .product-name { font-size: 18px; margin: 10px 0; } .product.product-list .product-price-box { margin-top: 10px; } .product.product-list .product-actions { margin: 0; } .product.product-list .product-actions a.addtowishlist, .product.product-list .product-actions a.comparelink, .product.product-list .product-actions a.quickview { left: auto; right: auto; visibility: visible; opacity: 1; } .product.product-list .product-actions a.addtocart { background-color: #65829d; border-color: #65829d; color: #fff; } @media (min-width: 600px) { .product.product-list .product-image-area { float: right; width: 20%; } .product.product-list .product-details-area { float: right; width: 80%; } } .product.product-sm { padding: 6px 0 8px; max-width: 300px; } .product.product-sm:after { content: ''; display: table; clear: both; } .product.product-sm .product-image-area { width: 33%; float: right; padding: 0; } .product.product-sm .product-details-area { float: right; width: 67%; text-align: right; padding: 10px 16px; } .product.product-sm .product-name { font-size: 12px; } .product.product-sm .product-ratings { background: none; margin-bottom: 5px; } .product.product-sm .product-price-box { margin: 2px 0 3px; } .product.product-sm .product-price-box .old-price { font-size: 11px; } .product.product-sm .product-price-box .old-price + .product-price { margin-right: 3px; } .product.product-sm .product-price-box .product-price { font-size: 15px; } .sidebar.shop-sidebar .panel-group { margin-bottom: 40px; } .sidebar.shop-sidebar .panel-group .panel + .panel { margin-top: 14px; } .sidebar.shop-sidebar .panel.panel-default { border-radius: 0; border: none; } .sidebar.shop-sidebar .panel.panel-default .panel-heading { border-radius: 0; } .sidebar.shop-sidebar .panel.panel-default .panel-heading .panel-title { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; color: #777; } .sidebar.shop-sidebar .panel.panel-default .panel-heading a { position: relative; border-radius: 0 0 0 0; padding-top: 11.5px; padding-bottom: 11.5px; padding-left: 45px; color: #777; border: 1px solid #ddd; } .sidebar.shop-sidebar .panel.panel-default .panel-heading a:before { font-family: 'FontAwesome'; content: "\f0d8"; width: 26px; height: 26px; display: block; border: 1px solid #ddd; position: absolute; left: 15px; top: 50%; margin-top: -13px; border-radius: 0; color: #ccc; text-align: center; line-height: 24px; background-color: #fff; font-size: 10px; } .sidebar.shop-sidebar .panel.panel-default .panel-heading a:hover:before { background-color: #65829d; border-color: #65829d; color: #fff; } .sidebar.shop-sidebar .panel.panel-default .panel-heading a.collapsed { border-radius: 0; } .sidebar.shop-sidebar .panel.panel-default .panel-heading a.collapsed:before { content: "\f0d7"; } .sidebar.shop-sidebar .panel.panel-default .panel-body { padding: 15px 15px 7px; border: 1px solid #ddd; border-top: none; border-radius: 0 0 0 0; background-color: #fbfbfb; } .sidebar.shop-sidebar .filter-price { margin: 14px 0 9px; } .sidebar.shop-sidebar .filter-price #price-slider { margin-bottom: 20px; } .sidebar.shop-sidebar .filter-price .noUi-target { background: #eee; border-radius: 0; border: none; box-shadow: none; } .sidebar.shop-sidebar .filter-price .noUi-handle { background: #65829d; cursor: pointer; border-radius: 0; border: none; box-shadow: none; } .sidebar.shop-sidebar .filter-price .noUi-handle:before, .sidebar.shop-sidebar .filter-price .noUi-handle:after { display: none; } .sidebar.shop-sidebar .filter-price .noUi-horizontal { position: relative; height: 7px; } .sidebar.shop-sidebar .filter-price .noUi-horizontal .noUi-handle { position: absolute; width: 13px; height: 18px; border: 0; right: -6.5px; top: -6px; } .sidebar.shop-sidebar .filter-price .noUi-horizontal .noUi-base .noUi-origin { position: absolute; } .sidebar.shop-sidebar .filter-price .noUi-connect { background-color: #94a8bb; box-shadow: inset 0 0 3px rgba(51, 51, 51, 0.45); } .sidebar.shop-sidebar .filter-price .filter-price-details { text-align: center; } .sidebar.shop-sidebar .filter-price .filter-price-details * { white-space: normal; } .sidebar.shop-sidebar .filter-price .filter-price-details span { vertical-align: middle; line-height: 26px; } .sidebar.shop-sidebar .filter-price .filter-price-details .form-control { display: inline-block; vertical-align: middle; color: #a3a2a2; padding: 2px 5px; font-size: 14px; margin: 0 2px; width: 50px; height: 26px; } .sidebar.shop-sidebar .filter-price .filter-price-details .btn { border: none; height: 26px; line-height: 26px; color: #fff; border-radius: 0; padding: 0 10px; font-size: 14px; margin: 5px 0; } .sidebar.shop-sidebar ul, .sidebar.shop-sidebar ol { padding: 0; margin: -7px 0 0; list-style: none; } .sidebar.shop-sidebar ul li a, .sidebar.shop-sidebar ol li a { color: #777; line-height: 2.5; } .sidebar.shop-sidebar .configurable-filter-list { padding: 0; margin: 0 -5px; list-style: none; font-size: 0; } .sidebar.shop-sidebar .configurable-filter-list li { display: inline-block; margin: 0 5px 8px; } .sidebar.shop-sidebar .configurable-filter-list li a { display: block; color: #777; width: 30px; height: 30px; font-size: 14px; line-height: 28px; background: #f4f4f4; border: 1px solid #cccccc; border-radius: 0; float: right; margin: 0; padding: 0; text-align: center; } .sidebar.shop-sidebar .configurable-filter-list li a:hover { border-color: #65829d; text-decoration: none; } .sidebar.shop-sidebar .configurable-filter-list.filter-list-color li a { padding: 1px; } .sidebar.shop-sidebar .configurable-filter-list.filter-list-color li a span { display: inline-block; width: 26px; height: 26px; border-radius: 0; } .sidebar.shop-sidebar h4 { margin-bottom: 10px; text-transform: uppercase; } .sidebar.shop-sidebar .owl-carousel .owl-nav { top: -28px; width: auto; left: 5px; margin: 0; line-height: 1; } .sidebar.shop-sidebar .owl-carousel .owl-nav .owl-prev, .sidebar.shop-sidebar .owl-carousel .owl-nav .owl-next { font-size: 16px; line-height: 1; min-width: 18px; } .product-essential { margin-bottom: 50px; } @media (max-width: 767px) { .product-img-box { margin-bottom: 25px; } } .product-img-box img { display: block; width: 100%; height: auto; } .product-img-box .product-img-wrapper { padding: 0; border-radius: 0; } .product-img-box .owl-carousel { margin-bottom: 0; } .zoomContainer { z-index: 49; } .product-img-box-wrapper { position: relative; margin-bottom: 10px; } .product-img-box-wrapper .product-img-zoom { position: absolute; left: 11px; bottom: 7px; z-index: 50; } .product-details-box .product-nav-container { float: left; } @media (max-width: 767px) { .product-details-box .product-nav-container { margin-top: -15px; } } .product-details-box .product-nav-container .product-nav { display: inline-block; vertical-align: middle; position: relative; font-size: 0; } .product-details-box .product-nav-container .product-nav a { color: #555; display: inline-block; font-size: 22px; line-height: 58px; text-decoration: none; min-width: 31px; text-align: center; } .product-details-box .product-nav-container .product-nav a:hover, .product-details-box .product-nav-container .product-nav a:focus { text-decoration: none; } .product-details-box .product-nav-container .product-nav .product-nav-dropdown { border-top: 3px solid #65829d; position: absolute; top: 100%; right: auto; left: 0; margin-left: -17.5px; padding: 10px; background-color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); z-index: 1; visibility: hidden; opacity: 0; -webkit-transition: all 0.2s; -moz-transition: all 0.2s; transition: all 0.2s; text-align: center; border-radius: 0; } .product-details-box .product-nav-container .product-nav .product-nav-dropdown:before { content: ""; width: 5px; height: 2px; border: 5px solid transparent; border-bottom-color: #65829d; display: block; position: absolute; top: -13px; left: 32px; } .product-details-box .product-nav-container .product-nav .product-nav-dropdown img { display: block; width: 80px; height: auto; margin-bottom: 10px; } .product-details-box .product-nav-container .product-nav .product-nav-dropdown h4 { margin: 0; font-weight: 600; font-size: 11px; line-height: 1.35; color: #777; } .product-details-box .product-nav-container .product-nav.product-nav-prev .product-nav-dropdown { left: auto; right: 0; margin-right: -17.5px; margin-left: 0; } .product-details-box .product-nav-container .product-nav.product-nav-prev .product-nav-dropdown:before { left: auto; right: 32px; } .product-details-box .product-nav-container .product-nav:hover > .product-nav-dropdown { visibility: visible; opacity: 1; } .product-details-box .product-nav-container .product-nav:hover > a { color: #65829d; text-decoration: none; } .product-details-box .product-name { margin: 15px 0; font-size: 28px; font-weight: 600; line-height: 1; color: #555; } .product-details-box .product-rating-container { margin-bottom: 20px; } .product-details-box .product-rating-container .product-ratings { vertical-align: middle; display: inline-block; background: none; margin: 0 0 0 2px; font-size: 16px; height: 20px; } .product-details-box .product-rating-container .product-ratings .ratings-box { margin-top: 1.5px; width: 100px; height: 16px; } .product-details-box .product-rating-container .product-ratings .ratings-box:before { width: 100px; height: 16px; font-size: 16px; line-height: 16px; } .product-details-box .product-rating-container .product-ratings .ratings-box .rating { height: 16px; } .product-details-box .product-rating-container .product-ratings .ratings-box .rating:before { width: 100px; height: 16px; font-size: 16px; line-height: 16px; } .product-details-box .product-rating-container .review-link { vertical-align: middle; display: inline-block; font-size: 14px; color: #bdbdbd; } .product-details-box .product-rating-container .review-link a { color: #bdbdbd; display: inline-block; vertical-align: bottom; padding: 0 5px; } .product-details-box .product-rating-container .review-link a:hover, .product-details-box .product-rating-container .review-link a:focus { text-decoration: none; color: #65829d; } .product-details-box .product-short-desc { padding: 0 0 10px; border-bottom: 1px solid #ebebeb; } .product-details-box .product-short-desc p { font-size: 14px; line-height: 1.65; margin: 0 0 20px; } .product-details-box .product-detail-info { padding-bottom: 20px; margin-top: 20px; border-bottom: 1px solid #ebebeb; } .product-details-box .product-detail-info .product-price-box { margin: 0 0 20px; } .product-details-box .product-detail-info .product-price-box .old-price { vertical-align: bottom; font-size: 18px; line-height: 1.2; font-weight: 400; color: #999; } .product-details-box .product-detail-info .product-price-box .product-price { font-size: 33px; line-height: 1; color: #65829d; } .product-details-box .product-detail-info .availability { margin: 0 0 10px; font-size: 14px; color: #777; font-weight: 400; } .product-details-box .product-detail-info .email-to-friend { margin-bottom: 0; } .product-details-box .product-detail-info .email-to-friend a { color: #65829d; } .product-details-box .product-detail-options { margin: 20px 0 0; position: relative; padding-bottom: 0; border-bottom: 1px solid #ebebeb; } .product-details-box .product-detail-options label { font-size: 12px; font-weight: 700; line-height: 1; margin: 0 0 10px; } .product-details-box .product-detail-options label span:last-child { margin-right: 5px; font-weight: 400; } .product-details-box .product-detail-options .configurable-filter-list { padding: 0; margin: 0 0 20px; list-style: none; font-size: 0; } .product-details-box .product-detail-options .configurable-filter-list li { display: inline-block; margin: 0 0 5px 3px; } .product-details-box .product-detail-options .configurable-filter-list li a { display: block; color: #777; width: 30px; height: 30px; font-size: 14px; line-height: 28px; background: #f4f4f4; border: 1px solid #cccccc; border-radius: 0; float: right; margin: 0; padding: 0; text-align: center; } .product-details-box .product-detail-options .configurable-filter-list li a:hover { border-color: #65829d; text-decoration: none; } .product-details-box .product-detail-options .configurable-filter-list.filter-list-color li a { padding: 1px; } .product-details-box .product-detail-options .configurable-filter-list.filter-list-color li a span { display: inline-block; width: 26px; height: 26px; border-radius: 0; } .product-details-box .product-detail-qty { display: inline-block; vertical-align: middle; margin-left: 7px; width: 60px; } .product-details-box .product-detail-qty #product-vqty { border-radius: 0; width: 35px !important; border-color: #e1e1e1; color: #65829d; padding-left: 2px; padding-right: 2px; text-align: center; } .product-details-box .product-detail-qty .btn { border-radius: 0; } .product-details-box .product-detail-qty .btn.btn-default { color: #ccc; font-size: 8px; border-color: #e1e1e1; } .product-details-box .product-detail-qty .btn.btn-default.bootstrap-touchspin-up { margin-top: -2px; } .product-details-box .product-detail-qty .btn.btn-default.bootstrap-touchspin-down { margin-bottom: -2px; } .product-details-box .product-actions { margin-top: 10px; padding-bottom: 10px; margin-bottom: 20px; border-bottom: 1px solid #ebebeb; } .product-details-box .product-actions:after { content: ''; display: table; clear: both; } .product-details-box .product-actions .addtocart { color: #fff; border-color: #65829d; background-color: #65829d; line-height: 36px; height: 38px; min-width: 160px; text-align: center; } .product-details-box .product-actions .addtocart:hover, .product-details-box .product-actions .addtocart:focus { color: #fff; border-color: #7891a9; background-color: #7891a9; } .product-details-box .product-actions .actions-right { float: left; } @media (max-width: 480px) { .product-details-box .product-actions .actions-right { float: none; margin-top: -5px; } } .product-details-box .product-actions .actions-right .addtowishlist, .product-details-box .product-actions .actions-right .comparelink { opacity: 1; visibility: visible; left: auto; right: auto; width: 38px; height: 38px; line-height: 38px; font-size: 17px; } .product-details-box .product-actions .actions-right .addtowishlist + .comparelink { margin-right: 5px; } @media (min-width: 768px) { .product-details-box .product-share-box { padding-bottom: 20px; } } .bootstrap-touchspin .input-group-btn-vertical { position: relative; white-space: nowrap; width: 1%; vertical-align: middle; display: table-cell; } .bootstrap-touchspin .input-group-btn-vertical > .btn { display: block; float: none; width: 100%; max-width: 100%; padding: 9px 10px; margin-right: -1px; position: relative; } .bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-up { border-radius: 0; } .bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-down { margin-top: -2px; border-radius: 0; } .bootstrap-touchspin .input-group-btn-vertical i { position: absolute; top: 5px; right: 6px; font-size: 9px; font-weight: normal; } .sidebar .feature-box h4 { color: #313131; font-size: 16px; margin: 0; line-height: 1.5; padding-top: 6px; font-weight: 600; } .sidebar .feature-box .feature-box-info { padding-right: 60px; font-size: 12px; } .sidebar .feature-box.feature-box-style-3 { min-height: 50px; margin-bottom: 20px; } .sidebar .feature-box.feature-box-style-3 .feature-box-icon { font-size: 30px; color: #000; float: right; width: 50px; height: 50px; line-height: 48px; border: 1px solid #bbb; border-radius: 50%; text-align: center; } .sidebar .feature-box.feature-box-style-3 .feature-box-icon i.fa { color: #000; } .sidebar.product-sidebar .product.product-sm .product-image-area { width: 44%; } .sidebar.product-sidebar .product.product-sm .product-details-area { width: 56%; } .sidebar.product-sidebar .product.product-sm .product-name { font-size: 13px; margin-bottom: 10px; } .sidebar.product-sidebar .product.product-sm .product-price-box .product-price { font-size: 20px; } .sidebar.product-sidebar .owl-carousel .owl-nav { top: -68px; } .tabs.product-tabs { margin-bottom: 40px; } @media (min-width: 992px) { .tabs.product-tabs { margin-bottom: 50px; } } @media (max-width: 600px) { .tabs.product-tabs .nav-tabs li { display: block; } } .tabs.product-tabs .tab-content { padding: 37px 15px; min-height: 200px; border-radius: 0 0 0 0; box-shadow: 0 1px 2px #eee; background-color: #fff; } .tabs.product-tabs .tab-content p { margin-bottom: 15px; } @media (max-width: 767px) { .tabs.product-tabs.tabs-left .nav-tabs { display: block; width: 100%; height: auto; } } @media (max-width: 767px) { .tabs.product-tabs.tabs-left li { display: block; } } .tabs.product-tabs.tabs-left li a { border-radius: 0 0 0 0; border-top: 1px solid #eee !important; border-bottom: 1px solid #eee !important; } @media (min-width: 768px) { .tabs.product-tabs.tabs-left li a { border-left: none; margin-left: -1px; text-align: left; } } @media (max-width: 767px) { .tabs.product-tabs.tabs-left li a { margin-left: 0; margin-right: 0; border-left: 1px solid #eee !important; } } @media (min-width: 768px) { .tabs.product-tabs.tabs-left li + li { margin-top: 2px; } } .tabs.product-tabs.tabs-left .tab-content { border-right: 1px solid #eee; padding: 37px 15px 27px; } @media (min-width: 768px) { .tabs.product-tabs.tabs-left .tab-content { min-height: 250px; } } @media (max-width: 767px) { .tabs.product-tabs.tabs-left .tab-content { display: block; width: 100%; height: auto; padding-top: 25px; padding-bottom: 15px; } } .product-table, .ratings-table { width: 100%; border-spacing: 0; empty-cells: show; font-size: 100%; } .product-table thead th, .product-table tbody td, .ratings-table thead th, .ratings-table tbody td { border-bottom: 1px solid #dcdcdc; border-left: 1px solid #dcdcdc; padding: 15px 10px; line-height: 1.3; } @media (max-width: 600px) { .product-table thead th, .product-table tbody td, .ratings-table thead th, .ratings-table tbody td { padding-left: 5px; padding-right: 5px; } } .product-table { border: 1px solid #ddd; } .product-table .table-label { font-weight: 700; color: #000; } .ratings-table { margin: 20px 0 40px; border: 1px solid #ddd; } @media (max-width: 767px) { .ratings-table { margin-bottom: 30px; } } .ratings-table input[type=checkbox], .ratings-table input[type=radio] { margin-left: auto; margin-right: auto; } @media (max-width: 600px) { .ratings-table thead { display: none; } } .ratings-table thead th { font-weight: 600; font-size: 11px; padding: 3px 15px; color: #777; white-space: nowrap; vertical-align: middle; text-transform: uppercase; background-color: #f6f6f6; text-align: center; } .ratings-table tbody td { font-size: 13px; text-align: center; } .ratings-table tbody td:first-child { font-weight: 700; text-align: right; } .product-desc-area ul { padding-right: 15px; margin-right: 2px; } .product-desc-area ul li { line-height: 20px; } .product-desc-area p { margin-bottom: 15px; } .product-tags-area label { display: block; font-size: 18px; margin: 0 0 20px; font-weight: 400; } .product-tags-area .form-control.pull-left { width: 250px; margin-left: 10px; } .collateral-box ul, .collateral-box ol { margin-top: -20px; } .collateral-box ul li, .collateral-box ol li { border-bottom: 1px solid #eee; padding: 20px 0 10px; } .add-product-review { padding-top: 15px; } .panel-group.produt-panel { margin-bottom: 55px; border: none; } @media (min-width: 992px) { .panel-group.produt-panel { margin-bottom: 65px; } } .panel-group.produt-panel .panel.panel-default { border: none; } .panel-group.produt-panel .panel.panel-default .panel-heading { background-color: transparent; } .panel-group.produt-panel .panel.panel-default .panel-heading .panel-title { font-size: 15px; } .panel-group.produt-panel .panel.panel-default .panel-heading .panel-title a { position: relative; border-radius: 0; background-color: #f4f4f4; border-right: 4px solid #65829d; } .panel-group.produt-panel .panel.panel-default .panel-heading .panel-title a:before { content: "\f0d7"; color: #fff; font-family: "FontAwesome"; display: block; position: absolute; left: 20px; top: 50%; margin-top: -10px; } .panel-group.produt-panel .panel.panel-default .panel-heading .panel-title a.collapsed:before { content: "\f0da"; color: #65829d; } .panel-group.produt-panel .panel.panel-default .panel-heading .panel-title a:not(.collapsed) { color: #fff; background-color: #65829d; } @media (max-width: 480px) { .cart h1 span { display: block; margin-bottom: 10px; } .cart h1 .pull-right { float: none !important; } } .btn.btn-default.hover-primary:hover, .btn.btn-default.hover-primary:focus { color: #fff; background-color: #65829d; border-color: #65829d; } .btn-remove { display: inline-block; width: 34px; height: 34px; font-size: 18px; line-height: 22px; overflow: hidden; padding: 5px 0; color: #65829d; } .btn-remove:hover, .btn-remove:focus { color: #7891a9; text-decoration: none; } .qty-holder { display: inline-block; width: 125px; white-space: nowrap; vertical-align: middle; font-size: 0; } .qty-dec-btn, .qty-inc-btn { display: inline-block; width: 30px; height: 30px; background: #f4f4f4; border: 1px solid #ccc; color: #777; line-height: 30px; border-radius: 0; margin: 0; font-size: 14px; font-weight: 700; text-decoration: none; text-align: center; vertical-align: middle; } .qty-dec-btn:hover, .qty-dec-btn:focus, .qty-inc-btn:hover, .qty-inc-btn:focus { color: #65829d; background: #f4f4f4; text-decoration: none; } .qty-input { display: inline-block; vertical-align: middle; width: 35px !important; font-size: 14px; text-align: center; color: #777; height: 30px; border-radius: 0; border: 1px solid #ccc; margin: 0 -1px; outline: none; } .edit-qty { display: inline-block; font-size: 14px; margin-right: 8px; color: #65829d; vertical-align: middle; } .edit-qty:hover, .edit-qty:focus { color: #7891a9; text-decoration: none; } .cart-table-wrap { border: 1px solid #ececec; border-radius: 0; background: #fff; display: block; padding: 30px; margin-bottom: 50px; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.08); } @media (min-width: 992px) { .cart-table-wrap { margin-bottom: 60px; } } .cart-table { width: 100%; border: 0; border-spacing: 0; font-size: 14px; } .cart-table thead tr { border-bottom: 1px solid #dcdcdc; } .cart-table thead tr th { font-weight: 600; padding: 15px 10px; color: #777; white-space: nowrap; vertical-align: middle; line-height: 1; } .cart-table tbody tr td { border-bottom: 1px solid #dcdcdc; padding: 15px 10px; line-height: 1.3; } .cart-table tbody tr td.product-action-td { padding-left: 0; padding-right: 0; } .cart-table tbody tr td.product-image-td a { display: block; } .cart-table tbody tr td.product-image-td a img { display: block; width: 100px; height: auto; } .cart-table tbody tr td.product-name-td h2 { font-size: 14px; font-weight: 400; margin-bottom: 0; } .cart-table tbody tr td.product-name-td h2 a { color: #65829d; } .cart-table tbody tr td.product-name-td h2 a:hover, .cart-table tbody tr td.product-name-td h2 a:focus { color: #65829d; } .cart-table tfoot td { padding: 15px 5px 0; } .cart-table tfoot .btn.btn-default.btn-continue { float: right; } .cart-table tfoot .btn.btn-default.btn-update { float: left; margin-right: 10px; } .cart-table tfoot .btn.btn-default.btn-clear { float: left; } @media (max-width: 1199px) { .cart-table thead { display: none; } .cart-table tbody tr { position: relative; display: block; border-bottom: 1px solid #dcdcdc; padding: 25px 0; } .cart-table tbody tr td { display: block; padding: 0 0 15px; width: 100%; border-width: 0; text-align: center !important; } .cart-table tbody tr td:last-child { padding-bottom: 0; } .cart-table tbody tr td .qty-holder { width: 90px; } .cart-table tbody tr td.product-action-td { position: absolute; top: 20px; z-index: 1; } .cart-table tbody tr td.product-action-td .btn-remove { float: left; } .cart-table tbody tr td.product-image-td { padding-bottom: 15px; } .cart-table tbody tr td.product-image-td a img { margin: 0 auto; } .cart-table tbody tr:first-child { padding-top: 0; } .cart-table tbody tr:first-child td.product-action-td { top: -5px; } .cart-table tfoot td { padding-top: 25px; } .cart-table tfoot .btn.btn-default.btn-continue, .cart-table tfoot .btn.btn-default.btn-update, .cart-table tfoot .btn.btn-default.btn-clear { float: none; display: block; width: 100%; margin: 0 0 10px; } } .cart .sidebar.shop-sidebar .panel.panel-default .panel-heading a { color: #000; } .cart .sidebar.shop-sidebar .panel.panel-default .panel-body { padding: 15px; } .cart .sidebar.shop-sidebar .form-control { font-size: 13px; } .cart .sidebar.shop-sidebar .panel p { font-size: 14px; } .cart .sidebar.shop-sidebar .panel .btn-block + .btn-block { margin-top: 0; } .cart .sidebar.shop-sidebar .panel .btn-link { font-size: 13px; } .totals-table { width: 100%; margin-bottom: 5px; } .totals-table tbody tr { border-bottom: 1px solid #dcdcdc; } .totals-table tbody tr:last-child { border-bottom: none; } .totals-table tbody tr td { padding: 10px; line-height: 1.4; font-size: 15px; font-weight: 300; text-align: right !important; } .totals-table tbody tr td:last-child { color: #000; text-align: left !important; font-weight: 600; } .totals-table tbody tr:last-child td:last-child { font-size: 17px; } .crosssell-products { margin-bottom: 25px; } .crosssell-products .product.product-sm .product-details-area { padding-top: 4px; padding-bottom: 0; } .crosssell-products .product.product-sm .product-name { font-size: 13px; margin-bottom: 2px; } .crosssell-products .product.product-sm .product-price-box { margin-top: 0; margin-bottom: 4px; } .crosssell-products .product.product-sm .product-price-box .old-price { font-size: 14px; } .crosssell-products .product.product-sm .product-price-box .product-price { font-size: 20px; } .crosssell-products .product.product-sm .btn { font-size: 12px; padding-top: 0; padding-bottom: 0; line-height: 25px; } .checkout-menu { margin-bottom: 10px; } .checkout-menu .btn { font-size: 13px; padding: 9px 19px; } .checkout-menu .btn i { margin-left: 4px; } .checkout-review-dropdown .dropdown-menu { position: absolute; left: 0; top: 40px; width: 300px; background-color: #fff; border-width: 6px 0 0 0; border-style: solid; border-color: #65829d; z-index: 1; border-radius: 0 0 0 0; color: #777; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5); margin-top: 10px; padding: 30px 10px 30px 15px; } @media (max-width: 320px) { .checkout-review-dropdown .dropdown-menu { width: 260px; } } .checkout-review-dropdown .dropdown-menu h3 { font-weight: 600; color: #404040; font-size: 16px; border-bottom: 1px solid #b6b6b6; line-height: 1; padding-bottom: 13px; padding-right: 9px; margin-bottom: 20px; } .checkout-review-dropdown .dropdown-menu table { width: 100%; border: 0; border-spacing: 0; } .checkout-review-dropdown .dropdown-menu table td:last-child, .checkout-review-dropdown .dropdown-menu table th:last-child { padding-left: 0; } .checkout-review-dropdown .dropdown-menu table td { border-bottom: 1px solid #eaeaea; color: #676767; font-size: 14px; font-weight: 400; vertical-align: middle; } .checkout-review-dropdown .dropdown-menu table thead th { font-weight: 400; color: #1c1c1c; font-size: 15px; line-height: 1; padding: 0 15px 7px; border-bottom: 1px solid #eaeaea; } .checkout-review-dropdown .dropdown-menu table tbody td { padding: 14px; line-height: 1.4; } .checkout-review-dropdown .dropdown-menu table tfoot td { padding: 10px 0; line-height: 1; } .form-col { color: #393939; margin-bottom: 30px; } .form-col h3 { font-weight: 600; color: #404040; font-size: 16px; text-align: right; border-bottom: 1px solid #b6b6b6; padding-bottom: 8px; line-height: 1; margin-bottom: 20px; text-transform: none; } .form-col h3.no-border { border-bottom: none; margin-bottom: 0; padding-bottom: 0; } .form-col label { display: block; color: #393939; font-weight: normal; font-size: 14px; line-height: 1.25; margin-bottom: 2px; } @media (max-width: 767px) { .form-col .row { margin-left: -7.5px; margin-right: -7.5px; } .form-col .row [class*="col-"] { padding-left: 7.5px; padding-right: 7.5px; } } .form-col .form-group { margin-bottom: 10px; } @media (min-width: 992px) { .form-col .form-group.margin-left { margin-right: 4%; } .form-col .form-group.margin-left .form-control { width: 182px; } } .form-col .form-group.wide .form-control { display: block; width: 100%; } .form-col .form-group.wide .form-control.pull-left { width: auto; } .form-col .form-group .form-control { margin-bottom: 0; font-size: 13px; } @media (min-width: 992px) { .form-col .form-group .form-control { display: inline-block; width: auto; width: 100%; } } .form-col .form-group .checkbox label { font-size: 13px; } .form-col .ship-list { padding-right: 0; list-style: none; margin-top: 10px; margin-bottom: 30px; font-size: 14px; } .form-col .ship-list li { margin-bottom: 5px; } .form-col .ship-list li:nth-child(2n) { padding-right: 5px; } .form-col .expand-plus { display: inline-block; width: 16px; height: 16px; border-radius: 0; background-color: #65829d; color: #fff; text-align: center; font-size: 16px; line-height: 14px; vertical-align: middle; margin-right: 16px; text-decoration: none; } .form-col .expand-plus:before { content: '-'; } .form-col .expand-plus.collapsed:before { content: '+'; } .form-col .expand-plus:hover, .form-col .expand-plus:focus { text-decoration: none; } .form-col #discountArea { margin-top: 10px; padding-top: 10px; border-top: 1px solid #b6b6b6; } .form-col #discountArea.collapsing { -webkit-transition: all 0s; -moz-transition: all 0s; transition: all 0s; } .form-col .checkout-payment-method .radio { margin-bottom: 14px; } .form-col #payment-credit-card-area { display: none; } .form-col #payment-credit-card-area.show { display: block; } .form-col .checkout-review-action { border-top: 1px solid #b6b6b6; } .form-col .checkout-review-action h5 { color: #3f3f3f; font-size: 16px; font-weight: bold; margin-top: 30px; margin-bottom: 10px; } .form-col .checkout-review-action h5 span { margin-right: 45px; } .modal-open, body, .modal { padding-left: 0 !important; } .modal-backdrop { background-color: rgba(255, 255, 255, 0.5); } .modal-backdrop.in { opacity: 1; } .modal { -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; } .modal label { margin-bottom: 2px; } .modal .modal-header { padding: 20px; border-bottom: none; } .modal .modal-header h4 { color: #4a4a4a; font-weight: 600; font-size: 16px; margin: 0; } .modal .modal-header .close { font-size: 14px; opacity: 0.95; margin-top: -8px; margin-left: -8px; } .modal .modal-content { border: none; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5); } .modal .modal-body { padding: 0 20px 20px; } .modal .modal-body p { font-size: 14px; color: #393939; margin: 0 0 10px; } .modal .modal-footer { border-top: 1px solid #e5e5e5; padding: 19px 20px 20px; margin-top: 15px; vertical-align: middle; } .modal .modal-footer .btn { font-size: 13px; padding-top: 9px; padding-bottom: 9px; } .modal .modal-footer .btn.btn-link { font-size: 12px; padding: 9.5px 0; } .modal .modal-footer:after { content: ''; display: table; clear: both; } .alert.success-msg { font-size: 14px; } .panel-box { margin-bottom: 30px; } .panel-box a { color: #65829d; } .panel-box a:hover, .panel-box a:focus { color: #7891a9; } .panel-box .panel-box-title { padding: 10px 15px; border: 1px solid #ddd; background-color: #f5f5f5; position: relative; border-radius: 0 0 0 0; } .panel-box .panel-box-title:after { content: ''; display: table; clear: both; } .panel-box .panel-box-title h3, .panel-box .panel-box-title h4 { float: right; font-size: 13px; font-weight: 700; line-height: 18px; text-transform: uppercase; margin: 0; color: #313131; } .panel-box .panel-box-title .panel-box-edit { float: left; line-height: 18px; font-size: 12px; } .panel-box .panel-box-content { padding: 20px 15px; font-size: 13px; border: 1px solid #ddd; border-top: 0; border-radius: 0 0 0 0; background-color: #fbfbfb; min-height: 135px; } #account-chage-pass { display: none; margin-top: 30px; } #account-chage-pass.show { display: block; } .featured-box { box-shadow: 0 2px 3px rgba(0, 0, 0, 0.08); } .featured-box.featured-box-flat { background: #fff; } .featured-box h4 { font-size: 16px; } label .required { color: #eb340a; } .form-section { overflow: hidden; } .form-section .featured-box { margin-bottom: 30px; } .form-section .featured-box .box-content { padding: 35px 25px; } @media (min-width: 768px) { .form-section .form-content { min-height: 275px; } } .form-section p { margin-bottom: 15px; } .form-section .form-action { padding-top: 8px; margin-top: 1em; text-align: left; } .form-section .form-action a:not(.btn) { color: #65829d; } .form-section .form-action a:not(.btn).pull-left { line-height: 38px; } .form-section .form-action a:not(.btn):hover, .form-section .form-action a:not(.btn):focus { color: #6b87a1; text-decoration: underline; } .form-section .required { color: #eb340a; font-size: 11px; text-align: left; } @media (min-width: 992px) { .form-section.register-form .row { margin-left: -30px; margin-right: -30px; } .form-section.register-form [class*="col-"] { padding-left: 30px; padding-right: 30px; } } .blog-posts article { padding-bottom: 18px; margin-bottom: 30px; } @media (max-width: 991px) { .blog-posts + .toolbar { margin-bottom: 35px; } } article.post-large h2 { font-size: 20px; margin: 0 0 10px 0; font-weight: 600; } article.post-large .post-image .owl-dots { position: absolute; right: 0; right: 0; bottom: 10px; z-index: 20; } article.post-large .post-video iframe { border: none; } article.post-large .post-content { font-size: 14px; } article.post-large .post-content p { margin-bottom: 15px; } article.post-large .post-content p:last-of-type { margin-bottom: 12px; } article.post-large .btn.btn-link { font-size: 13px; padding: 0; color: #777; } article.post-large .btn.btn-link:hover, article.post-large .btn.btn-link:focus { color: #65829d; } article.post-large .post-meta { font-size: 13px; line-height: 1.65; margin-top: 15px; } article.post-large .post-meta > span { display: inline; padding-left: 15px; } article.post-large .post-meta > span i { margin-left: 7px; } article.post-large .post-meta span, article.post-large .post-meta a { color: #777; } article.post-large .post-meta a:hover, article.post-large .post-meta a:focus { color: #65829d; } aside ul.nav-list > li > a { font-size: 13px; padding-right: 21px; } aside ul.nav-list > li > a:before { margin-right: -11px; } aside ul.nav-list > li.active > a { color: #65829d; font-weight: 600; } aside ul.nav-list > li.active > a:before { border-right-color: #65829d; } .sidebar h4 { margin: 5px 0 10px; line-height: 1.2; font-size: 16px; font-weight: bold; color: #313131; } .sidebar .nav.nav-list { margin-bottom: 30px; } .sidebar .simple-post-list { margin-bottom: 40px; } .sidebar .simple-post-list li { padding: 10px 0; border-bottom: none; } .sidebar .simple-post-list li a { font-size: 13px; } .sidebar .simple-post-list li .post-image { width: 60px; line-height: 0; } .sidebar .simple-post-list li .post-image .img-thumbnail { padding: 2px; } .sidebar .simple-post-list li .post-image img { display: block; max-width: 100%; height: auto; } .sidebar .simple-post-list li .post-meta { font-size: 12px; } .sidebar .tagcloud { margin-bottom: 30px; } .sidebar .tagcloud a { display: block; padding: 10px 14px; background-color: #e1e1e1; color: #7e7d79; font-size: 13px; font-weight: 400; line-height: 11px; float: right; margin: 0 0 7px 7px; } .sidebar .tagcloud a:hover, .sidebar .tagcloud a:focus { color: #fff; background-color: #65829d; text-decoration: none; } .sidebar .tagcloud:after { content: ''; display: table; clear: both; } .sidebar .sidebar-compare-products { margin-bottom: 30px; font-size: 13px; } .post-share { margin-top: 30px; } .post-block h3 { font-size: 18px; font-weight: 600; } .section-contact-area { padding-bottom: 20px; } @media (min-width: 992px) { .section-contact-area { padding-bottom: 40px; } } label { font-size: 14px; } .form-control { border-radius: 0; height: 38px; padding-top: 8px; padding-bottom: 8px; } .btn { border-radius: 0; padding-top: 8px; padding-bottom: 8px; } .google-map { height: 300px; margin: 0 0 30px; } .list-contact li { margin-bottom: 15px; } .list-contact li i { display: block; float: right; width: 43px; height: 43px; background-color: #65829d; color: #fff; line-height: 43px; text-align: center; font-size: 16px; border-radius: 0; } .list-contact li i.fa-mobile { font-size: 24px; } .list-contact li div { margin-right: 55px; margin-bottom: 0; font-size: 14px; line-height: 21px; } #footer { background-color: #121214; color: #777; font-size: 13px; padding-top: 41px; } #footer .footer-ribbon { margin-top: -61px; } #footer .footer-ribbon span { font-size: 20px; line-height: 1; } #footer h1, #footer h2, #footer h3, #footer h4, #footer a { color: #fff; } #footer h4 { font-size: 16px; font-weight: 400; margin-bottom: 18px; } #footer a:hover, #footer a:focus { color: #fff; text-decoration: underline; } #footer .contact { margin-top: -6px; } #footer .contact li { padding: 5px 0; line-height: 1.5; margin-bottom: 0; } #footer .contact li:last-child { margin-bottom: 0; } #footer .contact p { margin-bottom: 0; line-height: 1.5; } #footer .contact i { color: #777; display: inline-block; vertical-align: top; font-size: 14px; line-height: 18px; margin-top: 0; top: 2px; } #footer .links, #footer .features { list-style: none; padding: 0; margin-top: -6px; } #footer .links li, #footer .features li { position: relative; padding: 10.5px 0; line-height: 1; display: block; } #footer .links li i, #footer .features li i { margin-left: 3px; } #footer .newsletter form { opacity: 1; } #footer .newsletter .btn { padding-top: 6px; padding-bottom: 6px; } #footer .newsletter .form-control { background-color: #fff; } #footer .newsletter p { margin-bottom: 15px; line-height: 1.5; } @media (min-width: 992px) { #footer .newsletter p.newsletter-info { margin-bottom: 40px; } } #footer .footer-copyright { color: #777; background-color: #0c0c0c; border-top: none; padding: 29.5px 0; margin-top: 20px; } #footer .footer-copyright p { color: #777; } #footer .footer-copyright .footer-payment { display: block; max-width: 100%; height: auto; } #footer .footer-copyright .social-icons li { margin-top: 0; } #footer .footer-copyright .social-icons li + li { margin-right: 7px; } #footer .footer-copyright .social-icons li a { color: #fff !important; } #footer .footer-copyright .social-icons li a:not(:hover) { background-color: #9e9e9e; } @media (min-width: 992px) { #footer .footer-copyright .logo, #footer .footer-copyright .social-icons, #footer .footer-copyright .footer-payment { float: right; margin-bottom: 0; } #footer .footer-copyright .logo { margin-left: 45px; } #footer .footer-copyright .social-icons { margin-left: 60px; } #footer .footer-copyright .social-icons li { margin-bottom: 0; } #footer .footer-copyright .footer-payment { margin-top: 1px; } #footer .footer-copyright .copyright-text { float: left; margin-bottom: 0; margin-top: 6px; } } @media (max-width: 991px) { #footer .footer-copyright { text-align: center; } #footer .footer-copyright .logo { margin-bottom: 8px; } #footer .footer-copyright .social-icons { margin-bottom: 5px; } #footer .footer-copyright .logo img, #footer .footer-copyright .footer-payment { margin-left: auto; margin-right: auto; } #footer .footer-copyright .footer-payment { margin-bottom: 10px; } } html .scroll-to-top { left: 15px; min-width: 40px; padding: 9px 5px 31px; font-size: 16px; color: #65829d; border-radius: 0 0 0 0; } html .scroll-to-top:hover, html .scroll-to-top:focus { color: #65829d; background-color: #555; } #header .header-nav-main nav > ul > li > a.dropdown-toggle:after { font-family: FontAwesome; border: none !important; margin: 0; width: initial !important; } .custom-text-color-1 { color: #666 !important; }
gpl-2.0
moveable-dev1/rep1
wp-content/themes/marsaec/js/toggle.js
7013
jQuery(function($) { //Get Level 2 Category $('#level1').on("change", ":checkbox", function () { $("#imageloader").show(); if (this.checked) { var parentCat=this.value; // call ajax add_action declared in functions.php $.ajax({ url: "/wp-admin/admin-ajax.php", type:'POST', data:'action=home_category_select_action&parent_cat_ID=' + parentCat, success:function(results) { $("#level2help").hide(); $("#imageloader").hide(); $(".lev1.cat-col").removeClass('dsbl'); //Append all child element in level 2 $("#level2").append(results); } }); } else { //Remove all level 2 element if unchecked $("#imageloader").hide(); $("#getallcat"+this.value).remove(); } }); //Get Level 3 Category $('#level2').on("change", ":checkbox", function () { $("#imageloader2").show(); if (this.checked) { var parentCat=this.value; var parentvalue = $('#parent_id'+parentCat).val(); // call ajax $.ajax({ url: "/wp-admin/admin-ajax.php", type:'POST', data:'action=home_category_select_action&parent_cat_ID=' + parentCat, success:function(results) { $("#level3help").hide(); $(".lev2.cat-col").removeClass('dsbl'); $("#imageloader2").hide(); //Append all child element in level 3 $("#level3").append(results); //Disable parent category $("#level1 input[value='"+parentvalue+"']").prop("disabled", true); // removeChild.push(parentCat); } }); } else { $("#imageloader2").hide(); var parentvalue = $('#parent_id'+this.value).val(); var checkcheckbox=$('#getallcat'+parentvalue+' #parent_cat2').is(':checked'); //check if any child category is checked if(checkcheckbox==false) { //Enable the parent checkbox if unchecked all child element $("#level1 input[value='"+parentvalue+"']").prop("disabled", false); } //Remove all level 3 element if unchecked $("#getallcat"+this.value).remove(); } }); //Load Profile based on tags var list = new Array(); var $container = $('#getTagProfiles'); var $checkboxes = $('#levelContainer input.cb'); $('#levelContainer').on("change", ":checkbox", function () { if (this.checked) { var filterclass=".isoShow"; list.push(this.value); $("#getAllCatId").val(list); $container.isotope({ itemSelector: '.items', masonry: { columnWidth: 40, rowHeight: 107, isFitWidth: true } }); $.post("/wp-admin/admin-ajax.php", 'action=home_tag_select_action&All_cat_ID=' + list+'&listlength='+list.length, function(response) { $(".firstsearch").remove(); $("#contentSection").remove(); $container.html(response); if(!$container.hasClass('isotope')){ $container.isotope({ filter: filterclass }); } else { $container.isotope('reloadItems'); $container.isotope({ itemSelector: '.items', masonry: { columnWidth: 40, rowHeight: 107, isFitWidth: true } }); $container.isotope({ filter: filterclass }); } }); } else //If unchecked { var filterclass=".isoShow"; list.splice( $.inArray(this.value,list) ,1 ); $("#getAllCatId").val(list); $container.isotope({ itemSelector: '.items', masonry: { columnWidth: 40, rowHeight: 107, isFitWidth: true } }); $.post("/wp-admin/admin-ajax.php", 'action=home_tag_select_action&All_cat_ID=' + list+'&listlength='+list.length, function(response) { $(".firstsearch").remove(); $("#contentSection").remove(); $container.html(response); if(!$container.hasClass('isotope')){ $container.isotope({ filter: filterclass }); } else { $container.isotope('reloadItems'); $container.isotope({ itemSelector: '.items', masonry: { columnWidth: 40, rowHeight: 107, isFitWidth: true } }); $container.isotope({ filter: filterclass }); } }); } }); //Load more $('.more_button').live("click",function() { //var $container2 = $('#getTagProfiles .profile-sec'); var getId = $(this).attr("id"); var getCat= $("#getAllCatId").val(); var filterclass=".isoShow"; if(getId) { $("#load_more_"+getId).html('<img src="/wp-content/themes/marsaec/img/load_img.gif" style="padding:10px 0 0 100px;"/>'); $container.isotope({ itemSelector: '.items', masonry: { columnWidth: 40, rowHeight: 107, isFitWidth: true } }); $.post("/wp-admin/admin-ajax.php", 'action=get_loadmore_profile&getLastContentId='+getId+'&getParentId='+getCat+'&listlength='+getCat.length, function(response) { $container.append(response); if(!$container.hasClass('isotope')){ $("#load_more_"+getId).remove(); $container.isotope({ filter: filterclass }); } else { $("#load_more_"+getId).remove(); $container.isotope('reloadItems'); $container.isotope({ itemSelector: '.items', masonry: { columnWidth: 40, rowHeight: 107, isFitWidth: true } }); $container.isotope({ filter: filterclass }); } }); // $.ajax({ // type: "POST", // url: "/wp-admin/admin-ajax.php", // data:'action=get_loadmore_profile&getLastContentId='+getId+'&getParentId='+getCat+'&listlength='+getCat.length, // success: function(html){ // $container2.append(html); // $("#load_more_"+getId).remove(); // } // }); } return false; }); });
gpl-2.0
agalakhov/barebox
arch/arm/boards/panda/board.c
4498
#include <common.h> #include <console.h> #include <init.h> #include <fs.h> #include <driver.h> #include <io.h> #include <ns16550.h> #include <asm/armlinux.h> #include <linux/stat.h> #include <generated/mach-types.h> #include <mach/silicon.h> #include <mach/sdrc.h> #include <mach/sys_info.h> #include <mach/syslib.h> #include <mach/control.h> #include <usb/ehci.h> #include <linux/err.h> #include <sizes.h> #include <asm/mmu.h> #include <mach/gpio.h> #include <environment.h> #include <mach/xload.h> #include <i2c/i2c.h> #include <gpio.h> #include <led.h> static int board_revision; #define GPIO_HUB_POWER 1 #define GPIO_HUB_NRESET_39 39 #define GPIO_HUB_NRESET_62 62 #define GPIO_BOARD_ID0 182 #define GPIO_BOARD_ID1 101 #define GPIO_BOARD_ID2 171 static struct NS16550_plat serial_plat = { .clock = 48000000, /* 48MHz (APLL96/2) */ .shift = 2, }; static int panda_console_init(void) { /* Register the serial port */ add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART3_BASE, 1024, IORESOURCE_MEM_8BIT, &serial_plat); return 0; } console_initcall(panda_console_init); static int panda_mem_init(void) { arm_add_mem_device("ram0", 0x80000000, SZ_1G); return 0; } mem_initcall(panda_mem_init); #ifdef CONFIG_USB_EHCI static struct ehci_platform_data ehci_pdata = { .flags = 0, }; static void panda_ehci_init(void) { u32 val; int hub_nreset; if (board_revision) hub_nreset = GPIO_HUB_NRESET_62; else hub_nreset = GPIO_HUB_NRESET_39; /* disable the power to the usb hub prior to init */ gpio_direction_output(GPIO_HUB_POWER, 0); gpio_set_value(GPIO_HUB_POWER, 0); /* reset phy+hub */ gpio_direction_output(hub_nreset, 0); gpio_set_value(hub_nreset, 0); gpio_set_value(hub_nreset, 1); val = readl(0x4a009358); val |= (1 << 24); val |= 0x2; writel(val, 0x4a009358); writel(0x7, 0x4a008180); mdelay(10); writel(0x00000014, 0x4a064010); writel(0x8000001c, 0x4a064040); /* enable power to hub */ gpio_set_value(GPIO_HUB_POWER, 1); add_usb_ehci_device(-1, 0x4a064c00, 0x4a064c00 + 0x10, &ehci_pdata); } #else static void panda_ehci_init(void) {} #endif static void __init panda_boardrev_init(void) { board_revision = gpio_get_value(GPIO_BOARD_ID0); board_revision |= (gpio_get_value(GPIO_BOARD_ID1)<<1); board_revision |= (gpio_get_value(GPIO_BOARD_ID2)<<2); pr_info("PandaBoard Revision: %03d\n", board_revision); } static struct i2c_board_info i2c_devices[] = { { I2C_BOARD_INFO("twl6030", 0x48), }, }; struct gpio_led panda_leds[] = { { .gpio = 7, .led = { .name = "heartbeat", }, }, }; static void panda_led_init(void) { gpio_direction_output(7, 0); led_gpio_register(&panda_leds[0]); led_set_trigger(LED_TRIGGER_HEARTBEAT, &panda_leds[0].led); } static int panda_devices_init(void) { panda_boardrev_init(); if (gpio_get_value(182)) { /* enable software ioreq */ sr32(OMAP44XX_SCRM_AUXCLK3, 8, 1, 0x1); /* set for sys_clk (38.4MHz) */ sr32(OMAP44XX_SCRM_AUXCLK3, 1, 2, 0x0); /* set divisor to 2 */ sr32(OMAP44XX_SCRM_AUXCLK3, 16, 4, 0x1); /* set the clock source to active */ sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1); /* enable clocks */ sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3); } else { /* enable software ioreq */ sr32(OMAP44XX_SCRM_AUXCLK1, 8, 1, 0x1); /* set for PER_DPLL */ sr32(OMAP44XX_SCRM_AUXCLK1, 1, 2, 0x2); /* set divisor to 16 */ sr32(OMAP44XX_SCRM_AUXCLK1, 16, 4, 0xf); /* set the clock source to active */ sr32(OMAP44XX_SCRM_ALTCLKSRC, 0, 1, 0x1); /* enable clocks */ sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3); } i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices)); add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, 0x48070000, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K, IORESOURCE_MEM, NULL); panda_ehci_init(); panda_led_init(); armlinux_set_bootparams((void *)0x80000100); armlinux_set_architecture(MACH_TYPE_OMAP4_PANDA); return 0; } device_initcall(panda_devices_init); #ifdef CONFIG_DEFAULT_ENVIRONMENT static int panda_env_init(void) { struct stat s; char *diskdev = "/dev/disk0.0"; int ret; ret = stat(diskdev, &s); if (ret) { printf("no %s. using default env\n", diskdev); return 0; } mkdir ("/boot", 0666); ret = mount(diskdev, "fat", "/boot"); if (ret) { printf("failed to mount %s\n", diskdev); return 0; } default_environment_path = "/boot/bareboxenv"; return 0; } late_initcall(panda_env_init); #endif
gpl-2.0
felipewmartins/SICOBA
src/main/resources/db/migration/V1__create-tables.sql
10416
CREATE TABLE pais ( id SERIAL NOT NULL PRIMARY KEY, nome CHARACTER VARYING(255) NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (nome) ); CREATE TABLE estado ( id SERIAL NOT NULL PRIMARY KEY, nome CHARACTER VARYING(255) NOT NULL, uf CHARACTER VARYING(2) NOT NULL, pais_id INT NOT NULL REFERENCES pais (id), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (nome, pais_id) ); CREATE TABLE cidade ( id SERIAL NOT NULL PRIMARY KEY, nome CHARACTER VARYING(255) NOT NULL, estado_id INT NOT NULL REFERENCES estado (id), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (nome, estado_id) ); CREATE TABLE bairro ( id SERIAL NOT NULL PRIMARY KEY, nome CHARACTER VARYING(255) NOT NULL, cidade_id INT NOT NULL REFERENCES cidade (id), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (nome, cidade_id) ); CREATE TABLE cedente ( id SERIAL NOT NULL PRIMARY KEY, codigo INT NOT NULL DEFAULT 0, digito_verificador INT NOT NULL DEFAULT 0, nome CHARACTER VARYING(255) NOT NULL, cpf_cnpj CHARACTER VARYING(255) NOT NULL, numero_agencia INT NOT NULL, digito_agencia INT NOT NULL DEFAULT 0, codigo_operacao INT NOT NULL DEFAULT 0, numero_conta INT NOT NULL, digito_conta INT NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, prazo INT NOT NULL DEFAULT '60', multa DECIMAL(12, 2) NOT NULL DEFAULT '5.00', juros DECIMAL(12, 2) NOT NULL DEFAULT '0.67' ); CREATE TABLE endereco ( id SERIAL NOT NULL PRIMARY KEY, logradouro CHARACTER VARYING(255) NOT NULL, numero CHARACTER VARYING(255) DEFAULT NULL, complemento CHARACTER VARYING(255) DEFAULT NULL, bairro_id INT NOT NULL REFERENCES bairro (id), cep CHARACTER VARYING(255) NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL ); CREATE TABLE cliente ( id SERIAL NOT NULL PRIMARY KEY, nome CHARACTER VARYING(100) NOT NULL, rg CHARACTER VARYING(20) DEFAULT NULL, cpf_cnpj CHARACTER VARYING(255) DEFAULT NULL, dt_nascimento DATE DEFAULT NULL, email CHARACTER VARYING(140) DEFAULT NULL, fone_titular CHARACTER VARYING(20) NOT NULL, contato CHARACTER VARYING(100) DEFAULT NULL, fone_contato CHARACTER VARYING(20) DEFAULT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, endereco_id INT DEFAULT NULL REFERENCES endereco (id), status SMALLINT NOT NULL DEFAULT 0, UNIQUE (rg), UNIQUE (cpf_cnpj), UNIQUE (email) ); CREATE TABLE mikrotik ( id SERIAL NOT NULL PRIMARY KEY, name CHARACTER VARYING(255) NOT NULL, description TEXT, login CHARACTER VARYING(255) NOT NULL, pass CHARACTER VARYING(255) NOT NULL DEFAULT '', host CHARACTER VARYING(255) NOT NULL, port INT NOT NULL DEFAULT '8728', created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL ); CREATE TABLE conexao ( id SERIAL NOT NULL PRIMARY KEY, cliente_id INT NOT NULL REFERENCES cliente (id), mikrotik_id INT NOT NULL REFERENCES mikrotik (id), nome CHARACTER VARYING(255) NOT NULL, senha CHARACTER VARYING(255) NOT NULL, ip CHARACTER VARYING(40) DEFAULT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (nome), UNIQUE (ip) ); CREATE TABLE plano ( id SERIAL NOT NULL PRIMARY KEY, nome CHARACTER VARYING(100) NOT NULL, upload INT NOT NULL DEFAULT 0, download INT NOT NULL DEFAULT 0, valor_instalacao DECIMAL(20, 2) DEFAULT NULL, valor DECIMAL(20, 2) DEFAULT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL ); CREATE TABLE equipamento ( id SERIAL NOT NULL PRIMARY KEY, descricao CHARACTER VARYING(255) DEFAULT NULL, marca CHARACTER VARYING(30) NOT NULL, modelo CHARACTER VARYING(30) NOT NULL, mac CHARACTER VARYING(20) NOT NULL, tipo SMALLINT NOT NULL, status SMALLINT NOT NULL DEFAULT 0, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (mac) ); CREATE TABLE contrato ( id SERIAL NOT NULL PRIMARY KEY, cliente_id INT NOT NULL REFERENCES cliente (id), plano_id INT NOT NULL REFERENCES plano (id), vencimento SMALLINT NOT NULL, data_instalacao DATE NOT NULL, equipamento_id INT DEFAULT NULL REFERENCES equipamento (id), equipamento_wifi_id INT DEFAULT NULL REFERENCES equipamento (id), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (cliente_id), UNIQUE (equipamento_id), UNIQUE (equipamento_wifi_id) ); CREATE TABLE header ( id SERIAL NOT NULL PRIMARY KEY, sequencial INT NOT NULL, nome_arquivo CHARACTER VARYING(255) DEFAULT NULL, data_geracao TIMESTAMP DEFAULT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (sequencial) ); CREATE TABLE header_lote ( id SERIAL NOT NULL PRIMARY KEY, numero_remessa_retorno INT DEFAULT NULL, data_gravacao_remessa_retorno DATE DEFAULT NULL, header_id INT DEFAULT NULL REFERENCES header (id), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL ); CREATE TABLE titulo ( id SERIAL NOT NULL PRIMARY KEY, data_vencimento DATE DEFAULT NULL, data_ocorrencia DATE DEFAULT NULL, valor DECIMAL(20, 2) DEFAULT NULL, valor_pago DECIMAL(20, 2) NOT NULL DEFAULT 0.00, desconto DECIMAL(20, 2) NOT NULL DEFAULT 0.00, tarifa DECIMAL(20, 2) NOT NULL DEFAULT 0.00, cliente_id INT NOT NULL REFERENCES cliente (id), status SMALLINT NOT NULL DEFAULT 0, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, numero_boleto INT DEFAULT NULL, modalidade INT NOT NULL DEFAULT '24', UNIQUE (numero_boleto) ); CREATE TABLE registro ( id SERIAL NOT NULL PRIMARY KEY, modalidade_nosso_numero INT DEFAULT NULL, nosso_numero INT DEFAULT NULL, vencimento DATE DEFAULT NULL, valor_titulo DECIMAL(20, 2) DEFAULT NULL, valor_tarifa DECIMAL(20, 2) DEFAULT NULL, header_lote_id INT DEFAULT NULL REFERENCES header_lote (id), numero_documento CHARACTER VARYING(255) DEFAULT NULL, banco_recebedor CHARACTER VARYING(255) DEFAULT NULL, agencia_recebedor CHARACTER VARYING(255) DEFAULT NULL, digito_verificador_recebedor CHARACTER VARYING(255) DEFAULT NULL, codigo_movimento INT DEFAULT NULL, uso_da_empresa CHARACTER VARYING(255) DEFAULT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL ); CREATE TABLE registro_detalhe ( id SERIAL NOT NULL PRIMARY KEY, juros_multas_encargos DECIMAL(20, 2) DEFAULT NULL, desconto DECIMAL(20, 2) DEFAULT NULL, abatimento DECIMAL(20, 2) DEFAULT NULL, iof DECIMAL(20, 2) DEFAULT NULL, valor_pago DECIMAL(20, 2) DEFAULT NULL, valor_liquido DECIMAL(20, 2) DEFAULT NULL, data_ocorrencia DATE DEFAULT NULL, data_credito DATE DEFAULT NULL, data_debito_tarifa DATE DEFAULT NULL, registro_id INT DEFAULT NULL REFERENCES registro (id), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL ); CREATE TABLE trailer ( id SERIAL NOT NULL PRIMARY KEY, quantidade_lotes INT NOT NULL, quantidade_registros INT NOT NULL, header_id INT NOT NULL REFERENCES header (id), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL ); CREATE TABLE trailer_lote ( id SERIAL NOT NULL PRIMARY KEY, quantidade_registro_lote INT DEFAULT NULL, header_lote_id INT DEFAULT NULL REFERENCES header_lote (id), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL ); CREATE TABLE users ( id SERIAL NOT NULL PRIMARY KEY, name VARCHAR(150) NOT NULL, username VARCHAR(45) NOT NULL, password VARCHAR(255) NOT NULL, enabled boolean NOT NULL DEFAULT true, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (username) ); CREATE TABLE user_roles ( id SERIAL NOT NULL PRIMARY KEY, user_id INT NOT NULL REFERENCES users (id), role VARCHAR(45) NOT NULL, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, UNIQUE (role, user_id) );
gpl-2.0
Gurgel100/gcc
libsanitizer/tsan/tsan_platform_mac.cpp
12112
//===-- tsan_platform_mac.cpp ---------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file is a part of ThreadSanitizer (TSan), a race detector. // // Mac-specific code. //===----------------------------------------------------------------------===// #include "sanitizer_common/sanitizer_platform.h" #if SANITIZER_MAC #include "sanitizer_common/sanitizer_atomic.h" #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_posix.h" #include "sanitizer_common/sanitizer_procmaps.h" #include "sanitizer_common/sanitizer_ptrauth.h" #include "sanitizer_common/sanitizer_stackdepot.h" #include "tsan_platform.h" #include "tsan_rtl.h" #include "tsan_flags.h" #include <mach/mach.h> #include <pthread.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdarg.h> #include <sys/mman.h> #include <sys/syscall.h> #include <sys/time.h> #include <sys/types.h> #include <sys/resource.h> #include <sys/stat.h> #include <unistd.h> #include <errno.h> #include <sched.h> namespace __tsan { #if !SANITIZER_GO static void *SignalSafeGetOrAllocate(uptr *dst, uptr size) { atomic_uintptr_t *a = (atomic_uintptr_t *)dst; void *val = (void *)atomic_load_relaxed(a); atomic_signal_fence(memory_order_acquire); // Turns the previous load into // acquire wrt signals. if (UNLIKELY(val == nullptr)) { val = (void *)internal_mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); CHECK(val); void *cmp = nullptr; if (!atomic_compare_exchange_strong(a, (uintptr_t *)&cmp, (uintptr_t)val, memory_order_acq_rel)) { internal_munmap(val, size); val = cmp; } } return val; } // On OS X, accessing TLVs via __thread or manually by using pthread_key_* is // problematic, because there are several places where interceptors are called // when TLVs are not accessible (early process startup, thread cleanup, ...). // The following provides a "poor man's TLV" implementation, where we use the // shadow memory of the pointer returned by pthread_self() to store a pointer to // the ThreadState object. The main thread's ThreadState is stored separately // in a static variable, because we need to access it even before the // shadow memory is set up. static uptr main_thread_identity = 0; ALIGNED(64) static char main_thread_state[sizeof(ThreadState)]; static ThreadState *main_thread_state_loc = (ThreadState *)main_thread_state; // We cannot use pthread_self() before libpthread has been initialized. Our // current heuristic for guarding this is checking `main_thread_identity` which // is only assigned in `__tsan::InitializePlatform`. static ThreadState **cur_thread_location() { if (main_thread_identity == 0) return &main_thread_state_loc; uptr thread_identity = (uptr)pthread_self(); if (thread_identity == main_thread_identity) return &main_thread_state_loc; return (ThreadState **)MemToShadow(thread_identity); } ThreadState *cur_thread() { return (ThreadState *)SignalSafeGetOrAllocate( (uptr *)cur_thread_location(), sizeof(ThreadState)); } void set_cur_thread(ThreadState *thr) { *cur_thread_location() = thr; } // TODO(kuba.brecka): This is not async-signal-safe. In particular, we call // munmap first and then clear `fake_tls`; if we receive a signal in between, // handler will try to access the unmapped ThreadState. void cur_thread_finalize() { ThreadState **thr_state_loc = cur_thread_location(); if (thr_state_loc == &main_thread_state_loc) { // Calling dispatch_main() or xpc_main() actually invokes pthread_exit to // exit the main thread. Let's keep the main thread's ThreadState. return; } internal_munmap(*thr_state_loc, sizeof(ThreadState)); *thr_state_loc = nullptr; } #endif void FlushShadowMemory() { } static void RegionMemUsage(uptr start, uptr end, uptr *res, uptr *dirty) { vm_address_t address = start; vm_address_t end_address = end; uptr resident_pages = 0; uptr dirty_pages = 0; while (address < end_address) { vm_size_t vm_region_size; mach_msg_type_number_t count = VM_REGION_EXTENDED_INFO_COUNT; vm_region_extended_info_data_t vm_region_info; mach_port_t object_name; kern_return_t ret = vm_region_64( mach_task_self(), &address, &vm_region_size, VM_REGION_EXTENDED_INFO, (vm_region_info_t)&vm_region_info, &count, &object_name); if (ret != KERN_SUCCESS) break; resident_pages += vm_region_info.pages_resident; dirty_pages += vm_region_info.pages_dirtied; address += vm_region_size; } *res = resident_pages * GetPageSizeCached(); *dirty = dirty_pages * GetPageSizeCached(); } void WriteMemoryProfile(char *buf, uptr buf_size, uptr nthread, uptr nlive) { uptr shadow_res, shadow_dirty; uptr meta_res, meta_dirty; uptr trace_res, trace_dirty; RegionMemUsage(ShadowBeg(), ShadowEnd(), &shadow_res, &shadow_dirty); RegionMemUsage(MetaShadowBeg(), MetaShadowEnd(), &meta_res, &meta_dirty); RegionMemUsage(TraceMemBeg(), TraceMemEnd(), &trace_res, &trace_dirty); #if !SANITIZER_GO uptr low_res, low_dirty; uptr high_res, high_dirty; uptr heap_res, heap_dirty; RegionMemUsage(LoAppMemBeg(), LoAppMemEnd(), &low_res, &low_dirty); RegionMemUsage(HiAppMemBeg(), HiAppMemEnd(), &high_res, &high_dirty); RegionMemUsage(HeapMemBeg(), HeapMemEnd(), &heap_res, &heap_dirty); #else // !SANITIZER_GO uptr app_res, app_dirty; RegionMemUsage(AppMemBeg(), AppMemEnd(), &app_res, &app_dirty); #endif StackDepotStats *stacks = StackDepotGetStats(); internal_snprintf(buf, buf_size, "shadow (0x%016zx-0x%016zx): resident %zd kB, dirty %zd kB\n" "meta (0x%016zx-0x%016zx): resident %zd kB, dirty %zd kB\n" "traces (0x%016zx-0x%016zx): resident %zd kB, dirty %zd kB\n" #if !SANITIZER_GO "low app (0x%016zx-0x%016zx): resident %zd kB, dirty %zd kB\n" "high app (0x%016zx-0x%016zx): resident %zd kB, dirty %zd kB\n" "heap (0x%016zx-0x%016zx): resident %zd kB, dirty %zd kB\n" #else // !SANITIZER_GO "app (0x%016zx-0x%016zx): resident %zd kB, dirty %zd kB\n" #endif "stacks: %zd unique IDs, %zd kB allocated\n" "threads: %zd total, %zd live\n" "------------------------------\n", ShadowBeg(), ShadowEnd(), shadow_res / 1024, shadow_dirty / 1024, MetaShadowBeg(), MetaShadowEnd(), meta_res / 1024, meta_dirty / 1024, TraceMemBeg(), TraceMemEnd(), trace_res / 1024, trace_dirty / 1024, #if !SANITIZER_GO LoAppMemBeg(), LoAppMemEnd(), low_res / 1024, low_dirty / 1024, HiAppMemBeg(), HiAppMemEnd(), high_res / 1024, high_dirty / 1024, HeapMemBeg(), HeapMemEnd(), heap_res / 1024, heap_dirty / 1024, #else // !SANITIZER_GO AppMemBeg(), AppMemEnd(), app_res / 1024, app_dirty / 1024, #endif stacks->n_uniq_ids, stacks->allocated / 1024, nthread, nlive); } #if !SANITIZER_GO void InitializeShadowMemoryPlatform() { } // On OS X, GCD worker threads are created without a call to pthread_create. We // need to properly register these threads with ThreadCreate and ThreadStart. // These threads don't have a parent thread, as they are created "spuriously". // We're using a libpthread API that notifies us about a newly created thread. // The `thread == pthread_self()` check indicates this is actually a worker // thread. If it's just a regular thread, this hook is called on the parent // thread. typedef void (*pthread_introspection_hook_t)(unsigned int event, pthread_t thread, void *addr, size_t size); extern "C" pthread_introspection_hook_t pthread_introspection_hook_install( pthread_introspection_hook_t hook); static const uptr PTHREAD_INTROSPECTION_THREAD_CREATE = 1; static const uptr PTHREAD_INTROSPECTION_THREAD_TERMINATE = 3; static pthread_introspection_hook_t prev_pthread_introspection_hook; static void my_pthread_introspection_hook(unsigned int event, pthread_t thread, void *addr, size_t size) { if (event == PTHREAD_INTROSPECTION_THREAD_CREATE) { if (thread == pthread_self()) { // The current thread is a newly created GCD worker thread. ThreadState *thr = cur_thread(); Processor *proc = ProcCreate(); ProcWire(proc, thr); ThreadState *parent_thread_state = nullptr; // No parent. int tid = ThreadCreate(parent_thread_state, 0, (uptr)thread, true); CHECK_NE(tid, 0); ThreadStart(thr, tid, GetTid(), ThreadType::Worker); } } else if (event == PTHREAD_INTROSPECTION_THREAD_TERMINATE) { if (thread == pthread_self()) { ThreadState *thr = cur_thread(); if (thr->tctx) { DestroyThreadState(); } } } if (prev_pthread_introspection_hook != nullptr) prev_pthread_introspection_hook(event, thread, addr, size); } #endif void InitializePlatformEarly() { #if !SANITIZER_GO && defined(__aarch64__) uptr max_vm = GetMaxUserVirtualAddress() + 1; if (max_vm != Mapping::kHiAppMemEnd) { Printf("ThreadSanitizer: unsupported vm address limit %p, expected %p.\n", max_vm, Mapping::kHiAppMemEnd); Die(); } #endif } static uptr longjmp_xor_key = 0; void InitializePlatform() { DisableCoreDumperIfNecessary(); #if !SANITIZER_GO CheckAndProtect(); CHECK_EQ(main_thread_identity, 0); main_thread_identity = (uptr)pthread_self(); prev_pthread_introspection_hook = pthread_introspection_hook_install(&my_pthread_introspection_hook); #endif if (GetMacosAlignedVersion() >= MacosVersion(10, 14)) { // Libsystem currently uses a process-global key; this might change. const unsigned kTLSLongjmpXorKeySlot = 0x7; longjmp_xor_key = (uptr)pthread_getspecific(kTLSLongjmpXorKeySlot); } } #ifdef __aarch64__ # define LONG_JMP_SP_ENV_SLOT \ ((GetMacosAlignedVersion() >= MacosVersion(10, 14)) ? 12 : 13) #else # define LONG_JMP_SP_ENV_SLOT 2 #endif uptr ExtractLongJmpSp(uptr *env) { uptr mangled_sp = env[LONG_JMP_SP_ENV_SLOT]; uptr sp = mangled_sp ^ longjmp_xor_key; sp = (uptr)ptrauth_auth_data((void *)sp, ptrauth_key_asdb, ptrauth_string_discriminator("sp")); return sp; } #if !SANITIZER_GO void ImitateTlsWrite(ThreadState *thr, uptr tls_addr, uptr tls_size) { // The pointer to the ThreadState object is stored in the shadow memory // of the tls. uptr tls_end = tls_addr + tls_size; uptr thread_identity = (uptr)pthread_self(); if (thread_identity == main_thread_identity) { MemoryRangeImitateWrite(thr, /*pc=*/2, tls_addr, tls_size); } else { uptr thr_state_start = thread_identity; uptr thr_state_end = thr_state_start + sizeof(uptr); CHECK_GE(thr_state_start, tls_addr); CHECK_LE(thr_state_start, tls_addr + tls_size); CHECK_GE(thr_state_end, tls_addr); CHECK_LE(thr_state_end, tls_addr + tls_size); MemoryRangeImitateWrite(thr, /*pc=*/2, tls_addr, thr_state_start - tls_addr); MemoryRangeImitateWrite(thr, /*pc=*/2, thr_state_end, tls_end - thr_state_end); } } #endif #if !SANITIZER_GO // Note: this function runs with async signals enabled, // so it must not touch any tsan state. int call_pthread_cancel_with_cleanup(int(*fn)(void *c, void *m, void *abstime), void *c, void *m, void *abstime, void(*cleanup)(void *arg), void *arg) { // pthread_cleanup_push/pop are hardcore macros mess. // We can't intercept nor call them w/o including pthread.h. int res; pthread_cleanup_push(cleanup, arg); res = fn(c, m, abstime); pthread_cleanup_pop(0); return res; } #endif } // namespace __tsan #endif // SANITIZER_MAC
gpl-2.0
stan3/debian-pidgin-sipe
src/core/sipe-http-transport.c
14334
/** * @file sipe-http-transport.c * * pidgin-sipe * * Copyright (C) 2013 SIPE Project <http://sipe.sourceforge.net/> * * * 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * SIPE HTTP transport layer implementation * * - connection handling: opening, closing, timeout * - interface to backend: sending & receiving of raw messages * - request queue pulling */ #include <string.h> #include <time.h> #include <glib.h> #include "sipmsg.h" #include "sipe-backend.h" #include "sipe-common.h" #include "sipe-core.h" #include "sipe-core-private.h" #include "sipe-http.h" #include "sipe-schedule.h" #include "sipe-utils.h" #define _SIPE_HTTP_PRIVATE_IF_REQUEST #include "sipe-http-request.h" #define _SIPE_HTTP_PRIVATE_IF_TRANSPORT #include "sipe-http-transport.h" #define SIPE_HTTP_CONNECTION ((struct sipe_http_connection *) connection->user_data) #define SIPE_HTTP_CONNECTION_PRIVATE ((struct sipe_http_connection *) conn_public) #define SIPE_HTTP_CONNECTION_PUBLIC ((struct sipe_http_connection_public *) conn) #define SIPE_HTTP_TIMEOUT_ACTION "<+http-timeout>" #define SIPE_HTTP_DEFAULT_TIMEOUT 60 /* in seconds */ struct sipe_http_connection { struct sipe_http_connection_public public; struct sipe_transport_connection *connection; gchar *host_port; time_t timeout; /* in seconds from epoch */ gboolean use_tls; }; struct sipe_http { GHashTable *connections; GQueue *timeouts; time_t next_timeout; /* in seconds from epoch, 0 if timer isn't running */ gboolean shutting_down; }; static gint timeout_compare(gconstpointer a, gconstpointer b, SIPE_UNUSED_PARAMETER gpointer user_data) { return(((struct sipe_http_connection *) a)->timeout - ((struct sipe_http_connection *) b)->timeout); } static void sipe_http_transport_update_timeout_queue(struct sipe_http_connection *conn, gboolean remove); static void sipe_http_transport_free(gpointer data) { struct sipe_http_connection *conn = data; SIPE_DEBUG_INFO("sipe_http_transport_free: destroying connection '%s'", conn->host_port); if (conn->connection) sipe_backend_transport_disconnect(conn->connection); conn->connection = NULL; sipe_http_transport_update_timeout_queue(conn, TRUE); sipe_http_request_shutdown(SIPE_HTTP_CONNECTION_PUBLIC, conn->public.sipe_private->http->shutting_down); g_free(conn->public.host); g_free(conn->host_port); g_free(conn); } static void sipe_http_transport_drop(struct sipe_http *http, struct sipe_http_connection *conn, const gchar *message) { SIPE_DEBUG_INFO("sipe_http_transport_drop: dropping connection '%s': %s", conn->host_port, message ? message : "REASON UNKNOWN"); /* this triggers sipe_http_transport_free */ g_hash_table_remove(http->connections, conn->host_port); } static void start_timer(struct sipe_core_private *sipe_private, time_t current_time); static void sipe_http_transport_timeout(struct sipe_core_private *sipe_private, gpointer data) { struct sipe_http *http = sipe_private->http; struct sipe_http_connection *conn = data; time_t current_time = time(NULL); /* timer has expired */ http->next_timeout = 0; while (1) { sipe_http_transport_drop(http, conn, "timeout"); /* conn is no longer valid */ /* is there another active connection? */ conn = g_queue_peek_head(http->timeouts); if (!conn) break; /* restart timer for next connection */ if (conn->timeout > current_time) { start_timer(sipe_private, current_time); break; } /* next connection timed-out too, loop around */ } } static void start_timer(struct sipe_core_private *sipe_private, time_t current_time) { struct sipe_http *http = sipe_private->http; struct sipe_http_connection *conn = g_queue_peek_head(http->timeouts); http->next_timeout = conn->timeout; sipe_schedule_seconds(sipe_private, SIPE_HTTP_TIMEOUT_ACTION, conn, http->next_timeout - current_time, sipe_http_transport_timeout, NULL); } static void sipe_http_transport_update_timeout_queue(struct sipe_http_connection *conn, gboolean remove) { struct sipe_core_private *sipe_private = conn->public.sipe_private; struct sipe_http *http = sipe_private->http; GQueue *timeouts = http->timeouts; time_t current_time = time(NULL); /* is this connection at head of queue? */ gboolean update = (conn == g_queue_peek_head(timeouts)); /* update timeout queue */ if (remove) { g_queue_remove(timeouts, conn); } else { conn->timeout = current_time + SIPE_HTTP_DEFAULT_TIMEOUT; g_queue_sort(timeouts, timeout_compare, NULL); } /* update timer if necessary */ if (update) { sipe_schedule_cancel(sipe_private, SIPE_HTTP_TIMEOUT_ACTION); if (g_queue_is_empty(timeouts)) { http->next_timeout = 0; } else { start_timer(sipe_private, current_time); } } } gboolean sipe_http_shutting_down(struct sipe_core_private *sipe_private) { struct sipe_http *http = sipe_private->http; /* We need to return FALSE in case HTTP stack isn't initialized yet */ if (!http) return(FALSE); return(http->shutting_down); } void sipe_http_free(struct sipe_core_private *sipe_private) { struct sipe_http *http = sipe_private->http; if (!http) return; /* HTTP stack is shutting down: reject all new requests */ http->shutting_down = TRUE; sipe_schedule_cancel(sipe_private, SIPE_HTTP_TIMEOUT_ACTION); g_hash_table_destroy(http->connections); g_queue_free(http->timeouts); g_free(http); sipe_private->http = NULL; } static void sipe_http_init(struct sipe_core_private *sipe_private) { struct sipe_http *http; if (sipe_private->http) return; sipe_private->http = http = g_new0(struct sipe_http, 1); http->connections = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, sipe_http_transport_free); http->timeouts = g_queue_new(); } static void sipe_http_transport_connected(struct sipe_transport_connection *connection) { struct sipe_http_connection *conn = SIPE_HTTP_CONNECTION; struct sipe_core_private *sipe_private = conn->public.sipe_private; struct sipe_http *http = sipe_private->http; time_t current_time = time(NULL); SIPE_DEBUG_INFO("sipe_http_transport_connected: %s", conn->host_port); conn->public.connected = TRUE; /* add active connection to timeout queue */ conn->timeout = current_time + SIPE_HTTP_DEFAULT_TIMEOUT; g_queue_insert_sorted(http->timeouts, conn, timeout_compare, NULL); /* start timeout timer if necessary */ if (http->next_timeout == 0) start_timer(sipe_private, current_time); sipe_http_request_next(SIPE_HTTP_CONNECTION_PUBLIC); } static void sipe_http_transport_input(struct sipe_transport_connection *connection) { struct sipe_http_connection *conn = SIPE_HTTP_CONNECTION; char *current = connection->buffer; /* according to the RFC remove CRLF at the beginning */ while (*current == '\r' || *current == '\n') { current++; } if (current != connection->buffer) sipe_utils_shrink_buffer(connection, current); if ((current = strstr(connection->buffer, "\r\n\r\n")) != NULL) { struct sipmsg *msg; gboolean next; current += 2; current[0] = '\0'; msg = sipmsg_parse_header(connection->buffer); if (!msg) { /* restore header for next try */ current[0] = '\r'; return; } /* HTTP/1.1 Transfer-Encoding: chunked */ if (msg->bodylen == SIPMSG_BODYLEN_CHUNKED) { gchar *start = current + 2; GSList *chunks = NULL; gboolean incomplete = TRUE; msg->bodylen = 0; while (strlen(start) > 0) { gchar *tmp; guint length = g_ascii_strtoll(start, &tmp, 16); guint remainder; struct _chunk { guint length; const gchar *start; } *chunk; /* Illegal number */ if ((length == 0) && (start == tmp)) break; msg->bodylen += length; /* Chunk header not finished yet */ tmp = strstr(tmp, "\r\n"); if (tmp == NULL) break; /* Chunk not finished yet */ tmp += 2; remainder = connection->buffer_used - (tmp - connection->buffer); if (remainder < length + 2) break; /* Next chunk */ start = tmp + length + 2; /* Body completed */ if (length == 0) { gchar *dummy = g_malloc(msg->bodylen + 1); gchar *p = dummy; GSList *entry = chunks; while (entry) { chunk = entry->data; memcpy(p, chunk->start, chunk->length); p += chunk->length; entry = entry->next; } p[0] = '\0'; msg->body = dummy; sipe_utils_message_debug("HTTP", connection->buffer, msg->body, FALSE); current = start; sipe_utils_shrink_buffer(connection, current); incomplete = FALSE; break; } /* Append completed chunk */ chunk = g_new0(struct _chunk, 1); chunk->length = length; chunk->start = tmp; chunks = g_slist_append(chunks, chunk); } if (chunks) sipe_utils_slist_free_full(chunks, g_free); if (incomplete) { /* restore header for next try */ sipmsg_free(msg); current[0] = '\r'; return; } } else { guint remainder = connection->buffer_used - (current + 2 - connection->buffer); if (remainder >= (guint) msg->bodylen) { char *dummy = g_malloc(msg->bodylen + 1); current += 2; memcpy(dummy, current, msg->bodylen); dummy[msg->bodylen] = '\0'; msg->body = dummy; current += msg->bodylen; sipe_utils_message_debug("HTTP", connection->buffer, msg->body, FALSE); sipe_utils_shrink_buffer(connection, current); } else { SIPE_DEBUG_INFO("sipe_http_transport_input: body too short (%d < %d, strlen %" G_GSIZE_FORMAT ") - ignoring message", remainder, msg->bodylen, strlen(connection->buffer)); /* restore header for next try */ sipmsg_free(msg); current[0] = '\r'; return; } } sipe_http_request_response(SIPE_HTTP_CONNECTION_PUBLIC, msg); next = sipe_http_request_pending(SIPE_HTTP_CONNECTION_PUBLIC); if (sipe_strcase_equal(sipmsg_find_header(msg, "Connection"), "close")) { /* drop backend connection */ SIPE_DEBUG_INFO("sipe_http_transport_input: server requested close '%s'", conn->host_port); sipe_backend_transport_disconnect(conn->connection); conn->connection = NULL; conn->public.connected = FALSE; /* if we have pending requests we need to trigger re-connect */ if (next) sipe_http_transport_new(conn->public.sipe_private, conn->public.host, conn->public.port, conn->use_tls); } else if (next) { /* trigger sending of next pending request */ sipe_http_request_next(SIPE_HTTP_CONNECTION_PUBLIC); } sipmsg_free(msg); } } static void sipe_http_transport_error(struct sipe_transport_connection *connection, const gchar *msg) { struct sipe_http_connection *conn = SIPE_HTTP_CONNECTION; sipe_http_transport_drop(conn->public.sipe_private->http, conn, msg); /* conn is no longer valid */ } struct sipe_http_connection_public *sipe_http_transport_new(struct sipe_core_private *sipe_private, const gchar *host_in, const guint32 port, gboolean use_tls) { struct sipe_http *http; struct sipe_http_connection *conn = NULL; /* host name matching should be case insensitive */ gchar *host = g_ascii_strdown(host_in, -1); gchar *host_port = g_strdup_printf("%s:%" G_GUINT32_FORMAT, host, port); sipe_http_init(sipe_private); http = sipe_private->http; if (http->shutting_down) { SIPE_DEBUG_ERROR("sipe_http_transport_new: new connection requested during shutdown: THIS SHOULD NOT HAPPEN! Debugging information:\n" "Host/Port: %s", host_port); } else { conn = g_hash_table_lookup(http->connections, host_port); if (conn) { /* re-establishing connection */ if (!conn->connection) { SIPE_DEBUG_INFO("sipe_http_transport_new: re-establishing %s", host_port); /* will be re-inserted after connect */ sipe_http_transport_update_timeout_queue(conn, TRUE); } } else { /* new connection */ SIPE_DEBUG_INFO("sipe_http_transport_new: new %s", host_port); conn = g_new0(struct sipe_http_connection, 1); conn->public.sipe_private = sipe_private; conn->public.host = g_strdup(host); conn->public.port = port; conn->host_port = host_port; conn->use_tls = use_tls; g_hash_table_insert(http->connections, host_port, conn); host_port = NULL; /* conn_private takes ownership of the key */ } if (!conn->connection) { sipe_connect_setup setup = { use_tls ? SIPE_TRANSPORT_TLS : SIPE_TRANSPORT_TCP, host, port, conn, sipe_http_transport_connected, sipe_http_transport_input, sipe_http_transport_error }; conn->public.connected = FALSE; conn->connection = sipe_backend_transport_connect(SIPE_CORE_PUBLIC, &setup); } } g_free(host_port); g_free(host); return(SIPE_HTTP_CONNECTION_PUBLIC); } void sipe_http_transport_send(struct sipe_http_connection_public *conn_public, const gchar *header, const gchar *body) { struct sipe_http_connection *conn = SIPE_HTTP_CONNECTION_PRIVATE; GString *message = g_string_new(header); g_string_append_printf(message, "\r\n%s", body ? body : ""); sipe_utils_message_debug("HTTP", message->str, NULL, TRUE); sipe_backend_transport_message(conn->connection, message->str); g_string_free(message, TRUE); sipe_http_transport_update_timeout_queue(conn, FALSE); } /* Local Variables: mode: c c-file-style: "bsd" indent-tabs-mode: t tab-width: 8 End: */
gpl-2.0
aldencolerain/mc2kernel
toolchain/share/doc/arm-marvell-linux-gnueabi/html/libc/Errors-in-Math-Functions.html
181665
<html lang="en"> <head> <title>Errors in Math Functions - The GNU C Library</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="The GNU C Library"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Mathematics.html#Mathematics" title="Mathematics"> <link rel="prev" href="Special-Functions.html#Special-Functions" title="Special Functions"> <link rel="next" href="Pseudo_002dRandom-Numbers.html#Pseudo_002dRandom-Numbers" title="Pseudo-Random Numbers"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This file documents the GNU C library. This is Edition 0.13, last updated 2011-07-19, of `The GNU C Library Reference Manual', for version 2.14 (EGLIBC). Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being ``Free Software Needs Free Documentation'' and ``GNU Lesser General Public License'', the Front-Cover texts being ``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled "GNU Free Documentation License". (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and modify this GNU manual. Buying copies from the FSF supports it in developing GNU and promoting software freedom.''--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Errors-in-Math-Functions"></a> <p> Next:&nbsp;<a rel="next" accesskey="n" href="Pseudo_002dRandom-Numbers.html#Pseudo_002dRandom-Numbers">Pseudo-Random Numbers</a>, Previous:&nbsp;<a rel="previous" accesskey="p" href="Special-Functions.html#Special-Functions">Special Functions</a>, Up:&nbsp;<a rel="up" accesskey="u" href="Mathematics.html#Mathematics">Mathematics</a> <hr> </div> <h3 class="section">19.7 Known Maximum Errors in Math Functions</h3> <p><a name="index-math-errors-2279"></a><a name="index-ulps-2280"></a> This section lists the known errors of the functions in the math library. Errors are measured in &ldquo;units of the last place&rdquo;. This is a measure for the relative error. For a number z with the representation d.d<small class="dots">...</small>d&amp;middot;2^e (we assume IEEE floating-point numbers with base 2) the ULP is represented by <pre class="smallexample"> |d.d...d - (z / 2^e)| / 2^(p - 1) </pre> <p class="noindent">where p is the number of bits in the mantissa of the floating-point number representation. Ideally the error for all functions is always less than 0.5ulps. Using rounding bits this is also possible and normally implemented for the basic operations. To achieve the same for the complex math functions requires a lot more work and this has not yet been done. <p>Therefore many of the functions in the math library have errors. The table lists the maximum error for each function which is exposed by one of the existing tests in the test suite. The table tries to cover as much as possible and list the actual maximum error (or at least a ballpark figure) but this is often not achieved due to the large search space. <p>The table lists the ULP values for different architectures. Different architectures have different results since their hardware support for floating-point operations varies and also the existing hardware support is different. <!-- This multitable does not fit on a single page --> <p><table summary=""><tr align="left"><td valign="top">Function </td><td valign="top">Alpha </td><td valign="top">ARM </td><td valign="top">hppa/fpu </td><td valign="top">m68k/coldfire/fpu </td><td valign="top">m68k/m680x0/fpu <br></td></tr><tr align="left"><td valign="top">acosf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acos </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acosl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acoshf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acosh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acoshl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">asinf </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asin </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">atanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanhf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanh </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">atan2f </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan2l </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">cabsf </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cabs </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cabsl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacosf </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">2 + i 1 <br></td></tr><tr align="left"><td valign="top">cacos </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacosl </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 2 <br></td></tr><tr align="left"><td valign="top">cacoshf </td><td valign="top">0 + i 1 </td><td valign="top">7 + i 3 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">7 + i 1 <br></td></tr><tr align="left"><td valign="top">cacosh </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">cacoshl </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">6 + i 2 <br></td></tr><tr align="left"><td valign="top">cargf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">carg </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cargl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casinf </td><td valign="top">1 + i 0 </td><td valign="top">2 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">5 + i 1 <br></td></tr><tr align="left"><td valign="top">casin </td><td valign="top">1 + i 0 </td><td valign="top">3 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">casinl </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">3 + i 2 <br></td></tr><tr align="left"><td valign="top">casinhf </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">19 + i 1 <br></td></tr><tr align="left"><td valign="top">casinh </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">6 + i 13 <br></td></tr><tr align="left"><td valign="top">casinhl </td><td valign="top">4 + i 2 </td><td valign="top">- </td><td valign="top">5 + i 3 </td><td valign="top">- </td><td valign="top">5 + i 6 <br></td></tr><tr align="left"><td valign="top">catanf </td><td valign="top">0 + i 1 </td><td valign="top">4 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">catan </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">catanl </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">catanhf </td><td valign="top">- </td><td valign="top">1 + i 6 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanh </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 1 </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanhl </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">4 + i 0 </td><td valign="top">- </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">cbrtf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cbrt </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cbrtl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">ccosf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccos </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccosl </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccoshf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccosh </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccoshl </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">ceilf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceil </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceill </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cexpf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">2 + i 1 <br></td></tr><tr align="left"><td valign="top">cexp </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cexpl </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">cimagf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimag </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimagl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clogf </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 3 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">clog </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clogl </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">clog10f </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 5 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">clog10 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">clog10l </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">1 + i 2 <br></td></tr><tr align="left"><td valign="top">conjf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conj </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conjl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysignf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysign </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysignl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cosf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">cos </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">cosl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">coshf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cosh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">coshl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cpowf </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 2 </td><td valign="top">2 + i 6 <br></td></tr><tr align="left"><td valign="top">cpow </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">1 + i 2 <br></td></tr><tr align="left"><td valign="top">cpowl </td><td valign="top">10 + i 1 </td><td valign="top">- </td><td valign="top">2 + i 2 </td><td valign="top">- </td><td valign="top">15 + i 2 <br></td></tr><tr align="left"><td valign="top">cprojf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cproj </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cprojl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">crealf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">creal </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">creall </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinf </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">csin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinl </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">csinhf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">csinh </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinhl </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">csqrtf </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csqrt </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csqrtl </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctanf </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctan </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">ctanl </td><td valign="top">1 + i 2 </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">1 + i 2 <br></td></tr><tr align="left"><td valign="top">ctanhf </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">ctanh </td><td valign="top">1 + i 0 </td><td valign="top">2 + i 2 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">ctanhl </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">erff </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfcf </td><td valign="top">- </td><td valign="top">12 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">erfc </td><td valign="top">1 </td><td valign="top">24 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfcl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">expf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp10f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp10 </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp10l </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">6 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2f </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2l </td><td valign="top">2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expm1f </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expm1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expm1l </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">fabsf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabs </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabsl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdimf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdim </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdiml </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floorf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floor </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floorl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fma </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmal </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaxf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmax </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaxl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fminf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fminl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmodf </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmod </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmodl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexpf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexpl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gammaf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gamma </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gammal </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">hypotf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">hypot </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">hypotl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j0f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">j0 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">j0l </td><td valign="top">2 </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">j1f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">j1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j1l </td><td valign="top">4 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">jnf </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">5 <br></td></tr><tr align="left"><td valign="top">jn </td><td valign="top">4 </td><td valign="top">6 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">jnl </td><td valign="top">4 </td><td valign="top">- </td><td valign="top">4 </td><td valign="top">- </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">lgammaf </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">lgamma </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">lgammal </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">lrintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logf </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log10f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log10 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log10l </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">log1pf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log1p </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log1pl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log2f </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log2 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log2l </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">logbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lroundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lround </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lroundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llroundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llround </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llroundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modff </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modfl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafterf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafter </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafterl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttowardf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttoward </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttowardl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">powf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">pow </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">powl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">remainderf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainder </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainderl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquof </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquo </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquol </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">roundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">round </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">roundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbnf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbn </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbnl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalblnf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbln </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalblnl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sincosf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sincos </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sincosl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sinhf </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinh </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sqrtf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrt </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrtl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tan </td><td valign="top">1 </td><td valign="top">0.5 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tanl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tanhf </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanh </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanhl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tgammaf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tgamma </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tgammal </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">truncf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">trunc </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">truncl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y0f </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">y0 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">y0l </td><td valign="top">3 </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">- </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">y1f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">y1 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">y1l </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">3 </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">ynf </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">yn </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">ynl </td><td valign="top">5 </td><td valign="top">- </td><td valign="top">3 </td><td valign="top">- </td><td valign="top">4 <br></td></tr></table> <p><table summary=""><tr align="left"><td valign="top">Function </td><td valign="top">MIPS </td><td valign="top">mips/mips64/n32 </td><td valign="top">mips/mips64/n64 </td><td valign="top">powerpc/nofpu </td><td valign="top">Generic <br></td></tr><tr align="left"><td valign="top">acosf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acos </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acosl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acoshf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acosh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acoshl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanhf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan2f </td><td valign="top">3 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">3 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan2l </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cabsf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cabs </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cabsl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacosf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacos </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacosl </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacoshf </td><td valign="top">7 + i 3 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">7 + i 3 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacosh </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacoshl </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cargf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">carg </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cargl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casinf </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casin </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casinl </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casinhf </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casinh </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casinhl </td><td valign="top">- </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanf </td><td valign="top">4 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">4 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catan </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanl </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanhf </td><td valign="top">0 + i 6 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 6 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanh </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanhl </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cbrtf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cbrt </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cbrtl </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccosf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccos </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccosl </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccoshf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccosh </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccoshl </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceilf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceil </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceill </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cexpf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cexp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cexpl </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimagf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimag </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimagl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clogf </td><td valign="top">1 + i 3 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 3 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clog </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clogl </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">2 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clog10f </td><td valign="top">1 + i 5 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 5 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clog10 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clog10l </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">3 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conjf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conj </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conjl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysignf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysign </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysignl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cosf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cos </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cosl </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">coshf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cosh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">coshl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cpowf </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cpow </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cpowl </td><td valign="top">- </td><td valign="top">10 + i 1 </td><td valign="top">10 + i 1 </td><td valign="top">2 + i 2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cprojf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cproj </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cprojl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">crealf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">creal </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">creall </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinl </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinhf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinh </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinhl </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csqrtf </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csqrt </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csqrtl </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctan </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctanl </td><td valign="top">- </td><td valign="top">1 + i 2 </td><td valign="top">1 + i 2 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctanhf </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctanh </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctanhl </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erff </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfcf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfc </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfcl </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp10f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp10 </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp10l </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">8 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2f </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2l </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expm1f </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expm1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expm1l </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabsf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabs </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabsl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdimf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdim </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdiml </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floorf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floor </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floorl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fma </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmal </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaxf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmax </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaxl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fminf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fminl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmodf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmod </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmodl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexpf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexpl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gammaf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gamma </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gammal </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">hypotf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">hypot </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">hypotl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j0f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j0 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j0l </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j1f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j1l </td><td valign="top">- </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">jnf </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">jn </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">jnl </td><td valign="top">- </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lgammaf </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lgamma </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lgammal </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">3 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log10f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log10 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log10l </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log1pf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log1p </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log1pl </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log2f </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log2l </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lroundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lround </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lroundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llroundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llround </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llroundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modff </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modfl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafterf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafter </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafterl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttowardf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttoward </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttowardl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">powf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">pow </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">powl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainderf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainder </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainderl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquof </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquo </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquol </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">roundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">round </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">roundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbnf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbn </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbnl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalblnf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbln </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalblnl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sincosf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sincos </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sincosl </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrtf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrt </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrtl </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tan </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanhl </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tgammaf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tgamma </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tgammal </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">truncf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">trunc </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">truncl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y0f </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y0 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y0l </td><td valign="top">- </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y1f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y1 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y1l </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ynf </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">yn </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ynl </td><td valign="top">- </td><td valign="top">5 </td><td valign="top">5 </td><td valign="top">2 </td><td valign="top">- <br></td></tr></table> <p><table summary=""><tr align="left"><td valign="top">Function </td><td valign="top">ix86 </td><td valign="top">IA64 </td><td valign="top">PowerPC </td><td valign="top">S/390 </td><td valign="top">SH4 <br></td></tr><tr align="left"><td valign="top">acosf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acos </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acosl </td><td valign="top">622 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acoshf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acosh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acoshl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">asin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">asinl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">atanhl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan2f </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">4 <br></td></tr><tr align="left"><td valign="top">atan2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan2l </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cabsf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">cabs </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">cabsl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacosf </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">cacos </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">cacosl </td><td valign="top">0 + i 2 </td><td valign="top">0 + i 2 </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacoshf </td><td valign="top">9 + i 4 </td><td valign="top">7 + i 0 </td><td valign="top">7 + i 3 </td><td valign="top">7 + i 3 </td><td valign="top">7 + i 3 <br></td></tr><tr align="left"><td valign="top">cacosh </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">cacoshl </td><td valign="top">6 + i 1 </td><td valign="top">7 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cargf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">carg </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cargl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casinf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">2 + i 1 <br></td></tr><tr align="left"><td valign="top">casin </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">3 + i 0 <br></td></tr><tr align="left"><td valign="top">casinl </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casinhf </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 <br></td></tr><tr align="left"><td valign="top">casinh </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 <br></td></tr><tr align="left"><td valign="top">casinhl </td><td valign="top">5 + i 5 </td><td valign="top">5 + i 5 </td><td valign="top">4 + i 1 </td><td valign="top">4 + i 2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanf </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">4 + i 1 </td><td valign="top">4 + i 1 </td><td valign="top">4 + i 1 <br></td></tr><tr align="left"><td valign="top">catan </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">catanl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanhf </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">0 + i 6 </td><td valign="top">0 + i 6 </td><td valign="top">1 + i 6 <br></td></tr><tr align="left"><td valign="top">catanh </td><td valign="top">2 + i 0 </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 1 <br></td></tr><tr align="left"><td valign="top">catanhl </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cbrtf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cbrt </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">cbrtl </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccosf </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">ccos </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccosl </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ccoshf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccosh </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccoshl </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 2 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceilf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceil </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceill </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cexpf </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">cexp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">cexpl </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimagf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimag </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimagl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clogf </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 3 </td><td valign="top">1 + i 3 </td><td valign="top">0 + i 3 <br></td></tr><tr align="left"><td valign="top">clog </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">clogl </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">2 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clog10f </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 5 </td><td valign="top">1 + i 5 </td><td valign="top">1 + i 5 <br></td></tr><tr align="left"><td valign="top">clog10 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">clog10l </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">3 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conjf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conj </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conjl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysignf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysign </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysignl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cosf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">cos </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">cosl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">coshf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cosh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">coshl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cpowf </td><td valign="top">4 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 2 </td><td valign="top">5 + i 2 </td><td valign="top">4 + i 2 <br></td></tr><tr align="left"><td valign="top">cpow </td><td valign="top">1 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">1 + i 1.1031 <br></td></tr><tr align="left"><td valign="top">cpowl </td><td valign="top">763 + i 2 </td><td valign="top">6 + i 4 </td><td valign="top">2 + i 2 </td><td valign="top">10 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cprojf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cproj </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cprojl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">crealf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">creal </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">creall </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">csin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinl </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinhf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">csinh </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">csinhl </td><td valign="top">1 + i 2 </td><td valign="top">1 + i 2 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csqrtf </td><td valign="top">- </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">csqrt </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">csqrtl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctanf </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ctan </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ctanl </td><td valign="top">439 + i 3 </td><td valign="top">2 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctanhf </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 <br></td></tr><tr align="left"><td valign="top">ctanh </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">2 + i 2 <br></td></tr><tr align="left"><td valign="top">ctanhl </td><td valign="top">5 + i 25 </td><td valign="top">1 + i 24 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erff </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfcf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">12 <br></td></tr><tr align="left"><td valign="top">erfc </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">24 <br></td></tr><tr align="left"><td valign="top">erfcl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp10f </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">exp10 </td><td valign="top">- </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">6 <br></td></tr><tr align="left"><td valign="top">exp10l </td><td valign="top">8 </td><td valign="top">3 </td><td valign="top">8 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2f </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2l </td><td valign="top">- </td><td valign="top">- </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expm1f </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">expm1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expm1l </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabsf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabs </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabsl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdimf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdim </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdiml </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floorf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floor </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floorl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fma </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmal </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaxf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmax </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaxl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fminf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fminl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmodf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">fmod </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">fmodl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexpf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexpl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gammaf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gamma </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gammal </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">hypotf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">hypot </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">hypotl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j0f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">j0 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">j0l </td><td valign="top">1 </td><td valign="top">2 </td><td valign="top">1 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j1f </td><td valign="top">1 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">j1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">j1l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">4 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">jnf </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">5 </td><td valign="top">5 </td><td valign="top">4 <br></td></tr><tr align="left"><td valign="top">jn </td><td valign="top">5 </td><td valign="top">3 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">6 <br></td></tr><tr align="left"><td valign="top">jnl </td><td valign="top">750 </td><td valign="top">2 </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lgammaf </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">lgamma </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">lgammal </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">3 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">logl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log10f </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log10 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log10l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log1pf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log1p </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log1pl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log2f </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log2l </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lroundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lround </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lroundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llroundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llround </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llroundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modff </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modfl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafterf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafter </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafterl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttowardf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttoward </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttowardl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">powf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">pow </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">powl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainderf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainder </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainderl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquof </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquo </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquol </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">roundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">round </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">roundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbnf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbn </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbnl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalblnf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbln </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalblnl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sincosf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sincos </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sincosl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sinh </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sinhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrtf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrt </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrtl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tan </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">0.5 <br></td></tr><tr align="left"><td valign="top">tanl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tanh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tanhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tgammaf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tgamma </td><td valign="top">2 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tgammal </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">truncf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">trunc </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">truncl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y0f </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">y0 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">y0l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">3 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y1f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">y1 </td><td valign="top">2 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 <br></td></tr><tr align="left"><td valign="top">y1l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">2 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ynf </td><td valign="top">3 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">yn </td><td valign="top">2 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 <br></td></tr><tr align="left"><td valign="top">ynl </td><td valign="top">4 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">5 </td><td valign="top">- <br></td></tr></table> <p><table summary=""><tr align="left"><td valign="top">Function </td><td valign="top">Sparc 32-bit </td><td valign="top">Sparc 64-bit </td><td valign="top">x86_64/fpu <br></td></tr><tr align="left"><td valign="top">acosf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acos </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acosl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">acoshf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acosh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">acoshl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">asinhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">asinhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanhf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">atanh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atanhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">atan2f </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">atan2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">atan2l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cabsf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cabs </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cabsl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacosf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">cacos </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cacosl </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 2 <br></td></tr><tr align="left"><td valign="top">cacoshf </td><td valign="top">7 + i 3 </td><td valign="top">7 + i 3 </td><td valign="top">7 + i 3 <br></td></tr><tr align="left"><td valign="top">cacosh </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">cacoshl </td><td valign="top">5 + i 1 </td><td valign="top">5 + i 1 </td><td valign="top">6 + i 1 <br></td></tr><tr align="left"><td valign="top">cargf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">carg </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cargl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">casinf </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">casin </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">casinl </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">2 + i 2 <br></td></tr><tr align="left"><td valign="top">casinhf </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 </td><td valign="top">1 + i 6 <br></td></tr><tr align="left"><td valign="top">casinh </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 </td><td valign="top">5 + i 3 <br></td></tr><tr align="left"><td valign="top">casinhl </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 2 </td><td valign="top">5 + i 5 <br></td></tr><tr align="left"><td valign="top">catanf </td><td valign="top">4 + i 1 </td><td valign="top">4 + i 1 </td><td valign="top">4 + i 1 <br></td></tr><tr align="left"><td valign="top">catan </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">catanl </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">catanhf </td><td valign="top">0 + i 6 </td><td valign="top">0 + i 6 </td><td valign="top">0 + i 6 <br></td></tr><tr align="left"><td valign="top">catanh </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 0 </td><td valign="top">4 + i 0 <br></td></tr><tr align="left"><td valign="top">catanhl </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">cbrtf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cbrt </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">cbrtl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">ccosf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccos </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">ccosl </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccoshf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccosh </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ccoshl </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">ceilf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceil </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ceill </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cexpf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">cexp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cexpl </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">cimagf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimag </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cimagl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clogf </td><td valign="top">1 + i 3 </td><td valign="top">1 + i 3 </td><td valign="top">1 + i 3 <br></td></tr><tr align="left"><td valign="top">clog </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">clogl </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">clog10f </td><td valign="top">1 + i 5 </td><td valign="top">1 + i 5 </td><td valign="top">1 + i 5 <br></td></tr><tr align="left"><td valign="top">clog10 </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">clog10l </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">conjf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conj </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">conjl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysignf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysign </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">copysignl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cosf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">cos </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">cosl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">coshf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cosh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">coshl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cpowf </td><td valign="top">4 + i 2 </td><td valign="top">4 + i 2 </td><td valign="top">5 + i 2 <br></td></tr><tr align="left"><td valign="top">cpow </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 </td><td valign="top">2 + i 2 <br></td></tr><tr align="left"><td valign="top">cpowl </td><td valign="top">10 + i 1 </td><td valign="top">10 + i 1 </td><td valign="top">5 + i 4 <br></td></tr><tr align="left"><td valign="top">cprojf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cproj </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">cprojl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">crealf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">creal </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">creall </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csinf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">csin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">csinl </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">csinhf </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">csinh </td><td valign="top">0 + i 1 </td><td valign="top">0 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">csinhl </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 2 <br></td></tr><tr align="left"><td valign="top">csqrtf </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 <br></td></tr><tr align="left"><td valign="top">csqrt </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">csqrtl </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ctanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">0 + i 1 <br></td></tr><tr align="left"><td valign="top">ctan </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ctanl </td><td valign="top">1 + i 2 </td><td valign="top">1 + i 2 </td><td valign="top">439 + i 3 <br></td></tr><tr align="left"><td valign="top">ctanhf </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 </td><td valign="top">2 + i 1 <br></td></tr><tr align="left"><td valign="top">ctanh </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 0 </td><td valign="top">1 + i 1 <br></td></tr><tr align="left"><td valign="top">ctanhl </td><td valign="top">1 + i 1 </td><td valign="top">1 + i 1 </td><td valign="top">5 + i 25 <br></td></tr><tr align="left"><td valign="top">erff </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">erfl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfcf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">erfc </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">erfcl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">expf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp10f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">exp10 </td><td valign="top">6 </td><td valign="top">6 </td><td valign="top">6 <br></td></tr><tr align="left"><td valign="top">exp10l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">8 <br></td></tr><tr align="left"><td valign="top">exp2f </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">exp2l </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">expm1f </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">expm1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">expm1l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabsf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabs </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fabsl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdimf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdim </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fdiml </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floorf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floor </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">floorl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fma </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmal </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaxf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmax </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmaxl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fminf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fminl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmodf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmod </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">fmodl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexpf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexp </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">frexpl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gammaf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gamma </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">gammal </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">hypotf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">hypot </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">hypotl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">ilogbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">j0f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">j0 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">j0l </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">j1f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">j1 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">j1l </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">jnf </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">5 <br></td></tr><tr align="left"><td valign="top">jn </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">4 <br></td></tr><tr align="left"><td valign="top">jnl </td><td valign="top">4 </td><td valign="top">4 </td><td valign="top">750 <br></td></tr><tr align="left"><td valign="top">lgammaf </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">lgamma </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">lgammal </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">lrintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lrintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llrintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log10f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">log10 </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log10l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log1pf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">log1p </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log1pl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log2f </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log2 </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">log2l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">logbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lroundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lround </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">lroundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llroundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llround </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">llroundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modff </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">modfl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nearbyintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafterf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafter </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nextafterl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttowardf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttoward </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">nexttowardl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">powf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">pow </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">powl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainderf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainder </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remainderl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquof </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquo </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">remquol </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rintf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rint </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">rintl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">roundf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">round </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">roundl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalb </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbnf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbn </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbnl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalblnf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalbln </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">scalblnl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sin </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sincosf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sincos </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sincosl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sinhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sinhl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">sqrtf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrt </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">sqrtl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tan </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tanl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanhf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanh </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tanhl </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">tgammaf </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tgamma </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">tgammal </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">truncf </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">trunc </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">truncl </td><td valign="top">- </td><td valign="top">- </td><td valign="top">- <br></td></tr><tr align="left"><td valign="top">y0f </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">y0 </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">y0l </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">y1f </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">y1 </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 <br></td></tr><tr align="left"><td valign="top">y1l </td><td valign="top">1 </td><td valign="top">1 </td><td valign="top">1 <br></td></tr><tr align="left"><td valign="top">ynf </td><td valign="top">2 </td><td valign="top">2 </td><td valign="top">2 <br></td></tr><tr align="left"><td valign="top">yn </td><td valign="top">3 </td><td valign="top">3 </td><td valign="top">3 <br></td></tr><tr align="left"><td valign="top">ynl </td><td valign="top">5 </td><td valign="top">5 </td><td valign="top">4 <br></td></tr></table> </body></html>
gpl-2.0
Bremaweb/streber
js/ninja.js
2022
(function ($) { 'use strict'; function Ninja() { this.keys = { arrowDown: 40, arrowLeft: 37, arrowRight: 39, arrowUp: 38, enter: 13, escape: 27, tab: 9 }; this.version = '0.0.0development'; } Ninja.prototype.log = function (message) { if (console && 'log' in console) { console.log('Ninja: ' + message); } }; Ninja.prototype.warn = function (message) { if (console && 'warn' in console) { console.warn('Ninja: ' + message); } }; Ninja.prototype.error = function (message) { var fullMessage = 'Ninja: ' + message; if (console && 'error' in console) { console.error(fullMessage); } throw fullMessage; }; Ninja.prototype.key = function (code, names) { var keys = this.keys, codes = $.map(names, function (name) { return keys[name]; }); return $.inArray(code, codes) > -1; }; $.Ninja = function (element, options) { if ($.isPlainObject(element)) { this.$element = $('<span>'); this.options = element; } else { this.$element = $(element); this.options = options || {}; } }; $.Ninja.prototype.deselect = function () { if (this.$element.hasClass('nui-slc') && !this.$element.hasClass('nui-dsb')) { this.$element.trigger('deselect.ninja'); } }; $.Ninja.prototype.disable = function () { this.$element.addClass('nui-dsb').trigger('disable.ninja'); }; $.Ninja.prototype.enable = function () { this.$element.removeClass('nui-dsb').trigger('enable.ninja'); }; $.Ninja.prototype.select = function () { if (!this.$element.hasClass('nui-dsb')) { this.$element.trigger('select.ninja'); } }; $.ninja = new Ninja(); $.fn.ninja = function (component, options) { return this.each(function () { if (!$.data(this, 'ninja.' + component)) { $.data(this, 'ninja.' + component); $.ninja[component](this, options); } }); }; }(jQuery));
gpl-2.0
alesaiko/UK-PRO5
drivers/input/keyboard/gpio_keys.c
26024
/* * Driver for keys on GPIO lines capable of generating interrupts. * * Copyright 2005 Phil Blundell * Copyright 2010, 2011 David Jander <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/module.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/sched.h> #include <linux/pm.h> #include <linux/slab.h> #include <linux/sysctl.h> #include <linux/proc_fs.h> #include <linux/delay.h> #include <linux/platform_device.h> #include <linux/input.h> #include <linux/gpio_keys.h> #include <linux/workqueue.h> #include <linux/gpio.h> #include <linux/of_platform.h> #include <linux/of_gpio.h> #include <linux/of_irq.h> #include <linux/spinlock.h> #include <linux/meizu-sys.h> #ifdef CONFIG_AUTO_SLEEP_WAKEUP_TEST #include <linux/notifier.h> #include <linux/auto_sleep_wakeup_test.h> #endif #if defined(CONFIG_JANUARY_BOOSTER) && defined(CONFIG_KEY_BOOSTER) #include <linux/input/janeps_booster.h> #endif #define LINK_KOBJ_NAME "key" struct gpio_button_data { const struct gpio_keys_button *button; struct input_dev *input; struct timer_list timer; struct work_struct work; unsigned int timer_debounce; /* in msecs */ unsigned int irq; spinlock_t lock; bool disabled; bool key_pressed; }; struct gpio_keys_drvdata { const struct gpio_keys_platform_data *pdata; struct input_dev *input; struct mutex disable_lock; #ifdef CONFIG_AUTO_SLEEP_WAKEUP_TEST struct notifier_block auto_sleep_wakeup_test_notifier_block; #endif struct gpio_button_data data[0]; }; static BLOCKING_NOTIFIER_HEAD(hall_notifier_list); /** * input_register_notifier_client - register a input client notifier * @nb: notifier block to callback on events */ int hall_register_notifier_client(struct notifier_block *nb) { return blocking_notifier_chain_register(&hall_notifier_list, nb); } EXPORT_SYMBOL(hall_register_notifier_client); /** * input_unregister_notifier_client - unregister a input client notifier * @nb: notifier block to callback on events */ int hall_unregister_notifier_client(struct notifier_block *nb) { return blocking_notifier_chain_unregister(&hall_notifier_list, nb); } EXPORT_SYMBOL(hall_unregister_notifier_client); /** * input_notifier_call_chain - notify clients of input event. * */ int hall_notifier_call_chain(unsigned long val, void *v) { return blocking_notifier_call_chain(&hall_notifier_list, val, v); } EXPORT_SYMBOL_GPL(hall_notifier_call_chain); /* * SYSFS interface for enabling/disabling keys and switches: * * There are 4 attributes under /sys/devices/platform/gpio-keys/ * keys [ro] - bitmap of keys (EV_KEY) which can be * disabled * switches [ro] - bitmap of switches (EV_SW) which can be * disabled * disabled_keys [rw] - bitmap of keys currently disabled * disabled_switches [rw] - bitmap of switches currently disabled * * Userland can change these values and hence disable event generation * for each key (or switch). Disabling a key means its interrupt line * is disabled. * * For example, if we have following switches set up as gpio-keys: * SW_DOCK = 5 * SW_CAMERA_LENS_COVER = 9 * SW_KEYPAD_SLIDE = 10 * SW_FRONT_PROXIMITY = 11 * This is read from switches: * 11-9,5 * Next we want to disable proximity (11) and dock (5), we write: * 11,5 * to file disabled_switches. Now proximity and dock IRQs are disabled. * This can be verified by reading the file disabled_switches: * 11,5 * If we now want to enable proximity (11) switch we write: * 5 * to disabled_switches. * * We can disable only those keys which don't allow sharing the irq. */ /** * get_n_events_by_type() - returns maximum number of events per @type * @type: type of button (%EV_KEY, %EV_SW) * * Return value of this function can be used to allocate bitmap * large enough to hold all bits for given type. */ static inline int get_n_events_by_type(int type) { BUG_ON(type != EV_SW && type != EV_KEY); return (type == EV_KEY) ? KEY_CNT : SW_CNT; } /** * gpio_keys_disable_button() - disables given GPIO button * @bdata: button data for button to be disabled * * Disables button pointed by @bdata. This is done by masking * IRQ line. After this function is called, button won't generate * input events anymore. Note that one can only disable buttons * that don't share IRQs. * * Make sure that @bdata->disable_lock is locked when entering * this function to avoid races when concurrent threads are * disabling buttons at the same time. */ static void gpio_keys_disable_button(struct gpio_button_data *bdata) { if (!bdata->disabled) { /* * Disable IRQ and possible debouncing timer. */ disable_irq(bdata->irq); if (bdata->timer_debounce) del_timer_sync(&bdata->timer); bdata->disabled = true; } } /** * gpio_keys_enable_button() - enables given GPIO button * @bdata: button data for button to be disabled * * Enables given button pointed by @bdata. * * Make sure that @bdata->disable_lock is locked when entering * this function to avoid races with concurrent threads trying * to enable the same button at the same time. */ static void gpio_keys_enable_button(struct gpio_button_data *bdata) { if (bdata->disabled) { enable_irq(bdata->irq); bdata->disabled = false; } } /** * gpio_keys_attr_show_helper() - fill in stringified bitmap of buttons * @ddata: pointer to drvdata * @buf: buffer where stringified bitmap is written * @type: button type (%EV_KEY, %EV_SW) * @only_disabled: does caller want only those buttons that are * currently disabled or all buttons that can be * disabled * * This function writes buttons that can be disabled to @buf. If * @only_disabled is true, then @buf contains only those buttons * that are currently disabled. Returns 0 on success or negative * errno on failure. */ static ssize_t gpio_keys_attr_show_helper(struct gpio_keys_drvdata *ddata, char *buf, unsigned int type, bool only_disabled) { int n_events = get_n_events_by_type(type); unsigned long *bits; ssize_t ret; int i; bits = kcalloc(BITS_TO_LONGS(n_events), sizeof(*bits), GFP_KERNEL); if (!bits) return -ENOMEM; for (i = 0; i < ddata->pdata->nbuttons; i++) { struct gpio_button_data *bdata = &ddata->data[i]; if (bdata->button->type != type) continue; if (only_disabled && !bdata->disabled) continue; __set_bit(bdata->button->code, bits); } ret = bitmap_scnlistprintf(buf, PAGE_SIZE - 2, bits, n_events); buf[ret++] = '\n'; buf[ret] = '\0'; kfree(bits); return ret; } /** * gpio_keys_attr_store_helper() - enable/disable buttons based on given bitmap * @ddata: pointer to drvdata * @buf: buffer from userspace that contains stringified bitmap * @type: button type (%EV_KEY, %EV_SW) * * This function parses stringified bitmap from @buf and disables/enables * GPIO buttons accordingly. Returns 0 on success and negative error * on failure. */ static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata, const char *buf, unsigned int type) { int n_events = get_n_events_by_type(type); unsigned long *bits; ssize_t error; int i; bits = kcalloc(BITS_TO_LONGS(n_events), sizeof(*bits), GFP_KERNEL); if (!bits) return -ENOMEM; error = bitmap_parselist(buf, bits, n_events); if (error) goto out; /* First validate */ for (i = 0; i < ddata->pdata->nbuttons; i++) { struct gpio_button_data *bdata = &ddata->data[i]; if (bdata->button->type != type) continue; if (test_bit(bdata->button->code, bits) && !bdata->button->can_disable) { error = -EINVAL; goto out; } } mutex_lock(&ddata->disable_lock); for (i = 0; i < ddata->pdata->nbuttons; i++) { struct gpio_button_data *bdata = &ddata->data[i]; if (bdata->button->type != type) continue; if (test_bit(bdata->button->code, bits)) gpio_keys_disable_button(bdata); else gpio_keys_enable_button(bdata); } mutex_unlock(&ddata->disable_lock); out: kfree(bits); return error; } #define ATTR_SHOW_FN(name, type, only_disabled) \ static ssize_t gpio_keys_show_##name(struct device *dev, \ struct device_attribute *attr, \ char *buf) \ { \ struct platform_device *pdev = to_platform_device(dev); \ struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); \ \ return gpio_keys_attr_show_helper(ddata, buf, \ type, only_disabled); \ } ATTR_SHOW_FN(keys, EV_KEY, false); ATTR_SHOW_FN(switches, EV_SW, false); ATTR_SHOW_FN(disabled_keys, EV_KEY, true); ATTR_SHOW_FN(disabled_switches, EV_SW, true); /* * ATTRIBUTES: * * /sys/devices/platform/gpio-keys/keys [ro] * /sys/devices/platform/gpio-keys/switches [ro] */ static DEVICE_ATTR(keys, S_IRUGO, gpio_keys_show_keys, NULL); static DEVICE_ATTR(switches, S_IRUGO, gpio_keys_show_switches, NULL); #define ATTR_STORE_FN(name, type) \ static ssize_t gpio_keys_store_##name(struct device *dev, \ struct device_attribute *attr, \ const char *buf, \ size_t count) \ { \ struct platform_device *pdev = to_platform_device(dev); \ struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); \ ssize_t error; \ \ error = gpio_keys_attr_store_helper(ddata, buf, type); \ if (error) \ return error; \ \ return count; \ } ATTR_STORE_FN(disabled_keys, EV_KEY); ATTR_STORE_FN(disabled_switches, EV_SW); /* /sys/class/meizu/key/hall_status * 1: near * 0: far */ static unsigned int hall_state = 0; static ssize_t gpio_keys_show_hall(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", hall_state); } static DEVICE_ATTR(hall_status, S_IRUGO, gpio_keys_show_hall, NULL); /* * ATTRIBUTES: * * /sys/devices/platform/gpio-keys/disabled_keys [rw] * /sys/devices/platform/gpio-keys/disables_switches [rw] */ static DEVICE_ATTR(disabled_keys, S_IWUSR | S_IRUGO, gpio_keys_show_disabled_keys, gpio_keys_store_disabled_keys); static DEVICE_ATTR(disabled_switches, S_IWUSR | S_IRUGO, gpio_keys_show_disabled_switches, gpio_keys_store_disabled_switches); static struct attribute *gpio_keys_attrs[] = { &dev_attr_hall_status.attr, &dev_attr_keys.attr, &dev_attr_switches.attr, &dev_attr_disabled_keys.attr, &dev_attr_disabled_switches.attr, NULL, }; static struct attribute_group gpio_keys_attr_group = { .attrs = gpio_keys_attrs, }; extern int key_input_report(int evt_type); static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) { const struct gpio_keys_button *button = bdata->button; struct input_dev *input = bdata->input; unsigned int type = button->type ?: EV_KEY; int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio)); if (type == EV_ABS) { if (state) input_event(input, type, button->code, button->value); } else { input_event(input, type, button->code, irqd_is_wakeup_set(&desc->irq_data) ? 1 : !!state); if(type == EV_SW){ if(!!state){ hall_state = 1; hall_notifier_call_chain(1, NULL); }else{ hall_state = 0; hall_notifier_call_chain(0, NULL); } } } input_sync(input); #if defined(CONFIG_JANUARY_BOOSTER) && defined(CONFIG_KEY_BOOSTER) if (type != EV_ABS) janeps_input_report(!!state ? DOWN : UP, 0, 0); #elif defined(CONFIG_INPUT_KEY_BOOSTER) if (type != EV_ABS) key_input_report(!!state ? 1 : 0); #endif } static void gpio_keys_gpio_work_func(struct work_struct *work) { struct gpio_button_data *bdata = container_of(work, struct gpio_button_data, work); gpio_keys_gpio_report_event(bdata); if (bdata->button->wakeup) pm_relax(bdata->input->dev.parent); } static void gpio_keys_gpio_timer(unsigned long _data) { struct gpio_button_data *bdata = (struct gpio_button_data *)_data; schedule_work(&bdata->work); } static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) { struct gpio_button_data *bdata = dev_id; BUG_ON(irq != bdata->irq); if (bdata->button->wakeup) pm_stay_awake(bdata->input->dev.parent); if (bdata->timer_debounce) mod_timer(&bdata->timer, jiffies + msecs_to_jiffies(bdata->timer_debounce)); else schedule_work(&bdata->work); return IRQ_HANDLED; } static void gpio_keys_irq_timer(unsigned long _data) { struct gpio_button_data *bdata = (struct gpio_button_data *)_data; struct input_dev *input = bdata->input; unsigned long flags; spin_lock_irqsave(&bdata->lock, flags); if (bdata->key_pressed) { input_event(input, EV_KEY, bdata->button->code, 0); input_sync(input); bdata->key_pressed = false; } spin_unlock_irqrestore(&bdata->lock, flags); } static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id) { struct gpio_button_data *bdata = dev_id; const struct gpio_keys_button *button = bdata->button; struct input_dev *input = bdata->input; unsigned long flags; BUG_ON(irq != bdata->irq); spin_lock_irqsave(&bdata->lock, flags); if (!bdata->key_pressed) { if (bdata->button->wakeup) pm_wakeup_event(bdata->input->dev.parent, 0); input_event(input, EV_KEY, button->code, 1); input_sync(input); if (!bdata->timer_debounce) { input_event(input, EV_KEY, button->code, 0); input_sync(input); goto out; } bdata->key_pressed = true; } if (bdata->timer_debounce) mod_timer(&bdata->timer, jiffies + msecs_to_jiffies(bdata->timer_debounce)); out: spin_unlock_irqrestore(&bdata->lock, flags); return IRQ_HANDLED; } static int gpio_keys_setup_key(struct platform_device *pdev, struct input_dev *input, struct gpio_button_data *bdata, const struct gpio_keys_button *button) { const char *desc = button->desc ? button->desc : "gpio_keys"; struct device *dev = &pdev->dev; irq_handler_t isr; unsigned long irqflags; int irq, error; bdata->input = input; bdata->button = button; spin_lock_init(&bdata->lock); if (gpio_is_valid(button->gpio)) { error = gpio_request_one(button->gpio, GPIOF_IN, desc); if (error < 0) { dev_err(dev, "Failed to request GPIO %d, error %d\n", button->gpio, error); return error; } if (button->debounce_interval) { error = gpio_set_debounce(button->gpio, button->debounce_interval * 1000); /* use timer if gpiolib doesn't provide debounce */ if (error < 0) bdata->timer_debounce = button->debounce_interval; } if (!bdata->irq) { irq = gpio_to_irq(button->gpio); if (irq < 0) { error = irq; dev_err(dev, "Unable to get irq number for GPIO %d, error %d\n", button->gpio, error); goto fail; } bdata->irq = irq; } INIT_WORK(&bdata->work, gpio_keys_gpio_work_func); setup_timer(&bdata->timer, gpio_keys_gpio_timer, (unsigned long)bdata); isr = gpio_keys_gpio_isr; irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; } else { if (!button->irq) { dev_err(dev, "No IRQ specified\n"); return -EINVAL; } bdata->irq = button->irq; if (button->type && button->type != EV_KEY) { dev_err(dev, "Only EV_KEY allowed for IRQ buttons.\n"); return -EINVAL; } bdata->timer_debounce = button->debounce_interval; setup_timer(&bdata->timer, gpio_keys_irq_timer, (unsigned long)bdata); isr = gpio_keys_irq_isr; irqflags = 0; } input_set_capability(input, button->type ?: EV_KEY, button->code); /* * If platform has specified that the button can be disabled, * we don't want it to share the interrupt line. */ if (!button->can_disable) irqflags |= IRQF_SHARED; if (button->wakeup) irqflags |= IRQF_NO_SUSPEND; error = request_any_context_irq(bdata->irq, isr, irqflags, desc, bdata); if (error < 0) { dev_err(dev, "Unable to claim irq %d; error %d\n", bdata->irq, error); goto fail; } return 0; fail: if (gpio_is_valid(button->gpio)) gpio_free(button->gpio); return error; } static void gpio_keys_report_state(struct gpio_keys_drvdata *ddata) { struct input_dev *input = ddata->input; int i; for (i = 0; i < ddata->pdata->nbuttons; i++) { struct gpio_button_data *bdata = &ddata->data[i]; if (gpio_is_valid(bdata->button->gpio)) gpio_keys_gpio_report_event(bdata); } input_sync(input); } static int gpio_keys_open(struct input_dev *input) { struct gpio_keys_drvdata *ddata = input_get_drvdata(input); const struct gpio_keys_platform_data *pdata = ddata->pdata; int error; if (pdata->enable) { error = pdata->enable(input->dev.parent); if (error) return error; } /* Report current state of buttons that are connected to GPIOs */ gpio_keys_report_state(ddata); return 0; } static void gpio_keys_close(struct input_dev *input) { struct gpio_keys_drvdata *ddata = input_get_drvdata(input); const struct gpio_keys_platform_data *pdata = ddata->pdata; if (pdata->disable) pdata->disable(input->dev.parent); } /* * Handlers for alternative sources of platform_data */ #ifdef CONFIG_OF /* * Translate OpenFirmware node properties into platform_data */ static struct gpio_keys_platform_data * gpio_keys_get_devtree_pdata(struct device *dev) { struct device_node *node, *pp; struct gpio_keys_platform_data *pdata; struct gpio_keys_button *button; int error; int nbuttons; int i; node = dev->of_node; if (!node) { error = -ENODEV; goto err_out; } nbuttons = of_get_child_count(node); if (nbuttons == 0) { error = -ENODEV; goto err_out; } pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button), GFP_KERNEL); if (!pdata) { error = -ENOMEM; goto err_out; } of_property_read_string(node, "keypad-name", &pdata->name); pdata->buttons = (struct gpio_keys_button *)(pdata + 1); pdata->nbuttons = nbuttons; pdata->rep = !!of_get_property(node, "autorepeat", NULL); i = 0; for_each_child_of_node(node, pp) { int gpio; enum of_gpio_flags flags; if (!of_find_property(pp, "gpios", NULL)) { pdata->nbuttons--; dev_warn(dev, "Found button without gpios\n"); continue; } gpio = of_get_gpio_flags(pp, 0, &flags); if (gpio < 0) { error = gpio; if (error != -EPROBE_DEFER) dev_err(dev, "Failed to get gpio flags, error: %d\n", error); goto err_free_pdata; } button = &pdata->buttons[i++]; button->gpio = gpio; button->active_low = flags & OF_GPIO_ACTIVE_LOW; if (of_property_read_u32(pp, "linux,code", &button->code)) { dev_err(dev, "Button without keycode: 0x%x\n", button->gpio); error = -EINVAL; goto err_free_pdata; } button->desc = of_get_property(pp, "label", NULL); if (of_property_read_u32(pp, "linux,input-type", &button->type)) button->type = EV_KEY; button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL); if (of_property_read_u32(pp, "debounce-interval", &button->debounce_interval)) button->debounce_interval = 5; } if (pdata->nbuttons == 0) { error = -EINVAL; goto err_free_pdata; } return pdata; err_free_pdata: kfree(pdata); err_out: return ERR_PTR(error); } static struct of_device_id gpio_keys_of_match[] = { { .compatible = "gpio-keys", }, { }, }; MODULE_DEVICE_TABLE(of, gpio_keys_of_match); #else static inline struct gpio_keys_platform_data * gpio_keys_get_devtree_pdata(struct device *dev) { return ERR_PTR(-ENODEV); } #endif static void gpio_remove_key(struct gpio_button_data *bdata) { free_irq(bdata->irq, bdata); if (bdata->timer_debounce) del_timer_sync(&bdata->timer); cancel_work_sync(&bdata->work); if (gpio_is_valid(bdata->button->gpio)) gpio_free(bdata->button->gpio); } #ifdef CONFIG_AUTO_SLEEP_WAKEUP_TEST static int auto_sleep_wakeup_test_notifier(struct notifier_block *notifier, unsigned long event, void *v) { struct gpio_keys_drvdata *ddata = container_of(notifier, struct gpio_keys_drvdata, auto_sleep_wakeup_test_notifier_block); switch ((int)event) { case AUTO_SLEEP_WAKEUP_TEST_PRESS_POWER_BUTTON: input_report_key(ddata->input, KEY_POWER, 1); input_sync(ddata->input); input_report_key(ddata->input, KEY_POWER, 0); input_sync(ddata->input); break; } return NOTIFY_OK; } #endif static int gpio_keys_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; const struct gpio_keys_platform_data *pdata = dev_get_platdata(dev); struct gpio_keys_drvdata *ddata; struct input_dev *input; int i, error; int wakeup = 0; #ifdef CONFIG_OF struct device_node *node, *pp; #endif if (!pdata) { pdata = gpio_keys_get_devtree_pdata(dev); if (IS_ERR(pdata)) return PTR_ERR(pdata); } ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + pdata->nbuttons * sizeof(struct gpio_button_data), GFP_KERNEL); input = input_allocate_device(); if (!ddata || !input) { dev_err(dev, "failed to allocate state\n"); error = -ENOMEM; goto fail1; } ddata->pdata = pdata; ddata->input = input; #ifdef CONFIG_AUTO_SLEEP_WAKEUP_TEST ddata->auto_sleep_wakeup_test_notifier_block.notifier_call = auto_sleep_wakeup_test_notifier; auto_sleep_wakeup_test_register_client(&ddata->auto_sleep_wakeup_test_notifier_block); #endif mutex_init(&ddata->disable_lock); platform_set_drvdata(pdev, ddata); input_set_drvdata(input, ddata); input->name = pdata->name ? : pdev->name; input->phys = "gpio-keys/input0"; input->dev.parent = &pdev->dev; input->open = gpio_keys_open; input->close = gpio_keys_close; input->id.bustype = BUS_HOST; input->id.vendor = 0x0001; input->id.product = 0x0001; input->id.version = 0x0100; /* Enable auto repeat feature of Linux input subsystem */ if (pdata->rep) __set_bit(EV_REP, input->evbit); #ifdef CONFIG_OF i = 0; node = dev->of_node; if (!node) { error = -ENODEV; goto fail2; } for_each_child_of_node(node, pp) { struct gpio_button_data *bdata = &ddata->data[i]; bdata->irq = irq_of_parse_and_map(pp, 0); i++; } #endif for (i = 0; i < pdata->nbuttons; i++) { const struct gpio_keys_button *button = &pdata->buttons[i]; struct gpio_button_data *bdata = &ddata->data[i]; error = gpio_keys_setup_key(pdev, input, bdata, button); if (error) goto fail2; dev_info(dev, "button: %s, value: %d\n", button->desc, gpio_get_value(button->gpio)); if (button->wakeup) wakeup = 1; } error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group); if (error) { dev_err(dev, "Unable to export keys/switches, error: %d\n", error); goto fail2; } if(meizu_sysfslink_register(&pdev->dev, LINK_KOBJ_NAME) < 0){ printk("gpio key sysfs_create_link failed.\n"); goto fail3; } error = input_register_device(input); if (error) { dev_err(dev, "Unable to register input device, error: %d\n", error); goto fail4; } device_init_wakeup(&pdev->dev, wakeup); return 0; fail4: meizu_sysfslink_unregister(LINK_KOBJ_NAME); fail3: sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); fail2: while (--i >= 0) gpio_remove_key(&ddata->data[i]); #ifdef CONFIG_AUTO_SLEEP_WAKEUP_TEST auto_sleep_wakeup_test_unregister_client(&ddata->auto_sleep_wakeup_test_notifier_block); #endif platform_set_drvdata(pdev, NULL); fail1: input_free_device(input); kfree(ddata); /* If we have no platform data, we allocated pdata dynamically. */ if (!dev_get_platdata(&pdev->dev)) kfree(pdata); return error; } static int gpio_keys_remove(struct platform_device *pdev) { struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); struct input_dev *input = ddata->input; int i; meizu_sysfslink_unregister(LINK_KOBJ_NAME); sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); device_init_wakeup(&pdev->dev, 0); for (i = 0; i < ddata->pdata->nbuttons; i++) gpio_remove_key(&ddata->data[i]); #ifdef CONFIG_AUTO_SLEEP_WAKEUP_TEST auto_sleep_wakeup_test_unregister_client(&ddata->auto_sleep_wakeup_test_notifier_block); #endif input_unregister_device(input); /* If we have no platform data, we allocated pdata dynamically. */ if (!dev_get_platdata(&pdev->dev)) kfree(ddata->pdata); kfree(ddata); return 0; } #ifdef CONFIG_PM_SLEEP static int gpio_keys_suspend(struct device *dev) { struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); struct input_dev *input = ddata->input; int i; if (device_may_wakeup(dev)) { for (i = 0; i < ddata->pdata->nbuttons; i++) { struct gpio_button_data *bdata = &ddata->data[i]; if (bdata->button->wakeup) enable_irq_wake(bdata->irq); } } else { mutex_lock(&input->mutex); if (input->users) gpio_keys_close(input); mutex_unlock(&input->mutex); } return 0; } static int gpio_keys_resume(struct device *dev) { struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); struct input_dev *input = ddata->input; int error = 0; int i; if (device_may_wakeup(dev)) { for (i = 0; i < ddata->pdata->nbuttons; i++) { struct gpio_button_data *bdata = &ddata->data[i]; if (bdata->button->wakeup) disable_irq_wake(bdata->irq); } } else { mutex_lock(&input->mutex); if (input->users) error = gpio_keys_open(input); mutex_unlock(&input->mutex); } if (error) return error; gpio_keys_report_state(ddata); return 0; } #endif static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume); static struct platform_driver gpio_keys_device_driver = { .probe = gpio_keys_probe, .remove = gpio_keys_remove, .driver = { .name = "gpio-keys", .owner = THIS_MODULE, .pm = &gpio_keys_pm_ops, .of_match_table = of_match_ptr(gpio_keys_of_match), } }; static int __init gpio_keys_init(void) { return platform_driver_register(&gpio_keys_device_driver); } static void __exit gpio_keys_exit(void) { platform_driver_unregister(&gpio_keys_device_driver); } late_initcall(gpio_keys_init); module_exit(gpio_keys_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Phil Blundell <[email protected]>"); MODULE_DESCRIPTION("Keyboard driver for GPIOs"); MODULE_ALIAS("platform:gpio-keys");
gpl-2.0
MaxLeap/MyBaaS
webroot/javascript/core/container/CascadeContainer.js
4532
define([ 'container/BasicContainer', 'text!./CascadeContainer.html', 'core/functions/ComponentFactory', 'jquery', 'underscore' ], function (BasicContainer, template, ComponentFactory, $, _) { var CascadeContainer = BasicContainer.extend({ events: { "click .btn-prev": "clickPrev", "click .btn-next": "clickNext" }, clickPrev: function () { if (this._currentindex > 0) { this._currentindex--; var root = this._containerRoot; var li = root.find('.form-bootstrapWizard>li'); li.removeClass('active'); li.eq(this._currentindex).addClass('active'); root.find('.form-pane'); var pane = root.find('.form-pane'); pane.hide(); pane.eq(this._currentindex).show(); } }, clickNext: function (state) { if (this._currentindex <= this._renderindex - 1) { this._currentindex++; var root = this._containerRoot; var li = root.find('.form-bootstrapWizard>li'); li.removeClass('active'); li.eq(this._currentindex - 1).addClass(state || 'success'); li.eq(this._currentindex).addClass('active'); var pane = root.find('.form-pane'); pane.hide(); pane.eq(this._currentindex).show(); } }, addComponent: function (options) { this._components.push({ name: options.name, description: options.description, constructor: options.constructor, factory: options.factory || ComponentFactory, options: options.options, extend: options.extend }); }, getContainer: function (index, options) { var node = '<div id="' + index + '" class="form-pane" ' + (this._renderindex == 0 ? '' : 'style="display:none"') + ' data-value="step' + (this._renderindex + 1) + '" ></div>'; return $(node); }, addStep: function (name, index, text) { var root = this._containerRoot; root.find('.form-bootstrapWizard').append('<li ' + (index == 1 ? 'class="active"' : '') + ' data-target="step1">' + '<span class="step">' + index + '</span>' + '<span class="title">' + name + '</span>' + (text ? '<span class="text">' + text + '</span>' : '') + '</li>'); }, renderComponents: function (options) { this._currentindex = 0; this._renderindex = 0; var self = this; var containerRoot; if (this.options.root) { var tmp = this._containerRoot.find(this.options.root); containerRoot = tmp.length ? tmp : $(this._containerRoot.get(0)); } else { containerRoot = $(this._containerRoot.get(0)); } _.forEach(this._components, function (item) { var name = item.name; if (typeof self._componentStack[name] == 'undefined') { self._componentStack[name] = self.createComponent(item, options || {}); } var component = self._componentStack[name]; var el = self.getContainer(name, options || {}).appendTo(containerRoot).get(0); component.setElement(el); component.beforeShow(); component.render(options || {}); self.addStep(name, self._renderindex + 1, item.description); self._renderindex++; }); this.addStep('Complete', this._renderindex + 1); containerRoot.append('' + '<div id="Complete" class="form-pane" style="display:none" data-value="step' + (this._renderindex + 1) + '"><br/>' + '<h1 class="text-center text-success"><strong><i class="fa fa-check fa-lg"></i> Complete</strong></h1>' + '<h4 class="text-center">Click next to finish</h4>' + '<br/><br/></div>'); } }); CascadeContainer.create = function (options) { var ret = new CascadeContainer(); options.template = template; options.root = '.form-content'; if (ret.initialize(options) == false) { return false; } return ret; }; return CascadeContainer; });
gpl-2.0
Megamouse/rpcs3
rpcs3/Emu/Io/usb_device.h
5438
#pragma once #ifdef _MSC_VER #pragma warning(push, 0) #else #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wall" #pragma GCC diagnostic ignored "-Wextra" #pragma GCC diagnostic ignored "-Wold-style-cast" #endif #include <libusb.h> #ifdef _MSC_VER #pragma warning(pop) #else #pragma GCC diagnostic pop #endif #include "Emu/Cell/lv2/sys_usbd.h" struct UsbTransfer; // Usb descriptors enum : u8 { USB_DESCRIPTOR_DEVICE = 0x01, USB_DESCRIPTOR_CONFIG = 0x02, USB_DESCRIPTOR_STRING = 0x03, USB_DESCRIPTOR_INTERFACE = 0x04, USB_DESCRIPTOR_ENDPOINT = 0x05, USB_DESCRIPTOR_HID = 0x21, USB_DESCRIPTOR_ACI = 0x24, USB_DESCRIPTOR_ENDPOINT_ASI = 0x25, }; struct UsbDeviceDescriptor { le_t<u16, 1> bcdUSB; u8 bDeviceClass; u8 bDeviceSubClass; u8 bDeviceProtocol; u8 bMaxPacketSize0; le_t<u16, 1> idVendor; le_t<u16, 1> idProduct; le_t<u16, 1> bcdDevice; u8 iManufacturer; u8 iProduct; u8 iSerialNumber; u8 bNumConfigurations; }; struct UsbDeviceConfiguration { le_t<u16, 1> wTotalLength; u8 bNumInterfaces; u8 bConfigurationValue; u8 iConfiguration; u8 bmAttributes; u8 bMaxPower; }; struct UsbDeviceInterface { u8 bInterfaceNumber; u8 bAlternateSetting; u8 bNumEndpoints; u8 bInterfaceClass; u8 bInterfaceSubClass; u8 bInterfaceProtocol; u8 iInterface; }; struct UsbDeviceEndpoint { u8 bEndpointAddress; u8 bmAttributes; le_t<u16, 1> wMaxPacketSize; u8 bInterval; }; struct UsbDeviceHID { le_t<u16, 1> bcdHID; u8 bCountryCode; u8 bNumDescriptors; u8 bDescriptorType; le_t<u16, 1> wDescriptorLength; }; struct UsbTransfer { u32 transfer_id = 0; s32 result = 0; u32 count = 0; UsbDeviceIsoRequest iso_request; std::vector<u8> setup_buf; libusb_transfer* transfer = nullptr; bool busy = false; // For fake transfers bool fake = false; u64 expected_time = 0; s32 expected_result = 0; u32 expected_count = 0; }; // Usb descriptor helper struct UsbDescriptorNode { u8 bLength; u8 bDescriptorType; union { UsbDeviceDescriptor _device; UsbDeviceConfiguration _configuration; UsbDeviceInterface _interface; UsbDeviceEndpoint _endpoint; UsbDeviceHID _hid; u8 data[0xFF]; }; std::vector<UsbDescriptorNode> subnodes; UsbDescriptorNode(){} template <typename T> UsbDescriptorNode(u8 _bDescriptorType, const T& _data) : bLength(sizeof(T) + 2) , bDescriptorType(_bDescriptorType) { memcpy(data, &_data, sizeof(T)); } UsbDescriptorNode(u8 _bLength, u8 _bDescriptorType, u8* _data) : bLength(_bLength) , bDescriptorType(_bDescriptorType) { memcpy(data, _data, _bLength - 2); } UsbDescriptorNode& add_node(const UsbDescriptorNode& newnode) { subnodes.push_back(newnode); return subnodes.back(); } u32 get_size() const { u32 nodesize = bLength; for (const auto& node : subnodes) { nodesize += node.get_size(); } return nodesize; } void write_data(u8*& ptr) { ptr[0] = bLength; ptr[1] = bDescriptorType; memcpy(ptr + 2, data, bLength - 2); ptr += bLength; for (auto& node : subnodes) { node.write_data(ptr); } } }; class usb_device { public: virtual bool open_device() = 0; virtual void read_descriptors(); virtual bool set_configuration(u8 cfg_num); virtual bool set_interface(u8 int_num); virtual void control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) = 0; virtual void interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint, UsbTransfer* transfer) = 0; virtual void isochronous_transfer(UsbTransfer* transfer) = 0; public: // device ID if the device has been ldded(0 otherwise) u32 assigned_number = 0; // base device descriptor, every other descriptor is a subnode UsbDescriptorNode device; protected: u8 current_config = 1; u8 current_interface = 0; protected: static u64 get_timestamp(); }; class usb_device_passthrough : public usb_device { public: usb_device_passthrough(libusb_device* _device, libusb_device_descriptor& desc); ~usb_device_passthrough(); bool open_device() override; void read_descriptors() override; bool set_configuration(u8 cfg_num) override; bool set_interface(u8 int_num) override; void control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) override; void interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint, UsbTransfer* transfer) override; void isochronous_transfer(UsbTransfer* transfer) override; protected: libusb_device* lusb_device = nullptr; libusb_device_handle* lusb_handle = nullptr; }; class usb_device_emulated : public usb_device { public: usb_device_emulated(); usb_device_emulated(const UsbDeviceDescriptor& _device); bool open_device() override; void control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) override; void interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint, UsbTransfer* transfer) override; void isochronous_transfer(UsbTransfer* transfer) override; // Emulated specific functions void add_string(char* str); s32 get_descriptor(u8 type, u8 index, u8* ptr, u32 max_size); protected: std::vector<std::string> strings; };
gpl-2.0
ducdongmg/joomla_tut25
components/com_poweradmin/controller.php
1429
<?php /*------------------------------------------------------------------------ # JSN PowerAdmin # ------------------------------------------------------------------------ # author JoomlaShine.com Team # copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved. # Websites: http://www.joomlashine.com # Technical Support: Feedback - http://www.joomlashine.com/joomlashine/contact-us.html # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # @version $Id: controller.php 12506 2012-05-09 03:55:24Z hiennh $ -------------------------------------------------------------------------*/ defined( '_JEXEC' ) or die( 'Restricted access' ); jimport('joomla.application.component.controller'); /** * Poweradmin Controller * * @package Joomla * @subpackage Poweradmin * @since 1.6 */ class PoweradminController extends JController { /** * Joomla display */ public function display( $tpl = '' ) { parent::display($tpl); } /** * * Ajax sef URL */ public function getRouterLink() { $config = JFactory::getConfig(); if ($config->get('sef') == 1){ $url = base64_decode(JRequest::getVar('link', '')); if ($url){ $uri = new JURI($url); $query = $uri->getQuery(); if ($query){ $routeLink = JRoute::_('index.php?'.$query); echo base64_encode($routeLink); }else{ echo base64_encode(JURI::root()); } } }else{ echo 'error'; } jexit(); } }
gpl-2.0
timedelaar/beadconfig
public/mdb.kralenconfig/Content/angular-1.5.11/angular-1.5.11/docs/examples/example-ng-keydown/index-production.html
348
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example - example-ng-keydown-production</title> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.10/angular.min.js"></script> </head> <body ng-app=""> <input ng-keydown="count = count + 1" ng-init="count=0"> key down count: {{count}} </body> </html>
gpl-2.0
legumbre/qemu-z80
block/vpc.c
17488
/* * Block driver for Conectix/Microsoft Virtual PC images * * Copyright (c) 2005 Alex Beregszaszi * Copyright (c) 2009 Kevin Wolf <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include "qemu-common.h" #include "block_int.h" #include "module.h" /**************************************************************/ #define HEADER_SIZE 512 //#define CACHE enum vhd_type { VHD_FIXED = 2, VHD_DYNAMIC = 3, VHD_DIFFERENCING = 4, }; // Seconds since Jan 1, 2000 0:00:00 (UTC) #define VHD_TIMESTAMP_BASE 946684800 // always big-endian struct vhd_footer { char creator[8]; // "conectix" uint32_t features; uint32_t version; // Offset of next header structure, 0xFFFFFFFF if none uint64_t data_offset; // Seconds since Jan 1, 2000 0:00:00 (UTC) uint32_t timestamp; char creator_app[4]; // "vpc " uint16_t major; uint16_t minor; char creator_os[4]; // "Wi2k" uint64_t orig_size; uint64_t size; uint16_t cyls; uint8_t heads; uint8_t secs_per_cyl; uint32_t type; // Checksum of the Hard Disk Footer ("one's complement of the sum of all // the bytes in the footer without the checksum field") uint32_t checksum; // UUID used to identify a parent hard disk (backing file) uint8_t uuid[16]; uint8_t in_saved_state; }; struct vhd_dyndisk_header { char magic[8]; // "cxsparse" // Offset of next header structure, 0xFFFFFFFF if none uint64_t data_offset; // Offset of the Block Allocation Table (BAT) uint64_t table_offset; uint32_t version; uint32_t max_table_entries; // 32bit/entry // 2 MB by default, must be a power of two uint32_t block_size; uint32_t checksum; uint8_t parent_uuid[16]; uint32_t parent_timestamp; uint32_t reserved; // Backing file name (in UTF-16) uint8_t parent_name[512]; struct { uint32_t platform; uint32_t data_space; uint32_t data_length; uint32_t reserved; uint64_t data_offset; } parent_locator[8]; }; typedef struct BDRVVPCState { BlockDriverState *hd; uint8_t footer_buf[HEADER_SIZE]; uint64_t free_data_block_offset; int max_table_entries; uint32_t *pagetable; uint64_t bat_offset; uint64_t last_bitmap_offset; uint32_t block_size; uint32_t bitmap_size; #ifdef CACHE uint8_t *pageentry_u8; uint32_t *pageentry_u32; uint16_t *pageentry_u16; uint64_t last_bitmap; #endif } BDRVVPCState; static uint32_t vpc_checksum(uint8_t* buf, size_t size) { uint32_t res = 0; int i; for (i = 0; i < size; i++) res += buf[i]; return ~res; } static int vpc_probe(const uint8_t *buf, int buf_size, const char *filename) { if (buf_size >= 8 && !strncmp((char *)buf, "conectix", 8)) return 100; return 0; } static int vpc_open(BlockDriverState *bs, const char *filename, int flags) { BDRVVPCState *s = bs->opaque; int ret, i; struct vhd_footer* footer; struct vhd_dyndisk_header* dyndisk_header; uint8_t buf[HEADER_SIZE]; uint32_t checksum; ret = bdrv_file_open(&s->hd, filename, flags); if (ret < 0) return ret; if (bdrv_pread(s->hd, 0, s->footer_buf, HEADER_SIZE) != HEADER_SIZE) goto fail; footer = (struct vhd_footer*) s->footer_buf; if (strncmp(footer->creator, "conectix", 8)) goto fail; checksum = be32_to_cpu(footer->checksum); footer->checksum = 0; if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum) fprintf(stderr, "block-vpc: The header checksum of '%s' is " "incorrect.\n", filename); // The visible size of a image in Virtual PC depends on the geometry // rather than on the size stored in the footer (the size in the footer // is too large usually) bs->total_sectors = (int64_t) be16_to_cpu(footer->cyls) * footer->heads * footer->secs_per_cyl; if (bdrv_pread(s->hd, be64_to_cpu(footer->data_offset), buf, HEADER_SIZE) != HEADER_SIZE) goto fail; dyndisk_header = (struct vhd_dyndisk_header*) buf; if (strncmp(dyndisk_header->magic, "cxsparse", 8)) goto fail; s->block_size = be32_to_cpu(dyndisk_header->block_size); s->bitmap_size = ((s->block_size / (8 * 512)) + 511) & ~511; s->max_table_entries = be32_to_cpu(dyndisk_header->max_table_entries); s->pagetable = qemu_malloc(s->max_table_entries * 4); s->bat_offset = be64_to_cpu(dyndisk_header->table_offset); if (bdrv_pread(s->hd, s->bat_offset, s->pagetable, s->max_table_entries * 4) != s->max_table_entries * 4) goto fail; s->free_data_block_offset = (s->bat_offset + (s->max_table_entries * 4) + 511) & ~511; for (i = 0; i < s->max_table_entries; i++) { be32_to_cpus(&s->pagetable[i]); if (s->pagetable[i] != 0xFFFFFFFF) { int64_t next = (512 * (int64_t) s->pagetable[i]) + s->bitmap_size + s->block_size; if (next> s->free_data_block_offset) s->free_data_block_offset = next; } } s->last_bitmap_offset = (int64_t) -1; #ifdef CACHE s->pageentry_u8 = qemu_malloc(512); s->pageentry_u32 = s->pageentry_u8; s->pageentry_u16 = s->pageentry_u8; s->last_pagetable = -1; #endif return 0; fail: bdrv_delete(s->hd); return -1; } /* * Returns the absolute byte offset of the given sector in the image file. * If the sector is not allocated, -1 is returned instead. * * The parameter write must be 1 if the offset will be used for a write * operation (the block bitmaps is updated then), 0 otherwise. */ static inline int64_t get_sector_offset(BlockDriverState *bs, int64_t sector_num, int write) { BDRVVPCState *s = bs->opaque; uint64_t offset = sector_num * 512; uint64_t bitmap_offset, block_offset; uint32_t pagetable_index, pageentry_index; pagetable_index = offset / s->block_size; pageentry_index = (offset % s->block_size) / 512; if (pagetable_index >= s->max_table_entries || s->pagetable[pagetable_index] == 0xffffffff) return -1; // not allocated bitmap_offset = 512 * (uint64_t) s->pagetable[pagetable_index]; block_offset = bitmap_offset + s->bitmap_size + (512 * pageentry_index); // We must ensure that we don't write to any sectors which are marked as // unused in the bitmap. We get away with setting all bits in the block // bitmap each time we write to a new block. This might cause Virtual PC to // miss sparse read optimization, but it's not a problem in terms of // correctness. if (write && (s->last_bitmap_offset != bitmap_offset)) { uint8_t bitmap[s->bitmap_size]; s->last_bitmap_offset = bitmap_offset; memset(bitmap, 0xff, s->bitmap_size); bdrv_pwrite(s->hd, bitmap_offset, bitmap, s->bitmap_size); } // printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n", // sector_num, pagetable_index, pageentry_index, // bitmap_offset, block_offset); // disabled by reason #if 0 #ifdef CACHE if (bitmap_offset != s->last_bitmap) { lseek(s->fd, bitmap_offset, SEEK_SET); s->last_bitmap = bitmap_offset; // Scary! Bitmap is stored as big endian 32bit entries, // while we used to look it up byte by byte read(s->fd, s->pageentry_u8, 512); for (i = 0; i < 128; i++) be32_to_cpus(&s->pageentry_u32[i]); } if ((s->pageentry_u8[pageentry_index / 8] >> (pageentry_index % 8)) & 1) return -1; #else lseek(s->fd, bitmap_offset + (pageentry_index / 8), SEEK_SET); read(s->fd, &bitmap_entry, 1); if ((bitmap_entry >> (pageentry_index % 8)) & 1) return -1; // not allocated #endif #endif return block_offset; } /* * Writes the footer to the end of the image file. This is needed when the * file grows as it overwrites the old footer * * Returns 0 on success and < 0 on error */ static int rewrite_footer(BlockDriverState* bs) { int ret; BDRVVPCState *s = bs->opaque; int64_t offset = s->free_data_block_offset; ret = bdrv_pwrite(s->hd, offset, s->footer_buf, HEADER_SIZE); if (ret < 0) return ret; return 0; } /* * Allocates a new block. This involves writing a new footer and updating * the Block Allocation Table to use the space at the old end of the image * file (overwriting the old footer) * * Returns the sectors' offset in the image file on success and < 0 on error */ static int64_t alloc_block(BlockDriverState* bs, int64_t sector_num) { BDRVVPCState *s = bs->opaque; int64_t bat_offset; uint32_t index, bat_value; int ret; uint8_t bitmap[s->bitmap_size]; // Check if sector_num is valid if ((sector_num < 0) || (sector_num > bs->total_sectors)) return -1; // Write entry into in-memory BAT index = (sector_num * 512) / s->block_size; if (s->pagetable[index] != 0xFFFFFFFF) return -1; s->pagetable[index] = s->free_data_block_offset / 512; // Initialize the block's bitmap memset(bitmap, 0xff, s->bitmap_size); bdrv_pwrite(s->hd, s->free_data_block_offset, bitmap, s->bitmap_size); // Write new footer (the old one will be overwritten) s->free_data_block_offset += s->block_size + s->bitmap_size; ret = rewrite_footer(bs); if (ret < 0) goto fail; // Write BAT entry to disk bat_offset = s->bat_offset + (4 * index); bat_value = be32_to_cpu(s->pagetable[index]); ret = bdrv_pwrite(s->hd, bat_offset, &bat_value, 4); if (ret < 0) goto fail; return get_sector_offset(bs, sector_num, 0); fail: s->free_data_block_offset -= (s->block_size + s->bitmap_size); return -1; } static int vpc_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BDRVVPCState *s = bs->opaque; int ret; int64_t offset; while (nb_sectors > 0) { offset = get_sector_offset(bs, sector_num, 0); if (offset == -1) { memset(buf, 0, 512); } else { ret = bdrv_pread(s->hd, offset, buf, 512); if (ret != 512) return -1; } nb_sectors--; sector_num++; buf += 512; } return 0; } static int vpc_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { BDRVVPCState *s = bs->opaque; int64_t offset; int ret; while (nb_sectors > 0) { offset = get_sector_offset(bs, sector_num, 1); if (offset == -1) { offset = alloc_block(bs, sector_num); if (offset < 0) return -1; } ret = bdrv_pwrite(s->hd, offset, buf, 512); if (ret != 512) return -1; nb_sectors--; sector_num++; buf += 512; } return 0; } /* * Calculates the number of cylinders, heads and sectors per cylinder * based on a given number of sectors. This is the algorithm described * in the VHD specification. * * Note that the geometry doesn't always exactly match total_sectors but * may round it down. * * Returns 0 on success, -EFBIG if the size is larger than 127 GB */ static int calculate_geometry(int64_t total_sectors, uint16_t* cyls, uint8_t* heads, uint8_t* secs_per_cyl) { uint32_t cyls_times_heads; if (total_sectors > 65535 * 16 * 255) return -EFBIG; if (total_sectors > 65535 * 16 * 63) { *secs_per_cyl = 255; *heads = 16; cyls_times_heads = total_sectors / *secs_per_cyl; } else { *secs_per_cyl = 17; cyls_times_heads = total_sectors / *secs_per_cyl; *heads = (cyls_times_heads + 1023) / 1024; if (*heads < 4) *heads = 4; if (cyls_times_heads >= (*heads * 1024) || *heads > 16) { *secs_per_cyl = 31; *heads = 16; cyls_times_heads = total_sectors / *secs_per_cyl; } if (cyls_times_heads >= (*heads * 1024)) { *secs_per_cyl = 63; *heads = 16; cyls_times_heads = total_sectors / *secs_per_cyl; } } // Note: Rounding up deviates from the Virtual PC behaviour // However, we need this to avoid truncating images in qemu-img convert *cyls = (cyls_times_heads + *heads - 1) / *heads; return 0; } static int vpc_create(const char *filename, QEMUOptionParameter *options) { uint8_t buf[1024]; struct vhd_footer* footer = (struct vhd_footer*) buf; struct vhd_dyndisk_header* dyndisk_header = (struct vhd_dyndisk_header*) buf; int fd, i; uint16_t cyls; uint8_t heads; uint8_t secs_per_cyl; size_t block_size, num_bat_entries; int64_t total_sectors = 0; // Read out options while (options && options->name) { if (!strcmp(options->name, "size")) { total_sectors = options->value.n / 512; } options++; } // Create the file fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); if (fd < 0) return -EIO; // Calculate matching total_size and geometry if (calculate_geometry(total_sectors, &cyls, &heads, &secs_per_cyl)) return -EFBIG; total_sectors = (int64_t) cyls * heads * secs_per_cyl; // Prepare the Hard Disk Footer memset(buf, 0, 1024); strncpy(footer->creator, "conectix", 8); // TODO Check if "qemu" creator_app is ok for VPC strncpy(footer->creator_app, "qemu", 4); strncpy(footer->creator_os, "Wi2k", 4); footer->features = be32_to_cpu(0x02); footer->version = be32_to_cpu(0x00010000); footer->data_offset = be64_to_cpu(HEADER_SIZE); footer->timestamp = be32_to_cpu(time(NULL) - VHD_TIMESTAMP_BASE); // Version of Virtual PC 2007 footer->major = be16_to_cpu(0x0005); footer->minor =be16_to_cpu(0x0003); footer->orig_size = be64_to_cpu(total_sectors * 512); footer->size = be64_to_cpu(total_sectors * 512); footer->cyls = be16_to_cpu(cyls); footer->heads = heads; footer->secs_per_cyl = secs_per_cyl; footer->type = be32_to_cpu(VHD_DYNAMIC); // TODO uuid is missing footer->checksum = be32_to_cpu(vpc_checksum(buf, HEADER_SIZE)); // Write the footer (twice: at the beginning and at the end) block_size = 0x200000; num_bat_entries = (total_sectors + block_size / 512) / (block_size / 512); if (write(fd, buf, HEADER_SIZE) != HEADER_SIZE) return -EIO; if (lseek(fd, 1536 + ((num_bat_entries * 4 + 511) & ~511), SEEK_SET) < 0) return -EIO; if (write(fd, buf, HEADER_SIZE) != HEADER_SIZE) return -EIO; // Write the initial BAT if (lseek(fd, 3 * 512, SEEK_SET) < 0) return -EIO; memset(buf, 0xFF, 512); for (i = 0; i < (num_bat_entries * 4 + 511) / 512; i++) if (write(fd, buf, 512) != 512) return -EIO; // Prepare the Dynamic Disk Header memset(buf, 0, 1024); strncpy(dyndisk_header->magic, "cxsparse", 8); dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFF); dyndisk_header->table_offset = be64_to_cpu(3 * 512); dyndisk_header->version = be32_to_cpu(0x00010000); dyndisk_header->block_size = be32_to_cpu(block_size); dyndisk_header->max_table_entries = be32_to_cpu(num_bat_entries); dyndisk_header->checksum = be32_to_cpu(vpc_checksum(buf, 1024)); // Write the header if (lseek(fd, 512, SEEK_SET) < 0) return -EIO; if (write(fd, buf, 1024) != 1024) return -EIO; close(fd); return 0; } static void vpc_close(BlockDriverState *bs) { BDRVVPCState *s = bs->opaque; qemu_free(s->pagetable); #ifdef CACHE qemu_free(s->pageentry_u8); #endif bdrv_delete(s->hd); } static QEMUOptionParameter vpc_create_options[] = { { "size", OPT_SIZE }, { NULL } }; static BlockDriver bdrv_vpc = { .format_name = "vpc", .instance_size = sizeof(BDRVVPCState), .bdrv_probe = vpc_probe, .bdrv_open = vpc_open, .bdrv_read = vpc_read, .bdrv_write = vpc_write, .bdrv_close = vpc_close, .bdrv_create = vpc_create, .create_options = vpc_create_options, }; static void bdrv_vpc_init(void) { bdrv_register(&bdrv_vpc); } block_init(bdrv_vpc_init);
gpl-2.0
odit/rv042
linux/kernel_2.6/linux/scripts/kconfig/lxdialog/Makefile
706
# Makefile to build lxdialog package # check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh # Use reursively expanded variables so we do not call gcc unless # we really need to do so. (Do not call gcc as part of make mrproper) HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) HOST_EXTRACFLAGS += -DLOCALE .PHONY: dochecklxdialog $(obj)/dochecklxdialog: $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES) hostprogs-y := lxdialog always := $(hostprogs-y) dochecklxdialog lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ util.o lxdialog.o msgbox.o
gpl-2.0
indonexia2004/opensaf-indo
osaf/services/saf/ntfsv/ntfs/NtfClient.cc
15097
/* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed * under the GNU Lesser General Public License Version 2.1, February 1999. * The complete license can be accessed from the following location: * http://opensource.org/licenses/lgpl-license.php * See the Copying file included with the OpenSAF distribution for full * licensing terms. * * Author(s): Ericsson AB * */ /** * This object handles information about NTF clients. * */ #include "NtfClient.hh" #include "logtrace.h" #include "NtfAdmin.hh" /** * This is the constructor. * * Client object is created, initial variables are set. * * @param clientId Node-wide unique id of this client. * @param mds_dest MDS communication pointer to this client. * * @param locatedOnThisNode * Flag that is set if the client is located on this node. */ NtfClient::NtfClient(unsigned int clientId, MDS_DEST mds_dest):readerId_(0),mdsDest_(mds_dest) { clientId_ = clientId; mdsDest_ = mds_dest; TRACE_3("NtfClient::NtfClient NtfClient %u created mdest: %" PRIu64, clientId_, mdsDest_); } /** * This is the destructor. * * It is called when a client is removed, i.e. a client finalized its * connection. * * Subscription objects belonging to this client are deleted. */ NtfClient::~NtfClient() { // delete all subscriptions SubscriptionMap::iterator pos; for (pos = subscriptionMap.begin(); pos != subscriptionMap.end(); pos++) { NtfSubscription* subscription = pos->second; delete subscription; } // delete all readers ReaderMapT::iterator rpos; for (rpos = readerMap.begin(); rpos != readerMap.end(); rpos++) { unsigned int readerId = 0; NtfReader* reader = rpos->second; if (reader != NULL) { readerId = reader->getId(); TRACE_3("~Client delete reader Id %u ", readerId); delete reader; } } TRACE_3("NtfClient::~NtfClient NtfClient %u destroyed, mdest %" PRIu64, clientId_, mdsDest_); } /** * This method is called to get the id of this client. * * @return Node-wide unique id of this client. */ unsigned int NtfClient::getClientId() const { return clientId_; } MDS_DEST NtfClient::getMdsDest() const { return mdsDest_; } /** * This method is called when the client made a new subscription. * * The pointer to the subscription object is stored if it did not * exist. If the client is located on this node, a confirmation * for the subscription is sent. * * @param subscription * Pointer to the subscription object. */ void NtfClient::subscriptionAdded(NtfSubscription* subscription, MDS_SYNC_SND_CTXT *mdsCtxt) { // check if subscription already exists SubscriptionMap::iterator pos; pos = subscriptionMap.find(subscription->getSubscriptionId()); if (pos != subscriptionMap.end()) { // subscription found TRACE_3("NtfClient::subscriptionAdded subscription %u already exists" ", client %u", subscription->getSubscriptionId(), clientId_); delete subscription; } else { // store new subscription in subscriptionMap subscriptionMap[subscription->getSubscriptionId()] = subscription; TRACE_3("NtfClient::subscriptionAdded subscription %u added," " client %u, subscriptionMap size is %u", subscription->getSubscriptionId(), clientId_, (unsigned int)subscriptionMap.size()); if (activeController()) { sendSubscriptionUpdate(subscription->getSubscriptionInfo()); confirmNtfSubscribe(subscription->getSubscriptionId(), mdsCtxt); } } } /** * This method is called when the client received a notification. * * If the notification is send from this client, a confirmation * for the notification is sent. * * The client scans through its subscriptions and if it finds a * matching one, it stores the id of the matching subscription in * the notification object. * * @param clientId Node-wide unique id of the client who sent the notification. * @param notification * Pointer to the notification object. */ void NtfClient::notificationReceived(unsigned int clientId, NtfSmartPtr& notification, MDS_SYNC_SND_CTXT *mdsCtxt) { TRACE_ENTER2("%u %u", clientId_, clientId); // send acknowledgement if (clientId_ == clientId) { // this is the client who sent the notification if (activeController()) { confirmNtfNotification(notification->getNotificationId(), mdsCtxt, mdsDest_); if (notification->loggedOk()) { sendLoggedConfirmUpdate(notification->getNotificationId()); } else { notification->loggFromCallback_= true; } } } // scan through all subscriptions SubscriptionMap::iterator pos; for (pos = subscriptionMap.begin(); pos != subscriptionMap.end(); pos++) { NtfSubscription* subscription = pos->second; if (subscription->checkSubscription(notification)) { // notification matches the subscription TRACE_2("NtfClient::notificationReceived notification %llu matches" " subscription %d, client %u", notification->getNotificationId(), subscription->getSubscriptionId(), clientId_); // first store subscription data in notifiaction object for // tracking purposes notification->storeMatchingSubscription(clientId_, subscription->getSubscriptionId()); // if active, send out the notification if (activeController()) { subscription->sendNotification(notification, this); } } else { TRACE_2("NtfClient::notificationReceived notification %llu does not" " match subscription %u, client %u", notification->getNotificationId(), subscription->getSubscriptionId(), clientId_); } } TRACE_LEAVE(); } /** * This method is called if the client made an unsubscribe. * * The subscription object is deleted. If the client is located on * this node, a confirmation is sent. * * @param subscriptionId * Client-wide unique id of the subscription that was removed. */ void NtfClient::subscriptionRemoved(SaNtfSubscriptionIdT subscriptionId, MDS_SYNC_SND_CTXT *mdsCtxt) { // find subscription SubscriptionMap::iterator pos; pos = subscriptionMap.find(subscriptionId); if (pos != subscriptionMap.end()) { // subscription found NtfSubscription* subscription = pos->second; delete subscription; // remove subscription from subscription map subscriptionMap.erase(pos); } else { LOG_ER( "NtfClient::subscriptionRemoved subscription" " %u not found", subscriptionId); } if (activeController()) { // client is located on this node sendUnsubscribeUpdate(clientId_, subscriptionId); confirmNtfUnsubscribe(subscriptionId, mdsCtxt); } } void NtfClient::discardedAdd(SaNtfSubscriptionIdT subscriptionId, SaNtfIdentifierT notificationId) { SubscriptionMap::iterator pos; pos = subscriptionMap.find(subscriptionId); if (pos != subscriptionMap.end()) { pos->second->discardedAdd(notificationId); } else { LOG_ER( "discardedAdd subscription %u not found", subscriptionId); } } void NtfClient::discardedClear(SaNtfSubscriptionIdT subscriptionId) { SubscriptionMap::iterator pos; pos = subscriptionMap.find(subscriptionId); if (pos != subscriptionMap.end()) { pos->second->discardedClear(); } else { LOG_ER( "discardedClear subscription %u not found", subscriptionId); } } /** * This method is called when information about this client is * requested by another node. * * The client scans through its subscriptions and sends them out one by one. */ void NtfClient::syncRequest(NCS_UBAID *uba) { // scan through all subscriptions sendNoOfSubscriptions(subscriptionMap.size(), uba); SubscriptionMap::iterator pos; for (pos = subscriptionMap.begin(); pos != subscriptionMap.end(); pos++) { NtfSubscription* subscription = pos->second; TRACE_3("NtfClient::syncRequest sending info about subscription %u for " "client %u", subscription->getSubscriptionId(), clientId_); subscription->syncRequest(uba); } } void NtfClient::sendNotConfirmedNotification(NtfSmartPtr notification, SaNtfSubscriptionIdT subscriptionId) { TRACE_ENTER(); // if active, send out the notification if (activeController()) { SubscriptionMap::iterator pos; pos = subscriptionMap.find(subscriptionId); if (pos != subscriptionMap.end()) { pos->second->sendNotification(notification, this); } else { TRACE_3("subscription: %u client: %u not found", subscriptionId, getClientId()); } } TRACE_LEAVE(); } /** * This method is called when a confirmation for the subscription * should be sent to a client. * * @param subscriptionId Client-wide unique id of the subscription that should * be confirmed. */ void NtfClient::confirmNtfSubscribe(SaNtfSubscriptionIdT subscriptionId, MDS_SYNC_SND_CTXT *mds_ctxt) { TRACE_2("NtfClient::confirmNtfSubscribe subscribe_res_lib called, " "client %u, subscription %u", clientId_, subscriptionId); subscribe_res_lib( SA_AIS_OK, subscriptionId, mdsDest_, mds_ctxt); } /** * This method is called when a confirmation for the unsubscription * should be sent to a client. * * @param subscriptionId Client-wide unique id of the subscription that shoul be * confirmed. */ void NtfClient::confirmNtfUnsubscribe(SaNtfSubscriptionIdT subscriptionId, MDS_SYNC_SND_CTXT *mdsCtxt) { TRACE_2("NtfClient::confirmNtfUnsubscribe unsubscribe_res_lib called," " client %u, subscription %u", clientId_, subscriptionId); unsubscribe_res_lib(SA_AIS_OK, subscriptionId, mdsDest_, mdsCtxt); } /** * This method is called when a confirmation for the notification * should be sent to a client. * * @param notificationId * Cluster-wide unique id of the notification that should be confirmed. */ void NtfClient::confirmNtfNotification(SaNtfIdentifierT notificationId, MDS_SYNC_SND_CTXT *mdsCtxt, MDS_DEST mdsDest) { notfication_result_lib( SA_AIS_OK, notificationId, mdsCtxt, mdsDest); } void NtfClient::newReaderResponse(SaAisErrorT* error, unsigned int readerId, MDS_SYNC_SND_CTXT *mdsCtxt) { new_reader_res_lib( *error, readerId, mdsDest_, mdsCtxt); } void NtfClient::readNextResponse(SaAisErrorT* error, NtfSmartPtr& notification, MDS_SYNC_SND_CTXT *mdsCtxt) { TRACE_ENTER(); if (*error == SA_AIS_OK) { read_next_res_lib(*error, notification->sendNotInfo_, mdsDest_, mdsCtxt); } else { read_next_res_lib(*error, NULL, mdsDest_, mdsCtxt); } TRACE_ENTER(); } void NtfClient::deleteReaderResponse(SaAisErrorT* error, MDS_SYNC_SND_CTXT *mdsCtxt) { delete_reader_res_lib( *error, mdsDest_, mdsCtxt); } void NtfClient::newReader(SaNtfSearchCriteriaT searchCriteria, ntfsv_filter_ptrs_t *f_rec, MDS_SYNC_SND_CTXT *mdsCtxt) { SaAisErrorT error = SA_AIS_OK; readerId_++; NtfReader* reader; if (f_rec) { reader = new NtfReader(NtfAdmin::theNtfAdmin->logger, readerId_, searchCriteria, f_rec); } else { /*old API no filtering */ reader = new NtfReader(NtfAdmin::theNtfAdmin->logger, readerId_); } readerMap[readerId_] = reader; newReaderResponse(&error,readerId_, mdsCtxt); } void NtfClient::readNext(unsigned int readerId, SaNtfSearchDirectionT searchDirection, MDS_SYNC_SND_CTXT *mdsCtxt) { TRACE_ENTER(); TRACE_6("readerId %u", readerId); // check if reader already exists SaAisErrorT error = SA_AIS_ERR_NOT_EXIST; ReaderMapT::iterator pos; pos = readerMap.find(readerId); if (pos != readerMap.end()) { // reader found TRACE_3("NtfClient::readNext readerId %u FOUND!", readerId); NtfReader* reader = pos->second; NtfSmartPtr notif(reader->next(searchDirection, &error)); readNextResponse(&error, notif, mdsCtxt); TRACE_LEAVE(); return; } else { NtfSmartPtr notif; // reader not found TRACE_3("NtfClient::readNext readerId %u not found", readerId); error = SA_AIS_ERR_BAD_HANDLE; readNextResponse(&error, notif, mdsCtxt); TRACE_LEAVE(); } } void NtfClient::deleteReader(unsigned int readerId, MDS_SYNC_SND_CTXT *mdsCtxt) { SaAisErrorT error = SA_AIS_ERR_NOT_EXIST; ReaderMapT::iterator pos; pos = readerMap.find(readerId); if (pos != readerMap.end()) { // reader found TRACE_3("NtfClient::deleteReader readerId %u ", readerId); NtfReader* reader = pos->second; error = SA_AIS_OK; delete reader; readerMap.erase(pos); } else { // reader not found TRACE_3("NtfClient::readNext readerId %u not found", readerId); } deleteReaderResponse(&error, mdsCtxt); } void NtfClient::printInfo() { TRACE("Client information"); TRACE(" clientId: %u", clientId_); TRACE(" mdsDest %" PRIu64, mdsDest_); SubscriptionMap::iterator pos; for (pos = subscriptionMap.begin(); pos != subscriptionMap.end(); pos++) { NtfSubscription* subscription = pos->second; subscription->printInfo(); } TRACE(" readerId counter: %u", readerId_); ReaderMapT::iterator rpos; for (rpos = readerMap.begin(); rpos != readerMap.end(); rpos++) { unsigned int readerId = 0; NtfReader* reader = rpos->second; if (reader != NULL) { readerId = reader->getId(); TRACE(" Reader Id %u ", readerId); } } }
gpl-2.0
swsachith/ANDROPHSY
src/main/java/lk/score/androphsy/exceptions/PropertyNotDefinedException.java
409
package lk.score.androphsy.exceptions; /** * This exception is thrown when a property cannot be read from the property * file */ public class PropertyNotDefinedException extends Exception { private static final String MESSAGE_PREFIX = "Property not defined!! : "; public PropertyNotDefinedException(String message) { super(MESSAGE_PREFIX + message); } public PropertyNotDefinedException() { } }
gpl-2.0
tidus30691nexus5/newwifi
src/util.h
2200
/* vim: set et ts=4 sts=4 sw=4 : */ /********************************************************************\ * 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. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License* * along with this program; if not, contact: * * * * Free Software Foundation Voice: +1-617-542-5942 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * Boston, MA 02111-1307, USA [email protected] * * * \********************************************************************/ /** @file util.h @brief Misc utility functions @author Copyright (C) 2004 Philippe April <[email protected]> @author Copyright (C) 2016 Dengfeng Liu <[email protected]> */ #ifndef _UTIL_H_ #define _UTIL_H_ #include <sys/types.h> #include <sys/socket.h> /** @brief Initialize the ICMP socket */ int init_icmp_socket(void); /** @brief Close the ICMP socket. */ void close_icmp_socket(void); /** @brief ICMP Ping an IP */ void icmp_ping(const char *); /** @brief Save pid of this wifidog in pid file */ void save_pid_file(const char *); int is_valid_ip(const char *); int is_valid_mac(const char *); int is_socket_valid(int ); int wd_connect(int, const struct sockaddr *, socklen_t, int); float get_cpu_usage(); void s_sleep(unsigned int, unsigned int); #endif /* _UTIL_H_ */
gpl-2.0
joelbrock/HARVEST_CORE
documentation/doxy/output/is4c-nf/html/class_kickers_test.html
4655
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.4"/> <title>CORE POS - IS4C: KickersTest Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); } }); </script> <link rel="search" href="search-opensearch.php?v=opensearch.xml" type="application/opensearchdescription+xml" title="CORE POS - IS4C"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">CORE POS - IS4C </div> <div id="projectbrief">The CORE POS front end</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.4 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <div class="left"> <form id="FSearchBox" action="search.php" method="get"> <img id="MSearchSelect" src="search/mag.png" alt=""/> <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"/> </form> </div><div class="right"></div> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> &#124; <a href="class_kickers_test-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">KickersTest Class Reference</div> </div> </div><!--header--> <div class="contents"> <div class="dynheader"> Inheritance diagram for KickersTest:</div> <div class="dyncontent"> <div class="center"> <img src="class_kickers_test.png" usemap="#KickersTest_map" alt=""/> <map id="KickersTest_map" name="KickersTest_map"> </map> </div></div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:a3747fb945da8f730be0e9be4deb74850"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3747fb945da8f730be0e9be4deb74850"></a> &#160;</td><td class="memItemRight" valign="bottom"><b>testAll</b> ()</td></tr> <tr class="separator:a3747fb945da8f730be0e9be4deb74850"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>disabled </p> </div><hr/>The documentation for this class was generated from the following file:<ul> <li>pos/is4c-nf/unit-tests/KickersTest.php</li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Apr 2 2015 12:27:46 for CORE POS - IS4C by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.4 </small></address> </body> </html>
gpl-2.0
jbachorik/btrace
btrace-core/src/main/java/org/openjdk/btrace/core/annotations/Property.java
1873
/* * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the Classpath exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.openjdk.btrace.core.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * BTrace fields with this annotation are exposed as attributes of the dynamic JMX bean that wraps * the BTrace class. * * @author A. Sundararajan */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Property { // by default, the name of the attribute is same as the name // of the field of the BTrace class. String name() default ""; // description of this attribute String description() default ""; }
gpl-2.0
coreboot/coreboot
src/soc/intel/broadwell/include/soc/nvs.h
1507
/* SPDX-License-Identifier: GPL-2.0-only */ #ifndef _BROADWELL_NVS_H_ #define _BROADWELL_NVS_H_ #include <stdint.h> struct __packed global_nvs { /* Miscellaneous */ u16 unused_was_osys; /* 0x00 - Operating System */ u8 smif; /* 0x02 - SMI function call ("TRAP") */ u8 unused_was_prm0; /* 0x03 - SMI function call parameter */ u8 unused_was_prm1; /* 0x04 - SMI function call parameter */ u8 scif; /* 0x05 - SCI function call (via _L00) */ u8 unused_was_prm2; /* 0x06 - SCI function call parameter */ u8 unused_was_prm3; /* 0x07 - SCI function call parameter */ u8 unused_was_lckf; /* 0x08 - Global Lock function for EC */ u8 unused_was_prm4; /* 0x09 - Lock function parameter */ u8 unused_was_prm5; /* 0x0a - Lock function parameter */ u8 unused_was_pcnt; /* 0x0b - Processor Count */ u8 ppcm; /* 0x0c - Max PPC State */ u8 tmps; /* 0x0d - Temperature Sensor ID */ u8 tlvl; /* 0x0e - Throttle Level Limit */ u8 flvl; /* 0x0f - Current FAN Level */ u8 tcrt; /* 0x10 - Critical Threshold */ u8 tpsv; /* 0x11 - Passive Threshold */ u8 tmax; /* 0x12 - CPU Tj_max */ u8 s5u0; /* 0x13 - Enable USB in S5 */ u8 s3u0; /* 0x14 - Enable USB in S3 */ u8 s33g; /* 0x15 - Enable 3G in S3 */ u8 lids; /* 0x16 - LID State */ u8 unused_was_pwrs; /* 0x17 - AC Power State */ u32 obsolete_cmem; /* 0x18 - 0x1b - CBMEM TOC */ u32 cbmc; /* 0x1c - 0x1f - coreboot Memory Console */ u64 pm1i; /* 0x20 - 0x27 - PM1 wake status bit */ u64 gpei; /* 0x28 - 0x2f - GPE wake status bit */ }; #endif
gpl-2.0
sdwuyawen/linux2.6.21_helper2416
drivers/usb/storage/shuttle_usbat.c
46174
/* Driver for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable * * $Id: shuttle_usbat.c,v 1.1.1.1 2007/06/12 07:27:09 eyryu Exp $ * * Current development and maintenance by: * (c) 2000, 2001 Robert Baruch ([email protected]) * (c) 2004, 2005 Daniel Drake <[email protected]> * * Developed with the assistance of: * (c) 2002 Alan Stern <[email protected]> * * Flash support based on earlier work by: * (c) 2002 Thomas Kreiling <[email protected]> * * Many originally ATAPI devices were slightly modified to meet the USB * market by using some kind of translation from ATAPI to USB on the host, * and the peripheral would translate from USB back to ATAPI. * * SCM Microsystems (www.scmmicro.com) makes a device, sold to OEM's only, * which does the USB-to-ATAPI conversion. By obtaining the data sheet on * their device under nondisclosure agreement, I have been able to write * this driver for Linux. * * The chip used in the device can also be used for EPP and ISA translation * as well. This driver is only guaranteed to work with the ATAPI * translation. * * See the Kconfig help text for a list of devices known to be supported by * this driver. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/errno.h> #include <linux/slab.h> #include <linux/cdrom.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include "usb.h" #include "transport.h" #include "protocol.h" #include "debug.h" #include "shuttle_usbat.h" #define short_pack(LSB,MSB) ( ((u16)(LSB)) | ( ((u16)(MSB))<<8 ) ) #define LSB_of(s) ((s)&0xFF) #define MSB_of(s) ((s)>>8) static int transferred = 0; static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us); static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us); /* * Convenience function to produce an ATA read/write sectors command * Use cmd=0x20 for read, cmd=0x30 for write */ static void usbat_pack_ata_sector_cmd(unsigned char *buf, unsigned char thistime, u32 sector, unsigned char cmd) { buf[0] = 0; buf[1] = thistime; buf[2] = sector & 0xFF; buf[3] = (sector >> 8) & 0xFF; buf[4] = (sector >> 16) & 0xFF; buf[5] = 0xE0 | ((sector >> 24) & 0x0F); buf[6] = cmd; } /* * Convenience function to get the device type (flash or hp8200) */ static int usbat_get_device_type(struct us_data *us) { return ((struct usbat_info*)us->extra)->devicetype; } /* * Read a register from the device */ static int usbat_read(struct us_data *us, unsigned char access, unsigned char reg, unsigned char *content) { return usb_stor_ctrl_transfer(us, us->recv_ctrl_pipe, access | USBAT_CMD_READ_REG, 0xC0, (u16)reg, 0, content, 1); } /* * Write to a register on the device */ static int usbat_write(struct us_data *us, unsigned char access, unsigned char reg, unsigned char content) { return usb_stor_ctrl_transfer(us, us->send_ctrl_pipe, access | USBAT_CMD_WRITE_REG, 0x40, short_pack(reg, content), 0, NULL, 0); } /* * Convenience function to perform a bulk read */ static int usbat_bulk_read(struct us_data *us, unsigned char *data, unsigned int len, int use_sg) { if (len == 0) return USB_STOR_XFER_GOOD; US_DEBUGP("usbat_bulk_read: len = %d\n", len); return usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe, data, len, use_sg, NULL); } /* * Convenience function to perform a bulk write */ static int usbat_bulk_write(struct us_data *us, unsigned char *data, unsigned int len, int use_sg) { if (len == 0) return USB_STOR_XFER_GOOD; US_DEBUGP("usbat_bulk_write: len = %d\n", len); return usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe, data, len, use_sg, NULL); } /* * Some USBAT-specific commands can only be executed over a command transport * This transport allows one (len=8) or two (len=16) vendor-specific commands * to be executed. */ static int usbat_execute_command(struct us_data *us, unsigned char *commands, unsigned int len) { return usb_stor_ctrl_transfer(us, us->send_ctrl_pipe, USBAT_CMD_EXEC_CMD, 0x40, 0, 0, commands, len); } /* * Read the status register */ static int usbat_get_status(struct us_data *us, unsigned char *status) { int rc; rc = usbat_read(us, USBAT_ATA, USBAT_ATA_STATUS, status); US_DEBUGP("usbat_get_status: 0x%02X\n", (unsigned short) (*status)); return rc; } /* * Check the device status */ static int usbat_check_status(struct us_data *us) { unsigned char *reply = us->iobuf; int rc; if (!us) return USB_STOR_TRANSPORT_ERROR; rc = usbat_get_status(us, reply); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_FAILED; /* error/check condition (0x51 is ok) */ if (*reply & 0x01 && *reply != 0x51) return USB_STOR_TRANSPORT_FAILED; /* device fault */ if (*reply & 0x20) return USB_STOR_TRANSPORT_FAILED; return USB_STOR_TRANSPORT_GOOD; } /* * Stores critical information in internal registers in prepartion for the execution * of a conditional usbat_read_blocks or usbat_write_blocks call. */ static int usbat_set_shuttle_features(struct us_data *us, unsigned char external_trigger, unsigned char epp_control, unsigned char mask_byte, unsigned char test_pattern, unsigned char subcountH, unsigned char subcountL) { unsigned char *command = us->iobuf; command[0] = 0x40; command[1] = USBAT_CMD_SET_FEAT; /* * The only bit relevant to ATA access is bit 6 * which defines 8 bit data access (set) or 16 bit (unset) */ command[2] = epp_control; /* * If FCQ is set in the qualifier (defined in R/W cmd), then bits U0, U1, * ET1 and ET2 define an external event to be checked for on event of a * _read_blocks or _write_blocks operation. The read/write will not take * place unless the defined trigger signal is active. */ command[3] = external_trigger; /* * The resultant byte of the mask operation (see mask_byte) is compared for * equivalence with this test pattern. If equal, the read/write will take * place. */ command[4] = test_pattern; /* * This value is logically ANDed with the status register field specified * in the read/write command. */ command[5] = mask_byte; /* * If ALQ is set in the qualifier, this field contains the address of the * registers where the byte count should be read for transferring the data. * If ALQ is not set, then this field contains the number of bytes to be * transferred. */ command[6] = subcountL; command[7] = subcountH; return usbat_execute_command(us, command, 8); } /* * Block, waiting for an ATA device to become not busy or to report * an error condition. */ static int usbat_wait_not_busy(struct us_data *us, int minutes) { int i; int result; unsigned char *status = us->iobuf; /* Synchronizing cache on a CDR could take a heck of a long time, * but probably not more than 10 minutes or so. On the other hand, * doing a full blank on a CDRW at speed 1 will take about 75 * minutes! */ for (i=0; i<1200+minutes*60; i++) { result = usbat_get_status(us, status); if (result!=USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (*status & 0x01) { /* check condition */ result = usbat_read(us, USBAT_ATA, 0x10, status); return USB_STOR_TRANSPORT_FAILED; } if (*status & 0x20) /* device fault */ return USB_STOR_TRANSPORT_FAILED; if ((*status & 0x80)==0x00) { /* not busy */ US_DEBUGP("Waited not busy for %d steps\n", i); return USB_STOR_TRANSPORT_GOOD; } if (i<500) msleep(10); /* 5 seconds */ else if (i<700) msleep(50); /* 10 seconds */ else if (i<1200) msleep(100); /* 50 seconds */ else msleep(1000); /* X minutes */ } US_DEBUGP("Waited not busy for %d minutes, timing out.\n", minutes); return USB_STOR_TRANSPORT_FAILED; } /* * Read block data from the data register */ static int usbat_read_block(struct us_data *us, unsigned char *content, unsigned short len, int use_sg) { int result; unsigned char *command = us->iobuf; if (!len) return USB_STOR_TRANSPORT_GOOD; command[0] = 0xC0; command[1] = USBAT_ATA | USBAT_CMD_READ_BLOCK; command[2] = USBAT_ATA_DATA; command[3] = 0; command[4] = 0; command[5] = 0; command[6] = LSB_of(len); command[7] = MSB_of(len); result = usbat_execute_command(us, command, 8); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; result = usbat_bulk_read(us, content, len, use_sg); return (result == USB_STOR_XFER_GOOD ? USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR); } /* * Write block data via the data register */ static int usbat_write_block(struct us_data *us, unsigned char access, unsigned char *content, unsigned short len, int minutes, int use_sg) { int result; unsigned char *command = us->iobuf; if (!len) return USB_STOR_TRANSPORT_GOOD; command[0] = 0x40; command[1] = access | USBAT_CMD_WRITE_BLOCK; command[2] = USBAT_ATA_DATA; command[3] = 0; command[4] = 0; command[5] = 0; command[6] = LSB_of(len); command[7] = MSB_of(len); result = usbat_execute_command(us, command, 8); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; result = usbat_bulk_write(us, content, len, use_sg); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; return usbat_wait_not_busy(us, minutes); } /* * Process read and write requests */ static int usbat_hp8200e_rw_block_test(struct us_data *us, unsigned char access, unsigned char *registers, unsigned char *data_out, unsigned short num_registers, unsigned char data_reg, unsigned char status_reg, unsigned char timeout, unsigned char qualifier, int direction, unsigned char *content, unsigned short len, int use_sg, int minutes) { int result; unsigned int pipe = (direction == DMA_FROM_DEVICE) ? us->recv_bulk_pipe : us->send_bulk_pipe; unsigned char *command = us->iobuf; int i, j; int cmdlen; unsigned char *data = us->iobuf; unsigned char *status = us->iobuf; BUG_ON(num_registers > US_IOBUF_SIZE/2); for (i=0; i<20; i++) { /* * The first time we send the full command, which consists * of downloading the SCSI command followed by downloading * the data via a write-and-test. Any other time we only * send the command to download the data -- the SCSI command * is still 'active' in some sense in the device. * * We're only going to try sending the data 10 times. After * that, we just return a failure. */ if (i==0) { cmdlen = 16; /* * Write to multiple registers * Not really sure the 0x07, 0x17, 0xfc, 0xe7 is * necessary here, but that's what came out of the * trace every single time. */ command[0] = 0x40; command[1] = access | USBAT_CMD_WRITE_REGS; command[2] = 0x07; command[3] = 0x17; command[4] = 0xFC; command[5] = 0xE7; command[6] = LSB_of(num_registers*2); command[7] = MSB_of(num_registers*2); } else cmdlen = 8; /* Conditionally read or write blocks */ command[cmdlen-8] = (direction==DMA_TO_DEVICE ? 0x40 : 0xC0); command[cmdlen-7] = access | (direction==DMA_TO_DEVICE ? USBAT_CMD_COND_WRITE_BLOCK : USBAT_CMD_COND_READ_BLOCK); command[cmdlen-6] = data_reg; command[cmdlen-5] = status_reg; command[cmdlen-4] = timeout; command[cmdlen-3] = qualifier; command[cmdlen-2] = LSB_of(len); command[cmdlen-1] = MSB_of(len); result = usbat_execute_command(us, command, cmdlen); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (i==0) { for (j=0; j<num_registers; j++) { data[j<<1] = registers[j]; data[1+(j<<1)] = data_out[j]; } result = usbat_bulk_write(us, data, num_registers*2, 0); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; } result = usb_stor_bulk_transfer_sg(us, pipe, content, len, use_sg, NULL); /* * If we get a stall on the bulk download, we'll retry * the bulk download -- but not the SCSI command because * in some sense the SCSI command is still 'active' and * waiting for the data. Don't ask me why this should be; * I'm only following what the Windoze driver did. * * Note that a stall for the test-and-read/write command means * that the test failed. In this case we're testing to make * sure that the device is error-free * (i.e. bit 0 -- CHK -- of status is 0). The most likely * hypothesis is that the USBAT chip somehow knows what * the device will accept, but doesn't give the device any * data until all data is received. Thus, the device would * still be waiting for the first byte of data if a stall * occurs, even if the stall implies that some data was * transferred. */ if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) { /* * If we're reading and we stalled, then clear * the bulk output pipe only the first time. */ if (direction==DMA_FROM_DEVICE && i==0) { if (usb_stor_clear_halt(us, us->send_bulk_pipe) < 0) return USB_STOR_TRANSPORT_ERROR; } /* * Read status: is the device angry, or just busy? */ result = usbat_read(us, USBAT_ATA, direction==DMA_TO_DEVICE ? USBAT_ATA_STATUS : USBAT_ATA_ALTSTATUS, status); if (result!=USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (*status & 0x01) /* check condition */ return USB_STOR_TRANSPORT_FAILED; if (*status & 0x20) /* device fault */ return USB_STOR_TRANSPORT_FAILED; US_DEBUGP("Redoing %s\n", direction==DMA_TO_DEVICE ? "write" : "read"); } else if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; else return usbat_wait_not_busy(us, minutes); } US_DEBUGP("Bummer! %s bulk data 20 times failed.\n", direction==DMA_TO_DEVICE ? "Writing" : "Reading"); return USB_STOR_TRANSPORT_FAILED; } /* * Write to multiple registers: * Allows us to write specific data to any registers. The data to be written * gets packed in this sequence: reg0, data0, reg1, data1, ..., regN, dataN * which gets sent through bulk out. * Not designed for large transfers of data! */ static int usbat_multiple_write(struct us_data *us, unsigned char *registers, unsigned char *data_out, unsigned short num_registers) { int i, result; unsigned char *data = us->iobuf; unsigned char *command = us->iobuf; BUG_ON(num_registers > US_IOBUF_SIZE/2); /* Write to multiple registers, ATA access */ command[0] = 0x40; command[1] = USBAT_ATA | USBAT_CMD_WRITE_REGS; /* No relevance */ command[2] = 0; command[3] = 0; command[4] = 0; command[5] = 0; /* Number of bytes to be transferred (incl. addresses and data) */ command[6] = LSB_of(num_registers*2); command[7] = MSB_of(num_registers*2); /* The setup command */ result = usbat_execute_command(us, command, 8); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; /* Create the reg/data, reg/data sequence */ for (i=0; i<num_registers; i++) { data[i<<1] = registers[i]; data[1+(i<<1)] = data_out[i]; } /* Send the data */ result = usbat_bulk_write(us, data, num_registers*2, 0); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (usbat_get_device_type(us) == USBAT_DEV_HP8200) return usbat_wait_not_busy(us, 0); else return USB_STOR_TRANSPORT_GOOD; } /* * Conditionally read blocks from device: * Allows us to read blocks from a specific data register, based upon the * condition that a status register can be successfully masked with a status * qualifier. If this condition is not initially met, the read will wait * up until a maximum amount of time has elapsed, as specified by timeout. * The read will start when the condition is met, otherwise the command aborts. * * The qualifier defined here is not the value that is masked, it defines * conditions for the write to take place. The actual masked qualifier (and * other related details) are defined beforehand with _set_shuttle_features(). */ static int usbat_read_blocks(struct us_data *us, unsigned char *buffer, int len, int use_sg) { int result; unsigned char *command = us->iobuf; command[0] = 0xC0; command[1] = USBAT_ATA | USBAT_CMD_COND_READ_BLOCK; command[2] = USBAT_ATA_DATA; command[3] = USBAT_ATA_STATUS; command[4] = 0xFD; /* Timeout (ms); */ command[5] = USBAT_QUAL_FCQ; command[6] = LSB_of(len); command[7] = MSB_of(len); /* Multiple block read setup command */ result = usbat_execute_command(us, command, 8); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_FAILED; /* Read the blocks we just asked for */ result = usbat_bulk_read(us, buffer, len, use_sg); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_FAILED; return USB_STOR_TRANSPORT_GOOD; } /* * Conditionally write blocks to device: * Allows us to write blocks to a specific data register, based upon the * condition that a status register can be successfully masked with a status * qualifier. If this condition is not initially met, the write will wait * up until a maximum amount of time has elapsed, as specified by timeout. * The read will start when the condition is met, otherwise the command aborts. * * The qualifier defined here is not the value that is masked, it defines * conditions for the write to take place. The actual masked qualifier (and * other related details) are defined beforehand with _set_shuttle_features(). */ static int usbat_write_blocks(struct us_data *us, unsigned char *buffer, int len, int use_sg) { int result; unsigned char *command = us->iobuf; command[0] = 0x40; command[1] = USBAT_ATA | USBAT_CMD_COND_WRITE_BLOCK; command[2] = USBAT_ATA_DATA; command[3] = USBAT_ATA_STATUS; command[4] = 0xFD; /* Timeout (ms) */ command[5] = USBAT_QUAL_FCQ; command[6] = LSB_of(len); command[7] = MSB_of(len); /* Multiple block write setup command */ result = usbat_execute_command(us, command, 8); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_FAILED; /* Write the data */ result = usbat_bulk_write(us, buffer, len, use_sg); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_FAILED; return USB_STOR_TRANSPORT_GOOD; } /* * Read the User IO register */ static int usbat_read_user_io(struct us_data *us, unsigned char *data_flags) { int result; result = usb_stor_ctrl_transfer(us, us->recv_ctrl_pipe, USBAT_CMD_UIO, 0xC0, 0, 0, data_flags, USBAT_UIO_READ); US_DEBUGP("usbat_read_user_io: UIO register reads %02X\n", (unsigned short) (*data_flags)); return result; } /* * Write to the User IO register */ static int usbat_write_user_io(struct us_data *us, unsigned char enable_flags, unsigned char data_flags) { return usb_stor_ctrl_transfer(us, us->send_ctrl_pipe, USBAT_CMD_UIO, 0x40, short_pack(enable_flags, data_flags), 0, NULL, USBAT_UIO_WRITE); } /* * Reset the device * Often needed on media change. */ static int usbat_device_reset(struct us_data *us) { int rc; /* * Reset peripheral, enable peripheral control signals * (bring reset signal up) */ rc = usbat_write_user_io(us, USBAT_UIO_DRVRST | USBAT_UIO_OE1 | USBAT_UIO_OE0, USBAT_UIO_EPAD | USBAT_UIO_1); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; /* * Enable peripheral control signals * (bring reset signal down) */ rc = usbat_write_user_io(us, USBAT_UIO_OE1 | USBAT_UIO_OE0, USBAT_UIO_EPAD | USBAT_UIO_1); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_GOOD; } /* * Enable card detect */ static int usbat_device_enable_cdt(struct us_data *us) { int rc; /* Enable peripheral control signals and card detect */ rc = usbat_write_user_io(us, USBAT_UIO_ACKD | USBAT_UIO_OE1 | USBAT_UIO_OE0, USBAT_UIO_EPAD | USBAT_UIO_1); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_GOOD; } /* * Determine if media is present. */ static int usbat_flash_check_media_present(unsigned char *uio) { if (*uio & USBAT_UIO_UI0) { US_DEBUGP("usbat_flash_check_media_present: no media detected\n"); return USBAT_FLASH_MEDIA_NONE; } return USBAT_FLASH_MEDIA_CF; } /* * Determine if media has changed since last operation */ static int usbat_flash_check_media_changed(unsigned char *uio) { if (*uio & USBAT_UIO_0) { US_DEBUGP("usbat_flash_check_media_changed: media change detected\n"); return USBAT_FLASH_MEDIA_CHANGED; } return USBAT_FLASH_MEDIA_SAME; } /* * Check for media change / no media and handle the situation appropriately */ static int usbat_flash_check_media(struct us_data *us, struct usbat_info *info) { int rc; unsigned char *uio = us->iobuf; rc = usbat_read_user_io(us, uio); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; /* Check for media existence */ rc = usbat_flash_check_media_present(uio); if (rc == USBAT_FLASH_MEDIA_NONE) { info->sense_key = 0x02; info->sense_asc = 0x3A; info->sense_ascq = 0x00; return USB_STOR_TRANSPORT_FAILED; } /* Check for media change */ rc = usbat_flash_check_media_changed(uio); if (rc == USBAT_FLASH_MEDIA_CHANGED) { /* Reset and re-enable card detect */ rc = usbat_device_reset(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; rc = usbat_device_enable_cdt(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; msleep(50); rc = usbat_read_user_io(us, uio); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; info->sense_key = UNIT_ATTENTION; info->sense_asc = 0x28; info->sense_ascq = 0x00; return USB_STOR_TRANSPORT_FAILED; } return USB_STOR_TRANSPORT_GOOD; } /* * Determine whether we are controlling a flash-based reader/writer, * or a HP8200-based CD drive. * Sets transport functions as appropriate. */ static int usbat_identify_device(struct us_data *us, struct usbat_info *info) { int rc; unsigned char status; if (!us || !info) return USB_STOR_TRANSPORT_ERROR; rc = usbat_device_reset(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; msleep(500); /* * In attempt to distinguish between HP CDRW's and Flash readers, we now * execute the IDENTIFY PACKET DEVICE command. On ATA devices (i.e. flash * readers), this command should fail with error. On ATAPI devices (i.e. * CDROM drives), it should succeed. */ rc = usbat_write(us, USBAT_ATA, USBAT_ATA_CMD, 0xA1); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; rc = usbat_get_status(us, &status); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; /* Check for error bit, or if the command 'fell through' */ if (status == 0xA1 || !(status & 0x01)) { /* Device is HP 8200 */ US_DEBUGP("usbat_identify_device: Detected HP8200 CDRW\n"); info->devicetype = USBAT_DEV_HP8200; } else { /* Device is a CompactFlash reader/writer */ US_DEBUGP("usbat_identify_device: Detected Flash reader/writer\n"); info->devicetype = USBAT_DEV_FLASH; } return USB_STOR_TRANSPORT_GOOD; } /* * Set the transport function based on the device type */ static int usbat_set_transport(struct us_data *us, struct usbat_info *info, int devicetype) { if (!info->devicetype) info->devicetype = devicetype; if (!info->devicetype) usbat_identify_device(us, info); switch (info->devicetype) { default: return USB_STOR_TRANSPORT_ERROR; case USBAT_DEV_HP8200: us->transport = usbat_hp8200e_transport; break; case USBAT_DEV_FLASH: us->transport = usbat_flash_transport; break; } return 0; } /* * Read the media capacity */ static int usbat_flash_get_sector_count(struct us_data *us, struct usbat_info *info) { unsigned char registers[3] = { USBAT_ATA_SECCNT, USBAT_ATA_DEVICE, USBAT_ATA_CMD, }; unsigned char command[3] = { 0x01, 0xA0, 0xEC }; unsigned char *reply; unsigned char status; int rc; if (!us || !info) return USB_STOR_TRANSPORT_ERROR; reply = kmalloc(512, GFP_NOIO); if (!reply) return USB_STOR_TRANSPORT_ERROR; /* ATA command : IDENTIFY DEVICE */ rc = usbat_multiple_write(us, registers, command, 3); if (rc != USB_STOR_XFER_GOOD) { US_DEBUGP("usbat_flash_get_sector_count: Gah! identify_device failed\n"); rc = USB_STOR_TRANSPORT_ERROR; goto leave; } /* Read device status */ if (usbat_get_status(us, &status) != USB_STOR_XFER_GOOD) { rc = USB_STOR_TRANSPORT_ERROR; goto leave; } msleep(100); /* Read the device identification data */ rc = usbat_read_block(us, reply, 512, 0); if (rc != USB_STOR_TRANSPORT_GOOD) goto leave; info->sectors = ((u32)(reply[117]) << 24) | ((u32)(reply[116]) << 16) | ((u32)(reply[115]) << 8) | ((u32)(reply[114]) ); rc = USB_STOR_TRANSPORT_GOOD; leave: kfree(reply); return rc; } /* * Read data from device */ static int usbat_flash_read_data(struct us_data *us, struct usbat_info *info, u32 sector, u32 sectors) { unsigned char registers[7] = { USBAT_ATA_FEATURES, USBAT_ATA_SECCNT, USBAT_ATA_SECNUM, USBAT_ATA_LBA_ME, USBAT_ATA_LBA_HI, USBAT_ATA_DEVICE, USBAT_ATA_STATUS, }; unsigned char command[7]; unsigned char *buffer; unsigned char thistime; unsigned int totallen, alloclen; int len, result; unsigned int sg_idx = 0, sg_offset = 0; result = usbat_flash_check_media(us, info); if (result != USB_STOR_TRANSPORT_GOOD) return result; /* * we're working in LBA mode. according to the ATA spec, * we can support up to 28-bit addressing. I don't know if Jumpshot * supports beyond 24-bit addressing. It's kind of hard to test * since it requires > 8GB CF card. */ if (sector > 0x0FFFFFFF) return USB_STOR_TRANSPORT_ERROR; totallen = sectors * info->ssize; /* * Since we don't read more than 64 KB at a time, we have to create * a bounce buffer and move the data a piece at a time between the * bounce buffer and the actual transfer buffer. */ alloclen = min(totallen, 65536u); buffer = kmalloc(alloclen, GFP_NOIO); if (buffer == NULL) return USB_STOR_TRANSPORT_ERROR; do { /* * loop, never allocate or transfer more than 64k at once * (min(128k, 255*info->ssize) is the real limit) */ len = min(totallen, alloclen); thistime = (len / info->ssize) & 0xff; /* ATA command 0x20 (READ SECTORS) */ usbat_pack_ata_sector_cmd(command, thistime, sector, 0x20); /* Write/execute ATA read command */ result = usbat_multiple_write(us, registers, command, 7); if (result != USB_STOR_TRANSPORT_GOOD) goto leave; /* Read the data we just requested */ result = usbat_read_blocks(us, buffer, len, 0); if (result != USB_STOR_TRANSPORT_GOOD) goto leave; US_DEBUGP("usbat_flash_read_data: %d bytes\n", len); /* Store the data in the transfer buffer */ usb_stor_access_xfer_buf(buffer, len, us->srb, &sg_idx, &sg_offset, TO_XFER_BUF); sector += thistime; totallen -= len; } while (totallen > 0); kfree(buffer); return USB_STOR_TRANSPORT_GOOD; leave: kfree(buffer); return USB_STOR_TRANSPORT_ERROR; } /* * Write data to device */ static int usbat_flash_write_data(struct us_data *us, struct usbat_info *info, u32 sector, u32 sectors) { unsigned char registers[7] = { USBAT_ATA_FEATURES, USBAT_ATA_SECCNT, USBAT_ATA_SECNUM, USBAT_ATA_LBA_ME, USBAT_ATA_LBA_HI, USBAT_ATA_DEVICE, USBAT_ATA_STATUS, }; unsigned char command[7]; unsigned char *buffer; unsigned char thistime; unsigned int totallen, alloclen; int len, result; unsigned int sg_idx = 0, sg_offset = 0; result = usbat_flash_check_media(us, info); if (result != USB_STOR_TRANSPORT_GOOD) return result; /* * we're working in LBA mode. according to the ATA spec, * we can support up to 28-bit addressing. I don't know if the device * supports beyond 24-bit addressing. It's kind of hard to test * since it requires > 8GB media. */ if (sector > 0x0FFFFFFF) return USB_STOR_TRANSPORT_ERROR; totallen = sectors * info->ssize; /* * Since we don't write more than 64 KB at a time, we have to create * a bounce buffer and move the data a piece at a time between the * bounce buffer and the actual transfer buffer. */ alloclen = min(totallen, 65536u); buffer = kmalloc(alloclen, GFP_NOIO); if (buffer == NULL) return USB_STOR_TRANSPORT_ERROR; do { /* * loop, never allocate or transfer more than 64k at once * (min(128k, 255*info->ssize) is the real limit) */ len = min(totallen, alloclen); thistime = (len / info->ssize) & 0xff; /* Get the data from the transfer buffer */ usb_stor_access_xfer_buf(buffer, len, us->srb, &sg_idx, &sg_offset, FROM_XFER_BUF); /* ATA command 0x30 (WRITE SECTORS) */ usbat_pack_ata_sector_cmd(command, thistime, sector, 0x30); /* Write/execute ATA write command */ result = usbat_multiple_write(us, registers, command, 7); if (result != USB_STOR_TRANSPORT_GOOD) goto leave; /* Write the data */ result = usbat_write_blocks(us, buffer, len, 0); if (result != USB_STOR_TRANSPORT_GOOD) goto leave; sector += thistime; totallen -= len; } while (totallen > 0); kfree(buffer); return result; leave: kfree(buffer); return USB_STOR_TRANSPORT_ERROR; } /* * Squeeze a potentially huge (> 65535 byte) read10 command into * a little ( <= 65535 byte) ATAPI pipe */ static int usbat_hp8200e_handle_read10(struct us_data *us, unsigned char *registers, unsigned char *data, struct scsi_cmnd *srb) { int result = USB_STOR_TRANSPORT_GOOD; unsigned char *buffer; unsigned int len; unsigned int sector; unsigned int sg_segment = 0; unsigned int sg_offset = 0; US_DEBUGP("handle_read10: transfersize %d\n", srb->transfersize); if (srb->request_bufflen < 0x10000) { result = usbat_hp8200e_rw_block_test(us, USBAT_ATA, registers, data, 19, USBAT_ATA_DATA, USBAT_ATA_STATUS, 0xFD, (USBAT_QUAL_FCQ | USBAT_QUAL_ALQ), DMA_FROM_DEVICE, srb->request_buffer, srb->request_bufflen, srb->use_sg, 1); return result; } /* * Since we're requesting more data than we can handle in * a single read command (max is 64k-1), we will perform * multiple reads, but each read must be in multiples of * a sector. Luckily the sector size is in srb->transfersize * (see linux/drivers/scsi/sr.c). */ if (data[7+0] == GPCMD_READ_CD) { len = short_pack(data[7+9], data[7+8]); len <<= 16; len |= data[7+7]; US_DEBUGP("handle_read10: GPCMD_READ_CD: len %d\n", len); srb->transfersize = srb->request_bufflen/len; } if (!srb->transfersize) { srb->transfersize = 2048; /* A guess */ US_DEBUGP("handle_read10: transfersize 0, forcing %d\n", srb->transfersize); } /* * Since we only read in one block at a time, we have to create * a bounce buffer and move the data a piece at a time between the * bounce buffer and the actual transfer buffer. */ len = (65535/srb->transfersize) * srb->transfersize; US_DEBUGP("Max read is %d bytes\n", len); len = min(len, srb->request_bufflen); buffer = kmalloc(len, GFP_NOIO); if (buffer == NULL) /* bloody hell! */ return USB_STOR_TRANSPORT_FAILED; sector = short_pack(data[7+3], data[7+2]); sector <<= 16; sector |= short_pack(data[7+5], data[7+4]); transferred = 0; sg_segment = 0; /* for keeping track of where we are in */ sg_offset = 0; /* the scatter/gather list */ while (transferred != srb->request_bufflen) { if (len > srb->request_bufflen - transferred) len = srb->request_bufflen - transferred; data[3] = len&0xFF; /* (cylL) = expected length (L) */ data[4] = (len>>8)&0xFF; /* (cylH) = expected length (H) */ /* Fix up the SCSI command sector and num sectors */ data[7+2] = MSB_of(sector>>16); /* SCSI command sector */ data[7+3] = LSB_of(sector>>16); data[7+4] = MSB_of(sector&0xFFFF); data[7+5] = LSB_of(sector&0xFFFF); if (data[7+0] == GPCMD_READ_CD) data[7+6] = 0; data[7+7] = MSB_of(len / srb->transfersize); /* SCSI command */ data[7+8] = LSB_of(len / srb->transfersize); /* num sectors */ result = usbat_hp8200e_rw_block_test(us, USBAT_ATA, registers, data, 19, USBAT_ATA_DATA, USBAT_ATA_STATUS, 0xFD, (USBAT_QUAL_FCQ | USBAT_QUAL_ALQ), DMA_FROM_DEVICE, buffer, len, 0, 1); if (result != USB_STOR_TRANSPORT_GOOD) break; /* Store the data in the transfer buffer */ usb_stor_access_xfer_buf(buffer, len, srb, &sg_segment, &sg_offset, TO_XFER_BUF); /* Update the amount transferred and the sector number */ transferred += len; sector += len / srb->transfersize; } /* while transferred != srb->request_bufflen */ kfree(buffer); return result; } static int usbat_select_and_test_registers(struct us_data *us) { int selector; unsigned char *status = us->iobuf; /* try device = master, then device = slave. */ for (selector = 0xA0; selector <= 0xB0; selector += 0x10) { if (usbat_write(us, USBAT_ATA, USBAT_ATA_DEVICE, selector) != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (usbat_read(us, USBAT_ATA, USBAT_ATA_STATUS, status) != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (usbat_read(us, USBAT_ATA, USBAT_ATA_DEVICE, status) != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_HI, status) != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (usbat_write(us, USBAT_ATA, USBAT_ATA_LBA_ME, 0x55) != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (usbat_write(us, USBAT_ATA, USBAT_ATA_LBA_HI, 0xAA) != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; } return USB_STOR_TRANSPORT_GOOD; } /* * Initialize the USBAT processor and the storage device */ static int init_usbat(struct us_data *us, int devicetype) { int rc; struct usbat_info *info; unsigned char subcountH = USBAT_ATA_LBA_HI; unsigned char subcountL = USBAT_ATA_LBA_ME; unsigned char *status = us->iobuf; us->extra = kzalloc(sizeof(struct usbat_info), GFP_NOIO); if (!us->extra) { US_DEBUGP("init_usbat: Gah! Can't allocate storage for usbat info struct!\n"); return 1; } info = (struct usbat_info *) (us->extra); /* Enable peripheral control signals */ rc = usbat_write_user_io(us, USBAT_UIO_OE1 | USBAT_UIO_OE0, USBAT_UIO_EPAD | USBAT_UIO_1); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; US_DEBUGP("INIT 1\n"); msleep(2000); rc = usbat_read_user_io(us, status); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; US_DEBUGP("INIT 2\n"); rc = usbat_read_user_io(us, status); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; rc = usbat_read_user_io(us, status); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; US_DEBUGP("INIT 3\n"); rc = usbat_select_and_test_registers(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; US_DEBUGP("INIT 4\n"); rc = usbat_read_user_io(us, status); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; US_DEBUGP("INIT 5\n"); /* Enable peripheral control signals and card detect */ rc = usbat_device_enable_cdt(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; US_DEBUGP("INIT 6\n"); rc = usbat_read_user_io(us, status); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; US_DEBUGP("INIT 7\n"); msleep(1400); rc = usbat_read_user_io(us, status); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; US_DEBUGP("INIT 8\n"); rc = usbat_select_and_test_registers(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; US_DEBUGP("INIT 9\n"); /* At this point, we need to detect which device we are using */ if (usbat_set_transport(us, info, devicetype)) return USB_STOR_TRANSPORT_ERROR; US_DEBUGP("INIT 10\n"); if (usbat_get_device_type(us) == USBAT_DEV_FLASH) { subcountH = 0x02; subcountL = 0x00; } rc = usbat_set_shuttle_features(us, (USBAT_FEAT_ETEN | USBAT_FEAT_ET2 | USBAT_FEAT_ET1), 0x00, 0x88, 0x08, subcountH, subcountL); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; US_DEBUGP("INIT 11\n"); return USB_STOR_TRANSPORT_GOOD; } /* * Transport for the HP 8200e */ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us) { int result; unsigned char *status = us->iobuf; unsigned char registers[32]; unsigned char data[32]; unsigned int len; int i; char string[64]; len = srb->request_bufflen; /* Send A0 (ATA PACKET COMMAND). Note: I guess we're never going to get any of the ATA commands... just ATA Packet Commands. */ registers[0] = USBAT_ATA_FEATURES; registers[1] = USBAT_ATA_SECCNT; registers[2] = USBAT_ATA_SECNUM; registers[3] = USBAT_ATA_LBA_ME; registers[4] = USBAT_ATA_LBA_HI; registers[5] = USBAT_ATA_DEVICE; registers[6] = USBAT_ATA_CMD; data[0] = 0x00; data[1] = 0x00; data[2] = 0x00; data[3] = len&0xFF; /* (cylL) = expected length (L) */ data[4] = (len>>8)&0xFF; /* (cylH) = expected length (H) */ data[5] = 0xB0; /* (device sel) = slave */ data[6] = 0xA0; /* (command) = ATA PACKET COMMAND */ for (i=7; i<19; i++) { registers[i] = 0x10; data[i] = (i-7 >= srb->cmd_len) ? 0 : srb->cmnd[i-7]; } result = usbat_get_status(us, status); US_DEBUGP("Status = %02X\n", *status); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (srb->cmnd[0] == TEST_UNIT_READY) transferred = 0; if (srb->sc_data_direction == DMA_TO_DEVICE) { result = usbat_hp8200e_rw_block_test(us, USBAT_ATA, registers, data, 19, USBAT_ATA_DATA, USBAT_ATA_STATUS, 0xFD, (USBAT_QUAL_FCQ | USBAT_QUAL_ALQ), DMA_TO_DEVICE, srb->request_buffer, len, srb->use_sg, 10); if (result == USB_STOR_TRANSPORT_GOOD) { transferred += len; US_DEBUGP("Wrote %08X bytes\n", transferred); } return result; } else if (srb->cmnd[0] == READ_10 || srb->cmnd[0] == GPCMD_READ_CD) { return usbat_hp8200e_handle_read10(us, registers, data, srb); } if (len > 0xFFFF) { US_DEBUGP("Error: len = %08X... what do I do now?\n", len); return USB_STOR_TRANSPORT_ERROR; } if ( (result = usbat_multiple_write(us, registers, data, 7)) != USB_STOR_TRANSPORT_GOOD) { return result; } /* * Write the 12-byte command header. * * If the command is BLANK then set the timer for 75 minutes. * Otherwise set it for 10 minutes. * * NOTE: THE 8200 DOCUMENTATION STATES THAT BLANKING A CDRW * AT SPEED 4 IS UNRELIABLE!!! */ if ((result = usbat_write_block(us, USBAT_ATA, srb->cmnd, 12, (srb->cmnd[0]==GPCMD_BLANK ? 75 : 10), 0) != USB_STOR_TRANSPORT_GOOD)) { return result; } /* If there is response data to be read in then do it here. */ if (len != 0 && (srb->sc_data_direction == DMA_FROM_DEVICE)) { /* How many bytes to read in? Check cylL register */ if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) != USB_STOR_XFER_GOOD) { return USB_STOR_TRANSPORT_ERROR; } if (len > 0xFF) { /* need to read cylH also */ len = *status; if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_HI, status) != USB_STOR_XFER_GOOD) { return USB_STOR_TRANSPORT_ERROR; } len += ((unsigned int) *status)<<8; } else len = *status; result = usbat_read_block(us, srb->request_buffer, len, srb->use_sg); /* Debug-print the first 32 bytes of the transfer */ if (!srb->use_sg) { string[0] = 0; for (i=0; i<len && i<32; i++) { sprintf(string+strlen(string), "%02X ", ((unsigned char *)srb->request_buffer)[i]); if ((i%16)==15) { US_DEBUGP("%s\n", string); string[0] = 0; } } if (string[0]!=0) US_DEBUGP("%s\n", string); } } return result; } /* * Transport for USBAT02-based CompactFlash and similar storage devices */ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) { int rc; struct usbat_info *info = (struct usbat_info *) (us->extra); unsigned long block, blocks; unsigned char *ptr = us->iobuf; static unsigned char inquiry_response[36] = { 0x00, 0x80, 0x00, 0x01, 0x1F, 0x00, 0x00, 0x00 }; if (srb->cmnd[0] == INQUIRY) { US_DEBUGP("usbat_flash_transport: INQUIRY. Returning bogus response.\n"); memcpy(ptr, inquiry_response, sizeof(inquiry_response)); fill_inquiry_response(us, ptr, 36); return USB_STOR_TRANSPORT_GOOD; } if (srb->cmnd[0] == READ_CAPACITY) { rc = usbat_flash_check_media(us, info); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; rc = usbat_flash_get_sector_count(us, info); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; /* hard coded 512 byte sectors as per ATA spec */ info->ssize = 0x200; US_DEBUGP("usbat_flash_transport: READ_CAPACITY: %ld sectors, %ld bytes per sector\n", info->sectors, info->ssize); /* * build the reply * note: must return the sector number of the last sector, * *not* the total number of sectors */ ((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1); ((__be32 *) ptr)[1] = cpu_to_be32(info->ssize); usb_stor_set_xfer_buf(ptr, 8, srb); return USB_STOR_TRANSPORT_GOOD; } if (srb->cmnd[0] == MODE_SELECT_10) { US_DEBUGP("usbat_flash_transport: Gah! MODE_SELECT_10.\n"); return USB_STOR_TRANSPORT_ERROR; } if (srb->cmnd[0] == READ_10) { block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); US_DEBUGP("usbat_flash_transport: READ_10: read block 0x%04lx count %ld\n", block, blocks); return usbat_flash_read_data(us, info, block, blocks); } if (srb->cmnd[0] == READ_12) { /* * I don't think we'll ever see a READ_12 but support it anyway */ block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); US_DEBUGP("usbat_flash_transport: READ_12: read block 0x%04lx count %ld\n", block, blocks); return usbat_flash_read_data(us, info, block, blocks); } if (srb->cmnd[0] == WRITE_10) { block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); US_DEBUGP("usbat_flash_transport: WRITE_10: write block 0x%04lx count %ld\n", block, blocks); return usbat_flash_write_data(us, info, block, blocks); } if (srb->cmnd[0] == WRITE_12) { /* * I don't think we'll ever see a WRITE_12 but support it anyway */ block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); US_DEBUGP("usbat_flash_transport: WRITE_12: write block 0x%04lx count %ld\n", block, blocks); return usbat_flash_write_data(us, info, block, blocks); } if (srb->cmnd[0] == TEST_UNIT_READY) { US_DEBUGP("usbat_flash_transport: TEST_UNIT_READY.\n"); rc = usbat_flash_check_media(us, info); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; return usbat_check_status(us); } if (srb->cmnd[0] == REQUEST_SENSE) { US_DEBUGP("usbat_flash_transport: REQUEST_SENSE.\n"); memset(ptr, 0, 18); ptr[0] = 0xF0; ptr[2] = info->sense_key; ptr[7] = 11; ptr[12] = info->sense_asc; ptr[13] = info->sense_ascq; usb_stor_set_xfer_buf(ptr, 18, srb); return USB_STOR_TRANSPORT_GOOD; } if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) { /* * sure. whatever. not like we can stop the user from popping * the media out of the device (no locking doors, etc) */ return USB_STOR_TRANSPORT_GOOD; } US_DEBUGP("usbat_flash_transport: Gah! Unknown command: %d (0x%x)\n", srb->cmnd[0], srb->cmnd[0]); info->sense_key = 0x05; info->sense_asc = 0x20; info->sense_ascq = 0x00; return USB_STOR_TRANSPORT_FAILED; } int init_usbat_cd(struct us_data *us) { return init_usbat(us, USBAT_DEV_HP8200); } int init_usbat_flash(struct us_data *us) { return init_usbat(us, USBAT_DEV_FLASH); } int init_usbat_probe(struct us_data *us) { return init_usbat(us, 0); } /* * Default transport function. Attempts to detect which transport function * should be called, makes it the new default, and calls it. * * This function should never be called. Our usbat_init() function detects the * device type and changes the us->transport ptr to the transport function * relevant to the device. * However, we'll support this impossible(?) case anyway. */ int usbat_transport(struct scsi_cmnd *srb, struct us_data *us) { struct usbat_info *info = (struct usbat_info*) (us->extra); if (usbat_set_transport(us, info, 0)) return USB_STOR_TRANSPORT_ERROR; return us->transport(srb, us); }
gpl-2.0
CharlieMarshall/xbmc
xbmc/peripherals/devices/PeripheralCecAdapter.h
7238
#pragma once /* * Copyright (C) 2005-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "system.h" #if !defined(HAVE_LIBCEC) #include "Peripheral.h" // an empty implementation, so CPeripherals can be compiled without a bunch of #ifdef's when libCEC is not available namespace PERIPHERALS { class CPeripheralCecAdapter : public CPeripheral { public: bool HasAudioControl(void) { return false; } void VolumeUp(void) {} void VolumeDown(void) {} bool IsMuted(void) { return false; } void ToggleMute(void) {} bool ToggleDeviceState(CecStateChange mode = STATE_SWITCH_TOGGLE, bool forceType = false) { return false; } int GetButton(void) { return 0; } unsigned int GetHoldTime(void) { return 0; } void ResetButton(void) {} }; } #else #include "PeripheralHID.h" #include "interfaces/AnnouncementManager.h" #include "threads/Thread.h" #include "threads/CriticalSection.h" #include <queue> // undefine macro isset, it collides with function in cectypes.h #ifdef isset #undef isset #endif #include <libcec/cectypes.h> class DllLibCEC; namespace CEC { class ICECAdapter; }; namespace PERIPHERALS { class CPeripheralCecAdapterUpdateThread; typedef struct { int iButton; unsigned int iDuration; } CecButtonPress; typedef enum { VOLUME_CHANGE_NONE, VOLUME_CHANGE_UP, VOLUME_CHANGE_DOWN, VOLUME_CHANGE_MUTE } CecVolumeChange; class CPeripheralCecAdapter : public CPeripheralHID, public ANNOUNCEMENT::IAnnouncer, private CThread { friend class CPeripheralCecAdapterUpdateThread; public: CPeripheralCecAdapter(const PeripheralScanResult& scanResult); virtual ~CPeripheralCecAdapter(void); void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data); // audio control bool HasAudioControl(void); void VolumeUp(void); void VolumeDown(void); void ToggleMute(void); bool IsMuted(void); // CPeripheral callbacks void OnSettingChanged(const CStdString &strChangedSetting); void OnDeviceRemoved(void); // input int GetButton(void); unsigned int GetHoldTime(void); void ResetButton(void); // public CEC methods void ActivateSource(void); void StandbyDevices(void); bool ToggleDeviceState(CecStateChange mode = STATE_SWITCH_TOGGLE, bool forceType = false); private: bool InitialiseFeature(const PeripheralFeature feature); void ResetMembers(void); void Process(void); bool IsRunning(void) const; bool OpenConnection(void); bool ReopenConnection(void); void SetConfigurationFromSettings(void); void SetConfigurationFromLibCEC(const CEC::libcec_configuration &config); void SetVersionInfo(const CEC::libcec_configuration &configuration); static void ReadLogicalAddresses(const CStdString &strString, CEC::cec_logical_addresses &addresses); static void ReadLogicalAddresses(int iLocalisedId, CEC::cec_logical_addresses &addresses); bool WriteLogicalAddresses(const CEC::cec_logical_addresses& addresses, const std::string& strSettingName, const std::string& strAdvancedSettingName); void ProcessActivateSource(void); void ProcessStandbyDevices(void); void ProcessVolumeChange(void); void PushCecKeypress(const CEC::cec_keypress &key); void PushCecKeypress(const CecButtonPress &key); void GetNextKey(void); void SetAudioSystemConnected(bool bSetTo); void SetMenuLanguage(const char *strLanguage); // callbacks from libCEC static int CecLogMessage(void *cbParam, const CEC::cec_log_message message); static int CecCommand(void *cbParam, const CEC::cec_command command); static int CecConfiguration(void *cbParam, const CEC::libcec_configuration config); static int CecAlert(void *cbParam, const CEC::libcec_alert alert, const CEC::libcec_parameter data); static void CecSourceActivated(void *param, const CEC::cec_logical_address address, const uint8_t activated); static int CecKeyPress(void *cbParam, const CEC::cec_keypress key); DllLibCEC* m_dll; CEC::ICECAdapter* m_cecAdapter; bool m_bStarted; bool m_bHasButton; bool m_bIsReady; bool m_bHasConnectedAudioSystem; CStdString m_strMenuLanguage; CDateTime m_screensaverLastActivated; std::vector<CecButtonPress> m_buttonQueue; CecButtonPress m_currentButton; std::queue<CecVolumeChange> m_volumeChangeQueue; unsigned int m_lastKeypress; CecVolumeChange m_lastChange; int m_iExitCode; bool m_bIsMuted; bool m_bGoingToStandby; bool m_bIsRunning; bool m_bDeviceRemoved; CPeripheralCecAdapterUpdateThread*m_queryThread; CEC::ICECCallbacks m_callbacks; CCriticalSection m_critSection; CEC::libcec_configuration m_configuration; bool m_bActiveSourcePending; bool m_bStandbyPending; CDateTime m_preventActivateSourceOnPlay; bool m_bActiveSourceBeforeStandby; bool m_bOnPlayReceived; bool m_bPlaybackPaused; CStdString m_strComPort; }; class CPeripheralCecAdapterUpdateThread : public CThread { public: CPeripheralCecAdapterUpdateThread(CPeripheralCecAdapter *adapter, CEC::libcec_configuration *configuration); virtual ~CPeripheralCecAdapterUpdateThread(void); void Signal(void); bool UpdateConfiguration(CEC::libcec_configuration *configuration); protected: void UpdateMenuLanguage(void); CStdString UpdateAudioSystemStatus(void); bool WaitReady(void); bool SetInitialConfiguration(void); void Process(void); CPeripheralCecAdapter * m_adapter; CEvent m_event; CCriticalSection m_critSection; CEC::libcec_configuration m_configuration; CEC::libcec_configuration m_nextConfiguration; bool m_bNextConfigurationScheduled; bool m_bIsUpdating; }; } #endif
gpl-2.0
githubupttik/upttik
components/com_kunena/template/blue_eagle/html/user/default_tab.php
5180
<?php /** * Kunena Component * @package Kunena.Template.Blue_Eagle * @subpackage User * * @copyright (C) 2008 - 2016 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.kunena.org **/ defined ( '_JEXEC' ) or die (); JHtml::_('behavior.calendar'); JHtml::_('behavior.tooltip'); ?> <div id="kprofile-rightcoltop"> <div class="kprofile-rightcol2"> <?php $this->displayTemplateFile('user', 'default', 'social'); ?> </div> <div class="kprofile-rightcol1"> <ul> <li><span class="kicon-profile kicon-profile-location"></span><strong><?php echo JText::_('COM_KUNENA_MYPROFILE_LOCATION'); ?>:</strong> <?php echo $this->locationlink; ?></li> <!-- The gender determines the suffix on the span class- gender-male & gender-female --> <li><span class="kicon-profile kicon-profile-gender-<?php echo $this->genderclass; ?>"></span><strong><?php echo JText::_('COM_KUNENA_MYPROFILE_GENDER'); ?>:</strong> <?php echo $this->gender; ?></li> <li class="bd"><span class="kicon-profile kicon-profile-birthdate"></span><strong><?php echo JText::_('COM_KUNENA_MYPROFILE_BIRTHDATE'); ?>:</strong> <span title="<?php echo KunenaDate::getInstance($this->profile->birthdate)->toKunena('ago', 'GMT'); ?>"><?php echo KunenaDate::getInstance($this->profile->birthdate)->toKunena('date', 'GMT'); ?></span> <!-- <a href="#" title=""><span class="bday-remind"></span></a> --> </li> </ul> </div> </div> <div class="clrline"></div> <div id="kprofile-rightcolbot"> <div class="kprofile-rightcol2"> <?php if ($this->email || !empty($this->profile->websiteurl)): ?> <ul> <?php if ($this->email): ?> <li><span class="kicon-profile kicon-profile-email"></span><?php echo $this->email; ?></li> <?php endif; ?> <?php if (!empty($this->profile->websiteurl)): ?> <?php // FIXME: we need a better way to add http/https ?> <li><span class="kicon-profile kicon-profile-website"></span><a href="<?php echo $this->escape($this->websiteurl); ?>" target="_blank"><?php echo KunenaHtmlParser::parseText(trim($this->profile->websitename) ? $this->profile->websitename : $this->websiteurl); ?></a></li> <?php endif; ?> </ul> <?php endif;?> </div> <div class="kprofile-rightcol1"> <h4><?php echo JText::_('COM_KUNENA_MYPROFILE_SIGNATURE'); ?></h4> <div class="kmsgsignature"><div><?php echo $this->signatureHtml ?></div></div> </div> </div> <div class="clrline"></div> <div id="kprofile-tabs"> <dl class="tabs"> <?php if($this->showUserPosts) : ?> <dt class="open" title="<?php echo JText::_('COM_KUNENA_USERPOSTS'); ?>"><?php echo JText::_('COM_KUNENA_USERPOSTS'); ?></dt> <dd style="display: none;"> <?php $this->displayUserPosts(); ?> </dd> <?php endif; ?> <?php if ($this->showSubscriptions) :?> <dt class="closed" title="<?php echo JText::_('COM_KUNENA_SUBSCRIPTIONS'); ?>"><?php echo JText::_('COM_KUNENA_SUBSCRIPTIONS'); ?></dt> <dd style="display: none;"> <?php $this->displayCategoriesSubscriptions(); ?> <?php $this->displaySubscriptions(); ?> </dd> <?php endif; ?> <?php if ($this->showFavorites) : ?> <dt class="closed" title="<?php echo JText::_('COM_KUNENA_FAVORITES'); ?>"><?php echo JText::_('COM_KUNENA_FAVORITES'); ?></dt> <dd style="display: none;"> <?php $this->displayFavorites(); ?> </dd> <?php endif; ?> <?php if($this->showThankyou) : ?> <dt class="closed" title="<?php echo JText::_('COM_KUNENA_THANK_YOU'); ?>"><?php echo JText::_('COM_KUNENA_THANK_YOU'); ?></dt> <dd style="display: none;"> <?php $this->displayGotThankyou(); ?> <?php $this->displaySaidThankyou(); ?> </dd> <?php endif; ?> <?php if ($this->showUnapprovedPosts): ?> <dt class="open" title="<?php echo JText::_('COM_KUNENA_MESSAGE_ADMINISTRATION'); ?>"><?php echo JText::_('COM_KUNENA_MESSAGE_ADMINISTRATION'); ?></dt> <dd style="display: none;"> <?php $this->displayUnapprovedPosts(); ?> </dd> <?php endif; ?> <?php if ($this->showAttachments): ?> <dt class="closed" title="<?php echo JText::_('COM_KUNENA_MANAGE_ATTACHMENTS'); ?>"><?php echo JText::_('COM_KUNENA_MANAGE_ATTACHMENTS'); ?></dt> <dd style="display: none;"> <?php $this->displayAttachments(); ?> </dd> <?php endif;?> <?php if ($this->showBanManager): ?> <dt class="closed" title="<?php echo JText::_('COM_KUNENA_BAN_BANMANAGER'); ?>"><?php echo JText::_('COM_KUNENA_BAN_BANMANAGER'); ?></dt> <dd style="display: none;"> <?php $this->displayBanManager(); ?> </dd> <?php endif;?> <?php if ($this->showBanHistory):?> <dt class="closed" title="<?php echo JText::_('COM_KUNENA_BAN_BANHISTORY'); ?>"><?php echo JText::_('COM_KUNENA_BAN_BANHISTORY'); ?></dt> <dd style="display: none;"> <?php $this->displayBanHistory(); ?> </dd> <?php endif;?> <?php if ($this->showBanUser) : ?> <dt class="closed" title="<?php echo $this->banInfo->id ? JText::_('COM_KUNENA_BAN_EDIT') : JText::_('COM_KUNENA_BAN_NEW' ); ?>"><?php echo $this->banInfo->id ? JText::_('COM_KUNENA_BAN_EDIT') : JText::_('COM_KUNENA_BAN_NEW' ); ?></dt> <dd style="display: none;"> <?php $this->displayBanUser(); ?> </dd> <?php endif; ?> </dl> </div>
gpl-2.0
ishoj/ishoj.dk
public_html/sites/all/themes/ishoj/templates/taxonomy-term--aktivitetstype.tpl.php
5453
<?php /** * @file * Default theme implementation to display a term. * * Available variables: * - $name: (deprecated) The unsanitized name of the term. Use $term_name * instead. * - $content: An array of items for the content of the term (fields and * description). Use render($content) to print them all, or print a subset * such as render($content['field_example']). Use * hide($content['field_example']) to temporarily suppress the printing of a * given element. * - $term_url: Direct URL of the current term. * - $term_name: Name of the current term. * - $classes: String of classes that can be used to style contextually through * CSS. It can be manipulated through the variable $classes_array from * preprocess functions. The default values can be one or more of the following: * - taxonomy-term: The current template type, i.e., "theming hook". * - vocabulary-[vocabulary-name]: The vocabulary to which the term belongs to. * For example, if the term is a "Tag" it would result in "vocabulary-tag". * * Other variables: * - $term: Full term object. Contains data that may not be safe. * - $view_mode: View mode, e.g. 'full', 'teaser'... * - $page: Flag for the full page state. * - $classes_array: Array of html class attribute values. It is flattened * into a string within the variable $classes. * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in * teaser listings. * - $id: Position of the term. Increments each time it's output. * - $is_front: Flags true when presented in the front page. * - $logged_in: Flags true when the current user is a logged-in member. * - $is_admin: Flags true when the current user is an administrator. * * @see template_preprocess() * @see template_preprocess_taxonomy_term() * @see template_process() * * @ingroup themeable */ ?> <?php $output = ""; //$output .= "<h1>" . $term->tid . "</h1>"; $output .= "<!-- ARTIKEL START -->"; $output .= "<section id=\"taxonomy-term-" . $term->tid . "\" class=\"" . $classes . " aktivitetsside\">"; $output .= "<div class=\"container\">"; // Brødkrummesti $output .= "<div class=\"row\">"; $output .= "<div class=\"grid-two-thirds\">"; $output .= "<p class=\"breadcrumbs\">" . theme('breadcrumb', array('breadcrumb'=>drupal_get_breadcrumb())) . " / " . $term_name . "</p>"; $output .= "</div>"; $output .= "</div>"; $output .= "<div class=\"row second\">"; $output .= "<div class=\"grid-two-thirds\">"; $output .= "<h1>Aktiviteter i kategorien \"" . $term_name . "\"</h1>"; // $output .= "<h1>" . $term_name . "</h1>"; $output .= "</div>"; $output .= "<div class=\"grid-third sociale-medier social-desktop\"></div>"; $output .= "</div>"; $output .= "<div class=\"row\">"; // $output .= "<div class=\"grid-two-thirds\">"; // $output .= "<!-- ARTIKEL TOP START -->"; // $output .= "<div class=\"artikel-top\">"; // $output .= "</div>"; // $output .= "<!-- ARTIKEL TOP SLUT -->"; // $output .= "<h1>Jaaaaaa, det virker!</h1>"; // $output .= render($content); // DEL PÅ SOCIALE MEDIER // include_once drupal_get_path('theme', 'ishoj') . '/includes/del-paa-sociale-medier.php'; // SENEST OPDATERET // $output .= "<!-- SENEST OPDATERET START -->"; // $output .= "<p class=\"last-updated\">Senest opdateret " . format_date($node->changed, 'senest_redigeret') . "</p>"; // $output .= "<!-- SENEST OPDATERET SLUT -->"; // $output .= "</div>"; $output .= "<div class=\"activities node-visning\">"; $output .= "<div class=\"swiper-container-activities-aktivitetsside\">"; $output .= "<div class=\"swiper-wrapper\">"; $output .= views_embed_view('aktiviteter','aktivitet_aktiviteter_med_kategori', $term->tid); $output .= "</div>"; $output .= "</div>"; $output .= "</div>"; // Højre kolonne // Flyt (prepend) højrekolonne ind i klassen .view-aktiviteter // $output .= "<div class=\"grid-third\">"; // $output .= "<h2>Jaaaa, man!!!</h2>"; // $output .= "</div>"; $output .= "</div>"; $output .= "</div>"; $output .= "</section>"; $output .= "<!-- ARTIKEL SLUT -->"; // DIMMER DEL SIDEN $options = array('absolute' => TRUE); // NODEVISNING // $nid = $node->nid; // $abs_url = url('node/' . $nid, $options); // ----------- // TAXONOMIVISNING $abs_url = url(substr($term_url, 1), $options); include_once drupal_get_path('theme', 'ishoj') . '/includes/dimmer-del-siden.php'; ?> <!--<div id="taxonomy-term-<?php print $term->tid; ?>" class="<?php print $classes; ?>">--> <?php// if (!$page): ?> <!-- <h2><a href="<?php //print $term_url; ?>"><?php //print $term_name; ?></a></h2>--> <?php //endif; ?> <!-- <div class="content">--> <?php// print render($content); ?> <!-- </div>--> <!--</div>--> <?php // BREAKING print views_embed_view('kriseinformation', 'pagevisning'); // OUTPUT print $output; ?>
gpl-2.0
glazzara/olena
milena/mln/canvas/all.hh
1796
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // // Olena 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, version 2 of the License. // // Olena is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Olena. If not, see <http://www.gnu.org/licenses/>. // // As a special exception, you may use this file as part of a free // software project without restriction. Specifically, if other files // instantiate templates or use macros or inline functions from this // file, or you compile this file and link it with other files to produce // an executable, this file does not by itself cause the resulting // executable to be covered by the GNU General Public License. This // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. #ifndef MLN_CANVAS_ALL_HH # define MLN_CANVAS_ALL_HH /// \file /// /// File that includes all canvas-related routines. namespace mln { /// Namespace of canvas. namespace canvas { /// Implementation namespace of canvas namespace. namespace impl {} } } # include <mln/canvas/browsing/all.hh> # include <mln/canvas/chamfer.hh> # include <mln/canvas/distance_front.hh> # include <mln/canvas/distance_geodesic.hh> # include <mln/canvas/labeling/all.hh> # include <mln/canvas/morpho/all.hh> #endif // ! MLN_CANVAS_ALL_HH
gpl-2.0
Lorpotin/Dokuwiki-Gamification
lib/plugins/statistics/inc/pchart/pChart.php
122890
<?php /** * pChart - a PHP class to build charts! * Copyright (C) 2008 Jean-Damien POGOLOTTI * Version 2.0 * * http://pchart.sourceforge.net * * 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 1,2,3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ spl_autoload_register('pChart_autoload'); function pChart_autoload($name){ $file = dirname(__FILE__).'/'.$name.'.php'; if(file_exists($file)) require_once($file); } /* Declare some script wide constants */ define ("SCALE_NORMAL", 1); define ("SCALE_ADDALL", 2); define ("SCALE_START0", 3); define ("SCALE_ADDALLSTART0", 4); define ("TARGET_GRAPHAREA", 1); define ("TARGET_BACKGROUND", 2); define ("ALIGN_TOP_LEFT", 1); define ("ALIGN_TOP_CENTER", 2); define ("ALIGN_TOP_RIGHT", 3); define ("ALIGN_LEFT", 4); define ("ALIGN_CENTER", 5); define ("ALIGN_RIGHT", 6); define ("ALIGN_BOTTOM_LEFT", 7); define ("ALIGN_BOTTOM_CENTER", 8); define ("ALIGN_BOTTOM_RIGHT", 9); /** * pChart class definition */ class pChart { protected $palette; /* Some static vars used in the class */ protected $XSize = NULL; protected $YSize = NULL; protected $Picture = NULL; protected $ImageMap = NULL; /* Error management */ protected $ErrorReporting = FALSE; protected $ErrorInterface = "CLI"; protected $Errors = NULL; protected $ErrorFontName = "Fonts/pf_arma_five.ttf"; protected $ErrorFontSize = 6; /* vars related to the graphing area */ protected $GArea_X1 = NULL; protected $GArea_Y1 = NULL; protected $GArea_X2 = NULL; protected $GArea_Y2 = NULL; protected $GAreaXOffset = NULL; protected $VMax = NULL; protected $VMin = NULL; protected $VXMax = NULL; protected $VXMin = NULL; protected $Divisions = NULL; protected $XDivisions = NULL; protected $DivisionHeight = NULL; protected $XDivisionHeight = NULL; protected $DivisionCount = NULL; protected $XDivisionCount = NULL; protected $DivisionRatio = NULL; protected $XDivisionRatio = NULL; protected $DivisionWidth = NULL; protected $DataCount = NULL; /* Text format related vars */ protected $FontName = NULL; /** @var float $FontSize */ protected $FontSize = NULL; protected $DateFormat = "d/m/Y"; /* Lines format related vars */ protected $LineWidth = 1; protected $LineDotSize = 0; /* Shadow settings */ private $shadowProperties; /* Image Map settings */ protected $BuildMap = FALSE; protected $MapFunction = NULL; protected $tmpFolder = "tmp/"; protected $MapID = NULL; /** * @brief An abstract ICanvas onto which we draw the chart * * @todo This probably shouldn't be protected, I'm still working * on how the modules are going to break down between the various * chart types. */ protected $canvas = null; /** * Initializes the Graph and Canvas object */ public function __construct($XSize, $YSize, ICanvas $canvas) { $this->palette = Palette::defaultPalette(); $this->XSize = $XSize; $this->YSize = $YSize; $this->setFontProperties("tahoma.ttf", 8); $this->shadowProperties = ShadowProperties::FromDefaults(); $this->canvas = $canvas; } /** * Set if warnings should be reported */ function reportWarnings($Interface = "CLI") { $this->ErrorReporting = TRUE; $this->ErrorInterface = $Interface; } /** * Set the font properties * * Will be used for all following text operations. * * @param string $FontFile full path to the TTF font file * @param float $FontSize */ function setFontProperties($FontFile, $FontSize) { $this->FontName = $FontFile; $this->FontSize = $FontSize; } /** * Changes the color Palette * * @param Palette $newPalette */ public function setPalette(Palette $newPalette) { $this->palette = $newPalette; } /** * Set the shadow properties */ function setShadowProperties($XDistance = 1, $YDistance = 1, Color $color = null, $Alpha = 50, $Blur = 0) { if($color == null) { $color = new Color(60, 60, 60); } $this->shadowProperties = ShadowProperties::FromSettings( $XDistance, $YDistance, $color, $Alpha, $Blur ); } /** * Remove shadow option */ function clearShadow() { $this->shadowProperties = ShadowProperties::FromDefaults(); } /** * Load Color Palette from file */ function loadColorPalette($FileName, $Delimiter = ",") { $this->palette = Palette::fromFile($FileName, $Delimiter); } /** * Set line style */ function setLineStyle($Width = 1, $DotSize = 0) { $this->LineWidth = $Width; $this->LineDotSize = $DotSize; } /** * Set the graph area location */ function setGraphArea($X1, $Y1, $X2, $Y2) { $this->GArea_X1 = $X1; $this->GArea_Y1 = $Y1; $this->GArea_X2 = $X2; $this->GArea_Y2 = $Y2; } /** * Prepare the graph area */ private function drawGraphArea(BackgroundStyle $style) { $this->canvas->drawFilledRectangle( new Point($this->GArea_X1, $this->GArea_Y1), new Point($this->GArea_X2, $this->GArea_Y2), $style->getBackgroundColor(), $this->shadowProperties, FALSE ); $this->canvas->drawRectangle( new Point($this->GArea_X1, $this->GArea_Y1), new Point($this->GArea_X2, $this->GArea_Y2), $style->getBackgroundColor()->addRGBIncrement(-40), $style->getBorderWidth(), $style->getBorderDotSize(), $this->shadowProperties ); if($style->useStripe()) { $color2 = $style->getBackgroundColor()->addRGBIncrement(-15); $SkewWidth = $this->GArea_Y2 - $this->GArea_Y1 - 1; for($i = $this->GArea_X1 - $SkewWidth; $i <= $this->GArea_X2; $i = $i + 4) { $X1 = $i; $Y1 = $this->GArea_Y2; $X2 = $i + $SkewWidth; $Y2 = $this->GArea_Y1; if($X1 < $this->GArea_X1) { $X1 = $this->GArea_X1; $Y1 = $this->GArea_Y1 + $X2 - $this->GArea_X1 + 1; } if($X2 >= $this->GArea_X2) { $Y2 = $this->GArea_Y1 + $X2 - $this->GArea_X2 + 1; $X2 = $this->GArea_X2 - 1; } $this->canvas->drawLine( new Point($X1, $Y1), new Point($X2, $Y2 + 1), $color2, 1, 0, ShadowProperties::NoShadow() ); } } } public function drawGraphBackground(BackgroundStyle $style) { $this->drawGraphArea($style); $this->drawGraphAreaGradient($style); } /** * Allow you to clear the scale : used if drawing multiple charts */ function clearScale() { $this->VMin = NULL; $this->VMax = NULL; $this->VXMin = NULL; $this->VXMax = NULL; $this->Divisions = NULL; $this->XDivisions = NULL; } /** * Allow you to fix the scale, use this to bypass the automatic scaling */ function setFixedScale($VMin, $VMax, $Divisions = 5, $VXMin = 0, $VXMax = 0, $XDivisions = 5) { $this->VMin = $VMin; $this->VMax = $VMax; $this->Divisions = $Divisions; if(!$VXMin == 0) { $this->VXMin = $VXMin; $this->VXMax = $VXMax; $this->XDivisions = $XDivisions; } } /** * Wrapper to the drawScale() function allowing a second scale to * be drawn */ function drawRightScale(pData $data, ScaleStyle $style, $Angle = 0, $Decimals = 1, $WithMargin = FALSE, $SkipLabels = 1) { $this->drawScale($data, $style, $Angle, $Decimals, $WithMargin, $SkipLabels, TRUE); } /** * Compute and draw the scale */ function drawScale(pData $Data, ScaleStyle $style, $Angle = 0, $Decimals = 1, $WithMargin = FALSE, $SkipLabels = 1, $RightScale = FALSE) { /* Validate the Data and DataDescription array */ $this->validateData("drawScale", $Data->getData()); $this->canvas->drawLine( new Point($this->GArea_X1, $this->GArea_Y1), new Point($this->GArea_X1, $this->GArea_Y2), $style->getColor(), $style->getLineWidth(), $style->getLineDotSize(), $this->shadowProperties ); $this->canvas->drawLine( new Point($this->GArea_X1, $this->GArea_Y2), new Point($this->GArea_X2, $this->GArea_Y2), $style->getColor(), $style->getLineWidth(), $style->getLineDotSize(), $this->shadowProperties ); if($this->VMin == NULL && $this->VMax == NULL) { $Divisions = $this->calculateDivisions($Data, $style); } else $Divisions = $this->Divisions; $this->DivisionCount = $Divisions; $DataRange = $this->VMax - $this->VMin; if($DataRange == 0) { $DataRange = .1; } $this->DivisionHeight = ($this->GArea_Y2 - $this->GArea_Y1) / $Divisions; $this->DivisionRatio = ($this->GArea_Y2 - $this->GArea_Y1) / $DataRange; $this->GAreaXOffset = 0; if(count($Data->getData()) > 1) { if($WithMargin == FALSE) $this->DivisionWidth = ($this->GArea_X2 - $this->GArea_X1) / (count($Data->getData()) - 1); else { $this->DivisionWidth = ($this->GArea_X2 - $this->GArea_X1) / (count($Data->getData())); $this->GAreaXOffset = $this->DivisionWidth / 2; } } else { $this->DivisionWidth = $this->GArea_X2 - $this->GArea_X1; $this->GAreaXOffset = $this->DivisionWidth / 2; } $this->DataCount = count($Data->getData()); if($style->getDrawTicks() == FALSE) return (0); $YPos = $this->GArea_Y2; $XMin = NULL; for($i = 1; $i <= $Divisions + 1; $i++) { if($RightScale) $this->canvas->drawLine( new Point($this->GArea_X2, $YPos), new Point($this->GArea_X2 + 5, $YPos), $style->getColor(), $style->getLineWidth(), $style->getLineDotSize(), $this->shadowProperties ); else $this->canvas->drawLine( new Point($this->GArea_X1, $YPos), new Point($this->GArea_X1 - 5, $YPos), $style->getColor(), $style->getLineWidth(), $style->getLineDotSize(), $this->shadowProperties ); $Value = $this->VMin + ($i - 1) * (($this->VMax - $this->VMin) / $Divisions); $Value = round($Value * pow(10, $Decimals)) / pow(10, $Decimals); $Value = $this->convertValueForDisplay( $Value, $Data->getDataDescription()->getYFormat(), $Data->getDataDescription()->getYUnit() ); $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value); $TextWidth = $Position [2] - $Position [0]; if($RightScale) { $this->canvas->drawText( $this->FontSize, 0, new Point($this->GArea_X2 + 10, $YPos + ($this->FontSize / 2)), $style->getColor(), $this->FontName, $Value, ShadowProperties::NoShadow() ); if($XMin < $this->GArea_X2 + 15 + $TextWidth || $XMin == NULL) { $XMin = $this->GArea_X2 + 15 + $TextWidth; } } else { $this->canvas->drawText( $this->FontSize, 0, new Point($this->GArea_X1 - 10 - $TextWidth, $YPos + ($this->FontSize / 2)), $style->getColor(), $this->FontName, $Value, ShadowProperties::NoShadow() ); if($XMin > $this->GArea_X1 - 10 - $TextWidth || $XMin == NULL) { $XMin = $this->GArea_X1 - 10 - $TextWidth; } } $YPos = $YPos - $this->DivisionHeight; } /* Write the Y Axis caption if set */ if($Data->getDataDescription()->getYAxisName() != '') { $Position = imageftbbox($this->FontSize, 90, $this->FontName, $Data->getDataDescription()->getYAxisName()); $TextHeight = abs($Position [1]) + abs($Position [3]); $TextTop = (($this->GArea_Y2 - $this->GArea_Y1) / 2) + $this->GArea_Y1 + ($TextHeight / 2); if($RightScale) { $this->canvas->drawText( $this->FontSize, 90, new Point($XMin + $this->FontSize, $TextTop), $style->getColor(), $this->FontName, $Data->getDataDescription()->getYAxisName(), ShadowProperties::NoShadow() ); } else { $this->canvas->drawText( $this->FontSize, 90, new Point($XMin - $this->FontSize, $TextTop), $style->getColor(), $this->FontName, $Data->getDataDescription()->getYAxisName(), ShadowProperties::NoShadow() ); } } /* Horizontal Axis */ $XPos = $this->GArea_X1 + $this->GAreaXOffset; $ID = 1; $YMax = NULL; foreach($Data->getData() as $Values) { if($ID % $SkipLabels == 0) { $this->canvas->drawLine( new Point(floor($XPos), $this->GArea_Y2), new Point(floor($XPos), $this->GArea_Y2 + 5), $style->getColor(), $style->getLineWidth(), $style->getLineDotSize(), $this->shadowProperties ); $Value = $Values[$Data->getDataDescription()->getPosition()]; $Value = $this->convertValueForDisplay( $Value, $Data->getDataDescription()->getXFormat(), $Data->getDataDescription()->getXUnit() ); $Position = imageftbbox($this->FontSize, $Angle, $this->FontName, $Value); $TextWidth = abs($Position [2]) + abs($Position [0]); $TextHeight = abs($Position [1]) + abs($Position [3]); if($Angle == 0) { $YPos = $this->GArea_Y2 + 18; $this->canvas->drawText( $this->FontSize, $Angle, new Point(floor($XPos) - floor($TextWidth / 2), $YPos), $style->getColor(), $this->FontName, $Value, ShadowProperties::NoShadow() ); } else { $YPos = $this->GArea_Y2 + 10 + $TextHeight; if($Angle <= 90) { $this->canvas->drawText( $this->FontSize, $Angle, new Point(floor($XPos) - $TextWidth + 5, $YPos), $style->getColor(), $this->FontName, $Value, ShadowProperties::NoShadow() ); } else { $this->canvas->drawText( $this->FontSize, $Angle, new Point(floor($XPos) + $TextWidth + 5, $YPos), $style->getColor(), $this->FontName, $Value, ShadowProperties::NoShadow() ); } } if($YMax < $YPos || $YMax == NULL) { $YMax = $YPos; } } $XPos = $XPos + $this->DivisionWidth; $ID++; } /* Write the X Axis caption if set */ if($Data->getDataDescription()->getXAxisName() != '') { $Position = imageftbbox( $this->FontSize, 90, $this->FontName, $Data->getDataDescription()->getXAxisName() ); $TextWidth = abs($Position [2]) + abs($Position [0]); $TextLeft = (($this->GArea_X2 - $this->GArea_X1) / 2) + $this->GArea_X1 + ($TextWidth / 2); $this->canvas->drawText( $this->FontSize, 0, new Point($TextLeft, $YMax + $this->FontSize + 5), $style->getColor(), $this->FontName, $Data->getDataDescription()->getXAxisName(), ShadowProperties::NoShadow() ); } } /** * Calculate the number of divisions that the Y axis will be * divided into. This is a function of the range of Y values the * data covers, as well as the scale style. Divisions should have * some minimum size in screen coordinates in order that the * divisions are clearly visible, so this is also a function of * the graph size in screen coordinates. * * This method returns the number of divisions, but it also has * side-effects on some class data members. This needs to be * refactored to make it clearer what is and isn't affected. */ private function calculateDivisions(pData $Data, ScaleStyle $style) { if(isset ($Data->getDataDescription()->values[0])) { /* Pointless temporary is necessary because you can't * directly apply an array index to the return value * of a function in PHP */ $dataArray = $Data->getData(); $this->VMin = $dataArray[0] [$Data->getDataDescription()->values[0]]; $this->VMax = $dataArray[0] [$Data->getDataDescription()->values[0]]; } else { $this->VMin = 2147483647; $this->VMax = -2147483647; } /* Compute Min and Max values */ if($style->getScaleMode() == SCALE_NORMAL || $style->getScaleMode() == SCALE_START0 ) { if($style->getScaleMode() == SCALE_START0) { $this->VMin = 0; } foreach($Data->getData() as $Values) { foreach($Data->getDataDescription()->values as $ColName) { if(isset ($Values[$ColName])) { $Value = $Values[$ColName]; if(is_numeric($Value)) { if($this->VMax < $Value) { $this->VMax = $Value; } if($this->VMin > $Value) { $this->VMin = $Value; } } } } } } elseif($style->getScaleMode() == SCALE_ADDALL || $style->getScaleMode() == SCALE_ADDALLSTART0) /* Experimental */ { if($style->getScaleMode() == SCALE_ADDALLSTART0) { $this->VMin = 0; } foreach($Data->getData() as $Values) { $Sum = 0; foreach($Data->getDataDescription()->values as $ColName) { $dataArray = $Data->getData(); if(isset ($Values[$ColName])) { $Value = $Values[$ColName]; if(is_numeric($Value)) $Sum += $Value; } } if($this->VMax < $Sum) { $this->VMax = $Sum; } if($this->VMin > $Sum) { $this->VMin = $Sum; } } } $this->VMax = ceil($this->VMax); /* If all values are the same */ if($this->VMax == $this->VMin) { if($this->VMax >= 0) { $this->VMax++; } else { $this->VMin--; } } $DataRange = $this->VMax - $this->VMin; if($DataRange == 0) { $DataRange = .1; } $this->calculateScales($Scale, $Divisions); if(!isset ($Divisions)) $Divisions = 2; if($Scale == 1 && $Divisions % 2 == 1) $Divisions--; return $Divisions; } /** * Compute and draw the scale for X/Y charts */ function drawXYScale(pData $Data, ScaleStyle $style, $YSerieName, $XSerieName, $Angle = 0, $Decimals = 1) { /* Validate the Data and DataDescription array */ $this->validateData("drawScale", $Data->getData()); $this->canvas->drawLine( new Point($this->GArea_X1, $this->GArea_Y1), new Point($this->GArea_X1, $this->GArea_Y2), $style->getColor(), $style->getLineWidth(), $style->getLineDotSize(), $this->shadowProperties ); $this->canvas->drawLine( new Point($this->GArea_X1, $this->GArea_Y2), new Point($this->GArea_X2, $this->GArea_Y2), $style->getColor(), $style->getLineWidth(), $style->getLineDotSize(), $this->shadowProperties ); /* Process Y scale */ if($this->VMin == NULL && $this->VMax == NULL) { $this->VMin = $Data->getSeriesMin($YSerieName); $this->VMax = $Data->getSeriesMax($YSerieName); /** @todo The use of ceil() here is questionable if all * the values are much less than 1, AIUI */ $this->VMax = ceil($this->VMax); $DataRange = $this->VMax - $this->VMin; if($DataRange == 0) { $DataRange = .1; } self::computeAutomaticScaling( $this->GArea_Y1, $this->GArea_Y2, $this->VMin, $this->VMax, $Divisions ); } else $Divisions = $this->Divisions; $this->DivisionCount = $Divisions; $DataRange = $this->VMax - $this->VMin; if($DataRange == 0) { $DataRange = .1; } $this->DivisionHeight = ($this->GArea_Y2 - $this->GArea_Y1) / $Divisions; $this->DivisionRatio = ($this->GArea_Y2 - $this->GArea_Y1) / $DataRange; $YPos = $this->GArea_Y2; $XMin = NULL; for($i = 1; $i <= $Divisions + 1; $i++) { $this->canvas->drawLine( new Point($this->GArea_X1, $YPos), new Point($this->GArea_X1 - 5, $YPos), $style->getColor(), $style->getLineWidth(), $style->getLineDotSize(), $this->shadowProperties ); $Value = $this->VMin + ($i - 1) * (($this->VMax - $this->VMin) / $Divisions); $Value = round($Value * pow(10, $Decimals)) / pow(10, $Decimals); $Value = $this->convertValueForDisplay( $Value, $Data->getDataDescription()->getYFormat(), $Data->getDataDescription()->getYUnit() ); $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value); $TextWidth = $Position [2] - $Position [0]; $this->canvas->drawText( $this->FontSize, 0, new Point($this->GArea_X1 - 10 - $TextWidth, $YPos + ($this->FontSize / 2)), $style->getColor(), $this->FontName, $Value, $this->shadowProperties ); if($XMin > $this->GArea_X1 - 10 - $TextWidth || $XMin == NULL) { $XMin = $this->GArea_X1 - 10 - $TextWidth; } $YPos = $YPos - $this->DivisionHeight; } /* Process X scale */ if($this->VXMin == NULL && $this->VXMax == NULL) { $this->VXMax = $Data->getSeriesMax($XSerieName); $this->VXMin = $Data->getSeriesMin($XSerieName); $this->VXMax = ceil($this->VXMax); $DataRange = $this->VMax - $this->VMin; if($DataRange == 0) { $DataRange = .1; } /* Compute automatic scaling */ self::computeAutomaticScaling( $this->GArea_X1, $this->GArea_X2, $this->VXMin, $this->VXMax, $XDivisions ); } else $XDivisions = $this->XDivisions; $this->XDivisionCount = $Divisions; $this->DataCount = $Divisions + 2; $XDataRange = $this->VXMax - $this->VXMin; if($XDataRange == 0) { $XDataRange = .1; } $this->DivisionWidth = ($this->GArea_X2 - $this->GArea_X1) / $XDivisions; $this->XDivisionRatio = ($this->GArea_X2 - $this->GArea_X1) / $XDataRange; $XPos = $this->GArea_X1; $YMax = NULL; for($i = 1; $i <= $XDivisions + 1; $i++) { $this->canvas->drawLine( new Point($XPos, $this->GArea_Y2), new Point($XPos, $this->GArea_Y2 + 5), $style->getColor(), $style->getLineWidth(), $style->getLineDotSize(), $this->shadowProperties ); $Value = $this->VXMin + ($i - 1) * (($this->VXMax - $this->VXMin) / $XDivisions); $Value = round($Value * pow(10, $Decimals)) / pow(10, $Decimals); $Value = $this->convertValueForDisplay( $Value, $Data->getDataDescription()->getYFormat(), $Data->getDataDescription()->getYUnit() ); $Position = imageftbbox($this->FontSize, $Angle, $this->FontName, $Value); $TextWidth = abs($Position [2]) + abs($Position [0]); $TextHeight = abs($Position [1]) + abs($Position [3]); if($Angle == 0) { $YPos = $this->GArea_Y2 + 18; $this->canvas->drawText( $this->FontSize, $Angle, new Point(floor($XPos) - floor($TextWidth / 2), $YPos), $style->getColor(), $this->FontName, $Value, $this->shadowProperties ); } else { $YPos = $this->GArea_Y2 + 10 + $TextHeight; if($Angle <= 90) { $this->canvas->drawText( $this->FontSize, $Angle, new Point(floor($XPos) - $TextWidth + 5, $YPos), $style->getColor(), $this->FontName, $Value, $this->shadowProperties ); } else { $this->canvas->drawText( $this->FontSize, $Angle, new Point(floor($XPos) + $TextWidth + 5, $YPos), $style->getColor(), $this->FontName, $Value, $this->shadowProperties ); } } if($YMax < $YPos || $YMax == NULL) { $YMax = $YPos; } $XPos = $XPos + $this->DivisionWidth; } /* Write the Y Axis caption if set */ if($Data->getDataDescription()->getYAxisName() != '') { $Position = imageftbbox( $this->FontSize, 90, $this->FontName, $Data->getDataDescription()->getYAxisName() ); $TextHeight = abs($Position [1]) + abs($Position [3]); $TextTop = (($this->GArea_Y2 - $this->GArea_Y1) / 2) + $this->GArea_Y1 + ($TextHeight / 2); $this->canvas->drawText( $this->FontSize, 90, new Point($XMin - $this->FontSize, $TextTop), $style->getColor(), $this->FontName, $Data->getDataDescription()->getYAxisName(), $this->shadowProperties ); } /* Write the X Axis caption if set */ $this->writeScaleXAxisCaption($Data, $style, $YMax); } private function drawGridMosaic(GridStyle $style, $divisionCount, $divisionHeight) { $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1; $YPos = $LayerHeight - 1; //$this->GArea_Y2-1; $LastY = $YPos; for($i = 0; $i < $divisionCount; $i++) { $LastY = $YPos; $YPos = $YPos - $divisionHeight; if($YPos <= 0) { $YPos = 1; } if($i % 2 == 0) { $this->canvas->drawFilledRectangle( new Point($this->GArea_X1 + 1, $this->GArea_Y1 + $YPos), new Point($this->GArea_X2 - 1, $this->GArea_Y1 + $LastY), new Color(250, 250, 250), ShadowProperties::NoShadow(), false, $style->getAlpha() ); } } } /** * Write the X Axis caption on the scale, if set */ private function writeScaleXAxisCaption(pData $data, ScaleStyle $style, $YMax) { if($data->getDataDescription()->getXAxisName() != '') { $Position = imageftbbox($this->FontSize, 90, $this->FontName, $data->getDataDescription()->getXAxisName()); $TextWidth = abs($Position [2]) + abs($Position [0]); $TextLeft = (($this->GArea_X2 - $this->GArea_X1) / 2) + $this->GArea_X1 + ($TextWidth / 2); $this->canvas->drawText( $this->FontSize, 0, new Point($TextLeft, $YMax + $this->FontSize + 5), $style->getColor(), $this->FontName, $data->getDataDescription()->getXAxisName(), $this->shadowProperties ); } } /** * Compute and draw the scale */ function drawGrid(GridStyle $style) { /* Draw mosaic */ if($style->getMosaic()) { $this->drawGridMosaic($style, $this->DivisionCount, $this->DivisionHeight); } /* Horizontal lines */ $YPos = $this->GArea_Y2 - $this->DivisionHeight; for($i = 1; $i <= $this->DivisionCount; $i++) { if($YPos > $this->GArea_Y1 && $YPos < $this->GArea_Y2) $this->canvas->drawDottedLine( new Point($this->GArea_X1, $YPos), new Point($this->GArea_X2, $YPos), $style->getLineWidth(), $this->LineWidth, $style->getColor(), ShadowProperties::NoShadow() ); /** @todo There's some inconsistency here. The parameter * $lineWidth appears to be used to control the dot size, * not the line width? This is the same way it's always * been done, although now it's more obvious that there's * a problem. */ $YPos = $YPos - $this->DivisionHeight; } /* Vertical lines */ if($this->GAreaXOffset == 0) { $XPos = $this->GArea_X1 + $this->DivisionWidth + $this->GAreaXOffset; $ColCount = $this->DataCount - 2; } else { $XPos = $this->GArea_X1 + $this->GAreaXOffset; $ColCount = floor(($this->GArea_X2 - $this->GArea_X1) / $this->DivisionWidth); } for($i = 1; $i <= $ColCount; $i++) { if($XPos > $this->GArea_X1 && $XPos < $this->GArea_X2) $this->canvas->drawDottedLine( new Point(floor($XPos), $this->GArea_Y1), new Point(floor($XPos), $this->GArea_Y2), $style->getLineWidth(), $this->LineWidth, $style->getcolor(), $this->shadowProperties ); $XPos = $XPos + $this->DivisionWidth; } } /** * retrieve the legends size */ public function getLegendBoxSize($DataDescription) { if(!isset ($DataDescription->description)) return (-1); /* <-10->[8]<-4->Text<-10-> */ $MaxWidth = 0; $MaxHeight = 8; foreach($DataDescription->description as $Value) { $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value); $TextWidth = $Position [2] - $Position [0]; $TextHeight = $Position [1] - $Position [7]; if($TextWidth > $MaxWidth) { $MaxWidth = $TextWidth; } $MaxHeight = $MaxHeight + $TextHeight + 4; } $MaxHeight = $MaxHeight - 3; $MaxWidth = $MaxWidth + 32; return (array($MaxWidth, $MaxHeight)); } /** * Draw the data legends */ public function drawLegend($XPos, $YPos, $DataDescription, Color $color, Color $color2 = null, Color $color3 = null, $Border = TRUE) { if($color2 == null) { $color2 = $color->addRGBIncrement(-30); } if($color3 == null) { $color3 = new Color(0, 0, 0); } /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawLegend", $DataDescription); if(!isset ($DataDescription->description)) return (-1); /* <-10->[8]<-4->Text<-10-> */ $MaxWidth = 0; $MaxHeight = 8; foreach($DataDescription->description as $Key => $Value) { $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value); $TextWidth = $Position [2] - $Position [0]; $TextHeight = $Position [1] - $Position [7]; if($TextWidth > $MaxWidth) { $MaxWidth = $TextWidth; } $MaxHeight = $MaxHeight + $TextHeight + 4; } $MaxHeight = $MaxHeight - 5; $MaxWidth = $MaxWidth + 32; if($Border) { $this->canvas->drawFilledRoundedRectangle( new Point($XPos + 1, $YPos + 1), new Point($XPos + $MaxWidth + 1, $YPos + $MaxHeight + 1), 5, $color2, $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $this->canvas->drawFilledRoundedRectangle( new Point($XPos, $YPos), new Point($XPos + $MaxWidth, $YPos + $MaxHeight), 5, $color, $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); } $YOffset = 4 + $this->FontSize; $ID = 0; foreach($DataDescription->description as $Key => $Value) { $this->canvas->drawFilledRoundedRectangle( new Point($XPos + 10, $YPos + $YOffset - 4), new Point($XPos + 14, $YPos + $YOffset - 4), 2, $this->palette->getColor($ID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $this->canvas->drawText( $this->FontSize, 0, new Point($XPos + 22, $YPos + $YOffset), $color3, $this->FontName, $Value, $this->shadowProperties ); $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value); $TextHeight = $Position [1] - $Position [7]; $YOffset = $YOffset + $TextHeight + 4; $ID++; } } /** * Draw the graph title * * @todo Should we pass in a ShadowProperties object here? Or is * this a public function? */ public function drawTitle($XPos, $YPos, $Value, Color $color, $XPos2 = -1, $YPos2 = -1, ShadowProperties $shadowProperties = null) { if($shadowProperties == null) { $shadowProperties = ShadowProperties::NoShadow(); } if($XPos2 != -1) { $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value); $TextWidth = $Position [2] - $Position [0]; $XPos = floor(($XPos2 - $XPos - $TextWidth) / 2) + $XPos; } if($YPos2 != -1) { $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value); $TextHeight = $Position [5] - $Position [3]; $YPos = floor(($YPos2 - $YPos - $TextHeight) / 2) + $YPos; } $this->canvas->drawText( $this->FontSize, 0, new Point($XPos, $YPos), $color, $this->FontName, $Value, $shadowProperties ); } /** * Draw a text box with text align & alpha properties * * @param $point1 Minimum corner of the box * @param $point2 Maximum corner of the box * * @todo This should probably be a method on the ICanvas * interface, since it doesn't have anything specifically to do * with graphs */ public function drawTextBox(Point $point1, Point $point2, $Text, $Angle = 0, Color $color = null, $Align = ALIGN_LEFT, ShadowProperties $shadowProperties = null, Color $backgroundColor = null, $Alpha = 100) { if($color == null) { $color = new Color(255, 255, 255); } if($shadowProperties == null) { $shadowProperties = ShadowProperties::NoShadow(); } $Position = imageftbbox($this->FontSize, $Angle, $this->FontName, $Text); $TextWidth = $Position [2] - $Position [0]; $TextHeight = $Position [5] - $Position [3]; $AreaWidth = $point2->getX() - $point1->getX(); $AreaHeight = $point2->getY() - $point1->getY(); if($backgroundColor != null) $this->canvas->drawFilledRectangle( $point1, $point2, $backgroundColor, $shadowProperties, FALSE, $Alpha ); if($Align == ALIGN_TOP_LEFT) { $newPosition = $point1->addIncrement(1, $this->FontSize + 1); } if($Align == ALIGN_TOP_CENTER) { $newPosition = $point1->addIncrement( ($AreaWidth / 2) - ($TextWidth / 2), $this->FontSize + 1 ); } if($Align == ALIGN_TOP_RIGHT) { $newPosition = new Point($point2->getX() - $TextWidth - 1, $point1->getY() + $this->FontSize + 1); } if($Align == ALIGN_LEFT) { $newPosition = $point1->addIncrement( 1, ($AreaHeight / 2) - ($TextHeight / 2) ); } if($Align == ALIGN_CENTER) { $newPosition = $point1->addIncrement( ($AreaWidth / 2) - ($TextWidth / 2), ($AreaHeight / 2) - ($TextHeight / 2) ); } if($Align == ALIGN_RIGHT) { $newPosition = new Point($point2->getX() - $TextWidth - 1, $point1->getY() + ($AreaHeight / 2) - ($TextHeight / 2)); } if($Align == ALIGN_BOTTOM_LEFT) { $newPosition = new Point($point1->getX() + 1, $point2->getY() - 1); } if($Align == ALIGN_BOTTOM_CENTER) { $newPosition = new Point($point1->getX() + ($AreaWidth / 2) - ($TextWidth / 2), $point2->getY() - 1); } if($Align == ALIGN_BOTTOM_RIGHT) { $newPosition = $point2->addIncrement( -$TextWidth - 1, -1 ); } $this->canvas->drawText($this->FontSize, $Angle, $newPosition, $color, $this->FontName, $Text, $shadowProperties); } /** * Compute and draw the scale * * @todo What is the method name a typo for? Threshold? */ function drawTreshold($Value, Color $color, $ShowLabel = FALSE, $ShowOnRight = FALSE, $TickWidth = 4, $FreeText = NULL) { $Y = $this->GArea_Y2 - ($Value - $this->VMin) * $this->DivisionRatio; if($Y <= $this->GArea_Y1 || $Y >= $this->GArea_Y2) return (-1); if($TickWidth == 0) $this->canvas->drawLine( new Point($this->GArea_X1, $Y), new Point($this->GArea_X2, $Y), $color, $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); else $this->canvas->drawDottedLine( new Point($this->GArea_X1, $Y), new Point($this->GArea_X2, $Y), $TickWidth, $this->LineWidth, $color, $this->shadowProperties ); if($ShowLabel) { if($FreeText == NULL) { $Label = $Value; } else { $Label = $FreeText; } if($ShowOnRight) { $position = new Point($this->GArea_X2 + 2, $Y + ($this->FontSize / 2)); } else { $position = new Point($this->GArea_X1 + 2, $Y - ($this->FontSize / 2)); } $this->canvas->drawText( $this->FontSize, 0, $position, $color, $this->FontName, $Label, ShadowProperties::NoShadow() ); } } /** * This function put a label on a specific point */ function setLabel($Data, $DataDescription, $SerieName, $ValueName, $Caption, Color $color = null) { if($color == null) { $color = new Color(210, 210, 210); } /* Validate the Data and DataDescription array */ $this->validateDataDescription("setLabel", $DataDescription); $this->validateData("setLabel", $Data); $ShadowFactor = 100; $Cp = 0; $Found = FALSE; foreach($Data as $Value) { if($Value[$DataDescription->getPosition()] == $ValueName) { $NumericalValue = $Value[$SerieName]; $Found = TRUE; } if(!$Found) $Cp++; } $XPos = $this->GArea_X1 + $this->GAreaXOffset + ($this->DivisionWidth * $Cp) + 2; $YPos = $this->GArea_Y2 - ($NumericalValue - $this->VMin) * $this->DivisionRatio; $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Caption); $TextHeight = $Position [3] - $Position [5]; $TextWidth = $Position [2] - $Position [0] + 2; $TextOffset = floor($TextHeight / 2); // Shadow $Poly = array($XPos + 1, $YPos + 1, $XPos + 9, $YPos - $TextOffset, $XPos + 8, $YPos + $TextOffset + 2); $this->canvas->drawFilledPolygon( $Poly, 3, $color->addRGBIncrement(-$ShadowFactor) ); $this->canvas->drawLine( new Point($XPos, $YPos + 1), new Point($XPos + 9, $YPos - $TextOffset - .2), $color->addRGBIncrement(-$ShadowFactor), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $this->canvas->drawLine( new Point($XPos, $YPos + 1), new Point($XPos + 9, $YPos + $TextOffset + 2.2), $color->addRGBIncrement(-$ShadowFactor), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $this->canvas->drawFilledRectangle( new Point($XPos + 9, $YPos - $TextOffset - .2), new Point($XPos + 13 + $TextWidth, $YPos + $TextOffset + 2.2), $color->addRGBIncrement(-$ShadowFactor), $this->shadowProperties ); // Label background $Poly = array($XPos, $YPos, $XPos + 8, $YPos - $TextOffset - 1, $XPos + 8, $YPos + $TextOffset + 1); $this->canvas->drawFilledPolygon($Poly, 3, $color); /** @todo We draw exactly the same line twice, with the same settings. * Surely this is pointless? */ $this->canvas->drawLine( new Point($XPos - 1, $YPos), new Point($XPos + 8, $YPos - $TextOffset - 1.2), $color, $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $this->canvas->drawLine( new Point($XPos - 1, $YPos), new Point($XPos + 8, $YPos + $TextOffset + 1.2), $color, $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $this->canvas->drawFilledRectangle( new Point($XPos + 8, $YPos - $TextOffset - 1.2), new Point($XPos + 12 + $TextWidth, $YPos + $TextOffset + 1.2), $color, $this->shadowProperties ); $this->canvas->drawText( $this->FontSize, 0, new Point($XPos + 10, $YPos + $TextOffset), new Color(0, 0, 0), $this->FontName, $Caption, ShadowProperties::NoShadow() ); } /** * Linearly Scale a given value * * using it's own minima/maxima and the desired output minima/maxima */ function linearScale($value, $istart, $istop, $ostart, $ostop) { $div = ($istop - $istart); if($div == 0.0) $div = 1; return $ostart + ($ostop - $ostart) * (($value - $istart) / $div); } /** * This function draw a plot graph */ function drawPlotGraph($Data, $DataDescription, $BigRadius = 5, $SmallRadius = 2, Color $color2 = null, $Shadow = FALSE) { /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawPlotGraph", $DataDescription); $this->validateData("drawPlotGraph", $Data); $GraphID = 0; $colorO = $color2; foreach($DataDescription->values as $ColName) { $ColorID = $DataDescription->getColumnIndex($ColName); $color = $this->palette->getColor($ColorID); $color2 = $colorO; if(isset ($DataDescription->seriesSymbols[$ColName])) { $Infos = getimagesize($DataDescription->seriesSymbols[$ColName]); $ImageWidth = $Infos [0]; $ImageHeight = $Infos [1]; $Symbol = imagecreatefromgif($DataDescription->seriesSymbols[$ColName]); } $XPos = $this->GArea_X1 + $this->GAreaXOffset; $Hsize = round($BigRadius / 2); $color3 = null; foreach($Data as $Values) { $Value = $Values[$ColName]; $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio); /* Save point into the image map if option activated */ if($this->BuildMap) $this->addToImageMap($XPos - $Hsize, $YPos - $Hsize, $XPos + 1 + $Hsize, $YPos + $Hsize + 1, $DataDescription->description[$ColName], $Values[$ColName].$DataDescription->getYUnit(), "Plot"); if(is_numeric($Value)) { if(!isset ($DataDescription->seriesSymbols[$ColName])) { if($Shadow) { if($color3 != null) { $this->canvas->drawFilledCircle( new Point($XPos + 2, $YPos + 2), $BigRadius, $color3, $this->shadowProperties ); } else { $color3 = $this->palette->getColor($ColorID)->addRGBIncrement(-20); $this->canvas->drawFilledCircle( new Point($XPos + 2, $YPos + 2), $BigRadius, $color3, $this->shadowProperties ); } } $this->canvas->drawFilledCircle( new Point($XPos + 1, $YPos + 1), $BigRadius, $color, $this->shadowProperties ); if($SmallRadius != 0) { if($color2 != null) { $this->canvas->drawFilledCircle( new Point($XPos + 1, $YPos + 1), $SmallRadius, $color2, $this->shadowProperties ); } else { $color2 = $this->palette->getColor($ColorID)->addRGBIncrement(-15); $this->canvas->drawFilledCircle( new Point($XPos + 1, $YPos + 1), $SmallRadius, $color2, $this->shadowProperties ); } } } else { imagecopymerge($this->canvas->getPicture(), $Symbol, $XPos + 1 - $ImageWidth / 2, $YPos + 1 - $ImageHeight / 2, 0, 0, $ImageWidth, $ImageHeight, 100); } } $XPos = $XPos + $this->DivisionWidth; } $GraphID++; } } /** * @brief This function draw a plot graph in an X/Y space */ function drawXYPlotGraph(pData $DataSet, $YSerieName, $XSerieName, $PaletteID = 0, $BigRadius = 5, $SmallRadius = 2, Color $color2 = null, $Shadow = TRUE, $SizeSerieName = '') { $color = $this->palette->getColor($PaletteID); $color3 = null; $Data = $DataSet->getData(); foreach($Data as $Values) { if(isset($Values[$YSerieName]) && isset ($Values[$XSerieName])) { $X = $Values[$XSerieName]; $Y = $Values[$YSerieName]; $Y = $this->GArea_Y2 - (($Y - $this->VMin) * $this->DivisionRatio); $X = $this->GArea_X1 + (($X - $this->VXMin) * $this->XDivisionRatio); if(isset($Values[$SizeSerieName])) { $br = $this->linearScale( $Values[$SizeSerieName], $DataSet->getSeriesMin($SizeSerieName), $DataSet->getSeriesMax($SizeSerieName), $SmallRadius, $BigRadius ); $sr = $br; } else { $br = $BigRadius; $sr = $SmallRadius; } if($Shadow) { if($color3 != null) { $this->canvas->drawFilledCircle( new Point($X + 2, $Y + 2), $br, $color3, $this->shadowProperties ); } else { $color3 = $this->palette->getColor($PaletteID)->addRGBIncrement(-20); $this->canvas->drawFilledCircle( new Point($X + 2, $Y + 2), $br, $color3, $this->shadowProperties ); } } $this->canvas->drawFilledCircle( new Point($X + 1, $Y + 1), $br, $color, $this->shadowProperties ); if($color2 != null) { $this->canvas->drawFilledCircle( new Point($X + 1, $Y + 1), $sr, $color2, $this->shadowProperties ); } else { $color2 = $this->palette->getColor($PaletteID)->addRGBIncrement(20); $this->canvas->drawFilledCircle( new Point($X + 1, $Y + 1), $sr, $color2, $this->shadowProperties ); } } } } /** * This function draw an area between two series */ function drawArea($Data, $Serie1, $Serie2, Color $color, $Alpha = 50) { /* Validate the Data and DataDescription array */ $this->validateData("drawArea", $Data); $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1; $XPos = $this->GAreaXOffset; $LastXPos = -1; $LastYPos1 = 0; $LastYPos2 = 0; foreach($Data as $Values) { $Value1 = $Values[$Serie1]; $Value2 = $Values[$Serie2]; $YPos1 = $LayerHeight - (($Value1 - $this->VMin) * $this->DivisionRatio); $YPos2 = $LayerHeight - (($Value2 - $this->VMin) * $this->DivisionRatio); if($LastXPos != -1) { $Points = array(); $Points [] = $LastXPos + $this->GArea_X1; $Points [] = $LastYPos1 + $this->GArea_Y1; $Points [] = $LastXPos + $this->GArea_X1; $Points [] = $LastYPos2 + $this->GArea_Y1; $Points [] = $XPos + $this->GArea_X1; $Points [] = $YPos2 + $this->GArea_Y1; $Points [] = $XPos + $this->GArea_X1; $Points [] = $YPos1 + $this->GArea_Y1; $this->canvas->drawFilledPolygon( $Points, 4, $color, $Alpha ); } $LastYPos1 = $YPos1; $LastYPos2 = $YPos2; $LastXPos = $XPos; $XPos = $XPos + $this->DivisionWidth; } } /** * This function write the values of the specified series */ function writeValues($Data, $DataDescription, $Series) { /* Validate the Data and DataDescription array */ $this->validateDataDescription("writeValues", $DataDescription); $this->validateData("writeValues", $Data); if(!is_array($Series)) { $Series = array($Series); } foreach($Series as $Serie) { $ColorID = $DataDescription->getColumnIndex($Serie); $XPos = $this->GArea_X1 + $this->GAreaXOffset; foreach($Data as $Values) { if(isset ($Values[$Serie]) && is_numeric($Values[$Serie])) { $Value = $Values[$Serie]; $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio); $Positions = imagettfbbox($this->FontSize, 0, $this->FontName, $Value); $Width = $Positions [2] - $Positions [6]; $XOffset = $XPos - ($Width / 2); $YOffset = $YPos - 4; $this->canvas->drawText( $this->FontSize, 0, new Point($XOffset, $YOffset), $this->palette->getColor($ColorID), $this->FontName, $Value, ShadowProperties::NoShadow() ); } $XPos = $XPos + $this->DivisionWidth; } } } /** * @brief Draws a line graph where the data gives Y values for a * series of regular positions along the X axis */ function drawLineGraph($Data, $DataDescription, $SerieName = "") { /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawLineGraph", $DataDescription); $this->validateData("drawLineGraph", $Data); $GraphID = 0; foreach($DataDescription->values as $ColName) { $ColorID = $DataDescription->getColumnIndex($ColName); if($SerieName == "" || $SerieName == $ColName) { $XPos = $this->GArea_X1 + $this->GAreaXOffset; $XLast = -1; $YLast = 0; foreach($Data as $Values) { if(isset ($Values[$ColName])) { $Value = $Values[$ColName]; $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio); /* Save point into the image map if option activated */ if($this->BuildMap) $this->addToImageMap($XPos - 3, $YPos - 3, $XPos + 3, $YPos + 3, $DataDescription->description[$ColName], $Values[$ColName].$DataDescription->getYUnit(), "Line"); if(!is_numeric($Value)) { $XLast = -1; } if($XLast != -1) $this->canvas->drawLine( new Point($XLast, $YLast), new Point($XPos, $YPos), $this->palette->getColor($ColorID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties, new Point($this->GArea_X1, $this->GArea_Y1), new Point($this->GArea_X2, $this->GArea_Y2) ); $XLast = $XPos; $YLast = $YPos; if(!is_numeric($Value)) { $XLast = -1; } } $XPos = $XPos + $this->DivisionWidth; } $GraphID++; } } } /** * @brief Draws a line graph where one series of data defines the * X position and another the Y position */ function drawXYGraph($Data, $YSerieName, $XSerieName, $PaletteID = 0) { $graphAreaMin = new Point($this->GArea_X1, $this->GArea_Y1); $graphAreaMax = new Point($this->GArea_X2, $this->GArea_Y2); $lastPoint = null; foreach($Data as $Values) { if(isset ($Values[$YSerieName]) && isset ($Values[$XSerieName])) { $X = $Values[$XSerieName]; $Y = $Values[$YSerieName]; $Y = $this->GArea_Y2 - (($Y - $this->VMin) * $this->DivisionRatio); $X = $this->GArea_X1 + (($X - $this->VXMin) * $this->XDivisionRatio); $currentPoint = new Point($X, $Y); if($lastPoint != null) { $this->canvas->drawLine( $lastPoint, $currentPoint, $this->palette->getColor($PaletteID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties, $graphAreaMin, $graphAreaMax ); } $lastPoint = $currentPoint; } } } /** * This function draw a cubic curve */ function drawCubicCurve(pData $data, $Accuracy = .1, $SerieName = "") { /* Validate the Data and DataDescription array */ $this->validateDataDescription( "drawCubicCurve", $data->getDataDescription() ); $this->validateData("drawCubicCurve", $data->getData()); $graphAreaMin = new Point($this->GArea_X1, $this->GArea_Y1); $graphAreaMax = new Point($this->GArea_X2, $this->GArea_Y2); $GraphID = 0; foreach($data->getDataDescription()->values as $ColName) { if($SerieName == "" || $SerieName == $ColName) { /** @todo The next section of code has been duplicated by * copy & paste */ $XIn = array(); $YIn = array(); $Yt = ""; $U = ""; $ColorID = $data->getDataDescription()->getColumnIndex($ColName); $Index = 1; $XLast = -1; $YLast = 0; $Missing = array(); $data->getXYMap($ColName, $XIn, $YIn, $Missing, $Index); assert(count($XIn) == count($YIn)); assert($Index + 1 >= count($XIn)); $Yt [0] = 0; $Yt [1] = 0; $U [1] = 0; $this->calculateCubicCurve($Yt, $XIn, $YIn, $U, $Index); $Yt [$Index] = 0; for($k = $Index - 1; $k >= 1; $k--) $Yt [$k] = $Yt [$k] * $Yt [$k + 1] + $U [$k]; $XPos = $this->GArea_X1 + $this->GAreaXOffset; for($X = 1; $X <= $Index; $X = $X + $Accuracy) { /* I believe here we're searching for the integral * value k such that $X lies between $XIn[k] and * $XIn[k-1] */ $klo = 1; $khi = $Index; $k = $khi - $klo; while($k > 1) { $k = $khi - $klo; If($XIn [$k] >= $X) $khi = $k; else $klo = $k; } $klo = $khi - 1; /* These assertions are to check my understanding * of the code. If they fail, it is my fault and * not a bug */ assert($khi = $klo + 1); assert($XIn[$klo] < $X); assert($X <= $XIn[$khi]); $h = $XIn [$khi] - $XIn [$klo]; $a = ($XIn [$khi] - $X) / $h; $b = ($X - $XIn [$klo]) / $h; /** * I believe this is the actual cubic Bezier * calculation. In parametric form: * * B(t) = (1-t)^3 * B0 * + 3 (1-t)^2 * t * B1 * + 3 (1-t) * t^2 * B2 * + t^3 B3 */ $Value = $a * $YIn [$klo] + $b * $YIn [$khi] + (($a * $a * $a - $a) * $Yt [$klo] + ($b * $b * $b - $b) * $Yt [$khi]) * ($h * $h) / 6; $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio); if($XLast != -1 && !isset ($Missing [floor($X)]) && !isset ($Missing [floor($X + 1)])) $this->canvas->drawLine( new Point($XLast, $YLast), new Point($XPos, $YPos), $this->palette->getColor($ColorID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties, $graphAreaMin, $graphAreaMax ); $XLast = $XPos; $YLast = $YPos; $XPos = $XPos + $this->DivisionWidth * $Accuracy; } // Add potentialy missing values $XPos = $XPos - $this->DivisionWidth * $Accuracy; if($XPos < ($this->GArea_X2 - $this->GAreaXOffset)) { $YPos = $this->GArea_Y2 - (($YIn [$Index] - $this->VMin) * $this->DivisionRatio); $this->canvas->drawLine( new Point($XLast, $YLast), new Point($this->GArea_X2 - $this->GAreaXOffset, $YPos), $this->palette->getColor($ColorID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties, $graphAreaMin, $graphAreaMax ); } $GraphID++; } } } /** * @todo I haven't figured out exactly what this bit of code does, * it's just an attempt to reduce code duplication */ private function calculateCubicCurve(array & $Yt, array $XIn, array $YIn, array & $U, $Index) { for($i = 2; $i <= $Index - 1; $i++) { /* Typically $Sig will be 0.5, since each X value will be * one unit past the last. If there is missing data then * this ratio will change */ $Sig = ($XIn [$i] - $XIn [$i - 1]) / ($XIn [$i + 1] - $XIn [$i - 1]); $p = $Sig * $Yt [$i - 1] + 2; /* This Y value will nearly always be negative, thanks to * $Sig being 0.5 */ $Yt [$i] = ($Sig - 1) / $p; /** @todo No idea what the following code is doing */ $U [$i] = ($YIn [$i + 1] - $YIn [$i]) / ($XIn [$i + 1] - $XIn [$i]) - ($YIn [$i] - $YIn [$i - 1]) / ($XIn [$i] - $XIn [$i - 1]); $U [$i] = (6 * $U [$i] / ($XIn [$i + 1] - $XIn [$i - 1]) - $Sig * $U [$i - 1]) / $p; } } /** * This function draw a filled cubic curve */ function drawFilledCubicCurve(pData $data, $Accuracy = .1, $Alpha = 100, $AroundZero = FALSE) { /* Validate the Data and DataDescription array */ $this->validateDataDescription( "drawFilledCubicCurve", $data->getDataDescription() ); $this->validateData("drawFilledCubicCurve", $data->getData()); $LayerWidth = $this->GArea_X2 - $this->GArea_X1; $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1; $YZero = $LayerHeight - ((0 - $this->VMin) * $this->DivisionRatio); if($YZero > $LayerHeight) { $YZero = $LayerHeight; } $GraphID = 0; foreach($data->getDataDescription()->values as $ColName) { $XIn = array(); $YIn = array(); $Yt = array(); $U = array(); $ColorID = $data->getDataDescription()->getColumnIndex($ColName); $numElements = 1; $XLast = -1; $Missing = array(); $data->getXYMap($ColName, $XIn, $YIn, $Missing, $numElements); $Yt [0] = 0; $Yt [1] = 0; $U [1] = 0; $this->calculateCubicCurve($Yt, $XIn, $YIn, $U, $numElements); $Yt [$numElements] = 0; for($k = $numElements - 1; $k >= 1; $k--) $Yt [$k] = $Yt [$k] * $Yt [$k + 1] + $U [$k]; $Points = ""; $Points [] = $this->GAreaXOffset + $this->GArea_X1; $Points [] = $LayerHeight + $this->GArea_Y1; $YLast = NULL; $XPos = $this->GAreaXOffset; $PointsCount = 2; for($X = 1; $X <= $numElements; $X = $X + $Accuracy) { $klo = 1; $khi = $numElements; $k = $khi - $klo; while($k > 1) { $k = $khi - $klo; If($XIn [$k] >= $X) $khi = $k; else $klo = $k; } $klo = $khi - 1; $h = $XIn [$khi] - $XIn [$klo]; $a = ($XIn [$khi] - $X) / $h; $b = ($X - $XIn [$klo]) / $h; $Value = $a * $YIn [$klo] + $b * $YIn [$khi] + (($a * $a * $a - $a) * $Yt [$klo] + ($b * $b * $b - $b) * $Yt [$khi]) * ($h * $h) / 6; $YPos = $LayerHeight - (($Value - $this->VMin) * $this->DivisionRatio); if($YLast != NULL && $AroundZero && !isset ($Missing [floor($X)]) && !isset ($Missing [floor($X + 1)])) { $aPoints = ""; $aPoints [] = $XLast + $this->GArea_X1; $aPoints [] = min($YLast + $this->GArea_Y1, $this->GArea_Y2); $aPoints [] = $XPos + $this->GArea_X1; $aPoints [] = min($YPos + $this->GArea_Y1, $this->GArea_Y2); $aPoints [] = $XPos + $this->GArea_X1; $aPoints [] = $YZero + $this->GArea_Y1; $aPoints [] = $XLast + $this->GArea_X1; $aPoints [] = $YZero + $this->GArea_Y1; $this->canvas->drawFilledPolygon( $aPoints, 4, $this->palette->getColor($ColorID), $alpha ); } if(!isset ($Missing [floor($X)]) || $YLast == NULL) { $PointsCount++; $Points [] = $XPos + $this->GArea_X1; $Points [] = min($YPos + $this->GArea_Y1, $this->GArea_Y2); } else { $PointsCount++; $Points [] = $XLast + $this->GArea_X1; $Points [] = min( $LayerHeight + $this->GArea_Y1, $this->GArea_Y2 ); ; } $YLast = $YPos; $XLast = $XPos; $XPos = $XPos + $this->DivisionWidth * $Accuracy; } // Add potentialy missing values $XPos = $XPos - $this->DivisionWidth * $Accuracy; if($XPos < ($LayerWidth - $this->GAreaXOffset)) { $YPos = $LayerHeight - (($YIn [$numElements] - $this->VMin) * $this->DivisionRatio); if($YLast != NULL && $AroundZero) { $aPoints = ""; $aPoints [] = $XLast + $this->GArea_X1; $aPoints [] = max($YLast + $this->GArea_Y1, $this->GArea_Y1); $aPoints [] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1; $aPoints [] = max($YPos + $this->GArea_Y1, $this->GArea_Y1); $aPoints [] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1; $aPoints [] = max($YZero + $this->GArea_Y1, $this->GArea_Y1); $aPoints [] = $XLast + $this->GArea_X1; $aPoints [] = max($YZero + $this->GArea_Y1, $this->GArea_Y1); $this->canvas->drawFilledPolygon( $aPoints, 4, $this->palette->getColor($ColorID), $alpha ); } if($YIn [$klo] != "" && $YIn [$khi] != "" || $YLast == NULL) { $PointsCount++; $Points [] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1; $Points [] = $YPos + $this->GArea_Y1; } } $Points [] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1; $Points [] = $LayerHeight + $this->GArea_Y1; if(!$AroundZero) { $this->canvas->drawFilledPolygon( $Points, $PointsCount, $this->palette->getColor($ColorID), $Alpha ); } $this->drawCubicCurve($data, $Accuracy, $ColName); $GraphID++; } } /** * This function draw a filled line graph */ function drawFilledLineGraph($Data, $DataDescription, $Alpha = 100, $AroundZero = FALSE) { $Empty = -2147483647; /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawFilledLineGraph", $DataDescription); $this->validateData("drawFilledLineGraph", $Data); $LayerWidth = $this->GArea_X2 - $this->GArea_X1; $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1; $GraphID = 0; foreach($DataDescription->values as $ColName) { $ColorID = $DataDescription->getColumnIndex($ColName); $aPoints = array(); $aPoints [] = $this->GAreaXOffset + $this->GArea_X1; $aPoints [] = $LayerHeight + $this->GArea_Y1; $XPos = $this->GAreaXOffset; $XLast = -1; $PointsCount = 2; $YZero = $LayerHeight - ((0 - $this->VMin) * $this->DivisionRatio); if($YZero > $LayerHeight) { $YZero = $LayerHeight; } $YLast = $Empty; foreach(array_keys($Data) as $Key) { $Value = $Data [$Key] [$ColName]; $YPos = $LayerHeight - (($Value - $this->VMin) * $this->DivisionRatio); /* Save point into the image map if option activated */ if($this->BuildMap) $this->addToImageMap($XPos - 3, $YPos - 3, $XPos + 3, $YPos + 3, $DataDescription->description[$ColName], $Data [$Key] [$ColName].$DataDescription->getYUnit(), "FLine"); if(!is_numeric($Value)) { $PointsCount++; $aPoints [] = $XLast + $this->GArea_X1; $aPoints [] = $LayerHeight + $this->GArea_Y1; $YLast = $Empty; } else { $PointsCount++; if($YLast != $Empty) { $aPoints [] = $XPos + $this->GArea_X1; $aPoints [] = $YPos + $this->GArea_Y1; } else { $PointsCount++; $aPoints [] = $XPos + $this->GArea_X1; $aPoints [] = $LayerHeight + $this->GArea_Y1; $aPoints [] = $XPos + $this->GArea_X1; $aPoints [] = $YPos + $this->GArea_Y1; } if($YLast != $Empty && $AroundZero) { $Points = ""; $Points [] = $XLast + $this->GArea_X1; $Points [] = $YLast + $this->GArea_Y1; $Points [] = $XPos + $this->GArea_X1; $Points [] = $YPos + $this->GArea_Y1; $Points [] = $XPos + $this->GArea_X1; $Points [] = $YZero + $this->GArea_Y1; $Points [] = $XLast + $this->GArea_X1; $Points [] = $YZero + $this->GArea_Y1; $this->canvas->drawFilledPolygon( $Points, 4, $this->palette->getColor($ColorID), $Alpha ); } $YLast = $YPos; } $XLast = $XPos; $XPos = $XPos + $this->DivisionWidth; } $aPoints [] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1; $aPoints [] = $LayerHeight + $this->GArea_Y1; if($AroundZero == FALSE) { $this->canvas->drawFilledPolygon( $aPoints, $PointsCount, $this->palette->getColor($ColorID), $Alpha ); } $GraphID++; $this->drawLineGraph($Data, $DataDescription, $ColName); } } /** * This function draws a bar graph */ function drawOverlayBarGraph($Data, $DataDescription, $Alpha = 50) { /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawOverlayBarGraph", $DataDescription); $this->validateData("drawOverlayBarGraph", $Data); $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1; $GraphID = 0; foreach($DataDescription->values as $ColName) { $ColorID = $DataDescription->getColumnIndex($ColName); $XWidth = $this->DivisionWidth / 4; $XPos = $this->GAreaXOffset; $YZero = $LayerHeight - ((0 - $this->VMin) * $this->DivisionRatio); foreach(array_keys($Data) as $Key) { if(isset ($Data [$Key] [$ColName])) { $Value = $Data [$Key] [$ColName]; if(is_numeric($Value)) { $YPos = $LayerHeight - (($Value - $this->VMin) * $this->DivisionRatio); $this->canvas->drawFilledRectangle( new Point(floor($XPos - $XWidth + $this->GArea_X1), floor($YPos + $this->GArea_Y1)), new Point(floor($XPos + $XWidth + $this->GArea_X1), floor($YZero + $this->GArea_Y1)), $this->palette->getColor($GraphID), ShadowProperties::NoShadow(), false, $Alpha ); $X1 = floor($XPos - $XWidth + $this->GArea_X1); $Y1 = floor($YPos + $this->GArea_Y1) + .2; $X2 = floor($XPos + $XWidth + $this->GArea_X1); $Y2 = $this->GArea_Y2 - ((0 - $this->VMin) * $this->DivisionRatio); if($X1 <= $this->GArea_X1) { $X1 = $this->GArea_X1 + 1; } if($X2 >= $this->GArea_X2) { $X2 = $this->GArea_X2 - 1; } /* Save point into the image map if option activated */ if($this->BuildMap) $this->addToImageMap($X1, min($Y1, $Y2), $X2, max($Y1, $Y2), $DataDescription->description[$ColName], $Data [$Key] [$ColName].$DataDescription->getYUnit(), "oBar"); $this->canvas->drawLine( new Point($X1, $Y1), new Point($X2, $Y1), $this->palette->getColor($ColorID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties, new Point($this->GArea_X1, $this->GArea_Y1), new Point($this->GArea_X2, $this->GArea_Y2) ); } } $XPos = $XPos + $this->DivisionWidth; } $GraphID++; } } /** * This function draw a bar graph */ function drawBarGraph($Data, $DataDescription, $Alpha = 100) { /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawBarGraph", $DataDescription); $this->validateData("drawBarGraph", $Data); $Series = count($DataDescription->values); $SeriesWidth = $this->DivisionWidth / ($Series + 1); $SerieXOffset = $this->DivisionWidth / 2 - $SeriesWidth / 2; $YZero = $this->GArea_Y2 - ((0 - $this->VMin) * $this->DivisionRatio); if($YZero > $this->GArea_Y2) { $YZero = $this->GArea_Y2; } $SerieID = 0; foreach($DataDescription->values as $ColName) { $ColorID = $DataDescription->getColumnIndex($ColName); $XPos = $this->GArea_X1 + $this->GAreaXOffset - $SerieXOffset + $SeriesWidth * $SerieID; foreach(array_keys($Data) as $Key) { if(isset ($Data [$Key] [$ColName])) { if(is_numeric($Data [$Key] [$ColName])) { $Value = $Data [$Key] [$ColName]; $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio); /* Save point into the image map if option activated */ if($this->BuildMap) { $this->addToImageMap($XPos + 1, min($YZero, $YPos), $XPos + $SeriesWidth - 1, max($YZero, $YPos), $DataDescription->description[$ColName], $Data [$Key] [$ColName].$DataDescription->getYUnit(), "Bar"); } if($Alpha == 100) { $this->canvas->drawRectangle( new Point($XPos + 1, $YZero), new Point($XPos + $SeriesWidth - 1, $YPos), new Color(25, 25, 25), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); } $this->canvas->drawFilledRectangle( new Point($XPos + 1, $YZero), new Point($XPos + $SeriesWidth - 1, $YPos), $this->palette->getColor($ColorID), $this->shadowProperties, TRUE, $Alpha ); } } $XPos = $XPos + $this->DivisionWidth; } $SerieID++; } } /** * This function draw a stacked bar graph */ function drawStackedBarGraph($Data, $DataDescription, $Alpha = 50, $Contiguous = FALSE) { /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawBarGraph", $DataDescription); $this->validateData("drawBarGraph", $Data); if($Contiguous) $SeriesWidth = $this->DivisionWidth; else $SeriesWidth = $this->DivisionWidth * .8; $YZero = $this->GArea_Y2 - ((0 - $this->VMin) * $this->DivisionRatio); if($YZero > $this->GArea_Y2) { $YZero = $this->GArea_Y2; } $SerieID = 0; $LastValue = ""; foreach($DataDescription->values as $ColName) { $ColorID = $DataDescription->getColumnIndex($ColName); $XPos = $this->GArea_X1 + $this->GAreaXOffset - $SeriesWidth / 2; foreach(array_keys($Data) as $Key) { if(isset ($Data [$Key] [$ColName])) { if(is_numeric($Data [$Key] [$ColName])) { $Value = $Data [$Key] [$ColName]; if(isset ($LastValue [$Key])) { $YPos = $this->GArea_Y2 - ((($Value + $LastValue [$Key]) - $this->VMin) * $this->DivisionRatio); $YBottom = $this->GArea_Y2 - (($LastValue [$Key] - $this->VMin) * $this->DivisionRatio); $LastValue [$Key] += $Value; } else { $YPos = $this->GArea_Y2 - (($Value - $this->VMin) * $this->DivisionRatio); $YBottom = $YZero; $LastValue [$Key] = $Value; } /* Save point into the image map if option activated */ if($this->BuildMap) $this->addToImageMap($XPos + 1, min($YBottom, $YPos), $XPos + $SeriesWidth - 1, max($YBottom, $YPos), $DataDescription->description[$ColName], $Data [$Key] [$ColName].$DataDescription->getYUnit(), "sBar"); $this->canvas->drawFilledRectangle( new Point($XPos + 1, $YBottom), new Point($XPos + $SeriesWidth - 1, $YPos), $this->palette->getColor($ColorID), $this->shadowProperties, TRUE, $Alpha ); } } $XPos = $XPos + $this->DivisionWidth; } $SerieID++; } } /** * This function draw a limits bar graphs */ function drawLimitsGraph($Data, $DataDescription, Color $color = null) { if($color == null) { $color = new Color(0, 0, 0); } /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawLimitsGraph", $DataDescription); $this->validateData("drawLimitsGraph", $Data); $XWidth = $this->DivisionWidth / 4; $XPos = $this->GArea_X1 + $this->GAreaXOffset; $graphAreaMin = new Point($this->GArea_X1, $this->GArea_Y1); $graphAreaMax = new Point($this->GArea_X2, $this->GArea_Y2); foreach(array_keys($Data) as $Key) { $Min = $Data [$Key] [$DataDescription->values[0]]; $Max = $Data [$Key] [$DataDescription->values[0]]; $GraphID = 0; $MaxID = 0; $MinID = 0; foreach($DataDescription->values as $ColName) { if(isset ($Data [$Key] [$ColName])) { if($Data [$Key] [$ColName] > $Max && is_numeric($Data [$Key] [$ColName])) { $Max = $Data [$Key] [$ColName]; $MaxID = $GraphID; } } if(isset ($Data [$Key] [$ColName]) && is_numeric($Data [$Key] [$ColName])) { if($Data [$Key] [$ColName] < $Min) { $Min = $Data [$Key] [$ColName]; $MinID = $GraphID; } $GraphID++; } } $YPos = $this->GArea_Y2 - (($Max - $this->VMin) * $this->DivisionRatio); $X1 = floor($XPos - $XWidth); $Y1 = floor($YPos) - .2; $X2 = floor($XPos + $XWidth); if($X1 <= $this->GArea_X1) { $X1 = $this->GArea_X1 + 1; } if($X2 >= $this->GArea_X2) { $X2 = $this->GArea_X2 - 1; } $YPos = $this->GArea_Y2 - (($Min - $this->VMin) * $this->DivisionRatio); $Y2 = floor($YPos) + .2; $this->canvas->drawLine( new Point(floor($XPos) - .2, $Y1 + 1), new Point(floor($XPos) - .2, $Y2 - 1), $color, $this->LineWidth, $this->LineDotSize, $this->shadowProperties, $graphAreaMin, $graphAreaMax ); $this->canvas->drawLine( new Point(floor($XPos) + .2, $Y1 + 1), new Point(floor($XPos) + .2, $Y2 - 1), $color, $this->LineWidth, $this->LineDotSize, $this->shadowProperties, $graphAreaMin, $graphAreaMax ); $this->canvas->drawLine( new Point($X1, $Y1), new Point($X2, $Y1), $this->palette->getColor($MaxID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $this->canvas->drawLine( new Point($X1, $Y2), new Point($X2, $Y2), $this->palette->getColor($MinID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $XPos = $XPos + $this->DivisionWidth; } } /** * This function draw radar axis centered on the graph area */ function drawRadarAxis($Data, $DataDescription, $Mosaic = TRUE, $BorderOffset = 10, Color $colorA = null, Color $colorS = null, $MaxValue = -1) { if($colorA == null) { $colorA = new Color(60, 60, 60); } if($colorS == null) { $colorS = new Color(200, 200, 200); } /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawRadarAxis", $DataDescription); $this->validateData("drawRadarAxis", $Data); /* Draw radar axis */ $Points = count($Data); $Radius = ($this->GArea_Y2 - $this->GArea_Y1) / 2 - $BorderOffset; $XCenter = ($this->GArea_X2 - $this->GArea_X1) / 2 + $this->GArea_X1; $YCenter = ($this->GArea_Y2 - $this->GArea_Y1) / 2 + $this->GArea_Y1; /* Search for the max value */ if($MaxValue == -1) { foreach($DataDescription->values as $ColName) { foreach(array_keys($Data) as $Key) { if(isset ($Data [$Key] [$ColName])) if($Data [$Key] [$ColName] > $MaxValue) { $MaxValue = $Data [$Key] [$ColName]; } } } } $LastX2 = 0; $LastY1 = 0; $LastY2 = 0; /* Draw the mosaic */ if($Mosaic) { $RadiusScale = $Radius / $MaxValue; for($t = 1; $t <= $MaxValue - 1; $t++) { $TRadius = $RadiusScale * $t; $LastX1 = -1; for($i = 0; $i <= $Points; $i++) { $Angle = -90 + $i * 360 / $Points; $X1 = cos($Angle * M_PI / 180) * $TRadius + $XCenter; $Y1 = sin($Angle * M_PI / 180) * $TRadius + $YCenter; $X2 = cos($Angle * M_PI / 180) * ($TRadius + $RadiusScale) + $XCenter; $Y2 = sin($Angle * M_PI / 180) * ($TRadius + $RadiusScale) + $YCenter; if($t % 2 == 1 && $LastX1 != -1) { $Plots = ""; $Plots [] = $X1; $Plots [] = $Y1; $Plots [] = $X2; $Plots [] = $Y2; $Plots [] = $LastX2; $Plots [] = $LastY2; $Plots [] = $LastX1; $Plots [] = $LastY1; $this->canvas->drawFilledPolygon( $Plots, (count($Plots) + 1) / 2, new Color(250, 250, 250) ); } $LastX1 = $X1; $LastY1 = $Y1; $LastX2 = $X2; $LastY2 = $Y2; } } } /* Draw the spider web */ $LastY = 0; for($t = 1; $t <= $MaxValue; $t++) { $TRadius = ($Radius / $MaxValue) * $t; $LastX = -1; for($i = 0; $i <= $Points; $i++) { $Angle = -90 + $i * 360 / $Points; $X = cos($Angle * M_PI / 180) * $TRadius + $XCenter; $Y = sin($Angle * M_PI / 180) * $TRadius + $YCenter; if($LastX != -1) $this->canvas->drawDottedLine( new Point($LastX, $LastY), new Point($X, $Y), 4, 1, $colorS, $this->shadowProperties ); $LastX = $X; $LastY = $Y; } } /* Draw the axis */ for($i = 0; $i <= $Points; $i++) { $Angle = -90 + $i * 360 / $Points; $X = cos($Angle * M_PI / 180) * $Radius + $XCenter; $Y = sin($Angle * M_PI / 180) * $Radius + $YCenter; $this->canvas->drawLine( new Point($XCenter, $YCenter), new Point($X, $Y), $colorA, $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $XOffset = 0; $YOffset = 0; if(isset ($Data [$i] [$DataDescription->getPosition()])) { $Label = $Data [$i] [$DataDescription->getPosition()]; $Positions = imagettfbbox($this->FontSize, 0, $this->FontName, $Label); $Width = $Positions [2] - $Positions [6]; $Height = $Positions [3] - $Positions [7]; if($Angle >= 0 && $Angle <= 90) $YOffset = $Height; if($Angle > 90 && $Angle <= 180) { $YOffset = $Height; $XOffset = -$Width; } if($Angle > 180 && $Angle <= 270) { $XOffset = -$Width; } $this->canvas->drawText( $this->FontSize, 0, new Point($X + $XOffset, $Y + $YOffset), $colorA, $this->FontName, $Label, ShadowProperties::NoShadow() ); } } /* Write the values */ for($t = 1; $t <= $MaxValue; $t++) { $TRadius = ($Radius / $MaxValue) * $t; $Angle = -90 + 360 / $Points; $X1 = $XCenter; $Y1 = $YCenter - $TRadius; $X2 = cos($Angle * M_PI / 180) * $TRadius + $XCenter; $Y2 = sin($Angle * M_PI / 180) * $TRadius + $YCenter; $XPos = floor(($X2 - $X1) / 2) + $X1; $YPos = floor(($Y2 - $Y1) / 2) + $Y1; $Positions = imagettfbbox($this->FontSize, 0, $this->FontName, $t); $X = $XPos - ($X + $Positions [2] - $X + $Positions [6]) / 2; $Y = $YPos + $this->FontSize; $this->canvas->drawFilledRoundedRectangle( new Point($X + $Positions [6] - 2, $Y + $Positions [7] - 1), new Point($X + $Positions [2] + 4, $Y + $Positions [3] + 1), 2, new Color(240, 240, 240), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $this->canvas->drawRoundedRectangle( new Point($X + $Positions [6] - 2, $Y + $Positions [7] - 1), new Point($X + $Positions [2] + 4, $Y + $Positions [3] + 1), 2, new Color(220, 220, 220), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $this->canvas->drawText( $this->FontSize, 0, new Point($X, $Y), $colorA, $this->FontName, $t, ShadowProperties::NoShadow() ); } } private function calculateMaxValue($Data, $DataDescription) { $MaxValue = -1; foreach($DataDescription->values as $ColName) { foreach(array_keys($Data) as $Key) { if(isset ($Data [$Key] [$ColName])) if($Data [$Key] [$ColName] > $MaxValue && is_numeric($Data[$Key][$ColName])) { $MaxValue = $Data [$Key] [$ColName]; } } } return $MaxValue; } /** * This function draw a radar graph centered on the graph area */ function drawRadar($Data, $DataDescription, $BorderOffset = 10, $MaxValue = -1) { /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawRadar", $DataDescription); $this->validateData("drawRadar", $Data); $Points = count($Data); $Radius = ($this->GArea_Y2 - $this->GArea_Y1) / 2 - $BorderOffset; $XCenter = ($this->GArea_X2 - $this->GArea_X1) / 2 + $this->GArea_X1; $YCenter = ($this->GArea_Y2 - $this->GArea_Y1) / 2 + $this->GArea_Y1; /* Search for the max value */ if($MaxValue == -1) { $MaxValue = $this->calculateMaxValue($Data, $DataDescription); } $GraphID = 0; $YLast = 0; foreach($DataDescription->values as $ColName) { $ColorID = $DataDescription->getColumnIndex($ColName); $Angle = -90; $XLast = -1; foreach(array_keys($Data) as $Key) { if(isset ($Data [$Key] [$ColName])) { $Value = $Data [$Key] [$ColName]; $Strength = ($Radius / $MaxValue) * $Value; $XPos = cos($Angle * M_PI / 180) * $Strength + $XCenter; $YPos = sin($Angle * M_PI / 180) * $Strength + $YCenter; if($XLast != -1) $this->canvas->drawLine( new Point($XLast, $YLast), new Point($XPos, $YPos), $this->palette->getColor($ColorID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); if($XLast == -1) { $FirstX = $XPos; $FirstY = $YPos; } $Angle = $Angle + (360 / $Points); $XLast = $XPos; $YLast = $YPos; } } $this->canvas->drawLine( new Point($XPos, $YPos), new Point($FirstX, $FirstY), $this->palette->getColor($ColorID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $GraphID++; } } /** * This function draw a radar graph centered on the graph area */ function drawFilledRadar($Data, $DataDescription, $Alpha = 50, $BorderOffset = 10, $MaxValue = -1) { /* Validate the Data and DataDescription array */ $this->validateDataDescription("drawFilledRadar", $DataDescription); $this->validateData("drawFilledRadar", $Data); $Points = count($Data); $Radius = ($this->GArea_Y2 - $this->GArea_Y1) / 2 - $BorderOffset; $XCenter = ($this->GArea_X2 - $this->GArea_X1) / 2; $YCenter = ($this->GArea_Y2 - $this->GArea_Y1) / 2; /* Search for the max value */ if($MaxValue == -1) { $MaxValue = $this->calculateMaxValue($Data, $DataDescription); } $GraphID = 0; foreach($DataDescription->values as $ColName) { $ColorID = $DataDescription->getColumnIndex($ColName); $Angle = -90; $XLast = -1; $Plots = array(); foreach(array_keys($Data) as $Key) { if(isset ($Data [$Key] [$ColName])) { $Value = $Data [$Key] [$ColName]; if(!is_numeric($Value)) { $Value = 0; } $Strength = ($Radius / $MaxValue) * $Value; $XPos = cos($Angle * M_PI / 180) * $Strength + $XCenter; $YPos = sin($Angle * M_PI / 180) * $Strength + $YCenter; $Plots [] = $XPos + $this->GArea_X1; $Plots [] = $YPos + $this->GArea_Y1; $Angle = $Angle + (360 / $Points); $XLast = $XPos; } } if(isset ($Plots [0])) { $Plots [] = $Plots [0]; $Plots [] = $Plots [1]; $this->canvas->drawFilledPolygon( $Plots, (count($Plots) + 1) / 2, $this->palette->getColor($ColorID), $Alpha ); for($i = 0; $i <= count($Plots) - 4; $i = $i + 2) $this->canvas->drawLine( new Point($Plots [$i], $Plots [$i + 1]), new Point($Plots [$i + 2], $Plots [$i + 3]), $this->palette->getColor($ColorID), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); } $GraphID++; } } /** * This function can be used to set the background color */ function drawBackground(Color $color) { $C_Background = $this->canvas->allocateColor($color); imagefilledrectangle($this->canvas->getPicture(), 0, 0, $this->XSize, $this->YSize, $C_Background); } private function drawGradient(Point $point1, Point $point2, Color $color, $decay) { /* Positive gradient */ if($decay > 0) { $YStep = ($point2->getY() - $point1->getY() - 2) / $decay; for($i = 0; $i <= $decay; $i++) { $color = $color->addRGBIncrement(-1); $Yi1 = $point1->getY() + ($i * $YStep); $Yi2 = ceil($Yi1 + ($i * $YStep) + $YStep); if($Yi2 >= $Yi2) { $Yi2 = $point2->getY() - 1; } $this->canvas->drawFilledRectangle( new Point($point1->getX(), $Yi1), new Point($point2->getX(), $Yi2), $color, ShadowProperties::NoShadow() ); } } /* Negative gradient */ if($decay < 0) { $YStep = ($point2->getY() - $point1->getY() - 2) / -$decay; $Yi1 = $point1->getY(); $Yi2 = $point1->getY() + $YStep; for($i = -$decay; $i >= 0; $i--) { $color = $color->addRGBIncrement(1); $this->canvas->drawFilledRectangle( new Point($point1->getX(), $Yi1), new Point($point2->getX(), $Yi2), $color, ShadowProperties::NoShadow() ); $Yi1 += $YStep; $Yi2 += $YStep; if($Yi2 >= $Yi2) { $Yi2 = $point2->getY() - 1; } } } } /** * This function can be used to set the background color */ private function drawGraphAreaGradient(BackgroundStyle $style) { if(!$style->useGradient()) { return; } $this->drawGradient( new Point($this->GArea_X1 + 1, $this->GArea_Y1 + 1), new Point($this->GArea_X2 - 1, $this->GArea_Y2), $style->getGradientStartColor(), $style->getGradientDecay() ); } public function drawBackgroundGradient(Color $color, $decay) { $this->drawGradient( new Point(0, 0), new Point($this->XSize, $this->YSize), $color, $decay ); } /** * This function will draw an ellipse */ function drawEllipse($Xc, $Yc, $Height, $Width, Color $color) { $this->canvas->drawCircle(new Point($Xc, $Yc), $Height, $color, $this->shadowProperties, $Width); } /** * This function will draw a filled ellipse */ function drawFilledEllipse($Xc, $Yc, $Height, $Width, Color $color) { $this->canvas->drawFilledCircle(new Point($Xc, $Yc), $Height, $color, $this->shadowProperties, $Width); } /** * Load a PNG file and draw it over the chart */ function drawFromPNG($FileName, $X, $Y, $Alpha = 100) { $this->drawFromPicture(1, $FileName, $X, $Y, $Alpha); } /** * Load a GIF file and draw it over the chart */ function drawFromGIF($FileName, $X, $Y, $Alpha = 100) { $this->drawFromPicture(2, $FileName, $X, $Y, $Alpha); } /** * Load a JPEG file and draw it over the chart */ function drawFromJPG($FileName, $X, $Y, $Alpha = 100) { $this->drawFromPicture(3, $FileName, $X, $Y, $Alpha); } /** * Generic loader function for external pictures */ function drawFromPicture($PicType, $FileName, $X, $Y, $Alpha = 100) { if(file_exists($FileName)) { $Infos = getimagesize($FileName); $Width = $Infos [0]; $Height = $Infos [1]; if($PicType == 1) { $Raster = imagecreatefrompng($FileName); } if($PicType == 2) { $Raster = imagecreatefromgif($FileName); } if($PicType == 3) { $Raster = imagecreatefromjpeg($FileName); } imagecopymerge($this->canvas->getPicture(), $Raster, $X, $Y, 0, 0, $Width, $Height, $Alpha); imagedestroy($Raster); } } /** * Add a border to the picture * * @todo This hasn't been updated to the new API yet */ function addBorder($Size = 3, $R = 0, $G = 0, $B = 0) { $Width = $this->XSize + 2 * $Size; $Height = $this->YSize + 2 * $Size; $Resampled = imagecreatetruecolor($Width, $Height); $C_Background = imagecolorallocate($Resampled, $R, $G, $B); imagefilledrectangle($Resampled, 0, 0, $Width, $Height, $C_Background); imagecopy($Resampled, $this->canvas->getPicture(), $Size, $Size, 0, 0, $this->XSize, $this->YSize); imagedestroy($this->canvas->getPicture()); $this->XSize = $Width; $this->YSize = $Height; $this->canvas->setPicture(imagecreatetruecolor($this->XSize, $this->YSize)); $C_White = $this->canvas->allocate(new Color(255, 255, 255)); imagefilledrectangle($this->canvas->getPicture(), 0, 0, $this->XSize, $this->YSize, $C_White); imagecolortransparent($this->canvas->getPicture(), $C_White); imagecopy($this->canvas->getPicture(), $Resampled, 0, 0, 0, 0, $this->XSize, $this->YSize); } /** * Render the current picture to a file */ function Render($FileName) { if($this->ErrorReporting) $this->printErrors($this->ErrorInterface); /* Save image map if requested */ if($this->BuildMap) $this->SaveImageMap(); if($FileName) { imagepng($this->canvas->getPicture(), $FileName); } else { imagepng($this->canvas->getPicture()); } } /** * Render the current picture to STDOUT */ function Stroke() { if($this->ErrorReporting) $this->printErrors("GD"); /* Save image map if requested */ if($this->BuildMap) $this->SaveImageMap(); header('Content-type: image/png'); imagepng($this->canvas->getPicture()); } /** * Validate data contained in the description array * * @todo Should this be a method on DataDescription? */ protected function validateDataDescription($FunctionName, DataDescription $DataDescription, $DescriptionRequired = TRUE) { if($DataDescription->getPosition() == '') { $this->Errors [] = "[Warning] ".$FunctionName." - Y Labels are not set."; $DataDescription->setPosition("Name"); } if($DescriptionRequired) { if(!isset ($DataDescription->description)) { $this->Errors [] = "[Warning] ".$FunctionName." - Series descriptions are not set."; foreach($DataDescription->values as $key => $Value) { $DataDescription->description[$Value] = $Value; } } if(count($DataDescription->description) < count($DataDescription->values)) { $this->Errors [] = "[Warning] ".$FunctionName." - Some series descriptions are not set."; foreach($DataDescription->values as $key => $Value) { if(!isset ($DataDescription->description[$Value])) $DataDescription->description[$Value] = $Value; } } } } /** * Validate data contained in the data array */ protected function validateData($FunctionName, $Data) { $DataSummary = array(); foreach($Data as $key => $Values) { foreach($Values as $key2 => $Value) { if(!isset ($DataSummary [$key2])) $DataSummary [$key2] = 1; else $DataSummary [$key2]++; } } if(empty($DataSummary)) $this->Errors [] = "[Warning] ".$FunctionName." - No data set."; foreach($DataSummary as $key => $Value) { if($Value < max($DataSummary)) { $this->Errors [] = "[Warning] ".$FunctionName." - Missing data in serie ".$key."."; } } } /** * Print all error messages on the CLI or graphically */ function printErrors($Mode = "CLI") { if(count($this->Errors) == 0) return (0); if($Mode == "CLI") { foreach($this->Errors as $key => $Value) echo $Value."\r\n"; } elseif($Mode == "GD") { $MaxWidth = 0; foreach($this->Errors as $key => $Value) { $Position = imageftbbox($this->ErrorFontSize, 0, $this->ErrorFontName, $Value); $TextWidth = $Position [2] - $Position [0]; if($TextWidth > $MaxWidth) { $MaxWidth = $TextWidth; } } $this->canvas->drawFilledRoundedRectangle( new Point($this->XSize - ($MaxWidth + 20), $this->YSize - (20 + (($this->ErrorFontSize + 4) * count($this->Errors)))), new Point($this->XSize - 10, $this->YSize - 10), 6, new Color(233, 185, 185), $this->lineWidth, $this->lineDotSize, $this->shadowProperties ); $this->canvas->drawRoundedRectangle( new Point($this->XSize - ($MaxWidth + 20), $this->YSize - (20 + (($this->ErrorFontSize + 4) * count($this->Errors)))), new Point($this->XSize - 10, $this->YSize - 10), 6, new Color(193, 145, 145), $this->LineWidth, $this->LineDotSize, $this->shadowProperties ); $YPos = $this->YSize - (18 + (count($this->Errors) - 1) * ($this->ErrorFontSize + 4)); foreach($this->Errors as $key => $Value) { $this->canvas->drawText( $this->ErrorFontSize, 0, new Point($this->XSize - ($MaxWidth + 15), $YPos), new Color(133, 85, 85), $this->ErrorFontName, $Value, ShadowProperties::NoShadow() ); $YPos = $YPos + ($this->ErrorFontSize + 4); } } } /** * Activate the image map creation process */ function setImageMap($Mode = TRUE, $GraphID = "MyGraph") { $this->BuildMap = $Mode; $this->MapID = $GraphID; } /** * Add a box into the image map */ function addToImageMap($X1, $Y1, $X2, $Y2, $SerieName, $Value, $CallerFunction) { if($this->MapFunction == NULL || $this->MapFunction == $CallerFunction) { $this->ImageMap [] = round($X1).",".round($Y1).",".round($X2).",".round($Y2).",".$SerieName.",".$Value; $this->MapFunction = $CallerFunction; } } /** * Load and cleanup the image map from disk */ function getImageMap($MapName, $Flush = TRUE) { /* Strip HTML query strings */ $Values = $this->tmpFolder.$MapName; $Value = explode("\?", $Values); $FileName = $Value [0]; if(file_exists($FileName)) { $Handle = fopen($FileName, "r"); $MapContent = fread($Handle, filesize($FileName)); fclose($Handle); echo $MapContent; if($Flush) unlink($FileName); exit (); } else { header("HTTP/1.0 404 Not Found"); exit (); } } /** * Save the image map to the disk */ function SaveImageMap() { if(!$this->BuildMap) { return (-1); } if($this->ImageMap == NULL) { $this->Errors [] = "[Warning] SaveImageMap - Image map is empty."; return (-1); } $Handle = fopen($this->tmpFolder.$this->MapID, 'w'); if(!$Handle) { $this->Errors [] = "[Warning] SaveImageMap - Cannot save the image map."; return (-1); } else { foreach($this->ImageMap as $Value) fwrite($Handle, htmlentities($Value)."\r"); } fclose($Handle); } /** * Set date format for axis labels */ function setDateFormat($Format) { $this->DateFormat = $Format; } /** * Convert TS to a date format string */ function ToDate($Value) { return (date($this->DateFormat, $Value)); } /** * Check if a number is a full integer (for scaling) */ static private function isRealInt($Value) { if($Value == floor($Value)) return (TRUE); return (FALSE); } /** * @todo I don't know what this does yet, I'm refactoring... */ public function calculateScales(& $Scale, & $Divisions) { /* Compute automatic scaling */ $ScaleOk = FALSE; $Factor = 1; $MinDivHeight = 25; $MaxDivs = ($this->GArea_Y2 - $this->GArea_Y1) / $MinDivHeight; if($this->VMax <= $this->VMin) { throw new Exception("Impossible to calculate scales when VMax <= VMin"); } if($this->VMin == 0 && $this->VMax == 0) { $this->VMin = 0; $this->VMax = 2; $Scale = 1; $Divisions = 2; } elseif($MaxDivs > 1) { while(!$ScaleOk) { $Scale1 = ($this->VMax - $this->VMin) / $Factor; $Scale2 = ($this->VMax - $this->VMin) / $Factor / 2; if($Scale1 > 1 && $Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale1); $Scale = 1; } if($Scale2 > 1 && $Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale2); $Scale = 2; } if(!$ScaleOk) { if($Scale2 > 1) { $Factor = $Factor * 10; } if($Scale2 < 1) { $Factor = $Factor / 10; } } } if(floor($this->VMax / $Scale / $Factor) != $this->VMax / $Scale / $Factor) { $GridID = floor($this->VMax / $Scale / $Factor) + 1; $this->VMax = $GridID * $Scale * $Factor; $Divisions++; } if(floor($this->VMin / $Scale / $Factor) != $this->VMin / $Scale / $Factor) { $GridID = floor($this->VMin / $Scale / $Factor); $this->VMin = $GridID * $Scale * $Factor; $Divisions++; } } else /* Can occur for small graphs */ $Scale = 1; } /* * Returns the resource */ public function getPicture() { return $this->canvas->getPicture(); } static private function computeAutomaticScaling($minCoord, $maxCoord, &$minVal, &$maxVal, &$Divisions) { $ScaleOk = FALSE; $Factor = 1; $Scale = 1; $MinDivHeight = 25; $MaxDivs = ($maxCoord - $minCoord) / $MinDivHeight; $minVal = (float) $minVal; $maxVal = (float) $maxVal; // when min and max are the them spread out the value if($minVal == $maxVal) { $ispos = $minVal > 0; $maxVal += $maxVal/2; $minVal -= $minVal/2; if($minVal < 0 && $ispos) $minVal = 0; } if($minVal == 0 && $maxVal == 0) { $minVal = 0; $maxVal = 2; $Divisions = 2; } elseif($MaxDivs > 1) { while(!$ScaleOk) { if($Factor == 0) throw new Exception('Division by zero whne calculating scales (should not happen)'); $Scale1 = ($maxVal - $minVal) / $Factor; $Scale2 = ($maxVal - $minVal) / $Factor / 2; if($Scale1 > 1 && $Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale1); $Scale = 1; } if($Scale2 > 1 && $Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale2); $Scale = 2; } if(!$ScaleOk) { if($Scale2 >= 1) { $Factor = $Factor * 10.0; } if($Scale2 < 1) { $Factor = $Factor / 10.0; } } } if(floor($maxVal / $Scale / $Factor) != $maxVal / $Scale / $Factor) { $GridID = floor($maxVal / $Scale / $Factor) + 1; $maxVal = $GridID * $Scale * $Factor; $Divisions++; } if(floor($minVal / $Scale / $Factor) != $minVal / $Scale / $Factor) { $GridID = floor($minVal / $Scale / $Factor); $minVal = $GridID * $Scale * $Factor; $Divisions++; } } if(!isset ($Divisions)) { $Divisions = 2; } if(self::isRealInt(($maxVal - $minVal) / ($Divisions - 1))) { $Divisions--; } elseif(self::isRealInt(($maxVal - $minVal) / ($Divisions + 1))) { $Divisions++; } } static private function convertValueForDisplay($value, $format, $unit) { if($format == "number") return $value.$unit; if($format == "time") return ConversionHelpers::ToTime($value); if($format == "date") return date('Y-m-d', $value); //todo: might be wrong, needs to go into converseion helper and needs a test if($format == "metric") return ConversionHelpers::ToMetric($value); if($format == "currency") return ConversionHelpers::ToCurrency($value); } } /** * * @param $Message */ function RaiseFatal($Message) { echo "[FATAL] ".$Message."\r\n"; exit (); }
gpl-2.0
conan513/SingleCore_TC
dep/duktape/dukglue/detail_stack.h
2085
#pragma once #include <string> #include "detail_traits.h" #include "detail_types.h" #include <duktape/duktape.h> namespace dukglue { namespace detail { // Helper to get the argument tuple type, with correct storage types. template<typename... Args> struct ArgsTuple { typedef std::tuple<typename dukglue::types::ArgStorage<Args>::type...> type; }; // Helper to get argument indices. // Call read for every Ts[i], for matching argument index Index[i]. // The traits::index_tuple is used for type inference. // A concrete example: // get_values<int, bool>(duktape_context) // get_values_helper<{int, bool}, {0, 1}>(ctx, ignored) // std::make_tuple<int, bool>(read<int>(ctx, 0), read<bool>(ctx, 1)) template<typename... Args, size_t... Indexes> typename ArgsTuple<Args...>::type get_stack_values_helper(duk_context* ctx, dukglue::detail::index_tuple<Indexes...>) { using namespace dukglue::types; return std::forward_as_tuple(DukType<typename Bare<Args>::type>::template read<typename ArgStorage<Args>::type>(ctx, Indexes)...); } // Returns an std::tuple of the values asked for in the template parameters. // Values will remain on the stack. // Values are indexed from the bottom of the stack up (0, 1, ...). // If a value does not exist or does not have the expected type, an error is thrown // through Duktape (with duk_error(...)), and the function does not return template<typename... Args> typename ArgsTuple<Args...>::type get_stack_values(duk_context* ctx) { // We need the argument indices for read_value, and we need to be able // to unpack them as a template argument to match Ts. // So, we use traits::make_indexes<Ts...>, which returns a traits::index_tuple<0, 1, 2, ...> object. // We pass that into a helper function so we can put a name to that <0, 1, ...> template argument. // Here, the type of Args isn't important, the length of it is. auto indices = typename dukglue::detail::make_indexes<Args...>::type(); return get_stack_values_helper<Args...>(ctx, indices); } } }
gpl-2.0
xpaum/kernel_stock_g3815
kernel.sh
96
export PATH=$PATH:/home/xpaum/android/gcc-linaro-4.7/bin make ARCH=arm CROSS_COMPILE=arm-eabi-
gpl-2.0
pscrevs/gcconnex
mod/gccollab_stats/languages/fr.php
2506
<?php $french = array( 'gccollab_stats:title' => "Statistiques de GCconnex", 'gccollab_stats:unknown' => "Inconnu", 'gccollab_stats:membercount' => "Membres inscrits", 'gccollab_stats:loading' => "Chargement des données...", 'gccollab_stats:registration:title' => "Inscription des membres", 'gccollab_stats:types:title' => "Types de membres", 'gccollab_stats:federal:title' => "Gouvernement fédéral", 'gccollab_stats:provincial:title' => "Provinciaux/territoriaux", 'gccollab_stats:student:title' => "Étudiants", 'gccollab_stats:academic:title' => "Universitaires", 'gccollab_stats:other:title' => "Autres", 'gccollab_stats:membertype' => "Type de membre", 'gccollab_stats:other' => "Autre membre", 'gccollab_stats:date' => "Date :", 'gccollab_stats:signups' => "Inscriptions :", 'gccollab_stats:total' => "Total :", 'gccollab_stats:users' => "utilisateurs", 'gccollab_stats:department' => "Département", 'gccollab_stats:province' => "Province / Territoire", 'gccollab_stats:wireposts:title' => "Messages sur le fil", 'gccollab_stats:wireposts:amount' => "Nombre de messages sur le fil", 'gccollab_stats:blogposts:title' => "Billets de blogue", 'gccollab_stats:blogposts:amount' => "Nombre de billets de blogue", 'gccollab_stats:comments:title' => "Commentaires", 'gccollab_stats:comments:amount' => "Nombre de commentaires", 'gccollab_stats:groups:label' => "Groupes :", 'gccollab_stats:groups:amount' => "Nombre de groupes", 'gccollab_stats:groupscreated:title' => "Groupes créés", 'gccollab_stats:groupscreated:amount' => "Nombre de groupes créés", 'gccollab_stats:groupsjoined:title' => "Groupes rejoints", 'gccollab_stats:groupsjoined:amount' => "Nombre de groupes rejoints", 'gccollab_stats:likes:title' => "Mentions « j\'aime »", 'gccollab_stats:likes:amount' => "Nombre de mentions « j\'aime »", 'gccollab_stats:messages:title' => "Messages", 'gccollab_stats:messages:amount' => "Nombre de messages", 'gccollab_stats:ministrymessage' => "Cliquez sur les colonnes pour afficher les ministères de la province ou du territoire", 'gccollab_stats:schoolmessage' => "Cliquez sur les colonnes pour afficher les différentes écoles", 'gccollab_stats:zoommessage' => "- Cliquez et glissez pour faire un zoom avant", 'gccollab_stats:pinchmessage' => "Pincer le graphique pour le zoomer", ); add_translation("fr", $french);
gpl-2.0
zzqcn/wireshark
epan/dissectors/asn1/ansi_map/packet-ansi_map-template.c
235856
/* packet-ansi_map.c * Routines for ANSI 41 Mobile Application Part (IS41 MAP) dissection * Specications from 3GPP2 (www.3gpp2.org) * Based on the dissector by : * Michael Lum <mlum [AT] telostech.com> * In association with Telos Technology Inc. * * Copyright 2005 - 2009, Anders Broman <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later * * Credit to Tomas Kukosa for developing the asn2wrs compiler. * * Title 3GPP2 Other * * Cellular Radiotelecommunications Intersystem Operations * 3GPP2 N.S0005-0 v 1.0 ANSI/TIA/EIA-41-D * * Network Support for MDN-Based Message Centers * 3GPP2 N.S0024-0 v1.0 IS-841 * * Enhanced International Calling * 3GPP2 N.S0027 IS-875 * * ANSI-41-D Miscellaneous Enhancements Revision 0 * 3GPP2 N.S0015 PN-3590 (ANSI-41-E) * * Authentication Enhancements * 3GPP2 N.S0014-0 v1.0 IS-778 * * Features In CDMA * 3GPP2 N.S0010-0 v1.0 IS-735 * * OTASP and OTAPA * 3GPP2 N.S0011-0 v1.0 IS-725-A * * Circuit Mode Services * 3GPP2 N.S0008-0 v1.0 IS-737 * XXX SecondInterMSCCircuitID not implemented, parameter ID conflicts with ISLP Information! * * IMSI * 3GPP2 N.S0009-0 v1.0 IS-751 * * WIN Phase 1 * 3GPP2 N.S0013-0 v1.0 IS-771 * * DCCH (Clarification of Audit Order with Forced * Re-Registration in pre-TIA/EIA-136-A Implementation * 3GPP2 A.S0017-B IS-730 * * UIM * 3GPP2 N.S0003 * * WIN Phase 2 * 3GPP2 N.S0004-0 v1.0 IS-848 * * TIA/EIA-41-D Pre-Paid Charging * 3GPP2 N.S0018-0 v1.0 IS-826 * * User Selective Call Forwarding * 3GPP2 N.S0021-0 v1.0 IS-838 * * * Answer Hold * 3GPP2 N.S0022-0 v1.0 IS-837 * */ #include "config.h" #include <epan/packet.h> #include <epan/prefs.h> #include <epan/expert.h> #include <epan/tap.h> #include <epan/stat_tap_ui.h> #include <epan/asn1.h> #include "packet-ber.h" #include "packet-ansi_map.h" #include "packet-ansi_a.h" #include "packet-gsm_map.h" #include "packet-tcap.h" #include "packet-ansi_tcap.h" #define PNAME "ANSI Mobile Application Part" #define PSNAME "ANSI MAP" #define PFNAME "ansi_map" void proto_register_ansi_map(void); void proto_reg_handoff_ansi_map(void); /* Preference settings */ #define MAX_SSN 254 static range_t *global_ssn_range; #define ANSI_MAP_TID_ONLY 0 #define ANSI_MAP_TID_AND_SOURCE 1 #define ANSI_MAP_TID_SOURCE_AND_DEST 2 static gint ansi_map_response_matching_type = ANSI_MAP_TID_AND_SOURCE; static dissector_handle_t ansi_map_handle=NULL; /* Initialize the protocol and registered fields */ static int ansi_map_tap = -1; static int proto_ansi_map = -1; static int hf_ansi_map_op_code_fam = -1; static int hf_ansi_map_op_code = -1; static int hf_ansi_map_reservedBitH = -1; static int hf_ansi_map_reservedBitHG = -1; static int hf_ansi_map_reservedBitHGFE = -1; static int hf_ansi_map_reservedBitFED = -1; static int hf_ansi_map_reservedBitD = -1; static int hf_ansi_map_reservedBitED = -1; static int hf_ansi_map_type_of_digits = -1; static int hf_ansi_map_na = -1; static int hf_ansi_map_pi = -1; static int hf_ansi_map_navail = -1; static int hf_ansi_map_si = -1; static int hf_ansi_map_digits_enc = -1; static int hf_ansi_map_np = -1; static int hf_ansi_map_nr_digits = -1; static int hf_ansi_map_bcd_digits = -1; static int hf_ansi_map_ia5_digits = -1; static int hf_ansi_map_subaddr_type = -1; static int hf_ansi_map_subaddr_odd_even = -1; static int hf_ansi_alertcode_cadence = -1; static int hf_ansi_alertcode_pitch = -1; static int hf_ansi_alertcode_alertaction = -1; static int hf_ansi_map_announcementcode_tone = -1; static int hf_ansi_map_announcementcode_class = -1; static int hf_ansi_map_announcementcode_std_ann = -1; static int hf_ansi_map_announcementcode_cust_ann = -1; static int hf_ansi_map_authorizationperiod_period = -1; static int hf_ansi_map_value = -1; static int hf_ansi_map_msc_type = -1; static int hf_ansi_map_handoffstate_pi = -1; static int hf_ansi_map_tgn = -1; static int hf_ansi_map_tmn = -1; static int hf_ansi_map_messagewaitingnotificationcount_tom = -1; static int hf_ansi_map_messagewaitingnotificationcount_no_mw = -1; static int hf_ansi_map_messagewaitingnotificationtype_mwi = -1; static int hf_ansi_map_messagewaitingnotificationtype_apt = -1; static int hf_ansi_map_messagewaitingnotificationtype_pt = -1; static int hf_ansi_map_trans_cap_prof = -1; static int hf_ansi_map_trans_cap_busy = -1; static int hf_ansi_map_trans_cap_ann = -1; static int hf_ansi_map_trans_cap_rui = -1; static int hf_ansi_map_trans_cap_spini = -1; static int hf_ansi_map_trans_cap_uzci = -1; static int hf_ansi_map_trans_cap_ndss = -1; static int hf_ansi_map_trans_cap_nami = -1; static int hf_ansi_trans_cap_multerm = -1; static int hf_ansi_map_terminationtriggers_busy = -1; static int hf_ansi_map_terminationtriggers_rf = -1; static int hf_ansi_map_terminationtriggers_npr = -1; static int hf_ansi_map_terminationtriggers_na = -1; static int hf_ansi_map_terminationtriggers_nr = -1; static int hf_ansi_trans_cap_tl = -1; static int hf_ansi_map_cdmaserviceoption = -1; static int hf_ansi_trans_cap_waddr = -1; static int hf_ansi_map_MarketID = -1; static int hf_ansi_map_swno = -1; static int hf_ansi_map_idno = -1; static int hf_ansi_map_segcount = -1; static int hf_ansi_map_sms_originationrestrictions_fmc = -1; static int hf_ansi_map_sms_originationrestrictions_direct = -1; static int hf_ansi_map_sms_originationrestrictions_default = -1; static int hf_ansi_map_systemcapabilities_auth = -1; static int hf_ansi_map_systemcapabilities_se = -1; static int hf_ansi_map_systemcapabilities_vp = -1; static int hf_ansi_map_systemcapabilities_cave = -1; static int hf_ansi_map_systemcapabilities_ssd = -1; static int hf_ansi_map_systemcapabilities_dp = -1; static int hf_ansi_map_mslocation_lat = -1; static int hf_ansi_map_mslocation_long = -1; static int hf_ansi_map_mslocation_res = -1; static int hf_ansi_map_nampscallmode_namps = -1; static int hf_ansi_map_nampscallmode_amps = -1; static int hf_ansi_map_nampschanneldata_navca = -1; static int hf_ansi_map_nampschanneldata_CCIndicator = -1; static int hf_ansi_map_callingfeaturesindicator_cfufa = -1; static int hf_ansi_map_callingfeaturesindicator_cfbfa = -1; static int hf_ansi_map_callingfeaturesindicator_cfnafa = -1; static int hf_ansi_map_callingfeaturesindicator_cwfa = -1; static int hf_ansi_map_callingfeaturesindicator_3wcfa = -1; static int hf_ansi_map_callingfeaturesindicator_pcwfa =-1; static int hf_ansi_map_callingfeaturesindicator_dpfa = -1; static int hf_ansi_map_callingfeaturesindicator_ahfa = -1; static int hf_ansi_map_callingfeaturesindicator_uscfvmfa = -1; static int hf_ansi_map_callingfeaturesindicator_uscfmsfa = -1; static int hf_ansi_map_callingfeaturesindicator_uscfnrfa = -1; static int hf_ansi_map_callingfeaturesindicator_cpdsfa = -1; static int hf_ansi_map_callingfeaturesindicator_ccsfa = -1; static int hf_ansi_map_callingfeaturesindicator_epefa = -1; static int hf_ansi_map_callingfeaturesindicator_cdfa = -1; static int hf_ansi_map_callingfeaturesindicator_vpfa = -1; static int hf_ansi_map_callingfeaturesindicator_ctfa = -1; static int hf_ansi_map_callingfeaturesindicator_cnip1fa = -1; static int hf_ansi_map_callingfeaturesindicator_cnip2fa = -1; static int hf_ansi_map_callingfeaturesindicator_cnirfa = -1; static int hf_ansi_map_callingfeaturesindicator_cniroverfa = -1; static int hf_ansi_map_cdmacallmode_cdma = -1; static int hf_ansi_map_cdmacallmode_amps = -1; static int hf_ansi_map_cdmacallmode_namps = -1; static int hf_ansi_map_cdmacallmode_cls1 = -1; static int hf_ansi_map_cdmacallmode_cls2 = -1; static int hf_ansi_map_cdmacallmode_cls3 = -1; static int hf_ansi_map_cdmacallmode_cls4 = -1; static int hf_ansi_map_cdmacallmode_cls5 = -1; static int hf_ansi_map_cdmacallmode_cls6 = -1; static int hf_ansi_map_cdmacallmode_cls7 = -1; static int hf_ansi_map_cdmacallmode_cls8 = -1; static int hf_ansi_map_cdmacallmode_cls9 = -1; static int hf_ansi_map_cdmacallmode_cls10 = -1; static int hf_ansi_map_cdmachanneldata_Frame_Offset = -1; static int hf_ansi_map_cdmachanneldata_CDMA_ch_no = -1; static int hf_ansi_map_cdmachanneldata_band_cls = -1; static int hf_ansi_map_cdmachanneldata_lc_mask_b6 = -1; static int hf_ansi_map_cdmachanneldata_lc_mask_b5 = -1; static int hf_ansi_map_cdmachanneldata_lc_mask_b4 = -1; static int hf_ansi_map_cdmachanneldata_lc_mask_b3 = -1; static int hf_ansi_map_cdmachanneldata_lc_mask_b2 = -1; static int hf_ansi_map_cdmachanneldata_lc_mask_b1 = -1; static int hf_ansi_map_cdmachanneldata_np_ext = -1; static int hf_ansi_map_cdmachanneldata_nominal_pwr = -1; static int hf_ansi_map_cdmachanneldata_nr_preamble = -1; static int hf_ansi_map_cdmastationclassmark_pc = -1; static int hf_ansi_map_cdmastationclassmark_dtx = -1; static int hf_ansi_map_cdmastationclassmark_smi = -1; static int hf_ansi_map_cdmastationclassmark_dmi = -1; static int hf_ansi_map_channeldata_vmac = -1; static int hf_ansi_map_channeldata_dtx = -1; static int hf_ansi_map_channeldata_scc = -1; static int hf_ansi_map_channeldata_chno = -1; static int hf_ansi_map_ConfidentialityModes_vp = -1; static int hf_ansi_map_controlchanneldata_dcc = -1; static int hf_ansi_map_controlchanneldata_cmac = -1; static int hf_ansi_map_controlchanneldata_chno = -1; static int hf_ansi_map_controlchanneldata_sdcc1 = -1; static int hf_ansi_map_controlchanneldata_sdcc2 = -1; static int hf_ansi_map_ConfidentialityModes_se = -1; static int hf_ansi_map_deniedauthorizationperiod_period = -1; static int hf_ansi_map_ConfidentialityModes_dp = -1; static int hf_ansi_map_originationtriggers_all = -1; static int hf_ansi_map_originationtriggers_local = -1; static int hf_ansi_map_originationtriggers_ilata = -1; static int hf_ansi_map_originationtriggers_olata = -1; static int hf_ansi_map_originationtriggers_int = -1; static int hf_ansi_map_originationtriggers_wz = -1; static int hf_ansi_map_originationtriggers_unrec = -1; static int hf_ansi_map_originationtriggers_rvtc = -1; static int hf_ansi_map_originationtriggers_star = -1; static int hf_ansi_map_originationtriggers_ds = -1; static int hf_ansi_map_originationtriggers_pound = -1; static int hf_ansi_map_originationtriggers_dp = -1; static int hf_ansi_map_originationtriggers_pa = -1; static int hf_ansi_map_originationtriggers_nodig = -1; static int hf_ansi_map_originationtriggers_onedig = -1; static int hf_ansi_map_originationtriggers_twodig = -1; static int hf_ansi_map_originationtriggers_threedig = -1; static int hf_ansi_map_originationtriggers_fourdig = -1; static int hf_ansi_map_originationtriggers_fivedig = -1; static int hf_ansi_map_originationtriggers_sixdig = -1; static int hf_ansi_map_originationtriggers_sevendig = -1; static int hf_ansi_map_originationtriggers_eightdig = -1; static int hf_ansi_map_originationtriggers_ninedig = -1; static int hf_ansi_map_originationtriggers_tendig = -1; static int hf_ansi_map_originationtriggers_elevendig = -1; static int hf_ansi_map_originationtriggers_twelvedig = -1; static int hf_ansi_map_originationtriggers_thirteendig = -1; static int hf_ansi_map_originationtriggers_fourteendig = -1; static int hf_ansi_map_originationtriggers_fifteendig = -1; static int hf_ansi_map_triggercapability_init = -1; static int hf_ansi_map_triggercapability_kdigit = -1; static int hf_ansi_map_triggercapability_all = -1; static int hf_ansi_map_triggercapability_rvtc = -1; static int hf_ansi_map_triggercapability_oaa = -1; static int hf_ansi_map_triggercapability_oans = -1; static int hf_ansi_map_triggercapability_odisc = -1; static int hf_ansi_map_triggercapability_ona = -1; static int hf_ansi_map_triggercapability_ct = -1; static int hf_ansi_map_triggercapability_unrec =-1; static int hf_ansi_map_triggercapability_pa = -1; static int hf_ansi_map_triggercapability_at = -1; static int hf_ansi_map_triggercapability_cgraa = -1; static int hf_ansi_map_triggercapability_it = -1; static int hf_ansi_map_triggercapability_cdraa = -1; static int hf_ansi_map_triggercapability_obsy = -1; static int hf_ansi_map_triggercapability_tra = -1; static int hf_ansi_map_triggercapability_tbusy = -1; static int hf_ansi_map_triggercapability_tna = -1; static int hf_ansi_map_triggercapability_tans = -1; static int hf_ansi_map_triggercapability_tdisc = -1; static int hf_ansi_map_winoperationscapability_conn = -1; static int hf_ansi_map_winoperationscapability_ccdir = -1; static int hf_ansi_map_winoperationscapability_pos = -1; static int hf_ansi_map_PACA_Level = -1; static int hf_ansi_map_pacaindicator_pa = -1; static int hf_ansi_map_point_code = -1; static int hf_ansi_map_SSN = -1; static int hf_ansi_map_win_trigger_list = -1; #include "packet-ansi_map-hf.c" /* Initialize the subtree pointers */ static gint ett_ansi_map = -1; static gint ett_mintype = -1; static gint ett_digitstype = -1; static gint ett_billingid = -1; static gint ett_sms_bearer_data = -1; static gint ett_sms_teleserviceIdentifier = -1; static gint ett_extendedmscid = -1; static gint ett_extendedsystemmytypecode = -1; static gint ett_handoffstate = -1; static gint ett_mscid = -1; static gint ett_cdmachanneldata = -1; static gint ett_cdmastationclassmark = -1; static gint ett_channeldata = -1; static gint ett_confidentialitymodes = -1; static gint ett_controlchanneldata = -1; static gint ett_CDMA2000HandoffInvokeIOSData = -1; static gint ett_CDMA2000HandoffResponseIOSData = -1; static gint ett_originationtriggers = -1; static gint ett_pacaindicator = -1; static gint ett_callingpartyname = -1; static gint ett_triggercapability = -1; static gint ett_winoperationscapability = -1; static gint ett_win_trigger_list = -1; static gint ett_controlnetworkid = -1; static gint ett_transactioncapability = -1; static gint ett_cdmaserviceoption = -1; static gint ett_systemcapabilities = -1; static gint ett_sms_originationrestrictions = -1; #include "packet-ansi_map-ett.c" static expert_field ei_ansi_map_nr_not_used = EI_INIT; static expert_field ei_ansi_map_unknown_invokeData_blob = EI_INIT; static expert_field ei_ansi_map_no_data = EI_INIT; /* Global variables */ static dissector_table_t is637_tele_id_dissector_table; /* IS-637 Teleservice ID */ static dissector_table_t is683_dissector_table; /* IS-683-A (OTA) */ static dissector_table_t is801_dissector_table; /* IS-801 (PLD) */ static packet_info *g_pinfo; static proto_tree *g_tree; tvbuff_t *SMS_BearerData_tvb = NULL; gint32 ansi_map_sms_tele_id = -1; static gboolean is683_ota; static gboolean is801_pld; static gboolean ansi_map_is_invoke; static guint32 OperationCode; static guint8 ServiceIndicator; struct ansi_map_invokedata_t { guint32 opcode; guint8 ServiceIndicator; }; static void dissect_ansi_map_win_trigger_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_); /* Transaction table */ static wmem_map_t *TransactionId_table=NULL; /* Store Invoke information needed for the corresponding reply */ static void update_saved_invokedata(packet_info *pinfo, struct ansi_tcap_private_t *p_private_tcap){ struct ansi_map_invokedata_t *ansi_map_saved_invokedata; address* src = &(pinfo->src); address* dst = &(pinfo->dst); guint8 *src_str; guint8 *dst_str; const char *buf = NULL; src_str = address_to_str(wmem_packet_scope(), src); dst_str = address_to_str(wmem_packet_scope(), dst); /* Data from the TCAP dissector */ if ((!pinfo->fd->visited)&&(p_private_tcap->TransactionID_str)){ /* Only do this once XXX I hope it's the right thing to do */ /* The hash string needs to contain src and dest to distiguish differnt flows */ switch(ansi_map_response_matching_type){ case ANSI_MAP_TID_ONLY: buf = wmem_strdup(wmem_packet_scope(), p_private_tcap->TransactionID_str); break; case ANSI_MAP_TID_AND_SOURCE: buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s",p_private_tcap->TransactionID_str,src_str); break; case ANSI_MAP_TID_SOURCE_AND_DEST: default: buf = wmem_strdup_printf(wmem_packet_scope(), "%s%s%s",p_private_tcap->TransactionID_str,src_str,dst_str); break; } /* If the entry allready exists don't owervrite it */ ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)wmem_map_lookup(TransactionId_table,buf); if(ansi_map_saved_invokedata) return; ansi_map_saved_invokedata = wmem_new(wmem_file_scope(), struct ansi_map_invokedata_t); ansi_map_saved_invokedata->opcode = p_private_tcap->d.OperationCode_private; ansi_map_saved_invokedata->ServiceIndicator = ServiceIndicator; wmem_map_insert(TransactionId_table, wmem_strdup(wmem_file_scope(), buf), ansi_map_saved_invokedata); /*g_warning("Invoke Hash string %s pkt: %u",buf,pinfo->num);*/ } } /* value strings */ const value_string ansi_map_opr_code_strings[] = { { 1, "Handoff Measurement Request" }, { 2, "Facilities Directive" }, { 3, "Mobile On Channel" }, { 4, "Handoff Back" }, { 5, "Facilities Release" }, { 6, "Qualification Request" }, { 7, "Qualification Directive" }, { 8, "Blocking" }, { 9, "Unblocking" }, { 10, "Reset Circuit" }, { 11, "Trunk Test" }, { 12, "Trunk Test Disconnect" }, { 13, "Registration Notification" }, { 14, "Registration Cancellation" }, { 15, "Location Request" }, { 16, "Routing Request" }, { 17, "Feature Request" }, { 18, "Reserved 18 (Service Profile Request, IS-41-C)" }, { 19, "Reserved 19 (Service Profile Directive, IS-41-C)" }, { 20, "Unreliable Roamer Data Directive" }, { 21, "Reserved 21 (Call Data Request, IS-41-C)" }, { 22, "MS Inactive" }, { 23, "Transfer To Number Request" }, { 24, "Redirection Request" }, { 25, "Handoff To Third" }, { 26, "Flash Request" }, { 27, "Authentication Directive" }, { 28, "Authentication Request" }, { 29, "Base Station Challenge" }, { 30, "Authentication Failure Report" }, { 31, "Count Request" }, { 32, "Inter System Page" }, { 33, "Unsolicited Response" }, { 34, "Bulk Deregistration" }, { 35, "Handoff Measurement Request 2" }, { 36, "Facilities Directive 2" }, { 37, "Handoff Back 2" }, { 38, "Handoff To Third 2" }, { 39, "Authentication Directive Forward" }, { 40, "Authentication Status Report" }, { 41, "Reserved 41" }, { 42, "Information Directive" }, { 43, "Information Forward" }, { 44, "Inter System Answer" }, { 45, "Inter System Page 2" }, { 46, "Inter System Setup" }, { 47, "Origination Request" }, { 48, "Random Variable Request" }, { 49, "Redirection Directive" }, { 50, "Remote User Interaction Directive" }, { 51, "SMS Delivery Backward" }, { 52, "SMS Delivery Forward" }, { 53, "SMS Delivery Point to Point" }, { 54, "SMS Notification" }, { 55, "SMS Request" }, { 56, "OTASP Request" }, { 57, "Information Backward" }, { 58, "Change Facilities" }, { 59, "Change Service" }, { 60, "Parameter Request" }, { 61, "TMSI Directive" }, { 62, "NumberPortabilityRequest" }, { 63, "Service Request" }, { 64, "Analyzed Information Request" }, { 65, "Connection Failure Report" }, { 66, "Connect Resource" }, { 67, "Disconnect Resource" }, { 68, "Facility Selected and Available" }, { 69, "Instruction Request" }, { 70, "Modify" }, { 71, "Reset Timer" }, { 72, "Search" }, { 73, "Seize Resource" }, { 74, "SRF Directive" }, { 75, "T Busy" }, { 76, "T NoAnswer" }, { 77, "Release" }, { 78, "SMS Delivery Point to Point Ack" }, { 79, "Message Directive" }, { 80, "Bulk Disconnection" }, { 81, "Call Control Directive" }, { 82, "O Answer" }, { 83, "O Disconnect" }, { 84, "Call Recovery Report" }, { 85, "T Answer" }, { 86, "T Disconnect" }, { 87, "Unreliable Call Data" }, { 88, "O CalledPartyBusy" }, { 89, "O NoAnswer" }, { 90, "Position Request" }, { 91, "Position Request Forward" }, { 92, "Call Termination Report" }, { 93, "Geo Position Directive" }, { 94, "Geo Position Request" }, { 95, "Inter System Position Request" }, { 96, "Inter System Position Request Forward" }, { 97, "ACG Directive" }, { 98, "Roamer Database Verification Request" }, { 99, "Add Service" }, { 100, "Drop Service" }, { 101, "InterSystemSMSPage" }, { 102, "LCSParameterRequest" }, { 103, "Unknown ANSI-MAP PDU" }, { 104, "Unknown ANSI-MAP PDU" }, { 105, "Unknown ANSI-MAP PDU" }, { 106, "PositionEventNotification" }, { 107, "Unknown ANSI-MAP PDU" }, { 108, "Unknown ANSI-MAP PDU" }, { 109, "Unknown ANSI-MAP PDU" }, { 110, "Unknown ANSI-MAP PDU" }, { 111, "InterSystemSMSDelivery-PointToPoint" }, { 112, "QualificationRequest2" }, { 0, NULL }, }; static value_string_ext ansi_map_opr_code_strings_ext = VALUE_STRING_EXT_INIT(ansi_map_opr_code_strings); static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx); static int dissect_returnData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx); static int dissect_ansi_map_SystemMyTypeCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_); /* Type of Digits (octet 1, bits A-H) */ static const value_string ansi_map_type_of_digits_vals[] = { { 0, "Not Used" }, { 1, "Dialed Number or Called Party Number" }, { 2, "Calling Party Number" }, { 3, "Caller Interaction" }, { 4, "Routing Number" }, { 5, "Billing Number" }, { 6, "Destination Number" }, { 7, "LATA" }, { 8, "Carrier" }, { 0, NULL } }; /* Nature of Number (octet 2, bits A-H )*/ static const true_false_string ansi_map_na_bool_val = { "International", "National" }; static const true_false_string ansi_map_pi_bool_val = { "Presentation Restricted", "Presentation Allowed" }; static const true_false_string ansi_map_navail_bool_val = { "Number is not available", "Number is available" }; #if 0 static const true_false_string ansi_map_si_bool_val = { "User provided, screening passed", "User provided, not screened" }; #endif static const value_string ansi_map_si_vals[] = { { 0, "User provided, not screened"}, { 1, "User provided, screening passed"}, { 2, "User provided, screening failed"}, { 3, "Network provided"}, { 0, NULL } }; /* Encoding (octet 3, bits A-D) */ static const value_string ansi_map_digits_enc_vals[] = { { 0, "Not used"}, { 1, "BCD"}, { 2, "IA5"}, { 3, "Octet string"}, { 0, NULL } }; /* Numbering Plan (octet 3, bits E-H) */ static const value_string ansi_map_np_vals[] = { { 0, "Unknown or not applicable"}, { 1, "ISDN Numbering"}, { 2, "Telephony Numbering (ITU-T Rec. E.164,E.163)"}, { 3, "Data Numbering (ITU-T Rec. X.121)"}, { 4, "Telex Numbering (ITU-T Rec. F.69)"}, { 5, "Maritime Mobile Numbering"}, { 6, "Land Mobile Numbering (ITU-T Rec. E.212)"}, { 7, "Private Numbering Plan"}, { 13, "SS7 Point Code (PC) and Subsystem Number (SSN)"}, { 14, "Internet Protocol (IP) Address."}, { 15, "Reserved for extension"}, { 0, NULL } }; static void dissect_ansi_map_min_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ char *digit_str; int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_mintype); proto_tree_add_item_ret_display_string(subtree, hf_ansi_map_bcd_digits, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_BCD_DIGITS_0_9, wmem_packet_scope(), &digit_str); proto_item_append_text(actx->created_item, " - %s", digit_str); } static void dissect_ansi_map_digits_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ guint8 octet , octet_len; guint8 b1,b2,b3,b4; int offset = 0; char *digit_str; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_digitstype); /* Octet 1 */ proto_tree_add_item(subtree, hf_ansi_map_type_of_digits, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Octet 2 */ proto_tree_add_item(subtree, hf_ansi_map_reservedBitHG, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_si, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_reservedBitD, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_navail, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_pi, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_na, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Octet 3 */ octet = tvb_get_guint8(tvb,offset); proto_tree_add_item(subtree, hf_ansi_map_np, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_digits_enc, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Octet 4 - */ switch(octet>>4){ case 0:/* Unknown or not applicable */ switch ((octet&0xf)){ case 1: /* BCD Coding */ octet_len = tvb_get_guint8(tvb,offset); proto_tree_add_item(subtree, hf_ansi_map_nr_digits, tvb, offset, 1, ENC_BIG_ENDIAN); if(octet_len == 0) return; offset++; proto_tree_add_item_ret_display_string(subtree, hf_ansi_map_bcd_digits, tvb, offset, -1, ENC_KEYPAD_BC_TBCD, wmem_packet_scope(), &digit_str); proto_item_append_text(actx->created_item, " - %s", digit_str); break; case 2: { const guint8* digits; /* IA5 Coding */ octet_len = tvb_get_guint8(tvb,offset); proto_tree_add_item(subtree, hf_ansi_map_nr_digits, tvb, offset, 1, ENC_BIG_ENDIAN); if(octet_len == 0) return; offset++; proto_tree_add_item_ret_string(subtree, hf_ansi_map_ia5_digits, tvb, offset, tvb_reported_length_remaining(tvb,offset), ENC_ASCII|ENC_NA, wmem_packet_scope(), &digits); proto_item_append_text(actx->created_item, " - %s", digits); } break; case 3: /* Octet string */ break; default: break; } break; case 1:/* ISDN Numbering (not used in this Standard). */ case 3:/* Data Numbering (ITU-T Rec. X.121) (not used in this Standard). */ case 4:/* Telex Numbering (ITU-T Rec. F.69) (not used in this Standard). */ case 5:/* Maritime Mobile Numbering (not used in this Standard). */ proto_tree_add_expert(subtree, pinfo, &ei_ansi_map_nr_not_used, tvb, offset, -1); break; case 2:/* Telephony Numbering (ITU-T Rec. E.164,E.163). */ case 6:/* Land Mobile Numbering (ITU-T Rec. E.212) */ case 7:/* Private Numbering Plan */ octet_len = tvb_get_guint8(tvb,offset); proto_tree_add_item(subtree, hf_ansi_map_nr_digits, tvb, offset, 1, ENC_BIG_ENDIAN); if(octet_len == 0) return; offset++; switch ((octet&0xf)){ case 1: /* BCD Coding */ proto_tree_add_item_ret_display_string(subtree, hf_ansi_map_bcd_digits, tvb, offset, -1, ENC_KEYPAD_BC_TBCD, wmem_packet_scope(), &digit_str); proto_item_append_text(actx->created_item, " - %s", digit_str); break; case 2: { const guint8* digits; /* IA5 Coding */ proto_tree_add_item_ret_string(subtree, hf_ansi_map_ia5_digits, tvb, offset, tvb_reported_length_remaining(tvb,offset), ENC_ASCII|ENC_NA, wmem_packet_scope(), &digits); proto_item_append_text(actx->created_item, " - %s", digits); } break; case 3: /* Octet string */ break; default: break; } break; case 13:/* ANSI SS7 Point Code (PC) and Subsystem Number (SSN). */ switch ((octet&0xf)){ case 3: /* Octet string */ /* Point Code Member Number octet 2 */ b1 = tvb_get_guint8(tvb,offset); offset++; /* Point Code Cluster Number octet 3 */ b2 = tvb_get_guint8(tvb,offset); offset++; /* Point Code Network Number octet 4 */ b3 = tvb_get_guint8(tvb,offset); offset++; proto_tree_add_bytes_format_value(subtree, hf_ansi_map_point_code, tvb, offset-3, 3, NULL, "%u-%u-%u", b3, b2, b1); /* Subsystem Number (SSN) octet 5 */ b4 = tvb_get_guint8(tvb,offset); proto_tree_add_item(subtree, hf_ansi_map_SSN, tvb, offset, 1, ENC_NA); proto_item_append_text(actx->created_item, " - Point Code %u-%u-%u SSN %u", b3, b2, b1, b4); break; default: break; } break; case 14:/* Internet Protocol (IP) Address. */ break; default: proto_tree_add_expert(subtree, pinfo, &ei_ansi_map_nr_not_used, tvb, offset, -1); break; } } /* 6.5.3.13. Subaddress */ #if 0 static const true_false_string ansi_map_Odd_Even_Ind_bool_val = { "Odd", "Even" }; #endif /* Type of Subaddress (octet 1, bits E-G) */ static const value_string ansi_map_sub_addr_type_vals[] = { { 0, "NSAP (CCITT Rec. X.213 or ISO 8348 AD2)"}, { 1, "User specified"}, { 2, "Reserved"}, { 3, "Reserved"}, { 4, "Reserved"}, { 5, "Reserved"}, { 6, "Reserved"}, { 7, "Reserved"}, { 0, NULL } }; static void dissect_ansi_map_subaddress(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); /* Type of Subaddress (octet 1, bits E-G) */ proto_tree_add_item(subtree, hf_ansi_map_subaddr_type, tvb, offset, 1, ENC_BIG_ENDIAN); /* Odd/Even Indicator (O/E) (octet 1, bit D) */ proto_tree_add_item(subtree, hf_ansi_map_subaddr_odd_even, tvb, offset, 1, ENC_BIG_ENDIAN); } /* * 6.5.2.2 ActionCode * Table 114 ActionCode value * * 6.5.2.2 ActionCode(TIA/EIA-41.5-D, page 5-129) */ static const value_string ansi_map_ActionCode_vals[] = { { 0, "Not used"}, { 1, "Continue processing"}, { 2, "Disconnect call"}, { 3, "Disconnect call leg"}, { 4, "Conference Calling Drop Last Party"}, { 5, "Bridge call leg(s) to conference call"}, { 6, "Drop call leg on busy or routing failure"}, { 7, "Disconnect all call legs"}, { 8, "Attach MSC to OTAF"}, { 9, "Initiate RegistrationNotification"}, { 10, "Generate Public Encryption values"}, { 11, "Generate A-key"}, { 12, "Perform SSD Update procedure"}, { 13, "Perform Re-authentication procedure"}, { 14, "Release TRN"}, { 15, "Commit A-key"}, { 16, "Release Resources (e.g., A-key, Traffic Channel)"}, { 17, "Record NEWMSID"}, { 18, "Allocate Resources (e.g., Multiple message traffic channel delivery)."}, { 19, "Generate Authentication Signature"}, { 20, "Release leg and redirect subscriber"}, { 21, "Do Not Wait For MS User Level Response"}, { 22, "Prepare for CDMA Handset-Based Position Determination"}, { 23, "CDMA Handset-Based Position Determination Complete"}, { 0, NULL } }; static value_string_ext ansi_map_ActionCode_vals_ext = VALUE_STRING_EXT_INIT(ansi_map_ActionCode_vals); /* 6.5.2.3 AlertCode */ /* Pitch (octet 1, bits G-H) */ static const value_string ansi_map_AlertCode_Pitch_vals[] = { { 0, "Medium pitch"}, { 1, "High pitch"}, { 2, "Low pitch"}, { 3, "Reserved"}, { 0, NULL } }; /* Cadence (octet 1, bits A-F) */ static const value_string ansi_map_AlertCode_Cadence_vals[] = { { 0, "NoTone"}, { 1, "Long"}, { 2, "ShortShort"}, { 3, "ShortShortLong"}, { 4, "ShortShort2"}, { 5, "ShortLongShort"}, { 6, "ShortShortShortShort"}, { 7, "PBXLong"}, { 8, "PBXShortShort"}, { 9, "PBXShortShortLong"}, { 10, "PBXShortLongShort"}, { 11, "PBXShortShortShortShort"}, { 12, "PipPipPipPip"}, { 13, "Reserved. Treat the same as value 0, NoTone"}, { 14, "Reserved. Treat the same as value 0, NoTone"}, { 15, "Reserved. Treat the same as value 0, NoTone"}, { 16, "Reserved. Treat the same as value 0, NoTone"}, { 17, "Reserved. Treat the same as value 0, NoTone"}, { 18, "Reserved. Treat the same as value 0, NoTone"}, { 19, "Reserved. Treat the same as value 0, NoTone"}, { 0, NULL } }; /* Alert Action (octet 2, bits A-C) */ static const value_string ansi_map_AlertCode_Alert_Action_vals[] = { { 0, "Alert without waiting to report"}, { 1, "Apply a reminder alert once"}, { 2, "Other values reserved. Treat the same as value 0, Alert without waiting to report"}, { 3, "Other values reserved. Treat the same as value 0, Alert without waiting to report"}, { 4, "Other values reserved. Treat the same as value 0, Alert without waiting to report"}, { 5, "Other values reserved. Treat the same as value 0, Alert without waiting to report"}, { 6, "Other values reserved. Treat the same as value 0, Alert without waiting to report"}, { 7, "Other values reserved. Treat the same as value 0, Alert without waiting to report"}, { 0, NULL } }; static void dissect_ansi_map_alertcode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); /* Pitch (octet 1, bits G-H) */ proto_tree_add_item(subtree, hf_ansi_alertcode_pitch, tvb, offset, 1, ENC_BIG_ENDIAN); /* Cadence (octet 1, bits A-F) */ proto_tree_add_item(subtree, hf_ansi_alertcode_cadence, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Alert Action (octet 2, bits A-C) */ proto_tree_add_item(subtree, hf_ansi_alertcode_alertaction, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.4 AlertResult */ /* Result (octet 1) */ static const value_string ansi_map_AlertResult_result_vals[] = { { 0, "Not specified"}, { 1, "Success"}, { 2, "Failure"}, { 3, "Denied"}, { 4, "NotAttempted"}, { 5, "NoPageResponse"}, { 6, "Busy"}, { 0, NULL } }; /* 6.5.2.5 AnnouncementCode Updatef from NS0018Re*/ /* Tone (octet 1) */ static const value_string ansi_map_AnnouncementCode_tone_vals[] = { { 0, "DialTone"}, { 1, "RingBack or AudibleAlerting"}, { 2, "InterceptTone or MobileReorder"}, { 3, "CongestionTone or ReorderTone"}, { 4, "BusyTone"}, { 5, "ConfirmationTone"}, { 6, "AnswerTone"}, { 7, "CallWaitingTone"}, { 8, "OffHookTone"}, { 17, "RecallDialTone"}, { 18, "BargeInTone"}, { 20, "PPCInsufficientTone"}, { 21, "PPCWarningTone1"}, { 22, "PPCWarningTone2"}, { 23, "PPCWarningTone3"}, { 24, "PPCDisconnectTone"}, { 25, "PPCRedirectTone"}, { 63, "TonesOff"}, { 192, "PipTone"}, { 193, "AbbreviatedIntercept"}, { 194, "AbbreviatedCongestion"}, { 195, "WarningTone"}, { 196, "DenialToneBurst"}, { 197, "DialToneBurst"}, { 250, "IncomingAdditionalCallTone"}, { 251, "PriorityAdditionalCallTone"}, { 0, NULL } }; /* Class (octet 2, bits A-D) */ static const value_string ansi_map_AnnouncementCode_class_vals[] = { { 0, "Concurrent"}, { 1, "Sequential"}, { 0, NULL } }; /* Standard Announcement (octet 3) Updated with N.S0015 */ static const value_string ansi_map_AnnouncementCode_std_ann_vals[] = { { 0, "None"}, { 1, "UnauthorizedUser"}, { 2, "InvalidESN"}, { 3, "UnauthorizedMobile"}, { 4, "SuspendedOrigination"}, { 5, "OriginationDenied"}, { 6, "ServiceAreaDenial"}, { 16, "PartialDial"}, { 17, "Require1Plus"}, { 18, "Require1PlusNPA"}, { 19, "Require0Plus"}, { 20, "Require0PlusNPA"}, { 21, "Deny1Plus"}, { 22, "Unsupported10plus"}, { 23, "Deny10plus"}, { 24, "Unsupported10XXX"}, { 25, "Deny10XXX"}, { 26, "Deny10XXXLocally"}, { 27, "Require10Plus"}, { 28, "RequireNPA"}, { 29, "DenyTollOrigination"}, { 30, "DenyInternationalOrigination"}, { 31, "Deny0Minus"}, { 48, "DenyNumber"}, { 49, "AlternateOperatorServices"}, { 64, "No Circuit or AllCircuitsBusy or FacilityProblem"}, { 65, "Overload"}, { 66, "InternalOfficeFailure"}, { 67, "NoWinkReceived"}, { 68, "InterofficeLinkFailure"}, { 69, "Vacant"}, { 70, "InvalidPrefix or InvalidAccessCode"}, { 71, "OtherDialingIrregularity"}, { 80, "VacantNumber or DisconnectedNumber"}, { 81, "DenyTermination"}, { 82, "SuspendedTermination"}, { 83, "ChangedNumber"}, { 84, "InaccessibleSubscriber"}, { 85, "DenyIncomingTol"}, { 86, "RoamerAccessScreening"}, { 87, "RefuseCall"}, { 88, "RedirectCall"}, { 89, "NoPageResponse"}, { 90, "NoAnswer"}, { 96, "RoamerIntercept"}, { 97, "GeneralInformation"}, { 112, "UnrecognizedFeatureCode"}, { 113, "UnauthorizedFeatureCode"}, { 114, "RestrictedFeatureCode"}, { 115, "InvalidModifierDigits"}, { 116, "SuccessfulFeatureRegistration"}, { 117, "SuccessfulFeatureDeRegistration"}, { 118, "SuccessfulFeatureActivation"}, { 119, "SuccessfulFeatureDeActivation"}, { 120, "InvalidForwardToNumber"}, { 121, "CourtesyCallWarning"}, { 128, "EnterPINSendPrompt"}, { 129, "EnterPINPrompt"}, { 130, "ReEnterPINSendPrompt"}, { 131, "ReEnterPINPrompt"}, { 132, "EnterOldPINSendPrompt"}, { 133, "EnterOldPINPrompt"}, { 134, "EnterNewPINSendPrompt"}, { 135, "EnterNewPINPrompt"}, { 136, "ReEnterNewPINSendPrompt"}, { 137, "ReEnterNewPINPrompt"}, { 138, "EnterPasswordPrompt"}, { 139, "EnterDirectoryNumberPrompt"}, { 140, "ReEnterDirectoryNumberPrompt"}, { 141, "EnterFeatureCodePrompt"}, { 142, "EnterEnterCreditCardNumberPrompt"}, { 143, "EnterDestinationNumberPrompt"}, { 152, "PPCInsufficientAccountBalance"}, { 153, "PPCFiveMinuteWarning"}, { 154, "PPCThreeMinuteWarning"}, { 155, "PPCTwoMinuteWarning"}, { 156, "PPCOneMinuteWarning"}, { 157, "PPCDisconnect"}, { 158, "PPCRedirect"}, { 0, NULL } }; static void dissect_ansi_map_announcementcode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); /* Tone (octet 1) */ proto_tree_add_item(subtree, hf_ansi_map_announcementcode_tone, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Class (octet 2, bits A-D) */ proto_tree_add_item(subtree, hf_ansi_map_announcementcode_class, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Standard Announcement (octet 3) */ proto_tree_add_item(subtree, hf_ansi_map_announcementcode_std_ann, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Custom Announcement ( octet 4 ) e. The assignment of this octet is left to bilateral agreement. When a Custom Announcement is specified it takes precedence over either the Standard Announcement or Tone */ proto_tree_add_item(subtree, hf_ansi_map_announcementcode_cust_ann, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.8 AuthenticationCapability Updated N.S0003*/ static const value_string ansi_map_AuthenticationCapability_vals[] = { { 0, "Not used"}, { 1, "No authentication required"}, { 2, "Authentication required"}, { 128, "Authentication required and UIM capable."}, { 0, NULL } }; /* 6.5.2.14 AuthorizationPeriod*/ /* Period (octet 1) */ static const value_string ansi_map_authorizationperiod_period_vals[] = { { 0, "Not used"}, { 1, "Per Call"}, { 2, "Hours"}, { 3, "Days"}, { 4, "Weeks"}, { 5, "Per Agreement"}, { 6, "Indefinite (i.e., authorized until canceled or deregistered)"}, { 7, "Number of calls. Re-authorization should be attempted after this number of (rejected) call attempts"}, { 0, NULL } }; /* Value (octet 2) Number of minutes hours, days, weeks, or number of calls (as per Period). If Period indicates anything else the Value is set to zero on sending and ignored on receipt. */ static void dissect_ansi_map_authorizationperiod(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); proto_tree_add_item(subtree, hf_ansi_map_authorizationperiod_period, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(subtree, hf_ansi_map_value, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.15 AvailabilityType */ static const value_string ansi_map_AvailabilityType_vals[] = { { 0, "Not used"}, { 1, "Unspecified MS inactivity type"}, { 0, NULL } }; /* 6.5.2.16 BillingID */ static void dissect_ansi_map_billingid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); proto_tree_add_item(subtree, hf_ansi_map_MarketID, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; proto_tree_add_item(subtree, hf_ansi_map_swno, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* ID Number */ proto_tree_add_item(subtree, hf_ansi_map_idno, tvb, offset, 3, ENC_BIG_ENDIAN); offset = offset + 3; proto_tree_add_item(subtree, hf_ansi_map_segcount, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.20 CallingFeaturesIndicator */ static const value_string ansi_map_FeatureActivity_vals[] = { { 0, "Not used"}, { 1, "Not authorized"}, { 2, "Authorized but de-activated"}, { 3, "Authorized and activated"}, { 0, NULL } }; static void dissect_ansi_map_callingfeaturesindicator(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; int length; proto_tree *subtree; length = tvb_reported_length_remaining(tvb,offset); subtree = proto_item_add_subtree(actx->created_item, ett_mscid); /* Call Waiting: FeatureActivity, CW-FA (Octet 1 bits GH ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cwfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Forwarding No Answer FeatureActivity, CFNA-FA (Octet 1 bits EF ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cfnafa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Forwarding Busy FeatureActivity, CFB-FA (Octet 1 bits CD ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cfbfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Forwarding Unconditional FeatureActivity, CFU-FA (Octet 1 bits AB ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cfufa, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; length--; /* Call Transfer: FeatureActivity, CT-FA (Octet 2 bits GH ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_ctfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Voice Privacy FeatureActivity, VP-FA (Octet 2 bits EF ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_vpfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Delivery: FeatureActivity (not interpreted on reception by IS-41-C or later) CD-FA (Octet 2 bits CD ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cdfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Three-Way Calling FeatureActivity, 3WC-FA (Octet 2 bits AB ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_3wcfa, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; length--; /* Calling Number Identification Restriction Override FeatureActivity CNIROver-FA (Octet 3 bits GH ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cniroverfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Calling Number Identification Restriction: FeatureActivity CNIR-FA (Octet 3 bits EF ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cnirfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Calling Number Identification Presentation: FeatureActivity CNIP2-FA (Octet 3 bits CD ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cnip2fa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Calling Number Identification Presentation: FeatureActivity CNIP1-FA (Octet 3 bits AB ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cnip1fa, tvb, offset, 1, ENC_BIG_ENDIAN); length--; if ( length == 0) return; offset++; /* USCF divert to voice mail: FeatureActivity USCFvm-FA (Octet 4 bits GH ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_uscfvmfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Answer Hold: FeatureActivity AH-FA (Octet 4 bits EF ) N.S0029-0 v1.0 */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_ahfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Data Privacy Feature Activity DP-FA (Octet 4 bits CD ) N.S0008-0 v 1.0 */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_dpfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Priority Call Waiting FeatureActivity PCW-FA (Octet 4 bits AB ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_pcwfa, tvb, offset, 1, ENC_BIG_ENDIAN); length--; if ( length == 0) return; offset++; /* USCF divert to mobile station provided DN:FeatureActivity.USCFms-FA (Octet 5 bits AB ) */ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_uscfmsfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* USCF divert to network registered DN:FeatureActivity. USCFnr-FA (Octet 5 bits CD )*/ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_uscfnrfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* CDMA-Packet Data Service: FeatureActivity. CPDS-FA (Octet 5 bits EF ) N.S0029-0 v1.0*/ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_cpdsfa, tvb, offset, 1, ENC_BIG_ENDIAN); /* CDMA-Concurrent Service:FeatureActivity. CCS-FA (Octet 5 bits GH ) N.S0029-0 v1.0*/ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_ccsfa, tvb, offset, 1, ENC_BIG_ENDIAN); length--; if ( length == 0) return; offset++; /* TDMA Enhanced Privacy and Encryption:FeatureActivity.TDMA EPE-FA (Octet 6 bits AB ) N.S0029-0 v1.0*/ proto_tree_add_item(subtree, hf_ansi_map_callingfeaturesindicator_epefa, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.27 CancellationType */ static const value_string ansi_map_CancellationType_vals[] = { { 0, "Not used"}, { 1, "ServingSystemOption"}, { 2, "ReportInCall."}, { 3, "Discontinue"}, { 0, NULL } }; /* 6.5.2.29 CDMACallMode Updated with N.S0029-0 v1.0*/ /* Call Mode (octet 1, bit A) */ static const true_false_string ansi_map_CDMACallMode_cdma_bool_val = { "CDMA 800 MHz channel (Band Class 0) acceptable.", "CDMA 800 MHz channel (Band Class 0) not acceptable" }; /* Call Mode (octet 1, bit B) */ static const true_false_string ansi_map_CallMode_amps_bool_val = { "AAMPS 800 MHz channel acceptable", "AMPS 800 MHz channel not acceptable" }; /* Call Mode (octet 1, bit C) */ static const true_false_string ansi_map_CallMode_namps_bool_val = { "NAMPS 800 MHz channel acceptable", "NAMPS 800 MHz channel not acceptable" }; /* Call Mode (octet 1, bit D) */ static const true_false_string ansi_map_CDMACallMode_cls1_bool_val = { "CDMA 1900 MHz channel (Band Class 1) acceptable.", "CDMA 1900 MHz channel (Band Class 1) not acceptable" }; /* Call Mode (octet 1, bit E) */ static const true_false_string ansi_map_CDMACallMode_cls2_bool_val = { "TACS channel (Band Class 2) acceptable", "TACS channel (Band Class 2) not acceptable" }; /* Call Mode (octet 1, bit F) */ static const true_false_string ansi_map_CDMACallMode_cls3_bool_val = { "JTACS channel (Band Class 3) acceptable", "JTACS channel (Band Class 3) not acceptable" }; /* Call Mode (octet 1, bit G) */ static const true_false_string ansi_map_CDMACallMode_cls4_bool_val = { "Korean PCS channel (Band Class 4) acceptable", "Korean PCS channel (Band Class 4) not acceptable" }; /* Call Mode (octet 1, bit H) */ static const true_false_string ansi_map_CDMACallMode_cls5_bool_val = { "450 MHz channel (Band Class 5) acceptable", "450 MHz channel (Band Class 5) not acceptable" }; /* Call Mode (octet 2, bit A) */ static const true_false_string ansi_map_CDMACallMode_cls6_bool_val = { "2 GHz channel (Band Class 6) acceptable.", "2 GHz channel (Band Class 6) not acceptable." }; /* Call Mode (octet 2, bit B) */ static const true_false_string ansi_map_CDMACallMode_cls7_bool_val = { "700 MHz channel (Band Class 7) acceptable", "700 MHz channel (Band Class 7) not acceptable" }; /* Call Mode (octet 2, bit C) */ static const true_false_string ansi_map_CDMACallMode_cls8_bool_val = { "1800 MHz channel (Band Class 8) acceptable", "1800 MHz channel (Band Class 8) not acceptable" }; /* Call Mode (octet 2, bit D) */ static const true_false_string ansi_map_CDMACallMode_cls9_bool_val = { "900 MHz channel (Band Class 9) acceptable", "900 MHz channel (Band Class 9) not acceptable" }; /* Call Mode (octet 2, bit E) */ static const true_false_string ansi_map_CDMACallMode_cls10_bool_val = { "Secondary 800 MHz channel (Band Class 10) acceptable.", "Secondary 800 MHz channel (Band Class 10) not acceptable." }; static void dissect_ansi_map_cdmacallmode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; int length; proto_tree *subtree; length = tvb_reported_length_remaining(tvb,offset); subtree = proto_item_add_subtree(actx->created_item, ett_mscid); /* Call Mode (octet 1, bit H) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls5, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 1, bit G) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls4, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 1, bit F) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls3, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 1, bit E) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls2, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 1, bit D) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls1, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 1, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_namps, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 1, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_amps, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 1, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cdma, tvb, offset, 1, ENC_BIG_ENDIAN); length--; if ( length == 0) return; offset++; /* Call Mode (octet 2, bit E) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls10, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 2, bit D) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls9, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 2, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls8, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 2, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls7, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Mode (octet 2, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_cdmacallmode_cls6, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.30 CDMAChannelData */ /* Updated with N.S0010-0 v 1.0 */ static const value_string ansi_map_cdmachanneldata_band_cls_vals[] = { { 0, "800 MHz Cellular System"}, { 0, NULL } }; static void dissect_ansi_map_cdmachanneldata(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; int length; proto_tree *subtree; length = tvb_reported_length_remaining(tvb,offset); subtree = proto_item_add_subtree(actx->created_item, ett_cdmachanneldata); proto_tree_add_item(subtree, hf_ansi_map_reservedBitH, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_Frame_Offset, tvb, offset, 1, ENC_BIG_ENDIAN); /* CDMA Channel Number */ proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_CDMA_ch_no, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; length = length -2; /* Band Class */ proto_tree_add_item(subtree, hf_ansi_map_reservedBitH, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_band_cls, tvb, offset, 1, ENC_BIG_ENDIAN); /* Long Code Mask */ proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_lc_mask_b6, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_lc_mask_b5, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_lc_mask_b4, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_lc_mask_b3, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_lc_mask_b2, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_lc_mask_b1, tvb, offset, 1, ENC_BIG_ENDIAN); length = length - 6; if (length == 0) return; offset++; /* NP_EXT */ proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_np_ext, tvb, offset, 1, ENC_BIG_ENDIAN); /* Nominal Power */ proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_nominal_pwr, tvb, offset, 1, ENC_BIG_ENDIAN); /* Number Preamble */ proto_tree_add_item(subtree, hf_ansi_map_cdmachanneldata_nr_preamble, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.31 CDMACodeChannel */ /* 6.5.2.41 CDMAStationClassMark */ /* Power Class: (PC) (octet 1, bits A and B) */ static const value_string ansi_map_CDMAStationClassMark_pc_vals[] = { { 0, "Class I"}, { 1, "Class II"}, { 2, "Class III"}, { 3, "Reserved"}, { 0, NULL } }; /* Analog Transmission: (DTX) (octet 1, bit C) */ static const true_false_string ansi_map_CDMAStationClassMark_dtx_bool_val = { "Discontinuous", "Continuous" }; /* Slotted Mode Indicator: (SMI) (octet 1, bit F) */ static const true_false_string ansi_map_CDMAStationClassMark_smi_bool_val = { "Slotted capable", "Slotted incapable" }; /* Dual-mode Indicator(DMI) (octet 1, bit G) */ static const true_false_string ansi_map_CDMAStationClassMark_dmi_bool_val = { "Dual-mode CDMA", "CDMA only" }; static void dissect_ansi_map_cdmastationclassmark(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_cdmastationclassmark); proto_tree_add_item(subtree, hf_ansi_map_reservedBitH, tvb, offset, 1, ENC_BIG_ENDIAN); /* Dual-mode Indicator(DMI) (octet 1, bit G) */ proto_tree_add_item(subtree, hf_ansi_map_cdmastationclassmark_dmi, tvb, offset, 1, ENC_BIG_ENDIAN); /* Slotted Mode Indicator: (SMI) (octet 1, bit F) */ proto_tree_add_item(subtree, hf_ansi_map_cdmastationclassmark_smi, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_reservedBitED, tvb, offset, 1, ENC_BIG_ENDIAN); /* Analog Transmission: (DTX) (octet 1, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_cdmastationclassmark_dtx, tvb, offset, 1, ENC_BIG_ENDIAN); /* Power Class: (PC) (octet 1, bits A and B) */ proto_tree_add_item(subtree, hf_ansi_map_cdmastationclassmark_pc, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.47 ChannelData */ /* Discontinuous Transmission Mode (DTX) (octet 1, bits E and D) */ static const value_string ansi_map_ChannelData_dtx_vals[] = { { 0, "DTX disabled"}, { 1, "Reserved. Treat the same as value 00, DTX disabled."}, { 2, "DTX-low mode"}, { 3, "DTX mode active or acceptable"}, { 0, NULL } }; static void dissect_ansi_map_channeldata(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_channeldata); /* SAT Color Code (SCC) (octet 1, bits H and G) */ proto_tree_add_item(subtree, hf_ansi_map_channeldata_scc, tvb, offset, 1, ENC_BIG_ENDIAN); /* Discontinuous Transmission Mode (DTX) (octet 1, bits E and D) */ proto_tree_add_item(subtree, hf_ansi_map_channeldata_dtx, tvb, offset, 1, ENC_BIG_ENDIAN); /* Voice Mobile Attenuation Code (VMAC) (octet 1, bits A - C)*/ proto_tree_add_item(subtree, hf_ansi_map_channeldata_vmac, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Channel Number (CHNO) ( octet 2 and 3 ) */ proto_tree_add_item(subtree, hf_ansi_map_channeldata_chno, tvb, offset, 2, ENC_BIG_ENDIAN); } /* 6.5.2.50 ConfidentialityModes */ /* Updated with N.S0008-0 v 1.0*/ /* Voice Privacy (VP) Confidentiality Status (octet 1, bit A) */ static const true_false_string ansi_map_ConfidentialityModes_bool_val = { "On", "Off" }; static void dissect_ansi_map_confidentialitymodes(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_confidentialitymodes); /* DataPrivacy (DP) Confidentiality Status (octet 1, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_ConfidentialityModes_dp, tvb, offset, 1, ENC_BIG_ENDIAN); /* Signaling Message Encryption (SE) Confidentiality Status (octet 1, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_ConfidentialityModes_se, tvb, offset, 1, ENC_BIG_ENDIAN); /* Voice Privacy (VP) Confidentiality Status (octet 1, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_ConfidentialityModes_vp, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.51 ControlChannelData */ /* Digital Color Code (DCC) (octet 1, bit H and G) */ /* Control Mobile Attenuation Code (CMAC) (octet 1, bit A - C) */ /* Channel Number (CHNO) ( octet 2 and 3 ) */ /* Supplementary Digital Color Codes (SDCC1 and SDCC2) */ /* SDCC1 ( octet 4, bit D and C )*/ /* SDCC2 ( octet 4, bit A and B )*/ static void dissect_ansi_map_controlchanneldata(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_controlchanneldata); /* Digital Color Code (DCC) (octet 1, bit H and G) */ proto_tree_add_item(subtree, hf_ansi_map_controlchanneldata_dcc, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_reservedBitFED, tvb, offset, 1, ENC_BIG_ENDIAN); /* Control Mobile Attenuation Code (CMAC) (octet 1, bit A - C) */ proto_tree_add_item(subtree, hf_ansi_map_controlchanneldata_cmac, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Channel Number (CHNO) ( octet 2 and 3 ) */ proto_tree_add_item(subtree, hf_ansi_map_controlchanneldata_chno, tvb, offset, 2, ENC_BIG_ENDIAN); /* Supplementary Digital Color Codes (SDCC1 and SDCC2) */ offset = offset +2; /* SDCC1 ( octet 4, bit D and C )*/ proto_tree_add_item(subtree, hf_ansi_map_controlchanneldata_sdcc1, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_reservedBitHGFE, tvb, offset, 1, ENC_BIG_ENDIAN); /* SDCC2 ( octet 4, bit A and B )*/ proto_tree_add_item(subtree, hf_ansi_map_controlchanneldata_sdcc2, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.52 CountUpdateReport */ static const value_string ansi_map_CountUpdateReport_vals[] = { { 0, "Class I"}, { 1, "Class II"}, { 2, "Class III"}, { 3, "Reserved"}, { 0, NULL } }; /* 6.5.2.53 DeniedAuthorizationPeriod */ /* Period (octet 1) */ static const value_string ansi_map_deniedauthorizationperiod_period_vals[] = { { 0, "Not used"}, { 1, "Per Call. Re-authorization should be attempted on the next call attempt"}, { 2, "Hours"}, { 3, "Days"}, { 4, "Weeks"}, { 5, "Per Agreement"}, { 6, "Reserved"}, { 7, "Number of calls. Re-authorization should be attempted after this number of (rejected) call attempts"}, { 8, "Minutes"}, { 0, NULL } }; /* Value (octet 2) Number of minutes hours, days, weeks, or number of calls (as per Period). If Period indicates anything else the Value is set to zero on sending and ignored on receipt. */ static void dissect_ansi_map_deniedauthorizationperiod(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); proto_tree_add_item(subtree, hf_ansi_map_deniedauthorizationperiod_period, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(subtree, hf_ansi_map_value, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.57 DigitCollectionControl */ /* TODO Add decoding here */ /* 6.5.2.64 ExtendedMSCID */ static const value_string ansi_map_msc_type_vals[] = { { 0, "Not specified"}, { 1, "Serving MSC"}, { 2, "Home MSC"}, { 3, "Gateway MSC"}, { 4, "HLR"}, { 5, "VLR"}, { 6, "EIR (reserved)"}, { 7, "AC"}, { 8, "Border MSC"}, { 9, "Originating MSC"}, { 0, NULL } }; static void dissect_ansi_map_extendedmscid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_extendedmscid); /* Type (octet 1) */ proto_tree_add_item(subtree, hf_ansi_map_msc_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(subtree, hf_ansi_map_MarketID, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; proto_tree_add_item(subtree, hf_ansi_map_swno, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.65 ExtendedSystemMyTypeCode */ static void dissect_ansi_map_extendedsystemmytypecode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_extendedsystemmytypecode); /* Type (octet 1) */ proto_tree_add_item(subtree, hf_ansi_map_msc_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; dissect_ansi_map_SystemMyTypeCode(TRUE, tvb, offset, actx, subtree, hf_ansi_map_systemMyTypeCode); } /* 6.5.2.68 GeographicAuthorization */ /* Geographic Authorization (octet 1) */ static const value_string ansi_map_GeographicAuthorization_vals[] = { { 0, "Not used"}, { 1, "Authorized for all MarketIDs served by the VLR"}, { 2, "Authorized for this MarketID only"}, { 3, "Authorized for this MarketID and Switch Number only"}, { 4, "Authorized for this LocationAreaID within a MarketID only"}, { 5, "VLR"}, { 6, "EIR (reserved)"}, { 7, "AC"}, { 8, "Border MSC"}, { 9, "Originating MSC"}, { 0, NULL } }; /* 6.5.2.71 HandoffState */ /* Party Involved (PI) (octet 1, bit A) */ static const true_false_string ansi_map_HandoffState_pi_bool_val = { "Terminator is handing off", "Originator is handing off" }; static void dissect_ansi_map_handoffstate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_handoffstate); /* Party Involved (PI) (octet 1, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_handoffstate_pi, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.72 InterMSCCircuitID */ /* Trunk Member Number (M) Octet2 */ static void dissect_ansi_map_intermsccircuitid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; guint8 octet, octet2; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); /* Trunk Group Number (G) Octet 1 */ octet = tvb_get_guint8(tvb,offset); proto_tree_add_item(subtree, hf_ansi_map_tgn, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Trunk Member Number (M) Octet2 */ octet2 = tvb_get_guint8(tvb,offset); proto_tree_add_item(subtree, hf_ansi_map_tmn, tvb, offset, 1, ENC_BIG_ENDIAN); proto_item_append_text(actx->created_item, " (G %u/M %u)", octet, octet2); } /* 6.5.2.78 MessageWaitingNotificationCount */ /* Type of messages (octet 1) */ static const value_string ansi_map_MessageWaitingNotificationCount_type_vals[] = { { 0, "Voice messages"}, { 1, "Short Message Services (SMS) messages"}, { 2, "Group 3 (G3) Fax messages"}, { 0, NULL } }; static void dissect_ansi_map_messagewaitingnotificationcount(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); /* Type of messages (octet 1) */ proto_tree_add_item(subtree, hf_ansi_map_messagewaitingnotificationcount_tom, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Number of Messages Waiting (octet 2) */ proto_tree_add_item(subtree, hf_ansi_map_messagewaitingnotificationcount_no_mw, tvb, offset, 1, ENC_BIG_ENDIAN); } #if 0 /* 6.5.2.79 MessageWaitingNotificationType */ /* Pip Tone (PT) (octet 1, bit A) */ static const true_false_string ansi_map_MessageWaitingNotificationType_pt_bool_val = { "Pip Tone (PT) notification is required", "Pip Tone (PT) notification is not authorized or no notification is required" }; #endif #if 0 /* Alert Pip Tone (APT) (octet 1, bit B) */ static const true_false_string ansi_map_MessageWaitingNotificationType_apt_bool_val = { "Alert Pip Tone (APT) notification is required", "Alert Pip Tone (APT) notification is not authorized or notification is not required" }; #endif /* Message Waiting Indication (MWI) (octet 1, bits C and D) */ static const value_string ansi_map_MessageWaitingNotificationType_mwi_vals[] = { { 0, "No MWI. Message Waiting Indication (MWI) notification is not authorized or notification is not required"}, { 1, "Reserved"}, { 2, "MWI On. Message Waiting Indication (MWI) notification is required. Messages waiting"}, { 3, "MWI Off. Message Waiting Indication (MWI) notification is required. No messages waiting"}, { 0, NULL } }; static void dissect_ansi_map_messagewaitingnotificationtype(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); /* Message Waiting Indication (MWI) (octet 1, bits C and D) */ proto_tree_add_item(subtree, hf_ansi_map_messagewaitingnotificationtype_mwi, tvb, offset, 1, ENC_BIG_ENDIAN); /* Alert Pip Tone (APT) (octet 1, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_messagewaitingnotificationtype_apt, tvb, offset, 1, ENC_BIG_ENDIAN); /* Pip Tone (PT) (octet 1, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_messagewaitingnotificationtype_pt, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.81 MobileIdentificationNumber */ /* 6.5.2.82 MSCID */ static void dissect_ansi_map_mscid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_mscid); proto_tree_add_item(subtree, hf_ansi_map_MarketID, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; proto_tree_add_item(subtree, hf_ansi_map_swno, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.84 MSLocation */ static void dissect_ansi_map_mslocation(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_mscid); /* Latitude in tenths of a second octet 1 - 3 */ proto_tree_add_item(subtree, hf_ansi_map_mslocation_lat, tvb, offset, 3, ENC_BIG_ENDIAN); offset = offset + 3; /* Longitude in tenths of a second octet 4 - 6 */ proto_tree_add_item(subtree, hf_ansi_map_mslocation_long, tvb, offset, 3, ENC_BIG_ENDIAN); offset = offset + 3; /* Resolution in units of 1 foot octet 7, octet 8 optional */ proto_tree_add_item(subtree, hf_ansi_map_mslocation_res, tvb, offset, -1, ENC_BIG_ENDIAN); } /* 6.5.2.85 NAMPSCallMode */ static void dissect_ansi_map_nampscallmode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_mscid); /* Call Mode (octet 1, bits A and B) */ proto_tree_add_item(subtree, hf_ansi_map_nampscallmode_amps, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_nampscallmode_namps, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.86 NAMPSChannelData */ /* Narrow Analog Voice Channel Assignment (NAVCA) (octet 1, bits A and B) */ static const value_string ansi_map_NAMPSChannelData_navca_vals[] = { { 0, "Wide. 30 kHz AMPS voice channel"}, { 1, "Upper. 10 kHz NAMPS voice channel"}, { 2, "Middle. 10 kHz NAMPS voice channel"}, { 3, "Lower. 10 kHz NAMPS voice channel"}, { 0, NULL } }; /* Color Code Indicator (CCIndicator) (octet 1, bits C, D, and E) */ static const value_string ansi_map_NAMPSChannelData_ccinidicator_vals[] = { { 0, "ChannelData parameter SCC field applies"}, { 1, "Digital SAT Color Code 1 (ignore SCC field)"}, { 2, "Digital SAT Color Code 2 (ignore SCC field)"}, { 3, "Digital SAT Color Code 3 (ignore SCC field)"}, { 4, "Digital SAT Color Code 4 (ignore SCC field)"}, { 5, "Digital SAT Color Code 5 (ignore SCC field)"}, { 6, "Digital SAT Color Code 6 (ignore SCC field)"}, { 7, "Digital SAT Color Code 7 (ignore SCC field)"}, { 0, NULL } }; static void dissect_ansi_map_nampschanneldata(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_mscid); /* Color Code Indicator (CCIndicator) (octet 1, bits C, D, and E) */ proto_tree_add_item(subtree, hf_ansi_map_nampschanneldata_CCIndicator, tvb, offset, 1, ENC_BIG_ENDIAN); /* Narrow Analog Voice Channel Assignment (NAVCA) (octet 1, bits A and B) */ proto_tree_add_item(subtree, hf_ansi_map_nampschanneldata_navca, tvb, offset, 1, ENC_BIG_ENDIAN); } #if 0 /* 6.5.2.88 OneTimeFeatureIndicator */ /* updated with N.S0012 */ /* Call Waiting for Future Incoming Call (CWFI) (octet 1, bits A and B) */ /* Call Waiting for Incoming Call (CWIC) (octet 1, bits C and D) */ static const value_string ansi_map_onetimefeatureindicator_cw_vals[] = { { 0, "Ignore"}, { 1, "No CW"}, { 2, "Normal CW"}, { 3, "Priority CW"}, { 0, NULL } }; #endif #if 0 /* MessageWaitingNotification (MWN) (octet 1, bits E and F) */ static const value_string ansi_map_onetimefeatureindicator_mwn_vals[] = { { 0, "Ignore"}, { 1, "Pip Tone Inactive"}, { 2, "Pip Tone Active"}, { 3, "Reserved"}, { 0, NULL } }; #endif #if 0 /* Calling Number Identification Restriction (CNIR) (octet 1, bits G and H)*/ static const value_string ansi_map_onetimefeatureindicator_cnir_vals[] = { { 0, "Ignore"}, { 1, "CNIR Inactive"}, { 2, "CNIR Active"}, { 3, "Reserved"}, { 0, NULL } }; #endif #if 0 /* Priority Access and Channel Assignment (PACA) (octet 2, bits A and B)*/ static const value_string ansi_map_onetimefeatureindicator_paca_vals[] = { { 0, "Ignore"}, { 1, "PACA Demand Inactive"}, { 2, "PACA Demand Activated"}, { 3, "Reserved"}, { 0, NULL } }; #endif #if 0 /* Flash Privileges (Flash) (octet 2, bits C and D) */ static const value_string ansi_map_onetimefeatureindicator_flash_vals[] = { { 0, "Ignore"}, { 1, "Flash Inactive"}, { 2, "Flash Active"}, { 3, "Reserved"}, { 0, NULL } }; #endif #if 0 /* Calling Name Restriction (CNAR) (octet 2, bits E and F) */ static const value_string ansi_map_onetimefeatureindicator_cnar_vals[] = { { 0, "Ignore"}, { 1, "Presentation Allowed"}, { 2, "Presentation Restricted."}, { 3, "Blocking Toggle"}, { 0, NULL } }; #endif static void dissect_ansi_map_onetimefeatureindicator(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ /* int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_mscid); */ /* Calling Number Identification Restriction (CNIR) (octet 1, bits G and H)*/ /* MessageWaitingNotification (MWN) (octet 1, bits E and F) */ /* Call Waiting for Incoming Call (CWIC) (octet 1, bits C and D) */ /* Call Waiting for Future Incoming Call (CWFI) (octet 1, bits A and B) */ /*offset++;*/ /* Calling Name Restriction (CNAR) (octet 2, bits E and F) */ /* Flash Privileges (Flash) (octet 2, bits C and D) */ /* Priority Access and Channel Assignment (PACA) (octet 2, bits A and B)*/ } /* 6.5.2.90 OriginationTriggers */ /* All Origination (All) (octet 1, bit A) */ static const true_false_string ansi_map_originationtriggers_all_bool_val = { "Launch an OriginationRequest for any call attempt. This overrides all other values", "Trigger is not active" }; /* Local (octet 1, bit B) */ static const true_false_string ansi_map_originationtriggers_local_bool_val = { "Launch an OriginationRequest for any local call attempt", "Trigger is not active" }; /* Intra-LATA Toll (ILATA) (octet 1, bit C) */ static const true_false_string ansi_map_originationtriggers_ilata_bool_val = { "Launch an OriginationRequest for any intra-LATA call attempt", "Trigger is not active" }; /* Inter-LATA Toll (OLATA) (octet 1, bit D) */ static const true_false_string ansi_map_originationtriggers_olata_bool_val = { "Launch an OriginationRequest for any inter-LATA toll call attempt", "Trigger is not active" }; /* International (Int'l ) (octet 1, bit E) */ static const true_false_string ansi_map_originationtriggers_int_bool_val = { "Launch an OriginationRequest for any international call attempt", "Trigger is not active" }; /* World Zone (WZ) (octet 1, bit F) */ static const true_false_string ansi_map_originationtriggers_wz_bool_val = { "Launch an OriginationRequest for any call attempt outside of the current World Zone (as defined in ITU-T Rec. E.164)", "Trigger is not active" }; /* Unrecognized Number (Unrec) (octet 1, bit G) */ static const true_false_string ansi_map_originationtriggers_unrec_bool_val = { "Launch an OriginationRequest for any call attempt to an unrecognized number", "Trigger is not active" }; /* Revertive Call (RvtC) (octet 1, bit H)*/ static const true_false_string ansi_map_originationtriggers_rvtc_bool_val = { "Launch an OriginationRequest for any Revertive Call attempt", "Trigger is not active" }; /* Star (octet 2, bit A) */ static const true_false_string ansi_map_originationtriggers_star_bool_val = { "Launch an OriginationRequest for any number beginning with a Star '*' digit", "Trigger is not active" }; /* Double Star (DS) (octet 2, bit B) */ static const true_false_string ansi_map_originationtriggers_ds_bool_val = { "Launch an OriginationRequest for any number beginning with two Star '**' digits", "Trigger is not active" }; /* Pound (octet 2, bit C) */ static const true_false_string ansi_map_originationtriggers_pound_bool_val = { "Launch an OriginationRequest for any number beginning with a Pound '#' digit", "Trigger is not active" }; /* Double Pound (DP) (octet 2, bit D) */ static const true_false_string ansi_map_originationtriggers_dp_bool_val = { "Launch an OriginationRequest for any number beginning with two Pound '##' digits", "Trigger is not active" }; /* Prior Agreement (PA) (octet 2, bit E) */ static const true_false_string ansi_map_originationtriggers_pa_bool_val = { "Launch an OriginationRequest for any number matching a criteria of a prior agreement", "Trigger is not active" }; /* No digits (octet 3, bit A) */ static const true_false_string ansi_map_originationtriggers_nodig_bool_val = { "Launch an OriginationRequest for any call attempt with no digits", "Trigger is not active" }; /* 1 digit (octet 3, bit B) */ static const true_false_string ansi_map_originationtriggers_onedig_bool_val = { "Launch an OriginationRequest for any call attempt with 1 digit", "Trigger is not active" }; /* 1 digit (octet 3, bit C) */ static const true_false_string ansi_map_originationtriggers_twodig_bool_val = { "Launch an OriginationRequest for any call attempt with 2 digits", "Trigger is not active" }; /* 1 digit (octet 3, bit D) */ static const true_false_string ansi_map_originationtriggers_threedig_bool_val = { "Launch an OriginationRequest for any call attempt with 3 digits", "Trigger is not active" }; /* 1 digit (octet 3, bit E) */ static const true_false_string ansi_map_originationtriggers_fourdig_bool_val = { "Launch an OriginationRequest for any call attempt with 4 digits", "Trigger is not active" }; /* 1 digit (octet 3, bit F) */ static const true_false_string ansi_map_originationtriggers_fivedig_bool_val = { "Launch an OriginationRequest for any call attempt with 5 digits", "Trigger is not active" }; /* 1 digit (octet 3, bit G) */ static const true_false_string ansi_map_originationtriggers_sixdig_bool_val = { "Launch an OriginationRequest for any call attempt with 6 digits", "Trigger is not active" }; /* 1 digit (octet 3, bit H) */ static const true_false_string ansi_map_originationtriggers_sevendig_bool_val = { "Launch an OriginationRequest for any call attempt with 7 digits", "Trigger is not active" }; /* 1 digit (octet 4, bit A) */ static const true_false_string ansi_map_originationtriggers_eightdig_bool_val = { "Launch an OriginationRequest for any call attempt with 8 digits", "Trigger is not active" }; /* 1 digit (octet 4, bit B) */ static const true_false_string ansi_map_originationtriggers_ninedig_bool_val = { "Launch an OriginationRequest for any call attempt with 9 digits", "Trigger is not active" }; /* 1 digit (octet 4, bit C) */ static const true_false_string ansi_map_originationtriggers_tendig_bool_val = { "Launch an OriginationRequest for any call attempt with 10 digits", "Trigger is not active" }; /* 1 digit (octet 4, bit D) */ static const true_false_string ansi_map_originationtriggers_elevendig_bool_val = { "Launch an OriginationRequest for any call attempt with 11 digits", "Trigger is not active" }; /* 1 digit (octet 4, bit E) */ static const true_false_string ansi_map_originationtriggers_twelvedig_bool_val = { "Launch an OriginationRequest for any call attempt with 12 digits", "Trigger is not active" }; /* 1 digit (octet 4, bit F) */ static const true_false_string ansi_map_originationtriggers_thirteendig_bool_val = { "Launch an OriginationRequest for any call attempt with 13 digits", "Trigger is not active" }; /* 1 digit (octet 4, bit G) */ static const true_false_string ansi_map_originationtriggers_fourteendig_bool_val = { "Launch an OriginationRequest for any call attempt with 14 digits", "Trigger is not active" }; /* 1 digit (octet 4, bit H) */ static const true_false_string ansi_map_originationtriggers_fifteendig_bool_val = { "Launch an OriginationRequest for any call attempt with 15 digits", "Trigger is not active" }; static void dissect_ansi_map_originationtriggers(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_originationtriggers); /* Revertive Call (RvtC) (octet 1, bit H)*/ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_rvtc, tvb, offset, 1, ENC_BIG_ENDIAN); /* Unrecognized Number (Unrec) (octet 1, bit G) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_unrec, tvb, offset, 1, ENC_BIG_ENDIAN); /* World Zone (WZ) (octet 1, bit F) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_wz, tvb, offset, 1, ENC_BIG_ENDIAN); /* International (Int'l ) (octet 1, bit E) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_int, tvb, offset, 1, ENC_BIG_ENDIAN); /* Inter-LATA Toll (OLATA) (octet 1, bit D) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_olata, tvb, offset, 1, ENC_BIG_ENDIAN); /* Intra-LATA Toll (ILATA) (octet 1, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_ilata, tvb, offset, 1, ENC_BIG_ENDIAN); /* Local (octet 1, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_local, tvb, offset, 1, ENC_BIG_ENDIAN); /* All Origination (All) (octet 1, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_all, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /*Prior Agreement (PA) (octet 2, bit E) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_pa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Double Pound (DP) (octet 2, bit D) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_dp, tvb, offset, 1, ENC_BIG_ENDIAN); /* Pound (octet 2, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_pound, tvb, offset, 1, ENC_BIG_ENDIAN); /* Double Star (DS) (octet 2, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_ds, tvb, offset, 1, ENC_BIG_ENDIAN); /* Star (octet 2, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_star, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* 7 digit (octet 3, bit H) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_sevendig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 6 digit (octet 3, bit G) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_sixdig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 5 digit (octet 3, bit F) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_fivedig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 4 digit (octet 3, bit E) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_fourdig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 3 digit (octet 3, bit D) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_threedig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 2 digit (octet 3, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_twodig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 1 digit (octet 3, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_onedig, tvb, offset, 1, ENC_BIG_ENDIAN); /* No digits (octet 3, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_nodig, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* 15 digit (octet 4, bit H) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_fifteendig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 14 digit (octet 4, bit G) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_fourteendig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 13 digit (octet 4, bit F) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_thirteendig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 12 digit (octet 4, bit E) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_twelvedig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 11 digit (octet 4, bit D) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_elevendig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 10 digit (octet 4, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_tendig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 9 digit (octet 4, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_ninedig, tvb, offset, 1, ENC_BIG_ENDIAN); /* 8 digits (octet 4, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_originationtriggers_eightdig, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.91 PACAIndicator */ /* Permanent Activation (PA) (octet 1, bit A) */ static const true_false_string ansi_map_pacaindicator_pa_bool_val = { "PACA is permanently activated", "PACA is not permanently activated" }; static const value_string ansi_map_PACA_Level_vals[] = { { 0, "Not used"}, { 1, "Priority Level. 1 This is the highest level"}, { 2, "Priority Level 2"}, { 3, "Priority Level 3"}, { 4, "Priority Level 4"}, { 5, "Priority Level 5"}, { 6, "Priority Level 6"}, { 7, "Priority Level 7"}, { 8, "Priority Level 8"}, { 9, "Priority Level 9"}, { 10, "Priority Level 10"}, { 11, "Priority Level 11"}, { 12, "Priority Level 12"}, { 13, "Priority Level 13"}, { 14, "Priority Level 14"}, { 15, "Priority Level 15"}, { 0, NULL } }; static void dissect_ansi_map_pacaindicator(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_pacaindicator); /* PACA Level (octet 1, bits B-E) */ proto_tree_add_item(subtree, hf_ansi_map_PACA_Level, tvb, offset, 1, ENC_BIG_ENDIAN); /* Permanent Activation (PA) (octet 1, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_pacaindicator_pa, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.92 PageIndicator */ static const value_string ansi_map_PageIndicator_vals[] = { { 0, "Not used"}, { 1, "Page"}, { 2, "Listen only"}, { 0, NULL } }; /* 6.5.2.93 PC_SSN */ static void dissect_ansi_map_pc_ssn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; guint8 b1,b2,b3; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); /* Type (octet 1) */ proto_tree_add_item(subtree, hf_ansi_map_msc_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Point Code Member Number octet 2 */ b1 = tvb_get_guint8(tvb,offset); offset++; /* Point Code Cluster Number octet 3 */ b2 = tvb_get_guint8(tvb,offset); offset++; /* Point Code Network Number octet 4 */ b3 = tvb_get_guint8(tvb,offset); offset++; proto_tree_add_bytes_format_value(subtree, hf_ansi_map_point_code, tvb, offset-3, 3, NULL, "%u-%u-%u", b3, b2, b1); proto_tree_add_item(subtree, hf_ansi_map_SSN, tvb, offset, 1, ENC_NA); } /* 6.5.2.94 PilotBillingID */ static void dissect_ansi_map_pilotbillingid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); /* First Originating MarketID octet 1 and 2 */ proto_tree_add_item(subtree, hf_ansi_map_MarketID, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; /* First Originating Switch Number octet 3*/ proto_tree_add_item(subtree, hf_ansi_map_swno, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* ID Number */ proto_tree_add_item(subtree, hf_ansi_map_idno, tvb, offset, 3, ENC_BIG_ENDIAN); offset = offset + 3; proto_tree_add_item(subtree, hf_ansi_map_segcount, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.96 PreferredLanguageIndicator */ static const value_string ansi_map_PreferredLanguageIndicator_vals[] = { { 0, "Unspecified"}, { 1, "English"}, { 2, "French"}, { 3, "Spanish"}, { 4, "German"}, { 5, "Portuguese"}, { 0, NULL } }; /* 6.5.2.106 ReceivedSignalQuality */ /* a. This octet is encoded the same as octet 1 in the SignalQuality parameter (see 6.5.2.121). */ /* 6.5.2.118 SetupResult */ static const value_string ansi_map_SetupResult_vals[] = { { 0, "Not used"}, { 1, "Unsuccessful"}, { 2, "Successful"}, { 0, NULL } }; /* 6.5.2.121 SignalQuality */ /* TODO */ /* 6.5.2.122 SMS_AccessDeniedReason (TIA/EIA-41.5-D, page 5-256) N.S0011-0 v 1.0 */ static const value_string ansi_map_SMS_AccessDeniedReason_vals[] = { { 0, "Not used"}, { 1, "Denied"}, { 2, "Postponed"}, { 3, "Unavailable"}, { 4, "Invalid"}, { 0, NULL } }; /* 6.5.2.125 SMS_CauseCode (TIA/EIA-41.5-D, page 5-262) N.S0011-0 v 1.0 */ static const value_string ansi_map_SMS_CauseCode_vals[] = { { 0, "Address vacant"}, { 1, "Address translation failure"}, { 2, "Network resource shortage"}, { 3, "Network failure"}, { 4, "Invalid Teleservice ID"}, { 5, "Other network problem"}, { 6, "Unsupported network interface"}, { 8, "CDMA handset-based position determination failure"}, { 9, "CDMA handset-based position determination resources released - voice service request"}, { 10, "CDMA handset-based position determination resources released - voice service request - message acknowledged"}, { 11, "Reserved"}, { 12, "Reserved"}, { 13, "Reserved"}, { 14, "Emergency Services Call Precedence"}, { 32, "No page response"}, { 33, "Destination busy"}, { 34, "No acknowledgment"}, { 35, "Destination resource shortage"}, { 36, "SMS delivery postponed"}, { 37, "Destination out of service"}, { 38, "Destination no longer at this address"}, { 39, "Other terminal problem"}, { 64, "Radio interface resource shortage"}, { 65, "Radio interface incompatibility"}, { 66, "Other radio interface problem"}, { 67, "Unsupported Base Station Capability"}, { 96, "Encoding problem"}, { 97, "Service origination denied"}, { 98, "Service termination denied"}, { 99, "Supplementary service not supported"}, { 100, "Service not supported"}, { 101, "Reserved"}, { 102, "Missing expected parameter"}, { 103, "Missing mandatory parameter"}, { 104, "Unrecognized parameter value"}, { 105, "Unexpected parameter value"}, { 106, "User Data size error"}, { 107, "Other general problems"}, { 108, "Session not active"}, { 109, "Reserved"}, { 110, "MS Disconnect"}, { 0, NULL } }; static value_string_ext ansi_map_SMS_CauseCode_vals_ext = VALUE_STRING_EXT_INIT(ansi_map_SMS_CauseCode_vals); /* 6.5.2.126 SMS_ChargeIndicator */ /* SMS Charge Indicator (octet 1) */ static const value_string ansi_map_SMS_ChargeIndicator_vals[] = { { 0, "Not used"}, { 1, "No charge"}, { 2, "Charge original originator"}, { 3, "Charge original destination"}, { 0, NULL } }; /* 4 through 63 Reserved. Treat the same as value 1, No charge. 64 through 127 Reserved. Treat the same as value 2, Charge original originator. 128 through 223 Reserved. Treat the same as value 3, Charge original destination. 224 through 255 Reserved for TIA/EIA-41 protocol extension. If unknown, treat the same as value 2, Charge original originator. */ /* 6.5.2.130 SMS_NotificationIndicator N.S0005-0 v 1.0*/ static const value_string ansi_map_SMS_NotificationIndicator_vals[] = { { 0, "Not used"}, { 1, "Notify when available"}, { 2, "Do not notify when available"}, { 0, NULL } }; /* 6.5.2.136 SMS_OriginationRestrictions */ /* DEFAULT (octet 1, bits A and B) */ static const value_string ansi_map_SMS_OriginationRestrictions_default_vals[] = { { 0, "Block all"}, { 1, "Reserved"}, { 2, "Allow specific"}, { 3, "Allow all"}, { 0, NULL } }; /* DIRECT (octet 1, bit C) */ static const true_false_string ansi_map_SMS_OriginationRestrictions_direct_bool_val = { "Allow Direct", "Block Direct" }; /* Force Message Center (FMC) (octet 1, bit D) */ static const true_false_string ansi_map_SMS_OriginationRestrictions_fmc_bool_val = { "Force Indirect", "No effect" }; static void dissect_ansi_map_sms_originationrestrictions(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_sms_originationrestrictions); proto_tree_add_item(subtree, hf_ansi_map_reservedBitHGFE, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_sms_originationrestrictions_fmc, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_sms_originationrestrictions_direct, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_sms_originationrestrictions_default, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.137 SMS_TeleserviceIdentifier */ /* Updated with N.S0011-0 v 1.0 */ #if 0 /* SMS Teleservice Identifier (octets 1 and 2) */ static const value_string ansi_map_SMS_TeleserviceIdentifier_vals[] = { { 0, "Not used"}, { 1, "Reserved for maintenance"}, { 2, "SSD Update no response"}, { 3, "SSD Update successful"}, { 4, "SSD Update failed"}, { 4096, "AMPS Extended Protocol Enhanced Services" }, { 4097, "CDMA Cellular Paging Teleservice" }, { 4098, "CDMA Cellular Messaging Teleservice" }, { 4099, "CDMA Voice Mail Notification" }, { 32513, "TDMA Cellular Messaging Teleservice" }, { 32520, "TDMA System Assisted Mobile Positioning through Satellite (SAMPS)" }, { 32584, "TDMA Segmented System Assisted Mobile Positioning Service" }, { 0, NULL } }; #endif /* 6.5.2.140 SPINITriggers */ /* All Origination (All) (octet 1, bit A) */ /* 6.5.2.142 SSDUpdateReport */ static const value_string ansi_map_SSDUpdateReport_vals[] = { { 0, "Not used"}, { 4096, "AMPS Extended Protocol Enhanced Services"}, { 4097, "CDMA Cellular Paging Teleservice"}, { 4098, "CDMA Cellular Messaging Teleservice"}, { 32513, "TDMA Cellular Messaging Teleservice"}, { 32514, "TDMA Cellular Paging Teleservice (CPT-136)"}, { 32515, "TDMA Over-the-Air Activation Teleservice (OATS)"}, { 32516, "TDMA Over-the-Air Programming Teleservice (OPTS)"}, { 32517, "TDMA General UDP Transport Service (GUTS)"}, { 32576, "Reserved"}, { 32577, "TDMA Segmented Cellular MessagingTeleservice"}, { 32578, "TDMA Segmented Cellular Paging Teleservice"}, { 32579, "TDMA Segmented Over-the-Air Activation Teleservice (OATS)"}, { 32580, "TDMA Segmented Over-the-Air Programming Teleservice (OPTS)."}, { 32581, "TDMA Segmented General UDP Transport Service (GUTS)"}, { 32576, "Reserved"}, { 0, NULL } }; /* 6.5.2.143 StationClassMark */ /* 6.5.2.144 SystemAccessData */ /* 6.5.2.146 SystemCapabilities */ /* Updated in N.S0008-0 v 1.0 */ static const true_false_string ansi_map_systemcapabilities_auth_bool_val = { "Authentication parameters were requested on this system access (AUTH=1 in the OMT)", "Authentication parameters were not requested on this system access (AUTH=0 in the OMT)." }; static const true_false_string ansi_map_systemcapabilities_se_bool_val = { "Signaling Message Encryption supported by the system", "Signaling Message Encryption not supported by the system" }; static const true_false_string ansi_map_systemcapabilities_vp_bool_val = { "Voice Privacy supported by the system", "Voice Privacy not supported by the system" }; static const true_false_string ansi_map_systemcapabilities_cave_bool_val = { "System can execute the CAVE algorithm and share SSD for the indicated MS", "System cannot execute the CAVE algorithm and cannot share SSD for the indicated MS" }; static const true_false_string ansi_map_systemcapabilities_ssd_bool_val = { "SSD is shared with the system for the indicated MS", "SSD is not shared with the system for the indicated MS" }; static const true_false_string ansi_map_systemcapabilities_dp_bool_val = { "DP is supported by the system", "DP is not supported by the system" }; static void dissect_ansi_map_systemcapabilities(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_systemcapabilities); proto_tree_add_item(subtree, hf_ansi_map_reservedBitHG, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_systemcapabilities_dp, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_systemcapabilities_ssd, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_systemcapabilities_cave, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_systemcapabilities_vp, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_systemcapabilities_se, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_ansi_map_systemcapabilities_auth, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.151 TDMABurstIndicator */ /* 6.5.2.152 TDMACallMode */ /* 6.5.2.153 TDMAChannelData Updated in N.S0007-0 v 1.0*/ /* 6.5.2.155 TerminationAccessType */ /* XXX Fix Me, Fill up the values or do special decoding? */ static const value_string ansi_map_TerminationAccessType_vals[] = { { 0, "Not used"}, { 1, "Reserved for controlling system assignment (may be a trunk group identifier)."}, /* 1 through 127 */ { 127, "Reserved for controlling system assignment (may be a trunk group identifier)."}, { 128, "Reserved for TIA/EIA-41 protocol extension. If unknown, treat the same as value 253, Land-to-Mobile Directory Number access"}, /* 128 through 160 */ { 160, "Reserved for TIA/EIA-41 protocol extension. If unknown, treat the same as value 253, Land-to-Mobile Directory Number access"}, { 161, "Reserved for this Standard"}, /* 161 through 251 */ { 151, "Reserved for this Standard"}, { 252, "Mobile-to-Mobile Directory Number access"}, { 253, "Land-to-Mobile Directory Number access"}, { 254, "Remote Feature Control port access"}, { 255, "Roamer port access"}, { 0, NULL } }; /* 6.5.2.158 TerminationTreatment */ static const value_string ansi_map_TerminationTreatment_vals[] = { { 0, "Not used"}, { 1, "MS Termination"}, { 2, "Voice Mail Storage"}, { 3, "Voice Mail Retrieval"}, { 4, "Dialogue Termination"}, { 0, NULL } }; /* 6.5.2.159 TerminationTriggers */ /* Busy (octet 1, bits A and B) */ static const value_string ansi_map_terminationtriggers_busy_vals[] = { { 0, "Busy Call"}, { 1, "Busy Trigger"}, { 2, "Busy Leg"}, { 3, "Reserved. Treat as an unrecognized parameter value"}, { 0, NULL } }; /* Routing Failure (RF) (octet 1, bits C and D) */ static const value_string ansi_map_terminationtriggers_rf_vals[] = { { 0, "Failed Call"}, { 1, "Routing Failure Trigger"}, { 2, "Failed Leg"}, { 3, "Reserved. Treat as an unrecognized parameter value"}, { 0, NULL } }; /* No Page Response (NPR) (octet 1, bits E and F) */ static const value_string ansi_map_terminationtriggers_npr_vals[] = { { 0, "No Page Response Call"}, { 1, "No Page Response Trigger"}, { 2, "No Page Response Leg"}, { 3, "Reserved. Treat as an unrecognized parameter value"}, { 0, NULL } }; /* No Answer (NA) (octet 1, bits G and H) */ static const value_string ansi_map_terminationtriggers_na_vals[] = { { 0, "No Answer Call"}, { 1, "No Answer Trigger"}, { 2, "No Answer Leg"}, { 3, "Reserved"}, { 0, NULL } }; /* None Reachable (NR) (octet 2, bit A) */ static const value_string ansi_map_terminationtriggers_nr_vals[] = { { 0, "Member Not Reachable"}, { 1, "Group Not Reachable"}, { 0, NULL } }; /* 6.5.2.159 TerminationTriggers N.S0005-0 v 1.0*/ static void dissect_ansi_map_terminationtriggers(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_transactioncapability); proto_tree_add_item(subtree, hf_ansi_map_reservedBitH, tvb, offset, 1, ENC_BIG_ENDIAN); /* No Page Response (NPR) (octet 1, bits E and F) */ proto_tree_add_item(subtree, hf_ansi_map_terminationtriggers_npr, tvb, offset, 1, ENC_BIG_ENDIAN); /* No Answer (NA) (octet 1, bits G and H) */ proto_tree_add_item(subtree, hf_ansi_map_terminationtriggers_na, tvb, offset, 1, ENC_BIG_ENDIAN); /* Routing Failure (RF) (octet 1, bits C and D) */ proto_tree_add_item(subtree, hf_ansi_map_terminationtriggers_rf, tvb, offset, 1, ENC_BIG_ENDIAN); /* Busy (octet 1, bits A and B) */ proto_tree_add_item(subtree, hf_ansi_map_terminationtriggers_busy, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* None Reachable (NR) (octet 2, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_terminationtriggers_nr, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.160 TransactionCapability (TIA/EIA-41.5-D, page 5-315) */ /* Updated with N.S0010-0 v 1.0, N.S0012-0 v 1.0 N.S0013-0 v 1.0 */ static const true_false_string ansi_map_trans_cap_prof_bool_val = { "The system is capable of supporting the IS-41-C profile parameters", "The system is not capable of supporting the IS-41-C profile parameters" }; static const true_false_string ansi_map_trans_cap_busy_bool_val = { "The system is capable of detecting a busy condition at the current time", "The system is not capable of detecting a busy condition at the current time" }; static const true_false_string ansi_map_trans_cap_ann_bool_val = { "The system is capable of honoring the AnnouncementList parameter at the current time", "The system is not capable of honoring the AnnouncementList parameter at the current time" }; static const true_false_string ansi_map_trans_cap_rui_bool_val = { "The system is capable of interacting with the user", "The system is not capable of interacting with the user" }; static const true_false_string ansi_map_trans_cap_spini_bool_val = { "The system is capable of supporting local SPINI operation", "The system is not capable of supporting local SPINI operation at the current time" }; static const true_false_string ansi_map_trans_cap_uzci_bool_val = { "The system is User Zone capable at the current time", "The system is not User Zone capable at the current time" }; static const true_false_string ansi_map_trans_cap_ndss_bool_val = { "Serving system is NDSS capable", "Serving system is not NDSS capable" }; static const true_false_string ansi_map_trans_cap_nami_bool_val = { "The system is CNAP/CNAR capable", "The system is not CNAP/CNAR capable" }; static const value_string ansi_map_trans_cap_multerm_vals[] = { { 0, "The system cannot accept a termination at this time (i.e., cannot accept routing information)"}, { 1, "The system supports the number of call legs indicated"}, { 2, "The system supports the number of call legs indicated"}, { 3, "The system supports the number of call legs indicated"}, { 4, "The system supports the number of call legs indicated"}, { 5, "The system supports the number of call legs indicated"}, { 6, "The system supports the number of call legs indicated"}, { 7, "The system supports the number of call legs indicated"}, { 8, "The system supports the number of call legs indicated"}, { 9, "The system supports the number of call legs indicated"}, { 10, "The system supports the number of call legs indicated"}, { 11, "The system supports the number of call legs indicated"}, { 12, "The system supports the number of call legs indicated"}, { 13, "The system supports the number of call legs indicated"}, { 14, "The system supports the number of call legs indicated"}, { 15, "The system supports the number of call legs indicated"}, { 0, NULL } }; static const true_false_string ansi_map_trans_cap_tl_bool_val = { "The system is capable of supporting the TerminationList parameter at the current time", "The system is not capable of supporting the TerminationList parameter at the current time" }; static const true_false_string ansi_map_trans_cap_waddr_bool_val = { "The system is capable of supporting the TriggerAddressList parameter", "The system is not capable of supporting the TriggerAddressList parameter" }; static void dissect_ansi_map_transactioncapability(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_transactioncapability); /*NAME Capability Indicator (NAMI) (octet 1, bit H) */ proto_tree_add_item(subtree, hf_ansi_map_trans_cap_nami, tvb, offset, 1, ENC_BIG_ENDIAN); /* NDSS Capability (NDSS) (octet 1, bit G) */ proto_tree_add_item(subtree, hf_ansi_map_trans_cap_ndss, tvb, offset, 1, ENC_BIG_ENDIAN); /* UZ Capability Indicator (UZCI) (octet 1, bit F) */ proto_tree_add_item(subtree, hf_ansi_map_trans_cap_uzci, tvb, offset, 1, ENC_BIG_ENDIAN); /* Subscriber PIN Intercept (SPINI) (octet 1, bit E) */ proto_tree_add_item(subtree, hf_ansi_map_trans_cap_spini, tvb, offset, 1, ENC_BIG_ENDIAN); /* Remote User Interaction (RUI) (octet 1, bit D) */ proto_tree_add_item(subtree, hf_ansi_map_trans_cap_rui, tvb, offset, 1, ENC_BIG_ENDIAN); /* Announcements (ANN) (octet 1, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_trans_cap_ann, tvb, offset, 1, ENC_BIG_ENDIAN); /* Busy Detection (BUSY) (octet 1, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_trans_cap_busy, tvb, offset, 1, ENC_BIG_ENDIAN); /* Profile (PROF) (octet 1, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_trans_cap_prof, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* WIN Addressing (WADDR) (octet 2, bit F) */ proto_tree_add_item(subtree, hf_ansi_trans_cap_waddr, tvb, offset, 1, ENC_BIG_ENDIAN); /* TerminationList (TL) (octet 2, bit E) */ proto_tree_add_item(subtree, hf_ansi_trans_cap_tl, tvb, offset, 1, ENC_BIG_ENDIAN); /* Multiple Terminations (octet 2, bits A-D) */ proto_tree_add_item(subtree, hf_ansi_trans_cap_multerm, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.162 UniqueChallengeReport */ /* Unique Challenge Report (octet 1) */ static const value_string ansi_map_UniqueChallengeReport_vals[] = { { 0, "Not used"}, { 1, "Unique Challenge not attempted"}, { 2, "Unique Challenge no response"}, { 3, "Unique Challenge successful"}, { 4, "Unique Challenge failed"}, { 0, NULL } }; /* 6.5.2.166 VoicePrivacyMask */ /* 6.5.2.e (TSB76) CDMAServiceConfigurationRecord N.S0008-0 v 1.0 */ /* a. This field carries the CDMA Service Configuration Record. The bit-layout is the same as that of Service Configuration Record in TSB74, and J-STD-008. */ /* 6.5.2.f CDMAServiceOption N.S0010-0 v 1.0 */ /* values copied from old ANSI map dissector */ static const range_string cdmaserviceoption_vals[] = { { 1, 1, "Basic Variable Rate Voice Service (8 kbps)" }, { 2, 2, "Mobile Station Loopback (8 kbps)" }, { 3, 3, "Enhanced Variable Rate Voice Service (8 kbps)" }, { 4, 4, "Asynchronous Data Service (9.6 kbps)" }, { 5, 5, "Group 3 Facsimile (9.6 kbps)" }, { 6, 6, "Short Message Services (Rate Set 1)" }, { 7, 7, "Packet Data Service: Internet or ISO Protocol Stack (9.6 kbps)" }, { 8, 8, "Packet Data Service: CDPD Protocol Stack (9.6 kbps)" }, { 9, 9, "Mobile Station Loopback (13 kbps)" }, { 10, 10, "STU-III Transparent Service" }, { 11, 11, "STU-III Non-Transparent Service" }, { 12, 12, "Asynchronous Data Service (14.4 or 9.6 kbps)" }, { 13, 13, "Group 3 Facsimile (14.4 or 9.6 kbps)" }, { 14, 14, "Short Message Services (Rate Set 2)" }, { 15, 15, "Packet Data Service: Internet or ISO Protocol Stack (14.4 kbps)" }, { 16, 16, "Packet Data Service: CDPD Protocol Stack (14.4 kbps)" }, { 17, 17, "High Rate Voice Service (13 kbps)" }, { 18, 18, "Over-the-Air Parameter Administration (Rate Set 1)" }, { 19, 19, "Over-the-Air Parameter Administration (Rate Set 2)" }, { 20, 20, "Group 3 Analog Facsimile (Rate Set 1)" }, { 21, 21, "Group 3 Analog Facsimile (Rate Set 2)" }, { 22, 22, "High Speed Packet Data Service: Internet or ISO Protocol Stack (RS1 forward, RS1 reverse)" }, { 23, 23, "High Speed Packet Data Service: Internet or ISO Protocol Stack (RS1 forward, RS2 reverse)" }, { 24, 24, "High Speed Packet Data Service: Internet or ISO Protocol Stack (RS2 forward, RS1 reverse)" }, { 25, 25, "High Speed Packet Data Service: Internet or ISO Protocol Stack (RS2 forward, RS2 reverse)" }, { 26, 26, "High Speed Packet Data Service: CDPD Protocol Stack (RS1 forward, RS1 reverse)" }, { 27, 27, "High Speed Packet Data Service: CDPD Protocol Stack (RS1 forward, RS2 reverse)" }, { 28, 28, "High Speed Packet Data Service: CDPD Protocol Stack (RS2 forward, RS1 reverse)" }, { 29, 29, "High Speed Packet Data Service: CDPD Protocol Stack (RS2 forward, RS2 reverse)" }, { 30, 30, "Supplemental Channel Loopback Test for Rate Set 1" }, { 31, 31, "Supplemental Channel Loopback Test for Rate Set 2" }, { 32, 32, "Test Data Service Option (TDSO)" }, { 33, 33, "cdma2000 High Speed Packet Data Service, Internet or ISO Protocol Stack" }, { 34, 34, "cdma2000 High Speed Packet Data Service, CDPD Protocol Stack" }, { 35, 35, "Location Services, Rate Set 1 (9.6 kbps)" }, { 36, 36, "Location Services, Rate Set 2 (14.4 kbps)" }, { 37, 37, "ISDN Interworking Service (64 kbps)" }, { 38, 38, "GSM Voice" }, { 39, 39, "GSM Circuit Data" }, { 40, 40, "GSM Packet Data" }, { 41, 41, "GSM Short Message Service" }, { 42, 42, "None Reserved for MC-MAP standard service options" }, { 54, 54, "Markov Service Option (MSO)" }, { 55, 55, "Loopback Service Option (LSO)" }, { 56, 56, "Selectable Mode Vocoder" }, { 57, 57, "32 kbps Circuit Video Conferencing" }, { 58, 58, "64 kbps Circuit Video Conferencing" }, { 59, 59, "HRPD Accounting Records Identifier" }, { 60, 60, "Link Layer Assisted Robust Header Compression (LLA ROHC) - Header Removal" }, { 61, 61, "Link Layer Assisted Robust Header Compression (LLA ROHC) - Header Compression" }, { 62, 62, "Source-Controlled Variable-Rate Multimode Wideband Speech Codec (VMR-WB) Rate Set 2" }, { 63, 63, "Source-Controlled Variable-Rate Multimode Wideband Speech Codec (VMR-WB) Rate Set 1" }, { 64, 64, "HRPD auxiliary Packet Data Service instance" }, { 65, 65, "cdma2000/GPRS Inter-working" }, { 66, 66, "cdma2000 High Speed Packet Data Service, Internet or ISO Protocol Stack" }, { 67, 67, "HRPD Packet Data IP Service where Higher Layer Protocol is IP or ROHC" }, { 68, 68, "Enhanced Variable Rate Voice Service (EVRC-B)" }, { 69, 69, "HRPD Packet Data Service, which when used in paging over the 1x air interface, a page response is required" }, { 70, 70, "Enhanced Variable Rate Voice Service (EVRC-WB)" }, { 71, 4099, "None Reserved for standard service options" }, { 4100, 4100, "Asynchronous Data Service, Revision 1 (9.6 or 14.4 kbps)" }, { 4101, 4101, "Group 3 Facsimile, Revision 1 (9.6 or 14.4 kbps)" }, { 4102, 4102, "Reserved for standard service option" }, { 4103, 4103, "Packet Data Service: Internet or ISO Protocol Stack, Revision 1 (9.6 or 14.4 kbps)" }, { 4104, 4104, "Packet Data Service: CDPD Protocol Stack, Revision 1 (9.6 or 14.4 kbps)" }, { 4105, 32767, "Reserved for standard service options" }, { 32768, 32768, "QCELP (13 kbps)" }, { 32769, 32771, "Proprietary QUALCOMM Incorporated" }, { 32772, 32775, "Proprietary OKI Telecom" }, { 32776, 32779, "Proprietary Lucent Technologies" }, { 32780, 32783, "Nokia" }, { 32784, 32787, "NORTEL NETWORKS" }, { 32788, 32791, "Sony Electronics Inc" }, { 32792, 32795, "Motorola" }, { 32796, 32799, "QUALCOMM Incorporated" }, { 32800, 32803, "QUALCOMM Incorporated" }, { 32804, 32807, "QUALCOMM Incorporated" }, { 32808, 32811, "QUALCOMM Incorporated" }, { 32812, 32815, "Lucent Technologies" }, { 32816, 32819, "Denso International" }, { 32820, 32823, "Motorola" }, { 32824, 32827, "Denso International" }, { 32828, 32831, "Denso International" }, { 32832, 32835, "Denso International" }, { 32836, 32839, "NEC America" }, { 32840, 32843, "Samsung Electronics" }, { 32844, 32847, "Texas Instruments Incorporated" }, { 32848, 32851, "Toshiba Corporation" }, { 32852, 32855, "LG Electronics Inc." }, { 32856, 32859, "VIA Telecom Inc." }, { 0, 0, NULL } }; static void dissect_ansi_map_cdmaserviceoption(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_cdmaserviceoption); proto_tree_add_item(subtree, hf_ansi_map_cdmaserviceoption, tvb, offset, 2, ENC_BIG_ENDIAN); } /* 6.5.2.f (TSB76) CDMAServiceOption N.S0008-0 v 1.0*/ /* This field carries the CDMA Service Option. The bit-layout is the same as that of Service Option in TSB74 and J-STD-008.*/ /* 6.5.2.i (IS-730) TDMAServiceCode N.S0008-0 v 1.0 */ static const value_string ansi_map_TDMAServiceCode_vals[] = { { 0, "Analog Speech Only"}, { 1, "Digital Speech Only"}, { 2, "Analog or Digital Speech, Analog Preferred"}, { 3, "Analog or Digital Speech, Digital Preferred"}, { 4, "Asynchronous Data"}, { 5, "G3 Fax"}, { 6, "Not Used (Service Rejected)"}, { 7, "STU-III"}, { 0, NULL } }; #if 0 /* 6.5.2.j (IS-730) TDMATerminalCapability N.S0008-0 v 1.0 Updted with N.S0015-0 */ /* Supported Frequency Band (octet 1) */ /* Voice Coder (octet 2) */ /* Protocol Version (octet 3) N.S0015-0 */ static const value_string ansi_map_TDMATerminalCapability_prot_ver_vals[] = { { 0, "EIA-553 or IS-54-A"}, { 1, "TIA/EIA-627.(IS-54-B)"}, { 2, "IS-136"}, { 3, "Permanently Reserved (ANSI J-STD-011).Treat the same as value 4, IS-136-A."}, { 4, "PV 0 as published in TIA/EIA-136-0 and IS-136-A."}, { 5, "PV 1 as published in TIA/EIA-136-A."}, { 6, "PV 2 as published in TIA/EIA-136-A."}, { 7, "PV 3 as published in TIA/EIA-136-A."}, { 0, NULL } }; #endif /* Asynchronous Data (ADS) (octet 4, bit A) N.S0007-0*/ /* Group 3 Fax (G3FAX) (octet 4, bit B) */ /* Secure Telephone Unit III (STU3) (octet 4, bit C) */ /* Analog Voice (AVOX) (octet 4, bit D) */ /* Half Rate (HRATE) (octet 4, bit E) */ /* Full Rate (FRATE) (octet 4, bit F) */ /* Double Rate (2RATE) (octet 4, bit G) */ /* Triple Rate (3RATE) (octet 4, bit H) */ /* 6.5.2.k (IS-730)) TDMAVoiceCoder N.S0008-0 v 1.0, N.S0007-0 */ /* VoiceCoder (octet 1) */ /* 6.5.2.p UserZoneData N.S0015-0 */ /* 6.5.2.aa BaseStationManufacturerCode N.S0007-0 v 1.0 */ /* The BaseStationManufacturerCode (BSMC) parameter specifies the manufacturer of the base station that is currently serving the MS (see IS-136 for enumeration of values).*/ /* 6.5.2.ab BSMCStatus */ /* BSMC Status (octet 1) */ static const value_string ansi_map_BSMCStatus_vals[] = { { 0, "Same BSMC Value shall not be supported"}, { 1, "Same BSMC Value shall be supported"}, { 0, NULL } }; /*- 6.5.2.ac ControlChannelMode (N.S0007-0 v 1.0)*/ static const value_string ansi_map_ControlChannelMode_vals[] = { { 0, "Unknown"}, { 1, "MS is in Analog CC Mode"}, { 2, "MS is in Digital CC Mode"}, { 3, "MS is in NAMPS CC Mode"}, { 0, NULL } }; /* 6.5.2.ad NonPublicData N.S0007-0 v 1.0*/ /* NP Only Service (NPOS) (octet 1, bits A and B) */ /* Charging Area Tone Service (CATS) (octet 1, bits C - F) */ /* PSID/RSID Download Order (PRDO) (octet 1, bits G and H) */ /* 6.5.2.ae PagingFrameClass N.S0007-0 v 1.0*/ /* Paging Frame Class (octet 1) */ static const value_string ansi_map_PagingFrameClass_vals[] = { { 0, "PagingFrameClass 1 (1.28 seconds)"}, { 1, "PagingFrameClass 2 (2.56 seconds)"}, { 2, "PagingFrameClass 3 (3.84 seconds)"}, { 3, "PagingFrameClass 4 (7.68 seconds)"}, { 4, "PagingFrameClass 5 (15.36 seconds)"}, { 5, "PagingFrameClass 6 (30.72 seconds)"}, { 6, "PagingFrameClass 7 (61.44 seconds)"}, { 7, "PagingFrameClass 8 (122.88 seconds)"}, { 8, "Reserved. Treat the same as value 0, PagingFrameClass 1"}, { 0, NULL } }; /* 6.5.2.af PSID_RSIDInformation N.S0007-0 v 1.0*/ /* PSID/RSID Indicator (octet 1, bit A) */ /* PSID/RSID Type (octet 1, bits B-D) */ /* 6.5.2.ah ServicesResult N.S0007-0 v 1.0*/ /* PSID/RSID Download Result (PRDR) (octet 1, bits A and B) */ static const value_string ansi_map_ServicesResult_ppr_vals[] = { { 0, "No Indication"}, { 1, "Unsuccessful PSID/RSID download"}, { 2, "Successful PSID/RSID download"}, { 3, "Reserved. Treat the same as value 0, No Indication"}, { 0, NULL } }; /* 6.5.2.ai SOCStatus N.S0007-0 v 1.0*/ /* SOC Status (octet 1) */ static const value_string ansi_map_SOCStatus_vals[] = { { 0, "Same SOC Value shall not be supported"}, { 1, "Same SOC Value shall be supported"}, { 0, NULL } }; /* 6.5.2.aj SystemOperatorCode N.S0007-0 v 1.0*/ /* The SystemOperatorCode (SOC) parameter specifies the system operator that is currently providing service to a MS (see IS-136 for enumeration of values) */ /* 6.5.2.al UserGroup N.S0007-0 v 1.0*/ /* 6.5.2.am UserZoneData N.S0007-0 v 1.0*/ /*Table 6.5.2.ay TDMABandwidth value N.S0008-0 v 1.0 */ static const value_string ansi_map_TDMABandwidth_vals[] = { { 0, "Half-Rate Digital Traffic Channel Only"}, { 1, "Full-Rate Digital Traffic Channel Only"}, { 2, "Half-Rate or Full-rate Digital Traffic Channel - Full-Rate Preferred"}, { 3, "Half-rate or Full-rate Digital Traffic Channel - Half-rate Preferred"}, { 4, "Double Full-Rate Digital Traffic Channel Only"}, { 5, "Triple Full-Rate Digital Traffic Channel Only"}, { 6, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 7, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 8, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 9, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 10, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 11, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 12, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 13, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 14, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 15, "Reserved. Treat reserved values the same as value 1 - Full-Rate Digital Traffic Channel Only"}, { 0, NULL } }; /* 6.5.2.az TDMADataFeaturesIndicator N.S0008-0 v 1.0 */ /* TDMADataFeaturesIndicator ansi_map_FeatureActivity_vals ADS FeatureActivity ADS-FA ( octet 1 bit A and B ) G3 Fax FeatureActivity G3FAX-FA ( octet 1 bit C and D ) STU-III FeatureActivity STUIII-FA ( octet 1 bit E and F ) Half Rate data FeatureActivity HRATE-FA ( octet 2 bit A and B ) Full Rate data FeatureActivity FRATE-FA ( octet 2 bit C and D ) Double Rate data FeatureActivity 2RATE-FA ( octet 2 bit E and F ) Triple Rate data FeatureActivity 3RATE-FA ( octet g bit G and H ) Table 6.5.2.azt TDMADataFeaturesIndicator value static const value_string ansi_map_TDMADataFeaturesIndicator_vals[] = { { 0, "Not Used"}, { 1, "Not Authorized"}, { 2, "Authorized, but de-activated"}, { 3, "Authorized and activated"}, { 0, NULL } }; */ /* 6.5.2.ba TDMADataMode N.S0008-0 v 1.0*/ /* 6.5.2.bb TDMAVoiceMode */ /* 6.5.2.bb CDMAConnectionReference N.S0008-0 v 1.0 */ /* Service Option Connection Reference Octet 1 */ /* a. This field carries the CDMA Service Option Connection Reference. The bitlayout is the same as that of Service Option Connection Reference in TSB74 and J-STD-008. */ /* 6.5.2.ad CDMAState N.S0008-0 v 1.0 */ /* Service Option State Octet 1 */ /* a. This field carries the CDMA Service Option State information. The CDMA Service Option State is defined in the current CDMA Service Options standard. If CDMA Service Option State is not explicitly defined within a section of the relevant CDMA Service Option standard, the CDMA Service Option State shall carry the value of the ORD_Q octet of all current Service Option Control Orders (see IS-95), or the contents of all current CDMA Service Option Control Messages (see TSB74) type specific field for this connection reference. */ /* 6.5.2.aj SecondInterMSCCircuitID */ /* -- XXX Same code as ISLPinformation??? dissect_ansi_map_secondintermsccircuitid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_billingid); / Trunk Group Number (G) Octet 1 / proto_tree_add_item(subtree, hf_ansi_map_tgn, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; / Trunk Member Number (M) Octet2 / proto_tree_add_item(subtree, hf_ansi_map_tmn, tvb, offset, 1, ENC_BIG_ENDIAN); } */ #if 0 /* 6.5.2.as ChangeServiceAttributes N.S0008-0 v 1.0 */ /* Change Facilities Flag (CHGFAC)(octet 1, bits A - B) */ static const value_string ansi_map_ChangeServiceAttributes_chgfac_vals[] = { { 0, "Change Facilities Operation Requested"}, { 1, "Change Facilities Operation Not Requested"}, { 2, "Change Facilities Operation Used"}, { 3, "Change Facilities Operation Not Used"}, { 0, NULL } }; #endif #if 0 /* Service Negotiate Flag (SRVNEG)(octet 1, bits C - D) */ static const value_string ansi_map_ChangeServiceAttributes_srvneg_vals[] = { { 0, "Service Negotiation Used"}, { 1, "Service Negotiation Not Used"}, { 2, "Service Negotiation Required"}, { 3, "Service Negotiation Not Required"}, { 0, NULL } }; #endif #if 0 /* 6.5.2.au DataPrivacyParameters N.S0008-0 v 1.0*/ /* Privacy Mode (PM) (octet 1, Bits A and B) */ static const value_string ansi_map_DataPrivacyParameters_pm_vals[] = { { 0, "Privacy inactive or not supported"}, { 1, "Privacy Requested or Acknowledged"}, { 2, "Reserved. Treat reserved values the same as value 0, Privacy inactive or not supported."}, { 3, "Reserved. Treat reserved values the same as value 0, Privacy inactive or not supported."}, { 0, NULL } }; #endif #if 0 /* Data Privacy Version (PM) (octet 2) */ static const value_string ansi_map_DataPrivacyParameters_data_priv_ver_vals[] = { { 0, "Not used"}, { 1, "Data Privacy Version 1"}, { 0, NULL } }; #endif /* 6.5.2.av ISLPInformation N.S0008-0 v 1.0*/ /* ISLP Type (octet 1) */ static const value_string ansi_map_islp_type_vals[] = { { 0, "No ISLP supported"}, { 1, "ISLP supported"}, { 0, NULL } }; /* 6.5.2.bc AnalogRedirectInfo */ /* Sys Ordering (octet 1, bits A-E) */ /* Ignore CDMA (IC) (octet 1, bit F) */ /* 6.5.2.be CDMAChannelNumber N.S0010-0 v 1.0*/ /* 6.5.2.bg CDMAPowerCombinedIndicator N.S0010-0 v 1.0*/ /* 6.5.2.bi CDMASearchParameters N.S0010-0 v 1.0*/ /* 6.5.2.bk CDMANetworkIdentification N.S0010-0 v 1.0*/ /* See CDMA [J-STD-008] for encoding of this field. */ /* 6.5.2.bo RequiredParametersMask N.S0010-0 v 1.0 */ /* 6.5.2.bp ServiceRedirectionCause */ static const value_string ansi_map_ServiceRedirectionCause_type_vals[] = { { 0, "Not used"}, { 1, "NormalRegistration"}, { 2, "SystemNotFound."}, { 3, "ProtocolMismatch."}, { 4, "RegistrationRejection."}, { 5, "WrongSID."}, { 6, "WrongNID.."}, { 0, NULL } }; /* 6.5.2.bq ServiceRedirectionInfo N.S0010-0 v 1.0 */ /* 6.5.2.br RoamingIndication N.S0010-0 v 1.0*/ /* See CDMA [TSB58] for the definition of this field. */ /* 6.5.2.bw CallingPartyName N.S0012-0 v 1.0*/ #if 0 /* Presentation Status (octet 1, bits A and B) */ static const value_string ansi_map_Presentation_Status_vals[] = { { 0, "Presentation allowed"}, { 1, "Presentation restricted"}, { 2, "Blocking toggle"}, { 3, "No indication"}, { 0, NULL } }; #endif #if 0 /* Availability (octet 1, bit E) N.S0012-0 v 1.0*/ static const true_false_string ansi_map_Availability_bool_val = { "Name not available", "Name available/unknown" }; #endif static void dissect_ansi_map_callingpartyname(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ /* Availability (octet 1, bit E) N.S0012-0 v 1.0*/ /* Presentation Status (octet 1, bits A and B) */ } /* 6.5.2.bx DisplayText N.S0012-0 v 1.0*/ /* a. Refer to ANSI T1.610 for field encoding. */ /* 6.5.2.bz ServiceID Service Identifier (octets 1 to n) 0 Not used. 1 Calling Name Presentation - No RND. 2 Calling Name Presentation with RND. */ /* 6.5.2.co GlobalTitle N.S0013-0 v 1.0 * Refer to Section 3 of ANSI T1.112 for the encoding of this field. */ /* Address Indicator octet 1 */ /* Global Title Octet 2 - n */ #if 0 /* 6.5.2.dc SpecializedResource N.S0013-0 v 1.0*/ /* Resource Type (octet 1) */ static const value_string ansi_map_resource_type_vals[] = { { 0, "Not used"}, { 1, "DTMF tone detector"}, { 2, "Automatic Speech Recognition - Speaker Independent - Digits"}, { 3, "Automatic Speech Recognition - Speaker Independent - Speech User Interface Version 1"}, { 0, NULL } }; #endif /* 6.5.2.df TriggerCapability */ /* Updated with N.S0004 N.S0013-0 v 1.0*/ static const true_false_string ansi_map_triggercapability_bool_val = { "triggers can be armed by the TriggerAddressList parameter", "triggers cannot be armed by the TriggerAddressList parameter" }; static void dissect_ansi_map_triggercapability(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_triggercapability); /* O_No_Answer (ONA) (octet 1, bit H)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_ona, tvb, offset, 1, ENC_BIG_ENDIAN); /* O_Disconnect (ODISC) (octet 1, bit G)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_odisc, tvb, offset, 1, ENC_BIG_ENDIAN); /* O_Answer (OANS) (octet 1, bit F)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_oans, tvb, offset, 1, ENC_BIG_ENDIAN); /* Origination_Attempt_Authorized (OAA) (octet 1, bit E)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_oaa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Revertive_Call (RvtC) (octet 1, bit D)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_rvtc, tvb, offset, 1, ENC_BIG_ENDIAN); /* All_Calls (All) (octet 1, bit C)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_all, tvb, offset, 1, ENC_BIG_ENDIAN); /* K-digit (K-digit) (octet 1, bit B)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_kdigit, tvb, offset, 1, ENC_BIG_ENDIAN); /* Introducing Star/Pound (INIT) (octet 1, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_init, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* O_Called_Party_Busy (OBSY) (octet 2, bit H)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_obsy, tvb, offset, 1, ENC_BIG_ENDIAN); /* Called_Routing_Address_Available (CdRAA) (octet 2, bit G)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_cdraa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Initial_Termination (IT) (octet 2, bit F)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_it, tvb, offset, 1, ENC_BIG_ENDIAN); /* Calling_Routing_Address_Available (CgRAA)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_cgraa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Advanced_Termination (AT) (octet 2, bit D)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_at, tvb, offset, 1, ENC_BIG_ENDIAN); /* Prior_Agreement (PA) (octet 2, bit C)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_pa, tvb, offset, 1, ENC_BIG_ENDIAN); /* Unrecognized_Number (Unrec) (octet 2, bit B)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_unrec, tvb, offset, 1, ENC_BIG_ENDIAN); /* Call Types (CT) (octet 2, bit A)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_ct, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* */ /* */ /* */ /* T_Disconnect (TDISC) (octet 3, bit E)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_tdisc, tvb, offset, 1, ENC_BIG_ENDIAN); /* T_Answer (TANS) (octet 3, bit D)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_tans, tvb, offset, 1, ENC_BIG_ENDIAN); /* T_No_Answer (TNA) (octet 3, bit C)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_tna, tvb, offset, 1, ENC_BIG_ENDIAN); /* T_Busy (TBusy) (octet 3, bit B)*/ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_tbusy, tvb, offset, 1, ENC_BIG_ENDIAN); /* Terminating_Resource_Available (TRA) (octet 3, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_triggercapability_tra, tvb, offset, 1, ENC_BIG_ENDIAN); } /* 6.5.2.ei DMH_ServiceID N.S0018 */ /* 6.5.2.dj WINOperationsCapability */ /* Updated with N.S0004 */ /* ConnectResource (CONN) (octet 1, bit A) */ static const true_false_string ansi_map_winoperationscapability_conn_bool_val = { "Sender is capable of supporting the ConnectResource, DisconnectResource, ConnectionFailureReport and ResetTimer (SSFT timer) operations", "Sender is not capable of supporting the ConnectResource, DisconnectResource,ConnectionFailureReport and ResetTimer (SSFT timer) operations" }; /* CallControlDirective (CCDIR) (octet 1, bit B) */ static const true_false_string ansi_map_winoperationscapability_ccdir_bool_val = { "Sender is capable of supporting the CallControlDirective operation", "Sender is not capable of supporting the CallControlDirective operation" }; /* PositionRequest (POS) (octet 1, bit C) */ static const true_false_string ansi_map_winoperationscapability_pos_bool_val = { "Sender is capable of supporting the PositionRequest operation", "Sender is not capable of supporting the PositionRequest operation" }; static void dissect_ansi_map_winoperationscapability(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_winoperationscapability); /* PositionRequest (POS) (octet 1, bit C) */ proto_tree_add_item(subtree, hf_ansi_map_winoperationscapability_pos, tvb, offset, 1, ENC_BIG_ENDIAN); /* CallControlDirective (CCDIR) (octet 1, bit B) */ proto_tree_add_item(subtree, hf_ansi_map_winoperationscapability_ccdir, tvb, offset, 1, ENC_BIG_ENDIAN); /* ConnectResource (CONN) (octet 1, bit A) */ proto_tree_add_item(subtree, hf_ansi_map_winoperationscapability_conn, tvb, offset, 1, ENC_BIG_ENDIAN); } /* * 6.5.2.dk N.S0013-0 v 1.0,X.S0004-550-E v1.0 2.301 * Code to be found after include functions. */ /* 6.5.2.ei TIA/EIA-41.5-D Modifications N.S0018Re */ /* Octet 1,2 1st MarketID */ /* Octet 3 1st MarketSegmentID */ /* Octet 4,5 1st DMH_ServiceID value */ /* Second marcet ID etc */ /* 6.5.2.ek ControlNetworkID N.S0018*/ static void dissect_ansi_map_controlnetworkid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_controlnetworkid); /* MarketID octet 1 and 2 */ proto_tree_add_item(subtree, hf_ansi_map_MarketID, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; /* Switch Number octet 3*/ proto_tree_add_item(subtree, hf_ansi_map_swno, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } /* 6.5.2.dk WIN_TriggerList N.S0013-0 v 1.0 */ /* 6.5.2.ec DisplayText2 Updated in N.S0015-0*/ /* 6.5.2.eq MSStatus N.S0004 */ /* 6.5.2.er PositionInformationCode N.S0004 */ /* 6.5.2.fd InterMessageTime N.S0015-0*/ /* Timer value (in 10s of seconds) octet 1 */ /* 6.5.2.fe MSIDUsage N.S0015-0 */ /* M and I Report (octet 1, bits A and B) */ static const value_string ansi_MSIDUsage_m_or_i_vals[] = { { 0, "Not used"}, { 1, "MIN last used"}, { 2, "IMSI last used"}, { 3, "Reserved"}, { 0, NULL } }; /* 6.5.2.ff NewMINExtension N.S0015-0 */ #if 0 /* 6.5.2.fv ACGEncountered N.S0023-0 v 1.0 */ /* ACG Encountered (octet 1, bits A-F) */ static const value_string ansi_ACGEncountered_vals[] = { { 0, "PC_SSN"}, { 1, "1-digit control"}, { 2, "2-digit control"}, { 3, "3-digit control"}, { 4, "4-digit control"}, { 5, "5-digit control"}, { 6, "6-digit control"}, { 7, "7-digit control"}, { 8, "8-digit control"}, { 9, "9-digit control"}, { 10, "10-digit control"}, { 11, "11-digit control"}, { 12, "12-digit control"}, { 13, "13-digit control"}, { 14, "14-digit control"}, { 15, "15-digit control"}, { 0, NULL } }; #endif #if 0 /* Control Type (octet 1, bits G-H) */ static const value_string ansi_ACGEncountered_cntrl_type_vals[] = { { 0, "Not used."}, { 1, "Service Management System Initiated control encountered"}, { 2, "SCF Overload control encountered"}, { 3, "Reserved. Treat the same as value 0, Not used."}, { 0, NULL } }; #endif /* 6.5.2.fw ControlType N.S0023-0 v 1.0 */ #if 0 /* 6.5.2.ge QoSPriority N.S0029-0 v1.0*/ /* 6.5.2.xx QOSPriority */ /* Non-Assured Priority (octet 1, bits A-D) */ static const value_string ansi_map_Priority_vals[] = { { 0, "Priority Level 0. This is the lowest level"}, { 1, "Priority Level 1"}, { 2, "Priority Level 2"}, { 3, "Priority Level 3"}, { 4, "Priority Level 4"}, { 5, "Priority Level 5"}, { 6, "Priority Level 6"}, { 7, "Priority Level 7"}, { 8, "Priority Level 8"}, { 8, "Priority Level 9"}, { 10, "Priority Level 10"}, { 11, "Priority Level 11"}, { 12, "Priority Level 12"}, { 13, "Priority Level 13"}, { 14, "Reserved"}, { 15, "Reserved"}, { 0, NULL } }; #endif /* Assured Priority (octet 1, bits E-H)*/ /* 6.5.2.gf PDSNAddress N.S0029-0 v1.0*/ /* a. See IOS Handoff Request message for the definition of this field. */ /* 6.5.2.gg PDSNProtocolType N.S0029-0 v1.0*/ /* See IOS Handoff Request message for the definition of this field. */ /* 6.5.2.gh CDMAMSMeasuredChannelIdentity N.S0029-0 v1.0*/ /* 6.5.2.gl CallingPartyCategory N.S0027*/ /* a. Refer to ITU-T Q.763 (Signalling System No. 7 ISDN user part formats and codes) for encoding of this parameter. b. Refer to national ISDN user part specifications for definitions and encoding of the reserved for national use values. */ /* 6.5.2.gm CDMA2000HandoffInvokeIOSData N.S0029-0 v1.0*/ /* IOS A1 Element Handoff Invoke Information */ /* 6.5.2.gn CDMA2000HandoffResponseIOSData */ /* IOS A1 Element Handoff Response Information N.S0029-0 v1.0*/ /* 6.5.2.gr CDMAServiceOptionConnectionIdentifier N.S0029-0 v1.0*/ /* 6.5.2.fk GeographicPosition */ /* Calling Geodetic Location (CGL) * a. See T1.628 for encoding. * b. Ignore extra octets, if received. Send only defined (or significant) octets. */ /* 6.5.2.fs PositionRequestType (See J-STD-036, page 8-47) X.S0002-0 v2.0 */ /* Position Request Type (octet 1, bits A-H) */ /* static const value_string ansi_map_Position_Request_Type_vals[] = { { 0, "Not used"}, { 1, "Initial Position"}, { 2, "Return the updated position"}, { 3, "Return the updated or last known position"}, { 4, "Reserved for LSP interface"}, { 5, "Initial Position Only"}, { 6, "Return the last known position"}, { 7, "Return the updated position based on the serving cell identity"}, */ /* values through 95 Reserved. Treat the same as value 1, Initial position. 96 through 255 Reserved for TIA/EIA-41 protocol extension. If unknown, treat the same as value 1, Initial position. * { 0, NULL } }; */ /* LCS Client Type (CTYP) (octet 2, bit A) * 0 Emergency services LCS Client. 1 Non-emergency services LCS Client. Call-Related Indicator (CALL) (octet 2, bit B) Decimal Value Meaning 0 Call-related LCS Client request. 1 Non call-related LCS Client request. Current Serving Cell Information for Coarse Position Determination (CELL) (octet 2, bit C) Decimal Value Meaning 0 No specific request. 1 Current serving cell information. Current serving cell information for Target MS requested. Radio contact with Target MS is required. */ /* 6.5.2.ft PositionResult * static const value_string ansi_map_PositionResult_vals[] = { { 0, "Not used"}, { 1, "Initial position returned"}, { 2, "Updated position returned"}, { 3, "Last known position returned"}, { 4, "Requested position is not available"}, { 5, "Target MS disconnect"}, { 6, "Target MS has handed-off"}, { 7, "Identified MS is inactive or has roamed to another system"}, { 8, "Unresponsive"}, { 9, "Identified MS is responsive, but refused position request"}, { 10, "System Failure"}, { 11, "MSID is not known"}, { 12, "Callback number is not known"}, { 13, "Improper request"}, { 14, "Mobile information returned"}, { 15, "Signal not detected"}, { 16, "PDE Timeout"}, { 17, "Position pending"}, { 18, "TDMA MAHO Information Returned"}, { 19, "TDMA MAHO Information is not available"}, { 20, "Access Denied"}, { 21, "Requested PQOS not met"}, { 22, "Resource required for CDMA handset-based position determination is currently unavailable"}, { 23, "CDMA handset-based position determination failure"}, { 24, "CDMA handset-based position determination failure detected by the PDE"}, { 25, "CDMA handset-based position determination incomplete traffic channel requested for voice services"}, { 26, "Emergency services call notification"}, { 27, "Emergency services call precedence"}, { 28, "Request acknowledged"}, { 0, NULL } }; */ #if 0 /* 6.5.2.bp-1 ServiceRedirectionCause value */ static const value_string ansi_map_ServiceRedirectionCause_vals[] = { { 0, "Not used"}, { 1, "NormalRegistration"}, { 2, "SystemNotFound"}, { 3, "ProtocolMismatch"}, { 4, "RegistrationRejection"}, { 5, "WrongSID"}, { 6, "WrongNID"}, { 0, NULL } }; #endif /* 6.5.2.mT AuthenticationResponseReauthentication N.S0011-0 v 1.0*/ /* 6.5.2.vT ReauthenticationReport N.S0011-0 v 1.0*/ static const value_string ansi_map_ReauthenticationReport_vals[] = { { 0, "Not used"}, { 1, "Reauthentication not attempted"}, { 2, "Reauthentication no response"}, { 3, "Reauthentication successful"}, { 4, "Reauthentication failed"}, { 0, NULL } }; #if 0 /* 6.5.2.lB AKeyProtocolVersion N.S0011-0 v 1.0 */ static const value_string ansi_map_AKeyProtocolVersion_vals[] = { { 0, "Not used"}, { 1, "A-key Generation not supported"}, { 2, "Diffie Hellman with 768-bit modulus, 160-bit primitive, and 160-bit exponents"}, { 3, "Diffie Hellman with 512-bit modulus, 160-bit primitive, and 160-bit exponents"}, { 4, "Diffie Hellman with 768-bit modulus, 32-bit primitive, and 160-bit exponents"}, { 0, NULL } }; #endif /* 6.5.2.sB OTASP_ResultCode N.S0011-0 v 1.0 */ static const value_string ansi_map_OTASP_ResultCode_vals[] = { { 0, "Accepted - Successful"}, { 1, "Rejected - Unknown cause."}, { 2, "Computation Failure - E.g., unable to compute A-key"}, { 3, "CSC Rejected - CSC challenge failure"}, { 4, "Unrecognized OTASPCallEntry"}, { 5, "Unsupported AKeyProtocolVersion(s)"}, { 6, "Unable to Commit"}, { 0, NULL } }; /*6.5.2.wB ServiceIndicator N.S0011-0 v 1.0 */ static const value_string ansi_map_ServiceIndicator_vals[] = { { 0, "Undefined Service"}, { 1, "CDMA OTASP Service"}, { 2, "TDMA OTASP Service"}, { 3, "CDMA OTAPA Service"}, { 4, "CDMA Position Determination Service (Emergency Services)"}, { 5, "AMPS Position Determination Service (Emergency Services)"}, { 6, "CDMA Position Determination Service (Value Added Services)"}, { 0, NULL } }; /* 6.5.2.xB SignalingMessageEncryptionReport N.S0011-0 v 1.0 */ static const value_string ansi_map_SMEReport_vals[] = { { 0, "Not used"}, { 1, "Signaling Message Encryption enabling not attempted"}, { 2, "Signaling Message Encryption enabling no response"}, { 3, "Signaling Message Encryption is enabled"}, { 4, "Signaling Message Encryption enabling failed"}, { 0, NULL } }; /* 6.5.2.zB VoicePrivacyReport N.S0011-0 v 1.0 */ static const value_string ansi_map_VoicePrivacyReport_vals[] = { { 0, "Not used"}, { 1, "Voice Privacy not attempted"}, { 2, "Voice Privacy no response"}, { 3, "Voice Privacy is active"}, { 4, "Voice Privacy failed"}, { 0, NULL } }; #include "packet-ansi_map-fn.c" /* * 6.5.2.dk N.S0013-0 v 1.0,X.S0004-550-E v1.0 2.301 */ static void dissect_ansi_map_win_trigger_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx _U_){ int offset = 0; int end_offset = 0; int j = 0; proto_tree *subtree; guint8 octet; end_offset = tvb_reported_length_remaining(tvb,offset); subtree = proto_item_add_subtree(actx->created_item, ett_win_trigger_list); while(offset< end_offset) { octet = tvb_get_guint8(tvb,offset); switch (octet){ case 0xdc: proto_tree_add_uint_format(subtree, hf_ansi_map_win_trigger_list, tvb, offset, 1, octet, "TDP-R's armed"); j=0; break; case 0xdd: proto_tree_add_uint_format(subtree, hf_ansi_map_win_trigger_list, tvb, offset, 1, octet, "TDP-N's armed"); j=0; break; case 0xde: proto_tree_add_uint_format(subtree, hf_ansi_map_win_trigger_list, tvb, offset, 1, octet, "EDP-R's armed"); j=0; break; case 0xdf: proto_tree_add_uint_format(subtree, hf_ansi_map_win_trigger_list, tvb, offset, 1, octet, "EDP-N's armed"); j=0; break; default: proto_tree_add_uint_format(subtree, hf_ansi_map_win_trigger_list, tvb, offset, 1, octet, "[%u] (%u) %s",j,octet,val_to_str_ext(octet, &ansi_map_TriggerType_vals_ext, "Unknown TriggerType (%u)")); j++; break; } offset++; } } static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) { static gboolean opCodeKnown = TRUE; static ansi_map_tap_rec_t tap_rec[16]; static ansi_map_tap_rec_t *tap_p; static int tap_current=0; /* * set tap record pointer */ tap_current++; if (tap_current == array_length(tap_rec)) { tap_current = 0; } tap_p = &tap_rec[tap_current]; switch(OperationCode){ case 1: /*Handoff Measurement Request*/ offset = dissect_ansi_map_HandoffMeasurementRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffMeasurementRequest); break; case 2: /*Facilities Directive*/ offset = dissect_ansi_map_FacilitiesDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_facilitiesDirective); break; case 3: /*Mobile On Channel*/ proto_tree_add_expert(tree, actx->pinfo, &ei_ansi_map_no_data, tvb, offset, -1); break; case 4: /*Handoff Back*/ offset = dissect_ansi_map_HandoffBack(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffBack); break; case 5: /*Facilities Release*/ offset = dissect_ansi_map_FacilitiesRelease(TRUE, tvb, offset, actx, tree, hf_ansi_map_facilitiesRelease); break; case 6: /*Qualification Request*/ offset = dissect_ansi_map_QualificationRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_qualificationRequest); break; case 7: /*Qualification Directive*/ offset = dissect_ansi_map_QualificationDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_qualificationDirective); break; case 8: /*Blocking*/ offset = dissect_ansi_map_Blocking(TRUE, tvb, offset, actx, tree, hf_ansi_map_blocking); break; case 9: /*Unblocking*/ offset = dissect_ansi_map_Unblocking(TRUE, tvb, offset, actx, tree, hf_ansi_map_unblocking); break; case 10: /*Reset Circuit*/ offset = dissect_ansi_map_ResetCircuit(TRUE, tvb, offset, actx, tree, hf_ansi_map_resetCircuit); break; case 11: /*Trunk Test*/ offset = dissect_ansi_map_TrunkTest(TRUE, tvb, offset, actx, tree, hf_ansi_map_trunkTest); break; case 12: /*Trunk Test Disconnect*/ offset = dissect_ansi_map_TrunkTestDisconnect(TRUE, tvb, offset, actx, tree, hf_ansi_map_trunkTestDisconnect); break; case 13: /*Registration Notification*/ offset = dissect_ansi_map_RegistrationNotification(TRUE, tvb, offset, actx, tree, hf_ansi_map_registrationNotification); break; case 14: /*Registration Cancellation*/ offset = dissect_ansi_map_RegistrationCancellation(TRUE, tvb, offset, actx, tree, hf_ansi_map_registrationCancellation); break; case 15: /*Location Request*/ offset = dissect_ansi_map_LocationRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_locationRequest); break; case 16: /*Routing Request*/ offset = dissect_ansi_map_RoutingRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_routingRequest); break; case 17: /*Feature Request*/ offset = dissect_ansi_map_FeatureRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_featureRequest); break; case 18: /*Reserved 18 (Service Profile Request, IS-41-C)*/ proto_tree_add_expert_format(tree, actx->pinfo, &ei_ansi_map_unknown_invokeData_blob, tvb, offset, -1, "Unknown invokeData blob(18 (Service Profile Request, IS-41-C)"); break; case 19: /*Reserved 19 (Service Profile Directive, IS-41-C)*/ proto_tree_add_expert_format(tree, actx->pinfo, &ei_ansi_map_unknown_invokeData_blob, tvb, offset, -1, "Unknown invokeData blob(19 Service Profile Directive, IS-41-C)"); break; case 20: /*Unreliable Roamer Data Directive*/ offset = dissect_ansi_map_UnreliableRoamerDataDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_unreliableRoamerDataDirective); break; case 21: /*Reserved 21 (Call Data Request, IS-41-C)*/ proto_tree_add_expert_format(tree, actx->pinfo, &ei_ansi_map_unknown_invokeData_blob, tvb, offset, -1, "Unknown invokeData blob(Reserved 21 (Call Data Request, IS-41-C)"); break; case 22: /*MS Inactive*/ offset = dissect_ansi_map_MSInactive(TRUE, tvb, offset, actx, tree, hf_ansi_map_mSInactive); break; case 23: /*Transfer To Number Request*/ offset = dissect_ansi_map_TransferToNumberRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_transferToNumberRequest); break; case 24: /*Redirection Request*/ offset = dissect_ansi_map_RedirectionRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_redirectionRequest); break; case 25: /*Handoff To Third*/ offset = dissect_ansi_map_HandoffToThird(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffToThird); break; case 26: /*Flash Request*/ offset = dissect_ansi_map_FlashRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_flashRequest); break; case 27: /*Authentication Directive*/ offset = dissect_ansi_map_AuthenticationDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationDirective); break; case 28: /*Authentication Request*/ offset = dissect_ansi_map_AuthenticationRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationRequest); break; case 29: /*Base Station Challenge*/ offset = dissect_ansi_map_BaseStationChallenge(TRUE, tvb, offset, actx, tree, hf_ansi_map_baseStationChallenge); break; case 30: /*Authentication Failure Report*/ offset = dissect_ansi_map_AuthenticationFailureReport(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationFailureReport); break; case 31: /*Count Request*/ offset = dissect_ansi_map_CountRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_countRequest); break; case 32: /*Inter System Page*/ offset = dissect_ansi_map_InterSystemPage(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemPage); break; case 33: /*Unsolicited Response*/ offset = dissect_ansi_map_UnsolicitedResponse(TRUE, tvb, offset, actx, tree, hf_ansi_map_unsolicitedResponse); break; case 34: /*Bulk Deregistration*/ offset = dissect_ansi_map_BulkDeregistration(TRUE, tvb, offset, actx, tree, hf_ansi_map_bulkDeregistration); break; case 35: /*Handoff Measurement Request 2*/ offset = dissect_ansi_map_HandoffMeasurementRequest2(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffMeasurementRequest2); break; case 36: /*Facilities Directive 2*/ offset = dissect_ansi_map_FacilitiesDirective2(TRUE, tvb, offset, actx, tree, hf_ansi_map_facilitiesDirective2); break; case 37: /*Handoff Back 2*/ offset = dissect_ansi_map_HandoffBack2(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffBack2); break; case 38: /*Handoff To Third 2*/ offset = dissect_ansi_map_HandoffToThird2(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffToThird2); break; case 39: /*Authentication Directive Forward*/ offset = dissect_ansi_map_AuthenticationDirectiveForward(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationDirectiveForward); break; case 40: /*Authentication Status Report*/ offset = dissect_ansi_map_AuthenticationStatusReport(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationStatusReport); break; case 41: /*Reserved 41*/ proto_tree_add_expert_format(tree, actx->pinfo, &ei_ansi_map_unknown_invokeData_blob, tvb, offset, -1, "Reserved 41, Unknown invokeData blob"); break; case 42: /*Information Directive*/ offset = dissect_ansi_map_InformationDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_informationDirective); break; case 43: /*Information Forward*/ offset = dissect_ansi_map_InformationForward(TRUE, tvb, offset, actx, tree, hf_ansi_map_informationForward); break; case 44: /*Inter System Answer*/ offset = dissect_ansi_map_InterSystemAnswer(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemAnswer); break; case 45: /*Inter System Page 2*/ offset = dissect_ansi_map_InterSystemPage2(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemPage2); break; case 46: /*Inter System Setup*/ offset = dissect_ansi_map_InterSystemSetup(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemSetup); break; case 47: /*OriginationRequest*/ offset = dissect_ansi_map_OriginationRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_originationRequest); break; case 48: /*Random Variable Request*/ offset = dissect_ansi_map_RandomVariableRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_randomVariableRequest); break; case 49: /*Redirection Directive*/ offset = dissect_ansi_map_RedirectionDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_redirectionDirective); break; case 50: /*Remote User Interaction Directive*/ offset = dissect_ansi_map_RemoteUserInteractionDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_remoteUserInteractionDirective); break; case 51: /*SMS Delivery Backward*/ offset = dissect_ansi_map_SMSDeliveryBackward(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSDeliveryBackward); break; case 52: /*SMS Delivery Forward*/ offset = dissect_ansi_map_SMSDeliveryForward(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSDeliveryForward); break; case 53: /*SMS Delivery Point to Point*/ offset = dissect_ansi_map_SMSDeliveryPointToPoint(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSDeliveryPointToPoint); break; case 54: /*SMS Notification*/ offset = dissect_ansi_map_SMSNotification(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSNotification); break; case 55: /*SMS Request*/ offset = dissect_ansi_map_SMSRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSRequest); break; /* End N.S0005*/ /* N.S0010-0 v 1.0 */ /* N.S0011-0 v 1.0 */ case 56: /*OTASP Request 6.4.2.CC*/ offset = dissect_ansi_map_OTASPRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_oTASPRequest); break; /*End N.S0011-0 v 1.0 */ case 57: /*Information Backward*/ break; /* N.S0008-0 v 1.0 */ case 58: /*Change Facilities*/ offset = dissect_ansi_map_ChangeFacilities(TRUE, tvb, offset, actx, tree, hf_ansi_map_changeFacilities); break; case 59: /*Change Service*/ offset = dissect_ansi_map_ChangeService(TRUE, tvb, offset, actx, tree, hf_ansi_map_changeService); break; /* End N.S0008-0 v 1.0 */ case 60: /*Parameter Request*/ offset = dissect_ansi_map_ParameterRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_parameterRequest); break; case 61: /*TMSI Directive*/ offset = dissect_ansi_map_TMSIDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_tMSIDirective); break; /*End N.S0010-0 v 1.0 */ case 62: /*NumberPortabilityRequest 62*/ offset = dissect_ansi_map_NumberPortabilityRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_numberPortabilityRequest); break; case 63: /*Service Request N.S0012-0 v 1.0*/ offset = dissect_ansi_map_ServiceRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_serviceRequest); break; /* N.S0013 */ case 64: /*Analyzed Information Request*/ offset = dissect_ansi_map_AnalyzedInformation(TRUE, tvb, offset, actx, tree, hf_ansi_map_analyzedInformation); break; case 65: /*Connection Failure Report*/ offset = dissect_ansi_map_ConnectionFailureReport(TRUE, tvb, offset, actx, tree, hf_ansi_map_connectionFailureReport); break; case 66: /*Connect Resource*/ offset = dissect_ansi_map_ConnectResource(TRUE, tvb, offset, actx, tree, hf_ansi_map_connectResource); break; case 67: /*Disconnect Resource*/ /* No data */ break; case 68: /*Facility Selected and Available*/ offset = dissect_ansi_map_FacilitySelectedAndAvailable(TRUE, tvb, offset, actx, tree, hf_ansi_map_facilitySelectedAndAvailable); break; case 69: /*Instruction Request*/ /* No data */ break; case 70: /*Modify*/ offset = dissect_ansi_map_Modify(TRUE, tvb, offset, actx, tree, hf_ansi_map_modify); break; case 71: /*Reset Timer*/ /*No Data*/ break; case 72: /*Search*/ offset = dissect_ansi_map_Search(TRUE, tvb, offset, actx, tree, hf_ansi_map_search); break; case 73: /*Seize Resource*/ offset = dissect_ansi_map_SeizeResource(TRUE, tvb, offset, actx, tree, hf_ansi_map_seizeResource); break; case 74: /*SRF Directive*/ offset = dissect_ansi_map_SRFDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_sRFDirective); break; case 75: /*T Busy*/ offset = dissect_ansi_map_TBusy(TRUE, tvb, offset, actx, tree, hf_ansi_map_tBusy); break; case 76: /*T NoAnswer*/ offset = dissect_ansi_map_TNoAnswer(TRUE, tvb, offset, actx, tree, hf_ansi_map_tNoAnswer); break; /*END N.S0013 */ case 77: /*Release*/ break; case 78: /*SMS Delivery Point to Point Ack*/ offset = dissect_ansi_map_SMSDeliveryPointToPointAck(TRUE, tvb, offset, actx, tree, hf_ansi_map_smsDeliveryPointToPointAck); break; /* N.S0024*/ case 79: /*Message Directive*/ offset = dissect_ansi_map_MessageDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_messageDirective); break; /*END N.S0024*/ /* N.S0018 PN-4287*/ case 80: /*Bulk Disconnection*/ offset = dissect_ansi_map_BulkDisconnection(TRUE, tvb, offset, actx, tree, hf_ansi_map_bulkDisconnection); break; case 81: /*Call Control Directive*/ offset = dissect_ansi_map_CallControlDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_callControlDirective); break; case 82: /*O Answer*/ offset = dissect_ansi_map_OAnswer(TRUE, tvb, offset, actx, tree, hf_ansi_map_oAnswer); break; case 83: /*O Disconnect*/ offset = dissect_ansi_map_ODisconnect(TRUE, tvb, offset, actx, tree, hf_ansi_map_oDisconnect); break; case 84: /*Call Recovery Report*/ offset = dissect_ansi_map_CallRecoveryReport(TRUE, tvb, offset, actx, tree, hf_ansi_map_callRecoveryReport); break; case 85: /*T Answer*/ offset = dissect_ansi_map_TAnswer(TRUE, tvb, offset, actx, tree, hf_ansi_map_tAnswer); break; case 86: /*T Disconnect*/ offset = dissect_ansi_map_TDisconnect(TRUE, tvb, offset, actx, tree, hf_ansi_map_tDisconnect); break; case 87: /*Unreliable Call Data*/ offset = dissect_ansi_map_UnreliableCallData(TRUE, tvb, offset, actx, tree, hf_ansi_map_unreliableCallData); break; /* N.S0018 PN-4287*/ /*N.S0004 */ case 88: /*O CalledPartyBusy*/ offset = dissect_ansi_map_OCalledPartyBusy(TRUE, tvb, offset, actx, tree, hf_ansi_map_oCalledPartyBusy); break; case 89: /*O NoAnswer*/ offset = dissect_ansi_map_ONoAnswer(TRUE, tvb, offset, actx, tree, hf_ansi_map_oNoAnswer); break; case 90: /*Position Request*/ offset = dissect_ansi_map_PositionRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_positionRequest); break; case 91: /*Position Request Forward*/ offset = dissect_ansi_map_PositionRequestForward(TRUE, tvb, offset, actx, tree, hf_ansi_map_positionRequestForward); break; /*END N.S0004 */ case 92: /*Call Termination Report*/ offset = dissect_ansi_map_CallTerminationReport(TRUE, tvb, offset, actx, tree, hf_ansi_map_callTerminationReport); break; case 93: /*Geo Position Directive*/ break; case 94: /*Geo Position Request*/ offset = dissect_ansi_map_GeoPositionRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemPositionRequest); break; case 95: /*Inter System Position Request*/ offset = dissect_ansi_map_InterSystemPositionRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemPositionRequest); break; case 96: /*Inter System Position Request Forward*/ offset = dissect_ansi_map_InterSystemPositionRequestForward(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemPositionRequestForward); break; /* 3GPP2 N.S0023-0 */ case 97: /*ACG Directive*/ offset = dissect_ansi_map_ACGDirective(TRUE, tvb, offset, actx, tree, hf_ansi_map_aCGDirective); break; /* END 3GPP2 N.S0023-0 */ case 98: /*Roamer Database Verification Request*/ offset = dissect_ansi_map_RoamerDatabaseVerificationRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_roamerDatabaseVerificationRequest); break; /* N.S0029 X.S0001-A v1.0*/ case 99: /*Add Service*/ offset = dissect_ansi_map_AddService(TRUE, tvb, offset, actx, tree, hf_ansi_map_addService); break; case 100: /*Drop Service*/ offset = dissect_ansi_map_DropService(TRUE, tvb, offset, actx, tree, hf_ansi_map_dropService); break; /*End N.S0029 X.S0001-A v1.0*/ /* X.S0002-0 v1.0 */ /* LCSParameterRequest */ case 101: /* InterSystemSMSPage 101 */ offset = dissect_ansi_map_InterSystemSMSPage(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemSMSPage); break; case 102: offset = dissect_ansi_map_LCSParameterRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_lcsParameterRequest); break; /* CheckMEID X.S0008-0 v1.0*/ case 104: offset = dissect_ansi_map_CheckMEID(TRUE, tvb, offset, actx, tree, hf_ansi_map_checkMEID); break; /* PositionEventNotification */ case 106: offset = dissect_ansi_map_PositionEventNotification(TRUE, tvb, offset, actx, tree, hf_ansi_map_positionEventNotification); break; case 107: /* StatusRequest X.S0008-0 v1.0*/ offset = dissect_ansi_map_StatusRequest(TRUE, tvb, offset, actx, tree, hf_ansi_map_statusRequest); break; /* InterSystemSMSDelivery-PointToPoint 111 X.S0004-540-E v2.0*/ case 111: /* InterSystemSMSDeliveryPointToPoint X.S0004-540-E v2.0 */ offset = dissect_ansi_map_InterSystemSMSDeliveryPointToPoint(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemSMSDeliveryPointToPoint); break; case 112: /* QualificationRequest2 112 X.S0004-540-E v2.0*/ offset = dissect_ansi_map_QualificationRequest2(TRUE, tvb, offset, actx, tree, hf_ansi_map_qualificationRequest2); break; default: proto_tree_add_expert(tree, actx->pinfo, &ei_ansi_map_unknown_invokeData_blob, tvb, offset, -1); opCodeKnown = FALSE; break; } if (opCodeKnown) { tap_p->message_type = OperationCode; tap_p->size = 0; /* should be number of octets in message */ tap_queue_packet(ansi_map_tap, g_pinfo, tap_p); } return offset; } static int dissect_returnData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx) { static gboolean opCodeKnown = TRUE; static ansi_map_tap_rec_t tap_rec[16]; static ansi_map_tap_rec_t *tap_p; static int tap_current=0; /* * set tap record pointer */ tap_current++; if (tap_current == array_length(tap_rec)) { tap_current = 0; } tap_p = &tap_rec[tap_current]; switch(OperationCode){ case 1: /*Handoff Measurement Request*/ offset = dissect_ansi_map_HandoffMeasurementRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffMeasurementRequestRes); break; case 2: /*Facilities Directive*/ offset = dissect_ansi_map_FacilitiesDirectiveRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_facilitiesDirectiveRes); break; case 4: /*Handoff Back*/ offset = dissect_ansi_map_HandoffBackRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffBackRes); break; case 5: /*Facilities Release*/ offset = dissect_ansi_map_FacilitiesReleaseRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_facilitiesReleaseRes); break; case 6: /*Qualification Request*/ offset = dissect_ansi_map_QualificationRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_qualificationRequestRes); break; case 7: /*Qualification Directive*/ offset = dissect_ansi_map_QualificationDirectiveRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_qualificationDirectiveRes); break; case 10: /*Reset Circuit*/ offset = dissect_ansi_map_ResetCircuitRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_resetCircuitRes); break; case 13: /*Registration Notification*/ offset = dissect_ansi_map_RegistrationNotificationRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_registrationNotificationRes); break; case 14: /*Registration Cancellation*/ offset = dissect_ansi_map_RegistrationCancellationRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_registrationCancellationRes); break; case 15: /*Location Request*/ offset = dissect_ansi_map_LocationRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_locationRequestRes); break; case 16: /*Routing Request*/ offset = dissect_ansi_map_RoutingRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_routingRequestRes); break; case 17: /*Feature Request*/ offset = dissect_ansi_map_FeatureRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_featureRequestRes); break; case 23: /*Transfer To Number Request*/ offset = dissect_ansi_map_TransferToNumberRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_transferToNumberRequestRes); break; case 25: /*Handoff To Third*/ offset = dissect_ansi_map_HandoffToThirdRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffToThirdRes); break; case 26: /*Flash Request*/ /* No data */ proto_tree_add_expert(tree, actx->pinfo, &ei_ansi_map_no_data, tvb, offset, -1); break; case 27: /*Authentication Directive*/ offset = dissect_ansi_map_AuthenticationDirectiveRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationDirectiveRes); break; case 28: /*Authentication Request*/ offset = dissect_ansi_map_AuthenticationRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationRequestRes); break; case 29: /*Base Station Challenge*/ offset = dissect_ansi_map_BaseStationChallengeRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_baseStationChallengeRes); break; case 30: /*Authentication Failure Report*/ offset = dissect_ansi_map_AuthenticationFailureReportRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationFailureReportRes); break; case 31: /*Count Request*/ offset = dissect_ansi_map_CountRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_countRequestRes); break; case 32: /*Inter System Page*/ offset = dissect_ansi_map_InterSystemPageRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemPageRes); break; case 33: /*Unsolicited Response*/ offset = dissect_ansi_map_UnsolicitedResponseRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_unsolicitedResponseRes); break; case 35: /*Handoff Measurement Request 2*/ offset = dissect_ansi_map_HandoffMeasurementRequest2Res(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffMeasurementRequest2Res); break; case 36: /*Facilities Directive 2*/ offset = dissect_ansi_map_FacilitiesDirective2Res(TRUE, tvb, offset, actx, tree, hf_ansi_map_facilitiesDirective2Res); break; case 37: /*Handoff Back 2*/ offset = dissect_ansi_map_HandoffBack2Res(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffBack2Res); break; case 38: /*Handoff To Third 2*/ offset = dissect_ansi_map_HandoffToThird2Res(TRUE, tvb, offset, actx, tree, hf_ansi_map_handoffToThird2Res); break; case 39: /*Authentication Directive Forward*/ offset = dissect_ansi_map_AuthenticationDirectiveForwardRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationDirectiveForwardRes); break; case 40: /*Authentication Status Report*/ offset = dissect_ansi_map_AuthenticationStatusReportRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_authenticationStatusReportRes); break; /*Reserved 41*/ case 42: /*Information Directive*/ offset = dissect_ansi_map_InformationDirectiveRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_informationDirectiveRes); break; case 43: /*Information Forward*/ offset = dissect_ansi_map_InformationForwardRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_informationForwardRes); break; case 45: /*Inter System Page 2*/ offset = dissect_ansi_map_InterSystemPage2Res(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemPage2Res); break; case 46: /*Inter System Setup*/ offset = dissect_ansi_map_InterSystemSetupRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemSetupRes); break; case 47: /*OriginationRequest*/ offset = dissect_ansi_map_OriginationRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_originationRequestRes); break; case 48: /*Random Variable Request*/ offset = dissect_ansi_map_RandomVariableRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_randomVariableRequestRes); break; case 50: /*Remote User Interaction Directive*/ offset = dissect_ansi_map_RemoteUserInteractionDirectiveRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_remoteUserInteractionDirectiveRes); break; case 51: /*SMS Delivery Backward*/ offset = dissect_ansi_map_SMSDeliveryBackwardRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSDeliveryBackwardRes); break; case 52: /*SMS Delivery Forward*/ offset = dissect_ansi_map_SMSDeliveryForwardRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSDeliveryForwardRes); break; case 53: /*SMS Delivery Point to Point*/ offset = dissect_ansi_map_SMSDeliveryPointToPointRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSDeliveryPointToPointRes); break; case 54: /*SMS Notification*/ offset = dissect_ansi_map_SMSNotificationRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSNotificationRes); break; case 55: /*SMS Request*/ offset = dissect_ansi_map_SMSRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_sMSRequestRes); break; /* N.S0008-0 v 1.0 */ case 56: /*OTASP Request 6.4.2.CC*/ offset = dissect_ansi_map_OTASPRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_oTASPRequestRes); break; /* 57 Information Backward*/ case 58: /*Change Facilities*/ offset = dissect_ansi_map_ChangeFacilitiesRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_changeFacilitiesRes); break; case 59: /*Change Service*/ offset = dissect_ansi_map_ChangeServiceRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_changeServiceRes); break; case 60: /*Parameter Request*/ offset = dissect_ansi_map_ParameterRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_parameterRequestRes); break; case 61: /*TMSI Directive*/ offset = dissect_ansi_map_TMSIDirectiveRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_tMSIDirectiveRes); break; case 62: /*NumberPortabilityRequest */ offset = dissect_ansi_map_NumberPortabilityRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_numberPortabilityRequestRes); break; case 63: /*Service Request*/ offset = dissect_ansi_map_ServiceRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_serviceRequestRes); break; /* N.S0013 */ case 64: /*Analyzed Information Request*/ offset = dissect_ansi_map_AnalyzedInformationRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_analyzedInformationRes); break; /* 65 Connection Failure Report*/ /* 66 Connect Resource*/ /* 67 Disconnect Resource*/ case 68: /*Facility Selected and Available*/ offset = dissect_ansi_map_FacilitySelectedAndAvailableRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_facilitySelectedAndAvailableRes); break; /* 69 Instruction Request*/ case 70: /*Modify*/ offset = dissect_ansi_map_ModifyRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_modifyRes); break; case 72: /*Search*/ offset = dissect_ansi_map_SearchRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_searchRes); break; case 73: /*Seize Resource*/ offset = dissect_ansi_map_SeizeResourceRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_seizeResourceRes); break; case 74: /*SRF Directive*/ offset = dissect_ansi_map_SRFDirectiveRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_sRFDirectiveRes); break; case 75: /*T Busy*/ offset = dissect_ansi_map_TBusyRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_tBusyRes); break; case 76: /*T NoAnswer*/ offset = dissect_ansi_map_TNoAnswerRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_tNoAnswerRes); break; case 81: /*Call Control Directive*/ offset = dissect_ansi_map_CallControlDirectiveRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_callControlDirectiveRes); break; case 83: /*O Disconnect*/ offset = dissect_ansi_map_ODisconnectRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_oDisconnectRes); break; case 86: /*T Disconnect*/ offset = dissect_ansi_map_TDisconnectRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_tDisconnectRes); break; case 88: /*O CalledPartyBusy*/ offset = dissect_ansi_map_OCalledPartyBusyRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_oCalledPartyBusyRes); break; case 89: /*O NoAnswer*/ offset = dissect_ansi_map_ONoAnswerRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_oNoAnswerRes); break; case 90: /*Position Request*/ offset = dissect_ansi_map_PositionRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_positionRequestRes); break; case 91: /*Position Request Forward*/ offset = dissect_ansi_map_PositionRequestForwardRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_positionRequestForwardRes); break; case 95: /*Inter System Position Request*/ offset = dissect_ansi_map_InterSystemPositionRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemPositionRequestRes); break; case 96: /*Inter System Position Request Forward*/ offset = dissect_ansi_map_InterSystemPositionRequestForwardRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemPositionRequestRes); break; case 98: /*Roamer Database Verification Request*/ offset = dissect_ansi_map_RoamerDatabaseVerificationRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_roamerDatabaseVerificationRequestRes); break; case 99: /*Add Service*/ offset = dissect_ansi_map_AddServiceRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_addServiceRes); break; case 100: /*Drop Service*/ offset = dissect_ansi_map_DropServiceRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_dropServiceRes); break; /*End N.S0029 */ /* X.S0002-0 v1.0 */ /* LCSParameterRequest */ case 102: offset = dissect_ansi_map_LCSParameterRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_lcsParameterRequestRes); break; /* CheckMEID X.S0008-0 v1.0*/ case 104: offset = dissect_ansi_map_CheckMEIDRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_checkMEIDRes); break; /* PositionEventNotification * case 106: offset = dissect_ansi_map_PositionEventNotification(TRUE, tvb, offset, actx, tree, hf_ansi_map_positionEventNotificationRes); break; */ case 107: /* StatusRequest X.S0008-0 v1.0*/ offset = dissect_ansi_map_StatusRequestRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_statusRequestRes); break; case 111: /* InterSystemSMSDeliveryPointToPointRes X.S0004-540-E v2.0 */ offset = dissect_ansi_map_InterSystemSMSDeliveryPointToPointRes(TRUE, tvb, offset, actx, tree, hf_ansi_map_interSystemSMSDeliveryPointToPointRes); break; case 112: /* QualificationRequest2Res 112 X.S0004-540-E v2.0*/ offset = dissect_ansi_map_QualificationRequest2Res(TRUE, tvb, offset, actx, tree, hf_ansi_map_qualificationRequest2Res); break; default: proto_tree_add_expert(tree, actx->pinfo, &ei_ansi_map_unknown_invokeData_blob, tvb, offset, -1); opCodeKnown = FALSE; break; } if (opCodeKnown) { tap_p->message_type = OperationCode; tap_p->size = 0; /* should be number of octets in message */ tap_queue_packet(ansi_map_tap, g_pinfo, tap_p); } return offset; } static int find_saved_invokedata(asn1_ctx_t *actx, struct ansi_tcap_private_t *p_private_tcap){ struct ansi_map_invokedata_t *ansi_map_saved_invokedata; address* src = &(actx->pinfo->src); address* dst = &(actx->pinfo->dst); guint8 *src_str; guint8 *dst_str; char *buf; buf=(char *)wmem_alloc(wmem_packet_scope(), 1024); /* Data from the TCAP dissector */ /* The hash string needs to contain src and dest to distiguish differnt flows */ src_str = address_to_str(wmem_packet_scope(), src); dst_str = address_to_str(wmem_packet_scope(), dst); /* Reverse order to invoke */ switch(ansi_map_response_matching_type){ case ANSI_MAP_TID_ONLY: g_snprintf(buf,1024,"%s",p_private_tcap->TransactionID_str); break; case ANSI_MAP_TID_AND_SOURCE: g_snprintf(buf,1024,"%s%s",p_private_tcap->TransactionID_str,dst_str); break; case ANSI_MAP_TID_SOURCE_AND_DEST: default: g_snprintf(buf,1024,"%s%s%s",p_private_tcap->TransactionID_str,dst_str,src_str); break; } /*g_warning("Find Hash string %s pkt: %u",buf,actx->pinfo->num);*/ ansi_map_saved_invokedata = (struct ansi_map_invokedata_t *)wmem_map_lookup(TransactionId_table, buf); if(ansi_map_saved_invokedata){ OperationCode = ansi_map_saved_invokedata->opcode & 0xff; ServiceIndicator = ansi_map_saved_invokedata->ServiceIndicator; }else{ OperationCode = OperationCode & 0x00ff; } return OperationCode; } static int dissect_ansi_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { proto_item *ansi_map_item; proto_tree *ansi_map_tree = NULL; struct ansi_tcap_private_t *p_private_tcap = (struct ansi_tcap_private_t *)data; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); SMS_BearerData_tvb = NULL; ansi_map_sms_tele_id = -1; g_pinfo = pinfo; g_tree = tree; /* The TCAP dissector should have provided data but didn't so reject it. */ if (data == NULL) return 0; /* * Make entry in the Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "ANSI MAP"); /* * create the ansi_map protocol tree */ ansi_map_item = proto_tree_add_item(tree, proto_ansi_map, tvb, 0, -1, ENC_NA); ansi_map_tree = proto_item_add_subtree(ansi_map_item, ett_ansi_map); ansi_map_is_invoke = FALSE; is683_ota = FALSE; is801_pld = FALSE; ServiceIndicator = 0; switch(p_private_tcap->d.pdu){ /* 1 : invoke, 2 : returnResult, 3 : returnError, 4 : reject */ case 1: OperationCode = p_private_tcap->d.OperationCode_private & 0x00ff; ansi_map_is_invoke = TRUE; col_add_fstr(pinfo->cinfo, COL_INFO,"%s Invoke ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)")); proto_item_append_text(p_private_tcap->d.OperationCode_item," %s",val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)")); dissect_invokeData(ansi_map_tree, tvb, 0, &asn1_ctx); update_saved_invokedata(pinfo, p_private_tcap); break; case 2: OperationCode = find_saved_invokedata(&asn1_ctx, p_private_tcap); col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnResult ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)")); proto_item_append_text(p_private_tcap->d.OperationCode_item," %s",val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)")); dissect_returnData(ansi_map_tree, tvb, 0, &asn1_ctx); break; case 3: col_add_fstr(pinfo->cinfo, COL_INFO,"%s ReturnError ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)")); break; case 4: col_add_fstr(pinfo->cinfo, COL_INFO,"%s Reject ", val_to_str_ext(OperationCode, &ansi_map_opr_code_strings_ext, "Unknown ANSI-MAP PDU (%u)")); break; default: /* Must be Invoke ReturnResult ReturnError or Reject */ DISSECTOR_ASSERT_NOT_REACHED(); break; } return tvb_captured_length(tvb); } static void range_delete_callback(guint32 ssn, gpointer ptr _U_) { if (ssn) { delete_ansi_tcap_subdissector(ssn, ansi_map_handle); } } static void range_add_callback(guint32 ssn, gpointer ptr _U_) { if (ssn) { add_ansi_tcap_subdissector(ssn, ansi_map_handle); } } /* TAP STAT INFO */ typedef enum { OPCODE_COLUMN = 0, OPERATION_COLUMN, COUNT_COLUMN, TOTAL_BYTES_COLUMN, AVG_BYTES_COLUMN } ansi_map_stat_columns; static stat_tap_table_item stat_fields[] = {{TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "OpCode", "0x%02x"}, {TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "Operation Name", "%-50s"}, {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Count", " %d "}, {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Total Bytes", " %d "}, {TABLE_ITEM_FLOAT, TAP_ALIGN_RIGHT, "Avg Bytes", " %8.2f "}}; static void ansi_map_stat_init(stat_tap_table_ui* new_stat) { int num_fields = sizeof(stat_fields)/sizeof(stat_tap_table_item); stat_tap_table* table = stat_tap_init_table("ANSI MAP Operation Statistics", num_fields, 0, "ansi_map.op_code"); int i = 0; stat_tap_table_item_type items[sizeof(stat_fields)/sizeof(stat_tap_table_item)]; stat_tap_add_table(new_stat, table); /* Add a fow for each value type */ while (ansi_map_opr_code_strings[i].strptr) { items[OPCODE_COLUMN].type = TABLE_ITEM_UINT; items[OPCODE_COLUMN].value.uint_value = ansi_map_opr_code_strings[i].value; items[OPERATION_COLUMN].type = TABLE_ITEM_STRING; items[OPERATION_COLUMN].value.string_value = ansi_map_opr_code_strings[i].strptr; items[COUNT_COLUMN].type = TABLE_ITEM_UINT; items[COUNT_COLUMN].value.uint_value = 0; items[TOTAL_BYTES_COLUMN].type = TABLE_ITEM_UINT; items[TOTAL_BYTES_COLUMN].value.uint_value = 0; items[AVG_BYTES_COLUMN].type = TABLE_ITEM_FLOAT; items[AVG_BYTES_COLUMN].value.float_value = 0.0f; stat_tap_init_table_row(table, ansi_map_opr_code_strings[i].value, num_fields, items); i++; } } static tap_packet_status ansi_map_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *data) { stat_data_t* stat_data = (stat_data_t*)tapdata; const ansi_map_tap_rec_t *data_p = (const ansi_map_tap_rec_t *)data; stat_tap_table* table; stat_tap_table_item_type* item_data; guint i = 0, count, total_bytes; /* Only tracking field values we know */ if (try_val_to_str(data_p->message_type, ansi_map_opr_code_strings) == NULL) return TAP_PACKET_DONT_REDRAW; table = g_array_index(stat_data->stat_tap_data->tables, stat_tap_table*, i); item_data = stat_tap_get_field_data(table, data_p->message_type, COUNT_COLUMN); item_data->value.uint_value++; count = item_data->value.uint_value; stat_tap_set_field_data(table, data_p->message_type, COUNT_COLUMN, item_data); item_data = stat_tap_get_field_data(table, data_p->message_type, TOTAL_BYTES_COLUMN); item_data->value.uint_value += data_p->size; total_bytes = item_data->value.uint_value; stat_tap_set_field_data(table, data_p->message_type, TOTAL_BYTES_COLUMN, item_data); item_data = stat_tap_get_field_data(table, data_p->message_type, AVG_BYTES_COLUMN); item_data->value.float_value = (float)total_bytes/(float)count; stat_tap_set_field_data(table, data_p->message_type, AVG_BYTES_COLUMN, item_data); return TAP_PACKET_REDRAW; } static void ansi_map_stat_reset(stat_tap_table* table) { guint element; stat_tap_table_item_type* item_data; for (element = 0; element < table->num_elements; element++) { item_data = stat_tap_get_field_data(table, element, COUNT_COLUMN); item_data->value.uint_value = 0; stat_tap_set_field_data(table, element, COUNT_COLUMN, item_data); item_data = stat_tap_get_field_data(table, element, TOTAL_BYTES_COLUMN); item_data->value.uint_value = 0; stat_tap_set_field_data(table, element, TOTAL_BYTES_COLUMN, item_data); item_data = stat_tap_get_field_data(table, element, AVG_BYTES_COLUMN); item_data->value.float_value = 0.0f; stat_tap_set_field_data(table, element, AVG_BYTES_COLUMN, item_data); } } void proto_reg_handoff_ansi_map(void) { static gboolean ansi_map_prefs_initialized = FALSE; static range_t *ssn_range; if(!ansi_map_prefs_initialized) { ansi_map_prefs_initialized = TRUE; } else { range_foreach(ssn_range, range_delete_callback, NULL); wmem_free(wmem_epan_scope(), ssn_range); } ssn_range = range_copy(wmem_epan_scope(), global_ssn_range); range_foreach(ssn_range, range_add_callback, NULL); } /*--- proto_register_ansi_map -------------------------------------------*/ void proto_register_ansi_map(void) { module_t *ansi_map_module; /* List of fields */ static hf_register_info hf[] = { { &hf_ansi_map_op_code_fam, { "Operation Code Family", "ansi_map.op_code_fam", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_ansi_map_reservedBitH, { "Reserved", "ansi_map.reserved_bitH", FT_BOOLEAN, 8, NULL,0x80, NULL, HFILL }}, { &hf_ansi_map_reservedBitD, { "Reserved", "ansi_map.reserved_bitD", FT_BOOLEAN, 8, NULL,0x08, NULL, HFILL }}, { &hf_ansi_map_reservedBitHG, { "Reserved", "ansi_map.reserved_bitHG", FT_UINT8, BASE_DEC, NULL, 0xc0, NULL, HFILL }}, { &hf_ansi_map_reservedBitHGFE, { "Reserved", "ansi_map.reserved_bitHGFE", FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }}, { &hf_ansi_map_reservedBitFED, { "Reserved", "ansi_map.reserved_bitFED", FT_UINT8, BASE_DEC, NULL, 0x38, NULL, HFILL }}, { &hf_ansi_map_reservedBitED, { "Reserved", "ansi_map.reserved_bitED", FT_UINT8, BASE_DEC, NULL, 0x18, NULL, HFILL }}, { &hf_ansi_map_op_code, { "Operation Code", "ansi_map.op_code", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ansi_map_opr_code_strings_ext, 0x0, NULL, HFILL }}, { &hf_ansi_map_type_of_digits, { "Type of Digits", "ansi_map.type_of_digits", FT_UINT8, BASE_DEC, VALS(ansi_map_type_of_digits_vals), 0x0, NULL, HFILL }}, { &hf_ansi_map_na, { "Nature of Number", "ansi_map.na", FT_BOOLEAN, 8, TFS(&ansi_map_na_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_pi, { "Presentation Indication", "ansi_map.type_of_pi", FT_BOOLEAN, 8, TFS(&ansi_map_pi_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_navail, { "Number available indication", "ansi_map.navail", FT_BOOLEAN, 8, TFS(&ansi_map_navail_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_si, { "Screening indication", "ansi_map.si", FT_UINT8, BASE_DEC, VALS(ansi_map_si_vals), 0x30, NULL, HFILL }}, { &hf_ansi_map_digits_enc, { "Encoding", "ansi_map.enc", FT_UINT8, BASE_DEC, VALS(ansi_map_digits_enc_vals), 0x0f, NULL, HFILL }}, { &hf_ansi_map_np, { "Numbering Plan", "ansi_map.np", FT_UINT8, BASE_DEC, VALS(ansi_map_np_vals), 0xf0, NULL, HFILL }}, { &hf_ansi_map_nr_digits, { "Number of Digits", "ansi_map.nr_digits", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ansi_map_bcd_digits, { "BCD digits", "ansi_map.bcd_digits", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_ansi_map_ia5_digits, { "IA5 digits", "ansi_map.ia5_digits", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_ansi_map_subaddr_type, { "Type of Subaddress", "ansi_map.subaddr_type", FT_UINT8, BASE_DEC, VALS(ansi_map_sub_addr_type_vals), 0x70, NULL, HFILL }}, { &hf_ansi_map_subaddr_odd_even, { "Odd/Even Indicator", "ansi_map.subaddr_odd_even", FT_BOOLEAN, 8, TFS(&ansi_map_navail_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_alertcode_cadence, { "Cadence", "ansi_map.alertcode.cadence", FT_UINT8, BASE_DEC, VALS(ansi_map_AlertCode_Cadence_vals), 0x3f, NULL, HFILL }}, { &hf_ansi_alertcode_pitch, { "Pitch", "ansi_map.alertcode.pitch", FT_UINT8, BASE_DEC, VALS(ansi_map_AlertCode_Pitch_vals), 0xc0, NULL, HFILL }}, { &hf_ansi_alertcode_alertaction, { "Alert Action", "ansi_map.alertcode.alertaction", FT_UINT8, BASE_DEC, VALS(ansi_map_AlertCode_Alert_Action_vals), 0x07, NULL, HFILL }}, { &hf_ansi_map_announcementcode_tone, { "Tone", "ansi_map.announcementcode.tone", FT_UINT8, BASE_DEC, VALS(ansi_map_AnnouncementCode_tone_vals), 0x0, NULL, HFILL }}, { &hf_ansi_map_announcementcode_class, { "Tone", "ansi_map.announcementcode.class", FT_UINT8, BASE_DEC, VALS(ansi_map_AnnouncementCode_class_vals), 0xf, NULL, HFILL }}, { &hf_ansi_map_announcementcode_std_ann, { "Standard Announcement", "ansi_map.announcementcode.std_ann", FT_UINT8, BASE_DEC, VALS(ansi_map_AnnouncementCode_std_ann_vals), 0x0, NULL, HFILL }}, { &hf_ansi_map_announcementcode_cust_ann, { "Custom Announcement", "ansi_map.announcementcode.cust_ann", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ansi_map_authorizationperiod_period, { "Period", "ansi_map.authorizationperiod.period", FT_UINT8, BASE_DEC, VALS(ansi_map_authorizationperiod_period_vals), 0x0, NULL, HFILL }}, { &hf_ansi_map_value, { "Value", "ansi_map.value", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ansi_map_msc_type, { "Type", "ansi_map.extendedmscid.type", FT_UINT8, BASE_DEC, VALS(ansi_map_msc_type_vals), 0x0, NULL, HFILL }}, { &hf_ansi_map_handoffstate_pi, { "Party Involved (PI)", "ansi_map.handoffstate.pi", FT_BOOLEAN, 8, TFS(&ansi_map_HandoffState_pi_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_tgn, { "Trunk Group Number (G)", "ansi_map.tgn", FT_UINT8, BASE_DEC, NULL,0x0, NULL, HFILL }}, { &hf_ansi_map_tmn, { "Trunk Member Number (M)", "ansi_map.tmn", FT_UINT8, BASE_DEC, NULL,0x0, NULL, HFILL }}, { &hf_ansi_map_messagewaitingnotificationcount_tom, { "Type of messages", "ansi_map.messagewaitingnotificationcount.tom", FT_UINT8, BASE_DEC, VALS(ansi_map_MessageWaitingNotificationCount_type_vals), 0x0, NULL, HFILL }}, { &hf_ansi_map_messagewaitingnotificationcount_no_mw, { "Number of Messages Waiting", "ansi_map.messagewaitingnotificationcount.nomw", FT_UINT8, BASE_DEC, NULL,0x0, NULL, HFILL }}, { &hf_ansi_map_messagewaitingnotificationtype_mwi, { "Message Waiting Indication (MWI)", "ansi_map.messagewaitingnotificationcount.mwi", FT_UINT8, BASE_DEC, VALS(ansi_map_MessageWaitingNotificationType_mwi_vals), 0x0, NULL, HFILL }}, { &hf_ansi_map_messagewaitingnotificationtype_apt, { "Alert Pip Tone (APT)", "ansi_map.messagewaitingnotificationtype.apt", FT_BOOLEAN, 8, TFS(&ansi_map_HandoffState_pi_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_messagewaitingnotificationtype_pt, { "Pip Tone (PT)", "ansi_map.messagewaitingnotificationtype.pt", FT_UINT8, BASE_DEC, VALS(ansi_map_MessageWaitingNotificationType_mwi_vals), 0xc0, NULL, HFILL }}, { &hf_ansi_map_trans_cap_prof, { "Profile (PROF)", "ansi_map.trans_cap_prof", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_prof_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_trans_cap_busy, { "Busy Detection (BUSY)", "ansi_map.trans_cap_busy", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_busy_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_trans_cap_ann, { "Announcements (ANN)", "ansi_map.trans_cap_ann", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_ann_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_trans_cap_rui, { "Remote User Interaction (RUI)", "ansi_map.trans_cap_rui", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_rui_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_trans_cap_spini, { "Subscriber PIN Intercept (SPINI)", "ansi_map.trans_cap_spini", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_spini_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_trans_cap_uzci, { "UZ Capability Indicator (UZCI)", "ansi_map.trans_cap_uzci", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_uzci_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_trans_cap_ndss, { "NDSS Capability (NDSS)", "ansi_map.trans_cap_ndss", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_ndss_bool_val),0x40, NULL, HFILL }}, { &hf_ansi_map_trans_cap_nami, { "NAME Capability Indicator (NAMI)", "ansi_map.trans_cap_nami", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_nami_bool_val),0x80, NULL, HFILL }}, { &hf_ansi_trans_cap_multerm, { "Multiple Terminations", "ansi_map.trans_cap_multerm", FT_UINT8, BASE_DEC, VALS(ansi_map_trans_cap_multerm_vals), 0x0f, NULL, HFILL }}, { &hf_ansi_map_terminationtriggers_busy, { "Busy", "ansi_map.terminationtriggers.busy", FT_UINT8, BASE_DEC, VALS(ansi_map_terminationtriggers_busy_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_terminationtriggers_rf, { "Routing Failure (RF)", "ansi_map.terminationtriggers.rf", FT_UINT8, BASE_DEC, VALS(ansi_map_terminationtriggers_rf_vals), 0x0c, NULL, HFILL }}, { &hf_ansi_map_terminationtriggers_npr, { "No Page Response (NPR)", "ansi_map.terminationtriggers.npr", FT_UINT8, BASE_DEC, VALS(ansi_map_terminationtriggers_npr_vals), 0x30, NULL, HFILL }}, { &hf_ansi_map_terminationtriggers_na, { "No Answer (NA)", "ansi_map.terminationtriggers.na", FT_UINT8, BASE_DEC, VALS(ansi_map_terminationtriggers_na_vals), 0xc0, NULL, HFILL }}, { &hf_ansi_map_terminationtriggers_nr, { "None Reachable (NR)", "ansi_map.terminationtriggers.nr", FT_UINT8, BASE_DEC, VALS(ansi_map_terminationtriggers_nr_vals), 0x01, NULL, HFILL }}, { &hf_ansi_trans_cap_tl, { "TerminationList (TL)", "ansi_map.trans_cap_tl", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_tl_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_cdmaserviceoption, { "CDMAServiceOption", "ansi_map.cdmaserviceoption", FT_UINT16, BASE_RANGE_STRING | BASE_DEC, RVALS(cdmaserviceoption_vals), 0x0, NULL, HFILL }}, { &hf_ansi_trans_cap_waddr, { "WIN Addressing (WADDR)", "ansi_map.trans_cap_waddr", FT_BOOLEAN, 8, TFS(&ansi_map_trans_cap_waddr_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_MarketID, { "MarketID", "ansi_map.marketid", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_ansi_map_swno, { "Switch Number (SWNO)", "ansi_map.swno", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_ansi_map_idno, { "ID Number", "ansi_map.idno", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_ansi_map_segcount, { "Segment Counter", "ansi_map.segcount", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_ansi_map_sms_originationrestrictions_direct, { "DIRECT", "ansi_map.originationrestrictions.direct", FT_BOOLEAN, 8, TFS(&ansi_map_SMS_OriginationRestrictions_direct_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_sms_originationrestrictions_default, { "DEFAULT", "ansi_map.originationrestrictions.default", FT_UINT8, BASE_DEC, VALS(ansi_map_SMS_OriginationRestrictions_default_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_sms_originationrestrictions_fmc, { "Force Message Center (FMC)", "ansi_map.originationrestrictions.fmc", FT_BOOLEAN, 8, TFS(&ansi_map_SMS_OriginationRestrictions_fmc_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_systemcapabilities_auth, { "Authentication Parameters Requested (AUTH)", "ansi_map.systemcapabilities.auth", FT_BOOLEAN, 8, TFS(&ansi_map_systemcapabilities_auth_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_systemcapabilities_se, { "Signaling Message Encryption Capable (SE )", "ansi_map.systemcapabilities.se", FT_BOOLEAN, 8, TFS(&ansi_map_systemcapabilities_se_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_systemcapabilities_vp, { "Voice Privacy Capable (VP )", "ansi_map.systemcapabilities.vp", FT_BOOLEAN, 8, TFS(&ansi_map_systemcapabilities_vp_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_systemcapabilities_cave, { "CAVE Algorithm Capable (CAVE)", "ansi_map.systemcapabilities.cave", FT_BOOLEAN, 8, TFS(&ansi_map_systemcapabilities_cave_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_systemcapabilities_ssd, { "Shared SSD (SSD)", "ansi_map.systemcapabilities.ssd", FT_BOOLEAN, 8, TFS(&ansi_map_systemcapabilities_ssd_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_systemcapabilities_dp, { "Data Privacy (DP)", "ansi_map.systemcapabilities.dp", FT_BOOLEAN, 8, TFS(&ansi_map_systemcapabilities_dp_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_mslocation_lat, { "Latitude in tenths of a second", "ansi_map.mslocation.lat", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_ansi_map_mslocation_long, { "Longitude in tenths of a second", "ansi_map.mslocation.long", FT_UINT8, BASE_DEC, NULL, 0, "Switch Number (SWNO)", HFILL }}, { &hf_ansi_map_mslocation_res, { "Resolution in units of 1 foot", "ansi_map.mslocation.res", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_ansi_map_nampscallmode_namps, { "Call Mode", "ansi_map.nampscallmode.namps", FT_BOOLEAN, 8, TFS(&ansi_map_CallMode_namps_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_nampscallmode_amps, { "Call Mode", "ansi_map.nampscallmode.amps", FT_BOOLEAN, 8, TFS(&ansi_map_CallMode_amps_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_nampschanneldata_navca, { "Narrow Analog Voice Channel Assignment (NAVCA)", "ansi_map.nampschanneldata.navca", FT_UINT8, BASE_DEC, VALS(ansi_map_NAMPSChannelData_navca_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_nampschanneldata_CCIndicator, { "Color Code Indicator (CCIndicator)", "ansi_map.nampschanneldata.ccindicator", FT_UINT8, BASE_DEC, VALS(ansi_map_NAMPSChannelData_ccinidicator_vals), 0x1c, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cfufa, { "Call Forwarding Unconditional FeatureActivity, CFU-FA", "ansi_map.callingfeaturesindicator.cfufa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cfbfa, { "Call Forwarding Busy FeatureActivity, CFB-FA", "ansi_map.callingfeaturesindicator.cfbafa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x0c, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cfnafa, { "Call Forwarding No Answer FeatureActivity, CFNA-FA", "ansi_map.callingfeaturesindicator.cfnafa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x30, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cwfa, { "Call Waiting: FeatureActivity, CW-FA", "ansi_map.callingfeaturesindicator.cwfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0xc0, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_3wcfa, { "Three-Way Calling FeatureActivity, 3WC-FA", "ansi_map.callingfeaturesindicator.3wcfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_pcwfa, { "Priority Call Waiting FeatureActivity PCW-FA", "ansi_map.callingfeaturesindicator.pcwfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_dpfa, { "Data Privacy Feature Activity DP-FA", "ansi_map.callingfeaturesindicator.dpfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x0c, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_ahfa, { "Answer Hold: FeatureActivity AH-FA", "ansi_map.callingfeaturesindicator.ahfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x30, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_uscfvmfa, { "USCF divert to voice mail: FeatureActivity USCFvm-FA", "ansi_map.callingfeaturesindicator.uscfvmfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0xc0, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_uscfmsfa, { "USCF divert to mobile station provided DN:FeatureActivity.USCFms-FA", "ansi_map.callingfeaturesindicator.uscfmsfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_uscfnrfa, { "USCF divert to network registered DN:FeatureActivity. USCFnr-FA", "ansi_map.callingfeaturesindicator.uscfnrfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x0c, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cpdsfa, { "CDMA-Packet Data Service: FeatureActivity. CPDS-FA", "ansi_map.callingfeaturesindicator.cpdfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x30, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_ccsfa, { "CDMA-Concurrent Service:FeatureActivity. CCS-FA", "ansi_map.callingfeaturesindicator.ccsfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0xc0, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_epefa, { "TDMA Enhanced Privacy and Encryption:FeatureActivity.TDMA EPE-FA", "ansi_map.callingfeaturesindicator.epefa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cdfa, { "Call Delivery: FeatureActivity, CD-FA", "ansi_map.callingfeaturesindicator.cdfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x0c, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_vpfa, { "Voice Privacy FeatureActivity, VP-FA", "ansi_map.callingfeaturesindicator.vpfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x30, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_ctfa, { "Call Transfer: FeatureActivity, CT-FA", "ansi_map.callingfeaturesindicator.ctfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0xc0, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cnip1fa, { "One number (network-provided only) Calling Number Identification Presentation: FeatureActivity CNIP1-FA", "ansi_map.callingfeaturesindicator.cnip1fa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cnip2fa, { "Two number (network-provided and user-provided) Calling Number Identification Presentation: FeatureActivity CNIP2-FA", "ansi_map.callingfeaturesindicator.cnip2fa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x0c, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cnirfa, { "Calling Number Identification Restriction: FeatureActivity CNIR-FA", "ansi_map.callingfeaturesindicator.cnirfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0x30, NULL, HFILL }}, { &hf_ansi_map_callingfeaturesindicator_cniroverfa, { "Calling Number Identification Restriction Override FeatureActivity CNIROver-FA", "ansi_map.callingfeaturesindicator.cniroverfa", FT_UINT8, BASE_DEC, VALS(ansi_map_FeatureActivity_vals), 0xc0, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cdma, { "Call Mode", "ansi_map.cdmacallmode.cdma", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cdma_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_amps, { "Call Mode", "ansi_map.cdmacallmode.amps", FT_BOOLEAN, 8, TFS(&ansi_map_CallMode_amps_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_namps, { "Call Mode", "ansi_map.cdmacallmode.namps", FT_BOOLEAN, 8, TFS(&ansi_map_CallMode_namps_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls1, { "Call Mode", "ansi_map.cdmacallmode.cls1", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls1_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls2, { "Call Mode", "ansi_map.cdmacallmode.cls2", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls2_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls3, { "Call Mode", "ansi_map.cdmacallmode.cls3", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls3_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls4, { "Call Mode", "ansi_map.cdmacallmode.cls4", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls4_bool_val),0x40, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls5, { "Call Mode", "ansi_map.cdmacallmode.cls5", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls5_bool_val),0x80, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls6, { "Call Mode", "ansi_map.cdmacallmode.cls6", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls6_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls7, { "Call Mode", "ansi_map.cdmacallmode.cls7", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls7_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls8, { "Call Mode", "ansi_map.cdmacallmode.cls8", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls8_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls9, { "Call Mode", "ansi_map.cdmacallmode.cls9", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls9_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_cdmacallmode_cls10, { "Call Mode", "ansi_map.cdmacallmode.cls10", FT_BOOLEAN, 8, TFS(&ansi_map_CDMACallMode_cls10_bool_val),0x10, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_Frame_Offset, { "Frame Offset", "ansi_map.cdmachanneldata.frameoffset", FT_UINT8, BASE_DEC, NULL, 0x78, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_CDMA_ch_no, { "CDMA Channel Number", "ansi_map.cdmachanneldata.cdma_ch_no", FT_UINT16, BASE_DEC, NULL, 0x07FF, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_band_cls, { "Band Class", "ansi_map.cdmachanneldata.band_cls", FT_UINT8, BASE_DEC, VALS(ansi_map_cdmachanneldata_band_cls_vals), 0x7c, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_lc_mask_b6, { "Long Code Mask (byte 6) MSB", "ansi_map.cdmachanneldata.lc_mask_b6", FT_UINT8, BASE_HEX, NULL, 0x03, "Long Code Mask MSB (byte 6)", HFILL }}, {&hf_ansi_map_cdmachanneldata_lc_mask_b5, { "Long Code Mask (byte 5)", "ansi_map.cdmachanneldata.lc_mask_b5", FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_lc_mask_b4, { "Long Code Mask (byte 4)", "ansi_map.cdmachanneldata.lc_mask_b4", FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_lc_mask_b3, { "Long Code Mask (byte 3)", "ansi_map.cdmachanneldata.lc_mask_b3", FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_lc_mask_b2, { "Long Code Mask (byte 2)", "ansi_map.cdmachanneldata.lc_mask_b2", FT_UINT8, BASE_HEX, NULL, 0xff, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_lc_mask_b1, { "Long Code Mask LSB(byte 1)", "ansi_map.cdmachanneldata.lc_mask_b1", FT_UINT8, BASE_HEX, NULL, 0xff, "Long Code Mask (byte 1)LSB", HFILL }}, {&hf_ansi_map_cdmachanneldata_np_ext, { "NP EXT", "ansi_map.cdmachanneldata.np_ext", FT_BOOLEAN, 8, NULL,0x80, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_nominal_pwr, { "Nominal Power", "ansi_map.cdmachanneldata.nominal_pwr", FT_UINT8, BASE_DEC, NULL, 0x71, NULL, HFILL }}, {&hf_ansi_map_cdmachanneldata_nr_preamble, { "Number Preamble", "ansi_map.cdmachanneldata.nr_preamble", FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL }}, { &hf_ansi_map_cdmastationclassmark_pc, { "Power Class(PC)", "ansi_map.cdmastationclassmark.pc", FT_UINT8, BASE_DEC, VALS(ansi_map_CDMAStationClassMark_pc_vals), 0x03, NULL, HFILL }}, { &hf_ansi_map_cdmastationclassmark_dtx, { "Analog Transmission: (DTX)", "ansi_map.cdmastationclassmark.dtx", FT_BOOLEAN, 8, TFS(&ansi_map_CDMAStationClassMark_dtx_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_cdmastationclassmark_smi, { "Slotted Mode Indicator: (SMI)", "ansi_map.cdmastationclassmark.smi", FT_BOOLEAN, 8, TFS(&ansi_map_CDMAStationClassMark_smi_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_cdmastationclassmark_dmi, { "Dual-mode Indicator(DMI)", "ansi_map.cdmastationclassmark.dmi", FT_BOOLEAN, 8, TFS(&ansi_map_CDMAStationClassMark_dmi_bool_val),0x40, NULL, HFILL }}, { &hf_ansi_map_channeldata_vmac, { "Voice Mobile Attenuation Code (VMAC)", "ansi_map.channeldata.vmac", FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL }}, { &hf_ansi_map_channeldata_dtx, { "Discontinuous Transmission Mode (DTX)", "ansi_map.channeldata.dtx", FT_UINT8, BASE_DEC, VALS(ansi_map_ChannelData_dtx_vals), 0x18, NULL, HFILL }}, { &hf_ansi_map_channeldata_scc, { "SAT Color Code (SCC)", "ansi_map.channeldata.scc", FT_UINT8, BASE_DEC, NULL, 0xc0, NULL, HFILL }}, { &hf_ansi_map_channeldata_chno, { "Channel Number (CHNO)", "ansi_map.channeldata.chno", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ansi_map_ConfidentialityModes_vp, { "Voice Privacy (VP) Confidentiality Status", "ansi_map.confidentialitymodes.vp", FT_BOOLEAN, 8, TFS(&ansi_map_ConfidentialityModes_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_controlchanneldata_dcc, { "Digital Color Code (DCC)", "ansi_map.controlchanneldata.dcc", FT_UINT8, BASE_DEC, NULL, 0xc0, NULL, HFILL }}, { &hf_ansi_map_controlchanneldata_cmac, { "Control Mobile Attenuation Code (CMAC)", "ansi_map.controlchanneldata.cmac", FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL }}, { &hf_ansi_map_controlchanneldata_chno, { "Channel Number (CHNO)", "ansi_map.controlchanneldata.chno", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ansi_map_controlchanneldata_sdcc1, { "Supplementary Digital Color Codes (SDCC1)", "ansi_map.controlchanneldata.ssdc1", FT_UINT8, BASE_DEC, NULL, 0x0c, NULL, HFILL }}, { &hf_ansi_map_controlchanneldata_sdcc2, { "Supplementary Digital Color Codes (SDCC2)", "ansi_map.controlchanneldata.ssdc2", FT_UINT8, BASE_DEC, NULL, 0x03, NULL, HFILL }}, { &hf_ansi_map_ConfidentialityModes_se, { "Signaling Message Encryption (SE) Confidentiality Status", "ansi_map.confidentialitymodes.se", FT_BOOLEAN, 8, TFS(&ansi_map_ConfidentialityModes_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_ConfidentialityModes_dp, { "DataPrivacy (DP) Confidentiality Status", "ansi_map.confidentialitymodes.dp", FT_BOOLEAN, 8, TFS(&ansi_map_ConfidentialityModes_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_deniedauthorizationperiod_period, { "Period", "ansi_map.deniedauthorizationperiod.period", FT_UINT8, BASE_DEC, VALS(ansi_map_deniedauthorizationperiod_period_vals), 0x0, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_all, { "All Origination (All)", "ansi_map.originationtriggers.all", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_all_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_local, { "Local", "ansi_map.originationtriggers.local", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_local_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_ilata, { "Intra-LATA Toll (ILATA)", "ansi_map.originationtriggers.ilata", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_ilata_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_olata, { "Inter-LATA Toll (OLATA)", "ansi_map.originationtriggers.olata", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_olata_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_int, { "International (Int'l )", "ansi_map.originationtriggers.int", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_int_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_wz, { "World Zone (WZ)", "ansi_map.originationtriggers.wz", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_wz_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_unrec, { "Unrecognized Number (Unrec)", "ansi_map.originationtriggers.unrec", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_unrec_bool_val),0x40, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_rvtc, { "Revertive Call (RvtC)", "ansi_map.originationtriggers.rvtc", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_rvtc_bool_val),0x80, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_star, { "Star", "ansi_map.originationtriggers.star", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_star_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_ds, { "Double Star (DS)", "ansi_map.originationtriggers.ds", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_ds_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_pound, { "Pound", "ansi_map.originationtriggers.pound", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_pound_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_dp, { "Double Pound (DP)", "ansi_map.originationtriggers.dp", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_dp_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_pa, { "Prior Agreement (PA)", "ansi_map.originationtriggers.pa", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_pa_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_nodig, { "No digits", "ansi_map.originationtriggers.nodig", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_nodig_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_onedig, { "1 digit", "ansi_map.originationtriggers.onedig", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_onedig_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_twodig, { "2 digits", "ansi_map.originationtriggers.twodig", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_twodig_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_threedig, { "3 digits", "ansi_map.originationtriggers.threedig", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_threedig_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_fourdig, { "4 digits", "ansi_map.originationtriggers.fourdig", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_fourdig_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_fivedig, { "5 digits", "ansi_map.originationtriggers.fivedig", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_fivedig_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_sixdig, { "6 digits", "ansi_map.originationtriggers.sixdig", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_sixdig_bool_val),0x40, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_sevendig, { "7 digits", "ansi_map.originationtriggers.sevendig", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_sevendig_bool_val),0x80, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_eightdig, { "8 digits", "ansi_map.originationtriggers.eight", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_eightdig_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_ninedig, { "9 digits", "ansi_map.originationtriggers.nine", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_ninedig_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_tendig, { "10 digits", "ansi_map.originationtriggers.ten", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_tendig_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_elevendig, { "11 digits", "ansi_map.originationtriggers.eleven", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_elevendig_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_twelvedig, { "12 digits", "ansi_map.originationtriggers.twelve", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_twelvedig_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_thirteendig, { "13 digits", "ansi_map.originationtriggers.thirteen", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_thirteendig_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_fourteendig, { "14 digits", "ansi_map.originationtriggers.fourteen", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_fourteendig_bool_val),0x40, NULL, HFILL }}, { &hf_ansi_map_originationtriggers_fifteendig, { "15 digits", "ansi_map.originationtriggers.fifteen", FT_BOOLEAN, 8, TFS(&ansi_map_originationtriggers_fifteendig_bool_val),0x80, NULL, HFILL }}, { &hf_ansi_map_triggercapability_init, { "Introducing Star/Pound (INIT)", "ansi_map.triggercapability.init", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_triggercapability_kdigit, { "K-digit (K-digit)", "ansi_map.triggercapability.kdigit", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_triggercapability_all, { "All_Calls (All)", "ansi_map.triggercapability.all", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_triggercapability_rvtc, { "Revertive_Call (RvtC)", "ansi_map.triggercapability.rvtc", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_triggercapability_oaa, { "Origination_Attempt_Authorized (OAA)", "ansi_map.triggercapability.oaa", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_triggercapability_oans, { "O_Answer (OANS)", "ansi_map.triggercapability.oans", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_triggercapability_odisc, { "O_Disconnect (ODISC)", "ansi_map.triggercapability.odisc", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x40, NULL, HFILL }}, { &hf_ansi_map_triggercapability_ona, { "O_No_Answer (ONA)", "ansi_map.triggercapability.ona", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x80, NULL, HFILL }}, { &hf_ansi_map_triggercapability_ct , { "Call Types (CT)", "ansi_map.triggercapability.ct", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_triggercapability_unrec, { "Unrecognized_Number (Unrec)", "ansi_map.triggercapability.unrec", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_triggercapability_pa, { "Prior_Agreement (PA)", "ansi_map.triggercapability.pa", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_triggercapability_at, { "Advanced_Termination (AT)", "ansi_map.triggercapability.at", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_triggercapability_cgraa, { "Calling_Routing_Address_Available (CgRAA)", "ansi_map.triggercapability.cgraa", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_triggercapability_it, { "Initial_Termination (IT)", "ansi_map.triggercapability.it", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x20, NULL, HFILL }}, { &hf_ansi_map_triggercapability_cdraa, { "Called_Routing_Address_Available (CdRAA)", "ansi_map.triggercapability.cdraa", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x40, NULL, HFILL }}, { &hf_ansi_map_triggercapability_obsy, { "O_Called_Party_Busy (OBSY)", "ansi_map.triggercapability.obsy", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x80, NULL, HFILL }}, { &hf_ansi_map_triggercapability_tra , { "Terminating_Resource_Available (TRA)", "ansi_map.triggercapability.tra", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_triggercapability_tbusy, { "T_Busy (TBusy)", "ansi_map.triggercapability.tbusy", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_triggercapability_tna, { "T_No_Answer (TNA)", "ansi_map.triggercapability.tna", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_triggercapability_tans, { "T_Answer (TANS)", "ansi_map.triggercapability.tans", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x08, NULL, HFILL }}, { &hf_ansi_map_triggercapability_tdisc, { "T_Disconnect (TDISC)", "ansi_map.triggercapability.tdisc", FT_BOOLEAN, 8, TFS(&ansi_map_triggercapability_bool_val),0x10, NULL, HFILL }}, { &hf_ansi_map_winoperationscapability_conn, { "ConnectResource (CONN)", "ansi_map.winoperationscapability.conn", FT_BOOLEAN, 8, TFS(&ansi_map_winoperationscapability_conn_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_winoperationscapability_ccdir, { "CallControlDirective(CCDIR)", "ansi_map.winoperationscapability.ccdir", FT_BOOLEAN, 8, TFS(&ansi_map_winoperationscapability_ccdir_bool_val),0x02, NULL, HFILL }}, { &hf_ansi_map_winoperationscapability_pos, { "PositionRequest (POS)", "ansi_map.winoperationscapability.pos", FT_BOOLEAN, 8, TFS(&ansi_map_winoperationscapability_pos_bool_val),0x04, NULL, HFILL }}, { &hf_ansi_map_pacaindicator_pa, { "Permanent Activation (PA)", "ansi_map.pacaindicator_pa", FT_BOOLEAN, 8, TFS(&ansi_map_pacaindicator_pa_bool_val),0x01, NULL, HFILL }}, { &hf_ansi_map_PACA_Level, { "PACA Level", "ansi_map.PACA_Level", FT_UINT8, BASE_DEC, VALS(ansi_map_PACA_Level_vals), 0x1e, NULL, HFILL }}, { &hf_ansi_map_point_code, { "Point Code", "ansi_map.point_code", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_ansi_map_SSN, { "SSN", "ansi_map.SSN", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_ansi_map_win_trigger_list, { "WIN trigger list", "ansi_map.win_trigger_list", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, #include "packet-ansi_map-hfarr.c" }; /* List of subtrees */ static gint *ett[] = { &ett_ansi_map, &ett_mintype, &ett_digitstype, &ett_billingid, &ett_sms_bearer_data, &ett_sms_teleserviceIdentifier, &ett_extendedmscid, &ett_extendedsystemmytypecode, &ett_handoffstate, &ett_mscid, &ett_cdmachanneldata, &ett_cdmastationclassmark, &ett_channeldata, &ett_confidentialitymodes, &ett_controlchanneldata, &ett_CDMA2000HandoffInvokeIOSData, &ett_CDMA2000HandoffResponseIOSData, &ett_originationtriggers, &ett_pacaindicator, &ett_callingpartyname, &ett_triggercapability, &ett_winoperationscapability, &ett_win_trigger_list, &ett_controlnetworkid, &ett_transactioncapability, &ett_cdmaserviceoption, &ett_sms_originationrestrictions, &ett_systemcapabilities, #include "packet-ansi_map-ettarr.c" }; static ei_register_info ei[] = { { &ei_ansi_map_nr_not_used, { "ansi_map.nr_not_used", PI_PROTOCOL, PI_WARN, "This Number plan should not have been used", EXPFILL }}, { &ei_ansi_map_unknown_invokeData_blob, { "ansi_map.unknown_invokeData_blob", PI_PROTOCOL, PI_WARN, "Unknown invokeData blob", EXPFILL }}, { &ei_ansi_map_no_data, { "ansi_map.no_data", PI_PROTOCOL, PI_NOTE, "Carries no data", EXPFILL }}, }; expert_module_t* expert_ansi_map; static const enum_val_t ansi_map_response_matching_type_values[] = { {"Only Transaction ID will be used in Invoke/response matching", "Transaction ID only", ANSI_MAP_TID_ONLY}, {"Transaction ID and Source will be used in Invoke/response matching", "Transaction ID and Source", ANSI_MAP_TID_AND_SOURCE}, {"Transaction ID Source and Destination will be used in Invoke/response matching", "Transaction ID Source and Destination", ANSI_MAP_TID_SOURCE_AND_DEST}, {NULL, NULL, -1} }; /* TAP STAT INFO */ static stat_tap_table_ui stat_table = { REGISTER_STAT_GROUP_TELEPHONY_ANSI, "Map Operation Statistics", "ansi_map", "ansi_map", ansi_map_stat_init, ansi_map_stat_packet, ansi_map_stat_reset, NULL, NULL, sizeof(stat_fields)/sizeof(stat_tap_table_item), stat_fields, 0, NULL, NULL, 0 }; /* Register protocol */ proto_ansi_map = proto_register_protocol(PNAME, PSNAME, PFNAME); /* Register fields and subtrees */ proto_register_field_array(proto_ansi_map, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_ansi_map = expert_register_protocol(proto_ansi_map); expert_register_field_array(expert_ansi_map, ei, array_length(ei)); ansi_map_handle = register_dissector("ansi_map", dissect_ansi_map, proto_ansi_map); is637_tele_id_dissector_table = register_dissector_table("ansi_map.tele_id", "IS-637 Teleservice ID", proto_ansi_map, FT_UINT8, BASE_DEC); is683_dissector_table = register_dissector_table("ansi_map.ota", "IS-683-A (OTA)", proto_ansi_map, FT_UINT8, BASE_DEC); is801_dissector_table = register_dissector_table("ansi_map.pld", "IS-801 (PLD)", proto_ansi_map, FT_UINT8, BASE_DEC); ansi_map_tap = register_tap("ansi_map"); range_convert_str(wmem_epan_scope(), &global_ssn_range, "5-14", MAX_SSN); ansi_map_module = prefs_register_protocol(proto_ansi_map, proto_reg_handoff_ansi_map); prefs_register_range_preference(ansi_map_module, "map.ssn", "ANSI MAP SSNs", "ANSI MAP SSNs to decode as ANSI MAP", &global_ssn_range, MAX_SSN); prefs_register_enum_preference(ansi_map_module, "transaction.matchtype", "Type of matching invoke/response", "Type of matching invoke/response, risk of mismatch if loose matching chosen", &ansi_map_response_matching_type, ansi_map_response_matching_type_values, FALSE); TransactionId_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), wmem_str_hash, g_str_equal); register_stat_tap_table_ui(&stat_table); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
gpl-2.0
EcvetStep/ecvet-step.eu
wp-content/themes/ecvet-step/sidebar-footer.php
1753
<?php /** * The Footer widget areas. * * @package ECVET STEP Themes * @subpackage ECVET STEP One * @since ECVET STEP One 1.0 */ ?> <?php /* The footer widget area is triggered if any of the areas * have widgets. So let's check that first. * * If none of the sidebars have widgets, then let's bail early. */ if ( ! is_active_sidebar( 'sidebar-2' ) && ! is_active_sidebar( 'sidebar-3' ) && ! is_active_sidebar( 'sidebar-4' ) && ! is_active_sidebar( 'sidebar-5' ) ) return; // If we get this far, we have widgets. Let do this. ?> <div id="footer-sidebar" class="container"> <div id="supplementary" <?php ecvetstep_footer_sidebar_class(); ?>> <?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?> <div id="first" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-2' ); ?> </div><!-- #first .widget-area --> <?php endif; ?> <?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?> <div id="second" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-3' ); ?> </div><!-- #second .widget-area --> <?php endif; ?> <?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?> <div id="third" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-4' ); ?> </div><!-- #third .widget-area --> <?php endif; ?> <?php if ( is_active_sidebar( 'sidebar-5' ) ) : ?> <div id="fourth" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-5' ); ?> </div><!-- #third .widget-area --> <?php endif; ?> </div><!-- #supplementary --> </div><!-- #footer-sidebar -->
gpl-2.0
hfiguiere/abiword
plugins/collab/backends/service/xp/ServiceErrorCodes.cpp
1153
/* Copyright (C) 2008 AbiSource Corporation B.V. * * 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. */ #include <boost/lexical_cast.hpp> #include "ServiceErrorCodes.h" namespace abicollab { namespace service { SOAP_ERROR error(const soa::SoapFault& fault) { if (!fault.string()) return SOAP_ERROR_GENERIC; try { return static_cast<SOAP_ERROR>(boost::lexical_cast<int>(fault.string()->value())); } catch (boost::bad_lexical_cast&) { return SOAP_ERROR_GENERIC; } } } }
gpl-2.0
renshuki/dfp-manager
vendor/googleads/googleads-php-lib/src/Google/AdsApi/AdWords/v201705/cm/ManualCpcBiddingScheme.php
1018
<?php namespace Google\AdsApi\AdWords\v201705\cm; /** * This file was generated from WSDL. DO NOT EDIT. */ class ManualCpcBiddingScheme extends \Google\AdsApi\AdWords\v201705\cm\BiddingScheme { /** * @var boolean $enhancedCpcEnabled */ protected $enhancedCpcEnabled = null; /** * @param string $BiddingSchemeType * @param boolean $enhancedCpcEnabled */ public function __construct($BiddingSchemeType = null, $enhancedCpcEnabled = null) { parent::__construct($BiddingSchemeType); $this->enhancedCpcEnabled = $enhancedCpcEnabled; } /** * @return boolean */ public function getEnhancedCpcEnabled() { return $this->enhancedCpcEnabled; } /** * @param boolean $enhancedCpcEnabled * @return \Google\AdsApi\AdWords\v201705\cm\ManualCpcBiddingScheme */ public function setEnhancedCpcEnabled($enhancedCpcEnabled) { $this->enhancedCpcEnabled = $enhancedCpcEnabled; return $this; } }
gpl-2.0