diff --git a/.gitignore b/.gitignore index 1d91f80a144f22..623c45d79ebd3e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,16 +20,17 @@ a.out *.class *.pyxbldc *.vcd -lane.cpp -loc*.cpp config.json clcache board/obj/ selfdrive/boardd/boardd selfdrive/logcatd/logcatd +selfdrive/mapd/default_speeds_by_region.json selfdrive/proclogd/proclogd selfdrive/ui/ui +selfdrive/test/tests/plant/out +selfdrive/visiond/visiond /src/ one diff --git a/.travis.yml b/.travis.yml index 74411b5de82281..3dfe3382392e92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ install: - docker build -t tmppilot -f Dockerfile.openpilot . script: - - docker run --rm + - docker run -v "$(pwd)"/selfdrive/test/tests/plant/out:/tmp/openpilot/selfdrive/test/tests/plant/out tmppilot /bin/sh -c 'cd /tmp/openpilot/selfdrive/test/tests/plant && OPTEST=1 ./test_longitudinal.py' + - docker run + tmppilot /bin/sh -c 'cd /tmp/openpilot/selfdrive/test/ && ./test_fingerprints.py' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2357509eeefe85..5305a72237ddb3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,17 +2,17 @@ Our software is open source so you can solve your own problems without needing help from others. And if you solve a problem and are so kind, you can upstream it for the rest of the world to use. -Most open source development activity is coordinated through our [slack](https://slack.comma.ai). A lot of documentation is available on our [medium](https://medium.com/@comma_ai/) +Most open source development activity is coordinated through our [Discord](https://discord.comma.ai). A lot of documentation is available on our [medium](https://medium.com/@comma_ai/) ## Getting Started - * Join our slack [slack.comma.ai](https://slack.comma.ai) + * Join our [Discord](https://discord.comma.ai) * Make sure you have a [GitHub account](https://github.com/signup/free) - * Fork the repository on GitHub + * Fork [our repositories](https://github.com/commaai) on GitHub ## Car Ports (openpilot) -We've released a guide for porting to Toyota cars [here](https://medium.com/@comma_ai/openpilot-port-guide-for-toyota-models-e5467f4b5fe6) +We've released a [Model Port guide](https://medium.com/@comma_ai/openpilot-port-guide-for-toyota-models-e5467f4b5fe6) for porting to Toyota/Lexus models. -If you port openpilot to a substantially new car, you might be eligible for a bounty. See our bounties at [comma.ai/bounties.html](https://comma.ai/bounties.html) +If you port openpilot to a substantially new car brand, see this more generic [Brand Port guide](https://medium.com/@comma_ai/how-to-write-a-car-port-for-openpilot-7ce0785eda84). You might also be eligible for a bounty. See our bounties at [comma.ai/bounties.html](https://comma.ai/bounties.html) diff --git a/Dockerfile.openpilot b/Dockerfile.openpilot index 98e1c0abf5555d..de602f3bca96c7 100644 --- a/Dockerfile.openpilot +++ b/Dockerfile.openpilot @@ -1,8 +1,27 @@ FROM ubuntu:16.04 ENV PYTHONUNBUFFERED 1 -RUN apt-get update && apt-get install -y build-essential clang vim screen wget bzip2 git libglib2.0-0 python-pip capnproto libcapnp-dev libzmq5-dev libffi-dev libusb-1.0-0 -RUN pip install numpy==1.11.2 scipy==0.18.1 matplotlib +RUN apt-get update && apt-get install -y \ + build-essential \ + clang \ + vim \ + screen \ + wget \ + bzip2 \ + git \ + libglib2.0-0 \ + python-pip \ + capnproto \ + libcapnp-dev \ + libzmq5-dev \ + libffi-dev \ + libusb-1.0-0 \ + libssl-dev \ + ocl-icd-libopencl1 \ + ocl-icd-opencl-dev \ + opencl-headers + +RUN pip install numpy==1.11.2 scipy==0.18.1 matplotlib==2.1.2 COPY requirements_openpilot.txt /tmp/ RUN pip install -r /tmp/requirements_openpilot.txt @@ -17,3 +36,5 @@ COPY ./phonelibs /tmp/openpilot/phonelibs COPY ./pyextra /tmp/openpilot/pyextra RUN mkdir -p /tmp/openpilot/selfdrive/test/out +RUN make -C /tmp/openpilot/selfdrive/controls/lib/longitudinal_mpc clean +RUN make -C /tmp/openpilot/selfdrive/controls/lib/lateral_mpc clean diff --git a/README.md b/README.md index 232d018f3bd1e8..a82b98dbc214e3 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,41 @@ -[![](https://i.imgur.com/RTQYufz.jpg)](#) +[![](https://i.imgur.com/xY2gdHv.png)](#) Welcome to openpilot ====== -[openpilot](http://github.com/commaai/openpilot) is an open source driving agent. Currently it performs the functions of Adaptive Cruise Control (ACC) and Lane Keeping Assist System (LKAS) for Hondas, Acuras, Toyotas, and a Chevy. It's about on par with Tesla Autopilot and GM Super Cruise, and better than [all other manufacturers](http://www.thedrive.com/tech/5707/the-war-for-autonomous-driving-part-iii-us-vs-germany-vs-japan). +[openpilot](http://github.com/commaai/openpilot) is an open source driving agent. Currently, it performs the functions of Adaptive Cruise Control (ACC) and Lane Keeping Assist System (LKAS) for selected Honda, Toyota, Acura, Lexus, Chevrolet, Hyundai, Kia. It's about on par with Tesla Autopilot and GM Super Cruise, and better than [all other manufacturers](http://www.thedrive.com/tech/5707/the-war-for-autonomous-driving-part-iii-us-vs-germany-vs-japan). -The openpilot codebase has been written to be concise and enable rapid prototyping. We look forward to your contributions - improving real vehicle automation has never been easier. +The openpilot codebase has been written to be concise and to enable rapid prototyping. We look forward to your contributions - improving real vehicle automation has never been easier. + +Table of Contents +======================= + +* [Community](#community) +* [Hardware](#hardware) +* [Supported Cars](#supported-cars) +* [Community Maintained Cars](#community-maintained-cars) +* [In Progress Cars](#in-progress-cars) +* [How can I add support for my car?](#how-can-i-add-support-for-my-car) +* [Directory structure](#directory-structure) +* [User Data / chffr Account / Crash Reporting](#user-data--chffr-account--crash-reporting) +* [Testing on PC](#testing-on-pc) +* [Contributing](#contributing) +* [Licensing](#licensing) + +--- Community ------ -openpilot is supported by [comma.ai](https://comma.ai/). +openpilot is developed by [comma.ai](https://comma.ai/) and users like you. We have a [Twitter you should follow](https://twitter.com/comma_ai). -Also, we have a 3500+ person [community on slack](https://slack.comma.ai). +Also, we have a several thousand people community on [Discord](https://discord.comma.ai). - + @@ -34,84 +51,98 @@ Also, we have a 3500+ person [community on slack](https://slack.comma.ai). Hardware ------ -Right now openpilot supports the [EON Dashcam DevKit](https://comma.ai/shop/products/eon-dashcam-devkit). We'd like to support other platforms as well. +At the moment openpilot supports the [EON Dashcam DevKit](https://comma.ai/shop/products/eon-dashcam-devkit). A [panda](https://shop.comma.ai/products/panda-obd-ii-dongle) and a [giraffe](https://comma.ai/shop/products/giraffe/) are recommended tools to interface the EON with the car. We'd like to support other platforms as well. Install openpilot on a neo device by entering ``https://openpilot.comma.ai`` during NEOS setup. Supported Cars ------ -| Make | Model | Supported Package | Lateral | Longitudinal | No Accel Below | No Steer Below | -| ------- | ---------------------- | -------------------- | ------- | ------------ | -------------- | -------------- | -| Acura | ILX 2016 | AcuraWatch Plus | Yes | Yes | 25mph* | 12mph | -| Acura | ILX 2017 | AcuraWatch Plus | Yes | Yes | 25mph* | 12mph | -| Acura | RDX 2018 | AcuraWatch Plus | Yes | Yes | 25mph* | 12mph | -| GM | Volt 2017 | Driver Confidence II | Yes | Yes | 0mph | 0mph | -| GM | Volt 2018 | Driver Confidence II | Yes | Yes | 0mph | 0mph | -| Honda | Accord 2018 | All | Yes | Stock | 0mph | 3mph | -| Honda | Civic 2016 *(Sedan)* | Honda Sensing | Yes | Yes | 0mph | 12mph | -| Honda | Civic 2017 *(Sedan)* | Honda Sensing | Yes | Yes | 0mph | 12mph | -| Honda | Civic 2017 *(Hatch)* | Honda Sensing | Yes | Stock | 0mph | 12mph | -| Honda | Civic 2018 *(Sedan)* | Honda Sensing | Yes | Yes | 0mph | 12mph | -| Honda | CR-V 2015 | Honda Sensing | Yes | Yes | 25mph* | 12mph | -| Honda | CR-V 2016 | Honda Sensing | Yes | Yes | 25mph* | 12mph | -| Honda | CR-V 2017 | Honda Sensing | Yes | Stock | 0mph | 12mph | -| Honda | CR-V 2018 | Honda Sensing | Yes | Stock | 0mph | 12mph | -| Honda | Odyssey 2017 | Honda Sensing | Yes | Yes | 25mph* | 12mph | -| Honda | Odyssey 2018 | Honda Sensing | Yes | Yes | 25mph* | 12mph | -| Honda | Pilot 2017 | Honda Sensing | Yes | Yes | 25mph* | 12mph | -| Honda | Pilot 2018 | Honda Sensing | Yes | Yes | 25mph* | 12mph | -| Honda | Ridgeline 2017 | Honda Sensing | Yes | Yes | 25mph* | 12mph | -| Honda | Ridgeline 2018 | Honda Sensing | Yes | Yes | 25mph* | 12mph | -| Lexus | RX Hybrid 2017 | All | Yes | Yes | 0mph | 0mph | -| Lexus | RX Hybrid 2018 | All | Yes | Yes | 0mph | 0mph | -| Toyota | Corolla 2017 | All | Yes | Yes | 20mph | 0mph | -| Toyota | Corolla 2018 | All | Yes | Yes | 20mph | 0mph | -| Toyota | Prius 2016 | TSS-P | Yes | Yes | 0mph | 0mph | -| Toyota | Prius 2017 | All | Yes | Yes | 0mph | 0mph | -| Toyota | Prius 2018 | All | Yes | Yes | 0mph | 0mph | -| Toyota | Prius Prime 2017 | All | Yes | Yes | 0mph | 0mph | -| Toyota | Prius Prime 2018 | All | Yes | Yes | 0mph | 0mph | -| Toyota | Rav4 2016 | TSS-P | Yes | Yes | 20mph | 0mph | -| Toyota | Rav4 2017 | All | Yes | Yes | 20mph | 0mph | -| Toyota | Rav4 2018 | All | Yes | Yes | 20mph | 0mph | -| Toyota | Rav4 Hybrid 2017 | All | Yes | Yes | 0mph | 0mph | -| Toyota | Rav4 Hybrid 2018 | All | Yes | Yes | 0mph | 0mph | - - -*[Comma Pedal](https://community.comma.ai/wiki/index.php/Comma_Pedal) is used to provide stop-and-go capability to some of the openpilot-supported cars that don't currently support stop-and-go. Here is how to [build a Comma Pedal](https://medium.com/@jfrux/comma-pedal-building-with-macrofab-6328bea791e8). ***NOTE: The Comma Pedal is not officially supported by [comma.ai](https://comma.ai)*** +| Make | Model | Supported Package | Lateral | Longitudinal | No Accel Below | No Steer Below | Giraffe | +| ---------------------| -------------------------| ---------------------| --------| ---------------| -----------------| ---------------|-------------------| +| Acura | ILX 2016-17 | AcuraWatch Plus | Yes | Yes | 25mph1| 25mph | Nidec | +| Acura | RDX 2018 | AcuraWatch Plus | Yes | Yes | 25mph1| 12mph | Nidec | +| Buick3 | Regal 2018 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom7| +| Chevrolet3| Malibu 2017 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom7| +| Chevrolet3| Volt 2017-18 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom7| +| Cadillac3 | ATS 2018 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom7| +| Chrysler | Pacifica 2018 | Adaptive Cruise | Yes | Stock | 0mph | 9mph | FCA | +| Chrysler | Pacifica Hybrid 2017-18 | Adaptive Cruise | Yes | Stock | 0mph | 9mph | FCA | +| Chrysler | Pacifica Hybrid 2019 | Adaptive Cruise | Yes | Stock | 0mph | 39mph | FCA | +| GMC3 | Acadia Denali 2018 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom7| +| Holden3 | Astra 2017 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom7| +| Honda | Accord 2018 | All | Yes | Stock | 0mph | 3mph | Bosch | +| Honda | Civic Sedan/Coupe 2016-18| Honda Sensing | Yes | Yes | 0mph | 12mph | Nidec | +| Honda | Civic Sedan/Coupe 2019 | Honda Sensing | Yes | Stock | 0mph | 2mph | Bosch | +| Honda | Civic Hatchback 2017-19 | Honda Sensing | Yes | Stock | 0mph | 12mph | Bosch | +| Honda | CR-V 2015-16 | Touring | Yes | Yes | 25mph1| 12mph | Nidec | +| Honda | CR-V 2017-18 | Honda Sensing | Yes | Stock | 0mph | 12mph | Bosch | +| Honda | CR-V Hybrid 2019 | All | Yes | Stock | 0mph | 12mph | Bosch | +| Honda | Odyssey 2017-19 | Honda Sensing | Yes | Yes | 25mph1| 0mph | Inverted Nidec | +| Honda | Pilot 2016-18 | Honda Sensing | Yes | Yes | 25mph1| 12mph | Nidec | +| Honda | Pilot 2019 | All | Yes | Yes | 25mph1| 12mph | Inverted Nidec | +| Honda | Ridgeline 2017-19 | Honda Sensing | Yes | Yes | 25mph1| 12mph | Nidec | +| Hyundai | Santa Fe 2019 | All | Yes | Stock | 0mph | 0mph | Custom6| +| Hyundai | Elantra 2017 | SCC + LKAS | Yes | Stock | 19mph | 34mph | Custom6| +| Hyundai | Genesis 2018 | All | Yes | Stock | 19mph | 34mph | Custom6| +| Jeep | Grand Cherokee 2017-18 | Adaptive Cruise | Yes | Stock | 0mph | 9mph | FCA | +| Jeep | Grand Cherokee 2019 | Adaptive Cruise | Yes | Stock | 0mph | 39mph | FCA | +| Kia | Optima 2019 | SCC + LKAS | Yes | Stock | 0mph | 0mph | Custom6| +| Kia | Sorento 2018 | All | Yes | Stock | 0mph | 0mph | Custom6| +| Kia | Stinger 2018 | SCC + LKAS | Yes | Stock | 0mph | 0mph | Custom6| +| Lexus | RX Hybrid 2016-18 | All | Yes | Yes2| 0mph | 0mph | Toyota | +| Toyota | Camry 20184 | All | Yes | Stock | 0mph5 | 0mph | Toyota | +| Toyota | C-HR 2017-184 | All | Yes | Stock | 0mph | 0mph | Toyota | +| Toyota | Corolla 2017-18 | All | Yes | Yes2| 20mph1| 0mph | Toyota | +| Toyota | Highlander 2017-18 | All | Yes | Yes2| 0mph | 0mph | Toyota | +| Toyota | Highlander Hybrid 2018 | All | Yes | Yes2| 0mph | 0mph | Toyota | +| Toyota | Prius 2016 | TSS-P | Yes | Yes2| 0mph | 0mph | Toyota | +| Toyota | Prius 2017-18 | All | Yes | Yes2| 0mph | 0mph | Toyota | +| Toyota | Prius Prime 2017-18 | All | Yes | Yes2| 0mph | 0mph | Toyota | +| Toyota | Rav4 2016 | TSS-P | Yes | Yes2| 20mph1| 0mph | Toyota | +| Toyota | Rav4 2017-18 | All | Yes | Yes2| 20mph1| 0mph | Toyota | +| Toyota | Rav4 Hybrid 2017-18 | All | Yes | Yes2| 0mph | 0mph | Toyota | + +1[Comma Pedal](https://community.comma.ai/wiki/index.php/Comma_Pedal) is used to provide stop-and-go capability to some of the openpilot-supported cars that don't currently support stop-and-go. Here is how to [build a Comma Pedal](https://medium.com/@jfrux/comma-pedal-building-with-macrofab-6328bea791e8). ***NOTE: The Comma Pedal is not officially supported by [comma.ai](https://comma.ai)*** +2When disconnecting the Driver Support Unit (DSU), otherwise longitudinal control is stock ACC. For DSU locations, see [Toyota Wiki page](https://community.comma.ai/wiki/index.php/Toyota) +3[GM installation guide](https://zoneos.com/volt/). +4It needs an extra 120Ohm resistor ([pic1](https://i.imgur.com/CmdKtTP.jpg), [pic2](https://i.imgur.com/s2etUo6.jpg)) on bus 3 and giraffe switches set to 01X1 (11X1 for stock LKAS), where X depends on if you have the [comma power](https://comma.ai/shop/products/power/). +528mph for Camry 4CYL L, 4CYL LE and 4CYL SE which don't have Full-Speed Range Dynamic Radar Cruise Control. +6Open sourced [Hyundai Giraffe](https://github.com/commaai/neo/tree/master/giraffe/hyundai) is designed for the 2019 Sante Fe; pinout may differ for other Hyundais. +7Community built Giraffe, find more information [here](https://zoneos.com/shop/). Community Maintained Cars ------ -| Make | Model | Supported Package | Lateral | Longitudinal | No Accel Below | No Steer Below | -| ------- | -----------------------| -------------------- | ------- | ------------ | ----------- | ------------ | -| Tesla | Model S 2012 | All | Yes | Not yet | Not applicable | 0mph | -| Tesla | Model S 2013 | All | Yes | Not yet | Not applicable | 0mph | +| Make | Model | Supported Package | Lateral | Longitudinal | No Accel Below | No Steer Below | Giraffe | +| ---------------------| -------------------------| ---------------------| --------| ---------------| -----------------| ---------------|-------------------| +| Honda | Fit 2018 | Honda Sensing | Yes | Yes | 25mph1| 12mph | Inverted Nidec | +| Tesla | Model S 2012-13 | All | Yes | Not yet | Not applicable | 0mph | Custom8| -[[Tesla Pull Request]](https://github.com/commaai/openpilot/pull/246) +[[Honda Fit Pull Request]](https://github.com/commaai/openpilot/pull/266).
+[[Tesla Model S Pull Request]](https://github.com/commaai/openpilot/pull/246)
+8Community built Giraffe, find more information here [Community Tesla Giraffe](https://github.com/jeankalud/neo/tree/tesla_giraffe/giraffe/tesla)
-*Community Maintained Cars are not confirmed by comma.ai to meet our safety model. Be extra cautious using them. +Community Maintained Cars are not confirmed by comma.ai to meet our [safety model](https://github.com/commaai/openpilot/blob/devel/SAFETY.md). Be extra cautious using them. In Progress Cars ------ -- All TSS-P Toyota with Steering Assist. - - 'Full Speed Range Dynamic Radar Cruise Control' is required to enable stop-and-go. Only the Prius, Camry and C-HR have this option. - - Even though the Tundra, Sequoia and the Land Cruiser have TSS-P, they don't have Steering Assist and are not supported. -- All LSS-P Lexus with Steering Assist or Lane Keep Assist. - - 'All-Speed Range Dynamic Radar Cruise Control' is required to enable stop-and-go. Only the GS, GSH, F, RX, RXH, LX, NX, NXH, LC, LCH, LS, LSH have this option. - - Even though the LX have TSS-P, it does not have Steering Assist and is not supported. +- All TSS-P Toyota with Steering Assist and LSS-P Lexus with Steering Assist or Lane Keep Assist. + - Only remaining Toyota cars with no port yet are the Avalon and the Sienna. +- All Hyundai with SmartSense. +- All Kia with SCC and LKAS. +- All Chrysler, Jeep, Fiat with Adaptive Cruise Control and LaneSense. How can I add support for my car? ------ If your car has adaptive cruise control and lane keep assist, you are in luck. Using a [panda](https://comma.ai/shop/products/panda-obd-ii-dongle/) and [cabana](https://community.comma.ai/cabana/), you can understand how to make your car drive by wire. -We've written a [porting guide](https://medium.com/@comma_ai/openpilot-port-guide-for-toyota-models-e5467f4b5fe6) for Toyota that might help you after you have the basics figured out. +We've written guides for [Brand](https://medium.com/@comma_ai/how-to-write-a-car-port-for-openpilot-7ce0785eda84) and [Model](https://medium.com/@comma_ai/openpilot-port-guide-for-toyota-models-e5467f4b5fe6) ports. These guides might help you after you have the basics figured out. -- BMW, Audi, Volvo, and Mercedes all use [FlexRay](https://en.wikipedia.org/wiki/FlexRay) and are unlikely to be supported any time soon. +- BMW, Audi, Volvo, and Mercedes all use [FlexRay](https://en.wikipedia.org/wiki/FlexRay) and can be supported after [FlexRay support](https://github.com/commaai/openpilot/pull/463) is merged. - We put time into a Ford port, but the steering has a 10 second cutout limitation that makes it unusable. -- The 2016-2017 Honda Accord use a custom signaling protocol for steering that's unlikely to ever be upstreamed. +- The 2016-2017 Honda Accord uses a custom signaling protocol for steering that's unlikely to ever be upstreamed. Directory structure ------ @@ -135,18 +166,20 @@ Directory structure ├── locationd # Soon to be home of precise location ├── logcatd # Android logcat as a service ├── loggerd # Logger and uploader of car data + ├── mapd # Fetches map data and computes next global path + ├── orbd # Computes ORB features from frames ├── proclogd # Logs information from proc ├── sensord # IMU / GPS interface code ├── test # Car simulator running code through virtual maneuvers ├── ui # The UI - └── visiond # Embedded vision pipeline + └── visiond # Vision pipeline To understand how the services interact, see `selfdrive/service_list.yaml` User Data / chffr Account / Crash Reporting ------ -By default openpilot creates an account and includes a client for chffr, our dashcam app. We use your data to train better models and improve openpilot for everyone. +By default, openpilot creates an account and includes a client for chffr, our dashcam app. We use your data to train better models and improve openpilot for everyone. It's open source software, so you are free to disable it if you wish. @@ -159,22 +192,21 @@ By using it, you agree to [our privacy policy](https://community.comma.ai/privac Testing on PC ------ -There is rudimentary infrastructure to run a basic simulation and generate a report of openpilot's behavior in different scenarios. +Check out [openpilot-tools](https://github.com/commaai/openpilot-tools): lots of tools you can use to replay driving data, test and develop openpilot from your pc. + +Also, within openpilot there is a rudimentary infrastructure to run a basic simulation and generate a report of openpilot's behavior in different longitudinal control scenarios. ```bash # Requires working docker ./run_docker_tests.sh ``` -The resulting plots are displayed in `selfdrive/test/tests/plant/out/longitudinal/index.html` - -More extensive testing infrastructure and simulation environments are coming soon. - Contributing ------ -We welcome both pull requests and issues on -[github](http://github.com/commaai/openpilot). Bug fixes and new car support encouraged. +We welcome both pull requests and issues on [github](http://github.com/commaai/openpilot). Bug fixes and new car ports encouraged. + +We also have a [bounty program](https://comma.ai/bounties.html). Want to get paid to work on openpilot? [comma.ai is hiring](https://comma.ai/jobs/) @@ -188,3 +220,7 @@ Any user of this software shall indemnify and hold harmless Comma.ai, Inc. and i **THIS IS ALPHA QUALITY SOFTWARE FOR RESEARCH PURPOSES ONLY. THIS IS NOT A PRODUCT. YOU ARE RESPONSIBLE FOR COMPLYING WITH LOCAL LAWS AND REGULATIONS. NO WARRANTY EXPRESSED OR IMPLIED.** + +--- + + diff --git a/RELEASES.md b/RELEASES.md index a515873642a5ca..48e3b647d51766 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,98 @@ +Version 0.5.10 (2019-03-19) +======================== + * Self-tuning vehicle parameters: steering offset, tires stiffness and steering ratio + * Improve longitudinal control at low speed when lead vehicle harshly decelerates + * Fix panda bug going unexpectedly in DCP mode when EON is connected + * Reduce white panda power consumption by 500mW when EON is disconnected by turning off WIFI + * New Driver Monitoring Model + * Support QR codes for login using comma connect + * Refactor comma pedal FW and use CRC-8 checksum algorithm for safety. Reflashing pedal is required. + Please see `#hw-pedal` on [discord](discord.comma.ai) for assistance updating comma pedal. + * Additional speed limit rules for Germany thanks to arne182 + * Allow negative speed limit offsets + +Version 0.5.9 (2019-02-10) +======================== + * Improve calibration using a dedicated neural network + * Abstract planner in its own process to remove lags in controls process + * Improve speed limits with country/region defaults by road type + * Reduce mapd data usage with gzip thanks to eFiniLan + * Zip log files in the background to reduce disk usage + * Kia Optima support thanks to emmertex! + * Buick Regal 2018 support thanks to HOYS! + * Comma pedal support for Toyota thanks to wocsor! Note: tuning needed and not maintained by comma + * Chrysler Pacifica and Jeep Grand Cherokee support thanks to adhintz! + +Version 0.5.8 (2019-01-17) +======================== + * Open sourced visiond + * Auto-slowdown for upcoming turns + * Chrysler/Jeep/Fiat support thanks to adhintz! + * Honda Civic 2019 support thanks to csouers! + * Improve use of car display in Toyota thanks to arne182! + * No data upload when connected to Android or iOS hotspots and "Enable Upload Over Cellular" setting is off + * EON stops charging when 12V battery drops below 11.8V + +Version 0.5.7 (2018-12-06) +======================== + * Speed limit from OpenStreetMap added to UI + * Highlight speed limit when speed exceeds road speed limit plus a delta + * Option to limit openpilot max speed to road speed limit plus a delta + * Cadillac ATS support thanks to vntarasov! + * GMC Acadia support thanks to CryptoKylan! + * Decrease GPU power consumption + * NEOSv8 autoupdate + +Version 0.5.6 (2018-11-16) +======================== + * Refresh settings layout and add feature descriptions + * In Honda, keep stock camera on for logging and extra stock features; new openpilot giraffe setting is 0111! + * In Toyota, option to keep stock camera on for logging and extra stock features (e.g. AHB); 120Ohm resistor required on giraffe. + * Improve camera calibration stability + * More tuning to Honda positive accelerations + * Reduce brake pump use on Hondas + * Chevrolet Malibu support thanks to tylergets! + * Holden Astra support thanks to AlexHill! + +Version 0.5.5 (2018-10-20) +======================== + * Increase allowed Honda positive accelerations + * Fix sporadic unexpected braking when passing semi-trucks in Toyota + * Fix gear reading bug in Hyundai Elantra thanks to emmertex! + +Version 0.5.4 (2018-09-25) +======================== + * New Driving Model + * New Driver Monitoring Model + * Improve longitudinal mpc in mid-low speed braking + * Honda Accord hybrid support thanks to energee! + * Ship mpc binaries and sensibly reduce build time + * Calibration more stable + * More Hyundai and Kia cars supported thanks to emmertex! + * Various GM Volt improvements thanks to vntarasov! + +Version 0.5.3 (2018-09-03) +======================== + * Hyundai Santa Fe support! + * Honda Pilot 2019 support thanks to energee! + * Toyota Highlander support thanks to daehahn! + * Improve steering tuning for Honda Odyssey + +Version 0.5.2 (2018-08-16) +======================== + * New calibration: more accurate, a lot faster, open source! + * Enable orbd + * Add little endian support to CAN packer + * Fix fingerprint for Honda Accord 1.5T + * Improve driver monitoring model + +Version 0.5.1 (2018-08-01) +======================== + * Fix radar error on Civic sedan 2018 + * Improve thermal management logic + * Alpha Toyota C-HR and Camry support! + * Auto-switch Driver Monitoring to 3 min counter when inaccurate + Version 0.5 (2018-07-11) ======================== * Driver Monitoring (beta) option in settings! diff --git a/SAFETY.md b/SAFETY.md index 0c8ae7e51eeb9a..b5800a0d507ff6 100644 --- a/SAFETY.md +++ b/SAFETY.md @@ -6,7 +6,10 @@ Like other ACC and LKA systems, openpilot requires the driver to be alert and to pay attention at all times. We repeat, **driver alertness is necessary, but not sufficient, for openpilot to be used safely**. -Even with an attentive driver, we must make further efforts for the system to be +In order to enforce driver alertness, openpilot includes a driver monitoring feature +that alerts the driver when distracted. + +However, even with an attentive driver, we must make further efforts for the system to be safe. We have designed openpilot with two other safety considerations. 1. The driver must always be capable to immediately retake manual control of the vehicle, @@ -20,7 +23,7 @@ Following are details of the car specific safety implementations: Honda/Acura ------ - - While the system is engaged, gas, brake and steer limits are subject to the same limits used by + - While the system is engaged, gas, brake and steer commands are subject to the same limits used by the stock system. - Without an interceptor, the gas is controlled by the Powertrain Control Module (PCM). @@ -28,16 +31,16 @@ Honda/Acura interceptor, the gas is clipped to 60%. - The brake is controlled by the 0x1FA CAN message. This message allows full - braking, although the board and the software clip it to 1/4th of the max. - This is around .3g of braking. + braking, although the panda firmware and openpilot clip it to 1/4th of the max. + This is approximately 0.3g of braking. - Steering is controlled by the 0xE4 CAN message. The Electronic Power Steering (EPS) controller in the car limits the torque to a very small amount, so regardless of the message, the controller cannot jerk the wheel. - Brake and gas pedal pressed signals are contained in the 0x17C CAN message. A rising edge of - either signal triggers a disengagement, which is enforced by the board and in software. The - green led on the board signifies if the board is allowing control messages. + either signals triggers a disengagement, which is enforced by the panda firmware and by openpilot. The + white led on the panda signifies if the panda is allowing control messages. - Honda CAN uses both a counter and a checksum to ensure integrity and prevent replay of the same message. @@ -45,29 +48,91 @@ Honda/Acura Toyota/Lexus ------ - - While the system is engaged, gas, brake and steer limits are subject to the same limits used by + - While the system is engaged, gas, brake and steer commands are subject to the same limits used by the stock system. - - With the stock Driving Support Unit (DSU) enabled, the acceleration is controlled - by the stock system and is subject to the stock adaptive cruise control limits. Without the - stock DSU connected, the acceleration command is controlled by the 0x343 CAN message and its - value is limited by the board and the software to between .3g of deceleration and .15g of - acceleration. The acceleration command is ignored by the Engine Control Module (ECM) while the - cruise control system is disengaged. - - - Steering torque is controlled through the 0x2E4 CAN message and it's limited by the board and in - software to a value of -1500 and 1500. In addition, the vehicle EPS unit will not respond to - commands outside these limits. A steering torque rate limit is enforced by the board and in - software so that the commanded steering torque must rise from 0 to max value no faster than - 1.5s. Commanded steering torque is limited by the board and in software to be no more than 350 + - With the stock Driving Support Unit (DSU) connected (or in DSU-less models like Camry and C-HR), + the acceleration is controlled by the stock system and is subject to the stock adaptive cruise + control limits. Without the stock DSU connected, the acceleration command is controlled by the + 0x343 CAN message and its value is limited between .3g of deceleration and .15g of acceleration + by the panda firmware and by openpilot. The acceleration command is ignored by the Engine Control + Module (ECM) while the cruise control system is disengaged. + + - Steering torque is controlled through the 0x2E4 CAN message and it's limited by the panda firmware and by + openpilot to a value between -1500 and 1500. In addition, the vehicle EPS unit will not respond to + commands outside these limits. A steering torque rate limit is enforced by the panda firmware and by + openpilot, so that the commanded steering torque must rise from 0 to max value no faster than + 1.5s. Commanded steering torque is limited by the panda firmware and by openpilot to be no more than 350 units above the actual EPS generated motor torque to ensure limited differences between commanded and actual torques. - Brake and gas pedal pressed signals are contained in the 0x224 and 0x1D2 CAN messages, - respectively. A rising edge of either signal triggers a disengagement, which is enforced by the - board and in software. Additionally, the cruise control system disengages on the rising edge of + respectively. A rising edge of either signals triggers a disengagement, which is enforced by the + panda firmware and by openpilot. Additionally, the cruise control system disengages on the rising edge of the brake pedal pressed signal. - The cruise control system state is contained in the 0x1D2 message. No control messages are - allowed if the cruise control system is not active. This is enforced by the software and the - board. The green led on the board signifies if the board is allowing control messages. + allowed if the cruise control system is not active. This is enforced by openpilot and the + panda firmware. The white led on the panda signifies if the panda is allowing control messages. + +GM/Chevrolet +------ + + - While the system is engaged, gas, brake and steer commands are subject to the same limits used by + the stock system. + + - The gas and regen are controlled by the 0x2CB message and it's limited by the panda firmware and by + openpilot to a value between 1404 and 3072. the minimum value correspond to a mild decel due to regen, + while 3072 correspond to approximately 0.18g of acceleration from stop. + + - The friction brakes are controlled by the 0x315 message and its value is limited by the panda firmware + and openpilot to 350. This is approximately 0.3g of braking. + + - Steering torque is controlled through the 0x180 CAN message and it's limited by the panda firmware and by + openpilot to a value between -300 and 300. In addition, the vehicle EPS unit will fault for + commands outside these limits. A steering torque rate limit is enforced by the panda firmware and by + openpilot, so that the commanded steering torque must rise from 0 to max value no faster than + 0.75s. Commanded steering torque is gradually limited by the panda firmware and by openpilot if the driver's + torque exceeds 12 units in the opposite dicrection to ensure limited applied torque against the + driver's will. + + - Brake pedal and gas pedal potentiometer signals are contained in the 0xF1 and 0x1A1 CAN messages, + respectively. A rising edge of either signals triggers a disengagement, which is enforced by the + panda firmware and by openpilot. Additionally, the cruise control system disengages on the rising edge of + the brake pedal pressed signal. The regen paddle pressed signal is in the 0xBD message. When the + regen paddle is pressed, a disengagement is enforced by both the firmware and by openpilot. + + - GM CAN uses both a counter and a checksum to ensure integrity and prevent + replay of the same message. + +Hyundai/Kia (Lateral only) +------ + + - While the system is engaged, steer commands are subject to the same limits used by + the stock system. + + - Steering torque is controlled through the 0x340 CAN message and it's limited by the panda firmware and by + openpilot to a value between -255 and 255. In addition, the vehicle EPS unit will fault for + commands outside the values of -409 and 409. A steering torque rate limit is enforced by the panda firmware and by + openpilot, so that the commanded steering torque must rise from 0 to max value no faster than + 0.85s. Commanded steering torque is gradually limited by the panda firmware and by openpilot if the driver's + torque exceeds 50 units in the opposite dicrection to ensure limited applied torque against the + driver's will. + +Chrysler/Jeep/Fiat (Lateral only) +------ + + - While the system is engaged, steer commands are subject to the same limits used by + the stock system. + + - Steering torque is controlled through the 0x292 CAN message and it's limited by the panda firmware and by + openpilot to a value between -261 and 261. In addition, the vehicle EPS unit will fault for + commands outside these limits. A steering torque rate limit is enforced by the panda firmware and by + openpilot, so that the commanded steering torque must rise from 0 to max value no faster than + 0.87s. Commanded steering torque is limited by the panda firmware and by openpilot to be no more than 80 + units above the actual EPS generated motor torque to ensure limited differences between + commanded and actual torques. + + +**Extra note**: comma.ai strongly discourages the use of openpilot forks with safety code either missing or + not fully meeting the above requirements. diff --git a/apk/ai.comma.plus.frame.apk b/apk/ai.comma.plus.frame.apk index eaf67b1c70390f..6df46822053c73 100644 Binary files a/apk/ai.comma.plus.frame.apk and b/apk/ai.comma.plus.frame.apk differ diff --git a/apk/ai.comma.plus.offroad.apk b/apk/ai.comma.plus.offroad.apk index db4a96af8b18d4..342f832c2a18ea 100644 Binary files a/apk/ai.comma.plus.offroad.apk and b/apk/ai.comma.plus.offroad.apk differ diff --git a/cereal/Makefile b/cereal/Makefile index b86fa68f585816..dc6b7f9d51fa03 100644 --- a/cereal/Makefile +++ b/cereal/Makefile @@ -6,13 +6,16 @@ GENS := gen/cpp/car.capnp.c++ gen/cpp/log.capnp.c++ JS := gen/js/car.capnp.js gen/js/log.capnp.js UNAME_M ?= $(shell uname -m) - # only generate C++ for docker tests ifneq ($(OPTEST),1) GENS += gen/c/car.capnp.c gen/c/log.capnp.c gen/c/include/c++.capnp.h gen/c/include/java.capnp.h ifeq ($(UNAME_M),x86_64) - GENS += gen/java/Car.java gen/java/Log.java + ifneq (, $(shell which capnpc-java)) + GENS += gen/java/Car.java gen/java/Log.java + else + $(warning capnpc-java not found, skipping java build) + endif endif endif diff --git a/cereal/car.capnp b/cereal/car.capnp index ffc79e6476dc69..8fb312867687cc 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -42,7 +42,7 @@ struct CarEvent @0x9b1657f34caf3ad3 { speedTooLow @17; outOfSpace @18; overheat @19; - calibrationInProgress @20; + calibrationIncomplete @20; calibrationInvalid @21; controlsMismatch @22; pcmEnable @23; @@ -63,6 +63,16 @@ struct CarEvent @0x9b1657f34caf3ad3 { promptDriverDistracted @38; driverDistracted @39; geofence @40; + driverMonitorOn @41; + driverMonitorOff @42; + preDriverUnresponsive @43; + promptDriverUnresponsive @44; + driverUnresponsive @45; + belowSteerSpeed @46; + calibrationProgress @47; + lowBattery @48; + invalidGiraffeHonda @49; + vehicleModelInvalid @50; } } @@ -235,6 +245,8 @@ struct CarControl { leadVisible @3: Bool; visualAlert @4: VisualAlert; audibleAlert @5: AudibleAlert; + rightLaneVisible @6: Bool; + leftLaneVisible @7: Bool; enum VisualAlert { # these are the choices from the Honda @@ -252,13 +264,13 @@ struct CarControl { # these are the choices from the Honda # map as good as you can for your car none @0; - beepSingle @1; - beepTriple @2; - beepRepeated @3; - chimeSingle @4; - chimeDouble @5; - chimeRepeated @6; - chimeContinuous @7; + chimeEngage @1; + chimeDisengage @2; + chimeError @3; + chimeWarning1 @4; + chimeWarning2 @5; + chimeWarningRepeat @6; + chimePrompt @7; } } } @@ -279,6 +291,7 @@ struct CarParams { enableApgs @28 :Bool; # advanced parking guidance system minEnableSpeed @17 :Float32; + minSteerSpeed @49 :Float32; safetyModel @18 :Int16; safetyParam @41 :Int16; @@ -302,6 +315,10 @@ struct CarParams { hondaBosch @5; ford @6; cadillac @7; + hyundai @8; + chrysler @9; + tesla @10; + subaru @11; } # things about the car in the manual @@ -342,6 +359,7 @@ struct CarParams { radarOffCan @47 :Bool; # True when radar objects aren't visible on CAN steerActuatorDelay @48 :Float32; # Steering wheel actuator delay in seconds + openpilotLongitudinalControl @50 :Bool; # is openpilot doing the longitudinal control? enum SteerControlType { torque @0; diff --git a/cereal/log.capnp b/cereal/log.capnp index 474c0d2410bd47..3f79deefe54d33 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -21,6 +21,8 @@ struct Map(Key, Value) { struct InitData { kernelArgs @0 :List(Text); + kernelVersion @15 :Text; + gctx @1 :Text; dongleId @2 :Text; @@ -32,6 +34,7 @@ struct InitData { androidBuildInfo @5 :AndroidBuildInfo; androidSensors @6 :List(AndroidSensor); + androidProperties @16 :Map(Text, Text); chffrAndroidExtra @7 :ChffrAndroidExtra; iosBuildInfo @14 :IosBuildInfo; @@ -39,6 +42,7 @@ struct InitData { dirty @9 :Bool; passive @12 :Bool; + params @17 :Map(Text, Text); enum DeviceType { unknown @0; @@ -183,6 +187,10 @@ struct SensorEventData { iOS @1; fiber @2; velodyne @3; # Velodyne IMU + bno055 @4; # Bosch accelerometer + lsm6ds3 @5; # accelerometer (c2) + bmp280 @6; # barometer (c2) + mmc3416x @7; # magnetometer (c2) } } @@ -259,6 +267,8 @@ struct ThermalData { freeSpace @7 :Float32; batteryPercent @8 :Int16; batteryStatus @9 :Text; + batteryCurrent @15 :Int32; + batteryVoltage @16 :Int32; usbOnline @12 :Bool; fanSpeed @10 :UInt16; @@ -266,6 +276,8 @@ struct ThermalData { startedTs @13 :UInt64; thermalStatus @14 :ThermalStatus; + chargingError @17 :Bool; + chargingDisabled @18 :Bool; enum ThermalStatus { green @0; # all processes run @@ -324,17 +336,22 @@ struct Live20Data { aLeadK @9 :Float32; fcw @10 :Bool; status @11 :Bool; + aLeadTau @12 :Float32; } } struct LiveCalibrationData { + # deprecated warpMatrix @0 :List(Float32); + # camera_frame_from_model_frame warpMatrix2 @5 :List(Float32); + warpMatrixBig @6 :List(Float32); calStatus @1 :Int8; calCycle @2 :Int32; calPerc @3 :Int8; - # Maps car space to normalized image space. + # view_frame_from_road_frame + # ui's is inversed needs new extrinsicMatrix @4 :List(Float32); } @@ -357,6 +374,7 @@ struct Live100Data { l20MonoTimeDEPRECATED @17 :UInt64; mdMonoTimeDEPRECATED @18 :UInt64; planMonoTime @28 :UInt64; + pathPlanMonoTime @50 :UInt64; state @31 :ControlState; vEgo @0 :Float32; @@ -382,6 +400,9 @@ struct Live100Data { curvature @37 :Float32; # path curvature from vehicle model hudLeadDEPRECATED @14 :Int32; cumLagMs @15 :Float32; + startMonoTime @48 :UInt64; + mapValid @49 :Bool; + forceDecel @51 :Bool; enabled @19 :Bool; active @36 :Bool; @@ -395,10 +416,17 @@ struct Live100Data { alertStatus @38 :AlertStatus; alertSize @39 :AlertSize; alertBlinkingRate @42 :Float32; + alertType @44 :Text; + alertSound @45 :Text; awarenessStatus @26 :Float32; - angleOffset @27 :Float32; + angleModelBias @27 :Float32; gpsPlannerActive @40 :Bool; engageable @41 :Bool; # can OP be engaged? + driverMonitoringOn @43 :Bool; + + # maps + vCurvature @46 :Float32; + decelForTurn @47 :Bool; enum ControlState { disabled @0; @@ -520,12 +548,12 @@ struct Plan { events @13 :List(Car.CarEvent); # lateral, 3rd order polynomial - lateralValid @0 :Bool; - dPoly @1 :List(Float32); - laneWidth @11 :Float32; + lateralValidDEPRECATED @0 :Bool; + dPolyDEPRECATED @1 :List(Float32); + laneWidthDEPRECATED @11 :Float32; # longitudinal - longitudinalValid @2 :Bool; + longitudinalValidDEPRECATED @2 :Bool; vCruise @16 :Float32; aCruise @17 :Float32; vTarget @3 :Float32; @@ -534,8 +562,14 @@ struct Plan { aTargetMinDEPRECATED @4 :Float32; aTargetMaxDEPRECATED @5 :Float32; aTarget @18 :Float32; + + vStart @26 :Float32; + aStart @27 :Float32; + jerkFactor @6 :Float32; hasLead @7 :Bool; + hasLeftLaneDEPRECATED @23 :Bool; + hasRightLaneDEPRECATED @24 :Bool; fcw @8 :Bool; longitudinalPlanSource @15 :LongitudinalPlanSource; @@ -544,6 +578,15 @@ struct Plan { gpsPlannerActive @19 :Bool; + # maps + vCurvature @21 :Float32; + decelForTurn @22 :Bool; + mapValid @25 :Bool; + radarValid @28 :Bool; + + processingDelay @29 :Float32; + + struct GpsTrajectory { x @0 :List(Float32); y @1 :List(Float32); @@ -557,6 +600,25 @@ struct Plan { } } +struct PathPlan { + laneWidth @0 :Float32; + + dPoly @1 :List(Float32); + cPoly @2 :List(Float32); + cProb @3 :Float32; + lPoly @4 :List(Float32); + lProb @5 :Float32; + rPoly @6 :List(Float32); + rProb @7 :Float32; + + angleSteers @8 :Float32; # deg + rateSteers @13 :Float32; # deg/s + valid @9 :Bool; + paramsValid @10 :Bool; + modelValid @12 :Bool; + angleOffset @11 :Float32; +} + struct LiveLocationData { status @0 :UInt8; @@ -1243,6 +1305,7 @@ struct UbloxGnss { carrierPhaseStdev @10 :Float32; # doppler standard deviation in Hz dopplerStdev @11 :Float32; + sigId @12 :UInt8; struct TrackingStatus { # pseudorange valid @@ -1533,6 +1596,56 @@ struct OrbKeyFrame { struct DriverMonitoring { frameId @0 :UInt32; descriptor @1 :List(Float32); + std @2 :Float32; +} + +struct Boot { + wallTimeNanos @0 :UInt64; + lastKmsg @1 :Data; + lastPmsg @2 :Data; +} + +struct LiveParametersData { + valid @0 :Bool; + gyroBias @1 :Float32; + angleOffset @2 :Float32; + angleOffsetAverage @3 :Float32; + stiffnessFactor @4 :Float32; + steerRatio @5 :Float32; +} + +struct LiveMapData { + speedLimitValid @0 :Bool; + speedLimit @1 :Float32; + speedAdvisoryValid @12 :Bool; + speedAdvisory @13 :Float32; + speedLimitAheadValid @14 :Bool; + speedLimitAhead @15 :Float32; + speedLimitAheadDistance @16 :Float32; + curvatureValid @2 :Bool; + curvature @3 :Float32; + wayId @4 :UInt64; + roadX @5 :List(Float32); + roadY @6 :List(Float32); + lastGps @7: GpsLocationData; + roadCurvatureX @8 :List(Float32); + roadCurvature @9 :List(Float32); + distToTurn @10 :Float32; + mapValid @11 :Bool; +} + +struct CameraOdometry { + trans @0 :List(Float32); # m/s in device frame + rot @1 :List(Float32); # rad/s in device frame + transStd @2 :List(Float32); # std m/s in device frame + rotStd @3 :List(Float32); # std rad/s in device frame +} + +struct KalmanOdometry { + trans @0 :List(Float32); # m/s in device frame + rot @1 :List(Float32); # rad/s in device frame + transStd @2 :List(Float32); # std m/s in device frame + rotStd @3 :List(Float32); # std rad/s in device frame } struct Event { @@ -1599,5 +1712,11 @@ struct Event { uiLayoutState @57 :UiLayoutState; orbFeaturesSummary @58 :OrbFeaturesSummary; driverMonitoring @59 :DriverMonitoring; + boot @60 :Boot; + liveParameters @61 :LiveParametersData; + liveMapData @62 :LiveMapData; + cameraOdometry @63 :CameraOdometry; + pathPlan @64 :PathPlan; + kalmanOdometry @65 :KalmanOdometry; } } diff --git a/common/dbc.py b/common/dbc.py index 10303094914a95..6accad43f82bec 100755 --- a/common/dbc.py +++ b/common/dbc.py @@ -1,10 +1,9 @@ import re import os import struct -import bitstring import sys import numbers -from collections import namedtuple +from collections import namedtuple, defaultdict def int_or_float(s): # return number, trying to maintain int format @@ -17,6 +16,7 @@ def int_or_float(s): "DBCSignal", ["name", "start_bit", "size", "is_little_endian", "is_signed", "factor", "offset", "tmin", "tmax", "units"]) + class dbc(object): def __init__(self, fn): self.name, _ = os.path.splitext(os.path.basename(fn)) @@ -28,6 +28,7 @@ def __init__(self, fn): bo_regexp = re.compile(r"^BO\_ (\w+) (\w+) *: (\w+) (\w+)") sg_regexp = re.compile(r"^SG\_ (\w+) : (\d+)\|(\d+)@(\d+)([\+|\-]) \(([0-9.+\-eE]+),([0-9.+\-eE]+)\) \[([0-9.+\-eE]+)\|([0-9.+\-eE]+)\] \"(.*)\" (.*)") sgm_regexp = re.compile(r"^SG\_ (\w+) (\w+) *: (\d+)\|(\d+)@(\d+)([\+|\-]) \(([0-9.+\-eE]+),([0-9.+\-eE]+)\) \[([0-9.+\-eE]+)\|([0-9.+\-eE]+)\] \"(.*)\" (.*)") + val_regexp = re.compile(r"VAL\_ (\w+) (\w+) (\s*[-+]?[0-9]+\s+\".+?\"[^;]*)") # A dictionary which maps message ids to tuples ((name, size), signals). # name is the ASCII name of the message. @@ -36,6 +37,9 @@ def __init__(self, fn): # signals is a list of DBCSignal in order of increasing start_bit. self.msgs = {} + # A dictionary which maps message ids to a list of tuples (signal name, definition value pairs) + self.def_vals = defaultdict(list) + # lookup to bit reverse each byte self.bits_index = [(i & ~0b111) + ((-i-1) & 0b111) for i in xrange(64)] @@ -81,6 +85,30 @@ def __init__(self, fn): DBCSignal(sgname, start_bit, signal_size, is_little_endian, is_signed, factor, offset, tmin, tmax, units)) + if l.startswith("VAL_ "): + # new signal value/definition + dat = val_regexp.match(l) + + if dat is None: + print "bad VAL", l + ids = int(dat.group(1), 0) # could be hex + sgname = dat.group(2) + defvals = dat.group(3) + + defvals = defvals.replace("?","\?") #escape sequence in C++ + defvals = defvals.split('"')[:-1] + + defs = defvals[1::2] + #cleanup, convert to UPPER_CASE_WITH_UNDERSCORES + for i,d in enumerate(defs): + d = defs[i].strip().upper() + defs[i] = d.replace(" ","_") + + defvals[1::2] = defs + defvals = '"'+"".join(str(i) for i in defvals)+'"' + + self.def_vals[ids].append((sgname, defvals)) + for msg in self.msgs.viewvalues(): msg[1].sort(key=lambda x: x.start_bit) @@ -94,6 +122,16 @@ def lookup_msg_id(self, msg_id): msg_id = self.msg_name_to_address[msg_id] return msg_id + def reverse_bytes(self, x): + return ((x & 0xff00000000000000) >> 56) | \ + ((x & 0x00ff000000000000) >> 40) | \ + ((x & 0x0000ff0000000000) >> 24) | \ + ((x & 0x000000ff00000000) >> 8) | \ + ((x & 0x00000000ff000000) << 8) | \ + ((x & 0x0000000000ff0000) << 24) | \ + ((x & 0x000000000000ff00) << 40) | \ + ((x & 0x00000000000000ff) << 56) + def encode(self, msg_id, dd): """Encode a CAN message using the dbc. @@ -103,35 +141,40 @@ def encode(self, msg_id, dd): """ msg_id = self.lookup_msg_id(msg_id) - # TODO: Stop using bitstring, which is super slow. msg_def = self.msgs[msg_id] size = msg_def[0][1] - bsf = bitstring.Bits(hex="00"*size) + result = 0 for s in msg_def[1]: ival = dd.get(s.name) if ival is not None: - ival = (ival / s.factor) - s.offset - ival = int(round(ival)) - # should pack this + b2 = s.size if s.is_little_endian: - ss = s.start_bit + b1 = s.start_bit else: - ss = self.bits_index[s.start_bit] + b1 = (s.start_bit // 8) * 8 + (-s.start_bit - 1) % 8 + bo = 64 - (b1 + s.size) + ival = (ival / s.factor) - s.offset + ival = int(round(ival)) - if s.is_signed: - tbs = bitstring.Bits(int=ival, length=s.size) - else: - tbs = bitstring.Bits(uint=ival, length=s.size) + if s.is_signed and ival < 0: + ival = (1 << b2) + ival - lpad = bitstring.Bits(bin="0b"+"0"*ss) - rpad = bitstring.Bits(bin="0b"+"0"*(8*size-(ss+s.size))) - tbs = lpad+tbs+rpad + shift = b1 if s.is_little_endian else bo + mask = ((1 << b2) - 1) << shift + dat = (ival & ((1 << b2) - 1)) << shift - bsf |= tbs - return bsf.tobytes() + if s.is_little_endian: + mask = self.reverse_bytes(mask) + dat = self.reverse_bytes(dat) + + result &= ~mask + result |= dat + + result = struct.pack('>Q', result) + return result[:size] def decode(self, x, arr=None, debug=False): """Decode a CAN message using the dbc. @@ -167,54 +210,77 @@ def decode(self, x, arr=None, debug=False): if debug: print name - blen = 8*len(x[2]) - - st = x[2].rjust(8, '\x00') + st = x[2].ljust(8, '\x00') le, be = None, None for s in msg[1]: if arr is not None and s[0] not in arr: continue - # big or little endian? - # see http://vi-firmware.openxcplatform.com/en/master/config/bit-numbering.html - if s[3] is False: - ss = self.bits_index[s[1]] - if be is None: - be = struct.unpack(">Q", st)[0] - x2_int = be - data_bit_pos = (blen - (ss + s[2])) + start_bit = s[1] + signal_size = s[2] + little_endian = s[3] + signed = s[4] + factor = s[5] + offset = s[6] + + b2 = signal_size + if little_endian: + b1 = start_bit else: + b1 = (start_bit // 8) * 8 + (-start_bit - 1) % 8 + bo = 64 - (b1 + signal_size) + + if little_endian: if le is None: le = struct.unpack("Q", st)[0] + shift_amount = bo + tmp = be - if data_bit_pos < 0: + if shift_amount < 0: continue - ival = (x2_int >> data_bit_pos) & ((1 << (s[2])) - 1) - if s[4] and (ival & (1<<(s[2]-1))): # signed - ival -= (1<> shift_amount) & ((1 << b2) - 1) + if signed and (tmp >> (b2 - 1)): + tmp -= (1 << b2) + + tmp = tmp * factor + offset - # control the offset - ival = (ival * s[5]) + s[6] - #if debug: - # print "%40s %2d %2d %7.2f %s" % (s[0], s[1], s[2], ival, s[-1]) + # if debug: + # print "%40s %2d %2d %7.2f %s" % (s[0], s[1], s[2], tmp, s[-1]) if arr is None: - out[s[0]] = ival + out[s[0]] = tmp else: - out[arr.index(s[0])] = ival + out[arr.index(s[0])] = tmp return name, out def get_signals(self, msg): msg = self.lookup_msg_id(msg) return [sgs.name for sgs in self.msgs[msg][1]] + if __name__ == "__main__": from opendbc import DBC_PATH + import numpy as np + + dbc_test = dbc(os.path.join(DBC_PATH, 'toyota_prius_2017_pt_generated.dbc')) + msg = ('STEER_ANGLE_SENSOR', {'STEER_ANGLE': -6.0, 'STEER_RATE': 4, 'STEER_FRACTION': -0.2}) + encoded = dbc_test.encode(*msg) + decoded = dbc_test.decode((0x25, 0, encoded)) + assert decoded == msg + + dbc_test = dbc(os.path.join(DBC_PATH, 'hyundai_santa_fe_2019_ccan.dbc')) + decoded = dbc_test.decode((0x2b0, 0, "\xfa\xfe\x00\x07\x12")) + assert np.isclose(decoded[1]['SAS_Angle'], -26.2) + + msg = ('SAS11', {'SAS_Stat': 7.0, 'MsgCount': 0.0, 'SAS_Angle': -26.200000000000003, 'SAS_Speed': 0.0, 'CheckSum': 0.0}) + encoded = dbc_test.encode(*msg) + decoded = dbc_test.decode((0x2b0, 0, encoded)) - dbc_test = dbc(os.path.join(DBC_PATH, sys.argv[1])) - print dbc_test.get_signals(0xe4) + assert decoded == msg diff --git a/common/ffi_wrapper.py b/common/ffi_wrapper.py new file mode 100644 index 00000000000000..fd6b2bf7b3706e --- /dev/null +++ b/common/ffi_wrapper.py @@ -0,0 +1,51 @@ +import os +import sys +import fcntl +import hashlib +from cffi import FFI + +TMPDIR = "/tmp/ccache" + + +def ffi_wrap(name, c_code, c_header, tmpdir=TMPDIR, cflags="", libraries=None): + if libraries is None: + libraries = [] + + cache = name + "_" + hashlib.sha1(c_code).hexdigest() + try: + os.mkdir(tmpdir) + except OSError: + pass + + fd = os.open(tmpdir, 0) + fcntl.flock(fd, fcntl.LOCK_EX) + try: + sys.path.append(tmpdir) + try: + mod = __import__(cache) + except Exception: + print "cache miss", cache + compile_code(cache, c_code, c_header, tmpdir, cflags, libraries) + mod = __import__(cache) + finally: + os.close(fd) + + return mod.ffi, mod.lib + + +def compile_code(name, c_code, c_header, directory, cflags="", libraries=None): + if libraries is None: + libraries = [] + + ffibuilder = FFI() + ffibuilder.set_source(name, c_code, source_extension='.cpp', libraries=libraries) + ffibuilder.cdef(c_header) + os.environ['OPT'] = "-fwrapv -O2 -DNDEBUG -std=c++11" + os.environ['CFLAGS'] = cflags + ffibuilder.compile(verbose=True, debug=False, tmpdir=directory) + + +def wrap_compiled(name, directory): + sys.path.append(directory) + mod = __import__(name) + return mod.ffi, mod.lib diff --git a/common/filter_simple.py b/common/filter_simple.py new file mode 100644 index 00000000000000..a3206db1cc5684 --- /dev/null +++ b/common/filter_simple.py @@ -0,0 +1,10 @@ +class FirstOrderFilter(): + # first order filter + def __init__(self, x0, ts, dt): + self.k = (dt / ts) / (1. + dt / ts) + self.x = x0 + + def update(self, x): + self.x = (1. - self.k) * self.x + self.k * x + + diff --git a/common/params.py b/common/params.py index 9d1b096af13f2b..30ebaa0609799d 100755 --- a/common/params.py +++ b/common/params.py @@ -29,6 +29,7 @@ import tempfile from enum import Enum + def mkdirs_exists_ok(path): try: os.makedirs(path) @@ -36,51 +37,47 @@ def mkdirs_exists_ok(path): if not os.path.isdir(path): raise + class TxType(Enum): PERSISTENT = 1 CLEAR_ON_MANAGER_START = 2 CLEAR_ON_CAR_START = 3 + class UnknownKeyName(Exception): pass + keys = { -# written: manager -# read: loggerd, uploaderd, offroad - "DongleId": TxType.PERSISTENT, "AccessToken": TxType.PERSISTENT, - "Version": TxType.PERSISTENT, - "TrainingVersion": TxType.PERSISTENT, - "GitCommit": TxType.PERSISTENT, + "CalibrationParams": TxType.PERSISTENT, + "CarParams": TxType.CLEAR_ON_CAR_START, + "CompletedTrainingVersion": TxType.PERSISTENT, + "ControlsParams": TxType.PERSISTENT, + "DoUninstall": TxType.CLEAR_ON_MANAGER_START, + "DongleId": TxType.PERSISTENT, "GitBranch": TxType.PERSISTENT, + "GitCommit": TxType.PERSISTENT, "GitRemote": TxType.PERSISTENT, -# written: baseui -# read: ui, controls - "IsMetric": TxType.PERSISTENT, - "IsFcwEnabled": TxType.PERSISTENT, "HasAcceptedTerms": TxType.PERSISTENT, - "CompletedTrainingVersion": TxType.PERSISTENT, - "IsUploadVideoOverCellularEnabled": TxType.PERSISTENT, "IsDriverMonitoringEnabled": TxType.PERSISTENT, + "IsFcwEnabled": TxType.PERSISTENT, "IsGeofenceEnabled": TxType.PERSISTENT, -# written: visiond -# read: visiond, controlsd - "CalibrationParams": TxType.PERSISTENT, -# written: visiond -# read: visiond, ui - "CloudCalibration": TxType.PERSISTENT, -# written: controlsd -# read: radard - "CarParams": TxType.CLEAR_ON_CAR_START, - - "Passive": TxType.PERSISTENT, - "DoUninstall": TxType.CLEAR_ON_MANAGER_START, - "ShouldDoUpdate": TxType.CLEAR_ON_MANAGER_START, + "IsMetric": TxType.PERSISTENT, "IsUpdateAvailable": TxType.PERSISTENT, - + "IsUploadVideoOverCellularEnabled": TxType.PERSISTENT, + "LimitSetSpeed": TxType.PERSISTENT, + "LiveParameters": TxType.PERSISTENT, + "LongitudinalControl": TxType.PERSISTENT, + "Passive": TxType.PERSISTENT, "RecordFront": TxType.PERSISTENT, + "ShouldDoUpdate": TxType.CLEAR_ON_MANAGER_START, + "SpeedLimitOffset": TxType.PERSISTENT, + "TrainingVersion": TxType.PERSISTENT, + "Version": TxType.PERSISTENT, } + def fsync_dir(path): fd = os.open(path, os.O_RDONLY) try: @@ -266,23 +263,50 @@ def __exit__(self, type, value, traceback): self._lock = None +def read_db(params_path, key): + path = "%s/d/%s" % (params_path, key) + try: + with open(path, "rb") as f: + return f.read() + except IOError: + return None -class JSDB(object): - def __init__(self, fn): - self._fn = fn +def write_db(params_path, key, value): + prev_umask = os.umask(0) + lock = FileLock(params_path+"/.lock", True) + lock.acquire() - def begin(self, write=False): - if write: - return DBWriter(self._fn) - else: - return DBReader(self._fn) + try: + tmp_path = tempfile.mktemp(prefix=".tmp", dir=params_path) + with open(tmp_path, "wb") as f: + f.write(value) + f.flush() + os.fsync(f.fileno()) + + path = "%s/d/%s" % (params_path, key) + os.rename(tmp_path, path) + fsync_dir(os.path.dirname(path)) + finally: + os.umask(prev_umask) + lock.release() class Params(object): def __init__(self, db='/data/params'): - self.env = JSDB(db) + self.db = db + + # create the database if it doesn't exist... + if not os.path.exists(self.db+"/d"): + with self.transaction(write=True): + pass + + def transaction(self, write=False): + if write: + return DBWriter(self.db) + else: + return DBReader(self.db) def _clear_keys_with_type(self, tx_type): - with self.env.begin(write=True) as txn: + with self.transaction(write=True) as txn: for key in keys: if keys[key] == tx_type: txn.delete(key) @@ -294,7 +318,7 @@ def car_start(self): self._clear_keys_with_type(TxType.CLEAR_ON_CAR_START) def delete(self, key): - with self.env.begin(write=True) as txn: + with self.transaction(write=True) as txn: txn.delete(key) def get(self, key, block=False): @@ -302,8 +326,7 @@ def get(self, key, block=False): raise UnknownKeyName(key) while 1: - with self.env.begin() as txn: - ret = txn.get(key) + ret = read_db(self.db, key) if not block or ret is not None: break # is polling really the best we can do? @@ -314,8 +337,7 @@ def put(self, key, dat): if key not in keys: raise UnknownKeyName(key) - with self.env.begin(write=True) as txn: - txn.put(key, dat) + write_db(self.db, key, dat) if __name__ == "__main__": params = Params() diff --git a/common/sympy_helpers.py b/common/sympy_helpers.py new file mode 100644 index 00000000000000..879eb71bbf7c5f --- /dev/null +++ b/common/sympy_helpers.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +import sympy as sp +import numpy as np + +def cross(x): + ret = sp.Matrix(np.zeros((3,3))) + ret[0,1], ret[0,2] = -x[2], x[1] + ret[1,0], ret[1,2] = x[2], -x[0] + ret[2,0], ret[2,1] = -x[1], x[0] + return ret + +def euler_rotate(roll, pitch, yaw): + # make symbolic rotation matrix from eulers + matrix_roll = sp.Matrix([[1, 0, 0], + [0, sp.cos(roll), -sp.sin(roll)], + [0, sp.sin(roll), sp.cos(roll)]]) + matrix_pitch = sp.Matrix([[sp.cos(pitch), 0, sp.sin(pitch)], + [0, 1, 0], + [-sp.sin(pitch), 0, sp.cos(pitch)]]) + matrix_yaw = sp.Matrix([[sp.cos(yaw), -sp.sin(yaw), 0], + [sp.sin(yaw), sp.cos(yaw), 0], + [0, 0, 1]]) + return matrix_yaw*matrix_pitch*matrix_roll + +def quat_rotate(q0, q1, q2, q3): + # make symbolic rotation matrix from quat + return sp.Matrix([[q0**2 + q1**2 - q2**2 - q3**2, 2*(q1*q2 + q0*q3), 2*(q1*q3 - q0*q2)], + [2*(q1*q2 - q0*q3), q0**2 - q1**2 + q2**2 - q3**2, 2*(q2*q3 + q0*q1)], + [2*(q1*q3 + q0*q2), 2*(q2*q3 - q0*q1), q0**2 - q1**2 - q2**2 + q3**2]]).T + +def quat_matrix_l(p): + return sp.Matrix([[p[0], -p[1], -p[2], -p[3]], + [p[1], p[0], -p[3], p[2]], + [p[2], p[3], p[0], -p[1]], + [p[3], -p[2], p[1], p[0]]]) + +def quat_matrix_r(p): + return sp.Matrix([[p[0], -p[1], -p[2], -p[3]], + [p[1], p[0], p[3], -p[2]], + [p[2], -p[3], p[0], p[1]], + [p[3], p[2], -p[1], p[0]]]) + + +def sympy_into_c(sympy_functions): + from sympy.utilities import codegen + routines = [] + for name, expr, args in sympy_functions: + r = codegen.make_routine(name, expr, language="C99") + + # argument ordering input to sympy is broken with function with output arguments + nargs = [] + # reorder the input arguments + for aa in args: + if aa is None: + nargs.append(codegen.InputArgument(sp.Symbol('unused'), dimensions=[1,1])) + continue + found = False + for a in r.arguments: + if str(aa.name) == str(a.name): + nargs.append(a) + found = True + break + if not found: + # [1,1] is a hack for Matrices + nargs.append(codegen.InputArgument(aa, dimensions=[1,1])) + # add the output arguments + for a in r.arguments: + if type(a) == codegen.OutputArgument: + nargs.append(a) + + #assert len(r.arguments) == len(args)+1 + r.arguments = nargs + + # add routine to list + routines.append(r) + + [(c_name, c_code), (h_name, c_header)] = codegen.get_code_generator('C', 'ekf', 'C99').write(routines, "ekf") + c_code = '\n'.join(filter(lambda x: len(x) > 0 and x[0] != '#', c_code.split("\n"))) + c_header = '\n'.join(filter(lambda x: len(x) > 0 and x[0] != '#', c_header.split("\n"))) + + return c_header, c_code diff --git a/common/transformations/camera.py b/common/transformations/camera.py new file mode 100644 index 00000000000000..367c0879afb2d0 --- /dev/null +++ b/common/transformations/camera.py @@ -0,0 +1,174 @@ +import numpy as np +import common.transformations.orientation as orient +import cv2 + +FULL_FRAME_SIZE = (1164, 874) +W, H = FULL_FRAME_SIZE[0], FULL_FRAME_SIZE[1] +eon_focal_length = FOCAL = 910.0 + +# aka 'K' aka camera_frame_from_view_frame +eon_intrinsics = np.array([ + [FOCAL, 0., W/2.], + [ 0., FOCAL, H/2.], + [ 0., 0., 1.]]) + +# aka 'K_inv' aka view_frame_from_camera_frame +eon_intrinsics_inv = np.linalg.inv(eon_intrinsics) + + +# device/mesh : x->forward, y-> right, z->down +# view : x->right, y->down, z->forward +device_frame_from_view_frame = np.array([ + [ 0., 0., 1.], + [ 1., 0., 0.], + [ 0., 1., 0.] +]) +view_frame_from_device_frame = device_frame_from_view_frame.T + + +def get_calib_from_vp(vp): + vp_norm = normalize(vp) + yaw_calib = np.arctan(vp_norm[0]) + pitch_calib = -np.arctan(vp_norm[1]*np.cos(yaw_calib)) + roll_calib = 0 + return roll_calib, pitch_calib, yaw_calib + +# aka 'extrinsic_matrix' +# road : x->forward, y -> left, z->up +def get_view_frame_from_road_frame(roll, pitch, yaw, height): + device_from_road = orient.rot_from_euler([roll, pitch, yaw]).dot(np.diag([1, -1, -1])) + view_from_road = view_frame_from_device_frame.dot(device_from_road) + return np.hstack((view_from_road, [[0], [height], [0]])) + + +def vp_from_ke(m): + """ + Computes the vanishing point from the product of the intrinsic and extrinsic + matrices C = KE. + + The vanishing point is defined as lim x->infinity C (x, 0, 0, 1).T + """ + return (m[0, 0]/m[2,0], m[1,0]/m[2,0]) + +def roll_from_ke(m): + # note: different from calibration.h/RollAnglefromKE: i think that one's just wrong + return np.arctan2(-(m[1, 0] - m[1, 1] * m[2, 0] / m[2, 1]), + -(m[0, 0] - m[0, 1] * m[2, 0] / m[2, 1])) + + +def normalize(img_pts, intrinsics=eon_intrinsics): + # normalizes image coordinates + # accepts single pt or array of pts + intrinsics_inv = np.linalg.inv(intrinsics) + img_pts = np.array(img_pts) + input_shape = img_pts.shape + img_pts = np.atleast_2d(img_pts) + img_pts = np.hstack((img_pts, np.ones((img_pts.shape[0],1)))) + img_pts_normalized = img_pts.dot(intrinsics_inv.T) + img_pts_normalized[(img_pts < 0).any(axis=1)] = np.nan + return img_pts_normalized[:,:2].reshape(input_shape) + + +def denormalize(img_pts, intrinsics=eon_intrinsics): + # denormalizes image coordinates + # accepts single pt or array of pts + img_pts = np.array(img_pts) + input_shape = img_pts.shape + img_pts = np.atleast_2d(img_pts) + img_pts = np.hstack((img_pts, np.ones((img_pts.shape[0],1)))) + img_pts_denormalized = img_pts.dot(intrinsics.T) + img_pts_denormalized[img_pts_denormalized[:,0] > W] = np.nan + img_pts_denormalized[img_pts_denormalized[:,0] < 0] = np.nan + img_pts_denormalized[img_pts_denormalized[:,1] > H] = np.nan + img_pts_denormalized[img_pts_denormalized[:,1] < 0] = np.nan + return img_pts_denormalized[:,:2].reshape(input_shape) + + +def device_from_ecef(pos_ecef, orientation_ecef, pt_ecef): + # device from ecef frame + # device frame is x -> forward, y-> right, z -> down + # accepts single pt or array of pts + input_shape = pt_ecef.shape + pt_ecef = np.atleast_2d(pt_ecef) + ecef_from_device_rot = orient.rotations_from_quats(orientation_ecef) + device_from_ecef_rot = ecef_from_device_rot.T + pt_ecef_rel = pt_ecef - pos_ecef + pt_device = np.einsum('jk,ik->ij', device_from_ecef_rot, pt_ecef_rel) + return pt_device.reshape(input_shape) + + +def img_from_device(pt_device): + # img coordinates from pts in device frame + # first transforms to view frame, then to img coords + # accepts single pt or array of pts + input_shape = pt_device.shape + pt_device = np.atleast_2d(pt_device) + pt_view = np.einsum('jk,ik->ij', view_frame_from_device_frame, pt_device) + + # This function should never return negative depths + pt_view[pt_view[:,2] < 0] = np.nan + + pt_img = pt_view/pt_view[:,2:3] + return pt_img.reshape(input_shape)[:,:2] + + +#TODO please use generic img transform below +def rotate_img(img, eulers, crop=None, intrinsics=eon_intrinsics): + size = img.shape[:2] + rot = orient.rot_from_euler(eulers) + quadrangle = np.array([[0, 0], + [size[1]-1, 0], + [0, size[0]-1], + [size[1]-1, size[0]-1]], dtype=np.float32) + quadrangle_norm = np.hstack((normalize(quadrangle, intrinsics=intrinsics), np.ones((4,1)))) + warped_quadrangle_full = np.einsum('ij, kj->ki', intrinsics.dot(rot), quadrangle_norm) + warped_quadrangle = np.column_stack((warped_quadrangle_full[:,0]/warped_quadrangle_full[:,2], + warped_quadrangle_full[:,1]/warped_quadrangle_full[:,2])).astype(np.float32) + if crop: + W_border = (size[1] - crop[0])/2 + H_border = (size[0] - crop[1])/2 + outside_crop = (((warped_quadrangle[:,0] < W_border) | + (warped_quadrangle[:,0] >= size[1] - W_border)) & + ((warped_quadrangle[:,1] < H_border) | + (warped_quadrangle[:,1] >= size[0] - H_border))) + if not outside_crop.all(): + raise ValueError("warped image not contained inside crop") + else: + H_border, W_border = 0, 0 + M = cv2.getPerspectiveTransform(quadrangle, warped_quadrangle) + img_warped = cv2.warpPerspective(img, M, size[::-1]) + return img_warped[H_border: size[0] - H_border, + W_border: size[1] - W_border] + + +def transform_img(base_img, + augment_trans=np.array([0,0,0]), + augment_eulers=np.array([0,0,0]), + from_intr=eon_intrinsics, + to_intr=eon_intrinsics, + calib_rot_view=None, + output_size=None): + cy = from_intr[1,2] + size = base_img.shape[:2] + if not output_size: + output_size = size[::-1] + h = 1.22 + quadrangle = np.array([[0, cy + 20], + [size[1]-1, cy + 20], + [0, size[0]-1], + [size[1]-1, size[0]-1]], dtype=np.float32) + quadrangle_norm = np.hstack((normalize(quadrangle, intrinsics=from_intr), np.ones((4,1)))) + quadrangle_world = np.column_stack((h*quadrangle_norm[:,0]/quadrangle_norm[:,1], + h*np.ones(4), + h/quadrangle_norm[:,1])) + rot = orient.rot_from_euler(augment_eulers) + if calib_rot_view is not None: + rot = calib_rot_view.dot(rot) + to_extrinsics = np.hstack((rot.T, -augment_trans[:,None])) + to_KE = to_intr.dot(to_extrinsics) + warped_quadrangle_full = np.einsum('jk,ik->ij', to_KE, np.hstack((quadrangle_world, np.ones((4,1))))) + warped_quadrangle = np.column_stack((warped_quadrangle_full[:,0]/warped_quadrangle_full[:,2], + warped_quadrangle_full[:,1]/warped_quadrangle_full[:,2])).astype(np.float32) + M = cv2.getPerspectiveTransform(quadrangle, warped_quadrangle.astype(np.float32)) + augmented_rgb = cv2.warpPerspective(base_img, M, output_size, borderMode=cv2.BORDER_REPLICATE) + return augmented_rgb diff --git a/common/transformations/coordinates.py b/common/transformations/coordinates.py index 1cd7a8e9d560db..568fb9bf2b3f4e 100644 --- a/common/transformations/coordinates.py +++ b/common/transformations/coordinates.py @@ -12,12 +12,14 @@ e1sq = 6.73949674228 * 0.001 -def geodetic2ecef(geodetic): +def geodetic2ecef(geodetic, radians=False): geodetic = np.array(geodetic) input_shape = geodetic.shape geodetic = np.atleast_2d(geodetic) - lat = (np.pi/180)*geodetic[:,0] - lon = (np.pi/180)*geodetic[:,1] + + ratio = 1.0 if radians else (np.pi / 180.0) + lat = ratio*geodetic[:,0] + lon = ratio*geodetic[:,1] alt = geodetic[:,2] xi = np.sqrt(1 - esq * np.sin(lat)**2) @@ -28,41 +30,41 @@ def geodetic2ecef(geodetic): return ecef.reshape(input_shape) -def ecef2geodetic(ecef): +def ecef2geodetic(ecef, radians=False): """ Convert ECEF coordinates to geodetic using ferrari's method """ - def ferrari(x, y, z): - # ferrari's method - r = np.sqrt(x * x + y * y) - Esq = a * a - b * b - F = 54 * b * b * z * z - G = r * r + (1 - esq) * z * z - esq * Esq - C = (esq * esq * F * r * r) / (pow(G, 3)) - S = np.cbrt(1 + C + np.sqrt(C * C + 2 * C)) - P = F / (3 * pow((S + 1 / S + 1), 2) * G * G) - Q = np.sqrt(1 + 2 * esq * esq * P) - r_0 = -(P * esq * r) / (1 + Q) + np.sqrt(0.5 * a * a*(1 + 1.0 / Q) - \ - P * (1 - esq) * z * z / (Q * (1 + Q)) - 0.5 * P * r * r) - U = np.sqrt(pow((r - esq * r_0), 2) + z * z) - V = np.sqrt(pow((r - esq * r_0), 2) + (1 - esq) * z * z) - Z_0 = b * b * z / (a * V) - h = U * (1 - b * b / (a * V)) - lat = (180/np.pi)*np.arctan((z + e1sq * Z_0) / r) - lon = (180/np.pi)*np.arctan2(y, x) - return lat, lon, h - - geodetic = [] - ecef = np.array(ecef) + # Save shape and export column + ecef = np.atleast_1d(ecef) input_shape = ecef.shape ecef = np.atleast_2d(ecef) - for p in ecef: - geodetic.append(ferrari(*p)) - geodetic = np.array(geodetic) + x, y, z = ecef[:, 0], ecef[:, 1], ecef[:, 2] + + ratio = 1.0 if radians else (180.0 / np.pi) + + # Conver from ECEF to geodetic using Ferrari's methods + # https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#Ferrari.27s_solution + r = np.sqrt(x * x + y * y) + Esq = a * a - b * b + F = 54 * b * b * z * z + G = r * r + (1 - esq) * z * z - esq * Esq + C = (esq * esq * F * r * r) / (pow(G, 3)) + S = np.cbrt(1 + C + np.sqrt(C * C + 2 * C)) + P = F / (3 * pow((S + 1 / S + 1), 2) * G * G) + Q = np.sqrt(1 + 2 * esq * esq * P) + r_0 = -(P * esq * r) / (1 + Q) + np.sqrt(0.5 * a * a*(1 + 1.0 / Q) - \ + P * (1 - esq) * z * z / (Q * (1 + Q)) - 0.5 * P * r * r) + U = np.sqrt(pow((r - esq * r_0), 2) + z * z) + V = np.sqrt(pow((r - esq * r_0), 2) + (1 - esq) * z * z) + Z_0 = b * b * z / (a * V) + h = U * (1 - b * b / (a * V)) + lat = ratio*np.arctan((z + e1sq * Z_0) / r) + lon = ratio*np.arctan2(y, x) + + # stack the new columns and return to the original shape + geodetic = np.column_stack((lat, lon, h)) return geodetic.reshape(input_shape) - - class LocalCoord(object): """ Allows conversions to local frames. In this case NED. diff --git a/common/transformations/model.py b/common/transformations/model.py new file mode 100644 index 00000000000000..2d41d9cebe354d --- /dev/null +++ b/common/transformations/model.py @@ -0,0 +1,141 @@ +import numpy as np + +from common.transformations.camera import eon_focal_length, \ + vp_from_ke, \ + get_view_frame_from_road_frame, \ + FULL_FRAME_SIZE + +# segnet + +SEGNET_SIZE = (512, 384) + +segnet_frame_from_camera_frame = np.array([ + [float(SEGNET_SIZE[0])/FULL_FRAME_SIZE[0], 0., ], + [ 0., float(SEGNET_SIZE[1])/FULL_FRAME_SIZE[1]]]) + + +# model + +MODEL_INPUT_SIZE = (320, 160) +MODEL_YUV_SIZE = (MODEL_INPUT_SIZE[0], MODEL_INPUT_SIZE[1] * 3 // 2) +MODEL_CX = MODEL_INPUT_SIZE[0]/2. +MODEL_CY = 21. + +model_zoom = 1.25 +model_height = 1.22 + +# canonical model transform +model_intrinsics = np.array( + [[ eon_focal_length / model_zoom, 0. , MODEL_CX], + [ 0. , eon_focal_length / model_zoom, MODEL_CY], + [ 0. , 0. , 1.]]) + + +# MED model +MEDMODEL_INPUT_SIZE = (640, 240) +MEDMODEL_YUV_SIZE = (MEDMODEL_INPUT_SIZE[0], MEDMODEL_INPUT_SIZE[1] * 3 // 2) +MEDMODEL_CY = 47.6 + +medmodel_zoom = 1. +medmodel_intrinsics = np.array( + [[ eon_focal_length / medmodel_zoom, 0. , 0.5 * MEDMODEL_INPUT_SIZE[0]], + [ 0. , eon_focal_length / medmodel_zoom, MEDMODEL_CY], + [ 0. , 0. , 1.]]) + + +# BIG model + +BIGMODEL_INPUT_SIZE = (864, 288) +BIGMODEL_YUV_SIZE = (BIGMODEL_INPUT_SIZE[0], BIGMODEL_INPUT_SIZE[1] * 3 // 2) + +bigmodel_zoom = 1. +bigmodel_intrinsics = np.array( + [[ eon_focal_length / bigmodel_zoom, 0. , 0.5 * BIGMODEL_INPUT_SIZE[0]], + [ 0. , eon_focal_length / bigmodel_zoom, 0.2 * BIGMODEL_INPUT_SIZE[1]], + [ 0. , 0. , 1.]]) + + +bigmodel_border = np.array([ + [0,0,1], + [BIGMODEL_INPUT_SIZE[0], 0, 1], + [BIGMODEL_INPUT_SIZE[0], BIGMODEL_INPUT_SIZE[1], 1], + [0, BIGMODEL_INPUT_SIZE[1], 1], +]) + + +model_frame_from_road_frame = np.dot(model_intrinsics, + get_view_frame_from_road_frame(0, 0, 0, model_height)) + +bigmodel_frame_from_road_frame = np.dot(bigmodel_intrinsics, + get_view_frame_from_road_frame(0, 0, 0, model_height)) + +medmodel_frame_from_road_frame = np.dot(medmodel_intrinsics, + get_view_frame_from_road_frame(0, 0, 0, model_height)) + +model_frame_from_bigmodel_frame = np.dot(model_intrinsics, np.linalg.inv(bigmodel_intrinsics)) + +# 'camera from model camera' +def get_model_height_transform(camera_frame_from_road_frame, height): + camera_frame_from_road_ground = np.dot(camera_frame_from_road_frame, np.array([ + [1, 0, 0], + [0, 1, 0], + [0, 0, 0], + [0, 0, 1], + ])) + + camera_frame_from_road_high = np.dot(camera_frame_from_road_frame, np.array([ + [1, 0, 0], + [0, 1, 0], + [0, 0, height - model_height], + [0, 0, 1], + ])) + + road_high_from_camera_frame = np.linalg.inv(camera_frame_from_road_high) + high_camera_from_low_camera = np.dot(camera_frame_from_road_ground, road_high_from_camera_frame) + + return high_camera_from_low_camera + + +# camera_frame_from_model_frame aka 'warp matrix' +# was: calibration.h/CalibrationTransform +def get_camera_frame_from_model_frame(camera_frame_from_road_frame, height=model_height): + vp = vp_from_ke(camera_frame_from_road_frame) + + model_camera_from_model_frame = np.array([ + [model_zoom, 0., vp[0] - MODEL_CX * model_zoom], + [ 0., model_zoom, vp[1] - MODEL_CY * model_zoom], + [ 0., 0., 1.], + ]) + + # This function is super slow, so skip it if height is very close to canonical + # TODO: speed it up! + if abs(height - model_height) > 0.001: # + camera_from_model_camera = get_model_height_transform(camera_frame_from_road_frame, height) + else: + camera_from_model_camera = np.eye(3) + + return np.dot(camera_from_model_camera, model_camera_from_model_frame) + + +def get_camera_frame_from_bigmodel_frame(camera_frame_from_road_frame): + camera_frame_from_ground = camera_frame_from_road_frame[:, (0, 1, 3)] + bigmodel_frame_from_ground = bigmodel_frame_from_road_frame[:, (0, 1, 3)] + + ground_from_bigmodel_frame = np.linalg.inv(bigmodel_frame_from_ground) + camera_frame_from_bigmodel_frame = np.dot(camera_frame_from_ground, ground_from_bigmodel_frame) + + return camera_frame_from_bigmodel_frame + + +def get_model_frame(snu_full, camera_frame_from_model_frame, size): + idxs = camera_frame_from_model_frame.dot(np.column_stack([np.tile(np.arange(size[0]), size[1]), + np.tile(np.arange(size[1]), (size[0],1)).T.flatten(), + np.ones(size[0] * size[1])]).T).T.astype(int) + calib_flat = snu_full[idxs[:,1], idxs[:,0]] + if len(snu_full.shape) == 3: + calib = calib_flat.reshape((size[1], size[0], 3)) + elif len(snu_full.shape) == 2: + calib = calib_flat.reshape((size[1], size[0])) + else: + raise ValueError("shape of input img is weird") + return calib diff --git a/common/transformations/orientation.py b/common/transformations/orientation.py new file mode 100644 index 00000000000000..33a822ca3fd498 --- /dev/null +++ b/common/transformations/orientation.py @@ -0,0 +1,295 @@ +import numpy as np +from numpy import dot, inner, array, linalg +from common.transformations.coordinates import LocalCoord + + +''' +Vectorized functions that transform between +rotation matrices, euler angles and quaternions. +All support lists, array or array of arrays as inputs. +Supports both x2y and y_from_x format (y_from_x preferred!). +''' + +def euler2quat(eulers): + eulers = array(eulers) + if len(eulers.shape) > 1: + output_shape = (-1,4) + else: + output_shape = (4,) + eulers = np.atleast_2d(eulers) + gamma, theta, psi = eulers[:,0], eulers[:,1], eulers[:,2] + + q0 = np.cos(gamma / 2) * np.cos(theta / 2) * np.cos(psi / 2) + \ + np.sin(gamma / 2) * np.sin(theta / 2) * np.sin(psi / 2) + q1 = np.sin(gamma / 2) * np.cos(theta / 2) * np.cos(psi / 2) - \ + np.cos(gamma / 2) * np.sin(theta / 2) * np.sin(psi / 2) + q2 = np.cos(gamma / 2) * np.sin(theta / 2) * np.cos(psi / 2) + \ + np.sin(gamma / 2) * np.cos(theta / 2) * np.sin(psi / 2) + q3 = np.cos(gamma / 2) * np.cos(theta / 2) * np.sin(psi / 2) - \ + np.sin(gamma / 2) * np.sin(theta / 2) * np.cos(psi / 2) + + quats = array([q0, q1, q2, q3]).T + for i in xrange(len(quats)): + if quats[i,0] < 0: + quats[i] = -quats[i] + return quats.reshape(output_shape) + + +def quat2euler(quats): + quats = array(quats) + if len(quats.shape) > 1: + output_shape = (-1,3) + else: + output_shape = (3,) + quats = np.atleast_2d(quats) + q0, q1, q2, q3 = quats[:,0], quats[:,1], quats[:,2], quats[:,3] + + gamma = np.arctan2(2 * (q0 * q1 + q2 * q3), 1 - 2 * (q1**2 + q2**2)) + theta = np.arcsin(2 * (q0 * q2 - q3 * q1)) + psi = np.arctan2(2 * (q0 * q3 + q1 * q2), 1 - 2 * (q2**2 + q3**2)) + + eulers = array([gamma, theta, psi]).T + return eulers.reshape(output_shape) + + +def quat2rot(quats): + quats = array(quats) + input_shape = quats.shape + quats = np.atleast_2d(quats) + Rs = np.zeros((quats.shape[0], 3, 3)) + q0 = quats[:, 0] + q1 = quats[:, 1] + q2 = quats[:, 2] + q3 = quats[:, 3] + Rs[:, 0, 0] = q0 * q0 + q1 * q1 - q2 * q2 - q3 * q3 + Rs[:, 0, 1] = 2 * (q1 * q2 - q0 * q3) + Rs[:, 0, 2] = 2 * (q0 * q2 + q1 * q3) + Rs[:, 1, 0] = 2 * (q1 * q2 + q0 * q3) + Rs[:, 1, 1] = q0 * q0 - q1 * q1 + q2 * q2 - q3 * q3 + Rs[:, 1, 2] = 2 * (q2 * q3 - q0 * q1) + Rs[:, 2, 0] = 2 * (q1 * q3 - q0 * q2) + Rs[:, 2, 1] = 2 * (q0 * q1 + q2 * q3) + Rs[:, 2, 2] = q0 * q0 - q1 * q1 - q2 * q2 + q3 * q3 + + if len(input_shape) < 2: + return Rs[0] + else: + return Rs + + +def rot2quat(rots): + input_shape = rots.shape + if len(input_shape) < 3: + rots = array([rots]) + K3 = np.empty((len(rots), 4, 4)) + K3[:, 0, 0] = (rots[:, 0, 0] - rots[:, 1, 1] - rots[:, 2, 2]) / 3.0 + K3[:, 0, 1] = (rots[:, 1, 0] + rots[:, 0, 1]) / 3.0 + K3[:, 0, 2] = (rots[:, 2, 0] + rots[:, 0, 2]) / 3.0 + K3[:, 0, 3] = (rots[:, 1, 2] - rots[:, 2, 1]) / 3.0 + K3[:, 1, 0] = K3[:, 0, 1] + K3[:, 1, 1] = (rots[:, 1, 1] - rots[:, 0, 0] - rots[:, 2, 2]) / 3.0 + K3[:, 1, 2] = (rots[:, 2, 1] + rots[:, 1, 2]) / 3.0 + K3[:, 1, 3] = (rots[:, 2, 0] - rots[:, 0, 2]) / 3.0 + K3[:, 2, 0] = K3[:, 0, 2] + K3[:, 2, 1] = K3[:, 1, 2] + K3[:, 2, 2] = (rots[:, 2, 2] - rots[:, 0, 0] - rots[:, 1, 1]) / 3.0 + K3[:, 2, 3] = (rots[:, 0, 1] - rots[:, 1, 0]) / 3.0 + K3[:, 3, 0] = K3[:, 0, 3] + K3[:, 3, 1] = K3[:, 1, 3] + K3[:, 3, 2] = K3[:, 2, 3] + K3[:, 3, 3] = (rots[:, 0, 0] + rots[:, 1, 1] + rots[:, 2, 2]) / 3.0 + q = np.empty((len(rots), 4)) + for i in xrange(len(rots)): + _, eigvecs = linalg.eigh(K3[i].T) + eigvecs = eigvecs[:,3:] + q[i, 0] = eigvecs[-1] + q[i, 1:] = -eigvecs[:-1].flatten() + if q[i, 0] < 0: + q[i] = -q[i] + + if len(input_shape) < 3: + return q[0] + else: + return q + + +def euler2rot(eulers): + return rotations_from_quats(euler2quat(eulers)) + + +def rot2euler(rots): + return quat2euler(quats_from_rotations(rots)) + + +quats_from_rotations = rot2quat +quat_from_rot = rot2quat +rotations_from_quats = quat2rot +rot_from_quat= quat2rot +rot_from_quat= quat2rot +euler_from_rot = rot2euler +euler_from_quat = quat2euler +rot_from_euler = euler2rot +quat_from_euler = euler2quat + + + + + + +''' +Random helpers below +''' + + +def quat_product(q, r): + t = np.zeros(4) + t[0] = r[0] * q[0] - r[1] * q[1] - r[2] * q[2] - r[3] * q[3] + t[1] = r[0] * q[1] + r[1] * q[0] - r[2] * q[3] + r[3] * q[2] + t[2] = r[0] * q[2] + r[1] * q[3] + r[2] * q[0] - r[3] * q[1] + t[3] = r[0] * q[3] - r[1] * q[2] + r[2] * q[1] + r[3] * q[0] + return t + + +def rot_matrix(roll, pitch, yaw): + cr, sr = np.cos(roll), np.sin(roll) + cp, sp = np.cos(pitch), np.sin(pitch) + cy, sy = np.cos(yaw), np.sin(yaw) + rr = array([[1,0,0],[0, cr,-sr],[0, sr, cr]]) + rp = array([[cp,0,sp],[0, 1,0],[-sp, 0, cp]]) + ry = array([[cy,-sy,0],[sy, cy,0],[0, 0, 1]]) + return ry.dot(rp.dot(rr)) + + +def rot(axis, angle): + # Rotates around an arbitrary axis + ret_1 = (1 - np.cos(angle)) * array([[axis[0]**2, axis[0] * axis[1], axis[0] * axis[2]], [ + axis[1] * axis[0], axis[1]**2, axis[1] * axis[2] + ], [axis[2] * axis[0], axis[2] * axis[1], axis[2]**2]]) + ret_2 = np.cos(angle) * np.eye(3) + ret_3 = np.sin(angle) * array([[0, -axis[2], axis[1]], [axis[2], 0, -axis[0]], + [-axis[1], axis[0], 0]]) + return ret_1 + ret_2 + ret_3 + + +def ecef_euler_from_ned(ned_ecef_init, ned_pose): + ''' + Got it from here: + Using Rotations to Build Aerospace Coordinate Systems + -Don Koks + ''' + converter = LocalCoord.from_ecef(ned_ecef_init) + x0 = converter.ned2ecef([1, 0, 0]) - converter.ned2ecef([0, 0, 0]) + y0 = converter.ned2ecef([0, 1, 0]) - converter.ned2ecef([0, 0, 0]) + z0 = converter.ned2ecef([0, 0, 1]) - converter.ned2ecef([0, 0, 0]) + + x1 = rot(z0, ned_pose[2]).dot(x0) + y1 = rot(z0, ned_pose[2]).dot(y0) + z1 = rot(z0, ned_pose[2]).dot(z0) + + x2 = rot(y1, ned_pose[1]).dot(x1) + y2 = rot(y1, ned_pose[1]).dot(y1) + z2 = rot(y1, ned_pose[1]).dot(z1) + + x3 = rot(x2, ned_pose[0]).dot(x2) + y3 = rot(x2, ned_pose[0]).dot(y2) + #z3 = rot(x2, ned_pose[0]).dot(z2) + + x0 = array([1, 0, 0]) + y0 = array([0, 1, 0]) + z0 = array([0, 0, 1]) + + psi = np.arctan2(inner(x3, y0), inner(x3, x0)) + theta = np.arctan2(-inner(x3, z0), np.sqrt(inner(x3, x0)**2 + inner(x3, y0)**2)) + y2 = rot(z0, psi).dot(y0) + z2 = rot(y2, theta).dot(z0) + phi = np.arctan2(inner(y3, z2), inner(y3, y2)) + + ret = array([phi, theta, psi]) + return ret + + +def ned_euler_from_ecef(ned_ecef_init, ecef_poses): + ''' + Got the math from here: + Using Rotations to Build Aerospace Coordinate Systems + -Don Koks + + Also accepts array of ecef_poses and array of ned_ecef_inits. + Where each row is a pose and an ecef_init. + ''' + ned_ecef_init = array(ned_ecef_init) + ecef_poses = array(ecef_poses) + output_shape = ecef_poses.shape + ned_ecef_init = np.atleast_2d(ned_ecef_init) + if ned_ecef_init.shape[0] == 1: + ned_ecef_init = np.tile(ned_ecef_init[0], (output_shape[0], 1)) + ecef_poses = np.atleast_2d(ecef_poses) + + ned_poses = np.zeros(ecef_poses.shape) + for i, ecef_pose in enumerate(ecef_poses): + converter = LocalCoord.from_ecef(ned_ecef_init[i]) + x0 = array([1, 0, 0]) + y0 = array([0, 1, 0]) + z0 = array([0, 0, 1]) + + x1 = rot(z0, ecef_pose[2]).dot(x0) + y1 = rot(z0, ecef_pose[2]).dot(y0) + z1 = rot(z0, ecef_pose[2]).dot(z0) + + x2 = rot(y1, ecef_pose[1]).dot(x1) + y2 = rot(y1, ecef_pose[1]).dot(y1) + z2 = rot(y1, ecef_pose[1]).dot(z1) + + x3 = rot(x2, ecef_pose[0]).dot(x2) + y3 = rot(x2, ecef_pose[0]).dot(y2) + #z3 = rot(x2, ecef_pose[0]).dot(z2) + + x0 = converter.ned2ecef([1, 0, 0]) - converter.ned2ecef([0, 0, 0]) + y0 = converter.ned2ecef([0, 1, 0]) - converter.ned2ecef([0, 0, 0]) + z0 = converter.ned2ecef([0, 0, 1]) - converter.ned2ecef([0, 0, 0]) + + psi = np.arctan2(inner(x3, y0), inner(x3, x0)) + theta = np.arctan2(-inner(x3, z0), np.sqrt(inner(x3, x0)**2 + inner(x3, y0)**2)) + y2 = rot(z0, psi).dot(y0) + z2 = rot(y2, theta).dot(z0) + phi = np.arctan2(inner(y3, z2), inner(y3, y2)) + ned_poses[i] = array([phi, theta, psi]) + + return ned_poses.reshape(output_shape) + + +def ecef2car(car_ecef, psi, theta, points_ecef, ned_converter): + """ + TODO: add roll rotation + Converts an array of points in ecef coordinates into + x-forward, y-left, z-up coordinates + Parameters + ---------- + psi: yaw, radian + theta: pitch, radian + Returns + ------- + [x, y, z] coordinates in car frame + """ + + # input is an array of points in ecef cocrdinates + # output is an array of points in car's coordinate (x-front, y-left, z-up) + + # convert points to NED + points_ned = [] + for p in points_ecef: + points_ned.append(ned_converter.ecef2ned_matrix.dot(array(p) - car_ecef)) + + points_ned = np.vstack(points_ned).T + + # n, e, d -> x, y, z + # Calculate relative postions and rotate wrt to heading and pitch of car + invert_R = array([[1., 0., 0.], [0., -1., 0.], [0., 0., -1.]]) + + c, s = np.cos(psi), np.sin(psi) + yaw_R = array([[c, s, 0.], [-s, c, 0.], [0., 0., 1.]]) + + c, s = np.cos(theta), np.sin(theta) + pitch_R = array([[c, 0., -s], [0., 1., 0.], [s, 0., c]]) + + return dot(pitch_R, dot(yaw_R, dot(invert_R, points_ned))) diff --git a/installer/updater/updater b/installer/updater/updater index a5defb4108b556..0b8602b3550175 100755 Binary files a/installer/updater/updater and b/installer/updater/updater differ diff --git a/models/driving_model.dlc b/models/driving_model.dlc new file mode 100644 index 00000000000000..a33c1feb084a55 Binary files /dev/null and b/models/driving_model.dlc differ diff --git a/models/monitoring_model.dlc b/models/monitoring_model.dlc new file mode 100644 index 00000000000000..0b9f8060d93d92 Binary files /dev/null and b/models/monitoring_model.dlc differ diff --git a/models/posenet.dlc b/models/posenet.dlc new file mode 100644 index 00000000000000..58dee250f73032 Binary files /dev/null and b/models/posenet.dlc differ diff --git a/opendbc/ESR.dbc b/opendbc/ESR.dbc new file mode 100644 index 00000000000000..e3837a68b2ff5a --- /dev/null +++ b/opendbc/ESR.dbc @@ -0,0 +1,1080 @@ +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: Gateway ESR +VAL_TABLE_ ForwardReverse 1 "Reverse" 0 "Forward" ; +VAL_TABLE_ LeftRight 1 "Right Clockwise" 0 "Left CounterClockwise" ; +VAL_TABLE_ ValidInvalid 1 "Valid" 0 "Invalid" ; +VAL_TABLE_ TrueFalse 1 "True" 0 "False" ; + + +BO_ 1343 Target64: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1342 Target63: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1341 Target62: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1340 Target61: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1339 Target60: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1338 Target59: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1337 Target58: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1336 Target57: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1335 Target56: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1334 Target55: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1333 Target54: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1332 Target53: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1331 Target52: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1330 Target51: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1329 Target50: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1328 Target49: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1327 Target48: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1326 Target47: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1325 Target46: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1324 Target45: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1323 Target44: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1322 Target43: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1321 Target42: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1320 Target41: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1319 Target40: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1318 Target39: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1317 Target38: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1316 Target37: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1315 Target36: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1314 Target35: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1313 Target34: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1312 Target33: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1311 Target32: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1310 Target31: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1309 Target30: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1308 Target29: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1307 Target28: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1306 Target27: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1305 Target26: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1304 Target25: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1303 Target24: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1302 Target23: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1301 Target22: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1300 Target21: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1299 Target20: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1298 Target19: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1297 Target18: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1296 Target17: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1295 Target16: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1294 Target15: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1293 Target14: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1292 Target13: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1291 Target12: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1290 Target11: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1289 Target10: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1288 Target9: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1287 Target8: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1285 Target6: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1286 Target7: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1284 Target5: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1283 Target4: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1282 Target3: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1281 Target2: 8 Vector__XXX + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1524 VehicleData3: 8 Gateway + SG_ CAN_RX_YAW_RATE_BIAS_SHIFT : 15|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_WHEELBASE : 55|8@0+ (2,200) [200|710] "cm" Vector__XXX + SG_ CAN_RX_STEERING_GEAR_RATIO : 63|8@0+ (0.125,0) [0|31.875] "" Vector__XXX + SG_ CAN_RX_OVERSTEER_UNDERSTEER : 7|8@0- (1,0) [-128|127] "%" Vector__XXX + SG_ CAN_RX_FUNNEL_OFFSET_RIGHT : 31|8@0- (0.1,0) [-12.8|12.7] "m" Vector__XXX + SG_ CAN_RX_FUNNEL_OFFSET_LEFT : 23|8@0- (0.1,0) [-12.8|12.7] "m" Vector__XXX + SG_ CAN_RX_DISTANCE_REAR_AXLE : 47|8@0+ (2,200) [200|710] "cm" Vector__XXX + SG_ CAN_RX_CW_BLOCKAGE_TRESHOLD : 39|8@0+ (0.0078125,0) [0|1.9921875] "" Vector__XXX + SG_ CAN_RX_BEAMWIDTH_VERT : 14|7@0+ (0.0625,0) [0|7.9375] "deg" Vector__XXX + +BO_ 1523 FactoryAlignment: 8 Gateway + +BO_ 1522 Vehicle_Data2: 8 Gateway + SG_ CAN_RX_WHEEL_SLIP : 41|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_RX_SERV_ALIGN_UPDATES_NEED : 55|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_RX_SERV_ALIGN_TYPE : 47|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_RADAR_HEIGHT : 38|7@0+ (1,0) [0|127] "cm" Vector__XXX + SG_ CAN_RX_RADAR_FOV_MR : 30|7@0+ (1,0) [0|127] "deg" Vector__XXX + SG_ CAN_RX_RADAR_FOV_LR : 19|5@0+ (1,0) [0|31] "deg" Vector__XXX + SG_ CAN_RX_LONG_ACCEL_VALIDITY : 7|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_LONG_ACCEL : 12|9@0- (0.03125,0) [-8|7.96875] "m/s^2" Vector__XXX + SG_ CAN_RX_LAT_ACCEL_VALIDITY : 6|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_LAT_ACCEL : 5|9@0- (0.03125,0) [-8|7.96875] "m/s^2" Vector__XXX + SG_ CAN_RX_AUTO_ALIGN_DISABLE : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_AUTO_ALIGN_CONVERGED : 42|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_ANGLE_MOUNTING_OFFSET : 63|8@0- (0.0625,0) [-8|7.9375] "deg" Vector__XXX + SG_ CAN_RX_AALIGN_AVG_CTR_TOTAL : 45|3@0+ (250,250) [250|2000] "" Vector__XXX + +BO_ 1512 CIPV_Targets_Etc: 8 ESR + +BO_ 1511 ESR_History_Fault: 8 ESR + +BO_ 1510 ESR_Active_Fault: 8 ESR + +BO_ 1508 AD_Data: 8 ESR + +BO_ 1489 SensorValidation2: 8 ESR + SG_ CAN_TX_VALID_MR_SN : 7|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_TX_VALID_MR_RANGE_RATE : 31|16@0- (0.0078125,0) [-256|255.9921875] "m/s" Vector__XXX + SG_ CAN_TX_VALID_MR_RANGE : 15|16@0+ (0.0078125,0) [0|511.9921875] "m" Vector__XXX + SG_ CAN_TX_VALID_MR_POWER : 63|8@0- (1,0) [-128|127] "db" Vector__XXX + SG_ CAN_TX_VALID_MR_ANGLE : 40|16@1- (0.0625,0) [-2048|2047.9375] "deg" Vector__XXX + +BO_ 1488 SensorValidation: 8 ESR + SG_ CAN_TX_VALID_LR_SN : 7|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_TX_VALID_LR_RANGE_RATE : 31|16@0- (0.0078125,0) [-256|255.9921875] "m/s" Vector__XXX + SG_ CAN_TX_VALID_LR_RANGE : 15|16@0+ (0.0078125,0) [0|511.9921875] "m" Vector__XXX + SG_ CAN_TX_VALID_LR_POWER : 63|8@0- (1,0) [-128|127] "db" Vector__XXX + SG_ CAN_TX_VALID_LR_ANGLE : 47|16@0- (0.0625,0) [-2048|2047.9375] "deg" Vector__XXX + +BO_ 1344 Track_Sensor: 1 ESR + SG_ CAN_TX_TRACK_ROLLING_COUNT_2 : 4|1@0+ (1,0) [0|1] "" Vector__XXX + +BO_ 1280 Target1: 8 ESR + SG_ CAN_TX_TRACK_WIDTH : 37|4@0+ (0.5,0) [0|7.5] "" Vector__XXX + SG_ CAN_TX_TRACK_STATUS : 15|3@0+ (1,0) [0|7] "" Vector__XXX + SG_ CAN_TX_TRACK_ROLLING_COUNT : 38|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_RATE : 53|14@0- (0.01,0) [-81.92|81.91] "m/s" Vector__XXX + SG_ CAN_TX_TRACK_RANGE_ACCEL : 33|10@0- (0.05,0) [-25.6|25.55] "m/s^2" Vector__XXX + SG_ CAN_TX_TRACK_RANGE : 18|11@0+ (0.1,0) [0|204.7] "m" Vector__XXX + SG_ CAN_TX_TRACK_ONCOMING : 0|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_MED_RANGE_MODE : 55|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_TRACK_LAT_RATE : 7|6@0- (0.25,0) [-8|7.75] "" Vector__XXX + SG_ CAN_TX_TRACK_GROUPING_CHANGED : 1|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_BRIDGE_OBJECT : 39|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_TRACK_ANGLE : 12|10@0- (0.1,0) [-51.2|51.1] "" Vector__XXX + +BO_ 1265 SensorInput: 8 Gateway + SG_ CAN_RX_USE_ANGLE_MISALIGNMENT : 23|1@0+ (1,0) [0|0] "" Vector__XXX + SG_ CAN_RX_SCAN_INDEX_ACK : 7|16@0+ (1,0) [0|65535] "" Vector__XXX + SG_ CAN_RX_LATERAL_MOUNTING_OFFSET : 47|8@0- (0.01563,0) [-2.00064|1.98501] "m" Vector__XXX + SG_ CAN_RX_WIPER_STATUS : 57|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_VOLVO_SHORT_TRACK_ROC : 31|4@0- (500,0) [-4000|3500] "m" Vector__XXX + SG_ CAN_RX_VEHICLE_SPEED_VALIDITY : 61|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_TURN_SIGNAL_STATUS : 63|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_RX_RAW_DATA_ENABLE : 56|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_RADAR_CMD_RADIATE : 55|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_MR_ONLY_TRANSMIT : 25|1@0+ (1,0) [0|0] "" Vector__XXX + SG_ CAN_RX_MMR_UPSIDE_DOWN : 60|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_MAXIMUM_TRACKS : 53|6@0+ (1,0) [0|63] "" Vector__XXX + SG_ CAN_RX_LR_ONLY_TRANSMIT : 24|1@0+ (1,0) [0|0] "" Vector__XXX + SG_ CAN_RX_HIGH_YAW_ANGLE : 21|6@0- (1,0) [-32|31] "deg" Vector__XXX + SG_ CAN_RX_GROUPING_MODE : 59|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_RX_CLEAR_FAULTS : 22|1@0- (1,0) [0|0] "" Vector__XXX + SG_ CAN_RX_BLOCKAGE_DISABLE : 54|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_ANGLE_MISALIGNMENT : 39|8@0- (0.0625,0) [-8|7.9375] "deg" Vector__XXX + +BO_ 1264 Vehicle_Data: 8 Gateway + SG_ CAN_RX_YAW_RATE_VALIDITY : 31|1@0+ (1,0) [0|0] "" Vector__XXX + SG_ CAN_RX_YAW_RATE : 11|12@0- (0.0625,0) [-128|127.9375] "deg/s" Vector__XXX + SG_ CAN_RX_VEHICLE_SPEED_DIRECTION : 12|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_VEHICLE_SPEED : 7|11@0+ (0.0625,0) [0|127.9375] "m/s" Vector__XXX + SG_ CAN_RX_RADIUS_CURVATURE : 29|14@0- (1,0) [-8192|8191] "m" Vector__XXX + SG_ CAN_RX_STEERING_VALIDITY : 47|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_STEERING_ANGLE_SIGN : 46|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_STEERING_ANGLE_RATE_SIGN : 30|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_RX_STEERING_ANGLE_RATE : 50|11@0+ (1,0) [0|2047] "deg/s" Vector__XXX + SG_ CAN_RX_STEERING_ANGLE : 45|11@0+ (1,0) [0|2047] "deg" Vector__XXX + +BO_ 1251 ESR_Output_InPath: 8 ESR + SG_ CAN_TX_PATH_ID_ACC_MOVE : 15|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_TX_TRUCK_TARGET_DET : 7|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_SIDELOBE_BLOCKATE : 5|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_ROLLING_COUNT_3 : 1|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_PATH_ID_FCW_STAT : 47|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_TX_PATH_ID_FCW_MOVE : 39|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_TX_PATH_ID_CMBB_STAT : 31|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_TX_PATH_ID_CMBB_MOVE : 23|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_TX_PATH_ID_ACC_STAT : 63|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_TX_PARTIAL_BLOCKAGE : 4|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_LR_ONLY_GRATING_LOBE_DET : 6|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_LMR_LR_MODE : 3|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_AUTO_ALIGN_ANGLE : 55|8@0- (0.0625,0) [-8|7.9375] "" Vector__XXX + +BO_ 1250 ESR_SW: 8 ESR + SG_ CAN_TX_SW_VERSION_PLD : 63|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ CAN_TX_SW_VERSION_HOST : 15|24@0+ (1,0) [0|16777215] "" Vector__XXX + SG_ CAN_TX_SERIAL_NUM : 39|24@0+ (1,0) [0|16777215] "" Vector__XXX + SG_ CAN_TX_INTERFACE_VERSION : 7|4@0+ (1,0) [0|15] "" Vector__XXX + SG_ CAN_TX_HW_VERSION : 3|4@0+ (1,0) [0|15] "" Vector__XXX + +BO_ 1249 ESR_Status2: 8 ESR + SG_ CAN_TX_YAW_RATE_BIAS : 47|8@0- (0.125,0) [-16|15.875] "" Vector__XXX + SG_ CAN_TX_XCVR_OPERATIONAL : 12|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_VEH_SPD_COMP_FACTOR : 39|6@0- (0.00195,1) [0.9376|1.06045] "" Vector__XXX + SG_ CAN_TX_TEMPERATURE : 31|8@0- (1,0) [-128|127] "degC" Vector__XXX + SG_ CAN_TX_SW_VERSION_DSP : 55|16@0+ (1,0) [0|65535] "" Vector__XXX + SG_ CAN_TX_STEERING_ANGLE_ACK : 10|11@0+ (1,0) [0|2047] "deg" Vector__XXX + SG_ CAN_TX_ROLLING_COUNT_2 : 1|2@0+ (1,0) [0|3] "" Vector__XXX + SG_ CAN_TX_RAW_DATA_MODE : 11|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_RANGE_PERF_ERROR : 14|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_OVERHEAT_ERROR : 15|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_MAXIMUM_TRACKS_ACK : 7|6@0+ (1,1) [1|64] "" Vector__XXX + SG_ CAN_TX_INTERNAL_ERROR : 13|1@0+ (1,0) [0|1] "" Vector__XXX + SG_ CAN_TX_GROUPING_MODE : 33|2@0+ (1,0) [0|3] "" Vector__XXX + +BO_ 1248 ESR_Status: 8 ESR + SG_ CAN_TX_COMM_ERROR : 14|1@0+ (1,0) [0|0] "" Vector__XXX + SG_ CAN_TX_RADIUS_CURVATURE_CALC : 13|14@0- (1,0) [-8192|8191] "" Vector__XXX + SG_ CAN_TX_YAW_RATE_CALC : 47|12@0- (0.0625,0) [-128|127.9375] "deg/s" Vector__XXX + SG_ CAN_TX_VEHICLE_SPEED_CALC : 50|11@0+ (0.0625,0) [0|127.9375] "m/s" Vector__XXX + SG_ CAN_TX_DSP_TIMESTAMP : 5|7@0+ (2,0) [0|254] "ms" Vector__XXX + SG_ CAN_TX_SCAN_INDEX : 31|16@0+ (1,0) [0|65535] "" Vector__XXX + SG_ CAN_TX_ROLLING_COUNT_1 : 6|2@1+ (1,0) [0|3] "" Vector__XXX + + + +BA_DEF_ "BusType" STRING ; +BA_DEF_DEF_ "BusType" "CAN"; +VAL_ 1264 CAN_RX_YAW_RATE_VALIDITY 1 "Valid" 0 "Invalid" ; +VAL_ 1264 CAN_RX_VEHICLE_SPEED_DIRECTION 1 "Reverse" 0 "Forward" ; +VAL_ 1264 CAN_RX_STEERING_VALIDITY 1 "True" 0 "False" ; +VAL_ 1264 CAN_RX_STEERING_ANGLE_SIGN 1 "Right Clockwise" 0 "Left CounterClockwise" ; +VAL_ 1264 CAN_RX_STEERING_ANGLE_RATE_SIGN 1 "Right Clockwise" 0 "Left CounterClockwise" ; + diff --git a/opendbc/acura_ilx_2016_can_generated.dbc b/opendbc/acura_ilx_2016_can_generated.dbc index 9b349b98073f88..dd112ca32ccc41 100644 --- a/opendbc/acura_ilx_2016_can_generated.dbc +++ b/opendbc/acura_ilx_2016_can_generated.dbc @@ -6,15 +6,15 @@ BO_ 512 GAS_COMMAND: 6 EON SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" INTERCEPTOR - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR BO_ 513 GAS_SENSOR: 6 INTERCEPTOR SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON - SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; @@ -59,9 +59,9 @@ BO_ 344 ENGINE_DATA: 8 PCM SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON @@ -76,6 +76,15 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + BO_ 432 STANDSTILL: 7 VSA SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON @@ -268,12 +277,6 @@ BO_ 419 GEARBOX: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -293,7 +296,7 @@ CM_ SG_ 780 CRUISE_SPEED "255 = no speed"; CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed"; CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc..."; -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 419 GEAR_SHIFTER 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; diff --git a/opendbc/acura_ilx_2016_nidec.dbc b/opendbc/acura_ilx_2016_nidec.dbc index 4d8738a0aa14a2..e73fcc422177be 100644 --- a/opendbc/acura_ilx_2016_nidec.dbc +++ b/opendbc/acura_ilx_2016_nidec.dbc @@ -182,4 +182,4 @@ BO_TX_BU_ 769 : NEO,ADAS; CM_ SG_ 1024 RADAR_STATE "need to find out more diagnostic values"; -VAL_ 1024 RADAR_STATE 121 "ok" 110 "faulted"; +VAL_ 1024 RADAR_STATE 121 "ok" 110 "faulted" 105 "wrong_config"; diff --git a/opendbc/acura_rdx_2018_can_generated.dbc b/opendbc/acura_rdx_2018_can_generated.dbc index ec2ecf59acfcea..a8e69b14e6c08d 100644 --- a/opendbc/acura_rdx_2018_can_generated.dbc +++ b/opendbc/acura_rdx_2018_can_generated.dbc @@ -6,15 +6,15 @@ BO_ 512 GAS_COMMAND: 6 EON SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" INTERCEPTOR - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR BO_ 513 GAS_SENSOR: 6 INTERCEPTOR SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON - SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; @@ -59,9 +59,9 @@ BO_ 344 ENGINE_DATA: 8 PCM SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON @@ -76,6 +76,15 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + BO_ 432 STANDSTILL: 7 VSA SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON @@ -257,12 +266,6 @@ BO_ 404 STEERING_CONTROL: 4 EON SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EPS SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EPS -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -288,6 +291,7 @@ BO_ 660 SCM_FEEDBACK: 8 SCM CM_ SG_ 422 PARKING_BRAKE_LIGHT "Believe this is just the dash light for the parking break"; VAL_ 392 GEAR_SHIFTER 0 "S" 1 "P" 2 "R" 4 "N" 8 "D" ; VAL_ 392 GEAR 26 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/cadillac_ct6_powertrain.dbc b/opendbc/cadillac_ct6_powertrain.dbc index 8fdd4c17e1a715..f139b1dbd4a734 100644 --- a/opendbc/cadillac_ct6_powertrain.dbc +++ b/opendbc/cadillac_ct6_powertrain.dbc @@ -189,7 +189,7 @@ BO_ 1033 ASCMKeepAlive: 7 NEO SG_ ASCMKeepAliveAllZero : 7|56@0+ (1,0) [0|0] "" NEO BO_ 1217 ECMEngineCoolantTemp: 8 K20_ECM - SG_ EngineCoolantTemp : 23|8@0+ (1,-40) [0|0] "C" NEO + SG_ EngineCoolantTemp : 23|8@0+ (1,-40) [0|0] "°C" NEO BO_ 1249 VIN_Part2: 8 K20_ECM SG_ VINPart2 : 7|64@0+ (1,0) [0|0] "" NEO diff --git a/opendbc/chrysler_pacifica_2017_hybrid.dbc b/opendbc/chrysler_pacifica_2017_hybrid.dbc index 7cd13b745f5ce0..dd5a7fe99ffd7c 100644 --- a/opendbc/chrysler_pacifica_2017_hybrid.dbc +++ b/opendbc/chrysler_pacifica_2017_hybrid.dbc @@ -37,12 +37,15 @@ BU_: XXX BO_ 258 STEERING: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ UNKNOWN_STEERING : 50|3@0+ (1,0) [0|15] "" XXX + SG_ STEERING_RATE : 20|13@0+ (0.3187251,-1305.498) [0|8191] "deg/s" XXX SG_ STEER_ANGLE : 4|13@0+ (0.3187251,-1307.888) [-360|360] "deg" XXX - SG_ STEERING_RATE : 20|13@0+ (1,-4096) [0|8191] "" XXX -BO_ 514 SPEED: 4 XXX - SG_ SPEED_LEFT : 7|16@0+ (0.07,0) [0|65535] "m/s" XXX - SG_ SPEED_RIGHT : 23|16@0+ (0.07,0) [0|1023] "m/s" XXX +BO_ 514 SPEED_1: 4 XXX + SG_ SPEED_LEFT : 7|12@0+ (0.071028,0) [0|65535] "m/s" XXX + SG_ SPEED_RIGHT : 23|12@0+ (0.071028,0) [0|1023] "m/s" XXX BO_ 653 BRAKE_MODULE: 2 XXX SG_ BRAKE_PRESSURE : 15|8@0+ (1,0) [0|255] "" XXX @@ -56,52 +59,376 @@ BO_ 820 DOORS: 8 XXX SG_ DOOR_OPEN_FL : 17|1@0+ (1,0) [0|1] "" XXX SG_ TURN_LIGHT_LEFT : 31|1@0+ (1,0) [0|1] "" XXX SG_ TURN_LIGHT_RIGHT : 30|1@0+ (1,0) [0|1] "" XXX - SG_ HIGH_BEAM_DISPLAY : 58|1@1+ (1,0) [0|1] "" XXX + SG_ HIGH_BEAM_DISPLAY : 58|1@0+ (1,0) [0|1] "" XXX BO_ 746 GEAR: 5 XXX - SG_ PRNDL : 0|3@1+ (1,0) [0|7] "" XXX + SG_ PRNDL : 2|3@0+ (1,0) [0|7] "" XXX + SG_ GEAR_CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 31|4@0+ (1,0) [0|15] "" XXX -BO_ 284 NEW_MSG_1: 8 XXX - SG_ BRAKE_RELATED : 3|12@0+ (1,0) [0|255] "" XXX - SG_ BRAKE_RELATED_2 : 17|10@0+ (1,0) [0|255] "" XXX - SG_ SPEED : 37|14@0+ (1,0) [0|255] "" XXX +BO_ 284 BRAKE_1: 8 XXX + SG_ SPEED_RELATED_1 : 37|14@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_RELATED_1_2 : 18|11@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_RELATED_1_1 : 3|12@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 320 NEW_MSG_2: 8 XXX - SG_ SPEED_RELATED : 47|8@0+ (1,0) [0|63] "" XXX - SG_ BRAKE_PRESSED : 2|3@0+ (1,0) [0|7] "" XXX +BO_ 320 BRAKE_2: 8 XXX + SG_ SPEED_RELATED_2 : 47|8@0+ (1,0) [0|63] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_PRESSED_2 : 2|3@0+ (1,0) [0|7] "" XXX + SG_ BRAKE_PRESSED_ACC : 6|1@0+ (1,0) [0|3] "" XXX BO_ 736 TRIP: 8 XXX - SG_ DISTANCE_COUNTER : 7|16@0+ (0,0) [0|65535] "Meters" XXX - SG_ DISTANCE_COUNTER_2 : 23|16@0+ (1,0) [0|65535] "Meters" XXX + SG_ COUNTER : 7|16@0+ (1,0) [0|65535] "Meters" XXX + SG_ COUNTER_2 : 23|16@0+ (1,0) [0|65535] "Meters" XXX BO_ 344 WHEEL_SPEEDS: 8 XXX - SG_ WHEEL_SPEED_FL : 1|10@0+ (1,0) [0|65535] "" XXX - SG_ WHEEL_SPEED_FR : 17|10@0+ (1,0) [0|255] "" XXX - SG_ WHEEL_SPEED_RL : 33|10@0+ (1,0) [0|3] "" XXX - SG_ WHEEL_SPEED_RR : 49|10@0+ (1,0) [0|255] "" XXX + SG_ WHEEL_SPEED_FL : 3|12@0+ (0.0189408,0) [0|65535] "m/s" XXX + SG_ WHEEL_SPEED_RR : 51|12@0+ (0.0189408,0) [0|255] "m/s" XXX + SG_ WHEEL_SPEED_RL : 35|12@0+ (0.0189408,0) [0|3] "m/s" XXX + SG_ WHEEL_SPEED_FR : 19|12@0+ (0.0189408,0) [0|255] "m/s" XXX BO_ 792 STEERING_LEVERS: 8 XXX + SG_ HIGH_BEAM_PUSHED_IN : 2|1@0+ (1,0) [0|3] "" XXX SG_ TURN_SIGNALS : 1|2@0+ (1,0) [0|3] "" XXX - SG_ HIGH_BEAM_PUSHED_IN : 2|1@1+ (1,0) [0|3] "" XXX - SG_ HIGH_BEAM_FLASH : 3|1@1+ (1,0) [0|3] "" XXX + SG_ HIGH_BEAM_FLASH : 3|1@0+ (1,0) [0|3] "" XXX BO_ 264 ACCEL_PEDAL_MSG: 8 XXX - SG_ ACCEL_PEDAL : 32|4@1+ (1,-7) [0|15] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ ACCEL_PEDAL : 35|1@0+ (1,0) [0|1] "" XXX +BO_ 464 SEATBELT_STATUS: 8 XXX + SG_ SEATBELT_DRIVER_UNLATCHED : 13|1@0+ (1,0) [0|1] "" XXX +BO_ 544 EPS_STATUS: 8 XXX + SG_ LKAS_STATE : 23|4@0+ (1,0) [0|15] "" XXX + SG_ TORQUE_DRIVER : 2|11@0+ (1,-1024) [-1024|1023] "" XXX + SG_ TORQUE_MOTOR_RAW : 19|12@0+ (1,-2048) [-2048|2047] "" XXX + SG_ TORQUE_MOTOR : 34|11@0+ (1,-1024) [-1024|1023] "" XXX + SG_ AUTO_PARK_HAS_CONTROL_2 : 51|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 658 LKAS_COMMAND: 6 XXX + SG_ COUNTER : 39|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX + SG_ LKAS_STEERING_TORQUE : 2|11@0+ (1,-1024) [0|1] "" XXX + SG_ LKAS_HIGH_TORQUE : 4|1@0+ (1,0) [0|1] "" XXX +BO_ 678 LKAS_HUD: 8 XXX + SG_ LKAS_ICON_COLOR : 1|2@0+ (1,0) [0|3] "" XXX + SG_ LKAS_LANE_LINES : 19|4@0+ (1,0) [0|1] "" XXX + SG_ LKAS_ALERTS : 27|4@0+ (1,0) [0|1] "" XXX + SG_ CAR_MODEL : 15|8@0+ (1,0) [0|255] "" XXX + +BO_ 705 AUTO_PARK_BUTTON: 8 XXX + SG_ AUTO_PARK_TOGGLE_2 : 8|1@0+ (1,0) [0|1] "" XXX + SG_ AUTO_PARK_TOGGLE_1 : 11|1@0+ (1,0) [0|1] "" XXX + SG_ INCREASING_UNKNOWN : 38|7@0+ (1,0) [0|15] "" XXX + +BO_ 719 AUTO_PARK_SIGNALS_1: 8 XXX + SG_ AUTO_PARK_UNKNOWN_1 : 7|16@0+ (1,0) [0|31] "" XXX + +BO_ 671 AUTO_PARK_SIGNALS_2: 8 XXX + SG_ AUTO_PARK_PARALLEL : 21|1@0+ (1,0) [0|1] "" XXX + SG_ AUTO_PARK_PERPENDICULAR_1 : 22|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ AUTO_PARK_CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ AUTO_PARK_MAYBE_TURNING : 3|12@0+ (1,0) [0|1023] "" XXX + SG_ AUTO_PARK_TURNING_STATUS : 7|4@0+ (1,0) [0|15] "" XXX + +BO_ 784 AUTO_PARK_LESS_INTERESTING: 8 XXX + SG_ INCREASING_UNKNOWN : 55|8@0+ (1,0) [0|7] "" XXX + SG_ AUTO_PARK_PERPENDICULAR_2 : 61|1@0+ (1,0) [0|255] "" XXX + +BO_ 826 AUTO_PARK_SIGNALS_3: 8 XXX + SG_ AUTO_PARK_HAS_CONTROL_3 : 1|1@0+ (1,0) [0|1] "" XXX + SG_ HUMAN_HAS_CONTROL : 2|1@0+ (1,0) [0|1] "" XXX + SG_ AUTO_PARK_GEAR_1 : 27|4@0+ (1,0) [0|255] "" XXX + SG_ AUTO_PARK_GEAR_2 : 35|4@0+ (1,0) [0|15] "" XXX + SG_ AUTO_PARK_GEAR_3 : 51|4@0+ (1,0) [0|15] "" XXX + +BO_ 332 STEERING_2: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ ENERGY_RELATED : 39|16@0+ (1,0) [0|65535] "" XXX + SG_ STEER_ANGLE_2 : 7|13@0+ (0.3187251,-1307.888) [-360|360] "deg" XXX + +BO_ 720 BLIND_SPOT_WARNINGS: 6 XXX + SG_ BLIND_SPOT_RIGHT : 5|1@0+ (1,0) [0|1] "" XXX + SG_ BLIND_SPOT_LEFT : 2|1@0+ (1,0) [0|1] "" XXX + +BO_ 331 BRAKE_3: 8 XXX + SG_ BRAKE_RELATED_3 : 7|16@0+ (1,0) [0|65535] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 608 PARKSENSE_SIGNAL: 8 XXX + SG_ PARKSENSE_DISABLED : 34|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ IN_REVERSE : 10|1@0+ (1,0) [0|255] "" XXX + SG_ AUTO_PARK_HAS_CONTROL_1 : 16|1@0+ (1,0) [0|255] "" XXX + SG_ HUMAN_HAS_CONTROL : 17|1@0+ (1,0) [0|3] "" XXX + +BO_ 729 LKAS_HEARTBIT: 5 XXX + SG_ LKAS_STATUS_OK : 31|16@0+ (1,0) [0|65535] "" XXX + +BO_ 274 NEW_MSG_112: 2 XXX + +BO_ 290 NEW_MSG_122: 6 XXX + +BO_ 376 NEW_MSG_178: 3 XXX + +BO_ 288 ACCEL_RELATED_120: 7 XXX + SG_ COUNTER : 47|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 55|8@0+ (1,0) [0|255] "" XXX + SG_ ACCEL : 23|8@0+ (1,0) [0|255] "" XXX + SG_ GAS_ENGINE_RPM_MAYBE : 31|16@0+ (1,0) [0|65535] "" XXX + +BO_ 257 ACCEL_RELATED_101: 5 XXX + SG_ ENERGY_OR_RPM : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 388 NEW_MSG_184: 4 XXX + +BO_ 448 NEW_MSG_1c0: 6 XXX + +BO_ 456 NEW_MSG_1c8: 4 XXX + +BO_ 560 NEW_MSG_230: 4 XXX + +BO_ 564 NEW_MSG_234: 4 XXX + +BO_ 571 WHEEL_BUTTONS: 3 XXX + SG_ CHECKSUM : 23|8@0+ (1,0) [0|255] "" XXX + SG_ ACC_FOLLOW_DEC : 1|1@0+ (1,0) [0|3] "" XXX + SG_ ACC_SPEED_INC : 2|1@0+ (1,0) [0|255] "" XXX + SG_ ACC_SPEED_DEC : 3|1@0+ (1,0) [0|3] "" XXX + SG_ ACC_FOLLOW_INC : 8|1@0+ (1,0) [0|15] "" XXX + SG_ ACC_CANCEL : 0|1@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 15|4@0+ (1,0) [0|15] "" XXX + +BO_ 669 NEW_MSG_29d: 3 XXX + SG_ COUNTER : 15|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 23|8@0+ (1,0) [0|255] "" XXX + +BO_ 825 AUDIBLE_BEEP_339: 2 XXX + SG_ BEEP_339 : 7|16@0+ (1,0) [0|65535] "" XXX + +BO_ 856 NEW_MSG_358: 4 XXX + +BO_ 860 NEW_MSG_35c: 6 XXX + +BO_ 924 NEW_MSG_39c: 3 XXX + +BO_ 969 NEW_MSG_3c9: 4 XXX + +BO_ 974 NEW_MSG_3ce: 5 XXX + +BO_ 993 NEW_MSG_3e1: 7 XXX + +BO_ 838 NEW_MSG_346: 2 XXX + +BO_ 926 NEW_MSG_39e: 3 XXX + +BO_ 168 ACCEL_RELATED_a8: 8 XXX + SG_ ACCEL_RELATED : 23|16@0+ (1,0) [0|65535] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 270 ACCEL_RELATED_10e: 8 XXX + SG_ ACCEL_OR_RPM : 7|16@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ ELECTRIC_MOTOR : 23|16@0+ (1,0) [0|65535] "" XXX + +BO_ 291 ENERGY_RELATED_123: 8 XXX + SG_ ENERGY_GAIN_LOSS : 18|11@0- (1,0) [0|255] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ ENERGY_SMOOTHER_CURVE : 35|12@0+ (1,0) [0|2047] "" XXX + +BO_ 294 ENERGY_RELATED_126: 8 XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ UNKNOWN_126_1 : 3|12@0+ (1,0) [0|4095] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ UNKNOWN_126_2 : 35|12@0+ (1,0) [0|4095] "" XXX + SG_ ENERGY_GAIN_LOSS_NOISY : 19|12@0+ (1,0) [0|2047] "" XXX + +BO_ 300 NEW_MSG_12C: 8 XXX + +BO_ 308 ACCEL_GAS_134: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ ACCEL_134 : 43|4@0+ (1,0) [0|15] "" XXX + +BO_ 532 ENERGY_RELATED_214: 8 XXX + SG_ NOISY_SLOWLY_DECREASING : 16|9@0+ (1,0) [0|255] "" XXX + SG_ ENERGY_RELATED : 0|9@0+ (1,0) [0|255] "" XXX + +BO_ 559 ACCEL_GAS_22F: 8 XXX + SG_ ACCEL_22F : 3|4@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 655 CHARGING_MAYBE_28F: 8 XXX + SG_ CHARGING : 1|2@0+ (1,0) [0|3] "" XXX + +BO_ 660 BRAKE_RELATED_294: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_PERHAPS_294 : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 764 ACCEL_RELATED_2FC: 8 XXX + SG_ ACCEL_2FC : 13|6@0+ (1,0) [0|255] "" XXX + +BO_ 816 TRACTION_BUTTON: 8 XXX + SG_ TRACTION_OFF : 19|1@0+ (1,0) [0|3] "" XXX + SG_ TOGGLE_PARKSENSE : 52|1@0+ (1,0) [0|3] "" XXX + +BO_ 878 ACCEL_RELATED_36E: 8 XXX + SG_ ACCEL_OR_RPM_2 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ ACCEL_OR_RPM_1 : 7|8@0+ (1,0) [0|255] "" XXX + +BO_ 324 SPEED_2: 8 XXX + SG_ SPEED_2 : 31|16@0+ (0.01,0) [0|255] "m/s" XXX + +BO_ 501 DASHBOARD: 8 XXX + SG_ ACC_SPEED_CONFIG_KPH : 15|8@0+ (1,0) [0|3] "km/h" XXX + SG_ ACC_SPEED_CONFIG_MPH : 23|8@0+ (1,0) [0|3] "mph" XXX + SG_ ACC_DISTANCE_CONFIG_1 : 1|2@0+ (1,0) [0|3] "" XXX + SG_ ACC_DISTANCE_CONFIG_2 : 41|2@0+ (1,0) [0|3] "" XXX + SG_ SPEED_DIGITAL : 63|8@0+ (1,0) [0|255] "mph" XXX + +BO_ 639 NEW_MSG_27f: 8 XXX + SG_ INCREASING : 47|8@0+ (1,0) [0|255] "" XXX + +BO_ 701 NEW_MSG_2bd: 8 XXX + SG_ unknown_1 : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 832 UNKNOWN_340: 8 XXX + SG_ SPEED_DIGITAL : 63|8@0+ (1,0) [0|255] "mph" XXX + +BO_ 848 UNKNOWN_350: 8 XXX + SG_ INCREASING_LSB : 5|6@0+ (1,0) [0|255] "" XXX + SG_ INCREASING_MSB : 12|5@0+ (1,0) [0|31] "" XXX + +BO_ 908 NEW_MSG_38c: 8 XXX + SG_ INCREASING_MSB : 44|5@0+ (1,0) [0|31] "" XXX + SG_ INCREASING_LSB : 61|6@0+ (1,0) [0|255] "" XXX + +BO_ 938 NEW_MSG_3aa: 8 XXX + SG_ INCREASING_UNKNOWN_1 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ INCREASING_UNKNOWN_2 : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 940 NEW_MSG_3ac: 8 XXX + SG_ INCREASING_1 : 35|4@0+ (1,0) [0|15] "" XXX + SG_ INCREASING_2 : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 941 NEW_MSG_3ad: 8 XXX + SG_ INCREASING_1 : 36|5@0+ (1,0) [0|31] "" XXX + SG_ INCREASING_2 : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 500 ACC_2: 8 XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ ACC_STATUS_1 : 7|3@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_MAYBE : 18|11@0+ (1,0) [0|255] "" XXX + SG_ ACC_STATUS_2 : 21|3@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_BOOL_1 : 36|1@0+ (1,0) [0|3] "" XXX + +BO_ 625 ACC_1: 8 XXX + SG_ SPEED : 31|8@0+ (1,0) [0|255] "km/h" XXX + SG_ ACCEL_PERHAPS : 39|16@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + +BO_ 268 ACC_10c: 8 XXX + SG_ BRAKE_PERHAPS : 48|1@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 384 NEW_MSG_180: 8 XXX + SG_ NEW_SIGNAL_2 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 39|8@0+ (1,0) [0|3] "" XXX + +BO_ 853 NEW_MSG_355: 8 XXX + +BO_ 939 NEW_MSG_3ab: 8 XXX + +BO_ 512 NEW_MSG_200: 8 XXX + SG_ NEW_SIGNAL_1 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ INCREASING : 27|12@0+ (1,0) [0|127] "" XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + + + + +CM_ SG_ 258 UNKNOWN_STEERING "never goes above 4. see if human-applied torque"; CM_ SG_ 258 STEER_ANGLE "positive is left (counter-clockwise)"; CM_ SG_ 514 SPEED_LEFT "TODO find upper limit"; CM_ SG_ 653 BRAKE_PRESSURE "max seems to be 148"; CM_ SG_ 820 TURN_LIGHT_LEFT "oscillates with the light blinking"; CM_ SG_ 820 TURN_LIGHT_RIGHT "hazard blinks both right and left lights"; -CM_ SG_ 746 PRNDL "4=D, 3=N, 2=R, 1=P"; -CM_ SG_ 284 BRAKE_RELATED "Correlates with braking"; -CM_ SG_ 284 SPEED "Another Speed Signal, Maybe RPMs?"; -CM_ SG_ 320 BRAKE_PRESSED "Value is 5 when brake is pressed"; +CM_ SG_ 746 PRNDL "5=L, 4=D, 3=N, 2=R, 1=P"; +CM_ SG_ 746 GEAR_CHECKSUM "different than the LKAS checksum. unknown non-simple algorithm. just build a lookup table for it."; +CM_ SG_ 284 SPEED_RELATED_1 "Another Speed Signal, Maybe RPMs?"; +CM_ SG_ 284 BRAKE_RELATED_1_1 "Correlates with braking"; +CM_ SG_ 320 BRAKE_PRESSED_2 "Value is 5 when brake is pressed by human, 1 when ACC brake"; +CM_ SG_ 320 BRAKE_PRESSED_ACC "set when ACC brakes"; CM_ SG_ 792 TURN_SIGNALS "1=Left, 2=Right"; CM_ SG_ 792 HIGH_BEAM_FLASH "use this for genericToggle"; CM_ SG_ 264 ACCEL_PEDAL "not in ACC so seems to be actual pedal. Use for gasPressed"; -VAL_ 746 PRNDL 4 "Drive" 3 "Neutral" 2 "Reverse" 1 "Park" ; +CM_ SG_ 544 LKAS_STATE "2 when autopark has control, 8 when is actuatable by lkas, 4 when there is a fault"; +CM_ SG_ 544 TORQUE_MOTOR_RAW "has larger range than TORQUE_MOTOR but ut seems biased"; +CM_ SG_ 658 COUNTER "each message increments, 0..f"; +CM_ SG_ 658 CHECKSUM "checksum calculated with https://gist.github.com/adhintz/94bf8d19b9075539f50172ab0fb24ba1"; +CM_ SG_ 658 LKAS_STEERING_TORQUE "Most sent by stock system is 1024+-230. + is left. typically changes by 2 or 3 each 0.01s"; +CM_ SG_ 678 LKAS_ICON_COLOR "3 is yellow, 2 is green, 1 is white, 0 is null"; +CM_ SG_ 678 LKAS_LANE_LINES "0x01 transparent lines, 0x02 left white, 0x03 right white, 0x04 left yellow with car on top, 0x05 left yellow with car on top, 0x06 both white, 0x07 left yellow, 0x08 left yellow right white, 0x09 right yellow, 0x0a right yellow left white, 0x0b left yellow with car on top right white, 0x0c right yellow with car on top left white, (0x00, 0x0d, 0x0e, 0x0f) null"; +CM_ SG_ 678 LKAS_ALERTS "(0x01, 0x02) lane sense off, (0x03, 0x04, 0x06) place hands on steering wheel, 0x07 lane departure detected + place hands on steering wheel, (0x08, 0x09) lane sense unavailable + clean front windshield, 0x0b lane sense and auto high beam unavailable + clean front windshield, 0x0c lane sense unavailable + service required, (0x00, 0x05, 0x0a, 0x0d, 0x0e, 0x0f) null"; +CM_ SG_ 705 AUTO_PARK_TOGGLE_1 "set briefly when turning on or off self-parking"; +CM_ SG_ 705 INCREASING_UNKNOWN "sometimes decreasing"; +CM_ SG_ 671 AUTO_PARK_PARALLEL "parallel parking mode"; +CM_ SG_ 671 AUTO_PARK_PERPENDICULAR_1 "perpendicular parking mode"; +CM_ SG_ 671 AUTO_PARK_MAYBE_TURNING "something with autopark turning the steering wheel maybe."; +CM_ SG_ 671 AUTO_PARK_TURNING_STATUS "0 when not steering. when steering starts, 4 for two packets, and then 5 for the rest"; +CM_ SG_ 784 INCREASING_UNKNOWN "perhaps distance traveled"; +CM_ SG_ 826 AUTO_PARK_GEAR_1 "Reverse=0, Forward=f"; +CM_ SG_ 826 AUTO_PARK_GEAR_2 "Reverse=0, Forward=f"; +CM_ SG_ 826 AUTO_PARK_GEAR_3 "Reverse=0, Forward=f"; +CM_ SG_ 332 STEER_ANGLE_2 "slightly lags the other steer_angle signal. also more noisy."; +CM_ SG_ 720 BLIND_SPOT_RIGHT "yellow triangle alert on side view mirror when a car is in your blind spot"; +CM_ SG_ 608 PARKSENSE_DISABLED "set if parksense is disabled"; +CM_ SG_ 729 LKAS_STATUS_OK "Set to 0x0820 when LKAS system is plugged in."; +CM_ SG_ 288 UNKNOWN_CHECKSUM "not the LKAS checksum"; +CM_ SG_ 288 GAS_ENGINE_RPM_MAYBE "lags acceleration, perhaps gas engine"; +CM_ SG_ 257 ENERGY_OR_RPM "perhaps energy consumption or RPMs"; +CM_ SG_ 571 CHECKSUM "standard checksum"; +CM_ SG_ 825 BEEP_339 "sent every 0.5s. 0050 is no beep. To beep send 4355 or 4155. Used by ParkSense warning."; +CM_ SG_ 270 ELECTRIC_MOTOR "0x7fff indicates electric motor not in use"; +CM_ SG_ 291 ENERGY_GAIN_LOSS "unsure what this actually is"; +CM_ SG_ 291 ENERGY_SMOOTHER_CURVE "unusre what it is, but smoother"; +CM_ SG_ 532 NOISY_SLOWLY_DECREASING "perhaps battery but do not know"; +CM_ SG_ 816 TRACTION_OFF "set when traction off button is enabled"; +CM_ SG_ 816 TOGGLE_PARKSENSE "sending 3000071ec0ff9000 enables or disables parksense"; +CM_ SG_ 324 SPEED_2 "signal is approx half other speeds"; +CM_ SG_ 501 ACC_SPEED_CONFIG_KPH "speed configured for ACC"; +CM_ SG_ 501 ACC_SPEED_CONFIG_MPH "speed configured for ACC"; +CM_ SG_ 639 INCREASING "perhaps number of seconds divided by two for this drive"; +CM_ SG_ 848 INCREASING_LSB "lower part of time counter"; +CM_ SG_ 848 INCREASING_MSB "upper part of time counter"; +CM_ SG_ 908 INCREASING_MSB "time based"; +CM_ SG_ 500 ACC_STATUS_1 "2 briefly (9 packets) when ACC goes to green, 1 help when ACC coming to a stop and at a stop"; +CM_ SG_ 500 BRAKE_MAYBE "2046 in non-ACC and non-decel. Signal on deceleration. 818 for already stopped break."; +CM_ SG_ 500 ACC_STATUS_2 "set to 1 in non-ACC, 3 when ACC enabled (white icon), and 7 when ACC in use (green icon)"; +CM_ SG_ 500 BRAKE_BOOL_1 "set to 1 when ACC decel. 0 on non-ACC and accel."; +CM_ SG_ 625 SPEED "zero on non-acc drives"; +CM_ SG_ 625 ACCEL_PERHAPS "set to 7767 on non-ACC drives. ACC drive 40k is constant speed, 42k is accelerating"; +CM_ SG_ 268 BRAKE_PERHAPS "triggers only on ACC braking"; +CM_ SG_ 384 NEW_SIGNAL_1 "set in ACC gas driving. not set in electric human. not sure about gas human driving."; +VAL_ 746 PRNDL 5 "Low" 4 "Drive" 3 "Neutral" 2 "Reverse" 1 "Park" ; VAL_ 792 TURN_SIGNALS 2 "Right" 1 "Left" ; diff --git a/opendbc/chrysler_pacifica_2017_hybrid_private_fusion.dbc b/opendbc/chrysler_pacifica_2017_hybrid_private_fusion.dbc new file mode 100644 index 00000000000000..07c37e1fa2899e --- /dev/null +++ b/opendbc/chrysler_pacifica_2017_hybrid_private_fusion.dbc @@ -0,0 +1,230 @@ +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX + + +BO_ 544 a_1: 8 XXX + SG_ track_id : 7|4@0+ (1,0) [0|15] "" XXX + SG_ REL_ACCEL : 3|12@0+ (1,0) [0|31] "" XXX + SG_ status1 : 23|4@0+ (1,0) [0|15] "" XXX + SG_ REL_SPEED : 19|12@0+ (1,0) [0|65535] "" XXX + SG_ status2 : 39|6@0+ (1,0) [0|15] "" XXX + SG_ sig2 : 33|10@0+ (1,0) [0|255] "" XXX + SG_ zeros : 55|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 576 b_1: 8 XXX + SG_ sig0 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ sig1 : 15|16@0+ (1,0) [0|65535] "" XXX + SG_ sig2 : 31|16@0+ (1,0) [0|255] "" XXX + SG_ zeros : 47|12@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 608 a_2: 8 XXX + SG_ track_id : 7|4@0+ (1,0) [0|15] "" XXX + SG_ REL_ACCEL : 3|12@0+ (1,0) [0|31] "" XXX + SG_ status1 : 23|4@0+ (1,0) [0|15] "" XXX + SG_ REL_SPEED : 19|12@0+ (1,0) [0|65535] "" XXX + SG_ status2 : 39|6@0+ (1,0) [0|15] "" XXX + SG_ sig2 : 33|10@0+ (1,0) [0|255] "" XXX + SG_ zeros : 55|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 640 b_2: 8 XXX + SG_ sig0 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ sig1 : 15|16@0+ (1,0) [0|65535] "" XXX + SG_ sig2 : 31|16@0+ (1,0) [0|255] "" XXX + SG_ zeros : 47|12@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 644 a_3: 8 XXX + SG_ track_id : 7|4@0+ (1,0) [0|15] "" XXX + SG_ REL_ACCEL : 3|12@0+ (1,0) [0|31] "" XXX + SG_ status1 : 23|4@0+ (1,0) [0|15] "" XXX + SG_ REL_SPEED : 19|12@0+ (1,0) [0|65535] "" XXX + SG_ status2 : 39|6@0+ (1,0) [0|15] "" XXX + SG_ sig2 : 33|10@0+ (1,0) [0|255] "" XXX + SG_ zeros : 55|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 648 b_3: 8 XXX + SG_ sig0 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ sig1 : 15|16@0+ (1,0) [0|65535] "" XXX + SG_ sig2 : 31|16@0+ (1,0) [0|255] "" XXX + SG_ zeros : 47|12@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 652 a_4: 8 XXX + SG_ track_id : 7|4@0+ (1,0) [0|15] "" XXX + SG_ REL_ACCEL : 3|12@0+ (1,0) [0|31] "" XXX + SG_ status1 : 23|4@0+ (1,0) [0|15] "" XXX + SG_ REL_SPEED : 19|12@0+ (1,0) [0|65535] "" XXX + SG_ status2 : 39|6@0+ (1,0) [0|15] "" XXX + SG_ sig2 : 33|10@0+ (1,0) [0|255] "" XXX + SG_ zeros : 55|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 656 b_4: 8 XXX + SG_ sig0 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ sig1 : 15|16@0+ (1,0) [0|65535] "" XXX + SG_ sig2 : 31|16@0+ (1,0) [0|255] "" XXX + SG_ zeros : 47|12@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 512 unknown_200: 8 XXX + SG_ COUNTER : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ increasing : 31|16@0+ (1,0) [0|255] "" XXX + SG_ zeros_0 : 3|12@0+ (1,0) [0|63] "" XXX + SG_ zeros_1 : 47|12@0+ (1,0) [0|63] "" XXX + SG_ status0 : 7|4@0+ (1,0) [0|15] "" XXX + SG_ unknown_0 : 23|8@0+ (1,0) [0|255] "" XXX + +BO_ 514 unknown_202: 8 XXX + SG_ COUNTER : 43|4@0+ (1,0) [0|15] "" XXX + SG_ sig3 : 31|8@0+ (1,0) [0|65535] "" XXX + SG_ increasing : 39|12@0+ (1,0) [0|15] "" XXX + +BO_ 706 c_1: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + +BO_ 708 c_2: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 710 c_3: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 712 c_4: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 714 c_5: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 716 c_6: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 718 c_7: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 720 c_8: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 722 c_9: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 724 c_10: 8 XXX + SG_ LAT_DIST : 18|11@0+ (0.005,-1000) [0|2047] "m" XXX + SG_ LONG_DIST : 34|11@0+ (0.073,0) [0|255] "m" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 674 d_1: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 676 d_2: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 678 d_3: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 680 d_4: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 682 d_5: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 684 d_6: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 686 d_7: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 688 d_8: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 690 d_9: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 692 d_10: 8 XXX + SG_ REL_SPEED : 17|10@0+ (0.2857,-146.278) [0|1023] "m/s" XXX + +BO_ 672 NEW_MSG_5: 8 XXX + SG_ NEW_SIGNAL_1 : 9|10@0+ (1,0) [0|1023] "" XXX + SG_ NEW_SIGNAL_2 : 45|10@0+ (1,0) [0|1023] "" XXX + + + + +CM_ SG_ 544 track_id "for message a_1 track_id is always 1, similar for other messages and track_id"; +CM_ SG_ 544 REL_ACCEL "perhaps REL_ACCEL because it responds faster and before REL_SPEED"; +CM_ SG_ 544 sig2 "perhaps distance to object. LONG_DIST or REL_ACCEL or REL_SPEED"; +CM_ SG_ 576 zeros "not always zero, sometimes has value when another car changes lanes"; +CM_ SG_ 706 LAT_DIST "positive is to the right, negative is to the left"; diff --git a/opendbc/generator/honda/_bosch_2018.dbc b/opendbc/generator/honda/_bosch_2018.dbc index 9c0ecd717e226f..0b8d8a17f02c9e 100644 --- a/opendbc/generator/honda/_bosch_2018.dbc +++ b/opendbc/generator/honda/_bosch_2018.dbc @@ -64,10 +64,10 @@ BO_ 330 STEERING_SENSORS: 8 EPS SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 344 ENGINE_DATA: 8 PCM - SG_ XMISSION_SPEED : 7|16@0+ (0.002759506,0) [0|70] "m/s" EON + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON - SG_ XMISSION_SPEED2 : 39|16@0+ (0.002759506,0) [0|70] "m/s" EON - SG_ DISTANCE_COUNTER : 55|8@0+ (10,0) [0|2550] "Meters" XXX + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON @@ -259,3 +259,5 @@ BO_ 891 STALK_STATUS_2: 8 XXX SG_ PARK_LIGHTS : 36|1@0+ (1,0) [0|1] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; \ No newline at end of file diff --git a/opendbc/generator/honda/_comma.dbc b/opendbc/generator/honda/_comma.dbc index 0be2275381eb92..c96250baedaa84 100644 --- a/opendbc/generator/honda/_comma.dbc +++ b/opendbc/generator/honda/_comma.dbc @@ -2,14 +2,14 @@ BO_ 512 GAS_COMMAND: 6 EON SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" INTERCEPTOR - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR BO_ 513 GAS_SENSOR: 6 INTERCEPTOR SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON - SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; diff --git a/opendbc/generator/honda/_honda_2017.dbc b/opendbc/generator/honda/_honda_2017.dbc index 999cc5dd910f73..c79f2587beb008 100644 --- a/opendbc/generator/honda/_honda_2017.dbc +++ b/opendbc/generator/honda/_honda_2017.dbc @@ -37,9 +37,9 @@ BO_ 344 ENGINE_DATA: 8 PCM SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON @@ -54,6 +54,15 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + BO_ 432 STANDSTILL: 7 VSA SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON diff --git a/opendbc/generator/honda/acura_ilx_2016_can.dbc b/opendbc/generator/honda/acura_ilx_2016_can.dbc index 5acfc3169d016f..e45426b3a67639 100644 --- a/opendbc/generator/honda/acura_ilx_2016_can.dbc +++ b/opendbc/generator/honda/acura_ilx_2016_can.dbc @@ -39,12 +39,6 @@ BO_ 419 GEARBOX: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -64,7 +58,7 @@ CM_ SG_ 780 CRUISE_SPEED "255 = no speed"; CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed"; CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc..."; -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 419 GEAR_SHIFTER 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; diff --git a/opendbc/generator/honda/acura_rdx_2018_can.dbc b/opendbc/generator/honda/acura_rdx_2018_can.dbc index f2d764c5cf0e33..87389f8b2c6613 100644 --- a/opendbc/generator/honda/acura_rdx_2018_can.dbc +++ b/opendbc/generator/honda/acura_rdx_2018_can.dbc @@ -28,12 +28,6 @@ BO_ 404 STEERING_CONTROL: 4 EON SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EPS SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EPS -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -59,6 +53,7 @@ BO_ 660 SCM_FEEDBACK: 8 SCM CM_ SG_ 422 PARKING_BRAKE_LIGHT "Believe this is just the dash light for the parking break"; VAL_ 392 GEAR_SHIFTER 0 "S" 1 "P" 2 "R" 4 "N" 8 "D" ; VAL_ 392 GEAR 26 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/generator/honda/honda_accord_lx15t_2018_can.dbc b/opendbc/generator/honda/honda_accord_lx15t_2018_can.dbc new file mode 100644 index 00000000000000..9e95f56dbb51be --- /dev/null +++ b/opendbc/generator/honda/honda_accord_lx15t_2018_can.dbc @@ -0,0 +1,52 @@ +CM_ "IMPORT _bosch_2018.dbc" + +BO_ 401 GEARBOX: 8 PCM + SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON + SG_ BOH : 45|6@0+ (1,0) [0|63] "" XXX + SG_ GEAR2 : 31|8@0+ (1,0) [0|1] "" XXX + SG_ GEAR : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH : 47|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + +BO_ 446 BRAKE_MODULE: 3 VSA + SG_ BRAKE_PRESSED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" XXX + +BO_ 927 RADAR_HUD: 8 RADAR + SG_ ZEROS_BOH : 7|10@0+ (1,0) [0|127] "" BDY + SG_ CMBS_OFF : 12|1@0+ (1,0) [0|1] "" BDY + SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_TO_1 : 13|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH2 : 11|4@0+ (1,0) [0|1] "" XXX + SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|1] "" XXX + SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_0 : 22|1@0+ (1,0) [0|1] "" XXX + SG_ LEAD_DISTANCE : 39|8@0+ (1,0) [0|255] "" XXX + SG_ BOH : 40|1@0+ (1,0) [0|1] "" XXX + SG_ BOH_2 : 30|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 1302 ODOMETER: 8 XXX + SG_ ODOMETER : 7|24@0+ (1,0) [0|16777215] "km" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; +VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 545 ECON_ON_2 0 "off" 3 "on" ; +VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; +VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ; +VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; +VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; + +CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/generator/honda/honda_civic_touring_2016_can.dbc b/opendbc/generator/honda/honda_civic_touring_2016_can.dbc index 9e795fbae38c6d..8af78ca052441d 100644 --- a/opendbc/generator/honda/honda_civic_touring_2016_can.dbc +++ b/opendbc/generator/honda/honda_civic_touring_2016_can.dbc @@ -44,14 +44,6 @@ BO_ 401 GEARBOX: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON - SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - BO_ 450 EPB_STATUS: 8 EPB SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON @@ -126,10 +118,10 @@ BO_ 1302 ODOMETER: 8 XXX CM_ SG_ 401 GEAR "10 = reverse, 11 = transition"; CM_ SG_ 420 BRAKE_HOLD_RELATED "On when Brake Hold engaged"; -CM_ SG_ 450 EPB_STATE "3 "engaged" 2 "disengaging" 1 "engaging" 0 "disengaged""; +CM_ SG_ 450 EPB_STATE "3 \"engaged\" 2 \"disengaging\" 1 \"engaging\" 0 \"disengaged\""; CM_ SG_ 806 REVERSE_LIGHT "Might be reverse gear selected and not the lights"; -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 450 EPB_STATE 3 "engaged" 2 "disengaging" 1 "engaging" 0 "disengaged" ; diff --git a/opendbc/generator/honda/honda_crv_hybrid_2019_can.dbc b/opendbc/generator/honda/honda_crv_hybrid_2019_can.dbc new file mode 100644 index 00000000000000..2398526e04fc9d --- /dev/null +++ b/opendbc/generator/honda/honda_crv_hybrid_2019_can.dbc @@ -0,0 +1,48 @@ +CM_ "IMPORT _bosch_2018.dbc" + +BO_ 419 GEARBOX: 8 PCM + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON + SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + +BO_ 927 RADAR_HUD: 8 RADAR + SG_ ZEROS_BOH : 7|10@0+ (1,0) [0|127] "" BDY + SG_ CMBS_OFF : 12|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH3 : 31|32@0+ (1,0) [0|4294967295] "" XXX + SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_TO_1 : 13|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH2 : 11|4@0+ (1,0) [0|1] "" XXX + SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|1] "" XXX + SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_0 : 22|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 1302 ODOMETER: 8 XXX + SG_ ODOMETER : 7|24@0+ (1,0) [0|16777215] "km" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +CM_ SG_ 344 DISTANCE_COUNTER ""; +CM_ SG_ 450 EPB_STATE "3: On, 2: Disengaging, 1: Engaging, 0: Off"; +CM_ SG_ 479 CONTROL_ON "Set to 5 when car is being controlled"; +CM_ SG_ 479 RELATED_TO_GAS "bits 7, 3, and 1 set to 1 when gas not applied"; +CM_ SG_ 479 GAS_BRAKE "Signed value, negative when braking and positive when applying gas"; + +VAL_ 419 GEAR_SHIFTER 32 "D" 8 "R" 4 "P" ; +VAL_ 545 ECON_ON_2 0 "off" 3 "on" ; +VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; +VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ; +VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; +VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; + +CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/generator/honda/honda_crv_touring_2016_can.dbc b/opendbc/generator/honda/honda_crv_touring_2016_can.dbc index 54350c01b3a4c3..3d9b48ab7154bc 100644 --- a/opendbc/generator/honda/honda_crv_touring_2016_can.dbc +++ b/opendbc/generator/honda/honda_crv_touring_2016_can.dbc @@ -29,12 +29,6 @@ BO_ 404 STEERING_CONTROL: 4 EON SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EPS SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EPS -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -64,7 +58,7 @@ BO_ 891 WIPERS: 8 XXX CM_ SG_ 401 GEAR "10 = reverse, 11 = transition"; -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; diff --git a/opendbc/generator/honda/honda_fit_ex_2018_can.dbc b/opendbc/generator/honda/honda_fit_ex_2018_can.dbc new file mode 100644 index 00000000000000..ce02d4cf8a161e --- /dev/null +++ b/opendbc/generator/honda/honda_fit_ex_2018_can.dbc @@ -0,0 +1,89 @@ +CM_ "IMPORT _honda_2017.dbc" +CM_ "IMPORT _comma.dbc" + +BO_ 145 KINEMATICS: 8 XXX + SG_ LAT_ACCEL : 7|10@0+ (0.02,-512) [-20|20] "m/s2" EON + +BO_ 228 STEERING_CONTROL: 5 ADAS + SG_ STEER_TORQUE : 7|16@0- (1,0) [-3840|3840] "" EPS + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" EPS + +BO_ 304 GAS_PEDAL_2: 8 PCM + SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 342 STEERING_SENSORS: 6 EPS + SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 401 GEARBOX: 8 PCM + SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON + SG_ GEAR : 43|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 422 SCM_BUTTONS: 8 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON + SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON + SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 487 BRAKE_PRESSURE: 4 VSA + SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" EON + SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" EON + SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON + +BO_ 660 SCM_FEEDBACK: 8 SCM + SG_ RIGHT_BLINKER : 6|1@0+ (1,0) [0|1] "" EON + SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON + SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 862 HIGHBEAM_CONTROL: 8 ADAS + SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY + SG_ ZEROS_BOH_2 : 48|4@1+ (1,0) [0|15] "" XXX + SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 884 STALK_STATUS: 8 XXX + SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON + SG_ HEADLIGHTS_ON : 54|1@0+ (1,0) [0|1] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +CM_ SG_ 401 GEAR "10 = reverse, 11 = transition"; +CM_ SG_ 420 BRAKE_HOLD_RELATED "On when Brake Hold engaged"; + +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; +VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; +VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; + +CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/generator/honda/honda_insight_ex_2019_can.dbc b/opendbc/generator/honda/honda_insight_ex_2019_can.dbc new file mode 100644 index 00000000000000..ff988cf9dae796 --- /dev/null +++ b/opendbc/generator/honda/honda_insight_ex_2019_can.dbc @@ -0,0 +1,44 @@ +CM_ "IMPORT _bosch_2018.dbc" + +BO_ 419 GEARBOX: 8 PCM + SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON + SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ BRAKE_ERROR_1 : 13|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 12|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + +BO_ 927 RADAR_HUD: 8 RADAR + SG_ ZEROS_BOH : 7|10@0+ (1,0) [0|127] "" BDY + SG_ CMBS_OFF : 12|1@0+ (1,0) [0|1] "" BDY + SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_TO_1 : 13|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH2 : 11|4@0+ (1,0) [0|1] "" XXX + SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|1] "" XXX + SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_0 : 22|1@0+ (1,0) [0|1] "" XXX + SG_ HUD_LEAD : 40|1@0+ (1,0) [0|1] "" XXX + SG_ SET_TO_64 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ LEAD_DISTANCE : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH3 : 47|7@0+ (1,0) [0|127] "" XXX + SG_ ZEROS_BOH4 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 1029 DOORS_STATUS: 8 BDY + SG_ DOOR_OPEN_FL : 37|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_FR : 38|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RL : 39|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RR : 40|1@0+ (1,0) [0|1] "" EON + SG_ TRUNK_OPEN : 41|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + + VAL_ 419 GEAR 10 "R" 1 "D" 0 "P"; + VAL_ 419 GEAR_SHIFTER 32 "D" 16 "N" 8 "R" 4 "P" ; + +CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/generator/honda/honda_odyssey_exl_2018.dbc b/opendbc/generator/honda/honda_odyssey_exl_2018.dbc index 40638ac805b63e..fb54a29abc7955 100644 --- a/opendbc/generator/honda/honda_odyssey_exl_2018.dbc +++ b/opendbc/generator/honda/honda_odyssey_exl_2018.dbc @@ -31,15 +31,6 @@ BO_ 419 GEARBOX: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" XXX - SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" XXX - SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX - BO_ 450 EPB_STATUS: 8 XXX SG_ EPB_BRAKE_AND_PULL : 6|1@0+ (1,0) [0|1] "" XXX SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" XXX @@ -100,7 +91,7 @@ CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed"; CM_ SG_ 806 REVERSE_LIGHT "Might be reverse gear selected and not the lights"; CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnings etc..."; -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 419 GEAR_SHIFTER 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 450 EPB_STATE 3 "engaged" 2 "disengaging" 1 "engaging" 0 "disengaged" ; VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; @@ -110,7 +101,5 @@ VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ; VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ; -VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; -VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ; CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/generator/honda/honda_pilot_touring_2017_can.dbc b/opendbc/generator/honda/honda_pilot_touring_2017_can.dbc index c480fad102b698..779cd66f5be877 100644 --- a/opendbc/generator/honda/honda_pilot_touring_2017_can.dbc +++ b/opendbc/generator/honda/honda_pilot_touring_2017_can.dbc @@ -39,12 +39,6 @@ BO_ 419 GEARBOX: 8 PCM SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -58,7 +52,7 @@ BO_ 660 SCM_FEEDBACK: 8 SCM SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 419 GEAR_SHIFTER 32 "D" 8 "R" 4 "P" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; diff --git a/opendbc/generator/honda/honda_ridgeline_black_edition_2017_can.dbc b/opendbc/generator/honda/honda_ridgeline_black_edition_2017_can.dbc index bd4d0f1366537b..d070d314d59e53 100644 --- a/opendbc/generator/honda/honda_ridgeline_black_edition_2017_can.dbc +++ b/opendbc/generator/honda/honda_ridgeline_black_edition_2017_can.dbc @@ -34,12 +34,6 @@ BO_ 419 GEARBOX: 8 PCM SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -53,7 +47,7 @@ BO_ 660 SCM_FEEDBACK: 8 SCM SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 419 GEAR_SHIFTER 32 "D" 8 "R" 4 "P" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; diff --git a/opendbc/generator/toyota/_comma.dbc b/opendbc/generator/toyota/_comma.dbc index 9c067113a60b58..aa6a55f8b00bd3 100644 --- a/opendbc/generator/toyota/_comma.dbc +++ b/opendbc/generator/toyota/_comma.dbc @@ -9,3 +9,19 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; diff --git a/opendbc/generator/toyota/_toyota_2017.dbc b/opendbc/generator/toyota/_toyota_2017.dbc index 5679ecf399eef8..c0e3a864850afc 100644 --- a/opendbc/generator/toyota/_toyota_2017.dbc +++ b/opendbc/generator/toyota/_toyota_2017.dbc @@ -40,6 +40,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -55,13 +60,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -96,29 +111,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -150,6 +155,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -160,32 +168,95 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; diff --git a/opendbc/generator/toyota/lexus_is_2018_pt.dbc b/opendbc/generator/toyota/lexus_is_2018_pt.dbc new file mode 100644 index 00000000000000..6548822fddca9c --- /dev/null +++ b/opendbc/generator/toyota/lexus_is_2018_pt.dbc @@ -0,0 +1,39 @@ +CM_ "IMPORT _toyota_2017.dbc" +CM_ "IMPORT _comma.dbc" + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 705 GAS_PEDAL: 8 XXX + SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX + SG_ GAS_PEDAL : 55|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 5 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 956 GEAR_PACKET: 8 XXX + SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + +BO_ 1009 PCM_CRUISE_3: 8 XXX + SG_ MAIN_ON : 13|1@0+ (1,0) [0|3] "" XXX + SG_ CRUISE_STATE : 10|1@0+ (1,0) [0|1] "" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "mph" XXX + +CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +CM_ SG_ 1009 SET_SPEED "units seem to be whatever the car is set to"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; diff --git a/opendbc/generator/toyota/lexus_is_hybrid_2017_pt.dbc b/opendbc/generator/toyota/lexus_is_hybrid_2017_pt.dbc new file mode 100644 index 00000000000000..7fb743770573c7 --- /dev/null +++ b/opendbc/generator/toyota/lexus_is_hybrid_2017_pt.dbc @@ -0,0 +1,41 @@ +CM_ "IMPORT _toyota_2017.dbc" +CM_ "IMPORT _comma.dbc" + +BO_ 581 GAS_PEDAL: 5 XXX + SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.66,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 5 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 956 GEAR_PACKET: 8 XXX + SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + +BO_ 1009 PCM_CRUISE_ISH: 8 XXX + SG_ MAIN_ON : 13|1@0+ (1,0) [0|3] "" XXX + SG_ CRUISE_STATE : 10|1@0+ (1,0) [0|1] "" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "mph" XXX + +BO_ 1599 LIGHT_STALK_ISH: 8 SCM + SG_ AUTO_HIGH_BEAM : 19|1@0+ (1,0) [0|1] "" XXX + +CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +CM_ SG_ 1009 SET_SPEED "units seem to be whatever the car is set to"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; diff --git a/opendbc/generator/toyota/lexus_rx_hybrid_2017_pt.dbc b/opendbc/generator/toyota/lexus_rx_hybrid_2017_pt.dbc index 8fe5ec1991f18a..fb42de9f68d36f 100644 --- a/opendbc/generator/toyota/lexus_rx_hybrid_2017_pt.dbc +++ b/opendbc/generator/toyota/lexus_rx_hybrid_2017_pt.dbc @@ -22,7 +22,9 @@ BO_ 610 EPS_STATUS: 5 EPS SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX BO_ 956 GEAR_PACKET: 8 XXX + SG_ SPORT_ON : 2|1@0+ (1,0) [0|1] "" XXX SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + SG_ ECON_ON : 40|1@0+ (1,0) [0|1] "" XXX CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; @@ -31,3 +33,5 @@ CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 956 SPORT_ON 0 "off" 1 "on"; +VAL_ 956 ECON_ON 0 "off" 1 "on"; diff --git a/opendbc/generator/toyota/toyota_camry_hybrid_2018_pt.dbc b/opendbc/generator/toyota/toyota_camry_hybrid_2018_pt.dbc index c21dc779eb2ae4..efde86ba9c81b5 100644 --- a/opendbc/generator/toyota/toyota_camry_hybrid_2018_pt.dbc +++ b/opendbc/generator/toyota/toyota_camry_hybrid_2018_pt.dbc @@ -20,6 +20,7 @@ BO_ 608 STEER_TORQUE_SENSOR: 8 XXX SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ STEER_ANGLE : 31|16@0- (0.05527,0) [-500|500] "" XXX BO_ 610 EPS_STATUS: 8 EPS SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX diff --git a/opendbc/generator/toyota/toyota_chr_2018_pt.dbc b/opendbc/generator/toyota/toyota_chr_2018_pt.dbc index 60865fb46f552d..7306ed2c06e039 100644 --- a/opendbc/generator/toyota/toyota_chr_2018_pt.dbc +++ b/opendbc/generator/toyota/toyota_chr_2018_pt.dbc @@ -23,11 +23,15 @@ BO_ 610 EPS_STATUS: 8 EPS SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 956 GEAR_PACKET: 8 XXX + SG_ SPORT_ON : 2|1@0+ (1,0) [0|1] "" XXX SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + SG_ ECON_ON : 40|1@0+ (1,0) [0|1] "" XXX CM_ SG_ 548 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 548 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; -VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 956 SPORT_ON 0 "off" 1 "on"; +VAL_ 956 ECON_ON 0 "off" 1 "on"; diff --git a/opendbc/generator/toyota/toyota_chr_hybrid_2018_pt.dbc b/opendbc/generator/toyota/toyota_chr_hybrid_2018_pt.dbc new file mode 100644 index 00000000000000..c86fcaaf659c86 --- /dev/null +++ b/opendbc/generator/toyota/toyota_chr_hybrid_2018_pt.dbc @@ -0,0 +1,36 @@ +CM_ "IMPORT _toyota_2017.dbc" +CM_ "IMPORT _comma.dbc" + +BO_ 295 GEAR_PACKET: 8 XXX + SG_ CAR_MOVEMENT : 39|8@0- (1,0) [0|255] "" XXX + SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 581 GAS_PEDAL: 8 XXX + SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 8 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +CM_ SG_ 548 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 548 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered"; +VAL_ 295 GEAR 0 "P" 1 "R" 2 "N" 3 "D" 4 "B"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; diff --git a/opendbc/generator/toyota/toyota_highlander_hybrid_2018_pt.dbc b/opendbc/generator/toyota/toyota_highlander_hybrid_2018_pt.dbc new file mode 100644 index 00000000000000..8fe5ec1991f18a --- /dev/null +++ b/opendbc/generator/toyota/toyota_highlander_hybrid_2018_pt.dbc @@ -0,0 +1,33 @@ +CM_ "IMPORT _toyota_2017.dbc" +CM_ "IMPORT _comma.dbc" + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 581 GAS_PEDAL: 5 XXX + SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 5 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 956 GEAR_PACKET: 8 XXX + SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + +CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; diff --git a/opendbc/generator/toyota/toyota_rav4_hybrid_2017_pt.dbc b/opendbc/generator/toyota/toyota_rav4_hybrid_2017_pt.dbc index 8fe5ec1991f18a..d5a265fbb8386d 100644 --- a/opendbc/generator/toyota/toyota_rav4_hybrid_2017_pt.dbc +++ b/opendbc/generator/toyota/toyota_rav4_hybrid_2017_pt.dbc @@ -22,7 +22,14 @@ BO_ 610 EPS_STATUS: 5 EPS SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX BO_ 956 GEAR_PACKET: 8 XXX + SG_ SPORT_ON : 2|1@0+ (1,0) [0|1] "" XXX SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + SG_ SPORT_GEAR_ON : 33|1@0+ (1,0) [0|1] "" XXX + SG_ SPORT_GEAR : 38|3@0+ (1,0) [0|7] "" XXX + SG_ ECON_ON : 40|1@0+ (1,0) [0|1] "" XXX + SG_ DRIVE_ENGAGED : 47|1@0+ (1,0) [0|1] "" XXX + + CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; @@ -30,4 +37,9 @@ CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered"; CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; +VAL_ 956 SPORT_ON 0 "off" 1 "on"; VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 956 SPORT_GEAR_ON 0 "off" 1 "on"; +VAL_ 956 SPORT_GEAR 1 "S1" 2 "S2" 3 "S3" 4 "S4" 5 "S5" 6 "S6"; +VAL_ 956 ECON_ON 0 "off" 1 "on"; +VAL_ 956 DRIVE_ENGAGED 0 "off" 1 "on"; diff --git a/opendbc/generator/toyota/toyota_sienna_xle_2018_pt.dbc b/opendbc/generator/toyota/toyota_sienna_xle_2018_pt.dbc new file mode 100644 index 00000000000000..0c6ba26bc1ed7d --- /dev/null +++ b/opendbc/generator/toyota/toyota_sienna_xle_2018_pt.dbc @@ -0,0 +1,33 @@ +CM_ "IMPORT _toyota_2017.dbc" +CM_ "IMPORT _comma.dbc" + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|65535] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|3] "" XXX + +BO_ 705 GAS_PEDAL: 8 XXX + SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX + SG_ GAS_PEDAL : 55|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 5 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 956 GEAR_PACKET: 8 XXX + SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + +CM_ SG_ 548 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 548 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby" diff --git a/opendbc/gm_global_a_object.dbc b/opendbc/gm_global_a_object.dbc index b4aa31a3e179f1..1532e90dadac90 100644 --- a/opendbc/gm_global_a_object.dbc +++ b/opendbc/gm_global_a_object.dbc @@ -33,16 +33,33 @@ NS_ : BS_: -BU_: K109_FCM B233B_LRR NEO K124_ASCM +BU_: K109_FCM B233B_LRR NEO VIS_FO VIS2_FO K124_ASCM Vector__XXX EOCM_F_FO EOCM2A_IMX6_FO EOCM2A_K2_FO EOCM2A_K1_FO EOCM2B_IMX6_FO EOCM2B_K2_FO EOCM2B_K1_FO VAL_TABLE_ RangeMode 1 "Active" 0 "Inactive" ; VAL_TABLE_ TrkConf 3 "Confident" 2 "Speculative" 1 "Highly speculative" 0 "Invalid" ; -VAL_TABLE_ TrkMeasStatus 3 "Measured current cycle" 2 "Latent track not detected " 1 "New object" 0 "No object" ; -VAL_TABLE_ TrkDynProp 4 "Moving in opposite direction" 3 "Moving in same direction " 2 "Has moved but currenty stopped" 1 "Has never moved," 0 "Unkown" ; +VAL_TABLE_ TrkMeasStatus 3 "Measured current cycle" 2 "Latent track not detected" 1 "New object" 0 "No object" ; +VAL_TABLE_ TrkDynProp 4 "Moving in opposite direction" 3 "Moving in same direction" 2 "Has moved but currenty stopped" 1 "Has never moved," 0 "Unkown" ; +VAL_TABLE_ FrntVsnInPthVehBrkNwSt 10 "Active" 5 "Inactive" ; +VAL_TABLE_ FrntVsnClostPedBrkNwSt 10 "Active" 5 "Inactive" ; +VAL_TABLE_ LaneSnsLLnPosValid 1 "Invalid" 0 "Valid" ; +VAL_TABLE_ LnSnsRLnPosValid 1 "Invalid" 0 "Valid" ; +VAL_TABLE_ ObjectType 7 "no object present" 6 "fixed roadside object" 5 "fixed overhead object" 4 "pedestrian" 3 "motocycle / bicycle" 2 "Large vehicle (semi)" 1 "4 Wheel Vehicle (car, small trk)" 0 "Unknown" ; +VAL_TABLE_ FwVsnCinCoutPotT9Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT8Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT7Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT6Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT5Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT4Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT3Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT2Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT1Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT12Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT11Rev 2 "Right" 1 "Left" 0 "None" ; +VAL_TABLE_ FwVsnCinCoutPotT10Rev 2 "Right" 1 "Left" 0 "None" ; BO_ 3221225472 VECTOR__INDEPENDENT_SIG_MSG: 0 Vector__XXX - SG_ Always12 : 0|8@0+ (1,0) [0|0] "" Vector__XXX - SG_ TimeStatusChecksum : 0|12@0+ (1,0) [0|0] "" Vector__XXX + SG_ Always12 : 0|8@0+ (1,0) [0|0] "" Vector__XXX + SG_ TimeStatusChecksum : 0|12@0+ (1,0) [0|0] "" Vector__XXX BO_ 161 ASCMTimeStatus: 7 NEO SG_ TimeStatus : 7|28@0+ (1,0) [0|0] "" B233B_LRR @@ -67,8 +84,37 @@ BO_ 776 ASCMAccSpeedStatus: 7 NEO SG_ VehicleSpeed : 15|12@0+ (1,0) [0|0] "" B233B_LRR SG_ AlwaysOne : 3|1@0+ (1,0) [0|0] "" B233B_LRR -BO_ 1120 LRRNumObjects: 8 B233B_LRR - SG_ LRRNumObjects : 20|5@0+ (1,0) [0|0] "" NEO +BO_ 1120 F_LRR_Obj_Header: 8 LRR_FO + SG_ FLRRRollingCount : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FLRRModeCmdFdbk : 23|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FLRRNumValidTargets : 20|5@0+ (1,0) [0|31] "" EOCM_F_FO + SG_ FLRRTimeStampV : 31|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRTimeStamp : 2|11@0+ (1,0) [0|2047] "ms" EOCM_F_FO + SG_ FLRRRoadTypeInfo : 5|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FLRRBurstChecksum : 55|16@0+ (1,0) [0|65535] "" EOCM_F_FO + SG_ FLRRDiagSpare : 30|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRVltgOutRngLo : 44|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRVltgOutRngHi : 43|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRSvcAlgnInPrcs : 38|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRSnsrBlckd : 45|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRSnstvFltPrsntInt : 24|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRPlntAlgnInProc : 37|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRMsalgnYawRt : 47|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRMsalgnYawLt : 46|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRLonVelPlsblityFlt : 35|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRYawRtPlsblityFlt : 34|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRMsalgnPtchUp : 32|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRMsalgnPtchDn : 33|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRInitDiagCmplt : 40|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRHWFltPrsntInt : 25|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRExtIntrfrnc : 36|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRCANSgnlSpvFld : 29|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRCANRxErr : 28|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRTunlDtctd : 27|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRAmbTmpOutRngLw : 42|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRAmbTmpOutRngHi : 41|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRAntTngFltPrsnt : 26|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FLRRAlgnFltPrsnt : 39|1@0+ (1,0) [0|1] "" EOCM_F_FO BO_ 1134 LRRObject14: 8 B233B_LRR SG_ TrkRange : 5|11@0+ (0.125,0) [0|255.875] "m" NEO @@ -229,6 +275,428 @@ BO_ 1121 LRRObject01: 8 B233B_LRR SG_ TrkAzimuth : 35|12@0- (0.125,0) [-256|255.875] "deg" NEO SG_ TrkWidth : 55|6@0+ (0.25,0) [0|15.75] "m" NEO SG_ TrkObjectID : 61|6@0+ (1,0) [0|63] "" NEO + + BO_ 1094 F_Vision_Obj_Track_12: 8 VIS2_FO + SG_ FwdVsnObjTypTr12Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FwdVsnAzmthTrk12Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnRngTrk12Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FVisionWidthTrk12 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + SG_ FVisionMeasStatTrk12 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnVertPosTrk12 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FVisionRelLaneTrk12 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk12 : 34|11@0- (0.125,0) [-128|127.875] "deg/sec" EOCM_F_FO + SG_ FVisionConfTrk12 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ ObjDirTrk12 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisBurstIDTrk12 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk12 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + +BO_ 1093 F_Vision_Obj_Track_11: 8 VIS2_FO + SG_ FwdVsnObjTypTr11Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FwdVsnAzmthTrk11Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnRngTrk11Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FVisionWidthTrk11 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + SG_ FVisionMeasStatTrk11 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnVertPosTrk11 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FVisionRelLaneTrk11 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk11 : 34|11@0- (0.125,0) [-128|127.875] "deg/sec" EOCM_F_FO + SG_ FVisionConfTrk11 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ ObjDirTrk11 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisBurstIDTrk11 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk11 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + +BO_ 1100 F_Vision_Obj_Track_12_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT12Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk12 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk12 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk12 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk12 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr12 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk12 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo12 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1099 F_Vision_Obj_Track_11_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT11Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk11 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk11 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk11 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk11 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr11 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk11 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo11 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1098 F_Vision_Obj_Track_10_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT10Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk10 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk10 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk10 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk10 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr10 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk10 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo10 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1097 F_Vision_Obj_Track_9_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT9Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk9 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk9 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk9 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk9 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr9 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk9 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo9 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1096 F_Vision_Obj_Track_8_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT8Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk8 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk8 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk8 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk8 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr8 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk8 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo8 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1095 F_Vision_Obj_Track_7_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT7Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk7 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk7 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk7 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk7 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr7 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk7 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo7 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1068 F_Vision_Obj_Track_6_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT6Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk6 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk6 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk6 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk6 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr6 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk6 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo6 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1067 F_Vision_Obj_Track_5_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT5Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk5 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk5 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk5 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk5 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr5 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk5 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo5 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1066 F_Vision_Obj_Track_4_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT4Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk4 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk4 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk4 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk4 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr4 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk4 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo4 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1065 F_Vision_Obj_Track_3_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT3Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk3 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk3 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk3 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk3 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr3 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk3 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo3 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1064 F_Vision_Obj_Track_2_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT2Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjAgeTrk2 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk2 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk2 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk2 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr2 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk2 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo2 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1063 F_Vision_Obj_Track_1_B: 8 VIS2_FO + SG_ FwVsnCinCoutPotT1Rev : 5|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnObjSclChgTrk1 : 15|16@0- (0.0002,0) [-6.5536|6.5534] "pix/sec" EOCM_F_FO + SG_ FwdVsnObjAgeTrk1 : 62|7@0+ (1,0) [0|127] "" EOCM_F_FO + SG_ FwdVsnLongVlctyTrk1 : 42|12@0- (0.0625,0) [-128|127.9375] "m/sec" EOCM_F_FO + SG_ FwdVsnLatOfstTrk1 : 36|10@0- (0.125,0) [-64|63.875] "m" EOCM_F_FO + SG_ FwdVsnBrkLtStatTrk1 : 38|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FwdVsnTrnSigStatTr1 : 25|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FrtVsnBrstIDAddInfo1 : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1088 F_Vision_Obj_Header_2: 8 VIS2_FO + SG_ FrntVsnInPthVehBrkNwSt : 35|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FrntVsnClostPedBrkNwSt : 39|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FrntVsnClostPedObjID : 29|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FrntVsnClostPedAlrtNwFlg : 30|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FrntVsnClostPedNotftnFlg : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FrntVsnInPthVehAlrtNwFlg : 2|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FrtVsnVldTgtNum2 : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FrtVsnTmStmp2V : 31|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FrtVsnTmStmp2 : 10|11@0+ (1,0) [0|2047] "" EOCM_F_FO + SG_ FrtVsnRollCnt2 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FrtVsnBrstChksum2 : 55|16@0+ (1,0) [0|65535] "" EOCM_F_FO + +BO_ 854 F_Vision_Environment_7: 3 VIS2_FO + SG_ FwdVsnCnstrctAreaDst : 13|4@0+ (10,0) [0|150] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ FwdVsnCnstrctZnDet : 15|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ FwdVsnEgoVehLnPos : 17|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ FwdVsnRdTypDet : 9|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ FwdVsnTunnlDetd : 23|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ FwdVsnTunnlDst : 21|4@0+ (10,0) [0|150] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsBrstID5 : 1|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + +BO_ 853 F_Vision_Environment_6: 8 VIS2_FO + SG_ LnMrkg4LnSnsLnHdngTngtV : 7|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnSnsLnHdngTngt : 23|8@0- (0.002,0) [-0.256|0.254] "m/m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnSnsLnDstV : 56|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnSnsLnDst : 15|8@0- (0.1,0) [-12.8|12.7] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnSnsLnCrvtV : 6|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnSnsLnCrvtGradV : 5|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnSnsLnCrvtGrad : 47|16@0- (5.96e-8,0) [-0.0019529728|0.0019529132] "1/(m*sec)" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnSnsLnCrvt : 31|16@0- (9.53e-7,0) [-0.031227904|0.031226951] "1/m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnQltyConfLvl : 63|7@0+ (0.7874016,0) [0|100.0000032] "%" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnMrkrTyp : 4|3@0+ (1,0) [0|7] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsBrstID4 : 1|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + +BO_ 852 F_Vision_Environment_5: 8 VIS2_FO + SG_ LnMrkg3LnSnsLnHdngTngtV : 7|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnSnsLnHdngTngt : 23|8@0- (0.002,0) [-0.256|0.254] "m/m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnSnsLnDstV : 56|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnSnsLnDst : 15|8@0- (0.1,0) [-12.8|12.7] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnSnsLnCrvtV : 6|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnSnsLnCrvtGradV : 5|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnSnsLnCrvtGrad : 47|16@0- (5.96e-8,0) [-0.0019529728|0.0019529132] "1/(m*sec)" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnSnsLnCrvt : 31|16@0- (9.53e-7,0) [-0.031227904|0.031226951] "1/m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnQltyConfLvl : 63|7@0+ (0.7874016,0) [0|100.0000032] "%" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnMrkrTyp : 4|3@0+ (1,0) [0|7] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsBrstID3 : 1|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + +BO_ 309 LHT_CameraObjConfirmation_FO: 1 VIS_FO + SG_ HiBmRecmnd : 1|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ CtLghtDet : 0|1@0+ (1,0) [0|1] "" EOCM_F_FO + +BO_ 848 F_Vision_Environment: 8 VIS_FO + SG_ FwdVsnEnvIllum : 37|3@0+ (1,0) [0|7] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsTngtOfHdngLnRtV : 1|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsTngtOfHdngLnRt : 31|8@0- (0.002,0) [-0.256|0.254] "m/m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLnChngStatus : 39|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsBurstChecksum : 55|16@0+ (1,0) [0|65535] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LaneSenseRollingCount : 7|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LaneSenseSystemOK : 4|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LaneSnsLLnPosValid : 2|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSenseDistToLLnEdge : 14|7@0+ (0.05,0) [0|6.35] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsRLnPosValid : 0|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsDistToRLnEdge : 22|7@0+ (0.05,0) [0|6.35] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LaneSenseTimeStampV : 5|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LaneSenseTimeStamp : 34|11@0+ (1,0) [0|2047] "ms" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LaneSenseSystemOKV : 3|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + +BO_ 849 F_Vision_Environment_2: 8 VIS_FO + SG_ LnSnsLatVRelToRgtMrkg : 23|8@0- (0.02,0) [-2.56|2.54] "m/s" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM_F_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO + SG_ LnSnsRtLnMrkgTypChgDst : 61|4@0+ (10,0) [0|150] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsCrvtGrdntRtV : 63|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLnMrkgWdthRt : 62|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsRtAnchrLn : 57|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLtAnchrLn : 56|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLnCrvtrRghtV : 0|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLnCrvtrRght : 47|16@0- (9.53e-7,0) [-0.031227904|0.031226951] "1/m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsCrvtGrdntRt : 31|16@0- (5.96e-8,0) [-0.0019529728|0.0019529132] "1/rad/s" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsBurstID : 2|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLatVRelToLftMrkg : 15|8@0- (0.02,0) [-2.56|2.54] "m/s" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + +BO_ 1056 F_Vision_Obj_Header: 6 VIS_FO + SG_ FVsnSnsrBlckd : 24|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ ClstInPathVehObjID : 30|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FrtVsnFld : 6|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FrtVsnIniDiagSuccCmpt : 5|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FrtVsnSrvAlgnInPrcs : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FrtVsnUnvlbl : 7|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisionRollingCnt : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVISModeCmdFdbk : 4|3@0+ (1,0) [0|7] "" EOCM_F_FO + SG_ FVisionNumValidTrgts : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FVisionTimeStampV : 31|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisionTimeStamp : 10|11@0+ (1,0) [0|2047] "ms" EOCM_F_FO + SG_ VISBurstChecksum : 39|16@0+ (1,0) [0|65535] "" EOCM_F_FO + +BO_ 1057 F_Vision_Obj_Track_1: 8 VIS_FO + SG_ FwdVsnRngTrk1Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnAzmthTrk1Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnObjTypTr1Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FwdVsnVertPosTrk1 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FVisBurstIDTrk1 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk1 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FVisionConfTrk1 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk1 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk1 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionMeasStatTrk1 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk1 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + SG_ ObjDirTrk1 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + +BO_ 1058 F_Vision_Obj_Track_2: 8 VIS_FO + SG_ FwdVsnVertPosTrk2 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FwdVsnRngTrk2Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnAzmthTrk2Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ ObjDirTrk2 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FwdVsnObjTypTr2Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FVisBurstIDTrk2 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk2 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FVisionConfTrk2 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk2 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk2 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionMeasStatTrk2 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk2 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + +BO_ 1059 F_Vision_Obj_Track_3: 8 VIS_FO + SG_ FwdVsnVertPosTrk3 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FwdVsnRngTrk3Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnAzmthTrk3Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnObjTypTr3Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ ObjDirTrk3 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisBurstIDTrk3 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk3 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FVisionConfTrk3 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk3 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk3 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionMeasStatTrk3 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk3 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + +BO_ 1060 F_Vision_Obj_Track_4: 8 VIS_FO + SG_ FwdVsnVertPosTrk4 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FVisionMeasStatTrk4 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk4 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + SG_ FwdVsnRngTrk4Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnAzmthTrk4Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnObjTypTr4Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FVisBurstIDTrk4 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk4 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ ObjDirTrk4 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisionConfTrk4 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk4 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk4 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + +BO_ 1061 F_Vision_Obj_Track_5: 8 VIS_FO + SG_ FwdVsnVertPosTrk5 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FwdVsnRngTrk5Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnAzmthTrk5Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnObjTypTr5Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ ObjDirTrk5 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisBurstIDTrk5 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk5 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FVisionConfTrk5 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk5 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk5 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionMeasStatTrk5 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk5 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + +BO_ 1062 F_Vision_Obj_Track_6: 8 VIS_FO + SG_ FwdVsnVertPosTrk6 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FwdVsnRngTrk6Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnAzmthTrk6Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnObjTypTr6Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ ObjDirTrk6 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisBurstIDTrk6 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk6 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FVisionConfTrk6 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk6 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk6 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionMeasStatTrk6 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk6 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + +BO_ 1089 F_Vision_Obj_Track_7: 8 VIS2_FO + SG_ FVisBurstIDTrk7 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk7 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FVisionConfTrk7 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk7 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk7 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionMeasStatTrk7 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk7 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + SG_ FwdVsnRngTrk7Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnObjTypTr7Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FwdVsnAzmthTrk7Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnVertPosTrk7 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ ObjDirTrk7 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + +BO_ 1090 F_Vision_Obj_Track_8: 8 VIS2_FO + SG_ FVisBurstIDTrk8 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk8 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FwdVsnAzmthTrk8Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnVertPosTrk8 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FwdVsnRngTrk8Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnObjTypTr8Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ ObjDirTrk8 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisionConfTrk8 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk8 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk8 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionMeasStatTrk8 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk8 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + +BO_ 1091 F_Vision_Obj_Track_9: 8 VIS2_FO + SG_ FwdVsnVertPosTrk9 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ FwdVsnRngTrk9Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnAzmthTrk9Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnObjTypTr9Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ ObjDirTrk9 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisBurstIDTrk9 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk9 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FVisionConfTrk9 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk9 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk9 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionMeasStatTrk9 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk9 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + +BO_ 1092 F_Vision_Obj_Track_10: 8 VIS2_FO + SG_ FwdVsnRngTrk10Rev : 16|12@0+ (0.1,0) [0|409.5] "m" EOCM_F_FO + SG_ FwdVsnAzmthTrk10Rev : 10|10@0- (0.1,0) [-51.2|51.1] "deg" EOCM_F_FO + SG_ FwdVsnObjTypTr10Rev : 14|4@0+ (1,0) [0|15] "" EOCM_F_FO + SG_ FwdVsnVertPosTrk10 : 53|6@0+ (0.25,-2) [-2|13.75] "deg" EOCM_F_FO + SG_ ObjDirTrk10 : 15|1@0+ (1,0) [0|1] "" EOCM_F_FO + SG_ FVisBurstIDTrk10 : 1|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionObjectIDTrk10 : 7|6@0+ (1,0) [0|63] "" EOCM_F_FO + SG_ FVisionConfTrk10 : 36|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionAzRateTrk10 : 34|11@0- (0.125,0) [-128|127.875] "deg/s" EOCM_F_FO + SG_ FVisionRelLaneTrk10 : 55|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionMeasStatTrk10 : 63|2@0+ (1,0) [0|3] "" EOCM_F_FO + SG_ FVisionWidthTrk10 : 61|6@0+ (0.25,0) [0|15.75] "m" EOCM_F_FO + +BO_ 851 F_Vision_Environment_4: 8 VIS_FO + SG_ LnMrkg3LnPrvwDst : 45|4@0+ (10,0) [0|150] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsTtlNmLnMrkgDetRt : 4|3@0+ (1,0) [0|7] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsRtLinCrsTm : 25|5@0+ (0.1,0) [0|3.1] "s" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsNumPrlLnsDetRt : 33|3@0+ (1,0) [0|7] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsNumPrlLnsDetLt : 36|3@0+ (1,0) [0|7] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsCrvtGrdntLftV : 31|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLtLinCrsTm : 30|5@0+ (0.1,0) [0|3.1] "s" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnPrvwDst : 50|4@0+ (10,0) [0|150] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnMrkgTypChgDst : 61|4@0+ (10,0) [0|150] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnMrkgTypChgDst : 40|4@0+ (10,0) [0|150] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnMrkgWdth : 62|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4LnMarkrElvtd : 51|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg4AnchrLnLin : 57|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnMrkgWdth : 41|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3LnMarkrElvtd : 46|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkg3AnchrLnLin : 52|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsBurstID2 : 1|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsCrvtGrdntLft : 15|16@0- (5.96e-8,0) [-0.0019529728|0.0019529132] "1/rad/s" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + + BO_ 850 F_Vision_Environment_3: 8 VIS_FO + SG_ LnSnsTtlNmLnMrkgDetLt : 58|3@0+ (1,0) [0|7] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLtLnMrkgWdth : 63|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLtLnMrkgTypChgDst : 62|4@0+ (10,0) [0|150] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsTngtOfHdngLnLftV : 23|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsTngtOfHdngLnLft : 31|8@0- (0.002,0) [-0.256|0.254] "m/m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLnCrvtrLftV : 15|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsLnCrvtrLft : 39|16@0- (9.53e-7,0) [-0.031227904|0.031226951] "1/m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkrTypRght : 50|3@0+ (1,0) [0|7] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkrTypLft : 53|3@0+ (1,0) [0|7] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkrElvtdRght : 54|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnMrkrElvtdLft : 55|1@0+ (1,0) [0|1] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnSnsBurstID1 : 7|2@0+ (1,0) [0|3] "" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnQltyCnfdncLvlRght : 22|7@0+ (0.7874016,0) [0|100.0000032] "%" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnQltyCnfdncLvlLft : 14|7@0+ (0.7874016,0) [0|100.0000032] "%" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnPrvwDstncRght : 2|3@0+ (10,0) [0|70] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + SG_ LnPrvwDstncLft : 5|3@0+ (10,0) [0|70] "m" EOCM2A_IMX6_FO,EOCM2A_K2_FO,EOCM2A_K1_FO,EOCM2B_IMX6_FO,EOCM2B_K2_FO,EOCM2B_K1_FO,EOCM_F_FO + BO_TX_BU_ 161 : K124_ASCM,NEO; BO_TX_BU_ 774 : K124_ASCM,NEO; @@ -236,9 +704,11 @@ BO_TX_BU_ 784 : K124_ASCM,NEO; BO_TX_BU_ 776 : K124_ASCM,NEO; -CM_ BU_ K109_FCM "Frontview Camera Module "; +CM_ BU_ K109_FCM "Frontview Camera Module"; CM_ BU_ B233B_LRR "Radar Sensor Module Long Range"; CM_ BU_ NEO "Comma NEO"; +CM_ BU_ VIS_FO "Front Camera Data"; +CM_ BU_ VIS2_FO "Front Camera Data2"; CM_ BU_ K124_ASCM "Active Safety Control Module"; CM_ BO_ 3221225472 "This is a message for not used signals, created by Vector CANdb++ DBC OLE DB Provider."; BA_DEF_ "UseGMParameterIDs" INT 0 0; @@ -250,6 +720,5 @@ BA_DEF_DEF_ "BusType" ""; BA_ "BusType" "CAN"; BA_ "ProtocolType" "GMLAN"; BA_ "UseGMParameterIDs" 0; -VAL_ 776 NearRangeMode 1 "Active" 0 "Inactive" ; -VAL_ 776 FarRangeMode 1 "Active" 0 "Inactive" ; - +VAL_ 776 NearRangeMode 1 "Active" 0 "Inactive"; +VAL_ 776 FarRangeMode 1 "Active" 0 "Inactive"; diff --git a/opendbc/gm_global_a_powertrain.dbc b/opendbc/gm_global_a_powertrain.dbc index 93d1291aa6c856..3caf60ce4a01ec 100644 --- a/opendbc/gm_global_a_powertrain.dbc +++ b/opendbc/gm_global_a_powertrain.dbc @@ -35,13 +35,18 @@ BS_: BU_: K16_BECM K73_TCIC K9_BCM K43_PSCM K17_EBCM K20_ECM K114B_HPCM NEO K124_ASCM EPB VAL_TABLE_ TurnSignals 2 "Right Turn" 1 "Left Turn" 0 "None" ; +VAL_TABLE_ Intellibeam 1 "Active" 0 "Inactive" ; +VAL_TABLE_ HighBeamsActive 1 "Active" 0 "Inactive" ; +VAL_TABLE_ HighBeamsTemporary 1 "Active" 0 "Inactive" ; VAL_TABLE_ ACCLeadCar 1 "Present" 0 "Not Present" ; VAL_TABLE_ ACCCmdActive 1 "Active" 0 "Inactive" ; VAL_TABLE_ BrakePedalPressed 1 "Pressed" 0 "Depressed" ; VAL_TABLE_ DistanceButton 1 "Active" 0 "Inactive" ; VAL_TABLE_ LKAButton 1 "Active" 0 "Inactive" ; VAL_TABLE_ ACCButtons 6 "Cancel" 5 "Main" 3 "Set" 2 "Resume" 1 "None" ; +VAL_TABLE_ DriveModeButton 1 "Active" 0 "Inactive" ; VAL_TABLE_ PRNDL 3 "Reverse" 2 "Drive" 1 "Neutral" 0 "Park" ; +VAL_TABLE_ ESPButton 1 "Active" 0 "Inactive" ; VAL_TABLE_ DoorStatus 1 "Opened" 0 "Closed" ; VAL_TABLE_ SeatBeltStatus 1 "Latched" 0 "Unlatched" ; VAL_TABLE_ LKASteeringCmdActive 1 "Active" 0 "Inactive" ; @@ -61,9 +66,11 @@ BO_ 190 ECMAcceleratorPos: 6 K20_ECM SG_ GasPedalAndAcc : 23|8@0+ (1,0) [0|0] "" NEO BO_ 201 ECMEngineStatus: 8 K20_ECM - SG_ EngineTPS : 39|8@0+ (0.392156863,0) [0|100.000000065] "%" NEO - SG_ EngineRPM : 15|16@0+ (0.25,0) [0|0] "RPM" NEO - SG_ CruiseMainOn : 29|1@0+ (1,0) [0|1] "" NEO + SG_ EngineTPS : 39|8@0+ (0.392156863,0) [0|100.000000065] "%" NEO + SG_ EngineRPM : 13|14@0+ (0.25,0) [0|0] "RPM" NEO + SG_ CruiseMainOn : 29|1@0+ (1,0) [0|1] "" NEO + SG_ Brake_Pressed : 40|1@0+ (1,0) [0|1] "" NEO + SG_ Standstill : 2|1@0+ (1,0) [0|1] "" NEO BO_ 209 EBCMBrakePedalTorque: 7 K17_EBCM SG_ BrakePedalTorque : 3|12@0+ (1,0) [0|0] "" NEO @@ -81,9 +88,13 @@ BO_ 298 BCMDoorBeltStatus: 8 K9_BCM BO_ 309 ECMPRDNL: 8 K20_ECM SG_ PRNDL : 2|3@0+ (1,0) [0|0] "" NEO + SG_ ESPButton : 4|1@0+ (1,0) [0|1] "" XXX BO_ 320 BCMTurnSignals: 3 K9_BCM SG_ TurnSignals : 19|2@0+ (1,0) [0|0] "" NEO + SG_ Intellibeam : 13|1@0+ (1,0) [0|1] "" XXX + SG_ HighBeamsActive : 7|1@0+ (1,0) [0|1] "" XXX + SG_ HighBeamsTemporary : 5|1@0+ (1,0) [0|1] "" XXX BO_ 328 PSCM_148: 1 K43_PSCM @@ -98,11 +109,12 @@ BO_ 384 ASCMLKASteeringCmd: 4 NEO SG_ LKASteeringCmd : 2|11@0- (1,0) [0|0] "" NEO BO_ 388 PSCMStatus: 8 K43_PSCM - SG_ HandsOffSWDetectionMode : 20|2@0+ (1,0) [0|3] "" NEO - SG_ HandsOffSWlDetectionStatus : 21|1@0+ (1,0) [0|1] "" NEO - SG_ LKATorqueDeliveredStatus : 5|3@0+ (1,0) [0|7] "" NEO - SG_ LKADriverAppldTrq : 50|11@0- (0.01,0) [-10.24|10.23] "Nm" NEO - SG_ LKATotalTorqueDelivered : 2|11@0- (0.01,0) [-10.24|10.23] "Nm" NEO + SG_ HandsOffSWDetectionMode : 20|2@0+ (1,0) [0|3] "" NEO + SG_ HandsOffSWlDetectionStatus : 21|1@0+ (1,0) [0|1] "" NEO + SG_ LKATorqueDeliveredStatus : 5|3@0+ (1,0) [0|7] "" NEO + SG_ LKADriverAppldTrq : 50|11@0- (0.01,0) [-10.24|10.23] "Nm" NEO + SG_ LKATorqueDelivered : 18|11@0- (0.01,0) [0|1] "" NEO + SG_ LKATotalTorqueDelivered : 2|11@0- (0.01,0) [-10.24|10.23] "Nm" NEO BO_ 417 AcceleratorPedal: 8 XXX SG_ AcceleratorPedal : 55|8@0+ (1,0) [0|0] "" NEO @@ -118,15 +130,17 @@ BO_ 481 ASCMSteeringButton: 7 K124_ASCM SG_ DistanceButton : 22|1@0+ (1,0) [0|0] "" NEO SG_ LKAButton : 23|1@0+ (1,0) [0|0] "" NEO SG_ ACCButtons : 46|3@0+ (1,0) [0|0] "" NEO + SG_ DriveModeButton : 39|1@0+ (1,0) [0|1] "" XXX BO_ 485 PSCMSteeringAngle: 8 K43_PSCM SG_ SteeringWheelAngle : 15|16@0- (0.0625,0) [-540|540] "deg" NEO SG_ SteeringWheelRate : 27|12@0- (0.5,0) [-100|100] "deg/s" NEO BO_ 489 EBCMVehicleDynamic: 8 K17_EBCM - SG_ YawRate : 51|12@0- (0.0625,0) [-2047|2047] "grad/s" NEO - SG_ LateralAcceleration : 3|12@0- (0.0161,0) [-2047|2047] "m/s2" NEO - SG_ BrakePedalPressed : 6|1@0+ (1,0) [0|0] "" NEO + SG_ BrakePedalPressed : 6|1@0+ (1,0) [0|0] "" NEO + SG_ LateralAcceleration : 3|10@0- (0.161,0) [-2047|2047] "m/s2" NEO + SG_ YawRate : 35|12@0- (0.625,0) [0|1] "" NEO + SG_ YawRate2 : 51|12@0- (0.0625,0) [-2047|2047] "grad/s" NEO BO_ 560 EPBStatus: 8 EPB SG_ EPBClosed : 12|1@0+ (1,0) [0|1] "" NEO @@ -170,6 +184,7 @@ BO_ 880 ASCMActiveCruiseControlStatus: 6 K124_ASCM SG_ ACCGapLevel : 21|2@0+ (1,0) [0|0] "" NEO SG_ ACCResumeButton : 1|1@0+ (1,0) [0|0] "" NEO SG_ ACCCmdActive : 23|1@0+ (1,0) [0|0] "" NEO + SG_ FCWAlert : 41|2@0+ (1,0) [0|3] "" XXX BO_ 1001 ECMVehicleSpeed: 8 K20_ECM SG_ VehicleSpeed : 7|16@0+ (0.01,0) [0|0] "mph" NEO @@ -180,7 +195,7 @@ BO_ 1033 ASCMKeepAlive: 7 NEO BO_ 1034 ASCM_40A: 7 K124_ASCM BO_ 1217 ECMEngineCoolantTemp: 8 K20_ECM - SG_ EngineCoolantTemp : 23|8@0+ (1,-40) [0|0] "C" NEO + SG_ EngineCoolantTemp : 23|8@0+ (1,-40) [0|0] "°C" NEO BO_ 1249 VIN_Part2: 8 K20_ECM SG_ VINPart2 : 7|64@0+ (1,0) [0|0] "" NEO @@ -224,8 +239,10 @@ BA_ "UseGMParameterIDs" 0; VAL_ 481 DistanceButton 1 "Active" 0 "Inactive" ; VAL_ 481 LKAButton 1 "Active" 0 "Inactive" ; VAL_ 481 ACCButtons 6 "Cancel" 5 "Main" 3 "Set" 2 "Resume" 1 "None" ; +VAL_ 481 DriveModeButton 1 "Active" 0 "Inactive" ; VAL_ 452 CruiseState 4 "Standstill" 3 "Faulted" 1 "Active" 0 "Off" ; VAL_ 309 PRNDL 3 "Reverse" 2 "Drive" 1 "Neutral" 0 "Park" ; +VAL_ 309 ESPButton 1 "Active" 0 "Inactive" ; VAL_ 384 LKASteeringCmdActive 1 "Active" 0 "Inactive" ; VAL_ 880 ACCLeadCar 1 "Present" 0 "Not Present" ; VAL_ 880 ACCGapLevel 3 "Far" 2 "Med" 1 "Near" 0 "Inactive" ; @@ -237,4 +254,6 @@ VAL_ 388 LKATorqueDeliveredStatus 3 "Failed" 2 "Temp. Limited" 1 "Active" 0 "Ina VAL_ 489 BrakePedalPressed 1 "Pressed" 0 "Depressed" ; VAL_ 715 GasRegenCmdActiveInv 1 "Inactive" 0 "Active" ; VAL_ 715 GasRegenCmdActive 1 "Active" 0 "Inactive" ; - +VAL_ 320 Intellibeam 1 "Active" 0 "Inactive" ; +VAL_ 320 HighBeamsActive 1 "Active" 0 "Inactive" ; +VAL_ 320 HighBeamsTemporary 1 "Active" 0 "Inactive" ; diff --git a/opendbc/honda_accord_lx15t_2018_can_generated.dbc b/opendbc/honda_accord_lx15t_2018_can_generated.dbc new file mode 100644 index 00000000000000..78896384986bdf --- /dev/null +++ b/opendbc/honda_accord_lx15t_2018_can_generated.dbc @@ -0,0 +1,320 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _bosch_2018.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BU_: EBCM EON CAM RADAR PCM EPS VSA SCM BDY XXX EPB + +BO_ 228 STEERING_CONTROL: 5 EON + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS + SG_ STEER_TORQUE : 7|16@0- (1,0) [-4096|4096] "" EPS + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" EPS + +BO_ 232 BRAKE_HOLD: 7 XXX + SG_ XMISSION_SPEED : 7|14@0- (1,0) [1|0] "" XXX + SG_ COMPUTER_BRAKE : 39|16@0+ (1,0) [0|0] "" XXX + SG_ COMPUTER_BRAKE_REQUEST : 29|1@0+ (1,0) [0|0] "" XXX + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" XXX + +BO_ 304 GAS_PEDAL_2: 8 PCM + SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 330 STEERING_SENSORS: 8 EPS + SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON + SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON + SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 344 ENGINE_DATA: 8 PCM + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 380 POWERTRAIN_DATA: 8 PCM + SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON + SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "" EON + SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "" EON + SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "" EON + SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "" EON + SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON + SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + +BO_ 420 VSA_STATUS: 8 VSA + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 450 EPB_STATUS: 8 EPB + SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON + SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 464 WHEEL_SPEEDS: 8 VSA + SG_ WHEEL_SPEED_FL : 7|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_FR : 8|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RL : 25|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RR : 42|15@0+ (0.01,0) [0|250] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 479 ACC_CONTROL: 8 EON + SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM + SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX + SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM + SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX + SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 495 ACC_CONTROL_ON: 8 XXX + SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_30 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH : 23|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH2 : 47|16@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_FF : 15|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_3 : 6|7@0+ (1,0) [0|4095] "" XXX + SG_ CONTROL_ON : 7|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + +BO_ 545 XXX_16: 6 SCM + SG_ ECON_ON : 23|1@0+ (1,0) [0|1] "" XXX + SG_ DRIVE_MODE : 37|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" BDY + +BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA + SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" EON + SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON + SG_ LONG_COUNTER : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + + BO_ 662 SCM_BUTTONS: 4 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 27|4@0+ (1,0) [0|15] "" EON + +BO_ 773 SEATBELT_STATUS: 7 BDY + SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_UNLATCHED : 10|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_LATCHED : 11|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_UNLATCHED : 12|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_OFF : 14|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_ON : 15|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 777 CAR_SPEED: 8 PCM + SG_ ROUGH_CAR_SPEED : 23|8@0+ (1,0) [0|255] "" XXX + SG_ CAR_SPEED : 7|16@0+ (1,0) [0|65535] "" XXX + SG_ ROUGH_CAR_SPEED_3 : 39|16@0+ (1,0) [0|65535] "" XXX + SG_ ROUGH_CAR_SPEED_2 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ LOCK_STATUS : 55|2@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 780 ACC_HUD: 8 ADAS + SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY + SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY + SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY + SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY + SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY + SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY + SG_ ZEROS_BOH : 7|24@0+ (0.002759506,0) [0|100] "m/s" BDY + SG_ FCM_OFF : 35|1@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_1 : 36|1@0+ (1,0) [0|1] "" XXX + SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY + SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY + SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY + SG_ ACC_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BOH_6 : 51|4@0+ (1,0) [0|15] "" XXX + SG_ SET_TO_X3 : 55|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 804 CRUISE: 8 PCM + SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 806 SCM_FEEDBACK: 8 SCM + SG_ DRIVERS_DOOR_OPEN : 17|1@0+ (1,0) [0|1] "" XXX + SG_ MAIN_ON : 28|1@0+ (1,0) [0|1] "" EON + SG_ RIGHT_BLINKER : 27|1@0+ (1,0) [0|1] "" EON + SG_ LEFT_BLINKER : 26|1@0+ (1,0) [0|1] "" EON + SG_ CMBS_STATES : 22|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 829 LKAS_HUD: 5 ADAS + SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY + SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY + SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY + SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY + SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY + SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY + SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY + SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY + SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY + SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY + SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" BDY + +BO_ 862 CAMERA_MESSAGES: 8 CAM + SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY + SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX + SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ ZEROS_BOH_2 : 51|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 884 STALK_STATUS: 8 XXX + SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON + SG_ HEADLIGHTS_ON : 54|1@0+ (1,0) [0|1] "" EON + SG_ WIPER_SWITCH : 53|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 891 STALK_STATUS_2: 8 XXX + SG_ WIPERS : 17|2@0+ (1,0) [0|3] "" EON + SG_ LOW_BEAMS : 35|1@0+ (1,0) [0|1] "" XXX + SG_ HIGH_BEAMS : 34|1@0+ (1,0) [0|1] "" XXX + SG_ PARK_LIGHTS : 36|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; +CM_ "honda_accord_lx15t_2018_can.dbc starts here" + + +BO_ 401 GEARBOX: 8 PCM + SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON + SG_ BOH : 45|6@0+ (1,0) [0|63] "" XXX + SG_ GEAR2 : 31|8@0+ (1,0) [0|1] "" XXX + SG_ GEAR : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH : 47|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + +BO_ 446 BRAKE_MODULE: 3 VSA + SG_ BRAKE_PRESSED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" XXX + +BO_ 927 RADAR_HUD: 8 RADAR + SG_ ZEROS_BOH : 7|10@0+ (1,0) [0|127] "" BDY + SG_ CMBS_OFF : 12|1@0+ (1,0) [0|1] "" BDY + SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_TO_1 : 13|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH2 : 11|4@0+ (1,0) [0|1] "" XXX + SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|1] "" XXX + SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_0 : 22|1@0+ (1,0) [0|1] "" XXX + SG_ LEAD_DISTANCE : 39|8@0+ (1,0) [0|255] "" XXX + SG_ BOH : 40|1@0+ (1,0) [0|1] "" XXX + SG_ BOH_2 : 30|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 1302 ODOMETER: 8 XXX + SG_ ODOMETER : 7|24@0+ (1,0) [0|16777215] "km" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; +VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 545 ECON_ON_2 0 "off" 3 "on" ; +VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; +VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ; +VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; +VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; + +CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/honda_accord_s2t_2018_can_generated.dbc b/opendbc/honda_accord_s2t_2018_can_generated.dbc index 6d83a6b8c5a9e5..43a46aff831d0c 100644 --- a/opendbc/honda_accord_s2t_2018_can_generated.dbc +++ b/opendbc/honda_accord_s2t_2018_can_generated.dbc @@ -68,10 +68,10 @@ BO_ 330 STEERING_SENSORS: 8 EPS SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 344 ENGINE_DATA: 8 PCM - SG_ XMISSION_SPEED : 7|16@0+ (0.002759506,0) [0|70] "m/s" EON + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON - SG_ XMISSION_SPEED2 : 39|16@0+ (0.002759506,0) [0|70] "m/s" EON - SG_ DISTANCE_COUNTER : 55|8@0+ (10,0) [0|2550] "Meters" XXX + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON @@ -264,6 +264,7 @@ BO_ 891 STALK_STATUS_2: 8 XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; CM_ "honda_accord_s2t_2018_can.dbc starts here" diff --git a/opendbc/honda_accord_touring_2016_can.dbc b/opendbc/honda_accord_touring_2016_can.dbc index d26ccd6a13a140..e8f388de08692c 100644 --- a/opendbc/honda_accord_touring_2016_can.dbc +++ b/opendbc/honda_accord_touring_2016_can.dbc @@ -86,10 +86,13 @@ BO_ 401 GEARBOX: 8 PCM SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" NEO BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" NEO - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" NEO - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" NEO - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" NEO + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" NEO diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index bc4933387d7fef..bbf810dd7c4084 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -68,10 +68,10 @@ BO_ 330 STEERING_SENSORS: 8 EPS SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 344 ENGINE_DATA: 8 PCM - SG_ XMISSION_SPEED : 7|16@0+ (0.002759506,0) [0|70] "m/s" EON + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON - SG_ XMISSION_SPEED2 : 39|16@0+ (0.002759506,0) [0|70] "m/s" EON - SG_ DISTANCE_COUNTER : 55|8@0+ (10,0) [0|2550] "Meters" XXX + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON @@ -264,6 +264,7 @@ BO_ 891 STALK_STATUS_2: 8 XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; CM_ "honda_civic_hatchback_ex_2017_can.dbc starts here" diff --git a/opendbc/honda_civic_touring_2016_can_generated.dbc b/opendbc/honda_civic_touring_2016_can_generated.dbc index 605d80d0daea59..7cee7c73dde8db 100644 --- a/opendbc/honda_civic_touring_2016_can_generated.dbc +++ b/opendbc/honda_civic_touring_2016_can_generated.dbc @@ -6,15 +6,15 @@ BO_ 512 GAS_COMMAND: 6 EON SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" INTERCEPTOR - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR BO_ 513 GAS_SENSOR: 6 INTERCEPTOR SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON - SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; @@ -59,9 +59,9 @@ BO_ 344 ENGINE_DATA: 8 PCM SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON @@ -76,6 +76,15 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + BO_ 432 STANDSTILL: 7 VSA SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON @@ -273,14 +282,6 @@ BO_ 401 GEARBOX: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON - SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - BO_ 450 EPB_STATUS: 8 EPB SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON @@ -355,10 +356,10 @@ BO_ 1302 ODOMETER: 8 XXX CM_ SG_ 401 GEAR "10 = reverse, 11 = transition"; CM_ SG_ 420 BRAKE_HOLD_RELATED "On when Brake Hold engaged"; -CM_ SG_ 450 EPB_STATE "3 "engaged" 2 "disengaging" 1 "engaging" 0 "disengaged""; +CM_ SG_ 450 EPB_STATE "3 \"engaged\" 2 \"disengaging\" 1 \"engaging\" 0 \"disengaged\""; CM_ SG_ 806 REVERSE_LIGHT "Might be reverse gear selected and not the lights"; -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 450 EPB_STATE 3 "engaged" 2 "disengaging" 1 "engaging" 0 "disengaged" ; diff --git a/opendbc/honda_crv_ex_2017_can_generated.dbc b/opendbc/honda_crv_ex_2017_can_generated.dbc index edcdf64d512d50..56a6b4e1b1c872 100644 --- a/opendbc/honda_crv_ex_2017_can_generated.dbc +++ b/opendbc/honda_crv_ex_2017_can_generated.dbc @@ -68,10 +68,10 @@ BO_ 330 STEERING_SENSORS: 8 EPS SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 344 ENGINE_DATA: 8 PCM - SG_ XMISSION_SPEED : 7|16@0+ (0.002759506,0) [0|70] "m/s" EON + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON - SG_ XMISSION_SPEED2 : 39|16@0+ (0.002759506,0) [0|70] "m/s" EON - SG_ DISTANCE_COUNTER : 55|8@0+ (10,0) [0|2550] "Meters" XXX + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON @@ -264,6 +264,7 @@ BO_ 891 STALK_STATUS_2: 8 XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; CM_ "honda_crv_ex_2017_can.dbc starts here" diff --git a/opendbc/honda_crv_hybrid_2019_can_generated.dbc b/opendbc/honda_crv_hybrid_2019_can_generated.dbc new file mode 100644 index 00000000000000..73e5a431c18acf --- /dev/null +++ b/opendbc/honda_crv_hybrid_2019_can_generated.dbc @@ -0,0 +1,316 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _bosch_2018.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BU_: EBCM EON CAM RADAR PCM EPS VSA SCM BDY XXX EPB + +BO_ 228 STEERING_CONTROL: 5 EON + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS + SG_ STEER_TORQUE : 7|16@0- (1,0) [-4096|4096] "" EPS + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" EPS + +BO_ 232 BRAKE_HOLD: 7 XXX + SG_ XMISSION_SPEED : 7|14@0- (1,0) [1|0] "" XXX + SG_ COMPUTER_BRAKE : 39|16@0+ (1,0) [0|0] "" XXX + SG_ COMPUTER_BRAKE_REQUEST : 29|1@0+ (1,0) [0|0] "" XXX + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" XXX + +BO_ 304 GAS_PEDAL_2: 8 PCM + SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 330 STEERING_SENSORS: 8 EPS + SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON + SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON + SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 344 ENGINE_DATA: 8 PCM + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 380 POWERTRAIN_DATA: 8 PCM + SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON + SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "" EON + SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "" EON + SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "" EON + SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "" EON + SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON + SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + +BO_ 420 VSA_STATUS: 8 VSA + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 450 EPB_STATUS: 8 EPB + SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON + SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 464 WHEEL_SPEEDS: 8 VSA + SG_ WHEEL_SPEED_FL : 7|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_FR : 8|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RL : 25|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RR : 42|15@0+ (0.01,0) [0|250] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 479 ACC_CONTROL: 8 EON + SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM + SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX + SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM + SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX + SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 495 ACC_CONTROL_ON: 8 XXX + SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_30 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH : 23|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH2 : 47|16@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_FF : 15|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_3 : 6|7@0+ (1,0) [0|4095] "" XXX + SG_ CONTROL_ON : 7|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + +BO_ 545 XXX_16: 6 SCM + SG_ ECON_ON : 23|1@0+ (1,0) [0|1] "" XXX + SG_ DRIVE_MODE : 37|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" BDY + +BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA + SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" EON + SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON + SG_ LONG_COUNTER : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + + BO_ 662 SCM_BUTTONS: 4 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 27|4@0+ (1,0) [0|15] "" EON + +BO_ 773 SEATBELT_STATUS: 7 BDY + SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_UNLATCHED : 10|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_LATCHED : 11|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_UNLATCHED : 12|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_OFF : 14|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_ON : 15|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 777 CAR_SPEED: 8 PCM + SG_ ROUGH_CAR_SPEED : 23|8@0+ (1,0) [0|255] "" XXX + SG_ CAR_SPEED : 7|16@0+ (1,0) [0|65535] "" XXX + SG_ ROUGH_CAR_SPEED_3 : 39|16@0+ (1,0) [0|65535] "" XXX + SG_ ROUGH_CAR_SPEED_2 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ LOCK_STATUS : 55|2@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 780 ACC_HUD: 8 ADAS + SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY + SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY + SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY + SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY + SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY + SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY + SG_ ZEROS_BOH : 7|24@0+ (0.002759506,0) [0|100] "m/s" BDY + SG_ FCM_OFF : 35|1@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_1 : 36|1@0+ (1,0) [0|1] "" XXX + SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY + SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY + SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY + SG_ ACC_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BOH_6 : 51|4@0+ (1,0) [0|15] "" XXX + SG_ SET_TO_X3 : 55|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 804 CRUISE: 8 PCM + SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 806 SCM_FEEDBACK: 8 SCM + SG_ DRIVERS_DOOR_OPEN : 17|1@0+ (1,0) [0|1] "" XXX + SG_ MAIN_ON : 28|1@0+ (1,0) [0|1] "" EON + SG_ RIGHT_BLINKER : 27|1@0+ (1,0) [0|1] "" EON + SG_ LEFT_BLINKER : 26|1@0+ (1,0) [0|1] "" EON + SG_ CMBS_STATES : 22|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 829 LKAS_HUD: 5 ADAS + SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY + SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY + SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY + SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY + SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY + SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY + SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY + SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY + SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY + SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY + SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" BDY + +BO_ 862 CAMERA_MESSAGES: 8 CAM + SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY + SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX + SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ ZEROS_BOH_2 : 51|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 884 STALK_STATUS: 8 XXX + SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON + SG_ HEADLIGHTS_ON : 54|1@0+ (1,0) [0|1] "" EON + SG_ WIPER_SWITCH : 53|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 891 STALK_STATUS_2: 8 XXX + SG_ WIPERS : 17|2@0+ (1,0) [0|3] "" EON + SG_ LOW_BEAMS : 35|1@0+ (1,0) [0|1] "" XXX + SG_ HIGH_BEAMS : 34|1@0+ (1,0) [0|1] "" XXX + SG_ PARK_LIGHTS : 36|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; +CM_ "honda_crv_hybrid_2019_can.dbc starts here" + + +BO_ 419 GEARBOX: 8 PCM + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON + SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + +BO_ 927 RADAR_HUD: 8 RADAR + SG_ ZEROS_BOH : 7|10@0+ (1,0) [0|127] "" BDY + SG_ CMBS_OFF : 12|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH3 : 31|32@0+ (1,0) [0|4294967295] "" XXX + SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_TO_1 : 13|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH2 : 11|4@0+ (1,0) [0|1] "" XXX + SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|1] "" XXX + SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_0 : 22|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 1302 ODOMETER: 8 XXX + SG_ ODOMETER : 7|24@0+ (1,0) [0|16777215] "km" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +CM_ SG_ 344 DISTANCE_COUNTER ""; +CM_ SG_ 450 EPB_STATE "3: On, 2: Disengaging, 1: Engaging, 0: Off"; +CM_ SG_ 479 CONTROL_ON "Set to 5 when car is being controlled"; +CM_ SG_ 479 RELATED_TO_GAS "bits 7, 3, and 1 set to 1 when gas not applied"; +CM_ SG_ 479 GAS_BRAKE "Signed value, negative when braking and positive when applying gas"; + +VAL_ 419 GEAR_SHIFTER 32 "D" 8 "R" 4 "P" ; +VAL_ 545 ECON_ON_2 0 "off" 3 "on" ; +VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; +VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ; +VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; +VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; + +CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/honda_crv_touring_2016_can_generated.dbc b/opendbc/honda_crv_touring_2016_can_generated.dbc index 57ae6ae5fcea6e..aaee239b909155 100644 --- a/opendbc/honda_crv_touring_2016_can_generated.dbc +++ b/opendbc/honda_crv_touring_2016_can_generated.dbc @@ -6,15 +6,15 @@ BO_ 512 GAS_COMMAND: 6 EON SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" INTERCEPTOR - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR BO_ 513 GAS_SENSOR: 6 INTERCEPTOR SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON - SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; @@ -59,9 +59,9 @@ BO_ 344 ENGINE_DATA: 8 PCM SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON @@ -76,6 +76,15 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + BO_ 432 STANDSTILL: 7 VSA SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON @@ -258,12 +267,6 @@ BO_ 404 STEERING_CONTROL: 4 EON SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EPS SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EPS -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -293,7 +296,7 @@ BO_ 891 WIPERS: 8 XXX CM_ SG_ 401 GEAR "10 = reverse, 11 = transition"; -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; diff --git a/opendbc/honda_fit_ex_2018_can_generated.dbc b/opendbc/honda_fit_ex_2018_can_generated.dbc new file mode 100644 index 00000000000000..62be687b19953d --- /dev/null +++ b/opendbc/honda_fit_ex_2018_can_generated.dbc @@ -0,0 +1,327 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _comma.dbc starts here" +BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + +BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + +VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + + +CM_ "Imported file _honda_2017.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BU_: EBCM ADAS PCM EPS VSA SCM BDY XXX EPB EON + +BO_ 344 ENGINE_DATA: 8 PCM + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 380 POWERTRAIN_DATA: 8 PCM + SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON + SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "rpm" EON + SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "rpm" EON + SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "rpm" EON + SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "rpm" EON + SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON + SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "rpm" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON + SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 464 WHEEL_SPEEDS: 8 VSA + SG_ WHEEL_SPEED_FL : 7|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_FR : 8|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RL : 25|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RR : 42|15@0+ (0.01,0) [0|250] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 490 VEHICLE_DYNAMICS: 8 VSA + SG_ LONG_ACCEL : 23|16@0- (0.0015384,0) [-20|20] "m/s2" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 506 BRAKE_COMMAND: 8 ADAS + SG_ COMPUTER_BRAKE : 7|10@0+ (1,0) [0|1] "" EBCM + SG_ ZEROS_BOH : 13|5@0+ (1,0) [0|1] "" EBCM + SG_ BRAKE_PUMP_REQUEST : 8|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_BOH2 : 23|3@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_OVERRIDE : 20|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_BOH3 : 19|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_FAULT_CMD : 18|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_CANCEL_CMD : 17|1@0+ (1,0) [0|1] "" EBCM + SG_ COMPUTER_BRAKE_REQUEST : 16|1@0+ (1,0) [0|1] "" EBCM + SG_ SET_ME_0X80 : 31|8@0+ (1,0) [0|1] "" EBCM + SG_ BRAKE_LIGHTS : 39|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_STATES : 38|7@0+ (1,0) [0|1] "" EBCM + SG_ CHIME : 47|3@0+ (1,0) [0|7] "" EBCM + SG_ ZEROS_BOH6 : 44|1@0+ (1,0) [0|1] "" EBCM + SG_ FCW : 43|2@0+ (1,0) [0|3] "" EBCM + SG_ ZEROS_BOH4 : 55|8@0+ (1,0) [0|0] "" EBCM + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EBCM + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EBCM + +BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA + SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" EON + SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" EON + SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 773 SEATBELT_STATUS: 7 BDY + SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_UNLATCHED : 10|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_LATCHED : 11|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_UNLATCHED : 12|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_OFF : 14|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_ON : 15|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 777 LOCK_STATUS: 8 XXX + SG_ DOORS_UNLOCKED : 54|1@0+ (1,0) [0|1] "" EON + SG_ DOORS_LOCKED : 55|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 780 ACC_HUD: 8 ADAS + SG_ PCM_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" BDY + SG_ PCM_GAS : 23|8@0+ (1,0) [0|127] "" BDY + SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY + SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY + SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_OFF : 36|1@0+ (1,0) [0|1] "" BDY + SG_ BOH_2 : 35|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY + SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY + SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X03 : 47|2@0+ (1,0) [0|3] "" BDY + SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY + SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY + SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY + SG_ HUD_DISTANCE_3 : 52|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X03_2 : 55|2@0+ (1,0) [0|3] "" BDY + SG_ SET_ME_X01 : 48|1@0+ (1,0) [0|1] "" BDY + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY + +BO_ 804 CRUISE: 8 PCM + SG_ HUD_SPEED_KPH : 7|8@0+ (1,0) [0|255] "kph" EON + SG_ HUD_SPEED_MPH : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" EON + SG_ CRUISE_SPEED_PCM : 39|8@0+ (1,0) [0|255] "" EON + SG_ BOH2 : 47|8@0- (1,0) [0|255] "" EON + SG_ BOH3 : 55|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 829 LKAS_HUD: 5 ADAS + SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY + SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY + SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY + SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY + SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY + SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY + SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY + SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY + SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY + SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY + SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" BDY + +BO_ 892 CRUISE_PARAMS: 8 PCM + SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 1029 DOORS_STATUS: 8 BDY + SG_ DOOR_OPEN_FL : 37|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_FR : 38|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RL : 39|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RR : 40|1@0+ (1,0) [0|1] "" EON + SG_ TRUNK_OPEN : 41|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +CM_ SG_ 490 LONG_ACCEL "wheel speed derivative, noisy and zero snapping"; +CM_ SG_ 773 PASS_AIRBAG_ON "Might just be indicator light"; +CM_ SG_ 773 PASS_AIRBAG_OFF "Might just be indicator light"; +CM_ SG_ 780 CRUISE_SPEED "255 = no speed"; +CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed"; +CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc..."; + + +VAL_ 506 FCW 3 "fcw" 2 "fcw" 1 "fcw" 0 "no_fcw" ; +VAL_ 506 CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime" ; +VAL_ 780 CRUISE_SPEED 255 "no_speed" 252 "stopped" ; +VAL_ 780 HUD_LEAD 3 "acc_off" 2 "solid_car" 1 "dashed_car" 0 "no_car" ; +VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; + +CM_ "honda_fit_ex_2018_can.dbc starts here" + + + +BO_ 145 KINEMATICS: 8 XXX + SG_ LAT_ACCEL : 7|10@0+ (0.02,-512) [-20|20] "m/s2" EON + +BO_ 228 STEERING_CONTROL: 5 ADAS + SG_ STEER_TORQUE : 7|16@0- (1,0) [-3840|3840] "" EPS + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" EPS + +BO_ 304 GAS_PEDAL_2: 8 PCM + SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 342 STEERING_SENSORS: 6 EPS + SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 401 GEARBOX: 8 PCM + SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON + SG_ GEAR : 43|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 422 SCM_BUTTONS: 8 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON + SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON + SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 487 BRAKE_PRESSURE: 4 VSA + SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" EON + SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" EON + SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON + +BO_ 660 SCM_FEEDBACK: 8 SCM + SG_ RIGHT_BLINKER : 6|1@0+ (1,0) [0|1] "" EON + SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON + SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 862 HIGHBEAM_CONTROL: 8 ADAS + SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY + SG_ ZEROS_BOH_2 : 48|4@1+ (1,0) [0|15] "" XXX + SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 884 STALK_STATUS: 8 XXX + SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON + SG_ HEADLIGHTS_ON : 54|1@0+ (1,0) [0|1] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +CM_ SG_ 401 GEAR "10 = reverse, 11 = transition"; +CM_ SG_ 420 BRAKE_HOLD_RELATED "On when Brake Hold engaged"; + +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; +VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; +VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; + +CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/honda_insight_ex_2019_can_generated.dbc b/opendbc/honda_insight_ex_2019_can_generated.dbc new file mode 100644 index 00000000000000..f2874fa45b86ce --- /dev/null +++ b/opendbc/honda_insight_ex_2019_can_generated.dbc @@ -0,0 +1,312 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _bosch_2018.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BU_: EBCM EON CAM RADAR PCM EPS VSA SCM BDY XXX EPB + +BO_ 228 STEERING_CONTROL: 5 EON + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS + SG_ STEER_TORQUE : 7|16@0- (1,0) [-4096|4096] "" EPS + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" EPS + +BO_ 232 BRAKE_HOLD: 7 XXX + SG_ XMISSION_SPEED : 7|14@0- (1,0) [1|0] "" XXX + SG_ COMPUTER_BRAKE : 39|16@0+ (1,0) [0|0] "" XXX + SG_ COMPUTER_BRAKE_REQUEST : 29|1@0+ (1,0) [0|0] "" XXX + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" XXX + +BO_ 304 GAS_PEDAL_2: 8 PCM + SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 330 STEERING_SENSORS: 8 EPS + SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON + SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON + SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 344 ENGINE_DATA: 8 PCM + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 380 POWERTRAIN_DATA: 8 PCM + SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON + SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "" EON + SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "" EON + SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "" EON + SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "" EON + SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON + SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + +BO_ 420 VSA_STATUS: 8 VSA + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 450 EPB_STATUS: 8 EPB + SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON + SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 464 WHEEL_SPEEDS: 8 VSA + SG_ WHEEL_SPEED_FL : 7|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_FR : 8|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RL : 25|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RR : 42|15@0+ (0.01,0) [0|250] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 479 ACC_CONTROL: 8 EON + SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM + SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX + SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM + SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX + SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 495 ACC_CONTROL_ON: 8 XXX + SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_30 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH : 23|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH2 : 47|16@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_FF : 15|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_3 : 6|7@0+ (1,0) [0|4095] "" XXX + SG_ CONTROL_ON : 7|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + +BO_ 545 XXX_16: 6 SCM + SG_ ECON_ON : 23|1@0+ (1,0) [0|1] "" XXX + SG_ DRIVE_MODE : 37|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" BDY + +BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA + SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" EON + SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON + SG_ LONG_COUNTER : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + + BO_ 662 SCM_BUTTONS: 4 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 27|4@0+ (1,0) [0|15] "" EON + +BO_ 773 SEATBELT_STATUS: 7 BDY + SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_UNLATCHED : 10|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_LATCHED : 11|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_UNLATCHED : 12|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_OFF : 14|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_ON : 15|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 777 CAR_SPEED: 8 PCM + SG_ ROUGH_CAR_SPEED : 23|8@0+ (1,0) [0|255] "" XXX + SG_ CAR_SPEED : 7|16@0+ (1,0) [0|65535] "" XXX + SG_ ROUGH_CAR_SPEED_3 : 39|16@0+ (1,0) [0|65535] "" XXX + SG_ ROUGH_CAR_SPEED_2 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ LOCK_STATUS : 55|2@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 780 ACC_HUD: 8 ADAS + SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY + SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY + SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY + SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY + SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY + SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY + SG_ ZEROS_BOH : 7|24@0+ (0.002759506,0) [0|100] "m/s" BDY + SG_ FCM_OFF : 35|1@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_1 : 36|1@0+ (1,0) [0|1] "" XXX + SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY + SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY + SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY + SG_ ACC_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BOH_6 : 51|4@0+ (1,0) [0|15] "" XXX + SG_ SET_TO_X3 : 55|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 804 CRUISE: 8 PCM + SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 806 SCM_FEEDBACK: 8 SCM + SG_ DRIVERS_DOOR_OPEN : 17|1@0+ (1,0) [0|1] "" XXX + SG_ MAIN_ON : 28|1@0+ (1,0) [0|1] "" EON + SG_ RIGHT_BLINKER : 27|1@0+ (1,0) [0|1] "" EON + SG_ LEFT_BLINKER : 26|1@0+ (1,0) [0|1] "" EON + SG_ CMBS_STATES : 22|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 829 LKAS_HUD: 5 ADAS + SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY + SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY + SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY + SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY + SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY + SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY + SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY + SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY + SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY + SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY + SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" BDY + +BO_ 862 CAMERA_MESSAGES: 8 CAM + SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY + SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX + SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ ZEROS_BOH_2 : 51|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 884 STALK_STATUS: 8 XXX + SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON + SG_ HEADLIGHTS_ON : 54|1@0+ (1,0) [0|1] "" EON + SG_ WIPER_SWITCH : 53|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 891 STALK_STATUS_2: 8 XXX + SG_ WIPERS : 17|2@0+ (1,0) [0|3] "" EON + SG_ LOW_BEAMS : 35|1@0+ (1,0) [0|1] "" XXX + SG_ HIGH_BEAMS : 34|1@0+ (1,0) [0|1] "" XXX + SG_ PARK_LIGHTS : 36|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; +CM_ "honda_insight_ex_2019_can.dbc starts here" + + +BO_ 419 GEARBOX: 8 PCM + SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON + SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ BRAKE_ERROR_1 : 13|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 12|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + +BO_ 927 RADAR_HUD: 8 RADAR + SG_ ZEROS_BOH : 7|10@0+ (1,0) [0|127] "" BDY + SG_ CMBS_OFF : 12|1@0+ (1,0) [0|1] "" BDY + SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_TO_1 : 13|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH2 : 11|4@0+ (1,0) [0|1] "" XXX + SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|1] "" XXX + SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_0 : 22|1@0+ (1,0) [0|1] "" XXX + SG_ HUD_LEAD : 40|1@0+ (1,0) [0|1] "" XXX + SG_ SET_TO_64 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ LEAD_DISTANCE : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH3 : 47|7@0+ (1,0) [0|127] "" XXX + SG_ ZEROS_BOH4 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 1029 DOORS_STATUS: 8 BDY + SG_ DOOR_OPEN_FL : 37|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_FR : 38|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RL : 39|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RR : 40|1@0+ (1,0) [0|1] "" EON + SG_ TRUNK_OPEN : 41|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + + VAL_ 419 GEAR 10 "R" 1 "D" 0 "P"; + VAL_ 419 GEAR_SHIFTER 32 "D" 16 "N" 8 "R" 4 "P" ; + +CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/honda_odyssey_exl_2018_generated.dbc b/opendbc/honda_odyssey_exl_2018_generated.dbc index ddabe780da8d0e..6f00df2d45de6c 100644 --- a/opendbc/honda_odyssey_exl_2018_generated.dbc +++ b/opendbc/honda_odyssey_exl_2018_generated.dbc @@ -6,15 +6,15 @@ BO_ 512 GAS_COMMAND: 6 EON SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" INTERCEPTOR - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR BO_ 513 GAS_SENSOR: 6 INTERCEPTOR SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON - SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; @@ -59,9 +59,9 @@ BO_ 344 ENGINE_DATA: 8 PCM SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON @@ -76,6 +76,15 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + BO_ 432 STANDSTILL: 7 VSA SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON @@ -260,15 +269,6 @@ BO_ 419 GEARBOX: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" XXX - SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" XXX - SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX - BO_ 450 EPB_STATUS: 8 XXX SG_ EPB_BRAKE_AND_PULL : 6|1@0+ (1,0) [0|1] "" XXX SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" XXX @@ -329,7 +329,7 @@ CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed"; CM_ SG_ 806 REVERSE_LIGHT "Might be reverse gear selected and not the lights"; CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnings etc..."; -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 419 GEAR_SHIFTER 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 450 EPB_STATE 3 "engaged" 2 "disengaging" 1 "engaging" 0 "disengaged" ; VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; @@ -339,7 +339,5 @@ VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ; VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ; -VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; -VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ; CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/honda_odyssey_extreme_edition_2018_china_can.dbc b/opendbc/honda_odyssey_extreme_edition_2018_china_can.dbc new file mode 100644 index 00000000000000..91859aa2493749 --- /dev/null +++ b/opendbc/honda_odyssey_extreme_edition_2018_china_can.dbc @@ -0,0 +1,298 @@ +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: EBCM ADAS PCM EPS VSA SCM BDY XXX EPB EON INTERCEPTOR + + +BO_ 344 ENGINE_DATA: 8 PCM + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + SG_ ZEROS : 23|16@0+ (1,0) [0|15000] "" EON + +BO_ 380 POWERTRAIN_DATA: 8 PCM + SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON + SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "rpm" EON + SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "rpm" EON + SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "rpm" EON + SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "rpm" EON + SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON + SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "rpm" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON + SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 464 WHEEL_SPEEDS: 8 VSA + SG_ WHEEL_SPEED_FL : 7|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_FR : 8|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RL : 25|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RR : 42|15@0+ (0.01,0) [0|250] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 490 VEHICLE_DYNAMICS: 8 VSA + SG_ LONG_ACCEL : 23|16@0- (0.0015384,0) [-20|20] "m/s2" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 506 BRAKE_COMMAND: 8 ADAS + SG_ COMPUTER_BRAKE : 7|10@0+ (1,0) [0|1] "" EBCM + SG_ ZEROS_BOH : 13|5@0+ (1,0) [0|1] "" EBCM + SG_ BRAKE_PUMP_REQUEST : 8|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_BOH2 : 23|3@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_OVERRIDE : 20|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_BOH3 : 19|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_FAULT_CMD : 18|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_CANCEL_CMD : 17|1@0+ (1,0) [0|1] "" EBCM + SG_ COMPUTER_BRAKE_REQUEST : 16|1@0+ (1,0) [0|1] "" EBCM + SG_ SET_ME_0X80 : 31|8@0+ (1,0) [0|1] "" EBCM + SG_ BRAKE_LIGHTS : 39|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_STATES : 38|7@0+ (1,0) [0|1] "" EBCM + SG_ CHIME : 47|3@0+ (1,0) [0|7] "" EBCM + SG_ ZEROS_BOH6 : 44|1@0+ (1,0) [0|1] "" EBCM + SG_ FCW : 43|2@0+ (1,0) [0|3] "" EBCM + SG_ ZEROS_BOH4 : 55|8@0+ (1,0) [0|0] "" EBCM + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EBCM + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EBCM + +BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" INTERCEPTOR + +BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON + SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + +BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA + SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" EON + SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" EON + SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 773 SEATBELT_STATUS: 7 BDY + SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_UNLATCHED : 10|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_LATCHED : 11|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_UNLATCHED : 12|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_OFF : 14|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_ON : 15|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 777 LOCK_STATUS: 8 XXX + SG_ DOORS_UNLOCKED : 54|1@0+ (1,0) [0|1] "" EON + SG_ DOORS_LOCKED : 55|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 780 ACC_HUD: 8 ADAS + SG_ PCM_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" BDY + SG_ PCM_GAS : 23|8@0+ (1,0) [0|127] "" BDY + SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY + SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY + SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_OFF : 36|1@0+ (1,0) [0|1] "" BDY + SG_ BOH_2 : 35|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY + SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY + SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X03 : 47|2@0+ (1,0) [0|3] "" BDY + SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY + SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY + SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY + SG_ HUD_DISTANCE_3 : 52|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X03_2 : 55|2@0+ (1,0) [0|3] "" BDY + SG_ SET_ME_X01 : 48|1@0+ (1,0) [0|1] "" BDY + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY + +BO_ 804 CRUISE: 8 PCM + SG_ HUD_SPEED_KPH : 7|8@0+ (1,0) [0|255] "kph" EON + SG_ HUD_SPEED_MPH : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" EON + SG_ CRUISE_SPEED_PCM : 39|8@0+ (1,0) [0|255] "" EON + SG_ BOH2 : 47|8@0- (1,0) [0|255] "" EON + SG_ BOH3 : 55|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 829 LKAS_HUD: 5 ADAS + SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY + SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY + SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY + SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY + SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY + SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY + SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY + SG_ BOH2 : 23|2@0+ (1,0) [0|4] "" BDY + SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY + SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY + SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY + SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" BDY + +BO_ 892 CRUISE_PARAMS: 8 PCM + SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 316 GAS_PEDAL: 8 PCM + SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" EON + +BO_ 342 STEERING_SENSORS: 6 EPS + SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON + SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-2985|2985] "tbd" EON + SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ STEER_STATUS : 43|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON + +BO_ 401 GEARBOX: 8 PCM + SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON + SG_ GEAR : 35|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 404 STEERING_CONTROL: 4 EON + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EPS + SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EPS + SG_ STEER_TORQUE : 7|16@0- (-1,0) [-32767|32767] "" EPS + +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 422 SCM_BUTTONS: 8 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON + SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON + SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON + SG_ DRIVERS_DOOR_OPEN : 63|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 450 EPB_STATUS: 8 XXX + SG_ EPB_BRAKE_AND_PULL : 6|1@0+ (1,0) [0|1] "" XXX + SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" XXX + SG_ EPB_STATE : 29|2@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + +BO_ 660 SCM_FEEDBACK: 8 SCM + SG_ RIGHT_BLINKER : 6|1@0+ (1,0) [0|1] "" EON + SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON + SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 862 HIGHBEAM_CONTROL: 8 ADAS + SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY + SG_ ZEROS_BOH_2 : 48|4@1+ (1,0) [0|15] "" XXX + SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 1302 ODOMETER: 8 XXX + SG_ ODOMETER : 7|24@0+ (1,0) [0|16777215] "km" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + + + + +CM_ SG_ 490 LONG_ACCEL "wheel speed derivative, noisy and zero snapping"; +CM_ SG_ 773 PASS_AIRBAG_OFF "Might just be indicator light"; +CM_ SG_ 773 PASS_AIRBAG_ON "Might just be indicator light"; +CM_ SG_ 780 CRUISE_SPEED "255 = no speed"; +CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed"; +CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc..."; +CM_ SG_ 401 GEAR "10 = reverse, 11 = transition"; +VAL_ 506 CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime" ; +VAL_ 506 FCW 3 "fcw" 2 "fcw" 1 "fcw" 0 "no_fcw" ; +VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; +VAL_ 780 CRUISE_SPEED 255 "no_speed" 252 "stopped" ; +VAL_ 780 HUD_LEAD 3 "acc_off" 2 "solid_car" 1 "dashed_car" 0 "no_car" ; +VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; +VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; +VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; +VAL_ 422 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; +CM_ "CHFFR_METRIC 342 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/opendbc/honda_pilot_touring_2017_can_generated.dbc b/opendbc/honda_pilot_touring_2017_can_generated.dbc index 51cd751c214d76..310de029bee0a0 100644 --- a/opendbc/honda_pilot_touring_2017_can_generated.dbc +++ b/opendbc/honda_pilot_touring_2017_can_generated.dbc @@ -6,15 +6,15 @@ BO_ 512 GAS_COMMAND: 6 EON SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" INTERCEPTOR - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR BO_ 513 GAS_SENSOR: 6 INTERCEPTOR SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON - SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; @@ -59,9 +59,9 @@ BO_ 344 ENGINE_DATA: 8 PCM SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON @@ -76,6 +76,15 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + BO_ 432 STANDSTILL: 7 VSA SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON @@ -268,12 +277,6 @@ BO_ 419 GEARBOX: 8 PCM SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -287,7 +290,7 @@ BO_ 660 SCM_FEEDBACK: 8 SCM SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 419 GEAR_SHIFTER 32 "D" 8 "R" 4 "P" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; diff --git a/opendbc/honda_ridgeline_black_edition_2017_can_generated.dbc b/opendbc/honda_ridgeline_black_edition_2017_can_generated.dbc index 40ff41e9c0aa24..04e1c78a262b46 100644 --- a/opendbc/honda_ridgeline_black_edition_2017_can_generated.dbc +++ b/opendbc/honda_ridgeline_black_edition_2017_can_generated.dbc @@ -6,15 +6,15 @@ BO_ 512 GAS_COMMAND: 6 EON SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR SG_ GAS_COMMAND2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" INTERCEPTOR SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" INTERCEPTOR - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR BO_ 513 GAS_SENSOR: 6 INTERCEPTOR SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON - SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; @@ -59,9 +59,9 @@ BO_ 344 ENGINE_DATA: 8 PCM SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON @@ -76,6 +76,15 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_RELATED : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + BO_ 432 STANDSTILL: 7 VSA SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON @@ -263,12 +272,6 @@ BO_ 419 GEARBOX: 8 PCM SG_ GEAR_SHIFTER : 29|6@0+ (1,0) [0|63] "" EON SG_ GEAR : 7|8@0+ (1,0) [0|255] "" EON -BO_ 420 VSA_STATUS: 8 VSA - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - BO_ 422 SCM_BUTTONS: 8 SCM SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON @@ -282,7 +285,7 @@ BO_ 660 SCM_FEEDBACK: 8 SCM SG_ LEFT_BLINKER : 5|1@0+ (1,0) [0|1] "" EON SG_ WIPERS_SPEED : 4|2@0+ (1,0) [0|3] "" EON -VAL_ 399 STEER_STATUS 5 "fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 399 STEER_STATUS 6 "tmp_fault" 5 "fault_1" 4 "no_torque_alert_2" 3 "low_speed_lockout" 2 "no_torque_alert_1" 0 "normal" ; VAL_ 419 GEAR_SHIFTER 32 "D" 8 "R" 4 "P" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; VAL_ 422 LIGHTS_SETTING 3 "high_beam" 2 "low_beam" 1 "position" 0 "no_lights" ; diff --git a/opendbc/hyundai_2015_ccan.dbc b/opendbc/hyundai_2015_ccan.dbc index 920edcabe2817e..addc0cac31fa08 100644 --- a/opendbc/hyundai_2015_ccan.dbc +++ b/opendbc/hyundai_2015_ccan.dbc @@ -149,7 +149,7 @@ BO_ 1456 CLU12: 4 CLU SG_ CF_Clu_Odometer : 0|24@1+ (0.1,0.0) [0.0|1677721.4] "km" _4WD,AAF,BCM,CUBIS,EMS,EPB,IBOX,LDWS_LKAS,SCC,TPMS BO_ 688 SAS11: 5 MDPS - SG_ SAS_Angle : 0|16@1+ (0.1,0.0) [-3276.8|3276.7] "Deg" _4WD,ACU,AFLS,AVM,CLU,ECS,EMS,ESC,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SPAS,TCU,_4WD,ACU,AFLS,AVM,BCM,CLU,ECS,EMS,ESC,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SPAS,TCU + SG_ SAS_Angle : 0|16@1- (0.1,0.0) [-3276.8|3276.7] "Deg" _4WD,ACU,AFLS,AVM,CLU,ECS,EMS,ESC,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SPAS,TCU,_4WD,ACU,AFLS,AVM,BCM,CLU,ECS,EMS,ESC,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SPAS,TCU SG_ SAS_Speed : 16|8@1+ (4.0,0.0) [0.0|1016.0] "" AFLS,ECS,ESC,IBOX,LDWS_LKAS,SCC,SPAS,TCU,AFLS,ECS,ESC,IBOX,LDWS_LKAS,SCC,SPAS,TCU SG_ SAS_Stat : 24|8@1+ (1.0,0.0) [0.0|255.0] "" ECS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS,TCU,ECS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS,TCU SG_ MsgCount : 32|4@1+ (1.0,0.0) [0.0|15.0] "" ECS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS,ECS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS diff --git a/opendbc/hyundai_kia_generic.dbc b/opendbc/hyundai_kia_generic.dbc new file mode 100644 index 00000000000000..e3e6a1eb6118cb --- /dev/null +++ b/opendbc/hyundai_kia_generic.dbc @@ -0,0 +1,1423 @@ +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: IAP ODS _4WD BCM HUD DATC MDPS AAF_Tester AEMC SMK _4WD EPB CUBIS MTS TMU EVP CGW TPMS LPI DI_BOX SPAS EMS LCA TCU IBOX FATC AFLS FPCM SCC AHLS AVM ABS SNV OPI PGS SAS AAF Dummy LDWS_LKAS LVR ESC PSB CLU ECS ACU REA + +BO_ 1532 ODS13: 5 ODS + SG_ CR_Ods_ID : 0|8@1+ (1.0,0.0) [0.0|255.0] "" ACU + SG_ CR_Ods_Chksum_H : 8|8@1+ (1.0,0.0) [0.0|255.0] "" Dummy + SG_ CR_Ods_Chksum_L : 16|8@1+ (1.0,0.0) [0.0|255.0] "" Dummy + SG_ CR_Ods_RomID_H : 24|8@1+ (1.0,0.0) [0.0|255.0] "" Dummy + SG_ CR_Ods_RomID_L : 32|8@1+ (1.0,0.0) [0.0|255.0] "" Dummy + +BO_ 1531 ODS12: 8 ODS + SG_ CR_Ods_SerNum0 : 0|8@1+ (1.0,0.0) [0.0|255.0] "" ACU + SG_ CR_Ods_SerNum1 : 8|8@1+ (1.0,0.0) [0.0|255.0] "" ACU + SG_ CR_Ods_SerNum2 : 16|8@1+ (1.0,0.0) [0.0|255.0] "" ACU + SG_ CR_Ods_SerNum3 : 24|8@1+ (1.0,0.0) [0.0|255.0] "" ACU + SG_ CR_Ods_SerNum4 : 32|8@1+ (1.0,0.0) [0.0|255.0] "" ACU + SG_ CR_Ods_SerNum5 : 40|8@1+ (1.0,0.0) [0.0|255.0] "" ACU + SG_ CR_Ods_SerNum6 : 48|8@1+ (1.0,0.0) [0.0|255.0] "" ACU + SG_ CR_Ods_SerNum7 : 56|8@1+ (1.0,0.0) [0.0|255.0] "" ACU + +BO_ 1530 ODS11: 8 ODS + SG_ CF_Ods_PrcCmd : 1|1@1+ (1.0,0.0) [0.0|1.0] "" Dummy + SG_ CF_Ods_BtsFail : 3|1@1+ (1.0,0.0) [0.0|1.0] "" Dummy + SG_ CF_Ods_AcuRcvSN : 4|1@1+ (1.0,0.0) [0.0|1.0] "" ACU + SG_ CF_Ods_EolCal : 5|1@1+ (1.0,0.0) [0.0|1.0] "" ACU + SG_ CF_Ods_PsFail : 6|1@1+ (1.0,0.0) [0.0|1.0] "" ACU + SG_ CF_Ods_EcuFail : 7|1@1+ (1.0,0.0) [0.0|1.0] "" ACU + SG_ CF_Ods_WgtStat : 8|1@1+ (1.0,0.0) [0.0|1.0] "" ACU + SG_ CF_Ods_OccStat : 16|1@1+ (1.0,0.0) [0.0|1.0] "" ACU + SG_ CR_Wcs_ErrStat : 32|8@1+ (1.0,0.0) [0.0|63.0] "" ACU + SG_ CR_Wcs_ClassStat : 40|8@1+ (1.0,0.0) [0.0|4.0] "" ACU,BCM + +BO_ 1017 ECS12: 4 ECS + SG_ Height_FL : 0|8@1+ (1.0,-128.0) [-128.0|127.0] "mm" AFLS + SG_ Height_FR : 8|8@1+ (1.0,-128.0) [-128.0|127.0] "mm" AFLS + SG_ Height_RL : 16|8@1+ (1.0,-128.0) [-128.0|127.0] "mm" AFLS + SG_ Height_RR : 24|8@1+ (1.0,-128.0) [-128.0|127.0] "mm" AFLS + +BO_ 1268 SPAS12: 8 SPAS + SG_ CF_Spas_HMI_Stat : 0|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ CF_Spas_Disp : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,EMS + SG_ CF_Spas_FIL_Ind : 10|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_FIR_Ind : 13|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_FOL_Ind : 16|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_FOR_Ind : 19|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_VolDown : 22|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Spas_RIL_Ind : 24|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_RIR_Ind : 27|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_FLS_Alarm : 30|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Spas_ROL_Ind : 32|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_ROR_Ind : 35|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_FCS_Alarm : 38|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Spas_FI_Ind : 40|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_RI_Ind : 43|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU + SG_ CF_Spas_FRS_Alarm : 46|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Spas_FR_Alarm : 48|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU + SG_ CF_Spas_RR_Alarm : 50|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU + SG_ CF_Spas_BEEP_Alarm : 52|4@1+ (1.0,0.0) [0.0|15.0] "" BCM,CLU + SG_ CF_Spas_StatAlarm : 56|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Spas_RLS_Alarm : 57|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Spas_RCS_Alarm : 59|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Spas_RRS_Alarm : 61|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1265 CLU11: 4 CLU + SG_ CF_Clu_CruiseSwState : 0|3@1+ (1.0,0.0) [0.0|7.0] "" EMS,LDWS_LKAS,SCC + SG_ CF_Clu_CruiseSwMain : 3|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,LDWS_LKAS,SCC + SG_ CF_Clu_SldMainSW : 4|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Clu_ParityBit1 : 5|1@1+ (1.0,0.0) [0.0|1.0] "pulse count" EMS + SG_ CF_Clu_VanzDecimal : 6|2@1+ (0.125,0.0) [0.0|0.375] "" EMS + SG_ CF_Clu_Vanz : 8|9@1+ (0.5,0.0) [0.0|255.5] "km/h or MPH" BCM,CUBIS,EMS,IBOX,LDWS_LKAS,MDPS,SCC + SG_ CF_Clu_SPEED_UNIT : 17|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CUBIS,EMS,IBOX,LDWS_LKAS,MDPS,SCC + SG_ CF_Clu_DetentOut : 18|1@1+ (1.0,0.0) [0.0|1.0] "" AVM,BCM,LCA,PGS,SPAS + SG_ CF_Clu_RheostatLevel : 19|5@1+ (1.0,0.0) [0.0|31.0] "" AVM,BCM,LCA,PGS,SPAS + SG_ CF_Clu_CluInfo : 24|1@1+ (1.0,0.0) [0.0|1.0] "" BCM + SG_ CF_Clu_AmpInfo : 25|1@1+ (1.0,0.0) [0.0|1.0] "" BCM + SG_ CF_Clu_AliveCnt1 : 28|4@1+ (1.0,0.0) [0.0|15.0] "" AHLS,EMS,EPB,LDWS_LKAS,MDPS,SCC + +BO_ 1492 TMU_GW_PE_01: 8 CLU + SG_ TMU_IVRActivity : 0|2@1+ (1.0,0.0) [0.0|3.0] "" DATC + SG_ TMU_PhoneActivity : 2|2@1+ (1.0,0.0) [0.0|3.0] "" DATC + +BO_ 1491 HU_DATC_PE_00: 8 CLU + SG_ HU_VRActivity : 0|2@1+ (1.0,0.0) [0.0|3.0] "" DATC + SG_ HU_PhoneActivity : 2|2@1+ (1.0,0.0) [0.0|3.0] "" DATC + SG_ BlowerNoiseControl : 4|2@1+ (1.0,0.0) [0.0|3.0] "" DATC + +BO_ 1490 HU_DATC_E_02: 8 CLU + SG_ HU_DATC_RearOnOffSet : 6|2@1+ (1.0,0.0) [0.0|3.0] "" DATC + SG_ HU_DATC_ADSOnOffSet : 8|2@1+ (1.0,0.0) [0.0|3.0] "" DATC + +BO_ 1479 EMS21: 8 EMS + SG_ SCR_LEVEL_WARN_LAMP : 0|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ SCR_LEVEL_WARN : 1|3@1+ (1.0,0.0) [0.0|4.0] "" CLU + SG_ SCR_SYS_ERROR_WARN : 4|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ SCR_SYSTEM_WARN_LAMP : 7|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ SCR_INDUCEMENT_EXIT_COND : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ SCR_UREA_LEVEL : 16|8@1+ (0.5,0.0) [0.0|100.0] "%" CLU + SG_ SCR_NO_REMAINING_RESTARTS : 24|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ SCR_REMAINING_DISTANCE : 32|16@1+ (1.0,0.0) [0.0|25000.0] "km" CLU + +BO_ 1472 GW_Warning_PE: 8 BCM + SG_ Audio_VolumeDown : 38|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ Pas_Spkr_Flh_Alarm : 48|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ Pas_Spkr_Fcnt_Alarm : 50|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ Pas_Spkr_Frh_Alarm : 52|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ Pas_Spkr_Rlh_Alarm : 56|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,PGS + SG_ Pas_Spkr_Rcnt_Alarm : 58|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ Pas_Spkr_Rrh_Alarm : 60|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,PGS + +BO_ 1984 CAL_SAS11: 2 ESC + SG_ CCW : 0|4@1+ (1.0,0.0) [0.0|15.0] "" SAS + SG_ SAS_CID : 4|11@1+ (1.0,0.0) [0.0|2047.0] "" SAS + +BO_ 1456 CLU12: 4 CLU + SG_ CF_Clu_Odometer : 0|24@1+ (0.1,0.0) [0.0|1677721.4] "km" _4WD,AAF,BCM,CUBIS,EMS,EPB,IBOX,LDWS_LKAS,SCC,TPMS + +BO_ 688 SAS11: 5 MDPS + SG_ SAS_Angle : 0|16@1- (0.1,0.0) [-3276.8|3276.7] "Deg" _4WD,ACU,AFLS,AVM,CLU,ECS,EMS,ESC,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SPAS,TCU,_4WD,ACU,AFLS,AVM,BCM,CLU,ECS,EMS,ESC,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SPAS,TCU + SG_ SAS_Speed : 16|8@1+ (4.0,0.0) [0.0|1016.0] "" AFLS,ECS,ESC,IBOX,LDWS_LKAS,SCC,SPAS,TCU,AFLS,ECS,ESC,IBOX,LDWS_LKAS,SCC,SPAS,TCU + SG_ SAS_Stat : 24|8@1+ (1.0,0.0) [0.0|255.0] "" ECS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS,TCU,ECS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS,TCU + SG_ MsgCount : 32|4@1+ (1.0,0.0) [0.0|15.0] "" ECS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS,ECS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS + SG_ CheckSum : 36|4@1+ (1.0,0.0) [0.0|15.0] "" ECS,EMS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS,ECS,EMS,ESC,IBOX,LDWS_LKAS,PSB,SCC,SPAS + +BO_ 1441 ACU12: 8 ACU + SG_ CR_Acu_SN : 0|64@1+ (1.0,0.0) [0.0|0.0] "" ODS + +BO_ 1440 ACU11: 8 ACU + SG_ CF_Ods_SNRcv : 1|1@1+ (1.0,0.0) [0.0|1.0] "" ODS + SG_ CF_Ods_IDRcv : 2|1@1+ (1.0,0.0) [0.0|1.0] "" ODS + SG_ CF_Ods_RZReq : 4|1@1+ (1.0,0.0) [0.0|1.0] "" ODS + SG_ CF_Abg_DepInhEnt : 6|1@1+ (1.0,0.0) [0.0|1.0] "" ODS + SG_ CF_Abg_DepEnt : 7|1@1+ (1.0,0.0) [0.0|1.0] "" ODS + SG_ CF_PasBkl_FltStat : 28|1@1+ (1.0,0.0) [0.0|1.0] "" ODS,PSB + SG_ CF_DriBkl_FltStat : 29|1@1+ (1.0,0.0) [0.0|1.0] "" ODS,PSB + SG_ CF_PasBkl_Stat : 30|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,ODS,PSB,TMU + SG_ CF_DriBkl_Stat : 31|1@1+ (1.0,0.0) [0.0|1.0] "" ODS,PSB + SG_ CF_SWL_Ind : 32|2@1+ (1.0,0.0) [0.0|3.0] "" CUBIS,IBOX + SG_ CF_Acu_FltStat : 34|2@1+ (1.0,0.0) [0.0|3.0] "" CUBIS,IBOX + SG_ CF_Acu_ExtOfSab : 36|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU,CUBIS,IBOX + SG_ CF_Acu_Dtc : 40|16@1+ (1.0,0.0) [0.0|65535.0] "" CUBIS,IBOX + SG_ CF_Acu_NumOfFlt : 56|8@1+ (1.0,0.0) [0.0|255.0] "" CUBIS,IBOX + +BO_ 1437 AHLS11: 8 AHLS + SG_ CF_Ahls_WarnLamp : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Ahls_WarnMsg : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1434 PSB11: 2 PSB + SG_ PSB_LH_FAIL : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ PSB_LH_TGL : 2|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ PSB_LH_ACT : 3|4@1+ (1.0,0.0) [0.0|4.0] "" Dummy + SG_ PSB_RH_FAIL : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ PSB_RH_TGL : 10|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ PSB_RH_ACT : 11|4@1+ (1.0,0.0) [0.0|4.0] "" Dummy + +BO_ 916 TCS13: 8 ESC + SG_ aBasis : 0|11@1+ (0.01,-10.23) [-10.23|10.24] "m/s^2" EMS,SCC + SG_ BrakeLight : 11|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,SCC + SG_ DCEnable : 12|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,SCC + SG_ AliveCounterTCS : 13|3@1+ (1.0,0.0) [0.0|7.0] "" EMS,SCC + SG_ ACCReqLim : 22|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,SCC + SG_ TQI_ACC : 24|8@1+ (0.390625,0.0) [0.0|99.609375] "%" EMS + SG_ ACCEL_REF_ACC : 32|11@1+ (0.01,-10.23) [-10.23|10.24] "m/s^2" EMS,SCC + SG_ ACCEnable : 43|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,SCC + SG_ DriverOverride : 45|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,SCC + SG_ StandStill : 47|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,SCC + SG_ CheckSum_TCS3 : 48|4@1+ (1.0,0.0) [0.0|15.0] "" EMS,SCC + SG_ ACC_EQUIP : 52|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,SCC + SG_ PBRAKE_ACT : 53|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,SCC + SG_ ACC_REQ : 54|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ DriverBraking : 55|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,SCC + SG_ CF_VSM_Coded : 56|1@1+ (1.0,0.0) [0.0|1.0] "" SCC + SG_ CF_VSM_Avail : 57|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,SCC + SG_ CF_VSM_Handshake : 59|1@1+ (1.0,0.0) [0.0|1.0] "" SCC + SG_ CF_DriBkeStat : 60|1@1+ (1.0,0.0) [0.0|1.0] "" SCC + SG_ CF_VSM_ConfSwi : 61|2@1+ (1.0,0.0) [0.0|3.0] "" SCC + SG_ AEB_EQUIP : 63|1@1+ (1.0,0.0) [0.0|1.0] "" SCC + +BO_ 1427 TPMS11: 6 BCM + SG_ TPMS_W_LAMP : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,CUBIS,HUD,IBOX,CLU,CUBIS,HUD,IBOX + SG_ TREAD_W_LAMP : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,CUBIS,HUD,IBOX,CLU,CUBIS,HUD,IBOX + SG_ POS_FL_W_LAMP : 4|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,CUBIS,HUD,IBOX + SG_ POS_FR_W_LAMP : 5|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,CUBIS,HUD,IBOX + SG_ POS_RL_W_LAMP : 6|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,CUBIS,HUD,IBOX + SG_ POS_RR_W_LAMP : 7|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,CUBIS,HUD,IBOX + SG_ STATUS_TPMS : 8|3@1+ (1.0,0.0) [0.0|0.0] "" CLU + SG_ UNIT : 11|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ PRESSURE_FL : 16|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ PRESSURE_FR : 24|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ PRESSURE_RL : 32|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ PRESSURE_RR : 40|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + +BO_ 915 TCS12: 4 ESC + SG_ SA_COUNT : 0|16@1+ (2.0,-32768.0) [-32768.0|98302.0] "" _4WD,ACU,MDPS + SG_ SA_Z_COUNT : 16|15@1+ (2.0,-32768.0) [-32768.0|32766.0] "" _4WD,ACU,MDPS + SG_ SA_Z_FLAG : 31|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,MDPS + +BO_ 1170 EMS19: 8 EMS + SG_ CF_Ems_BrkReq : 0|1@1+ (1.0,0.0) [0.0|1.0] "" ESC,IBOX,TCU + SG_ CF_Ems_DnShftReq : 1|4@1+ (1.0,0.0) [0.0|14.0] "" IBOX,TCU + SG_ CF_Ems_RepModChk : 5|2@1+ (1.0,0.0) [0.0|3.0] "" IBOX + SG_ CF_Ems_AAFOpenReq : 7|1@1+ (1.0,0.0) [0.0|1.0] "" AAF,IBOX + SG_ CF_Ems_DecelReq : 8|12@1+ (0.0010,-4.094) [-4.094|0.0] "m/s^2" ESC,IBOX,TCU + SG_ CR_Ems_BstPre : 20|12@1+ (1.322,0.0) [0.0|4094.0] "hPa" CLU,IBOX + SG_ CR_Ems_EngOilTemp : 32|8@1+ (0.75,-40.0) [0.0|254.0] "deg" CLU,IBOX + SG_ DPF_LAMP_STAT : 40|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,IBOX + SG_ BAT_LAMP_STAT : 42|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_ModeledAmbTemp : 48|8@1+ (0.5,-41.0) [-41.0|85.5] "deg" AAF,IBOX + SG_ CF_Ems_OPSFail : 56|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_AliveCounterEMS9 : 58|2@1+ (1.0,0.0) [0.0|3.0] "" AAF,ABS,CUBIS,ECS,EPB,IBOX,MDPS,REA,SCC,SMK,TCU + SG_ CF_Ems_ChecksumEMS9 : 60|4@1+ (1.0,0.0) [0.0|15.0] "" AAF,ABS,CUBIS,ECS,EPB,IBOX,MDPS,REA,SCC,SMK,TCU + +BO_ 1425 AFLS11: 2 AFLS + SG_ AFLS_STAT : 1|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Afls_TrfChgStat : 3|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Afls_LedHLStat : 4|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 912 SPAS11: 7 SPAS + SG_ CF_Spas_Stat : 0|4@1+ (1.0,0.0) [0.0|15.0] "" ESC,MDPS + SG_ CF_Spas_TestMode : 4|2@1+ (1.0,0.0) [0.0|3.0] "" MDPS + SG_ CR_Spas_StrAngCmd : 8|16@1- (0.1,0.0) [-3276.8|3276.7] "" MDPS + SG_ CF_Spas_BeepAlarm : 24|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ CF_Spas_Mode_Seq : 28|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Spas_AliveCnt : 32|8@1+ (1.0,0.0) [0.0|255.0] "" MDPS + SG_ CF_Spas_Chksum : 40|8@1+ (1.0,0.0) [0.0|255.0] "" MDPS + SG_ CF_Spas_PasVol : 48|3@1+ (1.0,0.0) [0.0|7.0] "" CGW,CLU + +BO_ 1168 EPB11: 7 EPB + SG_ EPB_I_LAMP : 0|4@1+ (1.0,0.0) [0.0|15.0] "" BCM,CLU,CUBIS,ESC,IBOX + SG_ EPB_F_LAMP : 4|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,CUBIS,ESC,IBOX + SG_ EPB_ALARM : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ESC + SG_ EPB_CLU : 8|8@1+ (1.0,0.0) [0.0|255.0] "" CLU,ESC + SG_ EPB_SWITCH : 16|2@1+ (1.0,0.0) [0.0|3.0] "" ESC,SCC + SG_ EPB_RBL : 18|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,ESC + SG_ EPB_STATUS : 19|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,EMS,ESC,SCC,TCU + SG_ EPB_FRC_ERR : 22|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,ESC,SCC,TCU + SG_ EPB_DBF_STAT : 24|1@1+ (1.0,0.0) [0.0|1.0] "" ESC + SG_ ESP_ACK : 25|1@1+ (1.0,0.0) [0.0|1.0] "" ESC + SG_ EPB_DBF_REQ : 26|1@1+ (1.0,0.0) [0.0|1.0] "" ESC + SG_ EPB_FAIL : 29|3@1+ (1.0,0.0) [0.0|7.0] "" ESC,SCC + SG_ EPB_FORCE : 32|12@1+ (1.0,-1000.0) [-1000.0|3000.0] "" ESC + SG_ EPB_DBF_DECEL : 48|8@1+ (0.01,0.0) [0.0|2.54] "g" ESC + +BO_ 399 EMS_H12: 8 EMS + SG_ R_TqAcnApvC : 0|8@1+ (0.2,0.0) [0.0|51.0] "Nm" DATC,IBOX + SG_ R_PAcnC : 8|8@1+ (125.0,0.0) [0.0|31875.0] "hPa" DATC,IBOX + SG_ TQI_B : 16|8@1+ (0.390625,0.0) [0.0|99.609375] "%" ABS,ESC,IBOX + SG_ SLD_VS : 24|8@1+ (1.0,0.0) [0.0|255.0] "km/h" CLU,IBOX + SG_ CF_CdaStat : 32|3@1+ (1.0,0.0) [0.0|7.0] "" AEMC,IBOX,TCU + SG_ CF_Ems_IsgStat : 35|3@1+ (1.0,0.0) [0.0|7.0] "" ABS,BCM,CLU,DATC,EPB,ESC,IBOX,LDWS_LKAS,MDPS,SMK,TCU + SG_ CF_Ems_OilChg : 38|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_EtcLimpMod : 39|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ R_NEngIdlTgC : 40|8@1+ (10.0,0.0) [0.0|2550.0] "rpm" DATC,IBOX,TCU + SG_ CF_Ems_UpTarGr : 48|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_DownTarGr : 49|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_DesCurGr : 50|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,IBOX + SG_ CF_Ems_SldAct : 54|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_SldPosAct : 55|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_HPresStat : 56|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,TCU + SG_ CF_Ems_IsgBuz : 57|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_IdlStpFCO : 58|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_FCopen : 59|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Ems_ActEcoAct : 60|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX,TCU + SG_ CF_Ems_EngRunNorm : 61|1@1+ (1.0,0.0) [0.0|1.0] "" ABS,ESC,IBOX,TCU + SG_ CF_Ems_IsgStat2 : 62|2@1+ (2.0,0.0) [0.0|3.0] "" CLU,IBOX,TCU + +BO_ 1419 LCA11: 8 LCA + SG_ CF_Lca_Stat : 0|4@1+ (1.0,0.0) [0.0|15.0] "" BCM,CLU + SG_ CF_Rcta_Stat : 4|4@1+ (1.0,0.0) [0.0|15.0] "" BCM,CLU + SG_ CF_Lca_IndLeft : 8|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU + SG_ CF_Rcw_Stat : 10|4@1+ (1.0,0.0) [0.0|15.0] "" BCM,CLU + SG_ CF_RCW_Warning : 14|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU + SG_ CF_Lca_IndRight : 16|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU + SG_ CF_Lca_SndWan_Stat : 18|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU + SG_ CF_FR_SndWan : 20|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CLU + SG_ CF_FL_SndWan : 21|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CLU + SG_ CF_RR_SndWan : 22|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CLU + SG_ CF_RL_SndWan : 23|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CLU + SG_ CF_Lca_IndBriLeft : 24|8@1+ (1.0,0.0) [0.0|255.0] "" BCM,CLU + SG_ CF_Lca_IndBriRight : 32|8@1+ (1.0,0.0) [0.0|255.0] "" BCM,CLU + SG_ CF_RCTA_IndBriLeft : 40|8@1+ (1.0,0.0) [0.0|255.0] "" BCM,CLU + SG_ CF_RCTA_IndBriRight : 48|8@1+ (1.0,0.0) [0.0|255.0] "" BCM,CLU + SG_ CF_RCTA_IndLeft : 56|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU + SG_ CF_RCTA_IndRight : 58|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU + SG_ CF_SndWarnForClu : 60|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + +BO_ 906 ABS11: 8 ABS + SG_ ABS_DEF : 0|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,EMS,SPAS,TCU + SG_ EBD_DEF : 1|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,SPAS,TCU + SG_ ABS_ACT : 2|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,EPB,SPAS,TCU + SG_ ABS_W_LAMP : 3|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU,CUBIS,MTS,TMU + SG_ EBD_W_LAMP : 4|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU + SG_ ABS_DIAG : 5|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU + SG_ ESS_STAT : 6|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,BCM,CLU,EMS + +BO_ 903 WHL_PUL11: 6 ABS + SG_ WHL_PUL_FL : 0|8@1+ (0.5,0.0) [0.0|127.5] "pulse count" CUBIS,EPB,IBOX,SPAS,TMU,TPMS,CUBIS,EPB,IBOX,LDWS_LKAS,SPAS,TMU,TPMS + SG_ WHL_PUL_FR : 8|8@1+ (0.5,0.0) [0.0|127.5] "pulse count" CUBIS,EPB,IBOX,SPAS,TMU,TPMS,CUBIS,EPB,IBOX,LDWS_LKAS,SPAS,TMU,TPMS + SG_ WHL_PUL_RL : 16|8@1+ (0.5,0.0) [0.0|127.5] "pulse count" CUBIS,EPB,IBOX,SPAS,TMU,TPMS,CUBIS,EPB,IBOX,LDWS_LKAS,SPAS,TMU,TPMS + SG_ WHL_PUL_RR : 24|8@1+ (0.5,0.0) [0.0|127.5] "pulse count" CUBIS,EPB,IBOX,SPAS,TMU,TPMS,CUBIS,EPB,IBOX,LDWS_LKAS,SPAS,TMU,TPMS + SG_ WHL_DIR_FL : 32|2@1+ (1.0,0.0) [0.0|3.0] "" EPB,SPAS,TPMS,EPB,LCA,SPAS,TPMS + SG_ WHL_DIR_FR : 34|2@1+ (1.0,0.0) [0.0|3.0] "" EPB,SPAS,TPMS,EPB,LCA,SPAS,TPMS + SG_ WHL_DIR_RL : 36|2@1+ (1.0,0.0) [0.0|3.0] "" EPB,SPAS,TPMS,EPB,LCA,SPAS,TPMS + SG_ WHL_DIR_RR : 38|2@1+ (1.0,0.0) [0.0|3.0] "" EPB,SPAS,TPMS,EPB,LCA,SPAS,TPMS + SG_ WHL_PUL_Chksum : 40|8@1+ (1.0,0.0) [0.0|255.0] "" EPB,SPAS,TPMS,EPB,LCA,LDWS_LKAS,SPAS,TPMS + +BO_ 1415 TMU11: 8 IBOX + SG_ CF_Tmu_VehSld : 0|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Tmu_VehImmo : 1|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Tmu_ReqRepCnd : 2|2@1+ (1.0,0.0) [0.0|3.0] "" EMS + SG_ CF_Tmu_AirconCtr : 4|1@1+ (1.0,0.0) [0.0|1.0] "" DATC + SG_ CF_Tmu_TempMd : 5|1@1+ (1.0,0.0) [0.0|1.0] "" DATC + SG_ CF_Tmu_TempSet : 6|16@1+ (1.0,0.0) [0.0|20.0] "" DATC + SG_ CF_Tmu_DefrostCtr : 22|1@1+ (1.0,0.0) [0.0|1.0] "" DATC,FATC + SG_ CF_Tmu_AliveCnt1 : 56|4@1+ (1.0,0.0) [0.0|15.0] "" EMS + +BO_ 902 WHL_SPD11: 8 ABS + SG_ WHL_SPD_FL : 0|14@1+ (0.03125,0.0) [0.0|511.96875] "km/h" _4WD,AFLS,AHLS,AVM,CLU,CUBIS,ECS,EMS,EPB,IBOX,LDWS_LKAS,PGS,PSB,SCC,SMK,SPAS,TCU,TPMS,_4WD,ACU,AFLS,AHLS,AVM,CLU,ECS,EMS,EPB,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SMK,SPAS,TCU,TPMS + SG_ WHL_SPD_FR : 16|14@1+ (0.03125,0.0) [0.0|511.96875] "km/h" _4WD,ACU,AFLS,AHLS,AVM,CLU,CUBIS,ECS,EMS,EPB,IBOX,LDWS_LKAS,PGS,PSB,SCC,SMK,SPAS,TCU,TPMS,_4WD,ACU,AFLS,AHLS,AVM,CLU,ECS,EMS,EPB,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SMK,SPAS,TCU,TPMS + SG_ WHL_SPD_RL : 32|14@1+ (0.03125,0.0) [0.0|511.96875] "km/h" _4WD,AFLS,AHLS,AVM,BCM,CLU,CUBIS,ECS,EMS,EPB,IBOX,LDWS_LKAS,PGS,PSB,SCC,SMK,SPAS,TCU,TPMS,_4WD,ACU,AFLS,AHLS,AVM,BCM,CLU,ECS,EMS,EPB,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SMK,SPAS,TCU,TPMS + SG_ WHL_SPD_RR : 48|14@1+ (0.03125,0.0) [0.0|511.96875] "km/h" _4WD,AFLS,AHLS,AVM,CLU,CUBIS,ECS,EMS,EPB,IBOX,LDWS_LKAS,PGS,PSB,SCC,SMK,SPAS,TCU,TPMS,_4WD,ACU,AFLS,AHLS,AVM,CLU,ECS,EMS,EPB,IBOX,LCA,LDWS_LKAS,PGS,PSB,SCC,SMK,SPAS,TCU,TPMS + SG_ WHL_SPD_AliveCounter_LSB : 14|2@1+ (1.0,0.0) [0.0|15.0] "" _4WD,EMS,LPI,TCU,TMU + SG_ WHL_SPD_AliveCounter_MSB : 30|2@1+ (1.0,0.0) [0.0|15.0] "" _4WD,EMS,LPI,TCU,TMU + SG_ WHL_SPD_Checksum_LSB : 46|2@1+ (1.0,0.0) [0.0|15.0] "" _4WD,EMS,LPI,TCU,TMU + SG_ WHL_SPD_Checksum_MSB : 62|2@1+ (1.0,0.0) [0.0|15.0] "" _4WD,EMS,LPI,TCU,TMU + +BO_ 1414 EVP11: 3 EVP + SG_ CF_Evp_Stat : 0|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + +BO_ 1412 AAF11: 8 AAF + SG_ CF_Aaf_ActFlapStatus : 0|2@1+ (1.0,0.0) [0.0|3.0] "" AAF_Tester + SG_ CF_Aaf_ModeStatus : 2|3@1+ (1.0,0.0) [0.0|7.0] "" AAF_Tester + SG_ CF_Aaf_WrnLamp : 5|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Aaf_ErrStatus : 6|10@1+ (1.0,0.0) [0.0|1023.0] "" AAF_Tester,EMS + SG_ CF_Aaf_OpenRqSysAct : 16|8@1+ (1.0,0.0) [0.0|255.0] "" AAF_Tester + SG_ CF_Aaf_PStatus : 24|8@1+ (1.0,0.0) [0.0|100.0] "%" AAF_Tester + SG_ CF_Aaf_OpenRqSysSol : 32|8@1+ (1.0,0.0) [0.0|255.0] "" AAF_Tester + SG_ CF_Aaf_SolFlapStatus : 40|2@1+ (1.0,0.0) [0.0|3.0] "" AAF_Tester + SG_ CF_Aaf_MilOnReq : 42|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + +BO_ 900 EMS17: 8 EMS + SG_ CF_Ems_PkpCurMSV : 0|8@1+ (1.0,0.0) [0.0|255.0] "" DI_BOX + SG_ CF_Ems_HolCurMSV : 8|8@1+ (1.0,0.0) [0.0|255.0] "" DI_BOX + SG_ CF_Ems_InjVBnkAct : 16|8@1+ (1.0,0.0) [0.0|255.0] "" DI_BOX + SG_ CF_Ems_InjVActSet : 24|8@1+ (1.0,0.0) [0.0|255.0] "" DI_BOX + SG_ CF_Ems_DiagFulHDEV : 32|1@1+ (1.0,0.0) [0.0|1.0] "" DI_BOX + SG_ CF_Ems_SwiOffIC1 : 33|1@1+ (1.0,0.0) [0.0|1.0] "" DI_BOX + SG_ CF_Ems_SwiOffIC2 : 34|1@1+ (1.0,0.0) [0.0|1.0] "" DI_BOX + SG_ CF_Ems_DiagReqHDEV : 38|1@1+ (1.0,0.0) [0.0|1.0] "" DI_BOX + SG_ CR_Ems_DutyCycMSV : 40|8@1+ (0.3921568627,0.0) [0.0|100.0] "%" DI_BOX + SG_ CR_Ems_BatVolRly : 48|8@1+ (0.1,0.0) [0.0|25.5] "V" DI_BOX + +BO_ 387 REA11: 8 REA + SG_ CF_EndBst_PwmDuH : 0|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_PwmDuL : 1|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_PwmFqOutRng : 2|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_HbriOverCur : 3|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_HbriOverTemp : 4|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_PosSnsKOR : 6|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_PosSnsOSOR : 7|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_EepFlt : 8|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_RomFlt : 9|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_RamFlt : 10|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_CanFlt : 11|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_AgH : 12|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_AgL : 13|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_EndBst_ORVol : 14|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CR_EndBst_ActPos : 16|16@1+ (0.117,0.0) [1.989|118.053] "" EMS + SG_ CR_EndBst_DemPos : 32|16@1+ (0.117,0.0) [0.0|119.691] "" EMS + SG_ CR_EndBst_HbriPwr : 48|16@1+ (0.045,0.0) [0.0|99.99] "%" EMS + +BO_ 1411 CUBIS11: 8 CUBIS + SG_ CF_Cubis_HUDisp : 0|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + +BO_ 899 FATC11: 8 DATC + SG_ CR_Fatc_TqAcnOut : 0|8@1+ (0.2,0.0) [0.0|50.8] "Nm" EMS,IBOX + SG_ CF_Fatc_AcnRqSwi : 8|1@1+ (1.0,0.0) [0.0|1.0] "" AAF,EMS,IBOX + SG_ CF_Fatc_AcnCltEnRq : 9|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Fatc_EcvFlt : 10|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Fatc_BlwrOn : 11|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_FATC_Iden : 12|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,IBOX + SG_ CF_Fatc_BlwrMax : 14|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,IBOX + SG_ CF_Fatc_EngStartReq : 15|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Fatc_IsgStopReq : 16|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Fatc_CtrInf : 17|3@1+ (1.0,0.0) [0.0|7.0] "" EMS,IBOX + SG_ CF_Fatc_MsgCnt : 20|4@1+ (1.0,0.0) [0.0|15.0] "" EMS,IBOX + SG_ CR_Fatc_OutTemp : 24|8@1+ (0.5,-40.0) [-40.0|60.0] "deg" BCM,CLU,EMS,IBOX,SPAS,TCU,TPMS + SG_ CR_Fatc_OutTempSns : 32|8@1+ (0.5,-40.0) [-40.0|60.0] "deg" AAF,AHLS,CLU,EMS,IBOX,SPAS,TCU + SG_ CF_Fatc_Compload : 40|3@1+ (1.0,0.0) [0.0|7.0] "" EMS,IBOX + SG_ CF_Fatc_ActiveEco : 43|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Fatc_AutoActivation : 44|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX + SG_ CF_Fatc_DefSw : 45|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,IBOX + SG_ CF_Fatc_PtcRlyStat : 46|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Fatc_ChkSum : 56|8@1+ (1.0,0.0) [0.0|255.0] "" EMS,IBOX,SPAS + +BO_ 129 EMS_DCT12: 8 EMS + SG_ CR_Ems_SoakTimeExt : 0|6@1+ (5.0,0.0) [0.0|315.0] "Min" TCU + SG_ BRAKE_ACT : 6|2@1+ (1.0,0.0) [0.0|3.0] "" TCU + SG_ CF_Ems_EngOperStat : 8|8@1+ (1.0,0.0) [0.0|255.0] "" TCU + SG_ CR_Ems_IndAirTemp : 16|8@1+ (0.75,-48.0) [-48.0|143.25] "deg" TCU + SG_ CF_Ems_Alive2 : 56|4@1+ (1.0,0.0) [0.0|15.0] "" TCU + SG_ CF_Ems_ChkSum2 : 60|4@1+ (1.0,0.0) [0.0|15.0] "" TCU + +BO_ 897 MDPS11: 8 MDPS + SG_ CF_Mdps_WLmp : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,CUBIS,EMS,IBOX,SPAS + SG_ CF_Mdps_Flex : 2|3@1+ (1.0,0.0) [0.0|3.0] "" CLU,LDWS_LKAS + SG_ CF_Mdps_FlexDisp : 5|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Mdps_Stat : 7|4@1+ (1.0,0.0) [0.0|15.0] "" SPAS + SG_ CR_Mdps_DrvTq : 11|12@1+ (1.0,-2048.0) [-2048.0|2046.0] "" SPAS + SG_ CF_Mdps_ALTRequest : 23|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CR_Mdps_StrAng : 24|16@1- (0.1,0.0) [-3276.8|3276.7] "Deg" SPAS + SG_ CF_Mdps_AliveCnt : 40|8@1+ (1.0,0.0) [0.0|255.0] "" LDWS_LKAS,SPAS + SG_ CF_Mdps_Chksum : 48|8@1+ (1.0,0.0) [0.0|255.0] "" LDWS_LKAS,SPAS + SG_ CF_Mdps_SPAS_FUNC : 57|1@1+ (1.0,0.0) [0.0|1.0] "flag" SPAS + SG_ CF_Mdps_LKAS_FUNC : 58|1@1+ (1.0,0.0) [0.0|1.0] "flag" LDWS_LKAS + SG_ CF_Mdps_CurrMode : 59|2@1+ (1.0,0.0) [0.0|3.0] "" LDWS_LKAS + SG_ CF_Mdps_Type : 61|2@1+ (1.0,0.0) [0.0|2.0] "" LDWS_LKAS,SPAS + +BO_ 896 DI_BOX13: 8 DI_BOX + SG_ CF_DiBox_HPreInjVConfStat : 0|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_HPreInjVStat1 : 8|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_HPreInjVStat2 : 16|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_HPreInjVPkp : 24|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_HPreInjVBpt : 32|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_ErrRegFrtMSV : 40|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_ErrRegSedMSV : 48|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_SPIErrSedMSV : 56|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_DiBox_SPIErrFrtMSV : 57|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_DiBox_IDErrSedMSV : 58|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_DiBox_IDErrFrtMSV : 59|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_DiBox_IniStatMSV : 60|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + +BO_ 640 EMS13: 8 EMS + SG_ LV_FUEL_TYPE_ECU : 0|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CLU,LPI,SMK + SG_ LV_BFS_CFIRM : 1|1@1+ (1.0,0.0) [0.0|1.0] "" LPI + SG_ LV_CRASH : 2|1@1+ (1.0,0.0) [0.0|1.0] "" LPI + SG_ LV_VB_OFF_ACT : 3|1@1+ (1.0,0.0) [0.0|1.0] "" LPI + SG_ LV_GSL_MAP M : 4|1@1+ (1.0,0.0) [0.0|1.0] "" LPI + SG_ LV_ENG_TURN : 5|1@1+ (1.0,0.0) [0.0|1.0] "" LPI + SG_ ERR_FUEL : 8|8@1+ (1.0,0.0) [0.0|255.0] "" LPI + SG_ EOS : 16|8@1+ (1.0,0.0) [0.0|255.0] "" LPI + SG_ TCO : 24|8@1+ (0.75,-48.0) [-48.0|143.25] "deg" LPI + SG_ N_32 : 32|8@1+ (32.0,0.0) [0.0|8160.0] "rpm" LPI + SG_ MAF : 40|8@1+ (5.447,0.0) [0.0|1388.985] "mg/TDC" LPI + SG_ TIA : 48|8@1+ (0.75,-48.0) [-48.0|143.25] "deg" LPI + SG_ MAP m1 : 56|8@1+ (0.47058,0.0) [0.0|119.9979] "kPa" LPI + SG_ AMP m0 : 56|8@1+ (21.22,0.0) [0.0|5411.1] "hPa" LPI + +BO_ 128 EMS_DCT11: 8 EMS + SG_ PV_AV_CAN : 0|8@1+ (0.3906,0.0) [0.0|99.603] "%" TCU + SG_ TQ_STND : 8|6@1+ (10.0,0.0) [0.0|630.0] "Nm" TCU + SG_ F_N_ENG : 14|1@1+ (1.0,0.0) [0.0|1.0] "" TCU + SG_ F_SUB_TQI : 15|1@1+ (1.0,0.0) [0.0|1.0] "" TCU + SG_ N : 16|16@1+ (0.25,0.0) [0.0|16383.75] "rpm" TCU + SG_ TQI_ACOR : 32|8@1+ (0.390625,0.0) [0.0|99.6094] "%" IBOX,TCU + SG_ TQFR : 40|8@1+ (0.390625,0.0) [0.0|99.6094] "%" TCU + SG_ TQI : 48|8@1+ (0.390625,0.0) [0.0|99.609375] "%" TCU + SG_ CF_Ems_Alive : 56|4@1+ (1.0,0.0) [0.0|15.0] "" TCU + SG_ CF_Ems_ChkSum : 60|4@1+ (1.0,0.0) [0.0|15.0] "" TCU + +BO_ 1407 HU_MON_PE_01: 8 CLU + SG_ HU_Type : 0|8@1+ (1.0,0.0) [0.0|255.0] "" AVM,PGS + +BO_ 127 CGW5: 8 BCM + SG_ C_StopLampLhOpenSts : 0|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_StopLampRhOpenSts : 1|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_HMSLOpenSts : 2|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_HLampLowLhOpenSts : 3|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_HLampLowRhOpenSts : 4|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_HLampHighLhOpenSts : 5|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_HLampHighRhOpenSts : 6|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_DRLLampLhOpenSts : 7|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_DRLLampRhOpenSts : 8|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_RearFOGLhOpenSts : 9|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_RearFOGRhOpenSts : 10|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_FrontFOGLhOpenSts : 11|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_FrontFOGRhOpenSts : 12|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_RearEXTTailLhOpenSts : 13|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_RearEXTTailRhOpenSts : 14|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_FrontEXTTailLhOpenSts : 15|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_FrontEXTTailRhOpenSts : 16|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_RearTSIGLhOpenSts : 17|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_RearTSIGRhOpenSts : 18|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_FrontTSIGLhOpenSts : 19|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_FrontTSIGRhOpenSts : 20|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_SBendingLhOpenSts : 21|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_SBendingRhOpenSts : 22|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_LicensePlateLhOpenSts : 23|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_LicensePlateRhOpenSts : 24|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + +BO_ 1151 ESP11: 6 ESC + SG_ AVH_STAT : 0|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,EPB,TCU + SG_ LDM_STAT : 2|1@1+ (1.0,0.0) [0.0|1.0] "" EPB,TCU + SG_ REQ_EPB_ACT : 3|2@1+ (1.0,0.0) [0.0|3.0] "" EPB,TCU + SG_ REQ_EPB_STAT : 5|1@1+ (1.0,0.0) [0.0|1.0] "" EPB + SG_ ECD_ACT : 6|1@1+ (1.0,0.0) [0.0|1.0] "" EPB + SG_ _4WD_LIM_REQ : 7|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS + SG_ ROL_CNT_ESP : 8|8@1+ (1.0,0.0) [0.0|255.0] "" EPB,TCU + SG_ _4WD_TQC_LIM : 16|16@1+ (1.0,0.0) [0.0|65535.0] "Nm" _4WD,EMS + SG_ _4WD_CLU_LIM : 32|8@1+ (0.390625,0.0) [0.0|99.609375] "%" _4WD,EMS + SG_ _4WD_OPEN : 40|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,EMS + SG_ _4WD_LIM_MODE : 42|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD + +BO_ 1397 HU_AVM_E_00: 8 CLU + SG_ HU_AVM_Cal_Cmd : 0|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + SG_ HU_AVM_Cal_Method : 4|2@1+ (1.0,0.0) [0.0|3.0] "" AVM,PGS + SG_ HU_AVM_Save_Controlpoint : 6|2@1+ (1.0,0.0) [0.0|3.0] "" AVM,PGS + SG_ HU_AVM_PT_X : 8|12@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + SG_ HU_AVM_RearViewPointOpt : 20|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + SG_ HU_AVM_PT_Y : 24|12@1+ (1.0,0.0) [0.0|4095.0] "" AVM,PGS + SG_ HU_AVM_FrontViewPointOpt : 36|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + SG_ HU_AVM_SelectedMenu : 40|5@1+ (1.0,0.0) [0.0|31.0] "" AVM,PGS + SG_ HU_AVM_CameraOff : 45|2@1+ (1.0,0.0) [0.0|3.0] "" AVM,PGS + SG_ HU_AVM_Option : 48|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + SG_ HU_AVM_CrossLineMove_Cmd : 52|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + SG_ HU_AVM_RearView_Option : 56|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + SG_ HU_AVM_FrontView_Option : 60|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + +BO_ 1395 HU_AVM_E_01: 8 CLU + SG_ HU_PGSSelectedMenu : 0|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + SG_ HU_PGSOption : 8|5@1+ (1.0,0.0) [0.0|31.0] "" AVM,PGS + SG_ HU_AVM_ParkingAssistMenu : 56|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + SG_ HU_AVM_ParkingAssistSB : 60|4@1+ (1.0,0.0) [0.0|15.0] "" AVM,PGS + +BO_ 1393 OPI11: 5 OPI + SG_ CR_Opi_Spd_Rpm : 0|8@1+ (20.0,0.0) [0.0|3500.0] "rpm" TCU + SG_ CF_Opi_Over_Temp : 8|1@1+ (1.0,0.0) [0.0|1.0] "" TCU + SG_ CF_Opi_Over_Cur : 9|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,TCU + SG_ CF_Opi_Over_Vol : 10|1@1+ (1.0,0.0) [0.0|1.0] "" TCU + SG_ CF_Opi_Hall_Fail : 11|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,TCU + SG_ CF_Opi_Flt : 12|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,TCU + SG_ CF_Opi_Motor_Dir : 15|1@1+ (1.0,0.0) [0.0|1.0] "" TCU + SG_ CF_Opi_Romver : 16|8@1+ (1.0,0.0) [0.0|255.0] "" TCU + SG_ CF_Opi_PWM_Rate : 24|12@1+ (1.0,0.0) [0.0|100.0] "%" TCU + +BO_ 625 LPI11: 8 LPI + SG_ FUP_LPG_MMV : 0|8@1+ (128.0,0.0) [0.0|32640.0] "hPa" EMS + SG_ LV_FUEL_TYPE_BOX : 8|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ LV_BFS_IN_PROGRESS : 9|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ LV_GAS_OK : 10|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ LV_FUP_ENA_THD : 11|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CLU,EMS,SMK + SG_ LPI_OBD : 12|4@1+ (1.0,0.0) [0.0|15.0] "" EMS + SG_ ERR_GAS : 16|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ FAC_TI_GAS_COR : 24|16@1+ (3.05E-5,0.0) [0.0|1.9988175] "" EMS + SG_ FTL_AFU : 40|8@1+ (0.392,0.0) [0.0|99.96] "%" EMS + SG_ BFS_CYL : 48|8@1+ (1.0,0.0) [0.0|6.0] "Cyl Nr." EMS + SG_ LV_PRE_CDN_LEAK : 56|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ LV_CONF_INJECTION_DELAY : 57|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ LV_LPG_SW_DRIVER_REQ : 58|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + +BO_ 356 VSM11: 4 ESC + SG_ CR_Esc_StrTqReq : 0|12@1+ (0.01,-20.48) [-20.48|20.47] "Nm" MDPS + SG_ CF_Esc_Act : 12|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS,MDPS + SG_ CF_Esc_CtrMode : 13|3@1+ (1.0,0.0) [0.0|7.0] "" MDPS + SG_ CF_Esc_Def : 16|1@1+ (1.0,0.0) [0.0|1.0] "" MDPS + SG_ CF_Esc_AliveCnt : 17|4@1+ (1.0,0.0) [0.0|15.0] "" LDWS_LKAS,MDPS + SG_ CF_Esc_Chksum : 24|8@1+ (1.0,0.0) [0.0|255.0] "" LDWS_LKAS,MDPS + +BO_ 1379 PGS_HU_PE_01: 8 PGS + SG_ PGS_State : 0|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ PGS_ParkGuideState : 8|5@1+ (1.0,0.0) [0.0|31.0] "" CLU + SG_ PGS_Option : 16|5@1+ (1.0,0.0) [0.0|31.0] "" CLU + SG_ PGS_Version : 32|16@1+ (1.0,0.0) [0.0|65535.0] "" CLU + +BO_ 354 TCU_DCT13: 3 TCU + SG_ Clutch_Driving_Tq : 0|10@1+ (1.0,-512.0) [0.0|0.0] "Nm" ESC + SG_ Cluster_Engine_RPM : 10|13@1+ (0.9766,0.0) [0.0|0.0] "" CLU + SG_ Cluster_Engine_RPM_Flag : 23|1@1+ (1.0,0.0) [0.0|0.0] "" CLU + +BO_ 1378 HUD11: 4 HUD + SG_ CF_Hud_HeightStaus : 0|5@1+ (1.0,0.0) [0.0|31.0] "" CLU + SG_ CF_Hud_PBackStatus : 6|2@1+ (1.0,0.0) [0.0|0.0] "" BCM,CLU + SG_ CF_Hud_Brightness : 8|5@1+ (1.0,0.0) [0.0|31.0] "" CLU + +BO_ 608 EMS16: 8 EMS + SG_ TQI_MIN : 0|8@1+ (0.390625,0.0) [0.0|99.609375] "%" ESC,IBOX,TCU + SG_ TQI : 8|8@1+ (0.390625,0.0) [0.0|99.609375] "%" ESC,IBOX,TCU + SG_ TQI_TARGET : 16|8@1+ (0.390625,0.0) [0.0|99.609375] "%" EPB,ESC,IBOX,TCU + SG_ GLOW_STAT : 24|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CLU,IBOX,SMK + SG_ CRUISE_LAMP_M : 25|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX,TCU + SG_ CRUISE_LAMP_S : 26|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX,TCU + SG_ PRE_FUEL_CUT_IN : 27|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,TCU + SG_ ENG_STAT : 28|3@1+ (1.0,0.0) [0.0|7.0] "" ABS,AHLS,AVM,BCM,CLU,EPB,ESC,EVP,FPCM,IBOX,LCA,LDWS_LKAS,MDPS,SCC,SMK,TCU + SG_ SOAK_TIME_ERROR : 31|1@1+ (1.0,0.0) [0.0|1.0] "" DATC,EPB,IBOX,TCU + SG_ SOAK_TIME : 32|8@1+ (1.0,0.0) [0.0|255.0] "Min" _4WD,DATC,EPB,IBOX,TCU + SG_ TQI_MAX : 40|8@1+ (0.390625,0.0) [0.0|99.609375] "%" ESC,IBOX,TCU + SG_ SPK_TIME_CUR : 48|8@1+ (0.375,-35.625) [-35.625|60.0] "" IBOX,TCU + SG_ Checksum : 56|4@1+ (1.0,0.0) [0.0|15.0] "" ECS,IBOX,LDWS_LKAS,MDPS,SCC + SG_ AliveCounter : 60|2@1+ (1.0,0.0) [0.0|3.0] "" IBOX,LDWS_LKAS,MDPS,SCC + SG_ CF_Ems_AclAct : 62|2@1+ (1.0,0.0) [0.0|3.0] "" IBOX,SCC + +BO_ 1371 AVM_HU_PE_00: 8 AVM + SG_ AVM_View : 0|5@1+ (1.0,0.0) [0.0|31.0] "" CLU + SG_ AVM_ParkingAssist_BtnSts : 5|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ AVM_Display_Message : 8|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ AVM_Popup_Msg : 16|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ AVM_Ready : 20|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ AVM_ParkingAssist_Step : 24|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ AVM_FrontBtn_Type : 28|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ AVM_Option : 32|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ AVM_HU_FrontViewPointOpt : 36|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ AVM_HU_RearView_Option : 40|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ AVM_HU_FrontView_Option : 44|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ AVM_Version : 48|16@1+ (1.0,0.0) [0.0|65535.0] "" CLU + +BO_ 1370 HU_AVM_PE_00: 8 CLU + SG_ HU_AVM_Status : 0|2@1+ (1.0,0.0) [0.0|3.0] "" AVM,PGS + +BO_ 1369 CGW4: 8 BCM + SG_ CF_Gway_MemoryP1Cmd : 0|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_MemoryP2Cmd : 1|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_PBackP1Cmd : 2|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_PBackP2Cmd : 3|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_StrgWhlHeatedState : 4|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_PBackStopCmd : 5|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,HUD + SG_ CF_Gway_StaticBendLhAct : 6|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_StaticBendRhAct : 7|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_DrvWdwStat : 8|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_RLWdwState : 9|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_RRWdwState : 10|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_AstWdwStat : 11|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_MemoryEnable : 12|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_PBACKStopCmd : 13|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_PBACKStop : 14|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,HUD + SG_ CF_Gway_IMSBuzzer : 15|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_DrvSeatBeltInd : 36|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,Dummy + SG_ CF_Gway_AstSeatBeltInd : 38|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_RCSeatBeltInd : 40|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_RLSeatBeltInd : 42|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_RRSeatBeltInd : 44|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_RrWiperHighSw : 46|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_RrWiperLowSw : 47|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + +BO_ 1367 EngFrzFrm12: 8 EMS + SG_ PID_06h : 0|8@1+ (0.78125,-100.0) [-100.0|99.22] "%" AAF,IBOX,TCU + SG_ PID_07h : 8|8@1+ (0.78125,-100.0) [-100.0|99.22] "%" AAF,IBOX,TCU + SG_ PID_08h : 16|8@1+ (0.78125,-100.0) [-100.0|99.22] "%" AAF,IBOX,TCU + SG_ PID_09h : 24|8@1+ (0.78125,-100.0) [-100.0|99.22] "%" AAF,IBOX,TCU + SG_ PID_0Bh : 32|8@1+ (1.0,0.0) [0.0|255.0] "kPa" AAF,IBOX,TCU + SG_ PID_23h : 40|16@1+ (10.0,0.0) [0.0|655350.0] "kPa" AAF,IBOX,TCU + +BO_ 1366 EngFrzFrm11: 8 EMS + SG_ PID_04h : 0|8@1+ (0.3921568627,0.0) [0.0|100.0] "%" AAF,TCU + SG_ PID_05h : 8|8@1+ (1.0,-40.0) [-40.0|215.0] "deg" AAF,TCU + SG_ PID_0Ch : 16|16@1+ (0.25,0.0) [0.0|16383.75] "rpm" AAF,TCU + SG_ PID_0Dh : 32|8@1+ (1.0,0.0) [0.0|255.0] "km/h" AAF,TCU + SG_ PID_11h : 40|8@1+ (0.3921568627,0.0) [0.0|100.0] "%" AAF,TCU + SG_ PID_03h : 48|16@1+ (1.0,0.0) [0.0|65535.0] "" AAF,TCU + +BO_ 1365 FPCM11: 8 FPCM + SG_ CR_Fpcm_LPActPre : 0|8@1+ (3.137254902,0.0) [0.0|800.0] "kPa" EMS + SG_ CF_Fpcm_LPPumpOverCur : 8|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Fpcm_PreSnrHi : 9|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Fpcm_PreSnrDisc : 10|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Fpcm_PreSnrShort : 11|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Fpcm_LPPumpDiscShort : 12|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Fpcm_LP_System_Error : 13|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Fpcm_PreSnrSigErr : 14|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Fpcm_LPCtrCirFlt : 15|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + +BO_ 871 LVR12: 8 LVR + SG_ CF_Lvr_CruiseSet : 0|8@1+ (1.0,0.0) [0.0|255.0] "" CLU,TCU + SG_ CF_Lvr_Gear : 32|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,TCU + +BO_ 872 LVR11: 8 LVR + SG_ CF_Lvr_GearInf : 0|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,TCU + SG_ CF_Lvr_PRelStat : 4|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CLU,SMK,TCU + SG_ CF_Lvr_BkeAct : 5|1@1+ (1.0,0.0) [0.0|1.0] "" TCU + SG_ CF_Lvr_NFnStat : 6|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Lvr_PosInf : 8|4@1+ (1.0,0.0) [0.0|15.0] "" TCU + SG_ CF_Lvr_PosCpl : 12|4@1+ (1.0,0.0) [0.0|15.0] "" TCU + SG_ CF_Lvr_UlkButStat : 18|2@1+ (1.0,0.0) [0.0|3.0] "" TCU + SG_ CF_Lvr_PNStat : 20|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Lvr_ShtLkStat : 24|4@1+ (1.0,0.0) [0.0|15.0] "" TCU + SG_ CF_Lvr_ShfErrInf : 28|20@1+ (1.0,0.0) [0.0|8191.0] "" CLU,TCU + SG_ CF_Lvr_AC : 48|4@1+ (1.0,0.0) [0.0|15.0] "" TCU + SG_ CF_Lvr_CS : 52|4@1+ (1.0,0.0) [0.0|15.0] "" TCU + +BO_ 1363 CGW2: 8 BCM + SG_ CF_Gway_GwayDiagState : 0|1@1+ (1.0,0.0) [0.0|3.0] "" CLU,Dummy + SG_ CF_Gway_DDMDiagState : 1|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_SCMDiagState : 2|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_PSMDiagState : 3|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_SJBDiagState : 4|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_IPMDiagState : 5|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_LDMFail : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,LDWS_LKAS,LDWS_LKAS + SG_ CF_Gway_CLUSwGuiCtrl : 10|3@1+ (1.0,0.0) [0.0|63.0] "" CLU,Dummy + SG_ CF_Gway_CLUSwGroup : 13|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_CLUSwMode : 14|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_CLUSwEnter : 15|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_AutoLightValue : 16|1@1+ (1.0,0.0) [0.0|1.0] "" LCA,LCA + SG_ CF_Gway_BrakeFluidSw : 17|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_DrvSeatBeltInd : 18|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_AvTail : 20|1@1+ (1.0,0.0) [0.0|3.0] "" CLU,SNV,SNV + SG_ CF_Gway_RearFogAct : 21|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_ExtTailAct : 22|1@1+ (1.0,0.0) [0.0|1.0] "" AVM,CLU,LCA,PGS,SPAS,AVM,LCA,PGS,SPAS + SG_ CF_Gway_RRDrSw : 23|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_RLDrSw : 24|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_IntTailAct : 25|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_CountryCfg : 26|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU,PGS,Dummy + SG_ CF_Gway_WiperParkPosition : 32|1@1+ (1.0,0.0) [0.0|1.0] "" AFLS,EMS,LDWS_LKAS,AFLS,EMS,LDWS_LKAS + SG_ CF_Gway_HLLowLHFail : 33|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS,SNV,LDWS_LKAS,SNV + SG_ CF_Gway_HLLowRHFail : 34|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS,SNV,LDWS_LKAS,SNV + SG_ CF_Gway_ESCLFailWarn : 35|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_ESCLNotLockedWarn : 36|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_ESCLNotUnlockWarn : 37|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_IDoutWarn : 38|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_ImmoLp : 40|1@1+ (1.0,0.0) [0.0|3.0] "" CLU,Dummy + SG_ CF_Gway_BCMRKEID : 41|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,Dummy + SG_ CF_Gway_VehicleNotPWarn : 44|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_DeactivationWarn : 45|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_KeyBATDischargeWarn : 46|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_SSBWarn : 47|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_SMKFobID : 48|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,Dummy + SG_ CF_Gway_SMKRKECmd : 51|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,Dummy + SG_ CF_Gway_AutoLightOption : 54|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_SJBDeliveryMode : 55|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_KeyoutLp : 56|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,Dummy + SG_ CF_Gway_SMKDispWarn : 57|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,Dummy + SG_ CF_Gway_WngBuz : 61|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,Dummy + +BO_ 339 TCS11: 8 ESC + SG_ TCS_REQ : 0|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB,TCU + SG_ MSR_C_REQ : 1|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,EPB,SCC,TCU + SG_ TCS_PAS : 2|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU,EMS,SCC,SPAS,TCU + SG_ TCS_GSC : 3|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,TCU + SG_ CF_Esc_LimoInfo : 4|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,SCC + SG_ ABS_DIAG : 6|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU,EMS,EPB + SG_ ABS_DEF : 7|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,ECS,EMS,EPB,SCC,SPAS,TCU + SG_ TCS_DEF : 8|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB,SCC,SPAS,TCU + SG_ TCS_CTL : 9|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB,SCC,SPAS,TCU + SG_ ABS_ACT : 10|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,ECS,EMS,EPB,LDWS_LKAS,SCC,SPAS,TCU + SG_ EBD_DEF : 11|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB,SPAS,TCU + SG_ ESP_PAS : 12|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,CLU,EMS,EPB,LDWS_LKAS,SCC,TCU + SG_ ESP_DEF : 13|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,ECS,EMS,EPB,LDWS_LKAS,SCC,TCU + SG_ ESP_CTL : 14|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,ECS,EMS,EPB,LDWS_LKAS,SCC,SPAS,TCU + SG_ TCS_MFRN : 15|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,EPB,TCU + SG_ DBC_CTL : 16|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB + SG_ DBC_PAS : 17|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB + SG_ DBC_DEF : 18|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB + SG_ HAC_CTL : 19|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU,EMS,EPB,TCU + SG_ HAC_PAS : 20|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU,EMS,EPB,TCU + SG_ HAC_DEF : 21|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU,EMS,EPB,TCU + SG_ ESS_STAT : 22|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,BCM,CLU,EMS,EPB + SG_ TQI_TCS : 24|8@1+ (0.390625,0.0) [0.0|99.609375] "%" EMS,EPB,TCU + SG_ TQI_MSR : 32|8@1+ (0.390625,0.0) [0.0|99.609375] "%" EMS,EPB,TCU + SG_ TQI_SLW_TCS : 40|8@1+ (0.390625,0.0) [0.0|99.609375] "%" EMS,EPB,TCU + SG_ CF_Esc_BrkCtl : 48|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ BLA_CTL : 49|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CGW,CLU + SG_ AliveCounter_TCS1 : 52|4@1+ (1.0,0.0) [0.0|14.0] "" EMS,EPB,LDWS_LKAS + SG_ CheckSum_TCS1 : 56|8@1+ (1.0,0.0) [0.0|255.0] "" EMS,EPB,LDWS_LKAS + +BO_ 1362 SNV11: 4 SNV + SG_ CF_SNV_DisplayControl : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,HUD + SG_ CF_Snv_BeepWarning : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,HUD + SG_ CF_Snv_WarningMessage : 4|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,HUD + SG_ CF_Snv_DetectionEnable : 7|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,CLU,HUD + SG_ CF_Snv_PedestrianDetect : 8|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU,HUD + SG_ CF_Snv_IRLampControl : 10|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU,HUD + +BO_ 593 MDPS12: 8 MDPS + SG_ CR_Mdps_StrColTq : 0|11@1+ (0.0078125,-8.0) [-8.0|7.9921875] "Nm" LDWS_LKAS + SG_ CF_Mdps_Def : 11|1@1+ (1.0,0.0) [0.0|1.0] "" ESC + SG_ CF_Mdps_ToiUnavail : 12|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS + SG_ CF_Mdps_ToiActive : 13|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS + SG_ CF_Mdps_ToiFlt : 14|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS + SG_ CF_Mdps_FailStat : 15|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS + SG_ CF_Mdps_MsgCount2 : 16|8@1+ (1.0,0.0) [0.0|255.0] "" ESC,LDWS_LKAS + SG_ CF_Mdps_Chksum2 : 24|8@1+ (1.0,0.0) [0.0|255.0] "" ESC,LDWS_LKAS + SG_ CF_Mdps_SErr : 37|1@1+ (1.0,0.0) [0.0|1.0] "" ESC + SG_ CR_Mdps_StrTq : 40|12@1+ (0.01,-20.48) [-20.48|20.47] "Nm" ESC + SG_ CR_Mdps_OutTq : 52|12@1+ (0.1,-204.8) [-204.8|204.7] "" ESC,LDWS_LKAS + +BO_ 1360 IAP11: 3 IAP + SG_ CF_Iap_EcoPmodSwi : 0|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Iap_EcoPmodAct : 1|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Iap_ReqWarn : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1356 TCU_DCT14: 8 TCU + SG_ Vehicle_Stop_Time : 0|5@1+ (1.0,0.0) [0.0|0.0] "" CLU + SG_ HILL_HOLD_WARNING : 5|1@1+ (1.0,0.0) [0.0|0.0] "" CLU + +BO_ 1353 BAT11: 8 EMS + SG_ BAT_SNSR_I : 0|16@1+ (0.01,-327.0) [-327.0|328.0] "A" CGW,CUBIS,IBOX,TMU + SG_ BAT_SOC : 16|8@1+ (1.0,0.0) [0.0|100.0] "%" CGW,CUBIS,IBOX,TMU + SG_ BAT_SNSR_V : 24|14@1+ (0.0010,6.0) [6.0|18.0] "V" CGW,CUBIS,IBOX,TMU + SG_ BAT_SNSR_Temp : 38|9@1- (0.5,-40.0) [-40.0|125.0] "deg" CGW,CUBIS,IBOX,TMU + SG_ BAT_SNSR_State : 47|1@1+ (1.0,0.0) [0.0|1.0] "" CGW,CUBIS,IBOX,TMU + SG_ BAT_SOH : 48|7@1+ (1.0,0.0) [0.0|100.0] "%" CGW,CUBIS,IBOX,TMU + SG_ BAT_SNSR_Invalid : 55|1@1+ (1.0,0.0) [0.0|1.0] "" CGW,CUBIS,IBOX,TMU + SG_ BAT_SOF : 56|7@1+ (0.1,0.0) [0.0|12.0] "V" CGW,CUBIS,IBOX,TMU + SG_ BAT_SNSR_Error : 63|1@1+ (1.0,0.0) [0.0|1.0] "" CGW,CUBIS,IBOX,TMU + +BO_ 1351 EMS15: 8 EMS + SG_ ECGPOvrd : 0|1@1+ (1.0,0.0) [0.0|1.0] "" ESC,IBOX,SCC + SG_ QECACC : 1|1@1+ (1.0,0.0) [0.0|1.0] "" ESC,IBOX + SG_ ECFail : 2|1@1+ (1.0,0.0) [0.0|1.0] "" ESC,IBOX + SG_ SwitchOffCondExt : 3|1@1+ (1.0,0.0) [0.0|1.0] "" ESC,IBOX + SG_ BLECFail : 4|1@1+ (1.0,0.0) [0.0|1.0] "" ESC,IBOX + SG_ CF_Ems_IsaAct : 5|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ FA_PV_CAN : 8|8@1+ (0.3906,0.0) [0.0|99.2] "%" IBOX,LDWS_LKAS,TCU + SG_ IntAirTemp : 16|8@1+ (0.75,-48.0) [-48.0|143.25] "deg" _4WD,ECS,EPB,IBOX,TCU + SG_ STATE_DC_OBD : 24|7@1+ (1.0,0.0) [0.0|127.0] "" IBOX,TCU + SG_ INH_DC_OBD : 31|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,TCU + SG_ CTR_IG_CYC_OBD : 32|16@1+ (1.0,0.0) [0.0|65535.0] "" ACU,IBOX,TCU + SG_ CTR_CDN_OBD : 48|16@1+ (1.0,0.0) [0.0|65535.0] "" IBOX,TCU + +BO_ 1350 DI_BOX12: 8 DI_BOX + SG_ CF_DiBox_FrtInjVDiagReg0 : 0|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_FrtInjVDiagReg1 : 8|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_FrtInjVDiagReg2 : 16|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_SedInjVDiagReg0 : 24|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_SedInjVDiagReg1 : 32|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CF_DiBox_SedInjVDiagReg2 : 40|8@1+ (1.0,0.0) [0.0|255.0] "" EMS + SG_ CR_DiBox_BatVol : 48|8@1+ (0.1,0.0) [0.0|25.5] "V" EMS + SG_ CF_DiBox_SedInjVChg : 56|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_DiBox_FrtInjVChg : 57|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_DiBox_SedInjVErrSPI : 58|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_DiBox_FrtInjVErrSPI : 59|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + +BO_ 1349 EMS14: 8 EMS + SG_ IMMO_LAMP_STAT : 0|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ L_MIL : 1|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,CUBIS,IBOX + SG_ IM_STAT : 2|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ AMP_CAN : 3|5@1+ (10.731613,458.98) [458.98|791.660003] "mmHg" CLU,IBOX,TCU,TPMS + SG_ BAT_Alt_FR_Duty : 8|8@1+ (0.4,0.0) [0.0|100.0] "%" CGW,CUBIS,IBOX,TMU + SG_ VB : 24|8@1+ (0.1015625,0.0) [0.0|25.8984375] "V" CLU,CUBIS,DATC,EPB,FPCM,IBOX + SG_ EMS_VS : 32|12@1+ (0.0625,0.0) [0.0|255.875] "km/h" CLU + SG_ TEMP_FUEL : 56|8@1+ (0.75,-48.0) [-48.0|143.25] "deg" FPCM + +BO_ 68 DATC11: 8 DATC + SG_ CF_Datc_Type : 0|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ CF_Datc_VerMaj : 8|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ CF_Datc_VerMin : 16|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ CR_Datc_OutTempC : 24|8@1+ (0.5,-41.0) [-41.0|86.5] "deg" CLU,FPCM + SG_ CR_Datc_OutTempF : 32|8@1+ (1.0,-42.0) [-42.0|213.0] "deg" CLU + SG_ CF_Datc_IncarTemp : 40|8@1+ (0.5,-40.0) [-40.0|60.0] "deg" BCM,CLU + +BO_ 67 DATC13: 8 DATC + SG_ CF_Datc_TempDispUnit : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,IBOX + SG_ CF_Datc_ModDisp : 2|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ CF_Datc_IonClean : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_ChgReqDisp : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_IntakeDisp : 10|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_AutoDisp : 12|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_FrDefLed : 14|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,IBOX + SG_ CF_Datc_AutoDefogBlink : 16|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_ClmScanDisp : 18|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_AqsDisp : 20|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_AcDisp : 22|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_OpSts : 25|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Mtc_MaxAcDisp : 28|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_DualDisp : 30|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_PwrInf : 32|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ CF_Datc_RearManual : 38|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_RearAutoDisp : 40|2@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Datc_RearOffDisp : 42|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_RearClimateScnDisp : 44|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_RearChgReqDisp : 46|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_RearModDisp : 48|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ CF_Datc_RearBlwDisp : 52|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ CF_Datc_PSModDisp : 56|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ CF_Datc_FrontBlwDisp : 60|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,IBOX + +BO_ 66 DATC12: 8 DATC + SG_ CR_Datc_DrTempDispC : 0|8@1+ (0.5,14.0) [15.0|32.0] "deg" CLU,IBOX + SG_ CR_Datc_DrTempDispF : 8|8@1+ (1.0,56.0) [58.0|90.0] "deg" CLU,IBOX + SG_ CR_Datc_PsTempDispC : 16|8@1+ (0.5,14.0) [15.0|32.0] "deg" CLU,IBOX + SG_ CR_Datc_PsTempDispF : 24|8@1+ (1.0,56.0) [58.0|90.0] "deg" CLU,IBOX + SG_ CR_Datc_RearDrTempDispC : 40|8@1+ (0.5,14.0) [15.0|32.0] "deg" CLU + SG_ CR_Datc_RearDrTempDispF : 48|8@1+ (1.0,58.0) [58.0|90.0] "deg" CLU + SG_ CF_Datc_CO2_Warning : 56|8@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1345 CGW1: 8 BCM + SG_ CF_Gway_IGNSw : 0|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU,ECS,EMS,EPB,ESC,IBOX,LVR,MDPS,SAS,SCC,ECS,EMS,EPB,ESC,IBOX,LVR,MDPS,SAS,SCC + SG_ CF_Gway_RKECmd : 3|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,ECS,EMS,IBOX,ECS,EMS,IBOX + SG_ CF_Gway_DrvKeyLockSw : 6|1@1+ (1.0,0.0) [0.0|1.0] "" ECS,EMS,IBOX,ECS,EMS,IBOX + SG_ CF_Gway_DrvKeyUnlockSw : 7|1@1+ (1.0,0.0) [0.0|1.0] "" ECS,EMS,IBOX,ECS,EMS,IBOX + SG_ CF_Gway_DrvDrSw : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ECS,EMS,EPB,ESC,IBOX,SCC,TCU,ECS,EMS,EPB,ESC,IBOX,SCC,TCU + SG_ CF_Gway_DrvSeatBeltSw : 10|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,EPB,ESC,IBOX,PSB,TCU,EMS,EPB,ESC,IBOX,PSB,TCU + SG_ CF_Gway_TrunkTgSw : 12|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ECS,EMS,EPB,ESC,IBOX,ECS,EMS,EPB,ESC,IBOX + SG_ CF_Gway_AstSeatBeltSw : 14|2@1+ (1.0,0.0) [0.0|3.0] "" IBOX,PSB,IBOX,PSB + SG_ CF_Gway_SMKOption : 16|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,IBOX,EMS,IBOX,SMK + SG_ CF_Gway_HoodSw : 17|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,EMS,EPB,ESC,IBOX,EMS,EPB,ESC,IBOX + SG_ CF_Gway_TurnSigLh : 19|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,EMS,IBOX,LCA,LDWS_LKAS,SCC,EMS,IBOX,LCA,LDWS_LKAS,SCC + SG_ CF_Gway_WiperIntT : 21|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,EMS,IBOX,LDWS_LKAS,EMS,ESC,IBOX,LDWS_LKAS + SG_ CF_Gway_WiperIntSw : 24|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,IBOX,LDWS_LKAS,EMS,ESC,IBOX,LDWS_LKAS + SG_ CF_Gway_WiperLowSw : 25|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,IBOX,LDWS_LKAS,EMS,ESC,IBOX,LDWS_LKAS + SG_ CF_Gway_WiperHighSw : 26|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,IBOX,LDWS_LKAS,EMS,ESC,IBOX,LDWS_LKAS + SG_ CF_Gway_WiperAutoSw : 27|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,IBOX,LDWS_LKAS,EMS,ESC,IBOX,LDWS_LKAS + SG_ CF_Gway_RainSnsState : 28|3@1+ (1.0,0.0) [0.0|7.0] "" AFLS,EMS,IBOX,LDWS_LKAS,AFLS,EMS,ESC,IBOX,LDWS_LKAS + SG_ CF_Gway_HeadLampLow : 31|1@1+ (1.0,0.0) [0.0|1.0] "" AFLS,CLU,EMS,IBOX,LDWS_LKAS,SNV,AFLS,EMS,IBOX,LDWS_LKAS,SNV + SG_ CF_Gway_HeadLampHigh : 32|1@1+ (1.0,0.0) [0.0|1.0] "" AFLS,CLU,EMS,IBOX,LDWS_LKAS,AFLS,EMS,IBOX,LDWS_LKAS + SG_ CF_Gway_HazardSw : 33|2@1+ (1.0,0.0) [0.0|3.0] "" ABS,EMS,ESC,IBOX,LCA,LDWS_LKAS,ABS,EMS,ESC,IBOX,LCA,LDWS_LKAS + SG_ CF_Gway_AstDrSw : 35|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX,IBOX + SG_ CF_Gway_DefoggerRly : 36|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX,EMS,IBOX + SG_ CF_Gway_ALightStat : 37|1@1+ (1.0,0.0) [0.0|1.0] "" AFLS,IBOX,LDWS_LKAS,AFLS,IBOX,LDWS_LKAS + SG_ CF_Gway_LightSwState : 38|2@1+ (1.0,0.0) [0.0|3.0] "" AFLS,IBOX,LDWS_LKAS,AFLS,IBOX,LDWS_LKAS + SG_ CF_Gway_Frt_Fog_Act : 40|1@1+ (1.0,0.0) [0.0|1.0] "" AFLS,CLU,IBOX,LDWS_LKAS,AFLS,IBOX,LDWS_LKAS + SG_ CF_Gway_TSigRHSw : 41|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,LDWS_LKAS,IBOX,LDWS_LKAS + SG_ CF_Gway_TSigLHSw : 42|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,LDWS_LKAS,IBOX,LDWS_LKAS + SG_ CF_Gway_DriveTypeOption : 43|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX,LDWS_LKAS,IBOX,LDWS_LKAS + SG_ CF_Gway_StarterRlyState : 44|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX,EMS,IBOX,SMK + SG_ CF_Gway_PassiveAccessLock : 45|2@1+ (1.0,0.0) [0.0|7.0] "" CLU,ECS,EMS,IBOX,ECS,EMS,IBOX,SMK + SG_ CF_Gway_WiperMistSw : 47|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,IBOX,LDWS_LKAS + SG_ CF_Gway_PassiveAccessUnlock : 48|2@1+ (1.0,0.0) [0.0|7.0] "" CLU,ECS,EMS,IBOX,ECS,EMS,IBOX,SMK + SG_ CF_Gway_RrSunRoofOpenState : 50|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,DATC,IBOX + SG_ CF_Gway_PassingSW : 51|1@1+ (1.0,0.0) [0.0|1.0] "" AFLS,IBOX,LDWS_LKAS,AFLS,IBOX,LDWS_LKAS + SG_ CF_Gway_HBAControlMode : 52|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,LDWS_LKAS,IBOX,LDWS_LKAS + SG_ CF_Gway_HLpHighSw : 53|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,LDWS_LKAS,IBOX,LDWS_LKAS + SG_ CF_Gway_InhibitRMT : 54|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,EPB,ESC,IBOX,LCA,LDWS_LKAS,MDPS,PGS,SCC,SPAS,TPMS,EPB,ESC,IBOX,LCA,LDWS_LKAS,PGS,SCC,SPAS,TPMS + SG_ CF_Gway_RainSnsOption : 56|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ C_SunRoofOpenState : 57|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,DATC,IBOX,DATC,IBOX + SG_ CF_Gway_Ign1 : 58|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_Ign2 : 59|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Gway_ParkBrakeSw : 60|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ESC,IBOX,SCC,ESC,IBOX,SCC + SG_ CF_Gway_TurnSigRh : 62|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,EMS,IBOX,LCA,LDWS_LKAS,SCC,EMS,IBOX,LCA,LDWS_LKAS,SCC + +BO_ 64 DATC14: 8 DATC + SG_ CF_Datc_AqsLevelOut : 0|4@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Datc_DiagMode : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CR_Datc_SelfDiagCode : 8|8@1+ (1.0,-1.0) [0.0|254.0] "" CLU + SG_ DATC_SyncDisp : 16|4@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ DATC_OffDisp : 20|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ DATC_SmartVentDisp : 22|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ DATC_SmartVentOnOffStatus : 24|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ DATC_AutoDefogSysOff_Disp : 26|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ DATC_ADSDisp : 28|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 832 LKAS11: 8 LDWS_LKAS + SG_ CF_Lkas_Icon : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,IBOX,PSB + SG_ CF_Lkas_LdwsSysState : 2|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,IBOX,PSB + SG_ CF_Lkas_SysWarning : 6|4@1+ (1.0,0.0) [0.0|15.0] "" BCM,CLU + SG_ CF_Lkas_LdwsLHWarning : 10|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU,PSB + SG_ CF_Lkas_LdwsRHWarning : 12|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU,PSB + SG_ CF_Lkas_HbaLamp : 14|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Lkas_FcwBasReq : 15|1@1+ (1.0,0.0) [0.0|1.0] "" ABS,ESC + SG_ CR_Lkas_StrToqReq : 16|11@1+ (1.0,-1024.0) [-1024.0|1024.0] "" MDPS + SG_ CF_Lkas_ActToi : 27|1@1+ (1.0,0.0) [0.0|1.0] "" MDPS + SG_ CF_Lkas_ToiFlt : 28|1@1+ (1.0,0.0) [0.0|1.0] "" MDPS + SG_ CF_Lkas_HbaSysState : 29|3@1+ (1.0,0.0) [0.0|7.0] "" BCM,CLU + SG_ CF_Lkas_FcwOpt : 32|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Lkas_HbaOpt : 34|2@1+ (1.0,0.0) [0.0|1.0] "" BCM,CGW + SG_ CF_Lkas_MsgCount : 36|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,MDPS + SG_ CF_Lkas_FcwSysState : 40|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Lkas_FcwCollisionWarning : 43|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Lkas_FusionState : 45|2@1+ (1.0,0.0) [0.0|3.0] "" SCC + SG_ CF_Lkas_Chksum : 48|8@1+ (1.0,0.0) [0.0|255.0] "" MDPS + SG_ CF_Lkas_FcwOpt_USM : 56|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Lkas_LdwsOpt_USM : 59|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,MDPS + SG_ CF_Lkas_Unknown1 : 47|1@1+ (1,0) [0|3] "" XXX + SG_ CF_Lkas_Unknown2 : 63|2@0+ (1,0) [0|3] "" XXX + +BO_ 1342 LKAS12: 6 LDWS_LKAS + SG_ CF_Lkas_TsrSlifOpt : 10|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_LkasTsrStatus : 12|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Lkas_TsrSpeed_Display_Clu : 16|8@1+ (1.0,0.0) [0.0|255.0] "" CLU + SG_ CF_LkasTsrSpeed_Display_Navi : 24|8@1+ (1.0,0.0) [0.0|255.0] "" BCM,CLU + SG_ CF_Lkas_TsrAddinfo_Display : 32|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1338 TMU_GW_E_01: 8 CLU + SG_ CF_Gway_TeleReqDrLock : 0|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Gway_TeleReqDrUnlock : 2|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Gway_TeleReqHazard : 4|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Gway_TeleReqHorn : 6|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Gway_TeleReqEngineOperate : 8|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + +BO_ 1078 PAS11: 4 BCM + SG_ CF_Gway_PASDisplayFLH : 0|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU,AVM + SG_ CF_Gway_PASDisplayFRH : 3|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU,AVM + SG_ CF_Gway_PASRsound : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,Dummy + SG_ CF_Gway_PASDisplayFCTR : 8|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU,AVM + SG_ CF_Gway_PASDisplayRCTR : 11|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU,PGS,AVM + SG_ CF_Gway_PASFsound : 14|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,Dummy + SG_ CF_Gway_PASDisplayRLH : 16|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU,PGS,AVM + SG_ CF_Gway_PASDisplayRRH : 19|3@1+ (1.0,0.0) [0.0|7.0] "" AVM,CLU,PGS,AVM + SG_ CF_Gway_PASCheckSound : 22|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,Dummy + SG_ CF_Gway_PASSystemOn : 24|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,Dummy + SG_ CF_Gway_PASOption : 26|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_PASDistance : 28|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + +BO_ 48 EMS18: 6 EMS + SG_ CF_Ems_DC1NumPerMSV : 0|8@1+ (1.0,0.0) [0.0|255.0] "" DI_BOX + SG_ CF_Ems_DC2NumPerMSV : 8|16@1+ (1.0,0.0) [0.0|65535.0] "" DI_BOX + SG_ CR_Ems_DutyCyc1MSV : 24|8@1+ (0.1953,0.0) [0.0|49.8] "%" DI_BOX + SG_ CR_Ems_DutyCyc2MSV : 32|8@1+ (0.13725,0.0) [0.0|35.0] "%" DI_BOX + SG_ CR_Ems_DutyCyc3MSV : 40|8@1+ (0.392,0.0) [0.0|100.0] "%" DI_BOX + +BO_ 1322 CLU15: 8 CLU + SG_ CF_Clu_VehicleSpeed : 0|8@1+ (1.0,0.0) [0.0|255.0] "" BCM + SG_ CF_Clu_InhibitP : 9|1@1+ (1.0,0.0) [0.0|1.0] "" BCM + SG_ CF_Clu_InhibitR : 10|1@1+ (1.0,0.0) [0.0|1.0] "" BCM + SG_ CF_Clu_InhibitN : 11|1@1+ (1.0,0.0) [0.0|1.0] "" BCM + SG_ CF_Clu_InhibitD : 12|1@1+ (1.0,0.0) [0.0|1.0] "" BCM + SG_ CF_Clu_HudInfoSet : 13|7@1+ (1.0,0.0) [0.0|127.0] "" HUD + SG_ CF_Clu_HudFontColorSet : 20|2@1+ (1.0,0.0) [0.0|3.0] "" HUD + SG_ CF_Clu_HudBrightUpSW : 22|2@1+ (1.0,0.0) [0.0|3.0] "" HUD + SG_ CF_Clu_HudBrightDnSW : 24|2@1+ (1.0,0.0) [0.0|3.0] "" HUD + SG_ CF_Clu_HudHeightUpSW : 26|2@1+ (1.0,0.0) [0.0|3.0] "" HUD + SG_ CF_Clu_HudHeightDnSW : 28|2@1+ (1.0,0.0) [0.0|3.0] "" HUD + SG_ CF_Clu_HudSet : 30|1@1+ (1.0,0.0) [0.0|1.0] "" HUD + SG_ CF_Clu_HudFontSizeSet : 31|2@1+ (1.0,0.0) [0.0|3.0] "" HUD + SG_ CF_Clu_LanguageInfo : 33|5@1+ (1.0,0.0) [0.0|31.0] "" BCM,PGS + SG_ CF_Clu_ClusterSound : 38|1@1- (1.0,0.0) [0.0|0.0] "" BCM,CGW,FATC + +BO_ 1066 _4WD13: 6 _4WD + SG_ _4WD_CURRENT : 0|8@1+ (0.390625,0.0) [-50.0|50.0] "A" TCU + SG_ _4WD_POSITION : 8|16@1+ (0.015625,0.0) [-180.0|180.0] "Deg" TCU + SG_ _4WD_CLU_THERM_STR : 24|8@1+ (1.0,0.0) [0.0|100.0] "%" TCU + SG_ _4WD_STATUS : 32|8@1+ (1.0,0.0) [0.0|15.0] "" ESC,TCU + +BO_ 1065 _4WD12: 8 _4WD + SG_ Ster_Pos : 0|16@1+ (1.0,-600.0) [-600.0|600.0] "Deg" ESC + SG_ FRSS : 16|8@1+ (1.0,0.0) [0.0|254.0] "km/h" ESC + SG_ FLSS : 24|8@1+ (1.0,0.0) [0.0|254.0] "km/h" ESC + SG_ RRSS : 32|8@1+ (1.0,0.0) [0.0|254.0] "km/h" ESC + SG_ RLSS : 40|8@1+ (1.0,0.0) [0.0|254.0] "km/h" ESC + SG_ CLU_PRES : 48|16@1+ (0.0625,-50.0) [-50.0|50.0] "Bar" ESC + +BO_ 809 EMS12: 8 EMS + SG_ CONF_TCU m1 : 0|6@1+ (1.0,0.0) [0.0|63.0] "" _4WD,ACU,BCM,CLU,DATC,EPB,ESC,IBOX,LCA,SMK + SG_ CAN_VERS m0 : 0|6@1+ (1.0,0.0) [0.0|7.7] "" _4WD,ABS,ESC,IBOX + SG_ TQ_STND m3 : 0|6@1+ (10.0,0.0) [0.0|630.0] "Nm" _4WD,DATC,ECS,EPB,ESC,FATC,IBOX + SG_ OBD_FRF_ACK m2 : 0|6@1+ (1.0,0.0) [0.0|63.0] "" _4WD,ESC,IBOX + SG_ MUL_CODE M : 6|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,ABS,ACU,BCM,CLU,DATC,ECS,EPB,ESC,IBOX,LCA,SMK,TCU + SG_ TEMP_ENG : 8|8@1+ (0.75,-48.0) [-48.0|143.25] "deg" _4WD,BCM,CLU,DATC,EPB,ESC,IBOX,SMK,TCU + SG_ MAF_FAC_ALTI_MMV : 16|8@1+ (0.00781,0.0) [0.0|1.99155] "" IBOX,TCU + SG_ VB_OFF_ACT : 24|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,TCU + SG_ ACK_ES : 25|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,IBOX + SG_ CONF_MIL_FMY : 26|3@1+ (1.0,0.0) [0.0|7.0] "" ESC,IBOX,TCU + SG_ OD_OFF_REQ : 29|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,TCU + SG_ ACC_ACT : 30|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ABS,CLU,ESC,IAP,IBOX,SCC,TCU + SG_ CLU_ACK : 31|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EPB,ESC,IBOX + SG_ BRAKE_ACT : 32|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,ABS,ACU,AFLS,CLU,DATC,ECS,EPB,ESC,IBOX,LDWS_LKAS,TCU + SG_ ENG_CHR : 34|4@1+ (1.0,0.0) [0.0|15.0] "" _4WD,ABS,ACU,CLU,DATC,EPB,ESC,FATC,IBOX,SCC,SMK,TCU + SG_ GP_CTL : 38|2@1+ (1.0,0.0) [0.0|3.0] "" IBOX + SG_ TPS : 40|8@1+ (0.4694836,-15.0234742) [-15.0234742|104.6948357] "%" _4WD,ABS,ACU,CLU,DATC,ECS,EPB,ESC,IBOX,TCU + SG_ PV_AV_CAN : 48|8@1+ (0.3906,0.0) [0.0|99.603] "%" _4WD,AAF,ABS,ACU,AFLS,CLU,DATC,EPB,ESC,IAP,IBOX,LDWS_LKAS,SCC,TCU + SG_ ENG_VOL : 56|8@1+ (0.1,0.0) [0.0|25.5] "liter" _4WD,ABS,ACU,BCM,CLU,DATC,EPB,ESC,IBOX,LDWS_LKAS,SCC,SMK + +BO_ 1064 _4WD11: 8 _4WD + SG_ _4WD_TYPE : 0|2@1+ (1.0,0.0) [0.0|3.0] "" ACU,ESC,TPMS + SG_ _4WD_SUPPORT : 2|2@1+ (1.0,0.0) [0.0|3.0] "" ABS,ESC,TPMS + SG_ _4WD_ERR : 8|8@1+ (1.0,0.0) [0.0|255.0] "" CLU,ESC + SG_ CLU_DUTY : 16|8@1+ (1.0,0.0) [0.0|64.0] "%" ABS,ESC + SG_ R_TIRE : 24|8@1+ (1.0,200.0) [200.0|455.0] "mm" ABS,ESC,TPMS + SG_ _4WD_SW : 32|8@1+ (1.0,0.0) [0.0|9.9] "" ESC + SG_ _2H_ACT : 40|1@1+ (1.0,0.0) [0.0|1.0] "" ABS,ESC + SG_ _4H_ACT : 41|1@1+ (1.0,0.0) [0.0|1.0] "" ABS,CLU,ESC,TPMS + SG_ LOW_ACT : 42|1@1+ (1.0,0.0) [0.0|1.0] "" ABS,ESC,TCU,TPMS + SG_ AUTO_ACT : 43|1@1+ (1.0,0.0) [0.0|1.0] "" ABS,ESC,TPMS + SG_ LOCK_ACT : 44|1@1+ (1.0,0.0) [0.0|1.0] "" ABS,CLU,ESC,TPMS + SG_ _4WD_TQC_CUR : 48|16@1+ (1.0,0.0) [0.0|65535.0] "Nm" ABS,ESC + +BO_ 1319 HU_GW_E_01: 8 CLU + SG_ C_ADrLNValueSet : 0|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + SG_ C_ADrUNValueSet : 4|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + SG_ C_TwUnNValueSet : 8|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_ABuzzerNValueSet : 10|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_ArmWKeyNValueSet : 12|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_PSMNValueSet : 14|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_SCMNValueSet : 16|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_HLEscortNValueSet : 18|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_WELNValueSet : 20|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_TriTurnLNValueSet : 22|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_SNVWarnNValueSet : 24|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_LkasWarnNValueSet : 26|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + +BO_ 1318 HU_GW_E_00: 8 CLU + SG_ C_ADrLURValueReq : 0|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_TwUnRValueReq : 2|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_AlarmRValueReq : 4|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_IMSRValueReq : 6|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_HLEscortRValueReq : 8|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_WELRValueReq : 10|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_TriTurnLRValueReq : 12|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_SNVWarnRValueReq : 14|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ C_LkasWarnRValueReq : 16|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + +BO_ 1317 GW_HU_E_01: 8 BCM + SG_ C_ADrLRValue : 0|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ C_ADrURValue : 4|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ C_TwUnRValue : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_ABuzzerRValue : 10|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_ArmWKeyRValue : 12|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_PSMRValue : 14|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_SCMRValue : 16|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_HLEscortRValue : 18|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_WELRValue : 20|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_TriTurnLRValue : 22|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1316 GW_HU_E_00: 8 BCM + SG_ C_ADrLUNValueConf : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_TwUnNValueConf : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_AlarmNValueConf : 4|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_PSMNValueConf : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_SCMNValueConf : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_HLEscortNValueConf : 10|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_WELNValueConf : 12|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_TriTurnLNValueConf : 14|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1315 GW_SWRC_PE: 8 BCM + SG_ C_ModeSW : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_MuteSW : 4|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_SeekDnSW : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_SeekUpSW : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_BTPhoneCallSW : 10|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_BTPhoneHangUpSW : 12|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_DISCDownSW : 14|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_DISCUpSW : 16|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_SdsSW : 18|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_MTSSW : 20|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_VolDnSW : 22|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_VolUpSW : 24|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1314 GW_IPM_PE_1: 8 BCM + SG_ C_AV_Tail : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_ParkingBrakeSW : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_RKECMD : 4|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ C_BAState : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_IGNSW : 12|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ C_CountryCfg : 16|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ C_TailLampActivity : 26|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ RearSW_RSELockOnOff : 28|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_SMKTeleCrankingState : 32|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_SMKTeleCrankingFailRes : 34|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1057 SCC12: 8 SCC + SG_ CF_VSM_Prefill : 0|1@1+ (1.0,0.0) [0.0|1.0] "" ESC + SG_ CF_VSM_DecCmdAct : 1|1@1+ (1.0,0.0) [0.0|1.0] "" ESC + SG_ CF_VSM_HBACmd : 2|2@1+ (1.0,0.0) [0.0|3.0] "" ESC + SG_ CF_VSM_Warn : 4|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ESC,IAP + SG_ CF_VSM_Stat : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ESC,PSB + SG_ CF_VSM_BeltCmd : 8|3@1+ (1.0,0.0) [0.0|7.0] "" ESC,PSB + SG_ ACCFailInfo : 11|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,CUBIS,ESC,IBOX + SG_ ACCMode : 13|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ESC,IBOX,TCU + SG_ StopReq : 15|1@1+ (1.0,0.0) [0.0|1.0] "" EPB,ESC + SG_ CR_VSM_DecCmd : 16|8@1+ (0.01,0.0) [0.0|2.55] "g" ESC + SG_ aReqMax : 24|11@1+ (0.01,-10.23) [-10.23|10.24] "m/s^2" EMS,ESC,TCU + SG_ TakeOverReq : 35|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,ESC,TCU + SG_ PreFill : 36|1@1+ (1.0,0.0) [0.0|1.0] "" ESC,TCU + SG_ aReqMin : 37|11@1+ (0.01,-10.23) [-10.23|10.24] "m/s^2" EMS,ESC,TCU + SG_ CF_VSM_ConfMode : 48|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ESC + SG_ AEB_Failinfo : 50|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ESC + SG_ AEB_Status : 52|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ESC + SG_ AEB_CmdAct : 54|1@1+ (1.0,0.0) [0.0|1.0] "" ESC + SG_ AEB_StopReq : 55|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,ESC + SG_ CR_VSM_Alive : 56|4@1+ (1.0,0.0) [0.0|15.0] "" ESC,PSB + SG_ CR_VSM_ChkSum : 60|4@1+ (1.0,0.0) [0.0|15.0] "" ESC,PSB + +BO_ 1313 GW_DDM_PE: 8 BCM + SG_ C_DRVDoorStatus : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_ASTDoorStatus : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_RLDoorStatus : 4|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_RRDoorStatus : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_TrunkStatus : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ C_OSMirrorStatus : 10|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1056 SCC11: 8 SCC + SG_ MainMode_ACC : 0|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,ESC + SG_ SCCInfoDisplay : 1|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,ESC + SG_ AliveCounterACC : 4|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,EMS,ESC,TCU + SG_ VSetDis : 8|8@1+ (1.0,0.0) [0.0|255.0] "km/h or MPH" CLU,ESC,TCU + SG_ ObjValid : 16|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,ESC,TCU + SG_ DriverAlertDisplay : 17|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,ESC + SG_ TauGapSet : 19|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,ESC,TCU + SG_ ACC_ObjStatus : 22|2@1+ (1.0,0.0) [0.0|3.0] "" ABS,ESC + SG_ ACC_ObjLatPos : 24|9@1+ (0.1,-20.0) [-20.0|31.1] "m" ABS,ESC + SG_ ACC_ObjDist : 33|11@1+ (0.1,0.0) [0.0|204.7] "m" ABS,ESC + SG_ ACC_ObjRelSpd : 44|12@1+ (0.1,-170.0) [-170.0|239.5] "m/s" ABS,ESC + SG_ Navi_SCC_Curve_Status : 56|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ Navi_SCC_Curve_Act : 58|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ Navi_SCC_Camera_Act : 60|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ Navi_SCC_Camera_Status : 62|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + +BO_ 1312 CGW3: 8 BCM + SG_ CR_Photosensor_LH : 0|8@1+ (78.125,0.0) [0.0|20000.0] "" DATC,DATC + SG_ CR_Photosensor_RH : 10|8@1+ (78.125,0.0) [0.0|20000.0] "" DATC,DATC + SG_ CF_Hoodsw_memory : 22|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,EMS + SG_ C_MirOutTempSns : 24|8@1+ (0.5,-40.5) [-40.0|60.0] "deg" AAF,CLU,DATC,EMS,SPAS,AAF,DATC,EMS,SPAS + +BO_ 544 ESP12: 8 ESC + SG_ LAT_ACCEL : 0|11@1+ (0.01,-10.23) [-10.23|10.24] "m/s^2" _4WD,ECS,IBOX,LCA,LDWS_LKAS,MDPS,PSB,SCC,TCU + SG_ LAT_ACCEL_STAT : 11|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,IBOX,LDWS_LKAS,MDPS,PSB,SCC,TCU + SG_ LAT_ACCEL_DIAG : 12|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,IBOX,LDWS_LKAS,MDPS,PSB,SCC,TCU + SG_ LONG_ACCEL : 13|11@1+ (0.01,-10.23) [-10.23|10.24] "m/s^2" _4WD,ECS,EMS,EPB,IBOX,LCA,LDWS_LKAS,PSB,SCC,SPAS,TCU + SG_ LONG_ACCEL_STAT : 24|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB,IBOX,LDWS_LKAS,PSB,SCC,SPAS,TCU + SG_ LONG_ACCEL_DIAG : 25|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB,IBOX,LDWS_LKAS,PSB,SCC,SPAS,TCU + SG_ CYL_PRES : 26|12@1+ (0.1,0.0) [0.0|409.5] "Bar" _4WD,ECS,EMS,EPB,IBOX,LDWS_LKAS,PSB,SCC,TCU + SG_ CYL_PRES_STAT : 38|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ECS,EMS,EPB,IBOX,LDWS_LKAS,PSB,SCC,TCU + SG_ CYL_PRESS_DIAG : 39|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ECS,EMS,EPB,IBOX,PSB,SCC,TCU + SG_ YAW_RATE : 40|13@1+ (0.01,-40.95) [-40.95|40.96] "" _4WD,AFLS,IBOX,LCA,LDWS_LKAS,MDPS,PSB,SCC,SPAS,TCU + SG_ YAW_RATE_STAT : 53|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,AFLS,IBOX,LCA,LDWS_LKAS,MDPS,PSB,SCC,SPAS,TCU + SG_ YAW_RATE_DIAG : 54|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,AFLS,IBOX,LCA,LDWS_LKAS,MDPS,PSB,SCC,SPAS,TCU + SG_ ESP12_AliveCounter : 56|4@1+ (1.0,0.0) [0.0|15.0] "" _4WD,EMS,LPI,TCU,TMU + SG_ ESP12_Checksum : 60|4@1+ (1.0,0.0) [0.0|15.0] "" _4WD,EMS,LPI,TCU,TMU + +BO_ 1307 CLU16: 8 CLU + SG_ CF_Clu_TirePressUnitNValueSet : 0|3@1+ (1.0,0.0) [0.0|7.0] "" TPMS + SG_ CF_Clu_SlifNValueSet : 3|2@1+ (1.0,0.0) [0.0|3.0] "" LDWS_LKAS + SG_ CF_Clu_RearWiperNValueSet : 12|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + +BO_ 790 EMS11: 8 EMS + SG_ SWI_IGK : 0|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ABS,ACU,AHLS,CUBIS,DI_BOX,ECS,EPB,ESC,IBOX,LDWS_LKAS,MDPS,REA,SAS,SCC,TCU + SG_ F_N_ENG : 1|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,AFLS,CLU,CUBIS,DATC,ECS,EPB,ESC,IBOX,MDPS,SCC,TCU + SG_ ACK_TCS : 2|1@1+ (1.0,0.0) [0.0|1.0] "" ESC,IBOX + SG_ PUC_STAT : 3|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU,DATC,IBOX,TCU + SG_ TQ_COR_STAT : 4|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,ESC,IBOX,TCU + SG_ RLY_AC : 6|1@1+ (1.0,0.0) [0.0|1.0] "" DATC,IBOX,TCU + SG_ F_SUB_TQI : 7|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ECS,EPB,ESC,IBOX,TCU + SG_ TQI_ACOR : 8|8@1+ (0.390625,0.0) [0.0|99.6094] "%" _4WD,EPB,ESC,IBOX,TCU + SG_ N : 16|16@1+ (0.25,0.0) [0.0|16383.75] "rpm" _4WD,ACU,AFLS,CLU,CUBIS,DATC,ECS,EPB,ESC,FPCM,IBOX,MDPS,SCC,TCU + SG_ TQI : 32|8@1+ (0.390625,0.0) [0.0|99.6094] "%" _4WD,ECS,EPB,ESC,IBOX,TCU + SG_ TQFR : 40|8@1+ (0.390625,0.0) [0.0|99.6094] "%" _4WD,EPB,ESC,IBOX,TCU + SG_ VS : 48|8@1+ (1.0,0.0) [0.0|254.0] "km/h" _4WD,AAF,ACU,AHLS,BCM,CLU,DATC,ECS,EPB,IBOX,LCA,LDWS_LKAS,LVR,MDPS,ODS,SCC,SMK,SPAS,TCU,TPMS + SG_ RATIO_TQI_BAS_MAX_STND : 56|8@1+ (0.0078,0.0) [0.0|2.0] "" _4WD,IBOX,TCU + +BO_ 1301 CLU14: 8 CLU + SG_ CF_Clu_ADrUNValueSet : 0|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + SG_ CF_Clu_ADrLNValueSet : 3|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + SG_ CF_Clu_EscortHLNValueSet : 6|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Clu_DoorLSNValueSet : 8|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + SG_ CF_Clu_PSMNValueSet : 11|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + SG_ CF_Clu_TTUnlockNValueSet : 14|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Clu_PTGMNValueSet : 16|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Clu_SCMNValueSet : 18|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Clu_WlightNValueSet : 20|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Clu_TempUnitNValueSet : 22|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,DATC + SG_ CF_Clu_MoodLpNValueSet : 24|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + SG_ CF_Clu_TrfChgSet : 27|2@1+ (1.0,0.0) [0.0|3.0] "" AFLS + SG_ CF_Clu_OTTurnNValueSet : 29|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + SG_ CF_Clu_LcaNValueSet : 32|2@1+ (1.0,0.0) [0.0|3.0] "" LCA + SG_ CF_Clu_RctaNValueSet : 34|2@1+ (1.0,0.0) [0.0|3.0] "" LCA + SG_ CF_Clu_RcwNValueSet : 36|2@1+ (1.0,0.0) [0.0|3.0] "" LCA + SG_ CF_Clu_EscOffNValueSet : 38|3@1+ (1.0,0.0) [0.0|7.0] "" ESC + SG_ CF_Clu_SccNaviCrvNValueSet : 41|2@1+ (1.0,0.0) [0.0|3.0] "" SCC + SG_ CF_Clu_SccNaviCamNValueSet : 43|2@1+ (1.0,0.0) [0.0|3.0] "" SCC + SG_ CF_Clu_SccAebNValueSet : 45|2@1+ (1.0,0.0) [0.0|3.0] "" SCC + SG_ CF_Clu_LkasModeNValueSet : 47|2@1+ (1.0,0.0) [0.0|3.0] "" LDWS_LKAS + SG_ CF_Clu_FcwNValueSet : 51|2@1+ (1.0,0.0) [0.0|3.0] "" LDWS_LKAS + SG_ CF_Clu_PasSpkrLvNValueSet : 53|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + SG_ CF_Clu_SccDrvModeNValueSet : 56|3@1+ (1.0,0.0) [0.0|7.0] "" SCC + SG_ CF_Clu_HAnBNValueSet : 59|2@1+ (1.0,0.0) [0.0|3.0] "" BCM + SG_ CF_Clu_HfreeTrunkTgNValueSet : 61|3@1+ (1.0,0.0) [0.0|7.0] "" BCM + +BO_ 275 TCU13: 8 TCU + SG_ N_TGT_LUP : 0|8@1+ (10.0,500.0) [500.0|3040.0] "rpm" EMS,IBOX + SG_ SLOPE_TCU : 8|6@1+ (0.5,-16.0) [-16.0|15.5] "%" CLU,CUBIS,EMS,IBOX + SG_ CF_Tcu_InhCda : 14|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Tcu_IsgInhib : 15|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Tcu_BkeOnReq : 16|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,IBOX + SG_ CF_Tcu_NCStat : 18|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,IBOX + SG_ CF_Tcu_TarGr : 20|4@1+ (1.0,0.0) [0.0|15.0] "" _4WD,CLU,DATC,EMS,EPB,ESC,IBOX,SCC + SG_ CF_Tcu_ShfPatt : 24|4@1+ (1.0,0.0) [0.0|15.0] "" CLU,CUBIS,EMS,IBOX + SG_ CF_Tcu_InhVis : 28|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Tcu_PRelReq : 29|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX,LVR + SG_ CF_Tcu_ITPhase : 30|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Tcu_ActEcoRdy : 31|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Tcu_TqGrdLim : 32|8@1+ (10.0,0.0) [0.0|2540.0] "Nm/s" EMS,IBOX + SG_ CR_Tcu_IsgTgtRPM : 40|8@1+ (20.0,0.0) [0.0|3500.0] "rpm" EMS,IBOX + SG_ CF_Tcu_SptRdy : 48|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,IBOX + SG_ CF_Tcu_SbwPInfo : 56|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ CF_Tcu_Alive3 : 58|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,IBOX + SG_ CF_Tcu_ChkSum3 : 60|4@1+ (1.0,0.0) [0.0|15.0] "" EMS,IBOX + +BO_ 274 TCU12: 8 TCU + SG_ ETL_TCU : 0|8@1+ (2.0,0.0) [0.0|508.0] "Nm" EMS,IBOX + SG_ CUR_GR : 8|4@1+ (1.0,0.0) [0.0|15.0] "" _4WD,EMS,ESC,IBOX,SCC,TPMS + SG_ CF_Tcu_Alive : 12|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,ESC,IBOX,SCC + SG_ CF_Tcu_ChkSum : 14|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,ESC,IBOX,SCC + SG_ VS_TCU : 16|8@1+ (1.0,0.0) [0.0|254.0] "km/h" BCM,CLU,DATC,EMS,IBOX,LCA,LVR,PGS,SMK,SNV + SG_ FUEL_CUT_TCU : 28|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ INH_FUEL_CUT : 29|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ IDLE_UP_TCU : 30|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ N_INC_TCU : 31|1@1+ (1.0,0.0) [0.0|1.0] "" EMS,IBOX + SG_ SPK_RTD_TCU : 32|8@1+ (0.375,-23.625) [-15.0|15.0] "" EMS,IBOX + SG_ N_TC_RAW : 40|16@1+ (0.25,0.0) [0.0|16383.5] "rpm" EMS,IBOX + SG_ VS_TCU_DECIMAL : 56|8@1+ (0.0078125,0.0) [0.0|0.9921875] "km/h" CLU,EMS,IBOX,LCA + +BO_ 273 TCU11: 8 TCU + SG_ TQI_TCU_INC : 0|8@1+ (0.390625,0.0) [0.0|99.609375] "%" EMS,ESC,IBOX + SG_ G_SEL_DISP : 8|4@1+ (1.0,0.0) [0.0|15.0] "" _4WD,AFLS,AVM,BCM,CGW,CLU,CUBIS,ECS,EMS,EPB,ESC,IAP,IBOX,LCA,LDWS_LKAS,LVR,MDPS,PGS,SCC,SMK,SNV,SPAS,TPMS + SG_ F_TCU : 12|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,ESC,IBOX + SG_ TCU_TYPE : 14|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,EMS,ESC,IBOX + SG_ TCU_OBD : 16|3@1+ (1.0,0.0) [0.0|7.0] "" EMS,ESC,IBOX + SG_ SWI_GS : 19|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,EMS,EPB,ESC,IBOX,SCC + SG_ GEAR_TYPE : 20|4@1+ (1.0,0.0) [0.0|15.0] "" _4WD,CLU,EMS,ESC,IBOX,SCC + SG_ TQI_TCU : 24|8@1+ (0.390625,0.0) [0.0|99.609375] "%" EMS,ESC,IBOX + SG_ TEMP_AT : 32|8@1+ (1.0,-40.0) [-40.0|214.0] "deg" AAF,CLU,CUBIS,EMS,ESC,IBOX + SG_ N_TC : 40|16@1+ (0.25,0.0) [0.0|16383.5] "rpm" _4WD,EMS,EPB,ESC,IBOX + SG_ SWI_CC : 56|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,CLU,EMS,ESC,IBOX + SG_ CF_Tcu_Alive1 : 58|2@1+ (1.0,0.0) [0.0|3.0] "" EMS,IBOX + SG_ CF_Tcu_ChkSum1 : 60|4@1+ (1.0,0.0) [0.0|15.0] "" EMS,IBOX + +BO_ 16 ACU13: 8 ACU + SG_ CF_Acu_CshAct : 0|1@1+ (1.0,0.0) [0.0|1.0] "" CUBIS,IBOX,ODS + +BO_ 1040 CGW_USM1: 8 BCM + SG_ CF_Gway_ATTurnRValue : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_PTGMRValue : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_EscortHLRValue : 4|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_TTUnlockRValue : 6|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_ADrLRValue : 8|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Gway_ADrURValue : 11|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Gway_SCMRValue : 14|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_WlightRValue : 16|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_PSMRValue : 18|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Gway_OTTurnRValue : 21|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Gway_DrLockSoundRValue : 24|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Gway_HAnBRValue : 27|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Gway_MoodLpRValue : 30|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_HfreeTrunkRValue : 32|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Gway_AutoLightRValue : 35|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_Gway_RearWiperRValue : 38|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_Gway_PasSpkrLvRValue : 40|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + +BO_ 1292 CLU13: 8 CLU + SG_ CF_Clu_LowfuelWarn : 0|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,FPCM,IBOX + SG_ CF_Clu_RefDetMod : 2|1@1+ (1.0,0.0) [0.0|1.0] "" IBOX + SG_ CF_Clu_AvgFCU : 3|2@1+ (1.0,0.0) [0.0|3.0] "" IBOX + SG_ CF_Clu_AvsmCur : 5|1@1+ (1.0,0.0) [0.0|1.0] "" ESC,SCC + SG_ CF_Clu_AvgFCI : 6|10@1+ (0.1,0.0) [0.0|102.2] "" IBOX + SG_ CF_Clu_DrivingModeSwi : 16|2@1+ (1.0,0.0) [0.0|3.0] "" DATC,ECS,EMS,ESC,IAP,MDPS,TCU + SG_ CF_Clu_FuelDispLvl : 18|5@1+ (1.0,0.0) [0.0|31.0] "" CGW,IBOX + SG_ CF_Clu_FlexSteerSW : 23|1@1+ (1.0,0.0) [0.0|1.0] "" MDPS + SG_ CF_Clu_DTE : 24|10@1+ (1.0,0.0) [0.0|1023.0] "" DATC + SG_ CF_Clu_TripUnit : 34|2@1+ (1.0,0.0) [0.0|3.0] "" DATC + SG_ CF_Clu_SWL_Stat : 36|3@1+ (1.0,0.0) [0.0|7.0] "" ACU,EMS + SG_ CF_Clu_ActiveEcoSW : 39|1@1+ (1.0,0.0) [0.0|1.0] "" DATC,EMS,TCU + SG_ CF_Clu_EcoDriveInf : 40|3@1+ (1.0,0.0) [0.0|7.0] "" CUBIS,EMS,IAP,IBOX + SG_ CF_Clu_IsaMainSW : 43|1@1+ (1.0,0.0) [0.0|1.0] "" EMS + SG_ CF_Clu_LdwsLkasSW : 56|1@1+ (1.0,0.0) [0.0|1.0] "" LDWS_LKAS + SG_ CF_Clu_AltLStatus : 59|1@1+ (1.0,0.0) [0.0|1.0] "" BCM,DATC,EMS + SG_ CF_Clu_AliveCnt2 : 60|4@1+ (1.0,0.0) [0.0|15.0] "" EMS,LDWS_LKAS + +BO_ 1290 SCC13: 8 SCC + SG_ SCCDrvModeRValue : 0|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ SCC_Equip : 3|1@1+ (1.0,0.0) [0.0|1.0] "" ESC + SG_ AebDrvSetStatus : 4|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,ESC + +BO_ 1287 TCS15: 4 ESC + SG_ ABS_W_LAMP : 0|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU,CUBIS,IBOX + SG_ TCS_OFF_LAMP : 1|2@1+ (1.0,0.0) [0.0|1.0] "" _4WD,ACU,CLU + SG_ TCS_LAMP : 3|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,ACU,CLU,CUBIS,IBOX,SCC + SG_ DBC_W_LAMP : 5|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU + SG_ DBC_F_LAMP : 6|2@1+ (1.0,0.0) [0.0|3.0] "" _4WD,CLU + SG_ ESC_Off_Step : 8|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ AVH_CLU : 16|8@1+ (1.0,0.0) [0.0|255.0] "" CLU,EPB + SG_ AVH_I_LAMP : 24|2@1+ (1.0,0.0) [0.0|3.0] "" EPB + SG_ EBD_W_LAMP : 26|1@1+ (1.0,0.0) [0.0|1.0] "" _4WD,CLU + SG_ AVH_ALARM : 27|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ AVH_LAMP : 29|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,EPB,SPAS + +BO_ 1282 TCU14: 4 TCU + SG_ CF_TCU_WarnMsg : 0|3@1+ (1.0,0.0) [0.0|7.0] "" CLU + SG_ CF_TCU_WarnImg : 3|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_TCU_WarnSnd : 4|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ CF_Tcu_GSel_BlinkReq : 5|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,LVR + SG_ CF_Tcu_StRelStat : 12|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,EMS,ESC + SG_ CF_Tcu_DriWarn1 : 13|3@1+ (1.0,0.0) [0.0|7.0] "" CLU,EMS,ESC + SG_ CF_Tcu_DriWarn2 : 16|2@1+ (1.0,0.0) [0.0|3.0] "" CLU,EMS,ESC + +BO_ 1281 ECS11: 3 ECS + SG_ ECS_W_LAMP : 0|1@1+ (1.0,0.0) [0.0|1.0] "" CLU,CUBIS,IBOX + SG_ SYS_NA : 1|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ ECS_DEF : 2|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ ECS_DIAG : 3|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ L_CHG_NA : 4|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ Leveling_Off : 5|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ LC_overheat : 6|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ Lifting : 8|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ Lowering : 9|1@1+ (1.0,0.0) [0.0|1.0] "" CLU + SG_ Damping_Mode : 10|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ REQ_Damping : 12|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ REQ_Height : 14|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ REQ_level : 16|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + SG_ ACT_Height : 20|4@1+ (1.0,0.0) [0.0|15.0] "" CLU + +BO_ 1024 CLU_CFG11: 2 CLU + SG_ Vehicle_Type : 0|16@1+ (1.0,0.0) [0.0|65536.0] "" _4WD + +BO_ 1280 ACU14: 1 ACU + SG_ CF_SWL_Ind : 0|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_TTL_Ind : 2|2@1+ (1.0,0.0) [0.0|3.0] "" CLU + SG_ CF_SBR_Ind : 4|2@1+ (1.0,0.0) [0.0|3.0] "" BCM,CLU + +BO_ 512 EMS20: 6 EMS + SG_ FCO : 0|16@1+ (0.128,0.0) [0.0|8388.48] "ul" CLU,CUBIS,FPCM,IBOX + SG_ CF_Ems_PumpTPres : 16|8@1+ (3.137254902,0.0) [0.0|800.0] "kPa" FPCM,IBOX + SG_ Split_Stat : 32|1@1+ (1.0,0.0) [0.0|1.0] "" FPCM diff --git a/opendbc/lexus_is_2018_pt_generated.dbc b/opendbc/lexus_is_2018_pt_generated.dbc new file mode 100644 index 00000000000000..a207b26d64e7e0 --- /dev/null +++ b/opendbc/lexus_is_2018_pt_generated.dbc @@ -0,0 +1,337 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _comma.dbc starts here" +BO_ 359 STEERING_IPAS_COMMA: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + + +CM_ "Imported file _toyota_2017.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX DSU HCU EPS IPAS + +BO_ 36 KINEMATICS: 8 XXX + SG_ ACCEL_Y : 33|10@0+ (1,-512) [0|65535] "" XXX + SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX + SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + +BO_ 166 BRAKE: 8 XXX + SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX + +BO_ 170 WHEEL_SPEEDS: 8 XXX + SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_FL : 23|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RR : 39|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RL : 55|16@0+ (0.01,-67.67) [0|250] "kph" XXX + +BO_ 180 SPEED: 8 XXX + SG_ ENCODER : 39|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX + +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + +BO_ 466 PCM_CRUISE: 8 XXX + SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX + SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX + SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 552 ACCELEROMETER: 8 XXX + SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX + SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX + +BO_ 560 BRAKE_MODULE2: 7 XXX + SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX + +BO_ 614 STEERING_IPAS: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 643 PRE_COLLISION: 8 XXX + +BO_ 740 STEERING_LKA: 5 XXX + SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX + SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX + SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX + SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 742 LEAD_INFO: 8 DSU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU + SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU + SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU + +BO_ 835 ACC_CONTROL: 8 DSU + SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX + SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU + SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU + SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 921 PCM_CRUISE_SM: 8 XXX + SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX + SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 951 ESP_CONTROL: 8 ESP + SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_LIGHTS_ACC : 18|1@0+ (1,0) [0|1] "" XXX + +BO_ 1041 ACC_HUD: 8 DSU + SG_ FCW : 4|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X20 : 15|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X10 : 39|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X80 : 55|8@0+ (1,0) [0|1] "" XXX + +BO_ 1042 LKAS_HUD: 8 XXX + SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX + SG_ RIGHT_LINE : 3|2@0+ (1,0) [0|3] "" XXX + SG_ LEFT_LINE : 5|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01 : 7|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01_2 : 11|2@0+ (1,0) [0|3] "" XXX + SG_ LDA_ALERT : 9|2@0+ (1,0) [0|3] "" XXX + SG_ TWO_BEEPS : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ADJUSTING_CAMERA : 13|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MALFUNCTION : 15|1@0+ (1,0) [0|1] "" XXX + SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X0C : 23|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X2C : 47|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X38 : 55|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X02 : 63|8@0+ (1,0) [0|1] "" XXX + +BO_ 1553 UI_SEETING: 8 XXX + SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX + +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + +BO_ 1568 SEATS_DOORS: 8 XXX + SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RR : 43|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FR : 44|1@0+ (1,0) [0|1] "" XXX + +BO_ 1570 LIGHT_STALK: 8 SCM + SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + +CM_ SG_ 36 ACCEL_Y "unit is tbd"; +CM_ SG_ 36 YAW_RATE "verify"; +CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; +CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; +CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; +CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; +CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; +CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; +CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; +CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; +CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; +VAL_ 614 STATE 3 "enabled" 1 "disabled"; +VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; +VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + + +CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; + +CM_ "lexus_is_2018_pt.dbc starts here" + + + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 705 GAS_PEDAL: 8 XXX + SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX + SG_ GAS_PEDAL : 55|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 5 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 956 GEAR_PACKET: 8 XXX + SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + +BO_ 1009 PCM_CRUISE_3: 8 XXX + SG_ MAIN_ON : 13|1@0+ (1,0) [0|3] "" XXX + SG_ CRUISE_STATE : 10|1@0+ (1,0) [0|1] "" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "mph" XXX + +CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +CM_ SG_ 1009 SET_SPEED "units seem to be whatever the car is set to"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; diff --git a/opendbc/lexus_is_hybrid_2017_pt_generated.dbc b/opendbc/lexus_is_hybrid_2017_pt_generated.dbc new file mode 100644 index 00000000000000..e94824670de740 --- /dev/null +++ b/opendbc/lexus_is_hybrid_2017_pt_generated.dbc @@ -0,0 +1,331 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _comma.dbc starts here" +BO_ 359 STEERING_IPAS_COMMA: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.0244140625,0) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.0244140625,-11.962890625) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ CHECKSUM : 47|8@0+ (1,0) [0|3] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.0244140625,0) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.0244140625,-11.962890625) [0|1] "" EON + SG_ STATE : 39|8@0+ (1,0) [0|255] "" EON + SG_ CHECKSUM : 47|8@0+ (1,0) [0|3] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + + +CM_ "Imported file _toyota_2017.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX DSU HCU EPS IPAS + +BO_ 36 KINEMATICS: 8 XXX + SG_ ACCEL_Y : 33|10@0+ (1,-512) [0|65535] "" XXX + SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX + SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + +BO_ 166 BRAKE: 8 XXX + SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX + +BO_ 170 WHEEL_SPEEDS: 8 XXX + SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_FL : 23|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RR : 39|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RL : 55|16@0+ (0.01,-67.67) [0|250] "kph" XXX + +BO_ 180 SPEED: 8 XXX + SG_ ENCODER : 39|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX + +BO_ 466 PCM_CRUISE: 8 XXX + SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX + SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX + SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 552 ACCELEROMETER: 8 XXX + SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX + SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX + +BO_ 560 BRAKE_MODULE2: 7 XXX + SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX + +BO_ 614 STEERING_IPAS: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 643 PRE_COLLISION: 8 XXX + +BO_ 740 STEERING_LKA: 5 XXX + SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX + SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX + SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX + SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 742 LEAD_INFO: 8 DSU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU + SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU + SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU + +BO_ 835 ACC_CONTROL: 8 DSU + SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU + SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU + SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU + SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 921 PCM_CRUISE_SM: 8 XXX + SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX + SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 951 ESP_CONTROL: 8 ESP + SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_LIGHTS_ACC : 18|1@0+ (1,0) [0|1] "" XXX + +BO_ 1041 ACC_HUD: 8 DSU + SG_ FCW : 4|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X20 : 15|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X10 : 39|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X80 : 55|8@0+ (1,0) [0|1] "" XXX + +BO_ 1042 LKAS_HUD: 8 XXX + SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX + SG_ RIGHT_LINE : 3|2@0+ (1,0) [0|3] "" XXX + SG_ LEFT_LINE : 5|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01 : 7|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01_2 : 11|2@0+ (1,0) [0|3] "" XXX + SG_ LDA_ALERT : 9|2@0+ (1,0) [0|3] "" XXX + SG_ TWO_BEEPS : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ADJUSTING_CAMERA : 13|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MALFUNCTION : 15|1@0+ (1,0) [0|1] "" XXX + SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X0C : 23|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X2C : 47|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X38 : 55|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X02 : 63|8@0+ (1,0) [0|1] "" XXX + +BO_ 1553 UI_SEETING: 8 XXX + SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX + +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + +BO_ 1568 SEATS_DOORS: 8 XXX + SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RR : 43|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FR : 44|1@0+ (1,0) [0|1] "" XXX + +BO_ 1570 LIGHT_STALK: 8 SCM + SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + +CM_ SG_ 36 ACCEL_Y "unit is tbd"; +CM_ SG_ 36 YAW_RATE "verify"; +CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; +CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; +CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; +CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; +CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; +CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; +CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; +CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; +CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; +VAL_ 614 STATE 3 "enabled" 1 "disabled"; +VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; +VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + + +CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; + +CM_ "lexus_is_hybrid_2017_pt.dbc starts here" + + + +BO_ 581 GAS_PEDAL: 5 XXX + SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.66,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 5 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 956 GEAR_PACKET: 8 XXX + SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + +BO_ 1009 PCM_CRUISE_ISH: 8 XXX + SG_ MAIN_ON : 13|1@0+ (1,0) [0|3] "" XXX + SG_ CRUISE_STATE : 10|1@0+ (1,0) [0|1] "" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "mph" XXX + +BO_ 1599 LIGHT_STALK_ISH: 8 SCM + SG_ AUTO_HIGH_BEAM : 19|1@0+ (1,0) [0|1] "" XXX + +CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +CM_ SG_ 1009 SET_SPEED "units seem to be whatever the car is set to"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; diff --git a/opendbc/lexus_rx_hybrid_2017_pt_generated.dbc b/opendbc/lexus_rx_hybrid_2017_pt_generated.dbc index d8b2558cd20dc9..acbd9bb1994210 100644 --- a/opendbc/lexus_rx_hybrid_2017_pt_generated.dbc +++ b/opendbc/lexus_rx_hybrid_2017_pt_generated.dbc @@ -14,6 +14,22 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + CM_ "Imported file _toyota_2017.dbc starts here" VERSION "" @@ -58,6 +74,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -73,13 +94,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -114,29 +145,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -168,6 +189,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -178,33 +202,96 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; @@ -233,7 +320,9 @@ BO_ 610 EPS_STATUS: 5 EPS SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX BO_ 956 GEAR_PACKET: 8 XXX + SG_ SPORT_ON : 2|1@0+ (1,0) [0|1] "" XXX SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + SG_ ECON_ON : 40|1@0+ (1,0) [0|1] "" XXX CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; @@ -242,3 +331,5 @@ CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 956 SPORT_ON 0 "off" 1 "on"; +VAL_ 956 ECON_ON 0 "off" 1 "on"; diff --git a/opendbc/mazda_cx5_gt_2017.dbc b/opendbc/mazda_cx5_gt_2017.dbc new file mode 100644 index 00000000000000..d0b84c22a3a9b2 --- /dev/null +++ b/opendbc/mazda_cx5_gt_2017.dbc @@ -0,0 +1,694 @@ +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX + + +BO_ 117 STEER_RELATED: 8 XXX + SG_ CTR : 7|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 48|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_2 : 49|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_3 : 55|1@0+ (1,0) [0|63] "" XXX + SG_ NEW_SIGNAL_4 : 54|4@0+ (1,0) [0|31] "" XXX + SG_ NEW_SIGNAL_5 : 50|1@0+ (1,0) [0|1] "" XXX + SG_ STEER_TORQUE : 19|12@0+ (1,0) [0|255] "" XXX + SG_ STEER_ANGLE_2 : 39|16@0+ (1,0) [0|131071] "" XXX + +BO_ 118 RPM_RELATED: 8 XXX + SG_ CTR : 7|8@0+ (1,0) [0|127] "" XXX + SG_ NEW_SIGNAL_2 : 19|12@0+ (1,0) [0|4095] "" XXX + +BO_ 514 ENGINE_DATA: 8 XXX + SG_ RPM : 7|16@0+ (1,0) [0|65535] "" XXX + SG_ CHKSUM : 56|8@1+ (1,0) [0|127] "" XXX + SG_ SPEED : 23|16@0+ (0.01,0) [0|32767] "KPH" XXX + SG_ PEDAL_GAS : 39|12@0+ (1,0) [0|255] "" XXX + +BO_ 357 PEDALS: 8 XXX + SG_ NEW_SIGNAL_6 : 31|4@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_7 : 8|3@1+ (1,0) [0|7] "" XXX + SG_ ACC_ACTIVE : 3|1@0+ (1,0) [0|1] "" XXX + SG_ ACC_OFF : 2|1@1+ (1,0) [0|15] "" XXX + SG_ CHKSUM : 63|8@0+ (1,0) [0|15] "" XXX + SG_ STANDSTILL : 26|1@0+ (1,0) [0|16777215] "" XXX + SG_ NEW_SIGNAL_3 : 23|8@0+ (1,0) [0|3] "" XXX + SG_ GEAR : 48|5@1+ (1,0) [0|255] "" XXX + SG_ BRAKE_ON : 4|1@0+ (1,0) [0|1] "" XXX + SG_ NO_BRAKE : 6|1@0+ (1,0) [0|7] "" XXX + SG_ BRAKE_ON_2 : 7|1@1+ (1,0) [0|255] "" XXX + SG_ NO_BRAKE_2 : 15|1@0+ (1,0) [0|7] "" XXX + +BO_ 533 WHEEL_SPEEDS: 8 XXX + SG_ FL : 7|16@0+ (0.01,-100) [0|16383] "" XXX + SG_ RL : 39|16@0+ (0.01,-100) [0|15] "" XXX + SG_ RR : 55|16@0+ (0.01,-100) [0|65535] "" XXX + SG_ FR : 23|16@0+ (0.01,-100) [0|65535] "" XXX + +BO_ 134 STEER2: 8 XXX + SG_ NEW_SIGNAL_2 : 48|3@1+ (1,0) [0|7] "" XXX + SG_ CTR : 22|4@0+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_4 : 23|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_5 : 18|3@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_7 : 24|3@1+ (1,0) [0|7] "" XXX + SG_ CTR_2 : 28|3@1+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_1 : 63|2@0+ (1,0) [0|255] "" XXX + SG_ STEER_ANGLE : 7|16@0+ (0.1,-1600) [-500|500] "deg" XXX + SG_ STEER_ANGLE_ROUGH : 39|8@0- (1,0) [0|15] "" XXX + +BO_ 576 STEER_TORQUE: 8 XXX + SG_ NEW_SIGNAL_2 : 39|8@0+ (1,0) [0|127] "" XXX + SG_ NEW_SIGNAL_1 : 20|4@1+ (1,0) [0|255] "" XXX + SG_ STEER_TORQUE_SENSOR : 7|16@0+ (0.5,-15000) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 47|1@0+ (1,0) [0|1] "" XXX + SG_ STEER_TORQUE_MOTOR : 46|20@0- (0.01,0) [-3000|3000] "deg/s" XXX + +BO_ 577 STEER_RATE: 8 XXX + SG_ STEER_ANGLE_RATE : 23|16@0+ (0.25,-8192) [0|1] "deg/s" XXX + SG_ CTR : 7|4@0+ (1,0) [0|15] "" XXX + SG_ LKAS_REQUEST : 3|12@0+ (1,-2048) [0|15] "" XXX + SG_ LKAS_EFFECTIVE : 39|12@0+ (1,-2048) [0|255] "" XXX + SG_ HANDS_OFF_5_SECONDS : 51|1@0+ (1,0) [0|1] "" XXX + SG_ LKAS_BLOCK : 50|1@1+ (1,0) [0|3] "" XXX + SG_ LKAS_TRACK_STATE : 52|1@0+ (1,0) [0|3] "" XXX + SG_ CHKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 582 CAM_LANEMAYBE: 8 XXX + SG_ NEW_SIGNAL_4 : 40|8@1+ (1,0) [0|127] "" XXX + SG_ NEW_SIGNAL_1 : 31|16@0- (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_2 : 55|16@0+ (1,0) [0|65535] "" XXX + SG_ CTR : 7|2@0+ (1,0) [0|3] "" XXX + +BO_ 541 CAM_EMPTY: 8 XXX + +BO_ 605 CAM_PEDESTRIAN: 8 XXX + SG_ CTR : 17|4@0+ (1,0) [0|255] "" XXX + SG_ AEB_NOT_ENGAGED : 13|1@0+ (1,0) [0|1] "" XXX + SG_ PED_WARNING : 9|1@0+ (1,0) [0|255] "" XXX + SG_ PED_BRAKE : 3|3@0+ (1,0) [0|7] "" XXX + SG_ RST_CTR : 23|6@0+ (1,0) [0|63] "" XXX + SG_ S1 : 29|4@0+ (1,0) [0|31] "" XXX + +BO_ 578 CAM_LANETRACK: 8 XXX + SG_ CHKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ ZERO : 53|6@0+ (1,0) [0|63] "" XXX + SG_ CTR : 7|4@0+ (1,0) [0|15] "" XXX + SG_ LINE2 : 9|10@0+ (1,-686) [0|255] "" XXX + SG_ LANE_CURVE : 31|8@0+ (1,-127) [0|255] "" XXX + SG_ SIG1 : 39|8@0+ (1,-128) [0|255] "" XXX + SG_ SIG2 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SIG3 : 55|2@0+ (1,0) [0|3] "" XXX + SG_ LINE1 : 3|10@0+ (1,-686) [0|1] "" XXX + +BO_ 579 CAM_LKAS: 8 XXX + SG_ LKAS_REQUEST : 3|12@0+ (1,-2048) [0|2048] "" XXX + SG_ CTR : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ERR_BIT_1 : 16|1@0+ (1,0) [0|1] "" XXX + SG_ CHKSUM : 63|8@0+ (1,0) [0|15] "" XXX + SG_ LINE_NOT_VISIBLE : 19|1@0+ (1,0) [0|1] "" XXX + SG_ BIT_1 : 29|1@0+ (1,0) [0|1] "" XXX + SG_ BIT_2 : 33|1@0+ (1,0) [0|1] "" XXX + SG_ ERR_BIT_2 : 30|1@0+ (1,0) [0|1] "" XXX + +BO_ 580 CAM_DISTANCE: 8 XXX + SG_ S1 : 0|8@1+ (1,0) [0|127] "" XXX + SG_ S2 : 15|8@0+ (1,0) [0|1] "" XXX + SG_ S3 : 16|8@1+ (1,0) [0|3] "" XXX + SG_ S4 : 24|8@1+ (1,0) [0|31] "" XXX + SG_ S5 : 32|8@1+ (1,0) [0|255] "" XXX + SG_ DISTANCE : 47|8@0+ (1,0) [0|65535] "" XXX + SG_ S6 : 55|16@0+ (1,0) [0|255] "" XXX + +BO_ 581 CAM_IDK3: 8 XXX + SG_ S1 : 0|8@1+ (1,0) [0|15] "" XXX + SG_ S2 : 8|6@1+ (1,0) [0|255] "" XXX + SG_ S3 : 15|2@0+ (1,0) [0|3] "" XXX + SG_ S4 : 16|8@1+ (1,0) [0|15] "" XXX + SG_ S5 : 24|8@1+ (1,0) [0|255] "" XXX + SG_ S6 : 32|8@1+ (1,0) [0|255] "" XXX + SG_ S7 : 40|8@1+ (1,0) [0|3] "" XXX + SG_ S8 : 48|8@1+ (1,0) [0|255] "" XXX + SG_ S9 : 56|8@1+ (1,0) [0|255] "" XXX + +BO_ 863 CAM_STATUS: 8 XXX + SG_ NEW_SIGNAL_1 : 32|1@0+ (1,0) [0|32767] "" XXX + SG_ NEW_SIGNAL_5 : 4|2@0+ (1,0) [0|32767] "" XXX + SG_ NEW_SIGNAL_4 : 15|4@0+ (1,0) [0|15] "" XXX + SG_ STOP_SIGN : 31|4@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_3 : 55|1@0+ (1,0) [0|127] "" XXX + SG_ NEW_SIGNAL_6 : 0|3@1+ (1,0) [0|7] "" XXX + SG_ FORWARD_COLLISION : 40|8@1+ (1,0) [0|7] "" XXX + +BO_ 1157 CAM_Empty2: 8 XXX + +BO_ 1160 CAM_Empty3: 8 XXX + SG_ NEW_SIGNAL_1 : 47|24@0+ (1,0) [0|16777215] "" XXX + +BO_ 1088 CAM_LANEINFO: 8 XXX + SG_ BIT3 : 62|1@0+ (1,0) [0|3] "" XXX + SG_ HANDS_ON_STEER_WARN_2 : 59|1@0+ (1,0) [0|1] "" XXX + SG_ HANDS_ON_STEER_WARN : 56|1@0+ (1,0) [0|3] "" XXX + SG_ S1_NOT : 54|1@0+ (1,0) [0|31] "" XXX + SG_ S1 : 52|1@0+ (1,0) [0|1] "" XXX + SG_ HANDS_WARN_3_BITS : 51|3@0+ (1,0) [0|7] "" XXX + SG_ ERR_BIT : 40|1@0+ (1,0) [0|1] "" XXX + SG_ NO_ERR_BIT : 14|1@0+ (1,0) [0|1] "" XXX + SG_ BIT2 : 13|1@0+ (1,0) [0|15] "" XXX + SG_ LANE_LINES : 10|3@0+ (1,0) [0|3] "" XXX + SG_ BIT1 : 6|1@0+ (1,0) [0|65535] "" XXX + SG_ LINE_NOT_VISIBLE : 1|1@0+ (1,0) [0|1] "" XXX + SG_ LINE_VISIBLE : 0|1@0+ (1,0) [0|3] "" XXX + +BO_ 1479 NEW_MSG_470: 8 XXX + +BO_ 1456 NEW_MSG_300: 8 XXX + +BO_ 1446 NEW_MSG_a600: 8 XXX + +BO_ 1416 MSG_18: 8 XXX + +BO_ 1086 DOORS: 8 XXX + SG_ DOOR_OPEN : 30|1@0+ (1,0) [0|255] "" XXX + SG_ LEFTGATE : 32|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_3 : 53|1@0+ (1,0) [0|255] "" XXX + SG_ KEYFOB_HORN : 2|1@0+ (1,0) [0|1] "" XXX + SG_ KEYFOB_LOCK : 3|1@0+ (1,0) [0|1] "" XXX + SG_ KEYFOB_UNLOCK : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CTR1 : 8|4@1+ (1,0) [0|3] "" XXX + SG_ CTR2 : 16|4@1+ (1,0) [0|15] "" XXX + SG_ BR : 34|1@0+ (1,0) [0|1] "" XXX + SG_ BL : 35|1@0+ (1,0) [0|1] "" XXX + SG_ FR : 36|1@0+ (1,0) [0|1] "" XXX + SG_ FL : 37|1@0+ (1,0) [0|255] "" XXX + +BO_ 977 TWO_STATES: 8 XXX + SG_ NEW_SIGNAL_1 : 50|1@1+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_2 : 56|4@1+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_3 : 28|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 24|4@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_5 : 39|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_6 : 36|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_7 : 47|8@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_8 : 51|1@0+ (1,0) [0|1] "" XXX + +BO_ 1085 MSG_12: 8 XXX + SG_ NEW_SIGNAL_3 : 36|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 16|8@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_2 : 48|8@1+ (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_4 : 31|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 24|1@0+ (1,0) [0|127] "" XXX + SG_ NEW_SIGNAL_6 : 40|3@1+ (1,0) [0|7] "" XXX + +BO_ 159 MSG_11: 8 XXX + SG_ NEW_SIGNAL_1 : 50|4@1+ (1,0) [0|15] "" XXX + +BO_ 1278 NEW_MSG_3: 8 XXX + SG_ NEW_SIGNAL_2 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_7 : 63|8@0+ (1,0) [0|255] "" XXX + SG_ MILAGE_MAYBE : 7|16@0+ (1,0) [0|255] "" XXX + +BO_ 1277 NEW_MSG_10: 8 XXX + SG_ NEW_SIGNAL_3 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ counter : 7|8@0+ (1,0) [0|255] "" XXX + +BO_ 1275 2017_5: 8 XXX + SG_ counter : 4|5@0+ (1,0) [0|255] "" XXX + +BO_ 1274 NEW_MSG_12: 8 XXX + SG_ NEW_SIGNAL_1 : 24|4@1+ (1,0) [0|15] "" XXX + SG_ CTR : 55|4@0+ (1,0) [0|63] "" XXX + SG_ NEW_SIGNAL_2 : 35|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 32|3@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4 : 48|4@1+ (1,0) [0|7] "" XXX + +BO_ 1180 last_byte_roughRPM: 8 XXX + SG_ NEW_SIGNAL_1 : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 1078 HVAC: 8 XXX + SG_ NEW_SIGNAL_1 : 2|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_2 : 8|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 23|1@0+ (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_4 : 56|5@0+ (1,0) [0|255] "" XXX + +BO_ 1056 NEW_MSG_13: 8 XXX + SG_ BIG_COUNTER_MAYBE : 55|16@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 29|6@0+ (1,0) [0|255] "" XXX + SG_ counter_or_GEAR : 15|8@0+ (1,0) [0|255] "" XXX + SG_ INCREASING : 7|8@0+ (1,0) [0|255] "" XXX + SG_ CTR : 23|8@0+ (1,0) [0|255] "" XXX + SG_ STANDSTILL : 32|1@0+ (1,0) [0|255] "" XXX + +BO_ 1045 MOVING: 8 XXX + SG_ NEW_SIGNAL_2 : 20|1@0+ (1,0) [0|3] "" XXX + SG_ CTR2 : 19|4@0+ (1,0) [0|31] "" XXX + SG_ CTR3 : 8|4@1+ (1,0) [0|15] "" XXX + SG_ IS_MOVING : 12|1@0+ (1,0) [0|3] "" XXX + SG_ CTR1 : 53|6@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 54|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE : 55|1@0+ (1,0) [0|1] "" XXX + +BO_ 1034 MSG_07: 8 XXX + SG_ NEW_SIGNAL_1 : 6|3@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_2 : 0|4@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_3 : 15|4@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_4 : 63|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_7 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_8 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_9 : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 870 NEW_MSG_16: 8 XXX + SG_ NEW_SIGNAL_1 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_7 : 55|8@0+ (1,0) [0|255] "" XXX + +BO_ 867 NEW_MSG_17: 8 XXX + SG_ NEW_SIGNAL_1 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ CTR : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 130 STEER: 8 XXX + SG_ NEW_SIGNAL_5 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 63|8@0+ (1,0) [0|255] "" XXX + SG_ CTR : 47|8@0+ (1,0) [0|255] "" XXX + SG_ CTR_2 : 35|4@0+ (1,0) [0|255] "" XXX + SG_ STEER_ANGLE : 23|16@0+ (0.05,-1600) [500|-500] "deg" XXX + +BO_ 120 NEW_MSG_18: 8 XXX + SG_ NEW_SIGNAL_1 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ CTR : 55|8@0+ (1,0) [0|255] "" XXX + +BO_ 304 GEAR_RELATED: 8 XXX + SG_ NEW_SIGNAL_1 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 47|8@0+ (1,0) [0|255] "" XXX + +BO_ 865 NEW_MSG_5: 8 XXX + SG_ SPEED_INVERSE : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 47|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 40|1@0+ (1,0) [0|1] "" XXX + SG_ IS_MOVING : 43|3@0+ (1,0) [0|127] "" XXX + SG_ NEW_SIGNAL_2 : 46|1@0+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_4 : 44|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_7 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_8 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_10 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 15|3@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ CTR : 56|4@1+ (1,0) [0|15] "" XXX + +BO_ 836 NEW_MSG_19: 8 XXX + SG_ CTR : 48|4@1+ (1,0) [0|15] "" XXX + SG_ CTR2 : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 832 SEATBELT: 8 XXX + SG_ NEW_SIGNAL_1 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ PASSENGER_SEATBELT : 26|1@1+ (1,0) [0|7] "" XXX + SG_ CTR1 : 15|4@0+ (1,0) [0|15] "" XXX + SG_ CTR2 : 23|4@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 8|4@1+ (1,0) [0|3] "" XXX + SG_ DRIVER_SEATBELT : 27|1@0+ (1,0) [0|1] "" XXX + +BO_ 866 NEW_MSG_21: 8 XXX + SG_ NEW_SIGNAL_2 : 7|8@0+ (1,0) [0|131071] "" XXX + SG_ NEW_SIGNAL_1 : 15|8@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 27|4@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_7 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ CTR : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 158 MSG_05: 8 XXX + SG_ NEW_SIGNAL_1 : 23|8@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_2 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 55|8@0+ (1,0) [0|255] "" XXX + +BO_ 157 CRZ_BTNS: 8 XXX + SG_ SET_P_INV : 21|1@0+ (1,0) [0|3] "" XXX + SG_ CAN_OFF_INV : 17|1@1+ (1,0) [0|3] "" XXX + SG_ CAN_OFF : 0|1@1+ (1,0) [0|3] "" XXX + SG_ SET_M_INV : 22|1@0+ (1,0) [0|255] "" XXX + SG_ SET_M : 5|1@0+ (1,0) [0|3] "" XXX + SG_ SET_P : 4|1@0+ (1,0) [0|3] "" XXX + SG_ RES_INV : 19|1@1+ (1,0) [0|3] "" XXX + SG_ RES : 2|1@1+ (1,0) [0|3] "" XXX + SG_ DISTANCE_LESS : 7|1@0+ (1,0) [0|1] "" XXX + SG_ DISTANCE_LESS_INV : 8|1@0+ (1,0) [0|31] "" XXX + SG_ DISTANCE_MORE : 6|1@0+ (1,0) [0|3] "" XXX + SG_ DISTANCE_MORE_INV : 23|1@0+ (1,0) [0|1] "" XXX + SG_ MODE_Y : 13|1@1+ (1,0) [0|3] "" XXX + SG_ MODE_X : 14|1@0+ (1,0) [0|255] "" XXX + SG_ MODE_Y_INV : 30|1@0+ (1,0) [0|3] "" XXX + SG_ MODE_X_INV : 31|1@0+ (1,0) [0|3] "" XXX + SG_ CTR : 29|4@0+ (1,0) [0|255] "" XXX + +BO_ 154 BLINK_INFO: 8 XXX + SG_ LEFT_BLINK : 18|1@1+ (1,0) [0|3] "" XXX + SG_ RIGHT_BLINK : 19|1@0+ (1,0) [0|255] "" XXX + SG_ REAR_WIPER_ON : 0|1@0+ (1,0) [0|1] "" XXX + SG_ WIPER_LO : 33|1@1+ (1,0) [0|31] "" XXX + SG_ WIPER_HI : 34|1@0+ (1,0) [0|1] "" XXX + +BO_ 145 TURN_SWITCH: 8 XXX + SG_ NEW_SIGNAL_1 : 37|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_2 : 36|1@0+ (1,0) [0|3] "" XXX + SG_ TURN : 38|1@0+ (1,0) [0|3] "" XXX + SG_ TURN_LEFT_SWITCH : 13|1@0+ (1,0) [0|255] "" XXX + SG_ TURN_RIGHT_SWITCH : 12|1@1+ (1,0) [0|3] "" XXX + SG_ HAZARD : 10|1@0+ (1,0) [0|1] "" XXX + SG_ CTR : 27|4@0+ (1,0) [0|255] "" XXX + +BO_ 80 MSG_04: 8 XXX + SG_ NEW_SIGNAL_1 : 25|1@0+ (1,0) [0|1] "" XXX + SG_ SIGNAL : 24|1@0+ (1,0) [0|1] "" XXX + +BO_ 978 MSG_03: 8 XXX + SG_ NEW_SIGNAL_1 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 23|8@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_4 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_7 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_8 : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 607 NEW_MSG_25: 8 XXX + +BO_ 1115 MSG_02: 8 XXX + SG_ NEW_SIGNAL_2 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 47|16@0+ (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_3 : 63|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_4 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ CTR : 2|3@0+ (1,0) [0|255] "" XXX + +BO_ 1067 NEW_MSG_27: 8 XXX + SG_ NEW_SIGNAL_2 : 3|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_4 : 0|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_1 : 2|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_5 : 1|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_3 : 12|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_6 : 11|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_7 : 10|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_8 : 9|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_9 : 8|1@0+ (1,0) [0|1] "" XXX + +BO_ 358 NEW_MSG_28: 8 XXX + +BO_ 608 NEW_MSG_29: 8 XXX + SG_ NEW_SIGNAL_1 : 8|5@1+ (1,0) [0|7] "" XXX + +BO_ 606 SPEED_TBD: 8 XXX + SG_ SPEED_TBD : 7|12@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 23|12@0- (1,0) [0|65535] "" XXX + +BO_ 552 GEAR: 8 XXX + SG_ NEW_SIGNAL_2 : 8|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 11|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_4 : 18|3@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 26|3@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 31|5@0+ (1,0) [0|31] "" XXX + SG_ NEW_SIGNAL_7 : 39|1@0+ (1,0) [0|255] "" XXX + SG_ GEAR : 35|4@0+ (1,0) [0|15] "" XXX + SG_ MORE_GEAR : 7|4@0+ (1,0) [0|255] "" XXX + +BO_ 543 CRZ_EVENTS: 8 XXX + SG_ NEW_SIGNAL_3 : 34|1@0+ (1,0) [0|1] "" XXX + SG_ CHKSUM : 63|8@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_1 : 55|4@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_5 : 47|4@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_6 : 6|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_8 : 0|1@0+ (1,0) [0|31] "" XXX + SG_ NEW_SIGNAL_9 : 1|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_10 : 2|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_12 : 10|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_13 : 9|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_18 : 12|1@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_19 : 14|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_20 : 15|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_21 : 23|1@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_24 : 31|1@0+ (1,0) [0|1] "" XXX + SG_ GAS_PEDAL_PRESSED : 32|1@0+ (1,0) [0|255] "" XXX + SG_ CRZ_STARTED : 18|1@0+ (1,0) [0|1] "" XXX + SG_ PLUS_ONE_CRZ : 17|1@0+ (1,0) [0|255] "" XXX + SG_ PLUS_ONE_CRZ_2 : 19|1@0+ (1,0) [0|1] "" XXX + SG_ GAS_MAYBE : 22|1@0+ (1,0) [0|1] "" XXX + SG_ NONACC_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE_CAR_MOVING : 16|1@0+ (1,0) [0|1] "" XXX + SG_ NONACC_RELATED : 11|1@0+ (1,0) [0|255] "" XXX + SG_ CTR : 51|4@0+ (1,0) [0|15] "" XXX + SG_ CAS_CMD_MAYBE : 30|7@0- (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 43|4@0+ (1,0) [0|255] "" XXX + +BO_ 542 NEW_MSG_33: 8 XXX + SG_ CTR : 48|4@1+ (1,0) [0|15] "" XXX + SG_ CTR2 : 56|4@1+ (1,0) [0|15] "" XXX + +BO_ 868 NEW_MSG_34: 8 XXX + SG_ CTR : 59|4@0+ (1,0) [0|255] "" XXX + +BO_ 869 NEW_MSG_35: 8 XXX + SG_ NEW_SIGNAL_1 : 7|4@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 23|16@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 39|16@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 55|2@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 50|4@1+ (1,0) [0|15] "" XXX + SG_ CTR : 59|4@0+ (1,0) [0|255] "" XXX + +BO_ 1114 NEW_MSG_4: 8 XXX + +BO_ 535 CURVE_CTRS: 8 XXX + SG_ CTR_A_1 : 4|3@0+ (1,0) [0|31] "" XXX + SG_ CTR_A_2 : 7|3@0+ (1,0) [0|255] "" XXX + SG_ CTR_B_1 : 12|3@0+ (1,0) [0|7] "" XXX + SG_ CTR_B_2 : 15|3@0+ (1,0) [0|7] "" XXX + SG_ CTR_C_1 : 20|3@0+ (1,0) [0|7] "" XXX + SG_ CTR_C_2 : 23|3@0+ (1,0) [0|255] "" XXX + SG_ CTR_D_2 : 31|3@0+ (1,0) [0|7] "" XXX + SG_ CTR_D_1 : 28|3@0+ (1,0) [0|7] "" XXX + SG_ CURVE : 39|16@0+ (1,0) [0|7] "" XXX + SG_ CTR : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHK_MAYBE : 63|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 0|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_2 : 1|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_6 : 17|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_7 : 24|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_8 : 25|1@0+ (1,0) [0|1] "" XXX + SG_ SEATBELT_MAYBE : 8|1@0+ (1,0) [0|1] "" XXX + SG_ NO_SEATBELT_MAYBE : 16|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_4 : 9|1@0+ (1,0) [0|1] "" XXX + +BO_ 540 CRZ_CTRL: 8 XXX + SG_ NEW_SIGNAL_3 : 1|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_4 : 8|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 9|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_6 : 10|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_7 : 18|3@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_9 : 31|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_10 : 30|1@0+ (1,0) [0|1] "" XXX + SG_ ACC_GAS_MAYBE : 23|1@0+ (1,0) [0|31] "" XXX + SG_ ACC_GAS_MAYBE2 : 29|1@0+ (1,0) [0|1] "" XXX + SG_ CRZ_ACTIVE : 3|1@0+ (1,0) [0|1] "" XXX + +BO_ 539 CRZ_INFO: 8 XXX + SG_ NEW_SIGNAL_1 : 17|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 16|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_5 : 34|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_7 : 47|1@0+ (1,0) [0|255] "" XXX + SG_ CTR1 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CTR2 : 63|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 37|1@0+ (1,0) [0|255] "" XXX + SG_ ACC_ACTIVE : 33|1@0+ (1,0) [0|1] "" XXX + SG_ ACCEL_CMD : 31|10@0- (1,0) [0|1] "" XXX + +BO_ 121 EPB: 8 XXX + SG_ NEW_SIGNAL_1 : 4|4@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 0|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_3 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 25|2@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_6 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ CTR : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_7 : 63|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_8 : 41|2@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_9 : 47|1@0+ (1,0) [0|63] "" XXX + SG_ NEW_SIGNAL_10 : 46|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_11 : 45|1@0+ (1,0) [0|1] "" XXX + SG_ EPB_ACTIVE : 29|1@0+ (1,0) [0|15] "" XXX + +BO_ 1070 2017_1: 8 XXX + +BO_ 1183 2017_2: 8 XXX + +BO_ 1243 2017_3: 8 XXX + SG_ NEW_SIGNAL_1 : 7|64@0+ (1,0) [0|18446744073709552000] "" XXX + +BO_ 1269 MSG_2017_4: 8 XXX + SG_ NEW_SIGNAL_1 : 55|16@0+ (1,0) [0|18446744073709552000] "" XXX + +BO_ 1178 2017_6: 8 XXX + SG_ NEW_SIGNAL_1 : 7|64@0+ (1,0) [0|18446744073709552000] "" XXX + +BO_ 1179 2017_7: 8 XXX + SG_ NEW_SIGNAL_1 : 7|64@0+ (1,0) [0|18446744073709552000] "" XXX + +BO_ 1435 2017_8: 8 XXX + +BO_ 253 NEW_MSG_7: 8 XXX + SG_ NEW_SIGNAL_1 : 16|1@0+ (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_2 : 41|1@0+ (1,0) [0|255] "" XXX + SG_ CTR : 23|4@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 61|1@0+ (1,0) [0|255] "" XXX + +BO_ 359 NEW_MSG_11: 8 XXX + SG_ NEW_SIGNAL_1 : 15|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 7|8@0+ (1,0) [0|255] "" XXX + SG_ CTR : 31|4@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 36|5@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 38|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_5 : 37|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_6 : 47|4@0+ (1,0) [0|255] "" XXX + +BO_ 512 NEW_MSG_30: 8 XXX + SG_ NEW_SIGNAL_1 : 6|7@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 7|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_3 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 23|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 22|7@0+ (1,0) [0|127] "" XXX + SG_ NEW_SIGNAL_6 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_7 : 39|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_8 : 38|7@0+ (1,0) [0|127] "" XXX + SG_ NEW_SIGNAL_9 : 40|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_10 : 47|4@0+ (1,0) [0|15] "" XXX + SG_ CTR : 51|3@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_11 : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 515 MSG_01: 8 XXX + SG_ CTR : 39|8@0+ (1,0) [0|65535] "" XXX + SG_ CTR_2 : 47|8@0+ (1,0) [0|255] "" XXX + +BO_ 529 NEW_MSG_36: 8 XXX + SG_ NEW_SIGNAL_1 : 22|5@0+ (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_2 : 31|8@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 32|4@1+ (1,0) [0|3] "" XXX + SG_ CTR : 39|4@0+ (1,0) [0|255] "" XXX + SG_ CTR_2 : 47|4@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 40|4@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_5 : 53|1@0+ (1,0) [0|255] "" XXX + +BO_ 1242 NEW_MSG_37: 8 XXX + +BO_ 1266 MSG_09: 8 XXX + SG_ NEW_SIGNAL_1 : 20|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 19|4@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_3 : 31|1@0+ (1,0) [0|255] "" XXX + +BO_ 976 MSG_15: 8 XXX + SG_ NEW_SIGNAL_1 : 55|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 61|6@0+ (1,0) [0|1] "" XXX + +BO_ 155 MSG_14: 8 XXX + +BO_ 1267 MSG_10: 8 XXX + SG_ NEW_SIGNAL_1 : 40|1@0+ (1,0) [0|16777215] "" XXX + SG_ NEW_SIGNAL_2 : 42|1@0+ (1,0) [0|1] "" XXX + +BO_ 305 NEW_MSG_6: 8 XXX + SG_ NEW_SIGNAL_1 : 8|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 9|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_3 : 10|1@0+ (1,0) [0|1] "" XXX + +BO_ 1238 TEMPERATURE: 8 XXX + SG_ TEMPERATURE_MAYBE : 47|8@0+ (1,0) [0|4294967295] "" XXX + +BO_ 1087 NEW_MSG_1: 8 XXX + SG_ NEW_SIGNAL_1 : 7|8@0+ (1,0) [0|255] "" XXX + +BO_ 1143 BSM: 8 XXX + SG_ BSM_OFF : 0|1@0+ (1,0) [0|1] "" XXX + SG_ RIGHT_BS_3 : 37|1@0+ (1,0) [0|1] "" XXX + SG_ STANDSTILL : 8|1@0+ (1,0) [0|1] "" XXX + SG_ LEFT_BS1 : 12|1@0+ (1,0) [0|1] "" XXX + SG_ LEFT_BS3 : 38|1@0+ (1,0) [0|1] "" XXX + SG_ RIGHT_BS4 : 39|1@0+ (1,0) [0|1] "" XXX + SG_ LEFT_BS_SIDE : 36|1@0+ (1,0) [0|1] "" XXX + SG_ IS_MOVING : 9|1@0+ (1,0) [0|1] "" XXX + SG_ LEFT_BS_BEHIND : 46|2@1+ (1,0) [0|16777215] "" XXX + SG_ RIGHT_BS1 : 14|1@0+ (1,0) [0|63] "" XXX + SG_ RIGHT_BS_DISTANCE : 35|3@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_1 : 32|1@0+ (1,0) [0|1] "" XXX + +BO_ 1361 KEY_POSITION: 8 XXX + +BO_ 1283 KEY_POSITION2: 8 XXX + +BO_ 628 MSG_06: 8 XXX + +BO_ 1154 MSG_08: 8 XXX + +BO_ 1139 MSG_13: 8 XXX + +BO_ 1270 MSG_16: 8 XXX + +BO_ 1272 MSG_17: 8 XXX + +BO_ 1425 MSG_19: 8 XXX + + + + +CM_ SG_ 605 PED_BRAKE "3: no brake, 4: brake"; +CM_ SG_ 1088 LANE_LINES "0 LKAS disabled, 1 no lines, 2 two lines, 3 left line, 4 right line"; +CM_ SG_ 157 CAN_OFF "Disengage Cruise if enabled, if already disabled TURN it OFF "; +CM_ SG_ 552 GEAR "0 P/N, 12 R, 2 D M1, 4 M2, 14 Shift"; +CM_ SG_ 552 MORE_GEAR ""; diff --git a/opendbc/mercedes_benz_e350_2010.dbc b/opendbc/mercedes_benz_e350_2010.dbc index 9841af6d4f8952..da6ae4c15ee66b 100644 --- a/opendbc/mercedes_benz_e350_2010.dbc +++ b/opendbc/mercedes_benz_e350_2010.dbc @@ -36,27 +36,141 @@ BS_: BU_: XXX -BO_ 3 NEW_MSG_1: 8 XXX - SG_ STEERING_ANGLE : 7|32@0- (1,0) [0|4294967295] "" XXX - SG_ NEW_SIGNAL_1 : 55|8@0+ (1,0) [0|255] "" XXX +BO_ 3 STEER_SENSOR: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ STEER_RATE : 19|12@0- (0.5,0) [0|255] "" XXX + SG_ STEER_DIRECTION : 4|1@0+ (1,2) [0|1] "" XXX + SG_ STEER_ANGLE : 3|12@0- (-0.5,0) [-500|500] "degrees" XXX -BO_ 5 NEW_MSG_2: 8 XXX - SG_ BRAKE_POSITION : 23|16@0+ (1,0) [0|65535] "" XXX - SG_ BRAKE_PRESSED : 0|8@1+ (1,0) [0|17] "" XXX +BO_ 5 BRAKE_MODULE: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_HOLD : 2|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_POSITION : 17|10@0+ (1,0) [0|65535] "" XXX + SG_ DRIVER_BRAKE : 4|1@0+ (1,0) [0|1] "" XXX + SG_ COMPUTER_BRAKE : 10|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_PRESSED : 0|1@1+ (1,0) [0|1] "" XXX -BO_ 69 NEW_MSG_3: 8 XXX - SG_ TURN_SIGNAL_LEVER : 16|8@1+ (1,0) [0|255] "" XXX - SG_ CRUISE_CONTROL_LEVER : 7|8@0+ (1,0) [0|255] "" XXX - SG_ NEW_SIGNAL_2 : 55|8@0+ (1,0) [0|255] "" XXX - SG_ NEW_SIGNAL_1 : 63|8@0+ (1,0) [0|255] "" XXX - SG_ STEERING_WHEEL_BUTTONS : 32|8@1+ (1,0) [0|255] "4 directional, 2 volume control, & 2 phone buttons" XXX - SG_ MORE_STEERING_WHEELS_BUTTONS : 40|8@1+ (1,0) [0|255] "" XXX +BO_ 69 DRIVER_CONTROLS: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ STEERING_WHEEL_BUTTONS : 32|16@1+ (1,0) [0|255] "4 directional, 2 volume control & 2 phone buttons" XXX + SG_ LEFT_BLINKER : 16|1@0+ (1,0) [0|1] "" XXX + SG_ RIGHT_BLINKER : 17|1@0+ (1,0) [0|1] "" XXX + SG_ HIGHBEAM_TOGGLE : 18|1@0+ (1,0) [0|1] "" XXX + SG_ HIGHBEAM_MOMENTARY : 19|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_CANCEL : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_RESUME : 1|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_ACCEL_HIGH : 2|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_DECEL_HIGH : 3|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_ACCEL_LOW : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_DECEL_LOW : 5|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_XFF : 15|8@0+ (1,0) [0|255] "" XXX -BO_ 1 NEW_MSG_4: 8 XXX - SG_ DOOR_LOCK_STATUS : 31|16@0+ (1,0) [0|65535] "" XXX +BO_ 513 WHEEL_ENCODERS: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ WHEEL_ENCODER_2 : 15|8@0+ (1,0) [0|255] "" XXX + SG_ WHEEL_ENCODER_3 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ WHEEL_ENCODER_4 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 56|8@1+ (1,0) [0|255] "" XXX + SG_ WHEEL_ENCODER_1 : 7|8@0+ (1,0) [0|255] "" XXX +BO_ 261 GAS_PEDAL: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ ENGINE_RPM : 4|5@0+ (1,0) [0|255] "" XXX + SG_ GAS_PEDAL : 39|8@0+ (1,0) [0|255] "" XXX + SG_ COMBINED_GAS : 31|8@0+ (1,0) [0|255] "" XXX +BO_ 643 DOOR_SENSORS: 8 XXX + SG_ BRAKE_PRESSED : 27|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FR : 3|1@1+ (1,0) [0|3] "" XXX + SG_ DOOR_OPEN_RL : 5|1@0+ (1,0) [0|3] "" XXX + SG_ DOOR_OPEN_RR : 7|1@0+ (1,0) [0|3] "" XXX + SG_ DOOR_OPEN_FL : 1|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_CLOSED_FL : 0|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_CLOSED_FR : 2|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_CLOSED_RL : 4|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_CLOSED_RR : 6|1@0+ (1,0) [0|1] "" XXX +BO_ 885 SEATBELT_SENSORS: 8 XXX + SG_ SEATBELT_DRIVER_LATCHED : 16|1@0+ (1,0) [0|1] "" XXX + SG_ SEATBELT_PASSENGER_LATCHED : 18|1@0+ (1,0) [0|1] "" XXX -CM_ SG_ 5 BRAKE_PRESSED "appears to be boolean (brake pressed)"; -CM_ SG_ 69 MORE_STEERING_WHEELS_BUTTONS "back, ok, voice assistance, and mute buttons"; +BO_ 257 CRUISE_CONTROL: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 6|1@0+ (1,0) [0|255] "" XXX + SG_ CRUISE_DISABLED : 23|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X002 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X003 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_1 : 5|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACCELERATING : 22|1@0+ (1,0) [0|1] "" XXX + SG_ LONGITUDINAL_ACCEL_REQUEST : 15|8@0- (1,0) [0|127] "" XXX + +BO_ 260 CRUISE_CONTROL2: 8 XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_XFF : 31|8@0+ (1,0) [0|65535] "" XXX + SG_ SET_ME_X02 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_XFF2 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 7|4@0+ (1,0) [0|255] "" XXX + +BO_ 14 STEER_TORQUE: 8 XXX + SG_ STEER_TORQUE : 15|8@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 888 CRUISE_CONTROL3: 8 XXX + SG_ NEW_SIGNAL_2 : 7|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_1 : 38|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_5 : 32|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_DISABLED : 36|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ENABLED : 34|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X003 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X004 : 63|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X002 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ CRUISE_SET_SPEED : 15|8@0+ (1,0) [0|63] "mph" XXX + SG_ CRUISE_SPEED_CHANGE : 55|1@0+ (1,0) [0|1] "" XXX + +BO_ 307 POWER_SEATS: 8 XXX + SG_ DRIVER_FORWARD : 0|1@0+ (1,0) [0|1] "" XXX + SG_ DRIVER_BACK : 1|1@0+ (1,0) [0|1] "" XXX + +BO_ 109 GEAR_LEVER: 8 XXX + SG_ PARK_BUTTON : 12|1@0+ (1,0) [0|1] "" XXX + SG_ NEUTRAL_UP : 9|1@0+ (1,0) [0|1] "" XXX + SG_ NEUTRAL_DOWN : 10|1@0+ (1,0) [0|1] "" XXX + SG_ DRIVE : 11|1@0+ (1,0) [0|1] "" XXX + SG_ REVERSE : 8|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 23|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 115 GEAR_PACKET: 8 XXX + SG_ GEAR : 0|4@1+ (1,0) [0|15] "" XXX + +BO_ 581 IGNITION: 8 XXX + +BO_ 515 WHEEL_SPEEDS: 8 XXX + SG_ WHEEL_MOVING_FR : 22|1@1+ (1,0) [0|15] "" XXX + SG_ WHEEL_MOVING_RL : 38|1@0+ (1,0) [0|1] "" XXX + SG_ WHEEL_MOVING_FL : 6|1@0+ (1,0) [0|1] "" XXX + SG_ WHEEL_MOVING_RR : 54|1@0+ (1,0) [0|1] "" XXX + SG_ WHEEL_SPEED_FL : 2|11@0+ (0.0375,0) [0|255] "mph" XXX + SG_ WHEEL_SPEED_FR : 18|11@0+ (0.0375,0) [0|255] "mph" XXX + SG_ WHEEL_SPEED_RL : 34|11@0+ (0.0375,0) [0|255] "mph" XXX + SG_ WHEEL_SPEED_RR : 50|11@0+ (0.0375,0) [0|255] "mph" XXX + + + + +CM_ SG_ 3 STEER_DIRECTION "0 = left, 1 = right"; +CM_ SG_ 5 BRAKE_POSITION "computer and driver"; +CM_ SG_ 5 BRAKE_PRESSED "computer and driver"; +CM_ SG_ 261 GAS_PEDAL "user gas input"; +CM_ SG_ 261 COMBINED_GAS "computer and driver gas"; +CM_ SG_ 257 CRUISE_ACCELERATING ""; \ No newline at end of file diff --git a/opendbc/subaru_global_2017.dbc b/opendbc/subaru_global_2017.dbc new file mode 100644 index 00000000000000..1c8b796ab2b7f6 --- /dev/null +++ b/opendbc/subaru_global_2017.dbc @@ -0,0 +1,363 @@ +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX X + + +BO_ 2 Steering: 8 XXX + SG_ Counter : 25|3@1+ (1,0) [0|7] "" XXX + SG_ Checksum : 32|8@1+ (1,0) [0|255] "" XXX + SG_ Steering_Angle : 7|16@0- (0.1,0) [0|65535] "" XXX + +BO_ 64 Throttle: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|255] "" XXX + SG_ Off_Accel : 60|4@1+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_3 : 56|4@1+ (1,0) [0|255] "" XXX + SG_ Engine_RPM : 16|12@1+ (1,0) [0|255] "" XXX + SG_ Throttle_Cruise : 40|8@1+ (1,0) [0|255] "" XXX + SG_ Throttle_Combo : 55|8@1+ (0.392157,0) [0|255] "" XXX + SG_ Throttle_Pedal : 32|8@1+ (1,0) [0|255] "" XXX + + +BO_ 65 NEW_MSG_1: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_4 : 32|12@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 16|12@1+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_5 : 31|1@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_6 : 48|8@1+ (1,0) [0|63] "" XXX + SG_ NEW_SIGNAL_7 : 59|2@0+ (1,0) [0|255] "" XXX + +BO_ 72 NEW_MSG_2: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 40|16@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 38|3@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 16|8@1+ (1,0) [0|255] "" XXX + +BO_ 316 NEW_MSG_3: 8 XXX + +BO_ 326 NEW_MSG_4: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_1 : 16|12@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 32|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 40|2@1+ (1,0) [0|255] "" XXX + +BO_ 315 G_Sensor: 8 XXX + SG_ longitudinal : 63|8@0- (1,0) [0|255] "" XXX + SG_ Latitudinal : 48|8@1- (1,0) [0|255] "" XXX + +BO_ 314 Wheel_Speeds: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ FR : 12|13@1+ (0.057,0) [0|255] "kph" XXX + SG_ RR : 25|13@1+ (0.057,0) [0|255] "kph" XXX + SG_ FL : 51|13@1+ (0.057,0) [0|255] "kph" XXX + SG_ RL : 38|13@1+ (0.057,0) [0|255] "kph" XXX + +BO_ 73 NEW_MSG_5: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 32|8@1+ (1,0) [0|4095] "" XXX + SG_ NEW_SIGNAL_2 : 24|8@1+ (1,0) [0|127] "" XXX + +BO_ 280 NEW_MSG_6: 8 XXX + SG_ NEW_SIGNAL_1 : 12|12@1- (1,0) [0|4095] "" XXX + SG_ NEW_SIGNAL_2 : 48|8@1- (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 61|1@1+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_4 : 40|4@1+ (1,0) [0|255] "" XXX + +BO_ 281 Steering_Torque: 8 XXX + SG_ checksum : 0|8@1+ (1,0) [0|3] "" XXX + SG_ counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ Steer_Torque_Sensor : 16|11@1- (-1,0) [0|3] "" XXX + SG_ Steering_Angle : 32|16@1- (-0.0217,0) [0|255] "" X + SG_ Steer_Torque_Output : 48|11@1- (-1,0) [0|31] "" XXX + +BO_ 312 Brake_Pressure_L_R: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|31] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|3] "" XXX + SG_ Brake_2 : 56|8@1+ (1,0) [0|255] "" XXX + SG_ Brake_1 : 48|8@1+ (1,0) [0|255] "" XXX + +BO_ 313 Brake_Pedal: 8 XXX + SG_ Brake_Pedal_On : 34|1@1+ (1,0) [0|7] "" XXX + SG_ Brake_Pedal : 36|12@1+ (1,0) [0|65535] "" XXX + +BO_ 290 ES_LKAS: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ LKAS_Output : 16|13@1- (-1,0) [0|3] "" XXX + SG_ LKAS_Request : 29|1@0+ (1,0) [0|3] "" XXX + SG_ SET_1 : 12|1@0+ (1,0) [0|3] "" XXX + +BO_ 722 NEW_MSG_10: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_1 : 27|3@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 56|2@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_5 : 45|2@0+ (1,0) [0|3] "" XXX + +BO_ 544 ES_Brake: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ Brake_Pressure : 16|16@1+ (1,0) [0|255] "" XXX + SG_ __Status : 36|4@1+ (1,0) [0|63] "" XXX + +BO_ 545 ES_Distance: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ Close_Distance : 40|8@1+ (1,0) [0|255] "" XXX + SG_ Distance_Swap : 37|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_5 : 39|1@1+ (1,0) [0|31] "" XXX + SG_ NEW_SIGNAL_9 : 38|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4 : 34|1@1+ (1,0) [0|3] "" XXX + SG_ Brake_Pedal : 33|1@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_10 : 35|1@1+ (1,0) [0|3] "" XXX + SG_ Throttle : 16|12@1+ (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_1 : 31|4@0+ (1,0) [0|15] "" XXX + SG_ SET_1 : 12|1@0+ (1,0) [0|3] "" XXX + SG_ ACC_ENABLE_BTN : 56|1@0+ (1,0) [0|1] "" XXX + SG_ Car_Follow : 32|1@1+ (1,0) [0|3] "" XXX + SG_ Brake : 36|1@0+ (1,0) [0|3] "" XXX + +BO_ 546 ES_Status: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ RPM : 16|12@1+ (1,0) [0|255] "" XXX + SG_ Cruise_Activated : 29|1@0+ (1,0) [0|3] "" XXX + SG_ Cruise_Brake : 30|1@1+ (1,0) [0|3] "" XXX + +BO_ 554 ES_Blank: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ SET_65535 : 39|16@1+ (1,0) [0|16777215] "" XXX + SG_ SET_1 : 13|1@1+ (1,0) [0|7] "" XXX + +BO_ 557 NEW_MSG_14: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 576 CruiseControl: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_5 : 42|1@1+ (1,0) [0|3] "" XXX + SG_ Cruise_On : 40|1@1+ (1,0) [0|3] "" XXX + SG_ Cruise_Activated : 41|1@1+ (1,0) [0|3] "" XXX + +BO_ 577 NEW_MSG_16: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_1 : 16|12@1+ (1,0) [0|255] "" XXX + +BO_ 552 NEW_MSG_17: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_1 : 48|1@1+ (1,0) [0|3] "" XXX + +BO_ 912 Dashlights: 8 XXX + SG_ NEW_SIGNAL_1 : 32|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_2 : 8|4@1+ (1,0) [0|15] "" XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ RIGHT_BLINKER : 51|1@1+ (1,0) [0|1] "" XXX + SG_ LEFT_BLINKER : 50|1@1+ (1,0) [0|3] "" XXX + SG_ SEATBELT_FL : 48|1@1+ (1,0) [0|1] "" XXX + +BO_ 940 BodyInfo: 8 XXX + SG_ DASH_BTN_LIGHTS : 56|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FL : 32|1@1+ (1,0) [0|255] "" XXX + SG_ DOOR_OPEN_FR : 33|1@1+ (1,0) [0|3] "" XXX + SG_ DOOR_OPEN_RL : 34|1@1+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RR : 35|1@1+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_TRUNK : 36|1@0+ (1,0) [0|1] "" XXX + SG_ FOG_LIGHTS2 : 60|1@1+ (1,0) [0|1] "" XXX + SG_ Highbeam : 58|1@1+ (1,0) [0|1] "" XXX + SG_ Lowbeam : 57|1@1+ (1,0) [0|3] "" XXX + +BO_ 801 ES_DashStatus: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_9 : 60|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_10 : 49|2@1+ (1,0) [0|3] "" XXX + SG_ Brake_Pedal : 51|1@1+ (1,0) [0|3] "" XXX + SG_ Cruise_Set_Speed : 40|8@1+ (1,0) [0|255] "" XXX + SG_ Cruise_Activated : 36|1@1+ (1,0) [0|3] "" XXX + SG_ Cruise_Disengaged : 35|1@1+ (1,0) [0|3] "" XXX + SG_ Far_Distance : 56|4@1+ (1,0) [0|15] "" XXX + SG_ Car_Follow : 52|1@1+ (1,0) [0|3] "" XXX + SG_ ACC_Distance : 28|3@1+ (1,0) [0|3] "" XXX + +BO_ 802 ES_LKAS_State: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ Keep_Hands_On_Wheel : 12|1@1+ (1,0) [0|1] "" XXX + SG_ Empty_Box : 13|1@1+ (1,0) [0|1] "" XXX + SG_ LKAS_ACTIVE : 17|1@1+ (1,0) [0|3] "" XXX + SG_ Backward_Speed_Limit_Menu : 23|1@1+ (1,0) [0|1] "" XXX + SG_ LKAS_ENABLE_3 : 24|1@1+ (1,0) [0|1] "" XXX + SG_ LKAS_ENABLE_2 : 26|1@1+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_7 : 28|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_2 : 30|1@1+ (1,0) [0|3] "" XXX + SG_ FCW_Cont_Beep : 32|1@1+ (1,0) [0|1] "" XXX + SG_ FCW_Repeated_Beep : 33|1@1+ (1,0) [0|1] "" XXX + SG_ Throttle_Management_Activated : 34|1@1+ (1,0) [0|1] "" XXX + SG_ Traffic_light_Ahead : 35|1@1+ (1,0) [0|1] "" XXX + SG_ Right_Depart : 36|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4 : 44|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_5 : 56|2@1+ (1,0) [0|3] "" XXX + +BO_ 805 ES_NEW_MSG_22: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 22|2@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_1 : 14|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4 : 15|1@1+ (1,0) [0|3] "" XXX + +BO_ 808 NEW_MSG_23: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 837 NEW_MSG_24: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 40|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 32|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_5 : 24|8@1+ (1,0) [0|255] "" XXX + +BO_ 838 NEW_MSG_25: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 16|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 40|1@1+ (1,0) [0|3] "" XXX + +BO_ 842 NEW_MSG_26: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 32|8@1+ (1,0) [0|255] "" XXX + +BO_ 915 NEW_MSG_27: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 16|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 32|9@1+ (1,0) [0|255] "" XXX + +BO_ 1788 NEW_MSG_28: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 40|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_4 : 48|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 16|8@1+ (1,0) [0|255] "" XXX + +BO_ 816 NEW_MSG_29: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 826 NEW_MSG_30: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 839 NEW_MSG_31: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 2015 NEW_MSG_32: 8 XXX + SG_ NEW_SIGNAL_2 : 16|8@1+ (1,0) [0|255] "" XXX + +BO_ 2024 NEW_MSG_33: 8 XXX + SG_ NEW_SIGNAL_1 : 24|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 0|3@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 16|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 32|8@1+ (1,0) [0|255] "" XXX + +BO_ 1614 NEW_MSG_34: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 1617 NEW_MSG_35: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 1632 NEW_MSG_36: 8 XXX + SG_ NEW_SIGNAL_1 : 55|16@0+ (1,0) [0|255] "" XXX + +BO_ 1650 NEW_MSG_37: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 1657 NEW_MSG_38: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 1658 NEW_MSG_39: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 33|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4 : 31|1@0+ (1,0) [0|3] "" XXX + +BO_ 1677 NEW_MSG_40: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 16|4@1+ (1,0) [0|15] "" XXX + +BO_ 1743 NEW_MSG_41: 8 XXX + SG_ Checksum : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 1785 NEW_MSG_42: 8 XXX + SG_ NEW_SIGNAL_1 : 0|4@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 21|1@1+ (1,0) [0|31] "" XXX + SG_ NEW_SIGNAL_3 : 17|1@1+ (1,0) [0|7] "" XXX + +BO_ 1759 NEW_MSG_43: 8 XXX + SG_ NEW_SIGNAL_1 : 17|1@1+ (1,0) [0|3] "" XXX + +BO_ 1786 NEW_MSG_44: 8 XXX + SG_ NEW_SIGNAL_1 : 0|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_2 : 16|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 8|8@1+ (1,0) [0|15] "" XXX + +BO_ 1787 NEW_MSG_45: 8 XXX + SG_ NEW_SIGNAL_1 : 0|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_2 : 8|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 16|8@1+ (1,0) [0|255] "" XXX + + + + +CM_ SG_ 940 FOG_LIGHTS2 "yellow fog light in the dash"; +CM_ SG_ 940 Highbeam "01 = low beam, 11 = high beam"; +CM_ SG_ 805 NEW_SIGNAL_3 "always 3"; +CM_ SG_ 805 NEW_SIGNAL_4 "always 1"; diff --git a/opendbc/subaru_outback_2015_eyesight.dbc b/opendbc/subaru_outback_2015_eyesight.dbc new file mode 100644 index 00000000000000..aad63e31058899 --- /dev/null +++ b/opendbc/subaru_outback_2015_eyesight.dbc @@ -0,0 +1,370 @@ +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX 0 + + +BO_ 2 Steering: 8 XXX + SG_ NEW_SIGNAL_1 : 31|4@0- (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_6 : 24|1@1+ (1,0) [0|3] "" XXX + SG_ Counter : 25|3@1+ (1,0) [0|15] "" XXX + SG_ Checksum : 32|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 22|3@0+ (1,0) [0|7] "" XXX + SG_ Steering_Angle : 7|16@0- (-0.1,-9) [-497|500] "degree" XXX + +BO_ 208 G_Sensor: 8 XXX + SG_ NEW_SIGNAL_3 : 32|8@1+ (1,0) [0|255] "" XXX + SG_ Steering_Angle : 0|16@1- (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_1 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ _Latitudinal : 16|16@1- (0.0035,1) [0|65535] "" XXX + SG_ _Longitudinal : 48|16@1- (0.000035,0) [0|255] "" XXX + +BO_ 209 Brake_Pedal: 8 XXX + SG_ NEW_SIGNAL_2 : 31|1@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 56|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 26|1@1+ (1,0) [0|3] "" XXX + SG_ Brake_Pedal : 23|8@0+ (1,0) [0|255] "" XXX + SG_ Speed : 0|16@1+ (0.05625,0) [0|255] "KPH" XXX + +BO_ 210 Brake_2: 8 XXX + SG_ NEW_SIGNAL_1 : 46|1@0+ (1,0) [0|4294967295] "" XXX + SG_ NEW_SIGNAL_2 : 39|3@0+ (1,0) [0|7] "" XXX + SG_ Right_Brake : 48|8@1+ (1,0) [0|255] "" XXX + SG_ Left_Brake : 63|8@0+ (1,0) [0|255] "" XXX + SG_ Brake_Light : 35|1@1+ (1,0) [0|15] "" XXX + SG_ Brake_Related : 36|1@1+ (1,0) [0|255] "" XXX + +BO_ 211 Brake_Type: 8 XXX + SG_ NEW_SIGNAL_4 : 28|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 7|1@0+ (1,0) [0|4294967295] "" XXX + SG_ NEW_SIGNAL_2 : 16|4@1+ (1,0) [0|15] "" XXX + SG_ Speed_Counter : 39|8@0+ (1,0) [0|15] "" XXX + SG_ Counter : 55|8@0+ (1,0) [0|255] "" XXX + SG_ Brake_Light : 21|1@0+ (1,0) [0|3] "" XXX + SG_ Brake_Cruise_On : 42|1@0+ (1,0) [0|3] "" XXX + SG_ Brake_Pedal_On : 46|1@0+ (1,0) [0|3] "" XXX + +BO_ 212 WHEEL_SPEEDS: 8 XXX + SG_ FL : 0|16@1+ (0.0592,0) [2|255] "KPH" XXX + SG_ FR : 16|16@1+ (0.0592,0) [0|255] "KPH" XXX + SG_ RL : 32|16@1+ (0.0592,0) [0|255] "" XXX + SG_ RR : 48|16@1+ (0.0592,0) [0|127] "KPH" XXX + +BO_ 320 Throttle: 8 XXX + SG_ Off_Throttle_2 : 56|1@1+ (1,0) [0|3] "" XXX + SG_ Throttle_Combo : 40|8@1+ (1,0) [0|255] "" XXX + SG_ Engine_RPM : 16|14@1+ (1,0) [0|15] "" XXX + SG_ Off_Throttle : 30|1@0+ (1,0) [0|3] "" XXX + SG_ Throttle_Cruise : 39|8@0+ (1,0) [0|255] "" XXX + SG_ Throttle_Body_ : 55|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 63|1@0+ (1,0) [0|15] "" XXX + SG_ Not_Full_Throttle : 14|1@0+ (1,0) [0|15] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ Throttle_Pedal : 0|8@1+ (0.392157,0) [0|255] "" XXX + +BO_ 321 undefined: 8 XXX + SG_ NEW_SIGNAL_7 : 59|2@1+ (1,0) [0|63] "" XXX + SG_ NEW_SIGNAL_6 : 46|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_2 : 47|1@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_5 : 48|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 54|2@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_8 : 31|4@0+ (1,0) [0|15] "" XXX + SG_ Engine_RPM : 32|12@1+ (1,0) [0|8191] "" XXX + SG_ Engine_Torque : 0|15@1+ (1,0) [0|255] "" XXX + SG_ Wheel_Torque : 16|12@1+ (1,0) [0|255] "" XXX + SG_ Engine_Stop : 15|1@0+ (1,0) [0|3] "" XXX + +BO_ 324 CruiseControl_2015: 8 XXX + SG_ Cruise_On : 48|1@0+ (1,0) [0|3] "" XXX + SG_ OnOffButton : 2|1@1+ (1,0) [0|3] "" XXX + SG_ SET_BUTTON : 3|1@0+ (1,0) [0|3] "" XXX + SG_ RES_BUTTON : 4|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_6 : 50|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4 : 28|5@0+ (1,0) [0|16777215] "" XXX + SG_ NEW_SIGNAL_9 : 15|1@1+ (1,0) [0|127] "" XXX + SG_ NEW_SIGNAL_2 : 8|1@0+ (1,0) [0|255] "" XXX + SG_ Cruise_Activated : 49|1@0+ (1,0) [0|7] "" XXX + SG_ Brake_Pedal_On : 51|1@0+ (1,0) [0|3] "" XXX + SG_ Button : 13|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_1 : 23|8@0+ (1,-124) [0|255] "" XXX + +BO_ 328 Transmission: 8 XXX + SG_ Counter : 11|4@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_7 : 63|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4 : 15|4@0+ (1,0) [0|15] "" XXX + SG_ Paddle_Shift : 60|2@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 31|1@0+ (1,0) [0|3] "" XXX + SG_ Transmission_Engine : 16|15@1+ (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_5 : 43|1@0+ (1,0) [0|65535] "" XXX + SG_ Gear : 48|4@1+ (1,0) [0|15] "" XXX + SG_ Gear_2 : 52|4@1+ (1,0) [0|15] "" XXX + SG_ Manual_Gear : 4|4@1+ (1,0) [0|255] "" XXX + +BO_ 329 CVT_Ratio: 8 XXX + SG_ NEW_SIGNAL_2 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 40|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 0|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 11|4@0+ (1,0) [0|65535] "" XXX + SG_ NEW_SIGNAL_1 : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 336 Brake_Pressure: 8 XXX + SG_ Brake_Pressure_Right : 0|8@1+ (1,0) [0|15] "" XXX + SG_ Brake_Pressure_Left : 15|8@0+ (1,0) [0|255] "" XXX + +BO_ 338 Stalk: 8 XXX + SG_ Wiper : 62|1@0+ (1,0) [0|3] "" XXX + SG_ brake_light : 52|1@0+ (1,0) [0|3] "" XXX + SG_ Headlights : 59|1@0+ (1,0) [0|3] "" XXX + SG_ Runlights : 58|1@1+ (1,0) [0|3] "" XXX + SG_ Highbeam : 60|1@0+ (1,0) [0|3] "" XXX + SG_ Counter : 15|4@0+ (1,0) [0|15] "" XXX + +BO_ 342 NEW_MSG_2: 8 XXX + +BO_ 346 Counter_3: 8 XXX + SG_ Counter : 0|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_1 : 20|1@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_2 : 57|1@1+ (1,0) [0|3] "" XXX + +BO_ 352 ES_Brake: 8 XXX + SG_ Counter : 48|3@1+ (1,0) [0|7] "" XXX + SG_ Checksum : 56|8@1+ (1,0) [0|7] "" XXX + SG_ Brake_On : 22|1@0+ (1,0) [0|3] "" XXX + SG_ Brake_Light : 20|1@0+ (1,0) [0|2047] "" XXX + SG_ Cruise_Activated : 23|1@0+ (1,0) [0|3] "" XXX + SG_ Brake_Pressure : 0|16@1+ (1,0) [0|255] "" XXX + +BO_ 353 ES_CruiseThrottle: 8 XXX + SG_ Throttle_Cruise : 0|12@1+ (1,0) [0|255] "" XXX + SG_ Counter_1 : 46|3@0+ (1,0) [0|15] "" XXX + SG_ Wheel_stop : 22|1@0+ (1,0) [0|3] "" XXX + SG_ CloseDistance : 24|8@1+ (1,0) [0|255] "" XXX + SG_ Unknown : 18|1@1+ (1,0) [0|7] "" XXX + SG_ Button_Speed_Down : 49|1@1+ (1,0) [0|3] "" XXX + SG_ Button_Resume : 50|1@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3_Blank : 15|4@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_2_Blank : 48|1@1+ (1,0) [0|3] "" XXX + SG_ Checksum : 56|8@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_9 : 17|1@1+ (1,0) [0|3] "" XXX + SG_ Cruise_Activatedish : 16|1@1+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_6_Blank : 23|1@0+ (1,0) [0|7] "" XXX + SG_ DistanceSwap : 21|1@0+ (1,0) [0|3] "" XXX + SG_ Brake_On : 20|1@0+ (1,0) [0|7] "" XXX + +BO_ 354 ES_RPM: 8 XXX + SG_ Counter : 48|3@1+ (1,0) [0|7] "" XXX + SG_ Cruise_Activated : 9|1@0+ (1,0) [0|3] "" XXX + SG_ Checksum : 39|8@0+ (1,0) [0|65535] "" XXX + SG_ RPM : 16|16@1+ (1,0) [0|255] "" XXX + SG_ Brake : 8|1@1+ (1,0) [0|7] "" XXX + +BO_ 356 ES_LKAS: 8 XXX + SG_ Checksum : 56|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 0|3@1+ (1,0) [0|8] "" XXX + SG_ LKAS_Active : 24|1@1+ (1,0) [0|1] "" XXX + SG_ LKAS_Command : 8|13@1- (-1,0) [-4096|4095] "" XXX + +BO_ 358 ES_Status: 8 XXX + SG_ Counter : 39|3@0+ (1,0) [0|7] "" XXX + SG_ Cruise_On : 16|1@1+ (1,0) [0|7] "" XXX + SG_ Cruise_Activated : 17|1@1+ (1,0) [0|3] "" XXX + SG_ Obstacle_Distance : 48|4@1+ (1,0) [0|15] "" XXX + SG_ Cruise_Off : 22|1@0+ (1,0) [0|3] "" XXX + SG_ Saved_Speed : 24|8@1+ (1,0) [0|255] "" XXX + SG_ Car_Follow : 46|1@1+ (1,0) [0|255] "" XXX + SG_ Driver_Input : 20|1@0+ (1,0) [0|15] "" XXX + SG_ WHEELS_MOVING_2015 : 19|1@1+ (1,0) [0|3] "" XXX + SG_ Untitled_Blank : 18|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_6_Blank : 21|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_5_Blank : 33|1@1+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4_Blank : 34|1@1+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_1 : 35|1@0+ (1,0) [0|31] "" XXX + SG_ 3SecondDisengage : 13|2@0+ (1,0) [0|3] "" XXX + SG_ Not_Ready_Startup : 0|3@1+ (1,0) [0|7] "" XXX + SG_ Steep_Hill_Disengage : 44|1@0+ (1,0) [0|3] "" XXX + SG_ Disengage_Alert : 15|2@0+ (1,0) [0|3] "" XXX + +BO_ 359 ES_LDW: 8 XXX + SG_ 2Right_Depart : 50|1@1+ (1,0) [0|7] "" XXX + SG_ 2All_Depart : 28|1@0+ (1,0) [0|3] "" XXX + SG_ 3All_Depart : 52|1@0+ (1,0) [0|3] "" XXX + SG_ Left_Depart_Front : 51|1@0+ (1,0) [0|3] "" XXX + SG_ All_depart_2015 : 0|1@1+ (1,0) [0|255] "" XXX + SG_ LKAS_Inactive_2017 : 36|1@1+ (1,0) [0|3] "" XXX + SG_ LKAS_Steer_Active_2017 : 37|1@0+ (1,0) [0|3] "" XXX + SG_ Right_Line_2017 : 24|1@1+ (1,0) [0|7] "" XXX + SG_ Left_Line_2017 : 25|1@1+ (1,0) [0|3] "" XXX + SG_ 1All_Depart : 31|1@0+ (1,0) [0|15] "" XXX + SG_ 1Right_Depart_Front : 49|1@1+ (1,0) [0|3] "" XXX + SG_ 1Right_Depart : 48|1@1+ (1,0) [0|3] "" XXX + +BO_ 392 Counter_0: 8 XXX + SG_ Counter : 16|4@1+ (1,0) [0|15] "" XXX + +BO_ 554 NEW_MSG_3: 8 XXX + SG_ Counter : 0|4@1+ (1,0) [0|255] "" XXX + +BO_ 604 undefined: 8 XXX + +BO_ 640 NEW_MSG_10: 8 XXX + SG_ NEW_SIGNAL_2 : 24|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 54|2@0+ (1,0) [0|15] "" XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 34|2@0+ (1,0) [0|63] "" XXX + SG_ NEW_SIGNAL_1 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 39|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_6 : 0|1@1+ (1,0) [0|7] "" XXX + SG_ NEW_SIGNAL_7 : 38|1@0+ (1,0) [0|3] "" XXX + +BO_ 642 Dashlights: 8 XXX + SG_ NEW_SIGNAL_2 : 32|1@1+ (1,0) [0|15] "" XXX + SG_ Counter : 15|4@0+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_1 : 0|12@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_3 : 34|2@1+ (1,0) [0|3] "" XXX + SG_ LEFT_BLINKER : 44|1@0+ (1,0) [0|3] "" XXX + SG_ RIGHT_BLINKER : 45|1@0+ (1,0) [0|3] "" XXX + +BO_ 644 NEW_MSG_8: 8 XXX + SG_ Counter : 8|4@1+ (1,0) [0|15] "" XXX + +BO_ 805 undefined: 8 XXX + +BO_ 880 Steer_Torque_2: 8 XXX + SG_ Counter : 40|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 48|4@1- (1,0) [0|15] "" XXX + SG_ Steering_Voltage_Flat : 7|8@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_1 : 8|1@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 30|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4_2017 : 52|1@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_5_2017 : 54|1@0+ (1,0) [0|3] "" XXX + SG_ Steer_Torque_Sensor : 32|8@1- (-1,0) [0|255] "" XXX + +BO_ 881 Steering_Torque: 8 XXX + SG_ Steering_Motor_Flat : 0|8@1+ (1,0) [0|255] "" XXX + SG_ Steer_Torque_Sensor : 39|8@0- (1,0) [0|255] "" XXX + SG_ Steering_Angle : 40|16@1- (-0.026,0) [0|255] "" XXX + SG_ Steering_Motor_LeftRight : 23|16@0- (-0.13,0) [0|255] "" XXX + +BO_ 882 Counter: 8 XXX + SG_ Counter : 15|4@0+ (1,0) [0|31] "" XXX + SG_ Something : 16|2@1+ (1,0) [0|255] "" XXX + +BO_ 884 DOORS_STATUS: 8 XXX + SG_ DOOR_OPEN_FR : 24|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FL : 25|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RL : 26|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RR : 27|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_Hatch : 28|1@0+ (1,0) [0|1] "" XXX + +BO_ 886 undefined: 8 XXX + +BO_ 864 Engine_Temp: 8 XXX + SG_ NEW_SIGNAL_1 : 32|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 44|1@1+ (1,0) [0|3] "" XXX + SG_ Saved_Speed : 56|8@1+ (1,0) [0|255] "" XXX + SG_ Cruise_Activated : 45|1@1+ (1,0) [0|3] "" XXX + SG_ Oil_Temp : 16|8@1+ (1,-40) [0|255] "" XXX + SG_ Coolant_Temp : 24|8@1+ (1,-40) [0|255] "" XXX + +BO_ 865 NEW_MSG_16: 8 XXX + SG_ NEW_SIGNAL_1 : 16|8@1+ (1,0) [0|255] "" XXX + SG_ Counter : 32|4@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_2 : 12|1@1+ (1,0) [0|255] "" XXX + +BO_ 866 Fuel__: 8 XXX + SG_ NEW_SIGNAL_2 : 55|8@0+ (1,0) [0|16777215] "" XXX + SG_ NEW_SIGNAL_3 : 35|4@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_4 : 47|8@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_1 : 0|16@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_5 : 24|1@0+ (1,0) [0|32767] "" XXX + +BO_ 872 NEW_MSG_15: 8 XXX + SG_ NEW_SIGNAL_1 : 31|8@0+ (1,0) [0|65535] "" XXX + +BO_ 977 NEW_MSG_12: 8 XXX + SG_ NEW_SIGNAL_1 : 0|8@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 16|12@1+ (1,0) [0|255] "" XXX + +BO_ 1632 Huge_Counter: 8 XXX + SG_ NEW_SIGNAL_1 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ Counter : 55|16@0+ (1,0) [0|255] "" XXX + +BO_ 1745 NEW_MSG_11: 8 XXX + SG_ NEW_SIGNAL_1 : 24|6@1+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 40|6@1+ (1,0) [0|15] "" XXX + SG_ NEW_SIGNAL_3 : 0|8@1+ (1,0) [0|255] "" XXX + +BO_ 1786 NEW_MSG_9: 8 XXX + SG_ Counter : 3|4@0+ (1,0) [0|255] "" XXX + SG_ NEW_SIGNAL_2 : 8|16@1+ (1,0) [0|15] "" XXX + + + + +CM_ SG_ 2 NEW_SIGNAL_1 ""; +CM_ SG_ 211 Brake_Pedal_On "high tolerance"; +CM_ SG_ 212 FL "KPH"; +CM_ SG_ 212 RL "KPH"; +CM_ SG_ 320 Off_Throttle_2 "Less sensitive"; +CM_ SG_ 320 Throttle_Body_ "Throttle related"; +CM_ SG_ 328 Gear "15 = P, 14 = R, 0 = N, 1-6=gear"; +CM_ SG_ 328 Gear_2 "15 = P, 14 = R, 0 = N, 1-6=gear"; +CM_ SG_ 338 Wiper "0 off, 1 on"; +CM_ SG_ 353 NEW_SIGNAL_3_Blank "always 2"; +CM_ SG_ 353 NEW_SIGNAL_2_Blank "0"; +CM_ SG_ 353 NEW_SIGNAL_9 "flipped around quick engagement"; +CM_ SG_ 353 NEW_SIGNAL_6_Blank "always 1"; +CM_ SG_ 353 Brake_On "long activatedish"; +CM_ SG_ 354 RPM "20hz version of Transmission_Engine under Transmission"; +CM_ SG_ 358 Cruise_Activated "is 1 when cruise is able to go"; +CM_ SG_ 358 Car_Follow "front car detected"; +CM_ SG_ 358 3SecondDisengage "seatbelt disengage"; +CM_ SG_ 358 Disengage_Alert "seatbelt and steep hill disengage"; +CM_ SG_ 359 2All_Depart "Left and right depart"; +CM_ SG_ 359 Left_Depart_Front "warning after acceleration into car in front and left depart"; +CM_ SG_ 359 All_depart_2015 "always 1 on 2017"; +CM_ SG_ 359 LKAS_Inactive_2017 "1 when not steering, 0 when lkas steering"; +CM_ SG_ 359 1All_Depart "Left and right depart"; +CM_ SG_ 359 1Right_Depart_Front "object in front, right depart, hill steep and seatbelt disengage alert "; +CM_ SG_ 359 1Right_Depart "right depart, hill steep and seatbelt disengage"; +CM_ SG_ 642 Counter "Affected by signals"; +CM_ SG_ 642 RIGHT_BLINKER "0 off, 2 right, 1 left"; +CM_ SG_ 880 Steering_Voltage_Flat "receives later than 371"; +CM_ SG_ 880 NEW_SIGNAL_1 "0 in 2017"; +CM_ SG_ 880 NEW_SIGNAL_2 ""; +CM_ SG_ 880 NEW_SIGNAL_4_2017 "1 in 2017"; +CM_ SG_ 880 NEW_SIGNAL_5_2017 "1 in 2017"; +CM_ SG_ 881 Steering_Motor_Flat "Possibly motor voltage"; +CM_ SG_ 881 Steering_Angle "Missing extra larger bits"; diff --git a/opendbc/tesla_can.dbc b/opendbc/tesla_can.dbc index 5858d1750efa81..37d839e44671c3 100644 --- a/opendbc/tesla_can.dbc +++ b/opendbc/tesla_can.dbc @@ -328,7 +328,8 @@ VAL_ 69 StW_Sw00_Psd 1 "PRESSED" 0 "NOT_PRESSED_SNA" ; VAL_ 69 StW_Sw01_Psd 1 "PRESSED" 0 "NOT_PRESSED_SNA" ; VAL_ 69 StW_Sw03_Psd 1 "PRESSED" 0 "NOT_PRESSED_SNA" ; VAL_ 69 StW_Sw04_Psd 1 "PRESSED" 0 "NOT_PRESSED_SNA" ; -VAL_ 69 WprSw6Posn 7 "SNA" 6 "STAGE2" 5 "STAGE1" 4 "INTERVAL4" 3 "INTERVAL3" 2 "INTERVAL2" 1 "INTERVAL1" 0 "OFF" ;VAL_ 257 GTW_epasControlType 0 "WITHOUT" 1 "WITH_ANGLE" 3 "WITH_BOTH" 2 "WITH_TORQUE" ; +VAL_ 69 WprSw6Posn 7 "SNA" 6 "STAGE2" 5 "STAGE1" 4 "INTERVAL4" 3 "INTERVAL3" 2 "INTERVAL2" 1 "INTERVAL1" 0 "OFF" ; +VAL_ 257 GTW_epasControlType 0 "WITHOUT" 1 "WITH_ANGLE" 3 "WITH_BOTH" 2 "WITH_TORQUE" ; VAL_ 109 StW_Sw_Stat3 7 "SNA" 6 "NDEF6" 5 "NDEF5" 4 "NDEF4" 3 "PLUS_MINUS" 2 "MINUS" 1 "PLUS" 0 "NPSD" ; VAL_ 109 MsgTxmtId 3 "NDEF3" 2 "NDEF2" 1 "SCCM" 0 "EWM" ; VAL_ 109 TSL_RND_Posn_StW 15 "SNA" 8 "D" 6 "INI" 4 "N_DOWN" 2 "N_UP" 1 "R" 0 "IDLE" ; diff --git a/opendbc/toyota_avalon_2017_pt_generated.dbc b/opendbc/toyota_avalon_2017_pt_generated.dbc index 2053c76a1f197d..64c39ff82f5364 100644 --- a/opendbc/toyota_avalon_2017_pt_generated.dbc +++ b/opendbc/toyota_avalon_2017_pt_generated.dbc @@ -14,6 +14,22 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + CM_ "Imported file _toyota_2017.dbc starts here" VERSION "" @@ -58,6 +74,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -73,13 +94,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -114,29 +145,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -168,6 +189,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -178,33 +202,96 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; diff --git a/opendbc/toyota_camry_hybrid_2018_pt_generated.dbc b/opendbc/toyota_camry_hybrid_2018_pt_generated.dbc index d51b09db273f66..5d4fd39a6e32e2 100644 --- a/opendbc/toyota_camry_hybrid_2018_pt_generated.dbc +++ b/opendbc/toyota_camry_hybrid_2018_pt_generated.dbc @@ -14,6 +14,22 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + CM_ "Imported file _toyota_2017.dbc starts here" VERSION "" @@ -58,6 +74,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -73,13 +94,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -114,29 +145,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -168,6 +189,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -178,33 +202,96 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; @@ -231,6 +318,7 @@ BO_ 608 STEER_TORQUE_SENSOR: 8 XXX SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ STEER_ANGLE : 31|16@0- (0.05527,0) [-500|500] "" XXX BO_ 610 EPS_STATUS: 8 EPS SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX diff --git a/opendbc/toyota_chr_2018_pt_generated.dbc b/opendbc/toyota_chr_2018_pt_generated.dbc index 4884f5efb5e1df..a2e169f94b5554 100644 --- a/opendbc/toyota_chr_2018_pt_generated.dbc +++ b/opendbc/toyota_chr_2018_pt_generated.dbc @@ -14,6 +14,22 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + CM_ "Imported file _toyota_2017.dbc starts here" VERSION "" @@ -58,6 +74,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -73,13 +94,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -114,29 +145,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -168,6 +189,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -178,33 +202,96 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; @@ -234,11 +321,15 @@ BO_ 610 EPS_STATUS: 8 EPS SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 956 GEAR_PACKET: 8 XXX + SG_ SPORT_ON : 2|1@0+ (1,0) [0|1] "" XXX SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + SG_ ECON_ON : 40|1@0+ (1,0) [0|1] "" XXX CM_ SG_ 548 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 548 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; -VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 956 SPORT_ON 0 "off" 1 "on"; +VAL_ 956 ECON_ON 0 "off" 1 "on"; diff --git a/opendbc/toyota_chr_hybrid_2018_pt_generated.dbc b/opendbc/toyota_chr_hybrid_2018_pt_generated.dbc new file mode 100644 index 00000000000000..574d3c2006bdb7 --- /dev/null +++ b/opendbc/toyota_chr_hybrid_2018_pt_generated.dbc @@ -0,0 +1,334 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _comma.dbc starts here" +BO_ 359 STEERING_IPAS_COMMA: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + + +CM_ "Imported file _toyota_2017.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX DSU HCU EPS IPAS + +BO_ 36 KINEMATICS: 8 XXX + SG_ ACCEL_Y : 33|10@0+ (1,-512) [0|65535] "" XXX + SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX + SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + +BO_ 166 BRAKE: 8 XXX + SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX + +BO_ 170 WHEEL_SPEEDS: 8 XXX + SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_FL : 23|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RR : 39|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RL : 55|16@0+ (0.01,-67.67) [0|250] "kph" XXX + +BO_ 180 SPEED: 8 XXX + SG_ ENCODER : 39|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX + +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + +BO_ 466 PCM_CRUISE: 8 XXX + SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX + SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX + SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 552 ACCELEROMETER: 8 XXX + SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX + SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX + +BO_ 560 BRAKE_MODULE2: 7 XXX + SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX + +BO_ 614 STEERING_IPAS: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 643 PRE_COLLISION: 8 XXX + +BO_ 740 STEERING_LKA: 5 XXX + SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX + SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX + SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX + SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 742 LEAD_INFO: 8 DSU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU + SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU + SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU + +BO_ 835 ACC_CONTROL: 8 DSU + SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX + SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU + SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU + SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 921 PCM_CRUISE_SM: 8 XXX + SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX + SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 951 ESP_CONTROL: 8 ESP + SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_LIGHTS_ACC : 18|1@0+ (1,0) [0|1] "" XXX + +BO_ 1041 ACC_HUD: 8 DSU + SG_ FCW : 4|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X20 : 15|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X10 : 39|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X80 : 55|8@0+ (1,0) [0|1] "" XXX + +BO_ 1042 LKAS_HUD: 8 XXX + SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX + SG_ RIGHT_LINE : 3|2@0+ (1,0) [0|3] "" XXX + SG_ LEFT_LINE : 5|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01 : 7|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01_2 : 11|2@0+ (1,0) [0|3] "" XXX + SG_ LDA_ALERT : 9|2@0+ (1,0) [0|3] "" XXX + SG_ TWO_BEEPS : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ADJUSTING_CAMERA : 13|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MALFUNCTION : 15|1@0+ (1,0) [0|1] "" XXX + SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X0C : 23|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X2C : 47|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X38 : 55|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X02 : 63|8@0+ (1,0) [0|1] "" XXX + +BO_ 1553 UI_SEETING: 8 XXX + SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX + +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + +BO_ 1568 SEATS_DOORS: 8 XXX + SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RR : 43|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FR : 44|1@0+ (1,0) [0|1] "" XXX + +BO_ 1570 LIGHT_STALK: 8 SCM + SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + +CM_ SG_ 36 ACCEL_Y "unit is tbd"; +CM_ SG_ 36 YAW_RATE "verify"; +CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; +CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; +CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; +CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; +CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; +CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; +CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; +CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; +CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; +VAL_ 614 STATE 3 "enabled" 1 "disabled"; +VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; +VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + + +CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; + +CM_ "toyota_chr_hybrid_2018_pt.dbc starts here" + + + +BO_ 295 GEAR_PACKET: 8 XXX + SG_ CAR_MOVEMENT : 39|8@0- (1,0) [0|255] "" XXX + SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 581 GAS_PEDAL: 8 XXX + SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 8 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +CM_ SG_ 548 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 548 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered"; +VAL_ 295 GEAR 0 "P" 1 "R" 2 "N" 3 "D" 4 "B"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; diff --git a/opendbc/toyota_corolla_2017_pt_generated.dbc b/opendbc/toyota_corolla_2017_pt_generated.dbc index 42e3a098f1e00c..14aff972e1d6de 100644 --- a/opendbc/toyota_corolla_2017_pt_generated.dbc +++ b/opendbc/toyota_corolla_2017_pt_generated.dbc @@ -14,6 +14,22 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + CM_ "Imported file _toyota_2017.dbc starts here" VERSION "" @@ -58,6 +74,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -73,13 +94,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -114,29 +145,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -168,6 +189,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -178,33 +202,96 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; diff --git a/opendbc/toyota_highlander_2017_pt_generated.dbc b/opendbc/toyota_highlander_2017_pt_generated.dbc index c99e22a9463e5e..cd78b63de2e930 100644 --- a/opendbc/toyota_highlander_2017_pt_generated.dbc +++ b/opendbc/toyota_highlander_2017_pt_generated.dbc @@ -14,6 +14,22 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + CM_ "Imported file _toyota_2017.dbc starts here" VERSION "" @@ -58,6 +74,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -73,13 +94,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -114,29 +145,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -168,6 +189,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -178,33 +202,96 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; diff --git a/opendbc/toyota_highlander_hybrid_2018_pt_generated.dbc b/opendbc/toyota_highlander_hybrid_2018_pt_generated.dbc new file mode 100644 index 00000000000000..08831635d74c54 --- /dev/null +++ b/opendbc/toyota_highlander_hybrid_2018_pt_generated.dbc @@ -0,0 +1,331 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _comma.dbc starts here" +BO_ 359 STEERING_IPAS_COMMA: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + + +CM_ "Imported file _toyota_2017.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX DSU HCU EPS IPAS + +BO_ 36 KINEMATICS: 8 XXX + SG_ ACCEL_Y : 33|10@0+ (1,-512) [0|65535] "" XXX + SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX + SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + +BO_ 166 BRAKE: 8 XXX + SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX + +BO_ 170 WHEEL_SPEEDS: 8 XXX + SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_FL : 23|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RR : 39|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RL : 55|16@0+ (0.01,-67.67) [0|250] "kph" XXX + +BO_ 180 SPEED: 8 XXX + SG_ ENCODER : 39|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX + +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + +BO_ 466 PCM_CRUISE: 8 XXX + SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX + SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX + SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 552 ACCELEROMETER: 8 XXX + SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX + SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX + +BO_ 560 BRAKE_MODULE2: 7 XXX + SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX + +BO_ 614 STEERING_IPAS: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 643 PRE_COLLISION: 8 XXX + +BO_ 740 STEERING_LKA: 5 XXX + SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX + SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX + SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX + SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 742 LEAD_INFO: 8 DSU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU + SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU + SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU + +BO_ 835 ACC_CONTROL: 8 DSU + SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX + SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU + SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU + SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 921 PCM_CRUISE_SM: 8 XXX + SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX + SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 951 ESP_CONTROL: 8 ESP + SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_LIGHTS_ACC : 18|1@0+ (1,0) [0|1] "" XXX + +BO_ 1041 ACC_HUD: 8 DSU + SG_ FCW : 4|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X20 : 15|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X10 : 39|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X80 : 55|8@0+ (1,0) [0|1] "" XXX + +BO_ 1042 LKAS_HUD: 8 XXX + SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX + SG_ RIGHT_LINE : 3|2@0+ (1,0) [0|3] "" XXX + SG_ LEFT_LINE : 5|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01 : 7|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01_2 : 11|2@0+ (1,0) [0|3] "" XXX + SG_ LDA_ALERT : 9|2@0+ (1,0) [0|3] "" XXX + SG_ TWO_BEEPS : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ADJUSTING_CAMERA : 13|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MALFUNCTION : 15|1@0+ (1,0) [0|1] "" XXX + SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X0C : 23|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X2C : 47|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X38 : 55|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X02 : 63|8@0+ (1,0) [0|1] "" XXX + +BO_ 1553 UI_SEETING: 8 XXX + SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX + +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + +BO_ 1568 SEATS_DOORS: 8 XXX + SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RR : 43|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FR : 44|1@0+ (1,0) [0|1] "" XXX + +BO_ 1570 LIGHT_STALK: 8 SCM + SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + +CM_ SG_ 36 ACCEL_Y "unit is tbd"; +CM_ SG_ 36 YAW_RATE "verify"; +CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; +CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; +CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; +CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; +CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; +CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; +CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; +CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; +CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; +VAL_ 614 STATE 3 "enabled" 1 "disabled"; +VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; +VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + + +CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; + +CM_ "toyota_highlander_hybrid_2018_pt.dbc starts here" + + + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 581 GAS_PEDAL: 5 XXX + SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 5 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 956 GEAR_PACKET: 8 XXX + SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + +CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; diff --git a/opendbc/toyota_prius_2010_pt.dbc b/opendbc/toyota_prius_2010_pt.dbc new file mode 100644 index 00000000000000..5dba519583c5bb --- /dev/null +++ b/opendbc/toyota_prius_2010_pt.dbc @@ -0,0 +1,203 @@ +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX DSU HCU EPS IPAS + + +BO_ 36 KINEMATICS: 8 XXX + SG_ ACCEL_Y : 33|10@0+ (1,-512) [0|65535] "" XXX + SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX + +BO_ 166 BRAKE: 8 XXX + SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX + +BO_ 170 WHEEL_SPEEDS: 8 XXX + SG_ WHEEL_SPEED_FR : 7|16@0+ (0.0062,-67.67) [0|250] "mph" XXX + SG_ WHEEL_SPEED_FL : 23|16@0+ (0.0062,-67.67) [0|250] "mph" XXX + SG_ WHEEL_SPEED_RR : 39|16@0+ (0.0062,-67.67) [0|250] "mph" XXX + SG_ WHEEL_SPEED_RL : 55|16@0+ (0.0062,-67.67) [0|250] "mph" XXX + +BO_ 180 SPEED: 8 XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ SPEED : 47|16@0+ (0.0062,0) [0|115] "mph" XXX + SG_ ENCODER : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 295 GEAR_PACKET: 8 XXX + SG_ CAR_MOVEMENT : 39|8@0- (1,0) [0|255] "" XXX + SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX + +BO_ 466 PCM_CRUISE: 8 XXX + SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX + SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 552 ACCELEROMETER: 8 XXX + SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX + SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX + +BO_ 560 BRAKE_MODULE2: 8 XXX + SG_ BRAKE_LIGHTS : 26|1@0+ (1,0) [0|1] "" XXX + +BO_ 581 GAS_PEDAL: 8 XXX + SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.66,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 5 EPS + SG_ STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 614 STEERING_IPAS: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1,0) [0|16777215] "" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 643 PRE_COLLISION: 8 XXX + +BO_ 740 STEERING_LKA: 8 XXX + SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX + SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX + SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX + +BO_ 742 LEAD_INFO: 8 DSU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU + SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU + SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU + +BO_ 835 ACC_CONTROL: 8 DSU + SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU + +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 921 PCM_CRUISE_SM: 8 XXX + SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 951 ESP_CONTROL: 8 ESP + SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX + +BO_ 1042 LKAS_HUD: 8 XXX + SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX + SG_ RIGHT_LINE : 3|2@0+ (1,0) [0|3] "" XXX + SG_ LEFT_LINE : 5|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_1 : 7|2@0+ (1,0) [0|3] "" XXX + SG_ LDA_ALERT : 9|2@0+ (1,0) [0|3] "" XXX + SG_ TWO_BEEPS : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ADJUSTING_CAMERA : 13|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MALFUNCTION : 15|1@0+ (1,0) [0|1] "" XXX + +BO_ 1553 UI_SEETING: 8 XXX + SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX + +BO_ 1568 SEATS_DOORS: 8 XXX + SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RR : 43|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FR : 44|1@0+ (1,0) [0|1] "" XXX + +BO_ 452 POWERTRAIN: 8 XXX + SG_ ENGINE_RPM : 7|16@0+ (1,0) [0|65535] "rpm" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + + + + +CM_ SG_ 36 ACCEL_Y "unit is tbd"; +CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 36 YAW_RATE "verify"; +CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 560 BRAKE_LIGHTS "double check"; +CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered"; +CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; +CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; +CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 1042 SET_ME_1 "unclear what this is, nut it's always 1 in drive traces"; +VAL_ 295 GEAR 0 "P" 1 "R" 2 "N" 3 "D" 4 "B" ; +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; +VAL_ 610 STATE 5 "override" 3 "enabled" 1 "disabled" ; +VAL_ 610 LKA_STATE 50 "temporary_fault" ; +VAL_ 614 STATE 3 "enabled" 1 "disabled" ; +VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left" ; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted" ; +VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none" ; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none" ; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none" ; +VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none" ; +VAL_ 1553 UNITS 1 "km" 2 "miles" ; +CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; diff --git a/opendbc/toyota_prius_2017_adas.dbc b/opendbc/toyota_prius_2017_adas.dbc index 9d1646f04af4dc..4aae65aa408baa 100644 --- a/opendbc/toyota_prius_2017_adas.dbc +++ b/opendbc/toyota_prius_2017_adas.dbc @@ -182,80 +182,95 @@ BO_ 543 TRACK_A_15: 8 XXX BO_ 544 TRACK_B_0: 8 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 545 TRACK_B_1: 8 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 546 TRACK_B_2: 8 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 547 TRACK_B_3: 8 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 548 TRACK_B_4: 8 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 549 TRACK_B_5: 8 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 550 TRACK_B_6: 8 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 551 TRACK_B_7: 8 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX BO_ 552 TRACK_B_8: 6 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX BO_ 553 TRACK_B_9: 6 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX BO_ 554 TRACK_B_10: 6 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX BO_ 555 TRACK_B_11: 6 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX BO_ 556 TRACK_B_12: 6 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX BO_ 557 TRACK_B_13: 6 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX BO_ 558 TRACK_B_14: 6 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX BO_ 559 TRACK_B_15: 6 XXX SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX + SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX - diff --git a/opendbc/toyota_prius_2017_pt_generated.dbc b/opendbc/toyota_prius_2017_pt_generated.dbc index 8151c906329f05..abc4f08171c367 100644 --- a/opendbc/toyota_prius_2017_pt_generated.dbc +++ b/opendbc/toyota_prius_2017_pt_generated.dbc @@ -14,6 +14,22 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + CM_ "Imported file _toyota_2017.dbc starts here" VERSION "" @@ -58,6 +74,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -73,13 +94,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -114,29 +145,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -168,6 +189,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -178,33 +202,96 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; diff --git a/opendbc/toyota_rav4_2017_pt_generated.dbc b/opendbc/toyota_rav4_2017_pt_generated.dbc index 1d8f7f7eadc1d9..872715625d6892 100644 --- a/opendbc/toyota_rav4_2017_pt_generated.dbc +++ b/opendbc/toyota_rav4_2017_pt_generated.dbc @@ -14,6 +14,22 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + CM_ "Imported file _toyota_2017.dbc starts here" VERSION "" @@ -58,6 +74,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -73,13 +94,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -114,29 +145,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -168,6 +189,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -178,33 +202,96 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; diff --git a/opendbc/toyota_rav4_hybrid_2017_pt_generated.dbc b/opendbc/toyota_rav4_hybrid_2017_pt_generated.dbc index f372dfcc247223..a75dcb3af916f6 100644 --- a/opendbc/toyota_rav4_hybrid_2017_pt_generated.dbc +++ b/opendbc/toyota_rav4_hybrid_2017_pt_generated.dbc @@ -14,6 +14,22 @@ BO_ 359 STEERING_IPAS_COMMA: 8 IPAS CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + CM_ "Imported file _toyota_2017.dbc starts here" VERSION "" @@ -58,6 +74,11 @@ BO_ 36 KINEMATICS: 8 XXX SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + BO_ 166 BRAKE: 8 XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX @@ -73,13 +94,23 @@ BO_ 180 SPEED: 8 XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + BO_ 466 PCM_CRUISE: 8 XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + BO_ 552 ACCELEROMETER: 8 XXX SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX @@ -114,29 +145,19 @@ BO_ 742 LEAD_INFO: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU - SG_ SET_ME_X63 : 23|8@0+ (1,0) [0|255] "" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX -BO_ 1556 STEERING_LEVERS: 8 XXX - SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX - -BO_ 37 STEER_ANGLE_SENSOR: 8 XXX - SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX - SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX - SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX - -BO_ 467 PCM_CRUISE_2: 8 XXX - SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX - SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX - SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX - SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX - BO_ 921 PCM_CRUISE_SM: 8 XXX SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX BO_ 951 ESP_CONTROL: 8 ESP @@ -168,6 +189,9 @@ BO_ 1042 LKAS_HUD: 8 XXX BO_ 1553 UI_SEETING: 8 XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + BO_ 1568 SEATS_DOORS: 8 XXX SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX @@ -178,33 +202,96 @@ BO_ 1568 SEATS_DOORS: 8 XXX BO_ 1570 LIGHT_STALK: 8 SCM SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + CM_ SG_ 36 ACCEL_Y "unit is tbd"; CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; -CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; -CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; -CM_ SG_ 37 STEER_RATE "factor is tbd"; -CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; -CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; -VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ; -VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; VAL_ 614 STATE 3 "enabled" 1 "disabled"; VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; -VAL_ 1553 UNITS 1 "km" 2 "miles"; -VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; -VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none"; -VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; @@ -233,7 +320,14 @@ BO_ 610 EPS_STATUS: 5 EPS SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX BO_ 956 GEAR_PACKET: 8 XXX + SG_ SPORT_ON : 2|1@0+ (1,0) [0|1] "" XXX SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + SG_ SPORT_GEAR_ON : 33|1@0+ (1,0) [0|1] "" XXX + SG_ SPORT_GEAR : 38|3@0+ (1,0) [0|7] "" XXX + SG_ ECON_ON : 40|1@0+ (1,0) [0|1] "" XXX + SG_ DRIVE_ENGAGED : 47|1@0+ (1,0) [0|1] "" XXX + + CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force"; CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; @@ -241,4 +335,9 @@ CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered"; CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby"; +VAL_ 956 SPORT_ON 0 "off" 1 "on"; VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 956 SPORT_GEAR_ON 0 "off" 1 "on"; +VAL_ 956 SPORT_GEAR 1 "S1" 2 "S2" 3 "S3" 4 "S4" 5 "S5" 6 "S6"; +VAL_ 956 ECON_ON 0 "off" 1 "on"; +VAL_ 956 DRIVE_ENGAGED 0 "off" 1 "on"; diff --git a/opendbc/toyota_sienna_xle_2018_pt_generated.dbc b/opendbc/toyota_sienna_xle_2018_pt_generated.dbc new file mode 100644 index 00000000000000..32ef3f518a6047 --- /dev/null +++ b/opendbc/toyota_sienna_xle_2018_pt_generated.dbc @@ -0,0 +1,331 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _comma.dbc starts here" +BO_ 359 STEERING_IPAS_COMMA: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +CM BO_ STEERING_IPAS_COMMA "Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant"; + + BO_ 512 GAS_COMMAND: 6 EON + SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR + SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR + SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR + + BO_ 513 GAS_SENSOR: 6 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.159375,-75.555) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.159375,-151.111) [0|1] "" EON + SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON + SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON + + VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ; + + +CM_ "Imported file _toyota_2017.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BS_: + +BU_: XXX DSU HCU EPS IPAS + +BO_ 36 KINEMATICS: 8 XXX + SG_ ACCEL_Y : 33|10@0+ (1,-512) [0|65535] "" XXX + SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX + SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX + +BO_ 37 STEER_ANGLE_SENSOR: 8 XXX + SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX + SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX + SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX + +BO_ 166 BRAKE: 8 XXX + SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX + +BO_ 170 WHEEL_SPEEDS: 8 XXX + SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_FL : 23|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RR : 39|16@0+ (0.01,-67.67) [0|250] "kph" XXX + SG_ WHEEL_SPEED_RL : 55|16@0+ (0.01,-67.67) [0|250] "kph" XXX + +BO_ 180 SPEED: 8 XXX + SG_ ENCODER : 39|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX + +BO_ 353 DSU_SPEED: 8 XXX + SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX + +BO_ 466 PCM_CRUISE: 8 XXX + SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX + SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX + SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 467 PCM_CRUISE_2: 8 XXX + SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX + SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX + SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 552 ACCELEROMETER: 8 XXX + SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX + SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX + +BO_ 560 BRAKE_MODULE2: 7 XXX + SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX + +BO_ 614 STEERING_IPAS: 8 IPAS + SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX + SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX + SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 643 PRE_COLLISION: 8 XXX + +BO_ 740 STEERING_LKA: 5 XXX + SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX + SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX + SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX + SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 742 LEAD_INFO: 8 DSU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU + SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU + SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU + +BO_ 835 ACC_CONTROL: 8 DSU + SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU + SG_ SET_ME_X01 : 23|2@0+ (1,0) [0|3] "" HCU + SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX + SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX + SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU + SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU + SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 921 PCM_CRUISE_SM: 8 XXX + SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX + SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX + SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX + SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX + +BO_ 951 ESP_CONTROL: 8 ESP + SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKE_LIGHTS_ACC : 18|1@0+ (1,0) [0|1] "" XXX + +BO_ 1041 ACC_HUD: 8 DSU + SG_ FCW : 4|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X20 : 15|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X10 : 39|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X80 : 55|8@0+ (1,0) [0|1] "" XXX + +BO_ 1042 LKAS_HUD: 8 XXX + SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX + SG_ RIGHT_LINE : 3|2@0+ (1,0) [0|3] "" XXX + SG_ LEFT_LINE : 5|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01 : 7|2@0+ (1,0) [0|3] "" XXX + SG_ SET_ME_X01_2 : 11|2@0+ (1,0) [0|3] "" XXX + SG_ LDA_ALERT : 9|2@0+ (1,0) [0|3] "" XXX + SG_ TWO_BEEPS : 12|1@0+ (1,0) [0|1] "" XXX + SG_ ADJUSTING_CAMERA : 13|1@0+ (1,0) [0|1] "" XXX + SG_ LDA_MALFUNCTION : 15|1@0+ (1,0) [0|1] "" XXX + SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X0C : 23|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X2C : 47|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X38 : 55|8@0+ (1,0) [0|1] "" XXX + SG_ SET_ME_X02 : 63|8@0+ (1,0) [0|1] "" XXX + +BO_ 1553 UI_SEETING: 8 XXX + SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX + +BO_ 1556 STEERING_LEVERS: 8 XXX + SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX + +BO_ 1568 SEATS_DOORS: 8 XXX + SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_RR : 43|1@0+ (1,0) [0|1] "" XXX + SG_ DOOR_OPEN_FR : 44|1@0+ (1,0) [0|1] "" XXX + +BO_ 1570 LIGHT_STALK: 8 SCM + SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX + +BO_ 1161 RSA1: 8 FCM + SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "kph" XXX + SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX + SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1162 RSA2: 8 FCM + SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX + SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX + SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX + SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX + SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX + SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX + SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX + SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX + SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX + SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX + +BO_ 1163 RSA3: 8 FCM + SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX + SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX + SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX + SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX + SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX + SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX + SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX + +CM_ SG_ 36 ACCEL_Y "unit is tbd"; +CM_ SG_ 36 YAW_RATE "verify"; +CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd"; +CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; +CM_ SG_ 37 STEER_RATE "factor is tbd"; +CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; +CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect"; +CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph"; +CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?"; +CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque"; +CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value"; +CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active"; +CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit"; +CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel"; +CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces"; +CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts"; +CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit."; +CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1161 SPDVAL2 "conditional speed value 70" +CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0"; +CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz"; +CM_ SG_ 1163 TSREQPD "always 1"; +CM_ SG_ 1163 TSRMSW "always 1"; +CM_ SG_ 1163 OTSGNNTM "always 3"; +CM_ SG_ 1163 NTLVLSPD "always 3"; +CM_ SG_ 1163 OVSPNTM "always 3"; +CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds"; +CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds"; +CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds"; +CM_ SG_ 1163 TSRSPU "always 1"; + +VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off"; +VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok"; +VAL_ 614 STATE 3 "enabled" 1 "disabled"; +VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left"; +VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted"; +VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none"; +VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none"; +VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none"; +VAL_ 1553 UNITS 1 "km" 2 "miles"; +VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; +VAL_ 1161 TSGN1 1 "speed sign" 0 "none"; +VAL_ 1161 TSGN2 1 "speed sign" 0 "none"; +VAL_ 1161 SPLSGN2 15 "conditional blank" 5 "rain" 0 "none"; +VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 65 "no overtake" 129 "no entry"; +VAL_ 1162 SPLSGN3 15 "conditional blank" 5 "rain" 0 "none"; + + +CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180"; + +CM_ "toyota_sienna_xle_2018_pt.dbc starts here" + + + +BO_ 550 BRAKE_MODULE: 8 XXX + SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|255] "" XXX + SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|65535] "" XXX + SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|3] "" XXX + +BO_ 705 GAS_PEDAL: 8 XXX + SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX + SG_ GAS_PEDAL : 55|8@0+ (0.005,0) [0|1] "" XXX + +BO_ 608 STEER_TORQUE_SENSOR: 8 XXX + SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX + SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX + SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX + +BO_ 610 EPS_STATUS: 5 EPS + SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX + SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX + SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX + +BO_ 956 GEAR_PACKET: 8 XXX + SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX + +CM_ SG_ 548 BRAKE_PRESSURE "seems prop to pedal force"; +CM_ SG_ 548 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8"; +CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others"; +VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P"; +VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled"; +VAL_ 610 LKA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 1 "standby" diff --git a/panda/.circleci/config.yml b/panda/.circleci/config.yml index e372b2a30775ff..6b98610c507527 100644 --- a/panda/.circleci/config.yml +++ b/panda/.circleci/config.yml @@ -25,9 +25,25 @@ jobs: command: | docker run panda_build /bin/bash -c "cd /panda; python setup.py install" - run: - name: Build STM image + name: Build Panda STM image command: | docker run panda_build /bin/bash -c "cd /panda/board; make bin" + - run: + name: Build Panda STM bootstub image + command: | + docker run panda_build /bin/bash -c "cd /panda/board; make obj/bootstub.panda.bin" + - run: + name: Build Pedal STM image + command: | + docker run panda_build /bin/bash -c "cd /panda/board/pedal; make obj/comma.bin" + - run: + name: Build Pedal STM bootstub image + command: | + docker run panda_build /bin/bash -c "cd /panda/board/pedal; make obj/bootstub.bin" + - run: + name: Build NEO STM image + command: | + docker run panda_build /bin/bash -c "cd /panda/board; make clean; make -f Makefile.legacy obj/comma.bin" - run: name: Build ESP image command: | diff --git a/panda/README.md b/panda/README.md index e323d400e1fdec..42f432dfc32a38 100644 --- a/panda/README.md +++ b/panda/README.md @@ -3,7 +3,7 @@ Welcome to panda [panda](http://github.com/commaai/panda) is the nicest universal car interface ever. - + diff --git a/panda/VERSION b/panda/VERSION index efdb8b180122a5..0408c30b42460f 100644 --- a/panda/VERSION +++ b/panda/VERSION @@ -1 +1 @@ -v1.1.2 \ No newline at end of file +v1.2.0 \ No newline at end of file diff --git a/panda/board/bootstub.c b/panda/board/bootstub.c index 4e516110c5d4bb..e44986c29ec47c 100644 --- a/panda/board/bootstub.c +++ b/panda/board/bootstub.c @@ -51,6 +51,9 @@ void fail() { // know where to sig check extern void *_app_start[]; +// FIXME: sometimes your panda will fail flashing and will quickly blink a single Green LED +// BOUNTY: $200 coupon on shop.comma.ai or $100 check. + int main() { __disable_irq(); clock_init(); diff --git a/panda/board/build.mk b/panda/board/build.mk index aee724c19044c1..a84ed3fd9d9193 100644 --- a/panda/board/build.mk +++ b/panda/board/build.mk @@ -1,7 +1,15 @@ -CFLAGS += -I inc -I ../ -nostdlib -fno-builtin -std=gnu11 -O2 +CFLAGS += -I inc -I ../ -nostdlib -fno-builtin -std=gnu11 -Os CFLAGS += -Tstm32_flash.ld +# Compile fast charge (DCP) only not on EON +ifeq (,$(wildcard /EON)) + BUILDER = DEV +else + CFLAGS += "-DEON" + BUILDER = EON +endif + CC = arm-none-eabi-gcc OBJCOPY = arm-none-eabi-objcopy OBJDUMP = arm-none-eabi-objdump @@ -51,6 +59,8 @@ obj/$(PROJ_NAME).bin: obj/$(STARTUP_FILE).o obj/main.$(PROJ_NAME).o $(CC) -Wl,--section-start,.isr_vector=0x8004000 $(CFLAGS) -o obj/$(PROJ_NAME).elf $^ $(OBJCOPY) -v -O binary obj/$(PROJ_NAME).elf obj/code.bin SETLEN=1 ../crypto/sign.py obj/code.bin $@ $(CERT) + @BINSIZE=$$(du -b "obj/$(PROJ_NAME).bin" | cut -f 1) ; if [ $$BINSIZE -ge 32768 ]; then echo "ERROR obj/$(PROJ_NAME).bin is too big!"; exit 1; fi; + obj/bootstub.$(PROJ_NAME).bin: obj/$(STARTUP_FILE).o obj/bootstub.$(PROJ_NAME).o obj/sha.$(PROJ_NAME).o obj/rsa.$(PROJ_NAME).o $(CC) $(CFLAGS) -o obj/bootstub.$(PROJ_NAME).elf $^ diff --git a/panda/board/drivers/can.h b/panda/board/drivers/can.h index cd809704b9a407..b837094c9a0d38 100644 --- a/panda/board/drivers/can.h +++ b/panda/board/drivers/can.h @@ -158,7 +158,7 @@ void can_set_speed(uint8_t can_number) { // initialization mode CAN->MCR = CAN_MCR_TTCM | CAN_MCR_INRQ; while((CAN->MSR & CAN_MSR_INAK) != CAN_MSR_INAK); - + // set time quanta from defines CAN->BTR = (CAN_BTR_TS1_0 * (CAN_SEQ1-1)) | (CAN_BTR_TS2_0 * (CAN_SEQ2-1)) | @@ -461,8 +461,6 @@ void CAN3_SCE_IRQHandler() { can_sce(CAN3); } #endif -#include "canbitbang.h" - void can_send(CAN_FIFOMailBox_TypeDef *to_push, uint8_t bus_number) { if (safety_tx_hook(to_push) && !can_autobaud_enabled[bus_number]) { if (bus_number < BUS_MAX) { @@ -470,8 +468,10 @@ void can_send(CAN_FIFOMailBox_TypeDef *to_push, uint8_t bus_number) { // bus number isn't passed through to_push->RDTR &= 0xF; if (bus_number == 3 && can_num_lookup[3] == 0xFF) { + #ifdef PANDA // TODO: why uint8 bro? only int8? bitbang_gmlan(to_push); + #endif } else { can_push(can_queues[bus_number], to_push); process_can(CAN_NUM_FROM_BUS_NUM(bus_number)); diff --git a/panda/board/drivers/canbitbang.h b/panda/board/drivers/canbitbang.h deleted file mode 100644 index 5226366b171990..00000000000000 --- a/panda/board/drivers/canbitbang.h +++ /dev/null @@ -1,203 +0,0 @@ -#define MAX_BITS_CAN_PACKET (200) - -// returns out_len -int do_bitstuff(char *out, char *in, int in_len) { - int last_bit = -1; - int bit_cnt = 0; - int j = 0; - for (int i = 0; i < in_len; i++) { - char bit = in[i]; - out[j++] = bit; - - // do the stuffing - if (bit == last_bit) { - bit_cnt++; - if (bit_cnt == 5) { - // 5 in a row the same, do stuff - last_bit = !bit; - out[j++] = last_bit; - bit_cnt = 1; - } - } else { - // this is a new bit - last_bit = bit; - bit_cnt = 1; - } - } - return j; -} - -int append_crc(char *in, int in_len) { - int crc = 0; - for (int i = 0; i < in_len; i++) { - crc <<= 1; - if (in[i] ^ ((crc>>15)&1)) { - crc = crc ^ 0x4599; - } - crc &= 0x7fff; - } - for (int i = 14; i >= 0; i--) { - in[in_len++] = (crc>>i)&1; - } - return in_len; -} - -int append_bits(char *in, int in_len, char *app, int app_len) { - for (int i = 0; i < app_len; i++) { - in[in_len++] = app[i]; - } - return in_len; -} - -int append_int(char *in, int in_len, int val, int val_len) { - for (int i = val_len-1; i >= 0; i--) { - in[in_len++] = (val&(1<RDTR & 0xF; - len = append_int(pkt, len, 0, 1); // Start-of-frame - - if (to_bang->RIR & 4) { - // extended identifier - len = append_int(pkt, len, to_bang->RIR >> 21, 11); // Identifier - len = append_int(pkt, len, 3, 2); // SRR+IDE - len = append_int(pkt, len, (to_bang->RIR >> 3) & ((1<<18)-1), 18); // Identifier - len = append_int(pkt, len, 0, 3); // RTR+r1+r0 - } else { - // standard identifier - len = append_int(pkt, len, to_bang->RIR >> 21, 11); // Identifier - len = append_int(pkt, len, 0, 3); // RTR+IDE+reserved - } - - len = append_int(pkt, len, dlc_len, 4); // Data length code - - // append data - for (int i = 0; i < dlc_len; i++) { - unsigned char dat = ((unsigned char *)(&(to_bang->RDLR)))[i]; - len = append_int(pkt, len, dat, 8); - } - - // append crc - len = append_crc(pkt, len); - - // do bitstuffing - len = do_bitstuff(out, pkt, len); - - // append footer - len = append_bits(out, len, footer, sizeof(footer)); - return len; -} - -// hardware stuff below this line - -#ifdef PANDA - -void set_bitbanged_gmlan(int val) { - if (val) { - GPIOB->ODR |= (1 << 13); - } else { - GPIOB->ODR &= ~(1 << 13); - } -} - -char pkt_stuffed[MAX_BITS_CAN_PACKET]; -int gmlan_sending = -1; -int gmlan_sendmax = -1; - -int gmlan_silent_count = 0; -int gmlan_fail_count = 0; -#define REQUIRED_SILENT_TIME 10 -#define MAX_FAIL_COUNT 10 - -void TIM4_IRQHandler(void) { - if (TIM4->SR & TIM_SR_UIF && gmlan_sendmax != -1) { - int read = get_gpio_input(GPIOB, 12); - if (gmlan_silent_count < REQUIRED_SILENT_TIME) { - if (read == 0) { - gmlan_silent_count = 0; - } else { - gmlan_silent_count++; - } - } else if (gmlan_silent_count == REQUIRED_SILENT_TIME) { - int retry = 0; - // in send loop - if (gmlan_sending > 0 && // not first bit - (read == 0 && pkt_stuffed[gmlan_sending-1] == 1) && // bus wrongly dominant - gmlan_sending != (gmlan_sendmax-11)) { //not ack bit - puts("GMLAN ERR: bus driven at "); - puth(gmlan_sending); - puts("\n"); - retry = 1; - } else if (read == 1 && gmlan_sending == (gmlan_sendmax-11)) { // recessive during ACK - puts("GMLAN ERR: didn't recv ACK\n"); - retry = 1; - } - if (retry) { - // reset sender (retry after 7 silent) - set_bitbanged_gmlan(1); // recessive - gmlan_silent_count = 0; - gmlan_sending = 0; - gmlan_fail_count++; - if (gmlan_fail_count == MAX_FAIL_COUNT) { - puts("GMLAN ERR: giving up send\n"); - } - } else { - set_bitbanged_gmlan(pkt_stuffed[gmlan_sending]); - gmlan_sending++; - } - } - if (gmlan_sending == gmlan_sendmax || gmlan_fail_count == MAX_FAIL_COUNT) { - set_bitbanged_gmlan(1); // recessive - set_gpio_mode(GPIOB, 13, MODE_INPUT); - TIM4->DIER = 0; // no update interrupt - TIM4->CR1 = 0; // disable timer - gmlan_sendmax = -1; // exit - } - } - TIM4->SR = 0; -} - -void bitbang_gmlan(CAN_FIFOMailBox_TypeDef *to_bang) { - // TODO: make failure less silent - if (gmlan_sendmax != -1) return; - - int len = get_bit_message(pkt_stuffed, to_bang); - gmlan_fail_count = 0; - gmlan_silent_count = 0; - gmlan_sending = 0; - gmlan_sendmax = len; - - // setup for bitbang loop - set_bitbanged_gmlan(1); // recessive - set_gpio_mode(GPIOB, 13, MODE_OUTPUT); - - // setup - TIM4->PSC = 48-1; // tick on 1 us - TIM4->CR1 = TIM_CR1_CEN; // enable - TIM4->ARR = 30-1; // 33.3 kbps - - // in case it's disabled - NVIC_EnableIRQ(TIM4_IRQn); - - // run the interrupt - TIM4->DIER = TIM_DIER_UIE; // update interrupt - TIM4->SR = 0; -} - -#endif - diff --git a/panda/board/drivers/gmlan_alt.h b/panda/board/drivers/gmlan_alt.h new file mode 100644 index 00000000000000..8521100a88083a --- /dev/null +++ b/panda/board/drivers/gmlan_alt.h @@ -0,0 +1,276 @@ +#define GMLAN_TICKS_PER_SECOND 33300 //1sec @ 33.3kbps +#define GMLAN_TICKS_PER_TIMEOUT_TICKLE 500 //15ms @ 33.3kbps +#define GMLAN_HIGH 0 //0 is high on bus (dominant) +#define GMLAN_LOW 1 //1 is low on bus + +#define DISABLED -1 +#define BITBANG 0 +#define GPIO_SWITCH 1 + +#define MAX_BITS_CAN_PACKET (200) + +int gmlan_alt_mode = DISABLED; + +// returns out_len +int do_bitstuff(char *out, char *in, int in_len) { + int last_bit = -1; + int bit_cnt = 0; + int j = 0; + for (int i = 0; i < in_len; i++) { + char bit = in[i]; + out[j++] = bit; + + // do the stuffing + if (bit == last_bit) { + bit_cnt++; + if (bit_cnt == 5) { + // 5 in a row the same, do stuff + last_bit = !bit; + out[j++] = last_bit; + bit_cnt = 1; + } + } else { + // this is a new bit + last_bit = bit; + bit_cnt = 1; + } + } + return j; +} + +int append_crc(char *in, int in_len) { + int crc = 0; + for (int i = 0; i < in_len; i++) { + crc <<= 1; + if (in[i] ^ ((crc>>15)&1)) { + crc = crc ^ 0x4599; + } + crc &= 0x7fff; + } + for (int i = 14; i >= 0; i--) { + in[in_len++] = (crc>>i)&1; + } + return in_len; +} + +int append_bits(char *in, int in_len, char *app, int app_len) { + for (int i = 0; i < app_len; i++) { + in[in_len++] = app[i]; + } + return in_len; +} + +int append_int(char *in, int in_len, int val, int val_len) { + for (int i = val_len-1; i >= 0; i--) { + in[in_len++] = (val&(1<RDTR & 0xF; + len = append_int(pkt, len, 0, 1); // Start-of-frame + + if (to_bang->RIR & 4) { + // extended identifier + len = append_int(pkt, len, to_bang->RIR >> 21, 11); // Identifier + len = append_int(pkt, len, 3, 2); // SRR+IDE + len = append_int(pkt, len, (to_bang->RIR >> 3) & ((1<<18)-1), 18); // Identifier + len = append_int(pkt, len, 0, 3); // RTR+r1+r0 + } else { + // standard identifier + len = append_int(pkt, len, to_bang->RIR >> 21, 11); // Identifier + len = append_int(pkt, len, 0, 3); // RTR+IDE+reserved + } + + len = append_int(pkt, len, dlc_len, 4); // Data length code + + // append data + for (int i = 0; i < dlc_len; i++) { + unsigned char dat = ((unsigned char *)(&(to_bang->RDLR)))[i]; + len = append_int(pkt, len, dat, 8); + } + + // append crc + len = append_crc(pkt, len); + + // do bitstuffing + len = do_bitstuff(out, pkt, len); + + // append footer + len = append_bits(out, len, footer, sizeof(footer)); + return len; +} + +#ifdef PANDA + +void setup_timer4() { + // setup + TIM4->PSC = 48-1; // tick on 1 us + TIM4->CR1 = TIM_CR1_CEN; // enable + TIM4->ARR = 30-1; // 33.3 kbps + + // in case it's disabled + NVIC_EnableIRQ(TIM4_IRQn); + + // run the interrupt + TIM4->DIER = TIM_DIER_UIE; // update interrupt + TIM4->SR = 0; +} + +int gmlan_timeout_counter = GMLAN_TICKS_PER_TIMEOUT_TICKLE; //GMLAN transceiver times out every 17ms held high; tickle every 15ms +int can_timeout_counter = GMLAN_TICKS_PER_SECOND; //1 second + +int inverted_bit_to_send = GMLAN_HIGH; +int gmlan_switch_below_timeout = -1; +int gmlan_switch_timeout_enable = 0; + +void gmlan_switch_init(int timeout_enable) { + gmlan_switch_timeout_enable = timeout_enable; + gmlan_alt_mode = GPIO_SWITCH; + gmlan_switch_below_timeout = 1; + set_gpio_mode(GPIOB, 13, MODE_OUTPUT); + + setup_timer4(); + + inverted_bit_to_send = GMLAN_LOW; //We got initialized, set the output low +} + +void set_gmlan_digital_output(int to_set) { + inverted_bit_to_send = to_set; + /* + puts("Writing "); + puth(inverted_bit_to_send); + puts("\n"); + */ +} + +void reset_gmlan_switch_timeout(void) { + can_timeout_counter = GMLAN_TICKS_PER_SECOND; + gmlan_switch_below_timeout = 1; + gmlan_alt_mode = GPIO_SWITCH; +} + +void set_bitbanged_gmlan(int val) { + if (val) { + GPIOB->ODR |= (1 << 13); + } else { + GPIOB->ODR &= ~(1 << 13); + } +} + +char pkt_stuffed[MAX_BITS_CAN_PACKET]; +int gmlan_sending = -1; +int gmlan_sendmax = -1; + +int gmlan_silent_count = 0; +int gmlan_fail_count = 0; +#define REQUIRED_SILENT_TIME 10 +#define MAX_FAIL_COUNT 10 + +void TIM4_IRQHandler(void) { + if (gmlan_alt_mode == BITBANG) { + if (TIM4->SR & TIM_SR_UIF && gmlan_sendmax != -1) { + int read = get_gpio_input(GPIOB, 12); + if (gmlan_silent_count < REQUIRED_SILENT_TIME) { + if (read == 0) { + gmlan_silent_count = 0; + } else { + gmlan_silent_count++; + } + } else if (gmlan_silent_count == REQUIRED_SILENT_TIME) { + int retry = 0; + // in send loop + if (gmlan_sending > 0 && // not first bit + (read == 0 && pkt_stuffed[gmlan_sending-1] == 1) && // bus wrongly dominant + gmlan_sending != (gmlan_sendmax-11)) { //not ack bit + puts("GMLAN ERR: bus driven at "); + puth(gmlan_sending); + puts("\n"); + retry = 1; + } else if (read == 1 && gmlan_sending == (gmlan_sendmax-11)) { // recessive during ACK + puts("GMLAN ERR: didn't recv ACK\n"); + retry = 1; + } + if (retry) { + // reset sender (retry after 7 silent) + set_bitbanged_gmlan(1); // recessive + gmlan_silent_count = 0; + gmlan_sending = 0; + gmlan_fail_count++; + if (gmlan_fail_count == MAX_FAIL_COUNT) { + puts("GMLAN ERR: giving up send\n"); + } + } else { + set_bitbanged_gmlan(pkt_stuffed[gmlan_sending]); + gmlan_sending++; + } + } + if (gmlan_sending == gmlan_sendmax || gmlan_fail_count == MAX_FAIL_COUNT) { + set_bitbanged_gmlan(1); // recessive + set_gpio_mode(GPIOB, 13, MODE_INPUT); + TIM4->DIER = 0; // no update interrupt + TIM4->CR1 = 0; // disable timer + gmlan_sendmax = -1; // exit + } + } + TIM4->SR = 0; + } //bit bang mode + + else if (gmlan_alt_mode == GPIO_SWITCH) { + if (TIM4->SR & TIM_SR_UIF && gmlan_switch_below_timeout != -1) { + if (can_timeout_counter == 0 && gmlan_switch_timeout_enable) { + //it has been more than 1 second since timeout was reset; disable timer and restore the GMLAN output + set_gpio_output(GPIOB, 13, GMLAN_LOW); + gmlan_switch_below_timeout = -1; + gmlan_timeout_counter = GMLAN_TICKS_PER_TIMEOUT_TICKLE; + gmlan_alt_mode = DISABLED; + } + else { + can_timeout_counter--; + if (gmlan_timeout_counter == 0) { + //Send a 1 (bus low) every 15ms to reset the GMLAN transceivers timeout + gmlan_timeout_counter = GMLAN_TICKS_PER_TIMEOUT_TICKLE; + set_gpio_output(GPIOB, 13, GMLAN_LOW); + } + else { + set_gpio_output(GPIOB, 13, inverted_bit_to_send); + gmlan_timeout_counter--; + } + } + } + TIM4->SR = 0; + } //gmlan switch mode +} + +void bitbang_gmlan(CAN_FIFOMailBox_TypeDef *to_bang) { + gmlan_alt_mode = BITBANG; + // TODO: make failure less silent + if (gmlan_sendmax != -1) return; + + int len = get_bit_message(pkt_stuffed, to_bang); + gmlan_fail_count = 0; + gmlan_silent_count = 0; + gmlan_sending = 0; + gmlan_sendmax = len; + + // setup for bitbang loop + set_bitbanged_gmlan(1); // recessive + set_gpio_mode(GPIOB, 13, MODE_OUTPUT); + + setup_timer4(); +} + +#endif diff --git a/panda/board/gpio.h b/panda/board/gpio.h index 6112f6f887c703..7bd24ecbb7c32d 100644 --- a/panda/board/gpio.h +++ b/panda/board/gpio.h @@ -454,6 +454,7 @@ void early() { #ifdef PANDA // enable the ESP, disable ESP boot mode // unless we are on a giant panda, then there's no ESP + // dont disable on grey panda if (is_giant_panda) { set_esp_mode(ESP_DISABLED); } else { diff --git a/panda/board/main.c b/panda/board/main.c index a15861a17e5c82..8ee1bb0c8c830c 100644 --- a/panda/board/main.c +++ b/panda/board/main.c @@ -15,6 +15,7 @@ #include "drivers/uart.h" #include "drivers/adc.h" #include "drivers/usb.h" +#include "drivers/gmlan_alt.h" #include "drivers/can.h" #include "drivers/spi.h" #include "drivers/timer.h" @@ -538,6 +539,9 @@ int main() { } else { // enable ESP uart uart_init(USART1, 115200); + #ifdef EON + set_esp_mode(ESP_DISABLED); + #endif } // enable LIN uart_init(UART5, 10400); @@ -558,6 +562,7 @@ int main() { usb_init(); // default to silent mode to prevent issues with Ford + // hardcode a specific safety mode if you want to force the panda to be in a specific mode safety_set_mode(SAFETY_NOOUTPUT, 0); can_silent = ALL_CAN_SILENT; can_init_all(); @@ -614,6 +619,7 @@ int main() { } break; case USB_POWER_CDP: +#ifndef EON // been CLICKS clicks since we switched to CDP if ((cnt-marker) >= CLICKS) { // measure current draw, if positive and no enumeration, switch to DCP @@ -627,6 +633,7 @@ int main() { if (current >= CURRENT_THRESHOLD) { marker = cnt; } +#endif break; case USB_POWER_DCP: // been at least CLICKS clicks since we switched to DCP diff --git a/panda/board/pedal/Makefile b/panda/board/pedal/Makefile index 9917e381503b03..37b95f90fb1880 100644 --- a/panda/board/pedal/Makefile +++ b/panda/board/pedal/Makefile @@ -30,12 +30,20 @@ recover: obj/bootstub.bin obj/$(PROJ_NAME).bin $(DFU_UTIL) -d 0483:df11 -a 0 -s 0x08004000 -D obj/$(PROJ_NAME).bin $(DFU_UTIL) -d 0483:df11 -a 0 -s 0x08000000:leave -D obj/bootstub.bin +include ../../common/version.mk + +obj/cert.h: ../../crypto/getcertheader.py + ../../crypto/getcertheader.py ../../certs/debug.pub ../../certs/release.pub > $@ + obj/main.o: main.c ../*.h mkdir -p obj $(CC) $(CFLAGS) -o $@ -c $< -obj/bootstub.o: ../bootstub.c ../*.h +obj/bootstub.o: ../bootstub.c ../*.h obj/gitversion.h obj/cert.h mkdir -p obj + mkdir -p ../obj + cp obj/gitversion.h ../obj/gitversion.h + cp obj/cert.h ../obj/cert.h $(CC) $(CFLAGS) -o $@ -c $< obj/$(STARTUP_FILE).o: ../$(STARTUP_FILE).s diff --git a/panda/board/pedal/main.c b/panda/board/pedal/main.c index 5d5264791ccf54..13a221a871fafc 100644 --- a/panda/board/pedal/main.c +++ b/panda/board/pedal/main.c @@ -70,21 +70,24 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, int hardwired) { #endif -// ***************************** honda can checksum ***************************** - -int can_cksum(uint8_t *dat, int len, int addr, int idx) { - int i; - int s = 0; - for (i = 0; i < len; i++) { - s += (dat[i] >> 4); - s += dat[i] & 0xF; +// ***************************** pedal can checksum ***************************** + +uint8_t pedal_checksum(uint8_t *dat, int len) { + uint8_t crc = 0xFF; + uint8_t poly = 0xD5; // standard crc8 + int i, j; + for (i = len - 1; i >= 0; i--) { + crc ^= dat[i]; + for (j = 0; j < 8; j++) { + if ((crc & 0x80) != 0) { + crc = (uint8_t)((crc << 1) ^ poly); + } + else { + crc <<= 1; + } + } } - s += (addr>>0)&0xF; - s += (addr>>4)&0xF; - s += (addr>>8)&0xF; - s += idx; - s = 8-s; - return s&0xF; + return crc; } // ***************************** can port ***************************** @@ -92,6 +95,8 @@ int can_cksum(uint8_t *dat, int len, int addr, int idx) { // addresses to be used on CAN #define CAN_GAS_INPUT 0x200 #define CAN_GAS_OUTPUT 0x201 +#define CAN_GAS_SIZE 6 +#define COUNTER_CYCLE 0xF void CAN1_TX_IRQHandler() { // clear interrupt @@ -134,14 +139,19 @@ void CAN1_RX0_IRQHandler() { } // normal packet - uint8_t *dat = (uint8_t *)&CAN->sFIFOMailBox[0].RDLR; - uint8_t *dat2 = (uint8_t *)&CAN->sFIFOMailBox[0].RDHR; + uint8_t dat[8]; + uint8_t *rdlr = (uint8_t *)&CAN->sFIFOMailBox[0].RDLR; + uint8_t *rdhr = (uint8_t *)&CAN->sFIFOMailBox[0].RDHR; + for (int i=0; i<4; i++) { + dat[i] = rdlr[i]; + dat[i+4] = rdhr[i]; + } uint16_t value_0 = (dat[0] << 8) | dat[1]; uint16_t value_1 = (dat[2] << 8) | dat[3]; - uint8_t enable = (dat2[0] >> 7) & 1; - uint8_t index = (dat2[1] >> 4) & 3; - if (can_cksum(dat, 5, CAN_GAS_INPUT, index) == (dat2[1] & 0xF)) { - if (((current_index+1)&3) == index) { + uint8_t enable = (dat[4] >> 7) & 1; + uint8_t index = dat[4] & COUNTER_CYCLE; + if (pedal_checksum(dat, CAN_GAS_SIZE - 1) == dat[5]) { + if (((current_index + 1) & COUNTER_CYCLE) == index) { #ifdef DEBUG puts("setting gas "); puth(value); @@ -196,18 +206,18 @@ void TIM3_IRQHandler() { // check timer for sending the user pedal and clearing the CAN if ((CAN->TSR & CAN_TSR_TME0) == CAN_TSR_TME0) { uint8_t dat[8]; - dat[0] = (pdl0>>8)&0xFF; - dat[1] = (pdl0>>0)&0xFF; - dat[2] = (pdl1>>8)&0xFF; - dat[3] = (pdl1>>0)&0xFF; - dat[4] = state; - dat[5] = can_cksum(dat, 5, CAN_GAS_OUTPUT, pkt_idx) | (pkt_idx<<4); + dat[0] = (pdl0>>8) & 0xFF; + dat[1] = (pdl0>>0) & 0xFF; + dat[2] = (pdl1>>8) & 0xFF; + dat[3] = (pdl1>>0) & 0xFF; + dat[4] = (state & 0xF) << 4 | pkt_idx; + dat[5] = pedal_checksum(dat, CAN_GAS_SIZE - 1); CAN->sTxMailBox[0].TDLR = dat[0] | (dat[1]<<8) | (dat[2]<<16) | (dat[3]<<24); CAN->sTxMailBox[0].TDHR = dat[4] | (dat[5]<<8); CAN->sTxMailBox[0].TDTR = 6; // len of packet is 5 CAN->sTxMailBox[0].TIR = (CAN_GAS_OUTPUT << 21) | 1; ++pkt_idx; - pkt_idx &= 3; + pkt_idx &= COUNTER_CYCLE; } else { // old can packet hasn't sent! state = FAULT_SEND; diff --git a/panda/board/pedal/obj/.gitkeep b/panda/board/pedal/obj/.gitkeep new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/panda/board/safety.h b/panda/board/safety.h index 4b5a84084845dd..6e5dc8e36f62b2 100644 --- a/panda/board/safety.h +++ b/panda/board/safety.h @@ -5,6 +5,14 @@ struct sample_t { int max; } sample_t_default = {{0}, 0, 0}; +// no float support in STM32F2 micros (cortex-m3) +#ifdef PANDA +struct lookup_t { + float x[3]; + float y[3]; +}; +#endif + void safety_rx_hook(CAN_FIFOMailBox_TypeDef *to_push); int safety_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); int safety_tx_lin_hook(int lin_num, uint8_t *data, int len); @@ -16,9 +24,12 @@ int max_limit_check(int val, const int MAX, const int MIN); int dist_to_meas_check(int val, int val_last, struct sample_t *val_meas, const int MAX_RATE_UP, const int MAX_RATE_DOWN, const int MAX_ERROR); int driver_limit_check(int val, int val_last, struct sample_t *val_driver, - const int MAX, const int MAX_RATE_UP, const int MAX_RATE_DOWN, + const int MAX, const int MAX_RATE_UP, const int MAX_RATE_DOWN, const int MAX_ALLOWANCE, const int DRIVER_FACTOR); int rt_rate_limit_check(int val, int val_last, const int MAX_RT_DELTA); +#ifdef PANDA +float interpolate(struct lookup_t xy, float x); +#endif typedef void (*safety_hook_init)(int16_t param); typedef void (*rx_hook)(CAN_FIFOMailBox_TypeDef *to_push); @@ -45,10 +56,15 @@ int controls_allowed = 0; #include "safety/safety_toyota.h" #ifdef PANDA #include "safety/safety_toyota_ipas.h" +#include "safety/safety_tesla.h" +#include "safety/safety_gm_ascm.h" #endif #include "safety/safety_gm.h" #include "safety/safety_ford.h" #include "safety/safety_cadillac.h" +#include "safety/safety_hyundai.h" +#include "safety/safety_chrysler.h" +#include "safety/safety_subaru.h" #include "safety/safety_elm327.h" const safety_hooks *current_hooks = &nooutput_hooks; @@ -87,6 +103,11 @@ typedef struct { #define SAFETY_HONDA_BOSCH 4 #define SAFETY_FORD 5 #define SAFETY_CADILLAC 6 +#define SAFETY_HYUNDAI 7 +#define SAFETY_TESLA 8 +#define SAFETY_CHRYSLER 9 +#define SAFETY_SUBARU 10 +#define SAFETY_GM_ASCM 0x1334 #define SAFETY_TOYOTA_IPAS 0x1335 #define SAFETY_TOYOTA_NOLIMITS 0x1336 #define SAFETY_ALLOUTPUT 0x1337 @@ -100,9 +121,14 @@ const safety_hook_config safety_hook_registry[] = { {SAFETY_GM, &gm_hooks}, {SAFETY_FORD, &ford_hooks}, {SAFETY_CADILLAC, &cadillac_hooks}, + {SAFETY_HYUNDAI, &hyundai_hooks}, + {SAFETY_CHRYSLER, &chrysler_hooks}, + {SAFETY_SUBARU, &subaru_hooks}, {SAFETY_TOYOTA_NOLIMITS, &toyota_nolimits_hooks}, #ifdef PANDA {SAFETY_TOYOTA_IPAS, &toyota_ipas_hooks}, + {SAFETY_GM_ASCM, &gm_ascm_hooks}, + {SAFETY_TESLA, &tesla_hooks}, #endif {SAFETY_ALLOUTPUT, &alloutput_hooks}, {SAFETY_ELM327, &elm327_hooks}, @@ -201,3 +227,31 @@ int rt_rate_limit_check(int val, int val_last, const int MAX_RT_DELTA) { // check for violation return (val < lowest_val) || (val > highest_val); } + + +#ifdef PANDA +// interp function that holds extreme values +float interpolate(struct lookup_t xy, float x) { + int size = sizeof(xy.x) / sizeof(xy.x[0]); + // x is lower than the first point in the x array. Return the first point + if (x <= xy.x[0]) { + return xy.y[0]; + + } else { + // find the index such that (xy.x[i] <= x < xy.x[i+1]) and linearly interp + for (int i=0; i < size-1; i++) { + if (x < xy.x[i+1]) { + float x0 = xy.x[i]; + float y0 = xy.y[i]; + float dx = xy.x[i+1] - x0; + float dy = xy.y[i+1] - y0; + // dx should not be zero as xy.x is supposed ot be monotonic + if (dx <= 0.) dx = 0.0001; + return dy * (x - x0) / dx + y0; + } + } + // if no such point is found, then x > xy.x[size-1]. Return last point + return xy.y[size - 1]; + } +} +#endif diff --git a/panda/board/safety/safety_cadillac.h b/panda/board/safety/safety_cadillac.h index 86549d96ebac8e..2a2d8b9857ff91 100644 --- a/panda/board/safety/safety_cadillac.h +++ b/panda/board/safety/safety_cadillac.h @@ -125,7 +125,7 @@ const safety_hooks cadillac_hooks = { .init = cadillac_init, .rx = cadillac_rx_hook, .tx = cadillac_tx_hook, - .tx_lin = alloutput_tx_lin_hook, + .tx_lin = nooutput_tx_lin_hook, .ignition = cadillac_ign_hook, .fwd = alloutput_fwd_hook, }; diff --git a/panda/board/safety/safety_chrysler.h b/panda/board/safety/safety_chrysler.h new file mode 100644 index 00000000000000..4af588401e0ec0 --- /dev/null +++ b/panda/board/safety/safety_chrysler.h @@ -0,0 +1,153 @@ +const int CHRYSLER_MAX_STEER = 261; +const int CHRYSLER_MAX_RT_DELTA = 112; // max delta torque allowed for real time checks +const int32_t CHRYSLER_RT_INTERVAL = 250000; // 250ms between real time checks +const int CHRYSLER_MAX_RATE_UP = 3; +const int CHRYSLER_MAX_RATE_DOWN = 3; +const int CHRYSLER_MAX_TORQUE_ERROR = 80; // max torque cmd in excess of torque motor + +int chrysler_camera_detected = 0; // is giraffe switch 2 high? +int chrysler_rt_torque_last = 0; +int chrysler_desired_torque_last = 0; +int chrysler_cruise_engaged_last = 0; +uint32_t chrysler_ts_last = 0; +struct sample_t chrysler_torque_meas; // last few torques measured + +static void chrysler_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { + int bus = (to_push->RDTR >> 4) & 0xFF; + uint32_t addr; + if (to_push->RIR & 4) { + // Extended + // Not looked at, but have to be separated + // to avoid address collision + addr = to_push->RIR >> 3; + } else { + // Normal + addr = to_push->RIR >> 21; + } + + // Measured eps torque + if (addr == 544) { + int rdhr = to_push->RDHR; + int torque_meas_new = ((rdhr & 0x7) << 8) + ((rdhr & 0xFF00) >> 8) - 1024; + + // update array of samples + update_sample(&chrysler_torque_meas, torque_meas_new); + } + + // enter controls on rising edge of ACC, exit controls on ACC off + if (addr == 0x1f4) { + int cruise_engaged = ((to_push->RDLR & 0x380000) >> 19) == 7; + if (cruise_engaged && !chrysler_cruise_engaged_last) { + controls_allowed = 1; + } else if (!cruise_engaged) { + controls_allowed = 0; + } + chrysler_cruise_engaged_last = cruise_engaged; + } + + // check if stock camera ECU is still online + if (bus == 0 && addr == 0x292) { + chrysler_camera_detected = 1; + controls_allowed = 0; + } +} + +static int chrysler_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { + + // There can be only one! (camera) + if (chrysler_camera_detected) { + return 0; + } + + uint32_t addr; + if (to_send->RIR & 4) { + // Extended + addr = to_send->RIR >> 3; + } else { + // Normal + addr = to_send->RIR >> 21; + } + + + // LKA STEER + if (addr == 0x292) { + int rdlr = to_send->RDLR; + int desired_torque = ((rdlr & 0x7) << 8) + ((rdlr & 0xFF00) >> 8) - 1024; + uint32_t ts = TIM2->CNT; + int violation = 0; + + if (controls_allowed) { + + // *** global torque limit check *** + violation |= max_limit_check(desired_torque, CHRYSLER_MAX_STEER, -CHRYSLER_MAX_STEER); + + // *** torque rate limit check *** + violation |= dist_to_meas_check(desired_torque, chrysler_desired_torque_last, + &chrysler_torque_meas, CHRYSLER_MAX_RATE_UP, CHRYSLER_MAX_RATE_DOWN, CHRYSLER_MAX_TORQUE_ERROR); + + // used next time + chrysler_desired_torque_last = desired_torque; + + // *** torque real time rate limit check *** + violation |= rt_rate_limit_check(desired_torque, chrysler_rt_torque_last, CHRYSLER_MAX_RT_DELTA); + + // every RT_INTERVAL set the new limits + uint32_t ts_elapsed = get_ts_elapsed(ts, chrysler_ts_last); + if (ts_elapsed > CHRYSLER_RT_INTERVAL) { + chrysler_rt_torque_last = desired_torque; + chrysler_ts_last = ts; + } + } + + // no torque if controls is not allowed + if (!controls_allowed && (desired_torque != 0)) { + violation = 1; + } + + // reset to 0 if either controls is not allowed or there's a violation + if (violation || !controls_allowed) { + chrysler_desired_torque_last = 0; + chrysler_rt_torque_last = 0; + chrysler_ts_last = ts; + } + + if (violation) { + return false; + } + } + + // FORCE CANCEL: safety check only relevant when spamming the cancel button. + // ensuring that only the cancel button press is sent when controls are off. + // This avoids unintended engagements while still allowing resume spam + // TODO: fix bug preventing the button msg to be fwd'd on bus 2 + + // 1 allows the message through + return true; +} + +static void chrysler_init(int16_t param) { + chrysler_camera_detected = 0; +} + +static int chrysler_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { + int32_t addr = to_fwd->RIR >> 21; + // forward CAN 0 -> 2 so stock LKAS camera sees messages + if (bus_num == 0 && !chrysler_camera_detected) { + return 2; + } + // forward all messages from camera except LKAS_COMMAND and LKAS_HUD + if (bus_num == 2 && !chrysler_camera_detected && addr != 658 && addr != 678) { + return 0; + } + return -1; // do not forward +} + + +const safety_hooks chrysler_hooks = { + .init = chrysler_init, + .rx = chrysler_rx_hook, + .tx = chrysler_tx_hook, + .tx_lin = nooutput_tx_lin_hook, + .ignition = default_ign_hook, + .fwd = chrysler_fwd_hook, +}; diff --git a/panda/board/safety/safety_defaults.h b/panda/board/safety/safety_defaults.h index 8042cc3ce05459..196df65d2f8eb6 100644 --- a/panda/board/safety/safety_defaults.h +++ b/panda/board/safety/safety_defaults.h @@ -57,4 +57,3 @@ const safety_hooks alloutput_hooks = { .ignition = default_ign_hook, .fwd = alloutput_fwd_hook, }; - diff --git a/panda/board/safety/safety_ford.h b/panda/board/safety/safety_ford.h index 804064842b3597..075029fb623e0f 100644 --- a/panda/board/safety/safety_ford.h +++ b/panda/board/safety/safety_ford.h @@ -83,24 +83,11 @@ static int ford_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { return true; } -static int ford_tx_lin_hook(int lin_num, uint8_t *data, int len) { - // TODO: add safety if using LIN - return true; -} - -static void ford_init(int16_t param) { - controls_allowed = 0; -} - -static int ford_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { - return -1; -} - const safety_hooks ford_hooks = { - .init = ford_init, + .init = nooutput_init, .rx = ford_rx_hook, .tx = ford_tx_hook, - .tx_lin = ford_tx_lin_hook, + .tx_lin = nooutput_tx_lin_hook, .ignition = default_ign_hook, - .fwd = ford_fwd_hook, + .fwd = nooutput_fwd_hook, }; diff --git a/panda/board/safety/safety_gm.h b/panda/board/safety/safety_gm.h index 2a6e8af0674890..f35b26b4ef84d3 100644 --- a/panda/board/safety/safety_gm.h +++ b/panda/board/safety/safety_gm.h @@ -8,7 +8,7 @@ // brake rising edge // brake > 0mph -const int GM_MAX_STEER = 255; +const int GM_MAX_STEER = 300; const int GM_MAX_RT_DELTA = 128; // max delta torque allowed for real time checks const int32_t GM_RT_INTERVAL = 250000; // 250ms between real time checks const int GM_MAX_RATE_UP = 7; @@ -22,7 +22,7 @@ const int GM_MAX_BRAKE = 350; int gm_brake_prev = 0; int gm_gas_prev = 0; int gm_speed = 0; -// silence everything if stock ECUs are still online +// silence everything if stock car control ECUs are still online int gm_ascm_detected = 0; int gm_ignition_started = 0; int gm_rt_torque_last = 0; @@ -63,8 +63,11 @@ static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { gm_speed = to_push->RDLR & 0xFFFF; } - // check if stock ASCM ECU is still online - if (bus_number == 0 && addr == 715) { + // Check if ASCM or LKA camera are online + // on powertrain bus. + // 384 = ASCMLKASteeringCmd + // 715 = ASCMGasRegenCmd + if (bus_number == 0 && (addr == 384 || addr == 715)) { gm_ascm_detected = 1; controls_allowed = 0; } @@ -222,11 +225,6 @@ static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { return true; } -static int gm_tx_lin_hook(int lin_num, uint8_t *data, int len) { - // LIN is not used in Volt - return false; -} - static void gm_init(int16_t param) { controls_allowed = 0; gm_ignition_started = 0; @@ -236,16 +234,12 @@ static int gm_ign_hook() { return gm_ignition_started; } -static int gm_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { - return -1; -} - const safety_hooks gm_hooks = { .init = gm_init, .rx = gm_rx_hook, .tx = gm_tx_hook, - .tx_lin = gm_tx_lin_hook, + .tx_lin = nooutput_tx_lin_hook, .ignition = gm_ign_hook, - .fwd = gm_fwd_hook, + .fwd = nooutput_fwd_hook, }; diff --git a/panda/board/safety/safety_gm_ascm.h b/panda/board/safety/safety_gm_ascm.h new file mode 100644 index 00000000000000..70a042ec514a69 --- /dev/null +++ b/panda/board/safety/safety_gm_ascm.h @@ -0,0 +1,52 @@ +// BUS 0 is on the LKAS module (ASCM) side +// BUS 2 is on the actuator (EPS) side + +static int gm_ascm_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { + + uint32_t addr = to_fwd->RIR>>21; + + if (bus_num == 0) { + + // do not propagate lkas messages from ascm to actuators + // block 0x152 and 0x154, which are the lkas command from ASCM1 and ASCM2 + // block 0x315 and 0x2cb, which are the brake and accel commands from ASCM1 + //if ((addr == 0x152) || (addr == 0x154) || (addr == 0x315) || (addr == 0x2cb)) { + if ((addr == 0x152) || (addr == 0x154)) { + int supercruise_on = (to_fwd->RDHR>>4) & 0x1; // bit 36 + if (!supercruise_on) return -1; + } + + // on the chassis bus, the OBDII port is on the module side, so we need to read + // the lkas messages sent by openpilot (put on unused 0x151 ane 0x153 addrs) and send it to + // the actuator as 0x152 and 0x154 + if (addr == 0x151) { + to_fwd->RIR = (0x152 << 21) | (to_fwd->RIR & 0x1fffff); + } + if (addr == 0x153) { + to_fwd->RIR = (0x154 << 21) | (to_fwd->RIR & 0x1fffff); + } + + // brake + if (addr == 0x314) { + to_fwd->RIR = (0x315 << 21) | (to_fwd->RIR & 0x1fffff); + } + + return 2; + } + + if (bus_num == 2) { + return 0; + } + + return -1; +} + +const safety_hooks gm_ascm_hooks = { + .init = nooutput_init, + .rx = default_rx_hook, + .tx = alloutput_tx_hook, + .tx_lin = nooutput_tx_lin_hook, + .ignition = default_ign_hook, + .fwd = gm_ascm_fwd_hook, +}; + diff --git a/panda/board/safety/safety_honda.h b/panda/board/safety/safety_honda.h index b64e45ce6d9653..fbee6cfe861f53 100644 --- a/panda/board/safety/safety_honda.h +++ b/panda/board/safety/safety_honda.h @@ -119,7 +119,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { if ((to_send->RDLR & 0xFFFF0000) != to_send->RDLR) return 0; } } - + // FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW // ensuring that only the cancel button press is sent (VAL 2) when controls are off. // This avoids unintended engagements while still allowing resume spam @@ -132,30 +132,12 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { return true; } -static int honda_tx_lin_hook(int lin_num, uint8_t *data, int len) { - // TODO: add safety if using LIN - return true; -} - static void honda_init(int16_t param) { controls_allowed = 0; bosch_hardware = false; honda_alt_brake_msg = false; } -static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { - return -1; -} - -const safety_hooks honda_hooks = { - .init = honda_init, - .rx = honda_rx_hook, - .tx = honda_tx_hook, - .tx_lin = honda_tx_lin_hook, - .ignition = default_ign_hook, - .fwd = honda_fwd_hook, -}; - static void honda_bosch_init(int16_t param) { controls_allowed = 0; bosch_hardware = true; @@ -163,6 +145,22 @@ static void honda_bosch_init(int16_t param) { honda_alt_brake_msg = param == 1 ? true : false; } +static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { + // fwd from car to camera. also fwd certain msgs from camera to car + // 0xE4 is steering on all cars except CRV and RDX, 0x194 for CRV and RDX, + // 0x1FA is brake control, 0x30C is acc hud, 0x33D is lkas hud, + // 0x39f is radar hud + int addr = to_fwd->RIR>>21; + if (bus_num == 0) { + return 2; + } else if (bus_num == 2 && addr != 0xE4 && addr != 0x194 && addr != 0x1FA && + addr != 0x30C && addr != 0x33D && addr != 0x39F) { + return 0; + } + + return -1; +} + static int honda_bosch_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { if (bus_num == 1 || bus_num == 2) { int addr = to_fwd->RIR>>21; @@ -171,11 +169,20 @@ static int honda_bosch_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { return -1; } +const safety_hooks honda_hooks = { + .init = honda_init, + .rx = honda_rx_hook, + .tx = honda_tx_hook, + .tx_lin = nooutput_tx_lin_hook, + .ignition = default_ign_hook, + .fwd = honda_fwd_hook, +}; + const safety_hooks honda_bosch_hooks = { .init = honda_bosch_init, .rx = honda_rx_hook, .tx = honda_tx_hook, - .tx_lin = honda_tx_lin_hook, + .tx_lin = nooutput_tx_lin_hook, .ignition = default_ign_hook, .fwd = honda_bosch_fwd_hook, }; diff --git a/panda/board/safety/safety_hyundai.h b/panda/board/safety/safety_hyundai.h new file mode 100644 index 00000000000000..b67632141d8365 --- /dev/null +++ b/panda/board/safety/safety_hyundai.h @@ -0,0 +1,164 @@ +const int HYUNDAI_MAX_STEER = 255; // like stock +const int HYUNDAI_MAX_RT_DELTA = 112; // max delta torque allowed for real time checks +const int32_t HYUNDAI_RT_INTERVAL = 250000; // 250ms between real time checks +const int HYUNDAI_MAX_RATE_UP = 3; +const int HYUNDAI_MAX_RATE_DOWN = 7; +const int HYUNDAI_DRIVER_TORQUE_ALLOWANCE = 50; +const int HYUNDAI_DRIVER_TORQUE_FACTOR = 2; + +int hyundai_camera_detected = 0; +int hyundai_camera_bus = 0; +int hyundai_giraffe_switch_2 = 0; // is giraffe switch 2 high? +int hyundai_rt_torque_last = 0; +int hyundai_desired_torque_last = 0; +int hyundai_cruise_engaged_last = 0; +uint32_t hyundai_ts_last = 0; +struct sample_t hyundai_torque_driver; // last few driver torques measured + +static void hyundai_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { + int bus = (to_push->RDTR >> 4) & 0xFF; + uint32_t addr; + if (to_push->RIR & 4) { + // Extended + // Not looked at, but have to be separated + // to avoid address collision + addr = to_push->RIR >> 3; + } else { + // Normal + addr = to_push->RIR >> 21; + } + + if (addr == 897) { + int torque_driver_new = ((to_push->RDLR >> 11) & 0xfff) - 2048; + // update array of samples + update_sample(&hyundai_torque_driver, torque_driver_new); + } + + // check if stock camera ECU is still online + if (bus == 0 && addr == 832) { + hyundai_camera_detected = 1; + controls_allowed = 0; + } + + // Find out which bus the camera is on + if (addr == 832) { + hyundai_camera_bus = bus; + } + + // enter controls on rising edge of ACC, exit controls on ACC off + if ((to_push->RIR>>21) == 1057) { + // 2 bits: 13-14 + int cruise_engaged = (to_push->RDLR >> 13) & 0x3; + if (cruise_engaged && !hyundai_cruise_engaged_last) { + controls_allowed = 1; + } else if (!cruise_engaged) { + controls_allowed = 0; + } + hyundai_cruise_engaged_last = cruise_engaged; + } + + // 832 is lkas cmd. If it is on camera bus, then giraffe switch 2 is high + if ((to_push->RIR>>21) == 832 && (bus == hyundai_camera_bus) && (hyundai_camera_bus != 0)) { + hyundai_giraffe_switch_2 = 1; + } +} + +static int hyundai_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { + + // There can be only one! (camera) + if (hyundai_camera_detected) { + return 0; + } + + uint32_t addr; + if (to_send->RIR & 4) { + // Extended + addr = to_send->RIR >> 3; + } else { + // Normal + addr = to_send->RIR >> 21; + } + + // LKA STEER: safety check + if (addr == 832) { + int desired_torque = ((to_send->RDLR >> 16) & 0x7ff) - 1024; + uint32_t ts = TIM2->CNT; + int violation = 0; + + if (controls_allowed) { + + // *** global torque limit check *** + violation |= max_limit_check(desired_torque, HYUNDAI_MAX_STEER, -HYUNDAI_MAX_STEER); + + // *** torque rate limit check *** + violation |= driver_limit_check(desired_torque, hyundai_desired_torque_last, &hyundai_torque_driver, + HYUNDAI_MAX_STEER, HYUNDAI_MAX_RATE_UP, HYUNDAI_MAX_RATE_DOWN, + HYUNDAI_DRIVER_TORQUE_ALLOWANCE, HYUNDAI_DRIVER_TORQUE_FACTOR); + + // used next time + hyundai_desired_torque_last = desired_torque; + + // *** torque real time rate limit check *** + violation |= rt_rate_limit_check(desired_torque, hyundai_rt_torque_last, HYUNDAI_MAX_RT_DELTA); + + // every RT_INTERVAL set the new limits + uint32_t ts_elapsed = get_ts_elapsed(ts, hyundai_ts_last); + if (ts_elapsed > HYUNDAI_RT_INTERVAL) { + hyundai_rt_torque_last = desired_torque; + hyundai_ts_last = ts; + } + } + + // no torque if controls is not allowed + if (!controls_allowed && (desired_torque != 0)) { + violation = 1; + } + + // reset to 0 if either controls is not allowed or there's a violation + if (violation || !controls_allowed) { + hyundai_desired_torque_last = 0; + hyundai_rt_torque_last = 0; + hyundai_ts_last = ts; + } + + if (violation) { + return false; + } + } + + // FORCE CANCEL: safety check only relevant when spamming the cancel button. + // ensuring that only the cancel button press is sent (VAL 4) when controls are off. + // This avoids unintended engagements while still allowing resume spam + // TODO: fix bug preventing the button msg to be fwd'd on bus 2 + //if (((to_send->RIR>>21) == 1265) && !controls_allowed && ((to_send->RDTR >> 4) & 0xFF) == 0) { + // if ((to_send->RDLR & 0x7) != 4) return 0; + //} + + // 1 allows the message through + return true; +} + +static int hyundai_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { + // forward cam to ccan and viceversa, except lkas cmd + if ((bus_num == 0 || bus_num == hyundai_camera_bus) && hyundai_giraffe_switch_2) { + + if ((to_fwd->RIR>>21) == 832 && bus_num == hyundai_camera_bus) return -1; + if (bus_num == 0) return hyundai_camera_bus; + if (bus_num == hyundai_camera_bus) return 0; + } + return -1; +} + +static void hyundai_init(int16_t param) { + controls_allowed = 0; + hyundai_giraffe_switch_2 = 0; +} + +const safety_hooks hyundai_hooks = { + .init = hyundai_init, + .rx = hyundai_rx_hook, + .tx = hyundai_tx_hook, + .tx_lin = nooutput_tx_lin_hook, + .ignition = default_ign_hook, + .fwd = hyundai_fwd_hook, +}; diff --git a/panda/board/safety/safety_subaru.h b/panda/board/safety/safety_subaru.h new file mode 100644 index 00000000000000..00fe1abf91d2f7 --- /dev/null +++ b/panda/board/safety/safety_subaru.h @@ -0,0 +1,131 @@ +const int SUBARU_MAX_STEER = 2047; // 1s +// real time torque limit to prevent controls spamming +// the real time limit is 1500/sec +const int SUBARU_MAX_RT_DELTA = 940; // max delta torque allowed for real time checks +const int32_t SUBARU_RT_INTERVAL = 250000; // 250ms between real time checks +const int SUBARU_MAX_RATE_UP = 50; +const int SUBARU_MAX_RATE_DOWN = 70; +const int SUBARU_DRIVER_TORQUE_ALLOWANCE = 60; +const int SUBARU_DRIVER_TORQUE_FACTOR = 10; + +int subaru_cruise_engaged_last = 0; +int subaru_rt_torque_last = 0; +int subaru_desired_torque_last = 0; +uint32_t subaru_ts_last = 0; +struct sample_t subaru_torque_driver; // last few driver torques measured + + +static void subaru_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { + int bus_number = (to_push->RDTR >> 4) & 0xFF; + uint32_t addr = to_push->RIR >> 21; + + if ((addr == 0x119) && (bus_number == 0)){ + int torque_driver_new = ((to_push->RDLR >> 16) & 0x7FF); + torque_driver_new = to_signed(torque_driver_new, 11); + // update array of samples + update_sample(&subaru_torque_driver, torque_driver_new); + } + + // enter controls on rising edge of ACC, exit controls on ACC off + if ((addr == 0x240) && (bus_number == 0)) { + int cruise_engaged = (to_push->RDHR >> 9) & 1; + if (cruise_engaged && !subaru_cruise_engaged_last) { + controls_allowed = 1; + } else if (!cruise_engaged) { + controls_allowed = 0; + } + subaru_cruise_engaged_last = cruise_engaged; + } +} + +static int subaru_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { + uint32_t addr = to_send->RIR >> 21; + + // steer cmd checks + if (addr == 0x122) { + int desired_torque = ((to_send->RDLR >> 16) & 0x1FFF); + int violation = 0; + uint32_t ts = TIM2->CNT; + desired_torque = to_signed(desired_torque, 13); + + if (controls_allowed) { + + // *** global torque limit check *** + violation |= max_limit_check(desired_torque, SUBARU_MAX_STEER, -SUBARU_MAX_STEER); + + // *** torque rate limit check *** + int desired_torque_last = subaru_desired_torque_last; + violation |= driver_limit_check(desired_torque, desired_torque_last, &subaru_torque_driver, + SUBARU_MAX_STEER, SUBARU_MAX_RATE_UP, SUBARU_MAX_RATE_DOWN, + SUBARU_DRIVER_TORQUE_ALLOWANCE, SUBARU_DRIVER_TORQUE_FACTOR); + + // used next time + subaru_desired_torque_last = desired_torque; + + // *** torque real time rate limit check *** + violation |= rt_rate_limit_check(desired_torque, subaru_rt_torque_last, SUBARU_MAX_RT_DELTA); + + // every RT_INTERVAL set the new limits + uint32_t ts_elapsed = get_ts_elapsed(ts, subaru_ts_last); + if (ts_elapsed > SUBARU_RT_INTERVAL) { + subaru_rt_torque_last = desired_torque; + subaru_ts_last = ts; + } + } + + // no torque if controls is not allowed + if (!controls_allowed && (desired_torque != 0)) { + violation = 1; + } + + // reset to 0 if either controls is not allowed or there's a violation + if (violation || !controls_allowed) { + subaru_desired_torque_last = 0; + subaru_rt_torque_last = 0; + subaru_ts_last = ts; + } + + if (violation) { + return false; + } + + } + return true; +} + +static int subaru_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { + + // shifts bits 29 > 11 + int32_t addr = to_fwd->RIR >> 21; + + // forward CAN 0 > 1 + if (bus_num == 0) { + return 2; // ES CAN + } + // forward CAN 1 > 0, except ES_LKAS + else if (bus_num == 2) { + + // outback 2015 + if (addr == 0x164) { + return -1; + } + // global platform + if (addr == 0x122) { + return -1; + } + + return 0; // Main CAN + } + + // fallback to do not forward + return -1; +} + +const safety_hooks subaru_hooks = { + .init = nooutput_init, + .rx = subaru_rx_hook, + .tx = subaru_tx_hook, + .tx_lin = nooutput_tx_lin_hook, + .ignition = default_ign_hook, + .fwd = subaru_fwd_hook, +}; diff --git a/panda/board/safety/safety_tesla.h b/panda/board/safety/safety_tesla.h new file mode 100644 index 00000000000000..78c450e85e31c6 --- /dev/null +++ b/panda/board/safety/safety_tesla.h @@ -0,0 +1,287 @@ +// board enforces +// in-state +// accel set/resume +// out-state +// cancel button +// regen paddle +// accel rising edge +// brake rising edge +// brake > 0mph +// +int fmax_limit_check(float val, const float MAX, const float MIN) { + return (val > MAX) || (val < MIN); +} + +// 2m/s are added to be less restrictive +const struct lookup_t TESLA_LOOKUP_ANGLE_RATE_UP = { + {2., 7., 17.}, + {5., .8, .25}}; + +const struct lookup_t TESLA_LOOKUP_ANGLE_RATE_DOWN = { + {2., 7., 17.}, + {5., 3.5, .8}}; + +const struct lookup_t TESLA_LOOKUP_MAX_ANGLE = { + {2., 29., 38.}, + {410., 92., 36.}}; + +const int TESLA_RT_INTERVAL = 250000; // 250ms between real time checks + +// state of angle limits +float tesla_desired_angle_last = 0; // last desired steer angle +float tesla_rt_angle_last = 0.; // last real time angle +float tesla_ts_angle_last = 0; + +int tesla_controls_allowed_last = 0; + +int tesla_brake_prev = 0; +int tesla_gas_prev = 0; +int tesla_speed = 0; +int eac_status = 0; + +int tesla_ignition_started = 0; + + +void set_gmlan_digital_output(int to_set); +void reset_gmlan_switch_timeout(void); +void gmlan_switch_init(int timeout_enable); + + +static void tesla_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) +{ + set_gmlan_digital_output(0); // #define GMLAN_HIGH 0 + reset_gmlan_switch_timeout(); //we're still in tesla safety mode, reset the timeout counter and make sure our output is enabled + + //int bus_number = (to_push->RDTR >> 4) & 0xFF; + uint32_t addr; + if (to_push->RIR & 4) + { + // Extended + // Not looked at, but have to be separated + // to avoid address collision + addr = to_push->RIR >> 3; + } + else + { + // Normal + addr = to_push->RIR >> 21; + } + + if (addr == 0x45) + { + // 6 bits starting at position 0 + int lever_position = (to_push->RDLR & 0x3F); + if (lever_position == 2) + { // pull forward + // activate openpilot + controls_allowed = 1; + //} + } + else if (lever_position == 1) + { // push towards the back + // deactivate openpilot + controls_allowed = 0; + } + } + + // Detect drive rail on (ignition) (start recording) + if (addr == 0x348) + { + // GTW_status + int drive_rail_on = (to_push->RDLR & 0x0001); + tesla_ignition_started = drive_rail_on == 1; + } + + // exit controls on brake press + // DI_torque2::DI_brakePedal 0x118 + if (addr == 0x118) + { + // 1 bit at position 16 + if (((to_push->RDLR & 0x8000)) >> 15 == 1) + { + //disable break cancel by commenting line below + controls_allowed = 0; + } + //get vehicle speed in m/s. Tesla gives MPH + tesla_speed = ((((((to_push->RDLR >> 24) & 0x0F) << 8) + ((to_push->RDLR >> 16) & 0xFF)) * 0.05 - 25) * 1.609 / 3.6); + if (tesla_speed < 0) + { + tesla_speed = 0; + } + } + + // exit controls on EPAS error + // EPAS_sysStatus::EPAS_eacStatus 0x370 + if (addr == 0x370) + { + // if EPAS_eacStatus is not 1 or 2, disable control + eac_status = ((to_push->RDHR >> 21)) & 0x7; + // For human steering override we must not disable controls when eac_status == 0 + // Additional safety: we could only allow eac_status == 0 when we have human steering allowed + if ((controls_allowed == 1) && (eac_status != 0) && (eac_status != 1) && (eac_status != 2)) + { + controls_allowed = 0; + //puts("EPAS error! \n"); + } + } + //get latest steering wheel angle + if (addr == 0x00E) + { + float angle_meas_now = (int)((((to_push->RDLR & 0x3F) << 8) + ((to_push->RDLR >> 8) & 0xFF)) * 0.1 - 819.2); + uint32_t ts = TIM2->CNT; + uint32_t ts_elapsed = get_ts_elapsed(ts, tesla_ts_angle_last); + + // *** angle real time check + // add 1 to not false trigger the violation and multiply by 25 since the check is done every 250 ms and steer angle is updated at 100Hz + float rt_delta_angle_up = interpolate(TESLA_LOOKUP_ANGLE_RATE_UP, tesla_speed) * 25. + 1.; + float rt_delta_angle_down = interpolate(TESLA_LOOKUP_ANGLE_RATE_DOWN, tesla_speed) * 25. + 1.; + float highest_rt_angle = tesla_rt_angle_last + (tesla_rt_angle_last > 0 ? rt_delta_angle_up : rt_delta_angle_down); + float lowest_rt_angle = tesla_rt_angle_last - (tesla_rt_angle_last > 0 ? rt_delta_angle_down : rt_delta_angle_up); + + if ((ts_elapsed > TESLA_RT_INTERVAL) || (controls_allowed && !tesla_controls_allowed_last)) + { + tesla_rt_angle_last = angle_meas_now; + tesla_ts_angle_last = ts; + } + + // check for violation; + if (fmax_limit_check(angle_meas_now, highest_rt_angle, lowest_rt_angle)) + { + // We should not be able to STEER under these conditions + // Other sending is fine (to allow human override) + controls_allowed = 0; + //puts("WARN: RT Angle - No steer allowed! \n"); + } + else + { + controls_allowed = 1; + } + + tesla_controls_allowed_last = controls_allowed; + } +} + +// all commands: gas/regen, friction brake and steering +// if controls_allowed and no pedals pressed +// allow all commands up to limit +// else +// block all commands that produce actuation + +static int tesla_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) +{ + + uint32_t addr; + float angle_raw; + float desired_angle; + + addr = to_send->RIR >> 21; + + // do not transmit CAN message if steering angle too high + // DAS_steeringControl::DAS_steeringAngleRequest + if (addr == 0x488) + { + angle_raw = ((to_send->RDLR & 0x7F) << 8) + ((to_send->RDLR & 0xFF00) >> 8); + desired_angle = angle_raw * 0.1 - 1638.35; + int16_t violation = 0; + int st_enabled = (to_send->RDLR & 0x400000) >> 22; + + if (st_enabled == 0) { + //steering is not enabled, do not check angles and do send + tesla_desired_angle_last = desired_angle; + return true; + } + + if (controls_allowed) + { + // add 1 to not false trigger the violation + float delta_angle_up = interpolate(TESLA_LOOKUP_ANGLE_RATE_UP, tesla_speed) + 1.; + float delta_angle_down = interpolate(TESLA_LOOKUP_ANGLE_RATE_DOWN, tesla_speed) + 1.; + float highest_desired_angle = tesla_desired_angle_last + (tesla_desired_angle_last > 0 ? delta_angle_up : delta_angle_down); + float lowest_desired_angle = tesla_desired_angle_last - (tesla_desired_angle_last > 0 ? delta_angle_down : delta_angle_up); + float TESLA_MAX_ANGLE = interpolate(TESLA_LOOKUP_MAX_ANGLE, tesla_speed) + 1.; + + //check for max angles + violation |= fmax_limit_check(desired_angle, TESLA_MAX_ANGLE, -TESLA_MAX_ANGLE); + + //check for angle delta changes + violation |= fmax_limit_check(desired_angle, highest_desired_angle, lowest_desired_angle); + + if (violation) + { + controls_allowed = 0; + return false; + } + tesla_desired_angle_last = desired_angle; + return true; + } + return false; + } + return true; +} + +static int tesla_tx_lin_hook(int lin_num, uint8_t *data, int len) +{ + // LIN is not used on the Tesla + return false; +} + +static void tesla_init(int16_t param) +{ + controls_allowed = 0; + tesla_ignition_started = 0; + gmlan_switch_init(1); //init the gmlan switch with 1s timeout enabled +} + +static int tesla_ign_hook() +{ + return tesla_ignition_started; +} + +static int tesla_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) +{ + + int32_t addr = to_fwd->RIR >> 21; + + if (bus_num == 0) + { + + // change inhibit of GTW_epasControl + if (addr == 0x101) + { + to_fwd->RDLR = to_fwd->RDLR | 0x4000; // 0x4000: WITH_ANGLE, 0xC000: WITH_BOTH (angle and torque) + int checksum = (((to_fwd->RDLR & 0xFF00) >> 8) + (to_fwd->RDLR & 0xFF) + 2) & 0xFF; + to_fwd->RDLR = to_fwd->RDLR & 0xFFFF; + to_fwd->RDLR = to_fwd->RDLR + (checksum << 16); + return 2; + } + + // remove EPB_epasControl + if (addr == 0x214) + { + return -1; + } + + return 2; // Custom EPAS bus + } + if (bus_num == 2) + { + + // remove GTW_epasControl in forwards + if (addr == 0x101) + { + return -1; + } + + return 0; // Chassis CAN + } + return -1; +} + +const safety_hooks tesla_hooks = { + .init = tesla_init, + .rx = tesla_rx_hook, + .tx = tesla_tx_hook, + .tx_lin = tesla_tx_lin_hook, + .ignition = tesla_ign_hook, + .fwd = tesla_fwd_hook, +}; diff --git a/panda/board/safety/safety_toyota.h b/panda/board/safety/safety_toyota.h index 7cbeafcb96f65d..50d457ab69c6c7 100644 --- a/panda/board/safety/safety_toyota.h +++ b/panda/board/safety/safety_toyota.h @@ -1,32 +1,34 @@ -struct sample_t torque_meas; // last 3 motor torques produced by the eps +int toyota_giraffe_switch_1 = 0; // is giraffe switch 1 high? +int toyota_camera_forwarded = 0; // should we forward the camera bus? // global torque limit -const int MAX_TORQUE = 1500; // max torque cmd allowed ever +const int TOYOTA_MAX_TORQUE = 1500; // max torque cmd allowed ever // rate based torque limit + stay within actually applied // packet is sent at 100hz, so this limit is 1000/sec -const int MAX_RATE_UP = 10; // ramp up slow -const int MAX_RATE_DOWN = 25; // ramp down fast -const int MAX_TORQUE_ERROR = 350; // max torque cmd in excess of torque motor +const int TOYOTA_MAX_RATE_UP = 10; // ramp up slow +const int TOYOTA_MAX_RATE_DOWN = 25; // ramp down fast +const int TOYOTA_MAX_TORQUE_ERROR = 350; // max torque cmd in excess of torque motor // real time torque limit to prevent controls spamming // the real time limit is 1500/sec -const int MAX_RT_DELTA = 375; // max delta torque allowed for real time checks -const int RT_INTERVAL = 250000; // 250ms between real time checks +const int TOYOTA_MAX_RT_DELTA = 375; // max delta torque allowed for real time checks +const int TOYOTA_RT_INTERVAL = 250000; // 250ms between real time checks // longitudinal limits -const int MAX_ACCEL = 1500; // 1.5 m/s2 -const int MIN_ACCEL = -3000; // 3.0 m/s2 +const int TOYOTA_MAX_ACCEL = 1500; // 1.5 m/s2 +const int TOYOTA_MIN_ACCEL = -3000; // 3.0 m/s2 // global actuation limit state -int actuation_limits = 1; // by default steer limits are imposed -int dbc_eps_torque_factor = 100; // conversion factor for STEER_TORQUE_EPS in %: see dbc file +int toyota_actuation_limits = 1; // by default steer limits are imposed +int toyota_dbc_eps_torque_factor = 100; // conversion factor for STEER_TORQUE_EPS in %: see dbc file // state of torque limits -int desired_torque_last = 0; // last desired steer torque -int rt_torque_last = 0; // last desired torque for real time check -uint32_t ts_last = 0; -int cruise_engaged_last = 0; // cruise state +int toyota_desired_torque_last = 0; // last desired steer torque +int toyota_rt_torque_last = 0; // last desired torque for real time check +uint32_t toyota_ts_last = 0; +int toyota_cruise_engaged_last = 0; // cruise state +struct sample_t toyota_torque_meas; // last 3 motor torques produced by the eps static void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { @@ -36,25 +38,36 @@ static void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { torque_meas_new = to_signed(torque_meas_new, 16); // scale by dbc_factor - torque_meas_new = (torque_meas_new * dbc_eps_torque_factor) / 100; + torque_meas_new = (torque_meas_new * toyota_dbc_eps_torque_factor) / 100; // increase torque_meas by 1 to be conservative on rounding torque_meas_new += (torque_meas_new > 0 ? 1 : -1); // update array of sample - update_sample(&torque_meas, torque_meas_new); + update_sample(&toyota_torque_meas, torque_meas_new); } // enter controls on rising edge of ACC, exit controls on ACC off if ((to_push->RIR>>21) == 0x1D2) { - // 4 bits: 55-52 - int cruise_engaged = to_push->RDHR & 0xF00000; - if (cruise_engaged && !cruise_engaged_last) { + // 5th bit is CRUISE_ACTIVE + int cruise_engaged = to_push->RDLR & 0x20; + if (cruise_engaged && !toyota_cruise_engaged_last) { controls_allowed = 1; } else if (!cruise_engaged) { controls_allowed = 0; } - cruise_engaged_last = cruise_engaged; + toyota_cruise_engaged_last = cruise_engaged; + } + + int bus = (to_push->RDTR >> 4) & 0xF; + // msgs are only on bus 2 if panda is connected to frc + if (bus == 2) { + toyota_camera_forwarded = 1; + } + + // 0x2E4 is lkas cmd. If it is on bus 0, then giraffe switch 1 is high + if ((to_push->RIR>>21) == 0x2E4 && (bus == 0)) { + toyota_giraffe_switch_1 = 1; } } @@ -66,12 +79,21 @@ static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { // no IPAS in non IPAS mode if (((to_send->RIR>>21) == 0x266) || ((to_send->RIR>>21) == 0x167)) return false; + // GAS PEDAL: safety check + if ((to_send->RIR>>21) == 0x200) { + if (controls_allowed && toyota_actuation_limits) { + // all messages are fine here + } else { + if ((to_send->RDLR & 0xFFFF0000) != to_send->RDLR) return 0; + } + } + // ACCEL: safety check on byte 1-2 if ((to_send->RIR>>21) == 0x343) { int desired_accel = ((to_send->RDLR & 0xFF) << 8) | ((to_send->RDLR >> 8) & 0xFF); desired_accel = to_signed(desired_accel, 16); - if (controls_allowed && actuation_limits) { - int violation = max_limit_check(desired_accel, MAX_ACCEL, MIN_ACCEL); + if (controls_allowed && toyota_actuation_limits) { + int violation = max_limit_check(desired_accel, TOYOTA_MAX_ACCEL, TOYOTA_MIN_ACCEL); if (violation) return 0; } else if (!controls_allowed && (desired_accel != 0)) { return 0; @@ -87,28 +109,29 @@ static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { uint32_t ts = TIM2->CNT; // only check if controls are allowed and actuation_limits are imposed - if (controls_allowed && actuation_limits) { + if (controls_allowed && toyota_actuation_limits) { // *** global torque limit check *** - violation |= max_limit_check(desired_torque, MAX_TORQUE, -MAX_TORQUE); + violation |= max_limit_check(desired_torque, TOYOTA_MAX_TORQUE, -TOYOTA_MAX_TORQUE); // *** torque rate limit check *** - violation |= dist_to_meas_check(desired_torque, desired_torque_last, &torque_meas, MAX_RATE_UP, MAX_RATE_DOWN, MAX_TORQUE_ERROR); + violation |= dist_to_meas_check(desired_torque, toyota_desired_torque_last, + &toyota_torque_meas, TOYOTA_MAX_RATE_UP, TOYOTA_MAX_RATE_DOWN, TOYOTA_MAX_TORQUE_ERROR); // used next time - desired_torque_last = desired_torque; + toyota_desired_torque_last = desired_torque; // *** torque real time rate limit check *** - violation |= rt_rate_limit_check(desired_torque, rt_torque_last, MAX_RT_DELTA); + violation |= rt_rate_limit_check(desired_torque, toyota_rt_torque_last, TOYOTA_MAX_RT_DELTA); // every RT_INTERVAL set the new limits - uint32_t ts_elapsed = get_ts_elapsed(ts, ts_last); - if (ts_elapsed > RT_INTERVAL) { - rt_torque_last = desired_torque; - ts_last = ts; + uint32_t ts_elapsed = get_ts_elapsed(ts, toyota_ts_last); + if (ts_elapsed > TOYOTA_RT_INTERVAL) { + toyota_rt_torque_last = desired_torque; + toyota_ts_last = ts; } } - + // no torque if controls is not allowed if (!controls_allowed && (desired_torque != 0)) { violation = 1; @@ -116,9 +139,9 @@ static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { // reset to 0 if either controls is not allowed or there's a violation if (violation || !controls_allowed) { - desired_torque_last = 0; - rt_torque_last = 0; - ts_last = ts; + toyota_desired_torque_last = 0; + toyota_rt_torque_last = 0; + toyota_ts_last = ts; } if (violation) { @@ -131,18 +154,23 @@ static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { return true; } -static int toyota_tx_lin_hook(int lin_num, uint8_t *data, int len) { - // TODO: add safety if using LIN - return true; -} - static void toyota_init(int16_t param) { controls_allowed = 0; - actuation_limits = 1; - dbc_eps_torque_factor = param; + toyota_actuation_limits = 1; + toyota_giraffe_switch_1 = 0; + toyota_camera_forwarded = 0; + toyota_dbc_eps_torque_factor = param; } static int toyota_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { + + // forward cam to radar and viceversa if car, except lkas cmd and hud + // don't forward when switch 1 is high + if ((bus_num == 0 || bus_num == 2) && toyota_camera_forwarded && !toyota_giraffe_switch_1) { + int addr = to_fwd->RIR>>21; + bool is_lkas_msg = (addr == 0x2E4 || addr == 0x412) && bus_num == 2; + return is_lkas_msg? -1 : (uint8_t)(~bus_num & 0x2); + } return -1; } @@ -150,22 +178,24 @@ const safety_hooks toyota_hooks = { .init = toyota_init, .rx = toyota_rx_hook, .tx = toyota_tx_hook, - .tx_lin = toyota_tx_lin_hook, + .tx_lin = nooutput_tx_lin_hook, .ignition = default_ign_hook, .fwd = toyota_fwd_hook, }; static void toyota_nolimits_init(int16_t param) { controls_allowed = 0; - actuation_limits = 0; - dbc_eps_torque_factor = param; + toyota_actuation_limits = 0; + toyota_giraffe_switch_1 = 0; + toyota_camera_forwarded = 0; + toyota_dbc_eps_torque_factor = param; } const safety_hooks toyota_nolimits_hooks = { .init = toyota_nolimits_init, .rx = toyota_rx_hook, .tx = toyota_tx_hook, - .tx_lin = toyota_tx_lin_hook, + .tx_lin = nooutput_tx_lin_hook, .ignition = default_ign_hook, .fwd = toyota_fwd_hook, }; diff --git a/panda/board/safety/safety_toyota_ipas.h b/panda/board/safety/safety_toyota_ipas.h index 35b7e2b5974a64..ff4158e3c77c3b 100644 --- a/panda/board/safety/safety_toyota_ipas.h +++ b/panda/board/safety/safety_toyota_ipas.h @@ -2,12 +2,7 @@ // TODO: refactor to repeat less code // IPAS override -const int32_t IPAS_OVERRIDE_THRESHOLD = 200; // disallow controls when user torque exceeds this value - -struct lookup_t { - float x[3]; - float y[3]; -}; +const int32_t TOYOTA_IPAS_OVERRIDE_THRESHOLD = 200; // disallow controls when user torque exceeds this value // 2m/s are added to be less restrictive const struct lookup_t LOOKUP_ANGLE_RATE_UP = { @@ -35,31 +30,6 @@ uint32_t ts_angle_last = 0; int controls_allowed_last = 0; -// interp function that holds extreme values -float interpolate(struct lookup_t xy, float x) { - int size = sizeof(xy.x) / sizeof(xy.x[0]); - // x is lower than the first point in the x array. Return the first point - if (x <= xy.x[0]) { - return xy.y[0]; - - } else { - // find the index such that (xy.x[i] <= x < xy.x[i+1]) and linearly interp - for (int i=0; i < size-1; i++) { - if (x < xy.x[i+1]) { - float x0 = xy.x[i]; - float y0 = xy.y[i]; - float dx = xy.x[i+1] - x0; - float dy = xy.y[i+1] - y0; - // dx should not be zero as xy.x is supposed ot be monotonic - if (dx <= 0.) dx = 0.0001; - return dy * (x - x0) / dx + y0; - } - } - // if no such point is found, then x > xy.x[size-1]. Return last point - return xy.y[size - 1]; - } -} - static void toyota_ipas_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { // check standard toyota stuff as well @@ -92,7 +62,7 @@ static void toyota_ipas_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { // every RT_INTERVAL or when controls are turned on, set the new limits uint32_t ts_elapsed = get_ts_elapsed(ts, ts_angle_last); - if ((ts_elapsed > RT_INTERVAL) || (controls_allowed && !controls_allowed_last)) { + if ((ts_elapsed > TOYOTA_RT_INTERVAL) || (controls_allowed && !controls_allowed_last)) { rt_angle_last = angle_meas_new; ts_angle_last = ts; } @@ -118,8 +88,8 @@ static void toyota_ipas_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { } // exit controls on high steering override - if (angle_control && ((torque_driver.min > IPAS_OVERRIDE_THRESHOLD) || - (torque_driver.max < -IPAS_OVERRIDE_THRESHOLD) || + if (angle_control && ((torque_driver.min > TOYOTA_IPAS_OVERRIDE_THRESHOLD) || + (torque_driver.max < -TOYOTA_IPAS_OVERRIDE_THRESHOLD) || (ipas_state==5))) { controls_allowed = 0; } @@ -146,15 +116,15 @@ static int toyota_ipas_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { int delta_angle_down = (int) (interpolate(LOOKUP_ANGLE_RATE_DOWN, speed) * CAN_TO_DEG + 1.); int highest_desired_angle = desired_angle_last + (desired_angle_last > 0? delta_angle_up:delta_angle_down); int lowest_desired_angle = desired_angle_last - (desired_angle_last > 0? delta_angle_down:delta_angle_up); - if ((desired_angle > highest_desired_angle) || + if ((desired_angle > highest_desired_angle) || (desired_angle < lowest_desired_angle)){ violation = 1; controls_allowed = 0; } } - + // desired steer angle should be the same as steer angle measured when controls are off - if ((!controls_allowed) && + if ((!controls_allowed) && ((desired_angle < (angle_meas.min - 1)) || (desired_angle > (angle_meas.max + 1)) || (ipas_state_cmd != 1))) { @@ -179,7 +149,7 @@ const safety_hooks toyota_ipas_hooks = { .init = toyota_init, .rx = toyota_ipas_rx_hook, .tx = toyota_ipas_tx_hook, - .tx_lin = toyota_tx_lin_hook, + .tx_lin = nooutput_tx_lin_hook, .ignition = default_ign_hook, .fwd = toyota_fwd_hook, }; diff --git a/panda/boardesp/README.md b/panda/boardesp/README.md index 9b15ef2351e924..5a8fab14777fee 100644 --- a/panda/boardesp/README.md +++ b/panda/boardesp/README.md @@ -2,13 +2,13 @@ Dependencies ----- -**Mac** +**Debian / Ubuntu** ``` ./get_sdk.sh ``` -**Debian / Ubuntu** +**Mac** ``` ./get_sdk_mac.sh diff --git a/panda/buy.png b/panda/buy.png index a4a9e0fd40a426..72c70574225173 100644 Binary files a/panda/buy.png and b/panda/buy.png differ diff --git a/panda/common/version.mk b/panda/common/version.mk index cc42223da3d03d..cc66efaa6dbc4b 100644 --- a/panda/common/version.mk +++ b/panda/common/version.mk @@ -1,18 +1,20 @@ ifeq ($(RELEASE),1) - BUILD_TYPE = "RELEASE" + BUILD_TYPE = "RELEASE" else - BUILD_TYPE = "DEBUG" + BUILD_TYPE = "DEBUG" endif -ifneq ($(wildcard ../.git/HEAD),) -obj/gitversion.h: ../VERSION ../.git/HEAD ../.git/index - echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@ +SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) + +ifneq ($(wildcard $(SELF_DIR)/../.git/HEAD),) +obj/gitversion.h: $(SELF_DIR)/../VERSION $(SELF_DIR)/../.git/HEAD $(SELF_DIR)/../.git/index + echo "const uint8_t gitversion[] = \"$(shell cat $(SELF_DIR)/../VERSION)-$(BUILDER)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@ else -ifneq ($(wildcard ../../.git/modules/panda/HEAD),) -obj/gitversion.h: ../VERSION ../../.git/modules/panda/HEAD ../../.git/modules/panda/index - echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@ +ifneq ($(wildcard $(SELF_DIR)/../../.git/modules/panda/HEAD),) +obj/gitversion.h: $(SELF_DIR)/../VERSION $(SELF_DIR)/../../.git/modules/panda/HEAD $(SELF_DIR)/../../.git/modules/panda/index + echo "const uint8_t gitversion[] = \"$(shell cat $(SELF_DIR)/../VERSION)-$(BUILDER)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@ else -obj/gitversion.h: ../VERSION - echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-unknown-$(BUILD_TYPE)\";" > $@ +obj/gitversion.h: $(SELF_DIR)/../VERSION + echo "const uint8_t gitversion[] = \"$(shell cat $(SELF_DIR)/../VERSION)-$(BUILDER)-unknown-$(BUILD_TYPE)\";" > $@ endif endif diff --git a/panda/crypto/sha.c b/panda/crypto/sha.c index 47676df4b6d8a6..8e1715525c68a2 100644 --- a/panda/crypto/sha.c +++ b/panda/crypto/sha.c @@ -127,10 +127,36 @@ const uint8_t* SHA_final(SHA_CTX* ctx) { while ((ctx->count & 63) != 56) { SHA_update(ctx, (uint8_t*)"\0", 1); } - for (i = 0; i < 8; ++i) { - uint8_t tmp = (uint8_t) (cnt >> ((7 - i) * 8)); - SHA_update(ctx, &tmp, 1); - } + + /* Hack - right shift operator with non const argument requires + * libgcc.a which is missing in EON + * thus expanding for loop from + + for (i = 0; i < 8; ++i) { + uint8_t tmp = (uint8_t) (cnt >> ((7 - i) * 8)); + SHA_update(ctx, &tmp, 1); + } + + to + */ + + uint8_t tmp = 0; + tmp = (uint8_t) (cnt >> ((7 - 0) * 8)); + SHA_update(ctx, &tmp, 1); + tmp = (uint8_t) (cnt >> ((7 - 1) * 8)); + SHA_update(ctx, &tmp, 1); + tmp = (uint8_t) (cnt >> ((7 - 2) * 8)); + SHA_update(ctx, &tmp, 1); + tmp = (uint8_t) (cnt >> ((7 - 3) * 8)); + SHA_update(ctx, &tmp, 1); + tmp = (uint8_t) (cnt >> ((7 - 4) * 8)); + SHA_update(ctx, &tmp, 1); + tmp = (uint8_t) (cnt >> ((7 - 5) * 8)); + SHA_update(ctx, &tmp, 1); + tmp = (uint8_t) (cnt >> ((7 - 6) * 8)); + SHA_update(ctx, &tmp, 1); + tmp = (uint8_t) (cnt >> ((7 - 7) * 8)); + SHA_update(ctx, &tmp, 1); for (i = 0; i < 5; i++) { uint32_t tmp = ctx->state[i]; diff --git a/panda/examples/get_panda_password.py b/panda/examples/get_panda_password.py new file mode 100644 index 00000000000000..11071d035346be --- /dev/null +++ b/panda/examples/get_panda_password.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +from panda import Panda + +def get_panda_password(): + + try: + print("Trying to connect to Panda over USB...") + p = Panda() + + except AssertionError: + print("USB connection failed") + sys.exit(0) + + wifi = p.get_serial() + #print('[%s]' % ', '.join(map(str, wifi))) + print("SSID: " + wifi[0]) + print("Password: " + wifi[1]) + +if __name__ == "__main__": + get_panda_password() \ No newline at end of file diff --git a/panda/examples/tesla_tester.py b/panda/examples/tesla_tester.py index b2cbb4d789e18d..99d8d92854423b 100644 --- a/panda/examples/tesla_tester.py +++ b/panda/examples/tesla_tester.py @@ -29,11 +29,11 @@ def tesla_tester(): # BDY 0x248 is the MCU_commands message, which includes folding mirrors, opening the trunk, frunk, setting the cars lock state and more. For our test, we will edit the 3rd byte, which is MCU_lockRequest. 0x01 will lock, 0x02 will unlock: print("Unlocking Tesla...") - p.can_send(0x248, "\x00\x00\x02\x00\x00\x00\x00\x00", bus_num) + p.can_send(0x248, "\x00\x00\x02\x00\x00\x00\x00\x00", body_bus_num) #Or, we can set the first byte, MCU_frontHoodCommand + MCU_liftgateSwitch, to 0x01 to pop the frunk, or 0x04 to open/close the trunk (0x05 should open both) print("Opening Frunk...") - p.can_send(0x248, "\x01\x00\x00\x00\x00\x00\x00\x00", bus_num) + p.can_send(0x248, "\x01\x00\x00\x00\x00\x00\x00\x00", body_bus_num) #Back to safety... print("Disabling output on Panda...") @@ -41,7 +41,6 @@ def tesla_tester(): print("Reading VIN from 0x568. This is painfully slow and can take up to 3 minutes (1 minute per message; 3 messages needed for full VIN)...") - cnt = 0 vin = {} while True: #Read the VIN @@ -53,11 +52,10 @@ def tesla_tester(): vin_string = binascii.hexlify(dat)[2:] #rest of the string is the actual VIN data vin[vin_index] = vin_string.decode("hex") print("Got VIN index " + str(vin_index) + " data " + vin[vin_index]) - cnt += 1 #if we have all 3 parts of the VIN, print it and break out of our while loop - if cnt == 3: + if 0 in vin and 1 in vin and 2 in vin: print("VIN: " + vin[0] + vin[1] + vin[2][:3]) break if __name__ == "__main__": - tesla_tester() \ No newline at end of file + tesla_tester() diff --git a/panda/python/__init__.py b/panda/python/__init__.py index 86b76285ee0ddb..b3610e6c3f9970 100644 --- a/panda/python/__init__.py +++ b/panda/python/__init__.py @@ -8,6 +8,7 @@ import os import time import traceback +import subprocess from dfu import PandaDFU from esptool import ESPROM, CesantaFlasher from flash_release import flash_release @@ -25,7 +26,13 @@ def build_st(target, mkfile="Makefile"): from panda import BASEDIR - assert(os.system('cd %s && make -f %s clean && make -f %s %s >/dev/null' % (os.path.join(BASEDIR, "board"), mkfile, mkfile, target)) == 0) + cmd = 'cd %s && make -f %s clean && make -f %s %s >/dev/null' % (os.path.join(BASEDIR, "board"), mkfile, mkfile, target) + try: + output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) + except subprocess.CalledProcessError as exception: + output = exception.output + returncode = exception.returncode + raise def parse_can_buffer(dat): ret = [] @@ -105,7 +112,14 @@ class Panda(object): SAFETY_NOOUTPUT = 0 SAFETY_HONDA = 1 SAFETY_TOYOTA = 2 + SAFETY_GM = 3 SAFETY_HONDA_BOSCH = 4 + SAFETY_FORD = 5 + SAFETY_CADILLAC = 6 + SAFETY_HYUNDAI = 7 + SAFETY_TESLA = 8 + SAFETY_CHRYSLER = 9 + SAFETY_TOYOTA_IPAS = 0x1335 SAFETY_TOYOTA_NOLIMITS = 0x1336 SAFETY_ALLOUTPUT = 0x1337 SAFETY_ELM327 = 0xE327 @@ -236,6 +250,7 @@ def flash_static(handle, code): pass def flash(self, fn=None, code=None, reconnect=True): + print("flash: main version is " + self.get_version()) if not self.bootstub: self.reset(enter_bootstub=True) assert(self.bootstub) @@ -256,7 +271,7 @@ def flash(self, fn=None, code=None, reconnect=True): code = f.read() # get version - print("flash: version is "+self.get_version()) + print("flash: bootstub version is " + self.get_version()) # do flash Panda.flash_static(self._handle, code) @@ -534,4 +549,3 @@ def kline_recv(self, bus=2): msg = self.kline_ll_recv(2, bus=bus) msg += self.kline_ll_recv(ord(msg[1])-2, bus=bus) return msg - diff --git a/panda/python/update.py b/panda/python/update.py index d393df9fb44152..ce730e4919119e 100755 --- a/panda/python/update.py +++ b/panda/python/update.py @@ -8,6 +8,8 @@ def ensure_st_up_to_date(): with open(os.path.join(BASEDIR, "VERSION")) as f: repo_version = f.read() + repo_version += "-EON" if os.path.isfile('/EON') else "-DEV" + panda = None panda_dfu = None should_flash_recover = False @@ -24,7 +26,7 @@ def ensure_st_up_to_date(): if len(panda_dfu) > 0: panda_dfu = PandaDFU(panda_dfu[0]) panda_dfu.recover() - + print "waiting for board..." time.sleep(1) diff --git a/panda/tests/safety/libpandasafety_py.py b/panda/tests/safety/libpandasafety_py.py index 8840c66f315dd1..d8cb27cf8c8092 100644 --- a/panda/tests/safety/libpandasafety_py.py +++ b/panda/tests/safety/libpandasafety_py.py @@ -30,21 +30,20 @@ uint32_t CNT; } TIM_TypeDef; -void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push); -int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); -void toyota_init(int16_t param); void set_controls_allowed(int c); -void reset_angle_control(void); int get_controls_allowed(void); -void init_tests_toyota(void); void set_timer(int t); -void set_torque_meas(int min, int max); -void set_cadillac_torque_driver(int min, int max); -void set_gm_torque_driver(int min, int max); -void set_rt_torque_last(int t); -void set_desired_torque_last(int t); -int get_torque_meas_min(void); -int get_torque_meas_max(void); +void reset_angle_control(void); + +void init_tests_toyota(void); +void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push); +int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); +void toyota_init(int16_t param); +int get_toyota_torque_meas_min(void); +int get_toyota_torque_meas_max(void); +void set_toyota_torque_meas(int min, int max); +void set_toyota_desired_torque_last(int t); +void set_toyota_rt_torque_last(int t); void init_tests_honda(void); int get_ego_speed(void); @@ -62,6 +61,7 @@ int cadillac_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); void set_cadillac_desired_torque_last(int t); void set_cadillac_rt_torque_last(int t); +void set_cadillac_torque_driver(int min, int max); void init_tests_gm(void); void gm_init(int16_t param); @@ -69,10 +69,36 @@ int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); void set_gm_desired_torque_last(int t); void set_gm_rt_torque_last(int t); +void set_gm_torque_driver(int min, int max); + +void init_tests_hyundai(void); +void nooutput_init(int16_t param); +void hyundai_rx_hook(CAN_FIFOMailBox_TypeDef *to_push); +int hyundai_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); +void set_hyundai_desired_torque_last(int t); +void set_hyundai_rt_torque_last(int t); +void set_hyundai_torque_driver(int min, int max); void toyota_ipas_rx_hook(CAN_FIFOMailBox_TypeDef *to_push); int toyota_ipas_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); +void init_tests_chrysler(void); +void chrysler_rx_hook(CAN_FIFOMailBox_TypeDef *to_push); +int chrysler_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); +void set_chrysler_desired_torque_last(int t); +void set_chrysler_rt_torque_last(int t); +int get_chrysler_torque_meas_min(void); +int get_chrysler_torque_meas_max(void); +void set_chrysler_torque_meas(int min, int max); + +void init_tests_subaru(void); +void subaru_rx_hook(CAN_FIFOMailBox_TypeDef *to_push); +int subaru_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); +void set_subaru_desired_torque_last(int t); +void set_subaru_rt_torque_last(int t); +void set_subaru_torque_driver(int min, int max); + + """) libpandasafety = ffi.dlopen(libpandasafety_fn) diff --git a/panda/tests/safety/test.c b/panda/tests/safety/test.c index f0f2af506da58b..9b4c807d72d3f7 100644 --- a/panda/tests/safety/test.c +++ b/panda/tests/safety/test.c @@ -22,9 +22,12 @@ typedef struct uint32_t CNT; } TIM_TypeDef; -struct sample_t torque_meas; +struct sample_t toyota_torque_meas; struct sample_t cadillac_torque_driver; struct sample_t gm_torque_driver; +struct sample_t hyundai_torque_driver; +struct sample_t chrysler_torque_meas; +struct sample_t subaru_torque_driver; TIM_TypeDef timer; TIM_TypeDef *TIM2 = &timer; @@ -60,9 +63,9 @@ void set_timer(int t){ timer.CNT = t; } -void set_torque_meas(int min, int max){ - torque_meas.min = min; - torque_meas.max = max; +void set_toyota_torque_meas(int min, int max){ + toyota_torque_meas.min = min; + toyota_torque_meas.max = max; } void set_cadillac_torque_driver(int min, int max){ @@ -75,16 +78,39 @@ void set_gm_torque_driver(int min, int max){ gm_torque_driver.max = max; } -int get_torque_meas_min(void){ - return torque_meas.min; +void set_hyundai_torque_driver(int min, int max){ + hyundai_torque_driver.min = min; + hyundai_torque_driver.max = max; } -int get_torque_meas_max(void){ - return torque_meas.max; +void set_chrysler_torque_meas(int min, int max){ + chrysler_torque_meas.min = min; + chrysler_torque_meas.max = max; } -void set_rt_torque_last(int t){ - rt_torque_last = t; +void set_subaru_torque_driver(int min, int max){ + subaru_torque_driver.min = min; + subaru_torque_driver.max = max; +} + +int get_chrysler_torque_meas_min(void){ + return chrysler_torque_meas.min; +} + +int get_chrysler_torque_meas_max(void){ + return chrysler_torque_meas.max; +} + +int get_toyota_torque_meas_min(void){ + return toyota_torque_meas.min; +} + +int get_toyota_torque_meas_max(void){ + return toyota_torque_meas.max; +} + +void set_toyota_rt_torque_last(int t){ + toyota_rt_torque_last = t; } void set_cadillac_rt_torque_last(int t){ @@ -95,8 +121,20 @@ void set_gm_rt_torque_last(int t){ gm_rt_torque_last = t; } -void set_desired_torque_last(int t){ - desired_torque_last = t; +void set_hyundai_rt_torque_last(int t){ + hyundai_rt_torque_last = t; +} + +void set_chrysler_rt_torque_last(int t){ + chrysler_rt_torque_last = t; +} + +void set_subaru_rt_torque_last(int t){ + subaru_rt_torque_last = t; +} + +void set_toyota_desired_torque_last(int t){ + toyota_desired_torque_last = t; } void set_cadillac_desired_torque_last(int t){ @@ -107,6 +145,17 @@ void set_gm_desired_torque_last(int t){ gm_desired_torque_last = t; } +void set_hyundai_desired_torque_last(int t){ + hyundai_desired_torque_last = t; +} + +void set_chrysler_desired_torque_last(int t){ + chrysler_desired_torque_last = t; +} + +void set_subaru_desired_torque_last(int t){ + subaru_desired_torque_last = t; +} int get_ego_speed(void){ return ego_speed; @@ -129,11 +178,11 @@ void set_bosch_hardware(bool c){ } void init_tests_toyota(void){ - torque_meas.min = 0; - torque_meas.max = 0; - desired_torque_last = 0; - rt_torque_last = 0; - ts_last = 0; + toyota_torque_meas.min = 0; + toyota_torque_meas.max = 0; + toyota_desired_torque_last = 0; + toyota_rt_torque_last = 0; + toyota_ts_last = 0; set_timer(0); } @@ -155,9 +204,45 @@ void init_tests_gm(void){ set_timer(0); } +void init_tests_hyundai(void){ + hyundai_torque_driver.min = 0; + hyundai_torque_driver.max = 0; + hyundai_desired_torque_last = 0; + hyundai_rt_torque_last = 0; + hyundai_ts_last = 0; + set_timer(0); +} + +void init_tests_chrysler(void){ + chrysler_torque_meas.min = 0; + chrysler_torque_meas.max = 0; + chrysler_desired_torque_last = 0; + chrysler_rt_torque_last = 0; + chrysler_ts_last = 0; + set_timer(0); +} + +void init_tests_subaru(void){ + subaru_torque_driver.min = 0; + subaru_torque_driver.max = 0; + subaru_desired_torque_last = 0; + subaru_rt_torque_last = 0; + subaru_ts_last = 0; + set_timer(0); +} + void init_tests_honda(void){ ego_speed = 0; gas_interceptor_detected = 0; brake_prev = 0; gas_prev = 0; } + +void set_gmlan_digital_output(int to_set){ +} + +void reset_gmlan_switch_timeout(void){ +} + +void gmlan_switch_init(int timeout_enable){ +} diff --git a/panda/tests/safety/test_chrysler.py b/panda/tests/safety/test_chrysler.py new file mode 100755 index 00000000000000..0fcfc3bcfbf07d --- /dev/null +++ b/panda/tests/safety/test_chrysler.py @@ -0,0 +1,205 @@ +#!/usr/bin/env python2 +import csv +import glob +import unittest +import numpy as np +import libpandasafety_py + +MAX_RATE_UP = 3 +MAX_RATE_DOWN = 3 +MAX_STEER = 261 + +MAX_RT_DELTA = 112 +RT_INTERVAL = 250000 + +MAX_TORQUE_ERROR = 80 + +def twos_comp(val, bits): + if val >= 0: + return val + else: + return (2**bits) + val + +def sign(a): + if a > 0: + return 1 + else: + return -1 + +def swap_bytes(data_str): + """Accepts string with hex, returns integer with order swapped for CAN.""" + a = int(data_str, 16) + return ((a & 0xff) << 24) + ((a & 0xff00) << 8) + ((a & 0x00ff0000) >> 8) + ((a & 0xff000000) >> 24) + +class TestChryslerSafety(unittest.TestCase): + @classmethod + def setUp(cls): + cls.safety = libpandasafety_py.libpandasafety + cls.safety.nooutput_init(0) + cls.safety.init_tests_chrysler() + + def _button_msg(self, buttons): + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = 1265 << 21 + to_send[0].RDLR = buttons + return to_send + + def _set_prev_torque(self, t): + self.safety.set_chrysler_desired_torque_last(t) + self.safety.set_chrysler_rt_torque_last(t) + self.safety.set_chrysler_torque_meas(t, t) + + def _torque_meas_msg(self, torque): + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = 544 << 21 + to_send[0].RDHR = ((torque + 1024) >> 8) + (((torque + 1024) & 0xff) << 8) + return to_send + + def _torque_msg(self, torque): + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = 0x292 << 21 + to_send[0].RDLR = ((torque + 1024) >> 8) + (((torque + 1024) & 0xff) << 8) + return to_send + + def test_default_controls_not_allowed(self): + self.assertFalse(self.safety.get_controls_allowed()) + + def test_steer_safety_check(self): + for enabled in [0, 1]: + for t in range(-MAX_STEER*2, MAX_STEER*2): + self.safety.set_controls_allowed(enabled) + self._set_prev_torque(t) + if abs(t) > MAX_STEER or (not enabled and abs(t) > 0): + self.assertFalse(self.safety.chrysler_tx_hook(self._torque_msg(t))) + else: + self.assertTrue(self.safety.chrysler_tx_hook(self._torque_msg(t))) + + def test_manually_enable_controls_allowed(self): + self.safety.set_controls_allowed(1) + self.assertTrue(self.safety.get_controls_allowed()) + self.safety.set_controls_allowed(0) + self.assertFalse(self.safety.get_controls_allowed()) + + def test_enable_control_allowed_from_cruise(self): + to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_push[0].RIR = 0x1f4 << 21 + to_push[0].RDLR = 0x380000 + + self.safety.chrysler_rx_hook(to_push) + self.assertTrue(self.safety.get_controls_allowed()) + + def test_disable_control_allowed_from_cruise(self): + to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_push[0].RIR = 0x1f4 << 21 + to_push[0].RDLR = 0 + + self.safety.set_controls_allowed(1) + self.safety.chrysler_rx_hook(to_push) + self.assertFalse(self.safety.get_controls_allowed()) + + def test_non_realtime_limit_up(self): + self.safety.set_controls_allowed(True) + + self._set_prev_torque(0) + self.assertTrue(self.safety.chrysler_tx_hook(self._torque_msg(MAX_RATE_UP))) + + self._set_prev_torque(0) + self.assertFalse(self.safety.chrysler_tx_hook(self._torque_msg(MAX_RATE_UP + 1))) + + def test_non_realtime_limit_down(self): + self.safety.set_controls_allowed(True) + + self.safety.set_chrysler_rt_torque_last(MAX_STEER) + torque_meas = MAX_STEER - MAX_TORQUE_ERROR - 20 + self.safety.set_chrysler_torque_meas(torque_meas, torque_meas) + self.safety.set_chrysler_desired_torque_last(MAX_STEER) + self.assertTrue(self.safety.chrysler_tx_hook(self._torque_msg(MAX_STEER - MAX_RATE_DOWN))) + + self.safety.set_chrysler_rt_torque_last(MAX_STEER) + self.safety.set_chrysler_torque_meas(torque_meas, torque_meas) + self.safety.set_chrysler_desired_torque_last(MAX_STEER) + self.assertFalse(self.safety.chrysler_tx_hook(self._torque_msg(MAX_STEER - MAX_RATE_DOWN + 1))) + + def test_exceed_torque_sensor(self): + self.safety.set_controls_allowed(True) + + for sign in [-1, 1]: + self._set_prev_torque(0) + for t in np.arange(0, MAX_TORQUE_ERROR + 2, 2): # step needs to be smaller than MAX_TORQUE_ERROR + t *= sign + self.assertTrue(self.safety.chrysler_tx_hook(self._torque_msg(t))) + + self.assertFalse(self.safety.chrysler_tx_hook(self._torque_msg(sign * (MAX_TORQUE_ERROR + 2)))) + + def test_realtime_limit_up(self): + self.safety.set_controls_allowed(True) + + for sign in [-1, 1]: + self.safety.init_tests_chrysler() + self._set_prev_torque(0) + for t in np.arange(0, MAX_RT_DELTA+1, 1): + t *= sign + self.safety.set_chrysler_torque_meas(t, t) + self.assertTrue(self.safety.chrysler_tx_hook(self._torque_msg(t))) + self.assertFalse(self.safety.chrysler_tx_hook(self._torque_msg(sign * (MAX_RT_DELTA + 1)))) + + self._set_prev_torque(0) + for t in np.arange(0, MAX_RT_DELTA+1, 1): + t *= sign + self.safety.set_chrysler_torque_meas(t, t) + self.assertTrue(self.safety.chrysler_tx_hook(self._torque_msg(t))) + + # Increase timer to update rt_torque_last + self.safety.set_timer(RT_INTERVAL + 1) + self.assertTrue(self.safety.chrysler_tx_hook(self._torque_msg(sign * MAX_RT_DELTA))) + self.assertTrue(self.safety.chrysler_tx_hook(self._torque_msg(sign * (MAX_RT_DELTA + 1)))) + + def test_torque_measurements(self): + self.safety.chrysler_rx_hook(self._torque_meas_msg(50)) + self.safety.chrysler_rx_hook(self._torque_meas_msg(-50)) + self.safety.chrysler_rx_hook(self._torque_meas_msg(0)) + self.safety.chrysler_rx_hook(self._torque_meas_msg(0)) + self.safety.chrysler_rx_hook(self._torque_meas_msg(0)) + self.safety.chrysler_rx_hook(self._torque_meas_msg(0)) + + self.assertEqual(-50, self.safety.get_chrysler_torque_meas_min()) + self.assertEqual(50, self.safety.get_chrysler_torque_meas_max()) + + self.safety.chrysler_rx_hook(self._torque_meas_msg(0)) + self.assertEqual(0, self.safety.get_chrysler_torque_meas_max()) + self.assertEqual(-50, self.safety.get_chrysler_torque_meas_min()) + + self.safety.chrysler_rx_hook(self._torque_meas_msg(0)) + self.assertEqual(0, self.safety.get_chrysler_torque_meas_max()) + self.assertEqual(0, self.safety.get_chrysler_torque_meas_min()) + + def _replay_drive(self, csv_reader): + for row in csv_reader: + if len(row) != 4: # sometimes truncated at end of the file + continue + if row[0] == 'time': # skip CSV header + continue + addr = int(row[1]) + bus = int(row[2]) + data_str = row[3] # Example '081407ff0806e06f' + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = addr << 21 + to_send[0].RDHR = swap_bytes(data_str[8:]) + to_send[0].RDLR = swap_bytes(data_str[:8]) + if (bus == 128): + self.assertTrue(self.safety.chrysler_tx_hook(to_send), msg=row) + else: + self.safety.chrysler_rx_hook(to_send) + + def test_replay_drive(self): + # In Cabana, click "Save Log" and then put the downloaded CSV in this directory. + test_files = glob.glob('chrysler_*.csv') + for filename in test_files: + print 'testing %s' % filename + with open(filename) as csvfile: + reader = csv.reader(csvfile) + self._replay_drive(reader) + + +if __name__ == "__main__": + unittest.main() diff --git a/panda/tests/safety/test_gm.py b/panda/tests/safety/test_gm.py index f11360dbe2a3fb..299de5a7e9ff51 100644 --- a/panda/tests/safety/test_gm.py +++ b/panda/tests/safety/test_gm.py @@ -5,7 +5,7 @@ MAX_RATE_UP = 7 MAX_RATE_DOWN = 17 -MAX_STEER = 255 +MAX_STEER = 300 MAX_BRAKE = 350 MAX_GAS = 3072 MAX_REGEN = 1404 @@ -84,10 +84,6 @@ def _torque_driver_msg(self, torque): to_send[0].RDHR = (((t >> 8) & 0x7) << 16) | ((t & 0xFF) << 24) return to_send - def _torque_driver_msg_array(self, torque): - for i in range(3): - self.safety.gm_ipas_rx_hook(self._torque_driver_msg(torque)) - def _torque_msg(self, torque): to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') to_send[0].RIR = 384 << 21 @@ -117,7 +113,7 @@ def test_cancel_button(self): self.safety.gm_rx_hook(self._button_msg(CANCEL_BTN)) self.assertFalse(self.safety.get_controls_allowed()) - def test_disengage_on_brake(self): + def test_disengage_on_brake(self): self.safety.set_controls_allowed(1) self.safety.gm_rx_hook(self._brake_msg(True)) self.assertFalse(self.safety.get_controls_allowed()) diff --git a/panda/tests/safety/test_honda.py b/panda/tests/safety/test_honda.py index 143916d609ec05..48b678eaaec43e 100755 --- a/panda/tests/safety/test_honda.py +++ b/panda/tests/safety/test_honda.py @@ -108,7 +108,7 @@ def test_alt_disengage_on_brake(self): self.safety.set_controls_allowed(1) self.safety.honda_rx_hook(self._alt_brake_msg(1)) self.assertFalse(self.safety.get_controls_allowed()) - + self.safety.set_honda_alt_brake_msg(0) self.safety.set_controls_allowed(1) self.safety.honda_rx_hook(self._alt_brake_msg(1)) diff --git a/panda/tests/safety/test_hyundai.py b/panda/tests/safety/test_hyundai.py new file mode 100644 index 00000000000000..bcf9b761189d55 --- /dev/null +++ b/panda/tests/safety/test_hyundai.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python2 +import unittest +import numpy as np +import libpandasafety_py + +MAX_RATE_UP = 3 +MAX_RATE_DOWN = 7 +MAX_STEER = 255 + +MAX_RT_DELTA = 112 +RT_INTERVAL = 250000 + +DRIVER_TORQUE_ALLOWANCE = 50; +DRIVER_TORQUE_FACTOR = 2; + +def twos_comp(val, bits): + if val >= 0: + return val + else: + return (2**bits) + val + +def sign(a): + if a > 0: + return 1 + else: + return -1 + +class TestHyundaiSafety(unittest.TestCase): + @classmethod + def setUp(cls): + cls.safety = libpandasafety_py.libpandasafety + cls.safety.nooutput_init(0) + cls.safety.init_tests_hyundai() + + def _button_msg(self, buttons): + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = 1265 << 21 + to_send[0].RDLR = buttons + return to_send + + def _set_prev_torque(self, t): + self.safety.set_hyundai_desired_torque_last(t) + self.safety.set_hyundai_rt_torque_last(t) + + def _torque_driver_msg(self, torque): + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = 897 << 21 + to_send[0].RDLR = (torque + 2048) << 11 + return to_send + + def _torque_msg(self, torque): + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = 832 << 21 + to_send[0].RDLR = (torque + 1024) << 16 + return to_send + + def test_default_controls_not_allowed(self): + self.assertFalse(self.safety.get_controls_allowed()) + + def test_steer_safety_check(self): + for enabled in [0, 1]: + for t in range(-0x200, 0x200): + self.safety.set_controls_allowed(enabled) + self._set_prev_torque(t) + if abs(t) > MAX_STEER or (not enabled and abs(t) > 0): + self.assertFalse(self.safety.hyundai_tx_hook(self._torque_msg(t))) + else: + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(t))) + + def test_manually_enable_controls_allowed(self): + self.safety.set_controls_allowed(1) + self.assertTrue(self.safety.get_controls_allowed()) + self.safety.set_controls_allowed(0) + self.assertFalse(self.safety.get_controls_allowed()) + + def test_enable_control_allowed_from_cruise(self): + to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_push[0].RIR = 1057 << 21 + to_push[0].RDLR = 1 << 13 + + self.safety.hyundai_rx_hook(to_push) + self.assertTrue(self.safety.get_controls_allowed()) + + def test_disable_control_allowed_from_cruise(self): + to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_push[0].RIR = 1057 << 21 + to_push[0].RDLR = 0 + + self.safety.set_controls_allowed(1) + self.safety.hyundai_rx_hook(to_push) + self.assertFalse(self.safety.get_controls_allowed()) + + def test_non_realtime_limit_up(self): + self.safety.set_hyundai_torque_driver(0, 0) + self.safety.set_controls_allowed(True) + + self._set_prev_torque(0) + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(MAX_RATE_UP))) + self._set_prev_torque(0) + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(-MAX_RATE_UP))) + + self._set_prev_torque(0) + self.assertFalse(self.safety.hyundai_tx_hook(self._torque_msg(MAX_RATE_UP + 1))) + self.safety.set_controls_allowed(True) + self._set_prev_torque(0) + self.assertFalse(self.safety.hyundai_tx_hook(self._torque_msg(-MAX_RATE_UP - 1))) + + def test_non_realtime_limit_down(self): + self.safety.set_hyundai_torque_driver(0, 0) + self.safety.set_controls_allowed(True) + + def test_against_torque_driver(self): + self.safety.set_controls_allowed(True) + + for sign in [-1, 1]: + for t in np.arange(0, DRIVER_TORQUE_ALLOWANCE + 1, 1): + t *= -sign + self.safety.set_hyundai_torque_driver(t, t) + self._set_prev_torque(MAX_STEER * sign) + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(MAX_STEER * sign))) + + self.safety.set_hyundai_torque_driver(DRIVER_TORQUE_ALLOWANCE + 1, DRIVER_TORQUE_ALLOWANCE + 1) + self.assertFalse(self.safety.hyundai_tx_hook(self._torque_msg(-MAX_STEER))) + + # spot check some individual cases + for sign in [-1, 1]: + driver_torque = (DRIVER_TORQUE_ALLOWANCE + 10) * sign + torque_desired = (MAX_STEER - 10 * DRIVER_TORQUE_FACTOR) * sign + delta = 1 * sign + self._set_prev_torque(torque_desired) + self.safety.set_hyundai_torque_driver(-driver_torque, -driver_torque) + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(torque_desired))) + self._set_prev_torque(torque_desired + delta) + self.safety.set_hyundai_torque_driver(-driver_torque, -driver_torque) + self.assertFalse(self.safety.hyundai_tx_hook(self._torque_msg(torque_desired + delta))) + + self._set_prev_torque(MAX_STEER * sign) + self.safety.set_hyundai_torque_driver(-MAX_STEER * sign, -MAX_STEER * sign) + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg((MAX_STEER - MAX_RATE_DOWN) * sign))) + self._set_prev_torque(MAX_STEER * sign) + self.safety.set_hyundai_torque_driver(-MAX_STEER * sign, -MAX_STEER * sign) + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(0))) + self._set_prev_torque(MAX_STEER * sign) + self.safety.set_hyundai_torque_driver(-MAX_STEER * sign, -MAX_STEER * sign) + self.assertFalse(self.safety.hyundai_tx_hook(self._torque_msg((MAX_STEER - MAX_RATE_DOWN + 1) * sign))) + + + def test_realtime_limits(self): + self.safety.set_controls_allowed(True) + + for sign in [-1, 1]: + self.safety.init_tests_hyundai() + self._set_prev_torque(0) + self.safety.set_hyundai_torque_driver(0, 0) + for t in np.arange(0, MAX_RT_DELTA, 1): + t *= sign + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(t))) + self.assertFalse(self.safety.hyundai_tx_hook(self._torque_msg(sign * (MAX_RT_DELTA + 1)))) + + self._set_prev_torque(0) + for t in np.arange(0, MAX_RT_DELTA, 1): + t *= sign + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(t))) + + # Increase timer to update rt_torque_last + self.safety.set_timer(RT_INTERVAL + 1) + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(sign * (MAX_RT_DELTA - 1)))) + self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(sign * (MAX_RT_DELTA + 1)))) + + + #def test_spam_cancel_safety_check(self): + # RESUME_BTN = 1 + # SET_BTN = 2 + # CANCEL_BTN = 4 + # BUTTON_MSG = 1265 + # self.safety.set_controls_allowed(0) + # self.assertTrue(self.safety.hyundai_tx_hook(self._button_msg(CANCEL_BTN))) + # self.assertFalse(self.safety.hyundai_tx_hook(self._button_msg(RESUME_BTN))) + # self.assertFalse(self.safety.hyundai_tx_hook(self._button_msg(SET_BTN))) + # # do not block resume if we are engaged already + # self.safety.set_controls_allowed(1) + # self.assertTrue(self.safety.hyundai_tx_hook(self._button_msg(RESUME_BTN))) + + +if __name__ == "__main__": + unittest.main() diff --git a/panda/tests/safety/test_subaru.py b/panda/tests/safety/test_subaru.py new file mode 100644 index 00000000000000..a1e03fea15cc85 --- /dev/null +++ b/panda/tests/safety/test_subaru.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python2 +import unittest +import numpy as np +import libpandasafety_py + +MAX_RATE_UP = 50 +MAX_RATE_DOWN = 70 +MAX_STEER = 2047 + +MAX_RT_DELTA = 940 +RT_INTERVAL = 250000 + +DRIVER_TORQUE_ALLOWANCE = 60; +DRIVER_TORQUE_FACTOR = 10; + +def twos_comp(val, bits): + if val >= 0: + return val + else: + return (2**bits) + val + +def sign(a): + if a > 0: + return 1 + else: + return -1 + +class TestSubaruSafety(unittest.TestCase): + @classmethod + def setUp(cls): + cls.safety = libpandasafety_py.libpandasafety + cls.safety.nooutput_init(0) + cls.safety.init_tests_subaru() + + def _set_prev_torque(self, t): + self.safety.set_subaru_desired_torque_last(t) + self.safety.set_subaru_rt_torque_last(t) + + def _torque_driver_msg(self, torque): + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = 0x119 << 21 + + t = twos_comp(torque, 11) + to_send[0].RDLR = ((t & 0x7FF) << 16) + return to_send + + def _torque_msg(self, torque): + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = 0x122 << 21 + + t = twos_comp(torque, 13) + to_send[0].RDLR = (t << 16) + return to_send + + def test_default_controls_not_allowed(self): + self.assertFalse(self.safety.get_controls_allowed()) + + def test_enable_control_allowed_from_cruise(self): + to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_push[0].RIR = 0x240 << 21 + to_push[0].RDHR = 1 << 9 + + self.safety.subaru_rx_hook(to_push) + self.assertTrue(self.safety.get_controls_allowed()) + + def test_disable_control_allowed_from_cruise(self): + to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_push[0].RIR = 0x240 << 21 + to_push[0].RDHR = 0 + + self.safety.set_controls_allowed(1) + self.safety.subaru_rx_hook(to_push) + self.assertFalse(self.safety.get_controls_allowed()) + + def test_steer_safety_check(self): + for enabled in [0, 1]: + for t in range(-3000, 3000): + self.safety.set_controls_allowed(enabled) + self._set_prev_torque(t) + if abs(t) > MAX_STEER or (not enabled and abs(t) > 0): + self.assertFalse(self.safety.subaru_tx_hook(self._torque_msg(t))) + else: + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(t))) + + def test_manually_enable_controls_allowed(self): + self.safety.set_controls_allowed(1) + self.assertTrue(self.safety.get_controls_allowed()) + self.safety.set_controls_allowed(0) + self.assertFalse(self.safety.get_controls_allowed()) + + def test_non_realtime_limit_up(self): + self.safety.set_subaru_torque_driver(0, 0) + self.safety.set_controls_allowed(True) + + self._set_prev_torque(0) + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(MAX_RATE_UP))) + self._set_prev_torque(0) + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(-MAX_RATE_UP))) + + self._set_prev_torque(0) + self.assertFalse(self.safety.subaru_tx_hook(self._torque_msg(MAX_RATE_UP + 1))) + self.safety.set_controls_allowed(True) + self._set_prev_torque(0) + self.assertFalse(self.safety.subaru_tx_hook(self._torque_msg(-MAX_RATE_UP - 1))) + + def test_non_realtime_limit_down(self): + self.safety.set_subaru_torque_driver(0, 0) + self.safety.set_controls_allowed(True) + + def test_against_torque_driver(self): + self.safety.set_controls_allowed(True) + + for sign in [-1, 1]: + for t in np.arange(0, DRIVER_TORQUE_ALLOWANCE + 1, 1): + t *= -sign + self.safety.set_subaru_torque_driver(t, t) + self._set_prev_torque(MAX_STEER * sign) + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(MAX_STEER * sign))) + + self.safety.set_subaru_torque_driver(DRIVER_TORQUE_ALLOWANCE + 1, DRIVER_TORQUE_ALLOWANCE + 1) + self.assertFalse(self.safety.subaru_tx_hook(self._torque_msg(-MAX_STEER))) + + # spot check some individual cases + for sign in [-1, 1]: + driver_torque = (DRIVER_TORQUE_ALLOWANCE + 10) * sign + torque_desired = (MAX_STEER - 10 * DRIVER_TORQUE_FACTOR) * sign + delta = 1 * sign + self._set_prev_torque(torque_desired) + self.safety.set_subaru_torque_driver(-driver_torque, -driver_torque) + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(torque_desired))) + self._set_prev_torque(torque_desired + delta) + self.safety.set_subaru_torque_driver(-driver_torque, -driver_torque) + self.assertFalse(self.safety.subaru_tx_hook(self._torque_msg(torque_desired + delta))) + + self._set_prev_torque(MAX_STEER * sign) + self.safety.set_subaru_torque_driver(-MAX_STEER * sign, -MAX_STEER * sign) + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg((MAX_STEER - MAX_RATE_DOWN) * sign))) + self._set_prev_torque(MAX_STEER * sign) + self.safety.set_subaru_torque_driver(-MAX_STEER * sign, -MAX_STEER * sign) + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(0))) + self._set_prev_torque(MAX_STEER * sign) + self.safety.set_subaru_torque_driver(-MAX_STEER * sign, -MAX_STEER * sign) + self.assertFalse(self.safety.subaru_tx_hook(self._torque_msg((MAX_STEER - MAX_RATE_DOWN + 1) * sign))) + + + def test_realtime_limits(self): + self.safety.set_controls_allowed(True) + + for sign in [-1, 1]: + self.safety.init_tests_subaru() + self._set_prev_torque(0) + self.safety.set_subaru_torque_driver(0, 0) + for t in np.arange(0, MAX_RT_DELTA, 1): + t *= sign + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(t))) + self.assertFalse(self.safety.subaru_tx_hook(self._torque_msg(sign * (MAX_RT_DELTA + 1)))) + + self._set_prev_torque(0) + for t in np.arange(0, MAX_RT_DELTA, 1): + t *= sign + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(t))) + + # Increase timer to update rt_torque_last + self.safety.set_timer(RT_INTERVAL + 1) + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(sign * (MAX_RT_DELTA - 1)))) + self.assertTrue(self.safety.subaru_tx_hook(self._torque_msg(sign * (MAX_RT_DELTA + 1)))) + + +if __name__ == "__main__": + unittest.main() diff --git a/panda/tests/safety/test_toyota.py b/panda/tests/safety/test_toyota.py index ad86be63beb64b..52c7015af3e5bc 100644 --- a/panda/tests/safety/test_toyota.py +++ b/panda/tests/safety/test_toyota.py @@ -41,9 +41,9 @@ def setUp(cls): cls.safety.init_tests_toyota() def _set_prev_torque(self, t): - self.safety.set_desired_torque_last(t) - self.safety.set_rt_torque_last(t) - self.safety.set_torque_meas(t, t) + self.safety.set_toyota_desired_torque_last(t) + self.safety.set_toyota_rt_torque_last(t) + self.safety.set_toyota_torque_meas(t, t) def _torque_meas_msg(self, torque): to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') @@ -119,6 +119,13 @@ def _accel_msg(self, accel): to_send[0].RDLR = (a & 0xFF) << 8 | (a >> 8) return to_send + def _gas_msg(self, gas): + to_send = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') + to_send[0].RIR = 0x200 << 21 + to_send[0].RDLR = gas + + return to_send + def test_default_controls_not_allowed(self): self.assertFalse(self.safety.get_controls_allowed()) @@ -129,7 +136,7 @@ def test_manually_enable_controls_allowed(self): def test_enable_control_allowed_from_cruise(self): to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') to_push[0].RIR = 0x1D2 << 21 - to_push[0].RDHR = 0xF00000 + to_push[0].RDLR = 0x20 self.safety.toyota_rx_hook(to_push) self.assertTrue(self.safety.get_controls_allowed()) @@ -137,7 +144,7 @@ def test_enable_control_allowed_from_cruise(self): def test_disable_control_allowed_from_cruise(self): to_push = libpandasafety_py.ffi.new('CAN_FIFOMailBox_TypeDef *') to_push[0].RIR = 0x1D2 << 21 - to_push[0].RDHR = 0 + to_push[0].RDLR = 0 self.safety.set_controls_allowed(1) self.safety.toyota_rx_hook(to_push) @@ -158,9 +165,9 @@ def test_torque_absolute_limits(self): for controls_allowed in [True, False]: for torque in np.arange(-MAX_TORQUE - 1000, MAX_TORQUE + 1000, MAX_RATE_UP): self.safety.set_controls_allowed(controls_allowed) - self.safety.set_rt_torque_last(torque) - self.safety.set_torque_meas(torque, torque) - self.safety.set_desired_torque_last(torque - MAX_RATE_UP) + self.safety.set_toyota_rt_torque_last(torque) + self.safety.set_toyota_torque_meas(torque, torque) + self.safety.set_toyota_desired_torque_last(torque - MAX_RATE_UP) if controls_allowed: send = (-MAX_TORQUE <= torque <= MAX_TORQUE) @@ -181,14 +188,14 @@ def test_non_realtime_limit_up(self): def test_non_realtime_limit_down(self): self.safety.set_controls_allowed(True) - self.safety.set_rt_torque_last(1000) - self.safety.set_torque_meas(500, 500) - self.safety.set_desired_torque_last(1000) + self.safety.set_toyota_rt_torque_last(1000) + self.safety.set_toyota_torque_meas(500, 500) + self.safety.set_toyota_desired_torque_last(1000) self.assertTrue(self.safety.toyota_tx_hook(self._torque_msg(1000 - MAX_RATE_DOWN))) - self.safety.set_rt_torque_last(1000) - self.safety.set_torque_meas(500, 500) - self.safety.set_desired_torque_last(1000) + self.safety.set_toyota_rt_torque_last(1000) + self.safety.set_toyota_torque_meas(500, 500) + self.safety.set_toyota_desired_torque_last(1000) self.assertFalse(self.safety.toyota_tx_hook(self._torque_msg(1000 - MAX_RATE_DOWN + 1))) def test_exceed_torque_sensor(self): @@ -210,14 +217,14 @@ def test_realtime_limit_up(self): self._set_prev_torque(0) for t in np.arange(0, 380, 10): t *= sign - self.safety.set_torque_meas(t, t) + self.safety.set_toyota_torque_meas(t, t) self.assertTrue(self.safety.toyota_tx_hook(self._torque_msg(t))) self.assertFalse(self.safety.toyota_tx_hook(self._torque_msg(sign * 380))) self._set_prev_torque(0) for t in np.arange(0, 370, 10): t *= sign - self.safety.set_torque_meas(t, t) + self.safety.set_toyota_torque_meas(t, t) self.assertTrue(self.safety.toyota_tx_hook(self._torque_msg(t))) # Increase timer to update rt_torque_last @@ -233,16 +240,16 @@ def test_torque_measurements(self): self.safety.toyota_rx_hook(self._torque_meas_msg(0)) self.safety.toyota_rx_hook(self._torque_meas_msg(0)) - self.assertEqual(-51, self.safety.get_torque_meas_min()) - self.assertEqual(51, self.safety.get_torque_meas_max()) + self.assertEqual(-51, self.safety.get_toyota_torque_meas_min()) + self.assertEqual(51, self.safety.get_toyota_torque_meas_max()) self.safety.toyota_rx_hook(self._torque_meas_msg(0)) - self.assertEqual(-1, self.safety.get_torque_meas_max()) - self.assertEqual(-51, self.safety.get_torque_meas_min()) + self.assertEqual(-1, self.safety.get_toyota_torque_meas_max()) + self.assertEqual(-51, self.safety.get_toyota_torque_meas_min()) self.safety.toyota_rx_hook(self._torque_meas_msg(0)) - self.assertEqual(-1, self.safety.get_torque_meas_max()) - self.assertEqual(-1, self.safety.get_torque_meas_min()) + self.assertEqual(-1, self.safety.get_toyota_torque_meas_max()) + self.assertEqual(-1, self.safety.get_toyota_torque_meas_min()) def test_ipas_override(self): @@ -373,7 +380,7 @@ def test_angle_cmd_rate_when_enabled(self): self.assertTrue(self.safety.get_controls_allowed()) # now inject too high rates - self.assertEqual(False, self.safety.toyota_ipas_tx_hook(self._ipas_control_msg(a + sign(a) * + self.assertEqual(False, self.safety.toyota_ipas_tx_hook(self._ipas_control_msg(a + sign(a) * (max_delta_up + 1), 1))) self.assertFalse(self.safety.get_controls_allowed()) self.safety.set_controls_allowed(1) @@ -381,7 +388,7 @@ def test_angle_cmd_rate_when_enabled(self): self.assertTrue(self.safety.get_controls_allowed()) self.assertEqual(True, self.safety.toyota_ipas_tx_hook(self._ipas_control_msg(a, 1))) self.assertTrue(self.safety.get_controls_allowed()) - self.assertEqual(False, self.safety.toyota_ipas_tx_hook(self._ipas_control_msg(a - sign(a) * + self.assertEqual(False, self.safety.toyota_ipas_tx_hook(self._ipas_control_msg(a - sign(a) * (max_delta_down + 1), 1))) self.assertFalse(self.safety.get_controls_allowed()) @@ -409,6 +416,13 @@ def test_angle_measured_rate(self): # reset no angle control at the end of the test self.safety.reset_angle_control() + def test_gas_safety_check(self): + self.safety.set_controls_allowed(0) + self.assertTrue(self.safety.honda_tx_hook(self._gas_msg(0x0000))) + self.assertFalse(self.safety.honda_tx_hook(self._gas_msg(0x1000))) + self.safety.set_controls_allowed(1) + self.assertTrue(self.safety.honda_tx_hook(self._gas_msg(0x1000))) + if __name__ == "__main__": unittest.main() diff --git a/panda/tests/safety/trim_csv.py b/panda/tests/safety/trim_csv.py new file mode 100755 index 00000000000000..511bd385f4e49a --- /dev/null +++ b/panda/tests/safety/trim_csv.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python2 + +# This trims CAN message CSV files to just the messages relevant for Panda testing. +# Usage: +# cat input.csv | ./trim_csv.py > output.csv +import fileinput + +addr_to_keep = [544, 0x1f4, 0x292] # For Chrysler, update to the addresses that matter for you. + +for line in fileinput.input(): + line = line.strip() + cols = line.split(',') + if len(cols) != 4: + continue # malformed, such as at the end or every 60s. + (_, addr, bus, _) = cols + if (addr == 'addr'): + continue + if (int(bus) == 128): # Keep all messages sent by OpenPilot. + print line + elif (int(addr) in addr_to_keep): + print line diff --git a/phonelibs/boringssl/build.txt b/phonelibs/boringssl/build.txt new file mode 100644 index 00000000000000..0c9cd0d31d244e --- /dev/null +++ b/phonelibs/boringssl/build.txt @@ -0,0 +1,7 @@ +# with neos tree +cd ~/android/system +mka libcrypt_static libssl_static + +cp ~/android/system/out/target/product/oneplus3/obj/STATIC_LIBRARIES/libcrypto_static_intermediates/libcrypto_static.a lib/ +cp ~/android/system/out/target/product/oneplus3/obj/STATIC_LIBRARIES/libssl_static_intermediates/libssl_static.a lib/ + diff --git a/phonelibs/boringssl/include/openssl/aead.h b/phonelibs/boringssl/include/openssl/aead.h new file mode 100644 index 00000000000000..dc453e342d204c --- /dev/null +++ b/phonelibs/boringssl/include/openssl/aead.h @@ -0,0 +1,315 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_AEAD_H +#define OPENSSL_HEADER_AEAD_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Authenticated Encryption with Additional Data. + * + * AEAD couples confidentiality and integrity in a single primtive. AEAD + * algorithms take a key and then can seal and open individual messages. Each + * message has a unique, per-message nonce and, optionally, additional data + * which is authenticated but not included in the ciphertext. + * + * The |EVP_AEAD_CTX_init| function initialises an |EVP_AEAD_CTX| structure and + * performs any precomputation needed to use |aead| with |key|. The length of + * the key, |key_len|, is given in bytes. + * + * The |tag_len| argument contains the length of the tags, in bytes, and allows + * for the processing of truncated authenticators. A zero value indicates that + * the default tag length should be used and this is defined as + * |EVP_AEAD_DEFAULT_TAG_LENGTH| in order to make the code clear. Using + * truncated tags increases an attacker's chance of creating a valid forgery. + * Be aware that the attacker's chance may increase more than exponentially as + * would naively be expected. + * + * When no longer needed, the initialised |EVP_AEAD_CTX| structure must be + * passed to |EVP_AEAD_CTX_cleanup|, which will deallocate any memory used. + * + * With an |EVP_AEAD_CTX| in hand, one can seal and open messages. These + * operations are intended to meet the standard notions of privacy and + * authenticity for authenticated encryption. For formal definitions see + * Bellare and Namprempre, "Authenticated encryption: relations among notions + * and analysis of the generic composition paradigm," Lecture Notes in Computer + * Science B<1976> (2000), 531–545, + * http://www-cse.ucsd.edu/~mihir/papers/oem.html. + * + * When sealing messages, a nonce must be given. The length of the nonce is + * fixed by the AEAD in use and is returned by |EVP_AEAD_nonce_length|. *The + * nonce must be unique for all messages with the same key*. This is critically + * important - nonce reuse may completely undermine the security of the AEAD. + * Nonces may be predictable and public, so long as they are unique. Uniqueness + * may be achieved with a simple counter or, if large enough, may be generated + * randomly. The nonce must be passed into the "open" operation by the receiver + * so must either be implicit (e.g. a counter), or must be transmitted along + * with the sealed message. + * + * The "seal" and "open" operations are atomic - an entire message must be + * encrypted or decrypted in a single call. Large messages may have to be split + * up in order to accomodate this. When doing so, be mindful of the need not to + * repeat nonces and the possibility that an attacker could duplicate, reorder + * or drop message chunks. For example, using a single key for a given (large) + * message and sealing chunks with nonces counting from zero would be secure as + * long as the number of chunks was securely transmitted. (Otherwise an + * attacker could truncate the message by dropping chunks from the end.) + * + * The number of chunks could be transmitted by prefixing it to the plaintext, + * for example. This also assumes that no other message would ever use the same + * key otherwise the rule that nonces must be unique for a given key would be + * violated. + * + * The "seal" and "open" operations also permit additional data to be + * authenticated via the |ad| parameter. This data is not included in the + * ciphertext and must be identical for both the "seal" and "open" call. This + * permits implicit context to be authenticated but may be empty if not needed. + * + * The "seal" and "open" operations may work in-place if the |out| and |in| + * arguments are equal. They may also be used to shift the data left inside the + * same buffer if |out| is less than |in|. However, |out| may not point inside + * the input data otherwise the input may be overwritten before it has been + * read. This situation will cause an error. + * + * The "seal" and "open" operations return one on success and zero on error. */ + + +/* AEAD algorithms. */ + +/* EVP_aead_aes_128_gcm is AES-128 in Galois Counter Mode. */ +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm(void); + +/* EVP_aead_aes_256_gcm is AES-256 in Galois Counter Mode. */ +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm(void); + +/* EVP_aead_chacha20_poly1305 is an AEAD built from ChaCha20 and Poly1305. */ +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_chacha20_poly1305(void); + +/* EVP_aead_aes_128_key_wrap is AES-128 Key Wrap mode. This should never be + * used except to interoperate with existing systems that use this mode. + * + * If the nonce is empty then the default nonce will be used, otherwise it must + * be eight bytes long. The input must be a multiple of eight bytes long. No + * additional data can be given to this mode. */ +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_key_wrap(void); + +/* EVP_aead_aes_256_key_wrap is AES-256 in Key Wrap mode. This should never be + * used except to interoperate with existing systems that use this mode. + * + * See |EVP_aead_aes_128_key_wrap| for details. */ +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_key_wrap(void); + +/* EVP_aead_aes_128_ctr_hmac_sha256 is AES-128 in CTR mode with HMAC-SHA256 for + * authentication. The nonce is 12 bytes; the bottom 32-bits are used as the + * block counter, thus the maximum plaintext size is 64GB. */ +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_ctr_hmac_sha256(void); + +/* EVP_aead_aes_128_ctr_hmac_sha256 is AES-256 in CTR mode with HMAC-SHA256 for + * authentication. See |EVP_aead_aes_128_ctr_hmac_sha256| for details. */ +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_ctr_hmac_sha256(void); + +/* EVP_has_aes_hardware returns one if we enable hardware support for fast and + * constant-time AES-GCM. */ +OPENSSL_EXPORT int EVP_has_aes_hardware(void); + + +/* TLS-specific AEAD algorithms. + * + * These AEAD primitives do not meet the definition of generic AEADs. They are + * all specific to TLS and should not be used outside of that context. They must + * be initialized with |EVP_AEAD_CTX_init_with_direction|, are stateful, and may + * not be used concurrently. Any nonces are used as IVs, so they must be + * unpredictable. They only accept an |ad| parameter of length 11 (the standard + * TLS one with length omitted). */ + +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_rc4_md5_tls(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_rc4_sha1_tls(void); + +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_cbc_sha1_tls(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_cbc_sha1_tls_implicit_iv(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_cbc_sha256_tls(void); + +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_cbc_sha1_tls(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_cbc_sha1_tls_implicit_iv(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_cbc_sha256_tls(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_cbc_sha384_tls(void); + +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_des_ede3_cbc_sha1_tls(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_des_ede3_cbc_sha1_tls_implicit_iv(void); + + +/* SSLv3-specific AEAD algorithms. + * + * These AEAD primitives do not meet the definition of generic AEADs. They are + * all specific to SSLv3 and should not be used outside of that context. They + * must be initialized with |EVP_AEAD_CTX_init_with_direction|, are stateful, + * and may not be used concurrently. They only accept an |ad| parameter of + * length 9 (the standard TLS one with length and version omitted). */ + +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_rc4_md5_ssl3(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_rc4_sha1_ssl3(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_cbc_sha1_ssl3(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_cbc_sha1_ssl3(void); +OPENSSL_EXPORT const EVP_AEAD *EVP_aead_des_ede3_cbc_sha1_ssl3(void); + + +/* Utility functions. */ + +/* EVP_AEAD_key_length returns the length, in bytes, of the keys used by + * |aead|. */ +OPENSSL_EXPORT size_t EVP_AEAD_key_length(const EVP_AEAD *aead); + +/* EVP_AEAD_nonce_length returns the length, in bytes, of the per-message nonce + * for |aead|. */ +OPENSSL_EXPORT size_t EVP_AEAD_nonce_length(const EVP_AEAD *aead); + +/* EVP_AEAD_max_overhead returns the maximum number of additional bytes added + * by the act of sealing data with |aead|. */ +OPENSSL_EXPORT size_t EVP_AEAD_max_overhead(const EVP_AEAD *aead); + +/* EVP_AEAD_max_tag_len returns the maximum tag length when using |aead|. This + * is the largest value that can be passed as |tag_len| to + * |EVP_AEAD_CTX_init|. */ +OPENSSL_EXPORT size_t EVP_AEAD_max_tag_len(const EVP_AEAD *aead); + + +/* AEAD operations. */ + +/* An EVP_AEAD_CTX represents an AEAD algorithm configured with a specific key + * and message-independent IV. */ +typedef struct evp_aead_ctx_st { + const EVP_AEAD *aead; + /* aead_state is an opaque pointer to whatever state the AEAD needs to + * maintain. */ + void *aead_state; +} EVP_AEAD_CTX; + +/* EVP_AEAD_MAX_KEY_LENGTH contains the maximum key length used by + * any AEAD defined in this header. */ +#define EVP_AEAD_MAX_KEY_LENGTH 80 + +/* EVP_AEAD_MAX_NONCE_LENGTH contains the maximum nonce length used by + * any AEAD defined in this header. */ +#define EVP_AEAD_MAX_NONCE_LENGTH 16 + +/* EVP_AEAD_MAX_OVERHEAD contains the maximum overhead used by any AEAD + * defined in this header. */ +#define EVP_AEAD_MAX_OVERHEAD 64 + +/* EVP_AEAD_DEFAULT_TAG_LENGTH is a magic value that can be passed to + * EVP_AEAD_CTX_init to indicate that the default tag length for an AEAD should + * be used. */ +#define EVP_AEAD_DEFAULT_TAG_LENGTH 0 + +/* evp_aead_direction_t denotes the direction of an AEAD operation. */ +enum evp_aead_direction_t { + evp_aead_open, + evp_aead_seal, +}; + +/* EVP_AEAD_CTX_init initializes |ctx| for the given AEAD algorithm from |impl|. + * The |impl| argument may be NULL to choose the default implementation. + * Authentication tags may be truncated by passing a size as |tag_len|. A + * |tag_len| of zero indicates the default tag length and this is defined as + * EVP_AEAD_DEFAULT_TAG_LENGTH for readability. + * + * Returns 1 on success. Otherwise returns 0 and pushes to the error stack. In + * the error case, you do not need to call |EVP_AEAD_CTX_cleanup|, but it's + * harmless to do so. */ +OPENSSL_EXPORT int EVP_AEAD_CTX_init(EVP_AEAD_CTX *ctx, const EVP_AEAD *aead, + const uint8_t *key, size_t key_len, + size_t tag_len, ENGINE *impl); + +/* EVP_AEAD_CTX_init_with_direction calls |EVP_AEAD_CTX_init| for normal + * AEADs. For TLS-specific and SSL3-specific AEADs, it initializes |ctx| for a + * given direction. */ +OPENSSL_EXPORT int EVP_AEAD_CTX_init_with_direction( + EVP_AEAD_CTX *ctx, const EVP_AEAD *aead, const uint8_t *key, size_t key_len, + size_t tag_len, enum evp_aead_direction_t dir); + +/* EVP_AEAD_CTX_cleanup frees any data allocated by |ctx|. It is a no-op to + * call |EVP_AEAD_CTX_cleanup| on a |EVP_AEAD_CTX| that has been |memset| to + * all zeros. */ +OPENSSL_EXPORT void EVP_AEAD_CTX_cleanup(EVP_AEAD_CTX *ctx); + +/* EVP_AEAD_CTX_seal encrypts and authenticates |in_len| bytes from |in| and + * authenticates |ad_len| bytes from |ad| and writes the result to |out|. It + * returns one on success and zero otherwise. + * + * This function may be called (with the same |EVP_AEAD_CTX|) concurrently with + * itself or |EVP_AEAD_CTX_open|. + * + * At most |max_out_len| bytes are written to |out| and, in order to ensure + * success, |max_out_len| should be |in_len| plus the result of + * |EVP_AEAD_max_overhead|. On successful return, |*out_len| is set to the + * actual number of bytes written. + * + * The length of |nonce|, |nonce_len|, must be equal to the result of + * |EVP_AEAD_nonce_length| for this AEAD. + * + * |EVP_AEAD_CTX_seal| never results in a partial output. If |max_out_len| is + * insufficient, zero will be returned. (In this case, |*out_len| is set to + * zero.) + * + * If |in| and |out| alias then |out| must be <= |in|. */ +OPENSSL_EXPORT int EVP_AEAD_CTX_seal(const EVP_AEAD_CTX *ctx, uint8_t *out, + size_t *out_len, size_t max_out_len, + const uint8_t *nonce, size_t nonce_len, + const uint8_t *in, size_t in_len, + const uint8_t *ad, size_t ad_len); + +/* EVP_AEAD_CTX_open authenticates |in_len| bytes from |in| and |ad_len| bytes + * from |ad| and decrypts at most |in_len| bytes into |out|. It returns one on + * success and zero otherwise. + * + * This function may be called (with the same |EVP_AEAD_CTX|) concurrently with + * itself or |EVP_AEAD_CTX_seal|. + * + * At most |in_len| bytes are written to |out|. In order to ensure success, + * |max_out_len| should be at least |in_len|. On successful return, |*out_len| + * is set to the the actual number of bytes written. + * + * The length of |nonce|, |nonce_len|, must be equal to the result of + * |EVP_AEAD_nonce_length| for this AEAD. + * + * |EVP_AEAD_CTX_open| never results in a partial output. If |max_out_len| is + * insufficient, zero will be returned. (In this case, |*out_len| is set to + * zero.) + * + * If |in| and |out| alias then |out| must be <= |in|. */ +OPENSSL_EXPORT int EVP_AEAD_CTX_open(const EVP_AEAD_CTX *ctx, uint8_t *out, + size_t *out_len, size_t max_out_len, + const uint8_t *nonce, size_t nonce_len, + const uint8_t *in, size_t in_len, + const uint8_t *ad, size_t ad_len); + + +/* Obscure functions. */ + +/* EVP_AEAD_CTX_get_rc4_state sets |*out_key| to point to an RC4 key structure. + * It returns one on success or zero if |ctx| doesn't have an RC4 key. */ +OPENSSL_EXPORT int EVP_AEAD_CTX_get_rc4_state(const EVP_AEAD_CTX *ctx, + const RC4_KEY **out_key); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_AEAD_H */ diff --git a/phonelibs/boringssl/include/openssl/aes.h b/phonelibs/boringssl/include/openssl/aes.h new file mode 100644 index 00000000000000..84cde416e64432 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/aes.h @@ -0,0 +1,158 @@ +/* ==================================================================== + * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== */ + +#ifndef OPENSSL_HEADER_AES_H +#define OPENSSL_HEADER_AES_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Raw AES functions. */ + + +#define AES_ENCRYPT 1 +#define AES_DECRYPT 0 + +/* AES_MAXNR is the maximum number of AES rounds. */ +#define AES_MAXNR 14 + +#define AES_BLOCK_SIZE 16 + +/* aes_key_st should be an opaque type, but EVP requires that the size be + * known. */ +struct aes_key_st { + uint32_t rd_key[4 * (AES_MAXNR + 1)]; + unsigned rounds; +}; +typedef struct aes_key_st AES_KEY; + +/* AES_set_encrypt_key configures |aeskey| to encrypt with the |bits|-bit key, + * |key|. + * + * WARNING: unlike other OpenSSL functions, this returns zero on success and a + * negative number on error. */ +OPENSSL_EXPORT int AES_set_encrypt_key(const uint8_t *key, unsigned bits, + AES_KEY *aeskey); + +/* AES_set_decrypt_key configures |aeskey| to decrypt with the |bits|-bit key, + * |key|. + * + * WARNING: unlike other OpenSSL functions, this returns zero on success and a + * negative number on error. */ +OPENSSL_EXPORT int AES_set_decrypt_key(const uint8_t *key, unsigned bits, + AES_KEY *aeskey); + +/* AES_encrypt encrypts a single block from |in| to |out| with |key|. The |in| + * and |out| pointers may overlap. */ +OPENSSL_EXPORT void AES_encrypt(const uint8_t *in, uint8_t *out, + const AES_KEY *key); + +/* AES_decrypt decrypts a single block from |in| to |out| with |key|. The |in| + * and |out| pointers may overlap. */ +OPENSSL_EXPORT void AES_decrypt(const uint8_t *in, uint8_t *out, + const AES_KEY *key); + + +/* Block cipher modes. */ + +/* AES_ctr128_encrypt encrypts (or decrypts, it's the same in CTR mode) |len| + * bytes from |in| to |out|. The |num| parameter must be set to zero on the + * first call and |ivec| will be incremented. */ +OPENSSL_EXPORT void AES_ctr128_encrypt(const uint8_t *in, uint8_t *out, + size_t len, const AES_KEY *key, + uint8_t ivec[AES_BLOCK_SIZE], + uint8_t ecount_buf[AES_BLOCK_SIZE], + unsigned int *num); + +/* AES_ecb_encrypt encrypts (or decrypts, if |enc| == |AES_DECRYPT|) a single, + * 16 byte block from |in| to |out|. */ +OPENSSL_EXPORT void AES_ecb_encrypt(const uint8_t *in, uint8_t *out, + const AES_KEY *key, const int enc); + +/* AES_cbc_encrypt encrypts (or decrypts, if |enc| == |AES_DECRYPT|) |len| + * bytes from |in| to |out|. The length must be a multiple of the block size. */ +OPENSSL_EXPORT void AES_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t len, + const AES_KEY *key, uint8_t *ivec, + const int enc); + +/* AES_ofb128_encrypt encrypts (or decrypts, it's the same in CTR mode) |len| + * bytes from |in| to |out|. The |num| parameter must be set to zero on the + * first call. */ +OPENSSL_EXPORT void AES_ofb128_encrypt(const uint8_t *in, uint8_t *out, + size_t len, const AES_KEY *key, + uint8_t *ivec, int *num); + +/* AES_cfb128_encrypt encrypts (or decrypts, if |enc| == |AES_DECRYPT|) |len| + * bytes from |in| to |out|. The |num| parameter must be set to zero on the + * first call. */ +OPENSSL_EXPORT void AES_cfb128_encrypt(const uint8_t *in, uint8_t *out, + size_t len, const AES_KEY *key, + uint8_t *ivec, int *num, int enc); + + +/* Android compatibility section. + * + * These functions are declared, temporarily, for Android because + * wpa_supplicant will take a little time to sync with upstream. Outside of + * Android they'll have no definition. */ + +OPENSSL_EXPORT int AES_wrap_key(AES_KEY *key, const uint8_t *iv, uint8_t *out, + const uint8_t *in, unsigned in_len); +OPENSSL_EXPORT int AES_unwrap_key(AES_KEY *key, const uint8_t *iv, uint8_t *out, + const uint8_t *in, unsigned in_len); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_AES_H */ diff --git a/phonelibs/boringssl/include/openssl/asn1.h b/phonelibs/boringssl/include/openssl/asn1.h new file mode 100644 index 00000000000000..4baf81c6bdc442 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/asn1.h @@ -0,0 +1,1234 @@ +/* crypto/asn1/asn1.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ASN1_H +#define HEADER_ASN1_H + +#include + +#include + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define V_ASN1_UNIVERSAL 0x00 +#define V_ASN1_APPLICATION 0x40 +#define V_ASN1_CONTEXT_SPECIFIC 0x80 +#define V_ASN1_PRIVATE 0xc0 + +#define V_ASN1_CONSTRUCTED 0x20 +#define V_ASN1_PRIMITIVE_TAG 0x1f +#define V_ASN1_PRIMATIVE_TAG 0x1f + +#define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ +#define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ +#define V_ASN1_ANY -4 /* used in ASN1 template code */ + +#define V_ASN1_NEG 0x100 /* negative flag */ + +#define V_ASN1_UNDEF -1 +#define V_ASN1_EOC 0 +#define V_ASN1_BOOLEAN 1 /**/ +#define V_ASN1_INTEGER 2 +#define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) +#define V_ASN1_BIT_STRING 3 +#define V_ASN1_OCTET_STRING 4 +#define V_ASN1_NULL 5 +#define V_ASN1_OBJECT 6 +#define V_ASN1_OBJECT_DESCRIPTOR 7 +#define V_ASN1_EXTERNAL 8 +#define V_ASN1_REAL 9 +#define V_ASN1_ENUMERATED 10 +#define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) +#define V_ASN1_UTF8STRING 12 +#define V_ASN1_SEQUENCE 16 +#define V_ASN1_SET 17 +#define V_ASN1_NUMERICSTRING 18 /**/ +#define V_ASN1_PRINTABLESTRING 19 +#define V_ASN1_T61STRING 20 +#define V_ASN1_TELETEXSTRING 20 /* alias */ +#define V_ASN1_VIDEOTEXSTRING 21 /**/ +#define V_ASN1_IA5STRING 22 +#define V_ASN1_UTCTIME 23 +#define V_ASN1_GENERALIZEDTIME 24 /**/ +#define V_ASN1_GRAPHICSTRING 25 /**/ +#define V_ASN1_ISO64STRING 26 /**/ +#define V_ASN1_VISIBLESTRING 26 /* alias */ +#define V_ASN1_GENERALSTRING 27 /**/ +#define V_ASN1_UNIVERSALSTRING 28 /**/ +#define V_ASN1_BMPSTRING 30 + +/* For use with d2i_ASN1_type_bytes() */ +#define B_ASN1_NUMERICSTRING 0x0001 +#define B_ASN1_PRINTABLESTRING 0x0002 +#define B_ASN1_T61STRING 0x0004 +#define B_ASN1_TELETEXSTRING 0x0004 +#define B_ASN1_VIDEOTEXSTRING 0x0008 +#define B_ASN1_IA5STRING 0x0010 +#define B_ASN1_GRAPHICSTRING 0x0020 +#define B_ASN1_ISO64STRING 0x0040 +#define B_ASN1_VISIBLESTRING 0x0040 +#define B_ASN1_GENERALSTRING 0x0080 +#define B_ASN1_UNIVERSALSTRING 0x0100 +#define B_ASN1_OCTET_STRING 0x0200 +#define B_ASN1_BIT_STRING 0x0400 +#define B_ASN1_BMPSTRING 0x0800 +#define B_ASN1_UNKNOWN 0x1000 +#define B_ASN1_UTF8STRING 0x2000 +#define B_ASN1_UTCTIME 0x4000 +#define B_ASN1_GENERALIZEDTIME 0x8000 +#define B_ASN1_SEQUENCE 0x10000 + +/* For use with ASN1_mbstring_copy() */ +#define MBSTRING_FLAG 0x1000 +#define MBSTRING_UTF8 (MBSTRING_FLAG) +#define MBSTRING_ASC (MBSTRING_FLAG|1) +#define MBSTRING_BMP (MBSTRING_FLAG|2) +#define MBSTRING_UNIV (MBSTRING_FLAG|4) + +#define SMIME_OLDMIME 0x400 +#define SMIME_CRLFEOL 0x800 +#define SMIME_STREAM 0x1000 + +#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ +#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ + +/* We MUST make sure that, except for constness, asn1_ctx_st and + asn1_const_ctx are exactly the same. Fortunately, as soon as + the old ASN1 parsing macros are gone, we can throw this away + as well... */ +typedef struct asn1_ctx_st + { + unsigned char *p;/* work char pointer */ + int eos; /* end of sequence read for indefinite encoding */ + int error; /* error code to use when returning an error */ + int inf; /* constructed if 0x20, indefinite is 0x21 */ + int tag; /* tag from last 'get object' */ + int xclass; /* class from last 'get object' */ + long slen; /* length of last 'get object' */ + unsigned char *max; /* largest value of p allowed */ + unsigned char *q;/* temporary variable */ + unsigned char **pp;/* variable */ + int line; /* used in error processing */ + } ASN1_CTX; + +typedef struct asn1_const_ctx_st + { + const unsigned char *p;/* work char pointer */ + int eos; /* end of sequence read for indefinite encoding */ + int error; /* error code to use when returning an error */ + int inf; /* constructed if 0x20, indefinite is 0x21 */ + int tag; /* tag from last 'get object' */ + int xclass; /* class from last 'get object' */ + long slen; /* length of last 'get object' */ + const unsigned char *max; /* largest value of p allowed */ + const unsigned char *q;/* temporary variable */ + const unsigned char **pp;/* variable */ + int line; /* used in error processing */ + } ASN1_const_CTX; + +/* These are used internally in the ASN1_OBJECT to keep track of + * whether the names and data need to be free()ed */ +#define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */ +#define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */ +#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */ +#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ +struct asn1_object_st + { + const char *sn,*ln; + int nid; + int length; + const unsigned char *data; /* data remains const after init */ + int flags; /* Should we free this one */ + }; + +#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ +/* This indicates that the ASN1_STRING is not a real value but just a place + * holder for the location where indefinite length constructed data should + * be inserted in the memory buffer + */ +#define ASN1_STRING_FLAG_NDEF 0x010 + +/* This flag is used by the CMS code to indicate that a string is not + * complete and is a place holder for content when it had all been + * accessed. The flag will be reset when content has been written to it. + */ + +#define ASN1_STRING_FLAG_CONT 0x020 +/* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING + * type. + */ +#define ASN1_STRING_FLAG_MSTRING 0x040 +/* This is the base type that holds just about everything :-) */ +struct asn1_string_st + { + int length; + int type; + unsigned char *data; + /* The value of the following field depends on the type being + * held. It is mostly being used for BIT_STRING so if the + * input data has a non-zero 'unused bits' value, it will be + * handled correctly */ + long flags; + }; + +/* ASN1_ENCODING structure: this is used to save the received + * encoding of an ASN1 type. This is useful to get round + * problems with invalid encodings which can break signatures. + */ + +typedef struct ASN1_ENCODING_st + { + unsigned char *enc; /* DER encoding */ + long len; /* Length of encoding */ + int modified; /* set to 1 if 'enc' is invalid */ + } ASN1_ENCODING; + +/* Used with ASN1 LONG type: if a long is set to this it is omitted */ +#define ASN1_LONG_UNDEF 0x7fffffffL + +#define STABLE_FLAGS_MALLOC 0x01 +#define STABLE_NO_MASK 0x02 +#define DIRSTRING_TYPE \ + (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) +#define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) + +typedef struct asn1_string_table_st { + int nid; + long minsize; + long maxsize; + unsigned long mask; + unsigned long flags; +} ASN1_STRING_TABLE; + +/* size limits: this stuff is taken straight from RFC2459 */ + +#define ub_name 32768 +#define ub_common_name 64 +#define ub_locality_name 128 +#define ub_state_name 128 +#define ub_organization_name 64 +#define ub_organization_unit_name 64 +#define ub_title 64 +#define ub_email_address 128 + +/* Declarations for template structures: for full definitions + * see asn1t.h + */ +typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; +typedef struct ASN1_TLC_st ASN1_TLC; +/* This is just an opaque pointer */ +typedef struct ASN1_VALUE_st ASN1_VALUE; + +/* Declare ASN1 functions: the implement macro in in asn1t.h */ + +#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) + +#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) + +#define DECLARE_ASN1_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) + +#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ + OPENSSL_EXPORT type *d2i_##name(type **a, const unsigned char **in, long len); \ + OPENSSL_EXPORT int i2d_##name(type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(itname) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ + OPENSSL_EXPORT type *d2i_##name(type **a, const unsigned char **in, long len); \ + OPENSSL_EXPORT int i2d_##name(const type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(name) + +#define DECLARE_ASN1_NDEF_FUNCTION(name) \ + OPENSSL_EXPORT int i2d_##name##_NDEF(name *a, unsigned char **out); + +#define DECLARE_ASN1_FUNCTIONS_const(name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) + +#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + OPENSSL_EXPORT type *name##_new(void); \ + OPENSSL_EXPORT void name##_free(type *a); + +#define DECLARE_ASN1_PRINT_FUNCTION(stname) \ + DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) + +#define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ + OPENSSL_EXPORT int fname##_print_ctx(BIO *out, stname *x, int indent, \ + const ASN1_PCTX *pctx); + +#define D2I_OF(type) type *(*)(type **,const unsigned char **,long) +#define I2D_OF(type) int (*)(type *,unsigned char **) +#define I2D_OF_const(type) int (*)(const type *,unsigned char **) + +#define CHECKED_D2I_OF(type, d2i) \ + ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) +#define CHECKED_I2D_OF(type, i2d) \ + ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) +#define CHECKED_NEW_OF(type, xnew) \ + ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) +#define CHECKED_PPTR_OF(type, p) \ + ((void**) (1 ? p : (type**)0)) + +#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) +#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(const type *,unsigned char **) +#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) + +TYPEDEF_D2I2D_OF(void); + +/* The following macros and typedefs allow an ASN1_ITEM + * to be embedded in a structure and referenced. Since + * the ASN1_ITEM pointers need to be globally accessible + * (possibly from shared libraries) they may exist in + * different forms. On platforms that support it the + * ASN1_ITEM structure itself will be globally exported. + * Other platforms will export a function that returns + * an ASN1_ITEM pointer. + * + * To handle both cases transparently the macros below + * should be used instead of hard coding an ASN1_ITEM + * pointer in a structure. + * + * The structure will look like this: + * + * typedef struct SOMETHING_st { + * ... + * ASN1_ITEM_EXP *iptr; + * ... + * } SOMETHING; + * + * It would be initialised as e.g.: + * + * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; + * + * and the actual pointer extracted with: + * + * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); + * + * Finally an ASN1_ITEM pointer can be extracted from an + * appropriate reference with: ASN1_ITEM_rptr(X509). This + * would be used when a function takes an ASN1_ITEM * argument. + * + */ + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM ASN1_ITEM_EXP; + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +#define ASN1_ITEM_ptr(iptr) (iptr) + +/* Macro to include ASN1_ITEM pointer from base type */ +#define ASN1_ITEM_ref(iptr) (&(iptr##_it)) + +#define ASN1_ITEM_rptr(ref) (&(ref##_it)) + +#define DECLARE_ASN1_ITEM(name) \ + extern OPENSSL_EXPORT const ASN1_ITEM name##_it; + +/* Parameters used by ASN1_STRING_print_ex() */ + +/* These determine which characters to escape: + * RFC2253 special characters, control characters and + * MSB set characters + */ + +#define ASN1_STRFLGS_ESC_2253 1 +#define ASN1_STRFLGS_ESC_CTRL 2 +#define ASN1_STRFLGS_ESC_MSB 4 + + +/* This flag determines how we do escaping: normally + * RC2253 backslash only, set this to use backslash and + * quote. + */ + +#define ASN1_STRFLGS_ESC_QUOTE 8 + + +/* These three flags are internal use only. */ + +/* Character is a valid PrintableString character */ +#define CHARTYPE_PRINTABLESTRING 0x10 +/* Character needs escaping if it is the first character */ +#define CHARTYPE_FIRST_ESC_2253 0x20 +/* Character needs escaping if it is the last character */ +#define CHARTYPE_LAST_ESC_2253 0x40 + +/* NB the internal flags are safely reused below by flags + * handled at the top level. + */ + +/* If this is set we convert all character strings + * to UTF8 first + */ + +#define ASN1_STRFLGS_UTF8_CONVERT 0x10 + +/* If this is set we don't attempt to interpret content: + * just assume all strings are 1 byte per character. This + * will produce some pretty odd looking output! + */ + +#define ASN1_STRFLGS_IGNORE_TYPE 0x20 + +/* If this is set we include the string type in the output */ +#define ASN1_STRFLGS_SHOW_TYPE 0x40 + +/* This determines which strings to display and which to + * 'dump' (hex dump of content octets or DER encoding). We can + * only dump non character strings or everything. If we + * don't dump 'unknown' they are interpreted as character + * strings with 1 octet per character and are subject to + * the usual escaping options. + */ + +#define ASN1_STRFLGS_DUMP_ALL 0x80 +#define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 + +/* These determine what 'dumping' does, we can dump the + * content octets or the DER encoding: both use the + * RFC2253 #XXXXX notation. + */ + +#define ASN1_STRFLGS_DUMP_DER 0x200 + +/* All the string flags consistent with RFC2253, + * escaping control characters isn't essential in + * RFC2253 but it is advisable anyway. + */ + +#define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ + ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + ASN1_STRFLGS_UTF8_CONVERT | \ + ASN1_STRFLGS_DUMP_UNKNOWN | \ + ASN1_STRFLGS_DUMP_DER) + +DECLARE_ASN1_SET_OF(ASN1_INTEGER) + +typedef struct asn1_type_st + { + int type; + union { + char *ptr; + ASN1_BOOLEAN boolean; + ASN1_STRING * asn1_string; + ASN1_OBJECT * object; + ASN1_INTEGER * integer; + ASN1_ENUMERATED * enumerated; + ASN1_BIT_STRING * bit_string; + ASN1_OCTET_STRING * octet_string; + ASN1_PRINTABLESTRING * printablestring; + ASN1_T61STRING * t61string; + ASN1_IA5STRING * ia5string; + ASN1_GENERALSTRING * generalstring; + ASN1_BMPSTRING * bmpstring; + ASN1_UNIVERSALSTRING * universalstring; + ASN1_UTCTIME * utctime; + ASN1_GENERALIZEDTIME * generalizedtime; + ASN1_VISIBLESTRING * visiblestring; + ASN1_UTF8STRING * utf8string; + /* set and sequence are left complete and still + * contain the set or sequence bytes */ + ASN1_STRING * set; + ASN1_STRING * sequence; + ASN1_VALUE * asn1_value; + } value; + } ASN1_TYPE; + +DECLARE_ASN1_SET_OF(ASN1_TYPE) + +typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) +DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) + +struct X509_algor_st + { + ASN1_OBJECT *algorithm; + ASN1_TYPE *parameter; + } /* X509_ALGOR */; +DEFINE_STACK_OF(X509_ALGOR); + +DECLARE_ASN1_FUNCTIONS(X509_ALGOR) + +typedef struct NETSCAPE_X509_st + { + ASN1_OCTET_STRING *header; + X509 *cert; + } NETSCAPE_X509; + +/* This is used to contain a list of bit names */ +typedef struct BIT_STRING_BITNAME_st { + int bitnum; + const char *lname; + const char *sname; +} BIT_STRING_BITNAME; + + +#define M_ASN1_STRING_length(x) ((x)->length) +#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n)) +#define M_ASN1_STRING_type(x) ((x)->type) +#define M_ASN1_STRING_data(x) ((x)->data) + +/* Macros for string operations */ +#define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\ + ASN1_STRING_type_new(V_ASN1_BIT_STRING) +#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ + ASN1_STRING_dup((const ASN1_STRING *)a) +#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ + (const ASN1_STRING *)a,(const ASN1_STRING *)b) +#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) + +#define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ + ASN1_STRING_type_new(V_ASN1_INTEGER) +#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\ + ASN1_STRING_dup((const ASN1_STRING *)a) +#define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ + (const ASN1_STRING *)a,(const ASN1_STRING *)b) + +#define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ + ASN1_STRING_type_new(V_ASN1_ENUMERATED) +#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\ + ASN1_STRING_dup((const ASN1_STRING *)a) +#define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ + (const ASN1_STRING *)a,(const ASN1_STRING *)b) + +#define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ + ASN1_STRING_type_new(V_ASN1_OCTET_STRING) +#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ + ASN1_STRING_dup((const ASN1_STRING *)a) +#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ + (const ASN1_STRING *)a,(const ASN1_STRING *)b) +#define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) +#define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) +#define M_i2d_ASN1_OCTET_STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ + V_ASN1_UNIVERSAL) + +#define B_ASN1_TIME \ + B_ASN1_UTCTIME | \ + B_ASN1_GENERALIZEDTIME + +#define B_ASN1_PRINTABLE \ + B_ASN1_NUMERICSTRING| \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_T61STRING| \ + B_ASN1_IA5STRING| \ + B_ASN1_BIT_STRING| \ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING|\ + B_ASN1_SEQUENCE|\ + B_ASN1_UNKNOWN + +#define B_ASN1_DIRECTORYSTRING \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_TELETEXSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_UTF8STRING + +#define B_ASN1_DISPLAYTEXT \ + B_ASN1_IA5STRING| \ + B_ASN1_VISIBLESTRING| \ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING + +#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) +#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_PRINTABLE(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_PRINTABLE) + +#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) +#define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_DIRECTORYSTRING(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_DIRECTORYSTRING) + +#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_DISPLAYTEXT(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_DISPLAYTEXT) + +#define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\ + ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) +#define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_PRINTABLESTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \ + (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING) + +#define M_ASN1_T61STRING_new() (ASN1_T61STRING *)\ + ASN1_STRING_type_new(V_ASN1_T61STRING) +#define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_T61STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_T61STRING(a,pp,l) \ + (ASN1_T61STRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING) + +#define M_ASN1_IA5STRING_new() (ASN1_IA5STRING *)\ + ASN1_STRING_type_new(V_ASN1_IA5STRING) +#define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_IA5STRING_dup(a) \ + (ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a) +#define M_i2d_ASN1_IA5STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_IA5STRING(a,pp,l) \ + (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\ + B_ASN1_IA5STRING) + +#define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ + ASN1_STRING_type_new(V_ASN1_UTCTIME) +#define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\ + ASN1_STRING_dup((const ASN1_STRING *)a) + +#define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ + ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) +#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ + (const ASN1_STRING *)a) + +#define M_ASN1_TIME_new() (ASN1_TIME *)\ + ASN1_STRING_type_new(V_ASN1_UTCTIME) +#define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_TIME_dup(a) (ASN1_TIME *)\ + ASN1_STRING_dup((const ASN1_STRING *)a) + +#define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ + ASN1_STRING_type_new(V_ASN1_GENERALSTRING) +#define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_GENERALSTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_GENERALSTRING(a,pp,l) \ + (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING) + +#define M_ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\ + ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING) +#define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \ + (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING) + +#define M_ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\ + ASN1_STRING_type_new(V_ASN1_BMPSTRING) +#define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_BMPSTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_BMPSTRING(a,pp,l) \ + (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING) + +#define M_ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\ + ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_VISIBLESTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \ + (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING) + +#define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\ + ASN1_STRING_type_new(V_ASN1_UTF8STRING) +#define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_UTF8STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_UTF8STRING(a,pp,l) \ + (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) + + /* for the is_set parameter to i2d_ASN1_SET */ +#define IS_SEQUENCE 0 +#define IS_SET 1 + +DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) + +OPENSSL_EXPORT int ASN1_TYPE_get(ASN1_TYPE *a); +OPENSSL_EXPORT void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); +OPENSSL_EXPORT int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); +OPENSSL_EXPORT int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); + +OPENSSL_EXPORT ASN1_OBJECT * ASN1_OBJECT_new(void ); +OPENSSL_EXPORT void ASN1_OBJECT_free(ASN1_OBJECT *a); +OPENSSL_EXPORT int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); +OPENSSL_EXPORT ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, + long length); +OPENSSL_EXPORT ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, + long length); + +DECLARE_ASN1_ITEM(ASN1_OBJECT) + +DECLARE_ASN1_SET_OF(ASN1_OBJECT) + +OPENSSL_EXPORT ASN1_STRING * ASN1_STRING_new(void); +OPENSSL_EXPORT void ASN1_STRING_free(ASN1_STRING *a); +OPENSSL_EXPORT int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); +OPENSSL_EXPORT ASN1_STRING * ASN1_STRING_dup(const ASN1_STRING *a); +OPENSSL_EXPORT ASN1_STRING * ASN1_STRING_type_new(int type ); +OPENSSL_EXPORT int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); + /* Since this is used to store all sorts of things, via macros, for now, make + its data void * */ +OPENSSL_EXPORT int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); +OPENSSL_EXPORT void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); +OPENSSL_EXPORT int ASN1_STRING_length(const ASN1_STRING *x); +OPENSSL_EXPORT void ASN1_STRING_length_set(ASN1_STRING *x, int n); +OPENSSL_EXPORT int ASN1_STRING_type(ASN1_STRING *x); +OPENSSL_EXPORT unsigned char * ASN1_STRING_data(ASN1_STRING *x); + +DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) +OPENSSL_EXPORT int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); +OPENSSL_EXPORT ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp, long length); +OPENSSL_EXPORT int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length ); +OPENSSL_EXPORT int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); +OPENSSL_EXPORT int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); +OPENSSL_EXPORT int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, unsigned char *flags, int flags_len); + +OPENSSL_EXPORT int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, BIT_STRING_BITNAME *tbl, int indent); +OPENSSL_EXPORT int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); +OPENSSL_EXPORT int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, BIT_STRING_BITNAME *tbl); + +OPENSSL_EXPORT int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); +OPENSSL_EXPORT int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length); + +DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) +OPENSSL_EXPORT int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); +OPENSSL_EXPORT ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, long length); +OPENSSL_EXPORT ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, long length); +OPENSSL_EXPORT ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x); +OPENSSL_EXPORT int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); + +DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) + +OPENSSL_EXPORT int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); +OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); +OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, int offset_day, long offset_sec); +OPENSSL_EXPORT int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); +OPENSSL_EXPORT int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); +#if 0 +time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s); +#endif + +OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); +OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); +OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day, long offset_sec); +OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); +OPENSSL_EXPORT int ASN1_TIME_diff(int *pday, int *psec, const ASN1_TIME *from, const ASN1_TIME *to); + +DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) +OPENSSL_EXPORT ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); +OPENSSL_EXPORT int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b); +OPENSSL_EXPORT int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); + +DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_NULL) +DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) + +OPENSSL_EXPORT int UTF8_getc(const unsigned char *str, int len, unsigned long *val); +OPENSSL_EXPORT int UTF8_putc(unsigned char *str, int len, unsigned long value); + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) +DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_TIME) + +DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) + +OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); +OPENSSL_EXPORT ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t, int offset_day, long offset_sec); +OPENSSL_EXPORT int ASN1_TIME_check(ASN1_TIME *t); +OPENSSL_EXPORT ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); +OPENSSL_EXPORT int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); + +OPENSSL_EXPORT int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag, int ex_class, int is_set); +OPENSSL_EXPORT STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, + const unsigned char **pp, + long length, d2i_of_void *d2i, + void (*free_func)(OPENSSL_BLOCK), int ex_tag, + int ex_class); + +OPENSSL_EXPORT int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); +OPENSSL_EXPORT int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); +OPENSSL_EXPORT int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); +OPENSSL_EXPORT int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size); +OPENSSL_EXPORT int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); +OPENSSL_EXPORT int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); +OPENSSL_EXPORT int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); +OPENSSL_EXPORT int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); + +OPENSSL_EXPORT int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); +OPENSSL_EXPORT ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, const char *sn, const char *ln); + +OPENSSL_EXPORT int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); +OPENSSL_EXPORT long ASN1_INTEGER_get(const ASN1_INTEGER *a); +OPENSSL_EXPORT ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); +OPENSSL_EXPORT BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn); + +OPENSSL_EXPORT int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); +OPENSSL_EXPORT long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); +OPENSSL_EXPORT ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); +OPENSSL_EXPORT BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); + +/* General */ +/* given a string, return the correct type, max is the maximum length */ +OPENSSL_EXPORT int ASN1_PRINTABLE_type(const unsigned char *s, int max); + +OPENSSL_EXPORT int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); +OPENSSL_EXPORT ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, long length, int Ptag, int Pclass); +OPENSSL_EXPORT unsigned long ASN1_tag2bit(int tag); +/* type is one or more of the B_ASN1_ values. */ +OPENSSL_EXPORT ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp, long length,int type); + +/* PARSING */ +OPENSSL_EXPORT int asn1_Finish(ASN1_CTX *c); +OPENSSL_EXPORT int asn1_const_Finish(ASN1_const_CTX *c); + +/* SPECIALS */ +OPENSSL_EXPORT int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, int *pclass, long omax); +OPENSSL_EXPORT int ASN1_check_infinite_end(unsigned char **p,long len); +OPENSSL_EXPORT int ASN1_const_check_infinite_end(const unsigned char **p,long len); +OPENSSL_EXPORT void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, int xclass); +OPENSSL_EXPORT int ASN1_put_eoc(unsigned char **pp); +OPENSSL_EXPORT int ASN1_object_size(int constructed, int length, int tag); + +/* Used to implement other functions */ +OPENSSL_EXPORT void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); + +#define ASN1_dup_of(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(type, x))) + +#define ASN1_dup_of_const(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(const type, x))) + +OPENSSL_EXPORT void *ASN1_item_dup(const ASN1_ITEM *it, void *x); + +/* ASN1 alloc/free macros for when a type is only used internally */ + +#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) +#define M_ASN1_free_of(x, type) \ + ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) + +#ifndef OPENSSL_NO_FP_API +OPENSSL_EXPORT void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); + +#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +OPENSSL_EXPORT void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); +OPENSSL_EXPORT int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x); + +#define ASN1_i2d_fp_of(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +#define ASN1_i2d_fp_of_const(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +OPENSSL_EXPORT int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); +OPENSSL_EXPORT int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); +#endif + +OPENSSL_EXPORT int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); + +OPENSSL_EXPORT void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x); + +#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +OPENSSL_EXPORT void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); +OPENSSL_EXPORT int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x); + +#define ASN1_i2d_bio_of(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +#define ASN1_i2d_bio_of_const(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +OPENSSL_EXPORT int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); +OPENSSL_EXPORT int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); +OPENSSL_EXPORT int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); +OPENSSL_EXPORT int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); +OPENSSL_EXPORT int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); +OPENSSL_EXPORT int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); +OPENSSL_EXPORT int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, unsigned char *buf, int off); +OPENSSL_EXPORT int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); +OPENSSL_EXPORT int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); +OPENSSL_EXPORT const char *ASN1_tag2str(int tag); + +/* Used to load and write netscape format cert */ + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509) + +int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); + +OPENSSL_EXPORT STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len, d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK)); +OPENSSL_EXPORT unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d, unsigned char **buf, int *len ); +OPENSSL_EXPORT void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); +OPENSSL_EXPORT void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); +OPENSSL_EXPORT ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, ASN1_OCTET_STRING **oct); + +#define ASN1_pack_string_of(type,obj,i2d,oct) \ + (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \ + CHECKED_I2D_OF(type, i2d), \ + oct)) + +OPENSSL_EXPORT ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); + +OPENSSL_EXPORT void ASN1_STRING_set_default_mask(unsigned long mask); +OPENSSL_EXPORT int ASN1_STRING_set_default_mask_asc(const char *p); +OPENSSL_EXPORT unsigned long ASN1_STRING_get_default_mask(void); +OPENSSL_EXPORT int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, int inform, unsigned long mask); +OPENSSL_EXPORT int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, int inform, unsigned long mask, long minsize, long maxsize); + +OPENSSL_EXPORT ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, int inlen, int inform, int nid); +OPENSSL_EXPORT ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); +OPENSSL_EXPORT int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); +OPENSSL_EXPORT void ASN1_STRING_TABLE_cleanup(void); + +/* ASN1 template functions */ + +/* Old API compatible functions */ +OPENSSL_EXPORT ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); +OPENSSL_EXPORT void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); +OPENSSL_EXPORT ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it); +OPENSSL_EXPORT int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); +OPENSSL_EXPORT int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); + +OPENSSL_EXPORT void ASN1_add_oid_module(void); + +OPENSSL_EXPORT ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); +OPENSSL_EXPORT ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); + +/* ASN1 Print flags */ + +/* Indicate missing OPTIONAL fields */ +#define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 +/* Mark start and end of SEQUENCE */ +#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 +/* Mark start and end of SEQUENCE/SET OF */ +#define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 +/* Show the ASN1 type of primitives */ +#define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 +/* Don't show ASN1 type of ANY */ +#define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 +/* Don't show ASN1 type of MSTRINGs */ +#define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 +/* Don't show field names in SEQUENCE */ +#define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 +/* Show structure names of each SEQUENCE field */ +#define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 +/* Don't show structure name even at top level */ +#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 + +OPENSSL_EXPORT int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, const ASN1_ITEM *it, const ASN1_PCTX *pctx); +OPENSSL_EXPORT ASN1_PCTX *ASN1_PCTX_new(void); +OPENSSL_EXPORT void ASN1_PCTX_free(ASN1_PCTX *p); +OPENSSL_EXPORT unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p); +OPENSSL_EXPORT void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); +OPENSSL_EXPORT unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p); +OPENSSL_EXPORT void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); +OPENSSL_EXPORT unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p); +OPENSSL_EXPORT void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); +OPENSSL_EXPORT unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p); +OPENSSL_EXPORT void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); +OPENSSL_EXPORT unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p); +OPENSSL_EXPORT void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); + +OPENSSL_EXPORT const BIO_METHOD *BIO_f_asn1(void); + +OPENSSL_EXPORT BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); + +OPENSSL_EXPORT int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, const ASN1_ITEM *it); +OPENSSL_EXPORT int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, const char *hdr, const ASN1_ITEM *it); +OPENSSL_EXPORT ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); +OPENSSL_EXPORT int SMIME_crlf_copy(BIO *in, BIO *out, int flags); +OPENSSL_EXPORT int SMIME_text(BIO *in, BIO *out); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ASN1_strings(void); + +typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg); +OPENSSL_EXPORT int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, asn1_ps_func *prefix_free); +OPENSSL_EXPORT int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, asn1_ps_func **pprefix_free); +OPENSSL_EXPORT int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, asn1_ps_func *suffix_free); +OPENSSL_EXPORT int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, asn1_ps_func **psuffix_free); + +#ifdef __cplusplus +} +#endif + +#define ASN1_F_ASN1_BIT_STRING_set_bit 100 +#define ASN1_F_ASN1_ENUMERATED_set 101 +#define ASN1_F_ASN1_ENUMERATED_to_BN 102 +#define ASN1_F_ASN1_GENERALIZEDTIME_adj 103 +#define ASN1_F_ASN1_INTEGER_set 104 +#define ASN1_F_ASN1_INTEGER_to_BN 105 +#define ASN1_F_ASN1_OBJECT_new 106 +#define ASN1_F_ASN1_PCTX_new 107 +#define ASN1_F_ASN1_STRING_TABLE_add 108 +#define ASN1_F_ASN1_STRING_set 109 +#define ASN1_F_ASN1_STRING_type_new 110 +#define ASN1_F_ASN1_TIME_adj 111 +#define ASN1_F_ASN1_UTCTIME_adj 112 +#define ASN1_F_ASN1_d2i_fp 113 +#define ASN1_F_ASN1_dup 114 +#define ASN1_F_ASN1_generate_v3 115 +#define ASN1_F_ASN1_get_object 116 +#define ASN1_F_ASN1_i2d_bio 117 +#define ASN1_F_ASN1_i2d_fp 118 +#define ASN1_F_ASN1_item_d2i_fp 119 +#define ASN1_F_ASN1_item_dup 120 +#define ASN1_F_ASN1_item_ex_d2i 121 +#define ASN1_F_ASN1_item_i2d_bio 122 +#define ASN1_F_ASN1_item_i2d_fp 123 +#define ASN1_F_ASN1_item_pack 124 +#define ASN1_F_ASN1_item_unpack 125 +#define ASN1_F_ASN1_mbstring_ncopy 126 +#define ASN1_F_ASN1_template_new 127 +#define ASN1_F_BIO_new_NDEF 128 +#define ASN1_F_BN_to_ASN1_ENUMERATED 129 +#define ASN1_F_BN_to_ASN1_INTEGER 130 +#define ASN1_F_a2d_ASN1_OBJECT 131 +#define ASN1_F_a2i_ASN1_ENUMERATED 132 +#define ASN1_F_a2i_ASN1_INTEGER 133 +#define ASN1_F_a2i_ASN1_STRING 134 +#define ASN1_F_append_exp 135 +#define ASN1_F_asn1_cb 136 +#define ASN1_F_asn1_check_tlen 137 +#define ASN1_F_asn1_collate_primitive 138 +#define ASN1_F_asn1_collect 139 +#define ASN1_F_asn1_d2i_ex_primitive 140 +#define ASN1_F_asn1_d2i_read_bio 141 +#define ASN1_F_asn1_do_adb 142 +#define ASN1_F_asn1_ex_c2i 143 +#define ASN1_F_asn1_find_end 144 +#define ASN1_F_asn1_item_ex_combine_new 145 +#define ASN1_F_asn1_str2type 146 +#define ASN1_F_asn1_template_ex_d2i 147 +#define ASN1_F_asn1_template_noexp_d2i 148 +#define ASN1_F_bitstr_cb 149 +#define ASN1_F_c2i_ASN1_BIT_STRING 150 +#define ASN1_F_c2i_ASN1_INTEGER 151 +#define ASN1_F_c2i_ASN1_OBJECT 152 +#define ASN1_F_collect_data 153 +#define ASN1_F_d2i_ASN1_BOOLEAN 154 +#define ASN1_F_d2i_ASN1_OBJECT 155 +#define ASN1_F_d2i_ASN1_UINTEGER 156 +#define ASN1_F_d2i_ASN1_UTCTIME 157 +#define ASN1_F_d2i_ASN1_bytes 158 +#define ASN1_F_d2i_ASN1_type_bytes 159 +#define ASN1_F_i2d_ASN1_TIME 160 +#define ASN1_F_i2d_PrivateKey 161 +#define ASN1_F_long_c2i 162 +#define ASN1_F_parse_tagging 163 +#define ASN1_R_ASN1_LENGTH_MISMATCH 100 +#define ASN1_R_AUX_ERROR 101 +#define ASN1_R_BAD_GET_ASN1_OBJECT_CALL 102 +#define ASN1_R_BAD_OBJECT_HEADER 103 +#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 104 +#define ASN1_R_BN_LIB 105 +#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 +#define ASN1_R_BUFFER_TOO_SMALL 107 +#define ASN1_R_DECODE_ERROR 108 +#define ASN1_R_DEPTH_EXCEEDED 109 +#define ASN1_R_ENCODE_ERROR 110 +#define ASN1_R_ERROR_GETTING_TIME 111 +#define ASN1_R_EXPECTING_AN_ASN1_SEQUENCE 112 +#define ASN1_R_EXPECTING_AN_INTEGER 113 +#define ASN1_R_EXPECTING_AN_OBJECT 114 +#define ASN1_R_EXPECTING_A_BOOLEAN 115 +#define ASN1_R_EXPECTING_A_TIME 116 +#define ASN1_R_EXPLICIT_LENGTH_MISMATCH 117 +#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 118 +#define ASN1_R_FIELD_MISSING 119 +#define ASN1_R_FIRST_NUM_TOO_LARGE 120 +#define ASN1_R_HEADER_TOO_LONG 121 +#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 122 +#define ASN1_R_ILLEGAL_BOOLEAN 123 +#define ASN1_R_ILLEGAL_CHARACTERS 124 +#define ASN1_R_ILLEGAL_FORMAT 125 +#define ASN1_R_ILLEGAL_HEX 126 +#define ASN1_R_ILLEGAL_IMPLICIT_TAG 127 +#define ASN1_R_ILLEGAL_INTEGER 128 +#define ASN1_R_ILLEGAL_NESTED_TAGGING 129 +#define ASN1_R_ILLEGAL_NULL 130 +#define ASN1_R_ILLEGAL_NULL_VALUE 131 +#define ASN1_R_ILLEGAL_OBJECT 132 +#define ASN1_R_ILLEGAL_OPTIONAL_ANY 133 +#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 134 +#define ASN1_R_ILLEGAL_TAGGED_ANY 135 +#define ASN1_R_ILLEGAL_TIME_VALUE 136 +#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 137 +#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 138 +#define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 139 +#define ASN1_R_INVALID_BMPSTRING_LENGTH 140 +#define ASN1_R_INVALID_DIGIT 141 +#define ASN1_R_INVALID_MODIFIER 142 +#define ASN1_R_INVALID_NUMBER 143 +#define ASN1_R_INVALID_OBJECT_ENCODING 144 +#define ASN1_R_INVALID_SEPARATOR 145 +#define ASN1_R_INVALID_TIME_FORMAT 146 +#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 147 +#define ASN1_R_INVALID_UTF8STRING 148 +#define ASN1_R_LIST_ERROR 149 +#define ASN1_R_MALLOC_FAILURE 150 +#define ASN1_R_MISSING_ASN1_EOS 151 +#define ASN1_R_MISSING_EOC 152 +#define ASN1_R_MISSING_SECOND_NUMBER 153 +#define ASN1_R_MISSING_VALUE 154 +#define ASN1_R_MSTRING_NOT_UNIVERSAL 155 +#define ASN1_R_MSTRING_WRONG_TAG 156 +#define ASN1_R_NESTED_ASN1_ERROR 157 +#define ASN1_R_NESTED_ASN1_STRING 158 +#define ASN1_R_NON_HEX_CHARACTERS 159 +#define ASN1_R_NOT_ASCII_FORMAT 160 +#define ASN1_R_NOT_ENOUGH_DATA 161 +#define ASN1_R_NO_MATCHING_CHOICE_TYPE 162 +#define ASN1_R_NULL_IS_WRONG_LENGTH 163 +#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 164 +#define ASN1_R_ODD_NUMBER_OF_CHARS 165 +#define ASN1_R_SECOND_NUMBER_TOO_LARGE 166 +#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 167 +#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 168 +#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 169 +#define ASN1_R_SHORT_LINE 170 +#define ASN1_R_STREAMING_NOT_SUPPORTED 171 +#define ASN1_R_STRING_TOO_LONG 172 +#define ASN1_R_STRING_TOO_SHORT 173 +#define ASN1_R_TAG_VALUE_TOO_HIGH 174 +#define ASN1_R_TIME_NOT_ASCII_FORMAT 175 +#define ASN1_R_TOO_LONG 176 +#define ASN1_R_TYPE_NOT_CONSTRUCTED 177 +#define ASN1_R_TYPE_NOT_PRIMITIVE 178 +#define ASN1_R_UNEXPECTED_EOC 179 +#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 180 +#define ASN1_R_UNKNOWN_FORMAT 181 +#define ASN1_R_UNKNOWN_TAG 182 +#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 183 +#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 184 +#define ASN1_R_UNSUPPORTED_TYPE 185 +#define ASN1_R_WRONG_TAG 186 +#define ASN1_R_WRONG_TYPE 187 + +#endif diff --git a/phonelibs/boringssl/include/openssl/asn1_mac.h b/phonelibs/boringssl/include/openssl/asn1_mac.h new file mode 100644 index 00000000000000..49b2a286b77020 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/asn1_mac.h @@ -0,0 +1,76 @@ +/* crypto/asn1/asn1_mac.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ASN1_MAC_H +#define HEADER_ASN1_MAC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +OPENSSL_EXPORT int asn1_GetSequence(ASN1_const_CTX *c, long *length); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/boringssl/include/openssl/asn1t.h b/phonelibs/boringssl/include/openssl/asn1t.h new file mode 100644 index 00000000000000..0f2560b7156396 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/asn1t.h @@ -0,0 +1,907 @@ +/* asn1t.h */ +/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project 2000. + */ +/* ==================================================================== + * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_ASN1T_H +#define HEADER_ASN1T_H + +#include +#include + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +/* ASN1 template defines, structures and functions */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) + + +/* Macros for start and end of ASN1_ITEM definition */ + +#define ASN1_ITEM_start(itname) \ + const ASN1_ITEM itname##_it = { + +#define ASN1_ITEM_end(itname) \ + }; + +/* Macros to aid ASN1 template writing */ + +#define ASN1_ITEM_TEMPLATE(tname) \ + static const ASN1_TEMPLATE tname##_item_tt + +#define ASN1_ITEM_TEMPLATE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE,\ + -1,\ + &tname##_item_tt,\ + 0,\ + NULL,\ + 0,\ + #tname \ + ASN1_ITEM_end(tname) + + +/* This is a ASN1 type which just embeds a template */ + +/* This pair helps declare a SEQUENCE. We can do: + * + * ASN1_SEQUENCE(stname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END(stname) + * + * This will produce an ASN1_ITEM called stname_it + * for a structure called stname. + * + * If you want the same structure but a different + * name then use: + * + * ASN1_SEQUENCE(itname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END_name(stname, itname) + * + * This will create an item called itname_it using + * a structure called stname. + */ + +#define ASN1_SEQUENCE(tname) \ + static const ASN1_TEMPLATE tname##_seq_tt[] + +#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) + +#define ASN1_SEQUENCE_END_name(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +#define ASN1_NDEF_SEQUENCE(tname) \ + ASN1_SEQUENCE(tname) + +#define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ + ASN1_SEQUENCE_cb(tname, cb) + +#define ASN1_SEQUENCE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, cb, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_BROKEN_SEQUENCE(tname) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_ref(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), cb, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_enc(tname, enc, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, cb, offsetof(tname, enc)}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_NDEF_SEQUENCE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(tname),\ + #tname \ + ASN1_ITEM_end(tname) + +#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) + +#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_ref(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +#define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + + +/* This pair helps declare a CHOICE type. We can do: + * + * ASN1_CHOICE(chname) = { + * ... CHOICE options ... + * ASN1_CHOICE_END(chname) + * + * This will produce an ASN1_ITEM called chname_it + * for a structure called chname. The structure + * definition must look like this: + * typedef struct { + * int type; + * union { + * ASN1_SOMETHING *opt1; + * ASN1_SOMEOTHER *opt2; + * } value; + * } chname; + * + * the name of the selector must be 'type'. + * to use an alternative selector name use the + * ASN1_CHOICE_END_selector() version. + */ + +#define ASN1_CHOICE(tname) \ + static const ASN1_TEMPLATE tname##_ch_tt[] + +#define ASN1_CHOICE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, cb, 0}; \ + ASN1_CHOICE(tname) + +#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) + +#define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) + +#define ASN1_CHOICE_END_selector(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +#define ASN1_CHOICE_END_cb(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +/* This helps with the template wrapper form of ASN1_ITEM */ + +#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ + (flags), (tag), 0,\ + #name, ASN1_ITEM_ref(type) } + +/* These help with SEQUENCE or CHOICE components */ + +/* used to declare other types */ + +#define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ + (flags), (tag), offsetof(stname, field),\ + #field, ASN1_ITEM_ref(type) } + +/* used when the structure is combined with the parent */ + +#define ASN1_EX_COMBINE(flags, tag, type) { \ + (flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) } + +/* implicit and explicit helper macros */ + +#define ASN1_IMP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type) + +#define ASN1_EXP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type) + +/* Any defined by macros: the field used is in the table itself */ + +#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +/* Plain simple type */ +#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) + +/* OPTIONAL simple type */ +#define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* IMPLICIT tagged simple type */ +#define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) + +/* IMPLICIT tagged OPTIONAL simple type */ +#define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) + +/* Same as above but EXPLICIT */ + +#define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) +#define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) + +/* SEQUENCE OF type */ +#define ASN1_SEQUENCE_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) + +/* OPTIONAL SEQUENCE OF */ +#define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Same as above but for SET OF */ + +#define ASN1_SET_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) + +#define ASN1_SET_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ + +#define ASN1_IMP_SET_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_EXP_SET_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +#define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +/* EXPLICIT using indefinite length constructed form */ +#define ASN1_NDEF_EXP(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) + +/* EXPLICIT OPTIONAL using indefinite length constructed form */ +#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) + +/* Macros for the ASN1_ADB structure */ + +#define ASN1_ADB(name) \ + static const ASN1_ADB_TABLE name##_adbtbl[] + +#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ + ;\ + static const ASN1_ADB name##_adb = {\ + flags,\ + offsetof(name, field),\ + app_table,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + } + +#define ADB_ENTRY(val, template) {val, template} + +#define ASN1_ADB_TEMPLATE(name) \ + static const ASN1_TEMPLATE name##_tt + +/* This is the ASN1 template structure that defines + * a wrapper round the actual type. It determines the + * actual position of the field in the value structure, + * various flags such as OPTIONAL and the field name. + */ + +struct ASN1_TEMPLATE_st { +unsigned long flags; /* Various flags */ +long tag; /* tag, not used if no tagging */ +unsigned long offset; /* Offset of this field in structure */ +#ifndef NO_ASN1_FIELD_NAMES +const char *field_name; /* Field name */ +#endif +ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ +}; + +/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ + +#define ASN1_TEMPLATE_item(t) (t->item_ptr) +#define ASN1_TEMPLATE_adb(t) (t->item_ptr) + +typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; +typedef struct ASN1_ADB_st ASN1_ADB; + +struct ASN1_ADB_st { + unsigned long flags; /* Various flags */ + unsigned long offset; /* Offset of selector field */ + STACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */ + const ASN1_ADB_TABLE *tbl; /* Table of possible types */ + long tblcount; /* Number of entries in tbl */ + const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ + const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ +}; + +struct ASN1_ADB_TABLE_st { + long value; /* NID for an object or value for an int */ + const ASN1_TEMPLATE tt; /* item for this value */ +}; + +/* template flags */ + +/* Field is optional */ +#define ASN1_TFLG_OPTIONAL (0x1) + +/* Field is a SET OF */ +#define ASN1_TFLG_SET_OF (0x1 << 1) + +/* Field is a SEQUENCE OF */ +#define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) + +/* Special case: this refers to a SET OF that + * will be sorted into DER order when encoded *and* + * the corresponding STACK will be modified to match + * the new order. + */ +#define ASN1_TFLG_SET_ORDER (0x3 << 1) + +/* Mask for SET OF or SEQUENCE OF */ +#define ASN1_TFLG_SK_MASK (0x3 << 1) + +/* These flags mean the tag should be taken from the + * tag field. If EXPLICIT then the underlying type + * is used for the inner tag. + */ + +/* IMPLICIT tagging */ +#define ASN1_TFLG_IMPTAG (0x1 << 3) + + +/* EXPLICIT tagging, inner tag from underlying type */ +#define ASN1_TFLG_EXPTAG (0x2 << 3) + +#define ASN1_TFLG_TAG_MASK (0x3 << 3) + +/* context specific IMPLICIT */ +#define ASN1_TFLG_IMPLICIT ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT + +/* context specific EXPLICIT */ +#define ASN1_TFLG_EXPLICIT ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT + +/* If tagging is in force these determine the + * type of tag to use. Otherwise the tag is + * determined by the underlying type. These + * values reflect the actual octet format. + */ + +/* Universal tag */ +#define ASN1_TFLG_UNIVERSAL (0x0<<6) +/* Application tag */ +#define ASN1_TFLG_APPLICATION (0x1<<6) +/* Context specific tag */ +#define ASN1_TFLG_CONTEXT (0x2<<6) +/* Private tag */ +#define ASN1_TFLG_PRIVATE (0x3<<6) + +#define ASN1_TFLG_TAG_CLASS (0x3<<6) + +/* These are for ANY DEFINED BY type. In this case + * the 'item' field points to an ASN1_ADB structure + * which contains a table of values to decode the + * relevant type + */ + +#define ASN1_TFLG_ADB_MASK (0x3<<8) + +#define ASN1_TFLG_ADB_OID (0x1<<8) + +#define ASN1_TFLG_ADB_INT (0x1<<9) + +/* This flag means a parent structure is passed + * instead of the field: this is useful is a + * SEQUENCE is being combined with a CHOICE for + * example. Since this means the structure and + * item name will differ we need to use the + * ASN1_CHOICE_END_name() macro for example. + */ + +#define ASN1_TFLG_COMBINE (0x1<<10) + +/* This flag when present in a SEQUENCE OF, SET OF + * or EXPLICIT causes indefinite length constructed + * encoding to be used if required. + */ + +#define ASN1_TFLG_NDEF (0x1<<11) + +/* This is the actual ASN1 item itself */ + +struct ASN1_ITEM_st { +char itype; /* The item type, primitive, SEQUENCE, CHOICE or extern */ +long utype; /* underlying type */ +const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains the contents */ +long tcount; /* Number of templates if SEQUENCE or CHOICE */ +const void *funcs; /* functions that handle this type */ +long size; /* Structure size (usually)*/ +#ifndef NO_ASN1_FIELD_NAMES +const char *sname; /* Structure name */ +#endif +}; + +/* These are values for the itype field and + * determine how the type is interpreted. + * + * For PRIMITIVE types the underlying type + * determines the behaviour if items is NULL. + * + * Otherwise templates must contain a single + * template and the type is treated in the + * same way as the type specified in the template. + * + * For SEQUENCE types the templates field points + * to the members, the size field is the + * structure size. + * + * For CHOICE types the templates field points + * to each possible member (typically a union) + * and the 'size' field is the offset of the + * selector. + * + * The 'funcs' field is used for application + * specific functions. + * + * For COMPAT types the funcs field gives a + * set of functions that handle this type, this + * supports the old d2i, i2d convention. + * + * The EXTERN type uses a new style d2i/i2d. + * The new style should be used where possible + * because it avoids things like the d2i IMPLICIT + * hack. + * + * MSTRING is a multiple string type, it is used + * for a CHOICE of character strings where the + * actual strings all occupy an ASN1_STRING + * structure. In this case the 'utype' field + * has a special meaning, it is used as a mask + * of acceptable types using the B_ASN1 constants. + * + * NDEF_SEQUENCE is the same as SEQUENCE except + * that it will use indefinite length constructed + * encoding if requested. + * + */ + +#define ASN1_ITYPE_PRIMITIVE 0x0 + +#define ASN1_ITYPE_SEQUENCE 0x1 + +#define ASN1_ITYPE_CHOICE 0x2 + +#define ASN1_ITYPE_COMPAT 0x3 + +#define ASN1_ITYPE_EXTERN 0x4 + +#define ASN1_ITYPE_MSTRING 0x5 + +#define ASN1_ITYPE_NDEF_SEQUENCE 0x6 + +/* Cache for ASN1 tag and length, so we + * don't keep re-reading it for things + * like CHOICE + */ + +struct ASN1_TLC_st{ + char valid; /* Values below are valid */ + int ret; /* return value */ + long plen; /* length */ + int ptag; /* class value */ + int pclass; /* class value */ + int hdrlen; /* header length */ +}; + +/* Typedefs for ASN1 function pointers */ + +typedef ASN1_VALUE * ASN1_new_func(void); +typedef void ASN1_free_func(ASN1_VALUE *a); +typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, long length); +typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in); + +typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, + int tag, int aclass, char opt, ASN1_TLC *ctx); + +typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); +typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); +typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); + +typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, + int indent, const char *fname, + const ASN1_PCTX *pctx); + +typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); +typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); +typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx); + +typedef struct ASN1_COMPAT_FUNCS_st { + ASN1_new_func *asn1_new; + ASN1_free_func *asn1_free; + ASN1_d2i_func *asn1_d2i; + ASN1_i2d_func *asn1_i2d; +} ASN1_COMPAT_FUNCS; + +typedef struct ASN1_EXTERN_FUNCS_st { + void *app_data; + ASN1_ex_new_func *asn1_ex_new; + ASN1_ex_free_func *asn1_ex_free; + ASN1_ex_free_func *asn1_ex_clear; + ASN1_ex_d2i *asn1_ex_d2i; + ASN1_ex_i2d *asn1_ex_i2d; + ASN1_ex_print_func *asn1_ex_print; +} ASN1_EXTERN_FUNCS; + +typedef struct ASN1_PRIMITIVE_FUNCS_st { + void *app_data; + unsigned long flags; + ASN1_ex_new_func *prim_new; + ASN1_ex_free_func *prim_free; + ASN1_ex_free_func *prim_clear; + ASN1_primitive_c2i *prim_c2i; + ASN1_primitive_i2c *prim_i2c; + ASN1_primitive_print *prim_print; +} ASN1_PRIMITIVE_FUNCS; + +/* This is the ASN1_AUX structure: it handles various + * miscellaneous requirements. For example the use of + * reference counts and an informational callback. + * + * The "informational callback" is called at various + * points during the ASN1 encoding and decoding. It can + * be used to provide minor customisation of the structures + * used. This is most useful where the supplied routines + * *almost* do the right thing but need some extra help + * at a few points. If the callback returns zero then + * it is assumed a fatal error has occurred and the + * main operation should be abandoned. + * + * If major changes in the default behaviour are required + * then an external type is more appropriate. + */ + +typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, + void *exarg); + +typedef struct ASN1_AUX_st { + void *app_data; + int flags; + int ref_offset; /* Offset of reference value */ + ASN1_aux_cb *asn1_cb; + int enc_offset; /* Offset of ASN1_ENCODING structure */ +} ASN1_AUX; + +/* For print related callbacks exarg points to this structure */ +typedef struct ASN1_PRINT_ARG_st { + BIO *out; + int indent; + const ASN1_PCTX *pctx; +} ASN1_PRINT_ARG; + +/* For streaming related callbacks exarg points to this structure */ +typedef struct ASN1_STREAM_ARG_st { + /* BIO to stream through */ + BIO *out; + /* BIO with filters appended */ + BIO *ndef_bio; + /* Streaming I/O boundary */ + unsigned char **boundary; +} ASN1_STREAM_ARG; + +/* Flags in ASN1_AUX */ + +/* Use a reference count */ +#define ASN1_AFLG_REFCOUNT 1 +/* Save the encoding of structure (useful for signatures) */ +#define ASN1_AFLG_ENCODING 2 +/* The Sequence length is invalid */ +#define ASN1_AFLG_BROKEN 4 + +/* operation values for asn1_cb */ + +#define ASN1_OP_NEW_PRE 0 +#define ASN1_OP_NEW_POST 1 +#define ASN1_OP_FREE_PRE 2 +#define ASN1_OP_FREE_POST 3 +#define ASN1_OP_D2I_PRE 4 +#define ASN1_OP_D2I_POST 5 +#define ASN1_OP_I2D_PRE 6 +#define ASN1_OP_I2D_POST 7 +#define ASN1_OP_PRINT_PRE 8 +#define ASN1_OP_PRINT_POST 9 +#define ASN1_OP_STREAM_PRE 10 +#define ASN1_OP_STREAM_POST 11 +#define ASN1_OP_DETACHED_PRE 12 +#define ASN1_OP_DETACHED_POST 13 + +/* Macro to implement a primitive type */ +#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) +#define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ + ASN1_ITEM_end(itname) + +/* Macro to implement a multi string type */ +#define IMPLEMENT_ASN1_MSTRING(itname, mask) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ + ASN1_ITEM_end(itname) + +/* Macro to implement an ASN1_ITEM in terms of old style funcs */ + +#define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE) + +#define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \ + static const ASN1_COMPAT_FUNCS sname##_ff = { \ + (ASN1_new_func *)sname##_new, \ + (ASN1_free_func *)sname##_free, \ + (ASN1_d2i_func *)d2i_##sname, \ + (ASN1_i2d_func *)i2d_##sname, \ + }; \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_COMPAT, \ + tag, \ + NULL, \ + 0, \ + &sname##_ff, \ + 0, \ + #sname \ + ASN1_ITEM_end(sname) + +#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_EXTERN, \ + tag, \ + NULL, \ + 0, \ + &fptrs, \ + 0, \ + #sname \ + ASN1_ITEM_end(sname) + +/* Macro to implement standard functions in terms of ASN1_ITEM structures */ + +#define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) + +#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ + IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) + +#define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ + pre stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + pre void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ + stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ + int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ + { \ + return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ + } + +/* This includes evil casts to remove const: they will go away when full + * ASN1 constification is done. + */ +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(const stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +#define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ + stname * stname##_dup(stname *x) \ + { \ + return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ + } + +#define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ + IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ + int fname##_print_ctx(BIO *out, stname *x, int indent, \ + const ASN1_PCTX *pctx) \ + { \ + return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ + ASN1_ITEM_rptr(itname), pctx); \ + } + +#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ + IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) + +#define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +/* external definitions for primitive types */ + +DECLARE_ASN1_ITEM(ASN1_BOOLEAN) +DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_SEQUENCE) +DECLARE_ASN1_ITEM(CBIGNUM) +DECLARE_ASN1_ITEM(BIGNUM) +DECLARE_ASN1_ITEM(LONG) +DECLARE_ASN1_ITEM(ZLONG) + +DECLARE_STACK_OF(ASN1_VALUE) + +/* Functions used internally by the ASN1 code */ + +int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); +void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); +int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); +int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it); + +void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); +int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt); +int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, + int tag, int aclass, char opt, ASN1_TLC *ctx); + +int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); +int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt); +void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it); + +int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); +int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); + +int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it); + +ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); + +const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr); + +void asn1_refcount_set_one(ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_refcount_dec_and_test_zero(ASN1_VALUE **pval, const ASN1_ITEM *it); + +void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it); +void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/phonelibs/boringssl/include/openssl/base.h b/phonelibs/boringssl/include/openssl/base.h new file mode 100644 index 00000000000000..b769ad5348c08a --- /dev/null +++ b/phonelibs/boringssl/include/openssl/base.h @@ -0,0 +1,233 @@ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + +#ifndef OPENSSL_HEADER_BASE_H +#define OPENSSL_HEADER_BASE_H + + +/* This file should be the first included by all BoringSSL headers. */ + +#include +#include +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +#if defined(__x86_64) || defined(_M_AMD64) || defined(_M_X64) +#define OPENSSL_64_BIT +#define OPENSSL_X86_64 +#elif defined(__x86) || defined(__i386) || defined(__i386__) || defined(_M_IX86) +#define OPENSSL_32_BIT +#define OPENSSL_X86 +#elif defined(__aarch64__) +#define OPENSSL_64_BIT +#define OPENSSL_AARCH64 +#elif defined(__arm) || defined(__arm__) || defined(_M_ARM) +#define OPENSSL_32_BIT +#define OPENSSL_ARM +#elif defined(__aarch64__) +#define OPENSSL_64_BIT +#define OPENSSL_AARCH64 +#elif defined(__mips__) && !defined(__LP64__) +#define OPENSSL_32_BIT +#define OPENSSL_MIPS +#elif defined(__mips__) && defined(__LP64__) +#define OPENSSL_64_BIT +#define OPENSSL_MIPS64 +#elif defined(__pnacl__) +#define OPENSSL_32_BIT +#define OPENSSL_PNACL +#else +#error "Unknown target CPU" +#endif + +#if defined(__APPLE__) +#define OPENSSL_APPLE +#endif + +#if defined(WIN32) || defined(_WIN32) +#define OPENSSL_WINDOWS +#endif + +#if defined(TRUSTY) +#define OPENSSL_TRUSTY +#define OPENSSL_NO_THREADS +#endif + +#define OPENSSL_IS_BORINGSSL +#define OPENSSL_VERSION_NUMBER 0x10002000 + +#if defined(BORINGSSL_SHARED_LIBRARY) + +#if defined(OPENSSL_WINDOWS) + +#if defined(BORINGSSL_IMPLEMENTATION) +#define OPENSSL_EXPORT __declspec(dllexport) +#else +#define OPENSSL_EXPORT __declspec(dllimport) +#endif + +#else /* defined(OPENSSL_WINDOWS) */ + +#if defined(BORINGSSL_IMPLEMENTATION) +#define OPENSSL_EXPORT __attribute__((visibility("default"))) +#else +#define OPENSSL_EXPORT +#endif + +#endif /* defined(OPENSSL_WINDOWS) */ + +#else /* defined(BORINGSSL_SHARED_LIBRARY) */ + +#define OPENSSL_EXPORT + +#endif /* defined(BORINGSSL_SHARED_LIBRARY) */ + +/* CRYPTO_THREADID is a dummy value. */ +typedef int CRYPTO_THREADID; + +typedef int ASN1_BOOLEAN; +typedef int ASN1_NULL; +typedef struct ASN1_ITEM_st ASN1_ITEM; +typedef struct asn1_object_st ASN1_OBJECT; +typedef struct asn1_pctx_st ASN1_PCTX; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct asn1_string_st ASN1_BMPSTRING; +typedef struct asn1_string_st ASN1_ENUMERATED; +typedef struct asn1_string_st ASN1_GENERALIZEDTIME; +typedef struct asn1_string_st ASN1_GENERALSTRING; +typedef struct asn1_string_st ASN1_IA5STRING; +typedef struct asn1_string_st ASN1_INTEGER; +typedef struct asn1_string_st ASN1_OCTET_STRING; +typedef struct asn1_string_st ASN1_PRINTABLESTRING; +typedef struct asn1_string_st ASN1_STRING; +typedef struct asn1_string_st ASN1_T61STRING; +typedef struct asn1_string_st ASN1_TIME; +typedef struct asn1_string_st ASN1_UNIVERSALSTRING; +typedef struct asn1_string_st ASN1_UTCTIME; +typedef struct asn1_string_st ASN1_UTF8STRING; +typedef struct asn1_string_st ASN1_VISIBLESTRING; + +typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; +typedef struct DIST_POINT_st DIST_POINT; +typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; +typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; +typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; +typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; +typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; +typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; +typedef struct X509_algor_st X509_ALGOR; +typedef struct X509_crl_st X509_CRL; +typedef struct X509_pubkey_st X509_PUBKEY; +typedef struct bignum_ctx BN_CTX; +typedef struct bignum_st BIGNUM; +typedef struct bio_method_st BIO_METHOD; +typedef struct bio_st BIO; +typedef struct bn_gencb_st BN_GENCB; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct buf_mem_st BUF_MEM; +typedef struct cbb_st CBB; +typedef struct cbs_st CBS; +typedef struct cmac_ctx_st CMAC_CTX; +typedef struct conf_st CONF; +typedef struct conf_value_st CONF_VALUE; +typedef struct dh_method DH_METHOD; +typedef struct dh_st DH; +typedef struct dsa_method DSA_METHOD; +typedef struct dsa_st DSA; +typedef struct ec_key_st EC_KEY; +typedef struct ecdsa_method_st ECDSA_METHOD; +typedef struct ecdsa_sig_st ECDSA_SIG; +typedef struct engine_st ENGINE; +typedef struct env_md_ctx_st EVP_MD_CTX; +typedef struct env_md_st EVP_MD; +typedef struct evp_aead_st EVP_AEAD; +typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; +typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; +typedef struct evp_pkey_method_st EVP_PKEY_METHOD; +typedef struct evp_pkey_st EVP_PKEY; +typedef struct hmac_ctx_st HMAC_CTX; +typedef struct md4_state_st MD4_CTX; +typedef struct md5_state_st MD5_CTX; +typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; +typedef struct pkcs12_st PKCS12; +typedef struct rand_meth_st RAND_METHOD; +typedef struct rc4_key_st RC4_KEY; +typedef struct rsa_meth_st RSA_METHOD; +typedef struct rsa_st RSA; +typedef struct sha256_state_st SHA256_CTX; +typedef struct sha512_state_st SHA512_CTX; +typedef struct sha_state_st SHA_CTX; +typedef struct ssl_ctx_st SSL_CTX; +typedef struct ssl_st SSL; +typedef struct st_ERR_FNS ERR_FNS; +typedef struct v3_ext_ctx X509V3_CTX; +typedef struct x509_crl_method_st X509_CRL_METHOD; +typedef struct x509_revoked_st X509_REVOKED; +typedef struct x509_st X509; +typedef struct x509_store_ctx_st X509_STORE_CTX; +typedef struct x509_store_st X509_STORE; +typedef void *OPENSSL_BLOCK; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_BASE_H */ diff --git a/phonelibs/boringssl/include/openssl/base64.h b/phonelibs/boringssl/include/openssl/base64.h new file mode 100644 index 00000000000000..7aee9907f9239b --- /dev/null +++ b/phonelibs/boringssl/include/openssl/base64.h @@ -0,0 +1,179 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_BASE64_H +#define OPENSSL_HEADER_BASE64_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* base64 functions. + * + * For historical reasons, these functions have the EVP_ prefix but just do + * base64 encoding and decoding. */ + + +typedef struct evp_encode_ctx_st EVP_ENCODE_CTX; + + +/* Encoding */ + +/* EVP_EncodeInit initialises |*ctx|, which is typically stack + * allocated, for an encoding operation. + * + * NOTE: The encoding operation breaks its output with newlines every + * 64 characters of output (48 characters of input). Use + * EVP_EncodeBlock to encode raw base64. */ +OPENSSL_EXPORT void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); + +/* EVP_EncodeUpdate encodes |in_len| bytes from |in| and writes an encoded + * version of them to |out| and sets |*out_len| to the number of bytes written. + * Some state may be contained in |ctx| so |EVP_EncodeFinal| must be used to + * flush it before using the encoded data. */ +OPENSSL_EXPORT void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, uint8_t *out, + int *out_len, const uint8_t *in, + size_t in_len); + +/* EVP_EncodeFinal flushes any remaining output bytes from |ctx| to |out| and + * sets |*out_len| to the number of bytes written. */ +OPENSSL_EXPORT void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, uint8_t *out, + int *out_len); + +/* EVP_EncodeBlock encodes |src_len| bytes from |src| and writes the + * result to |dst| with a trailing NUL. It returns the number of bytes + * written, not including this trailing NUL. */ +OPENSSL_EXPORT size_t EVP_EncodeBlock(uint8_t *dst, const uint8_t *src, + size_t src_len); + +/* EVP_EncodedLength sets |*out_len| to the number of bytes that will be needed + * to call |EVP_EncodeBlock| on an input of length |len|. This includes the + * final NUL that |EVP_EncodeBlock| writes. It returns one on success or zero + * on error. */ +OPENSSL_EXPORT int EVP_EncodedLength(size_t *out_len, size_t len); + + +/* Decoding */ + +/* EVP_DecodedLength sets |*out_len| to the maximum number of bytes + * that will be needed to call |EVP_DecodeBase64| on an input of + * length |len|. */ +OPENSSL_EXPORT int EVP_DecodedLength(size_t *out_len, size_t len); + +/* EVP_DecodeBase64 decodes |in_len| bytes from base64 and writes + * |*out_len| bytes to |out|. |max_out| is the size of the output + * buffer. If it is not enough for the maximum output size, the + * operation fails. */ +OPENSSL_EXPORT int EVP_DecodeBase64(uint8_t *out, size_t *out_len, + size_t max_out, const uint8_t *in, + size_t in_len); + +/* EVP_DecodeInit initialises |*ctx|, which is typically stack allocated, for + * a decoding operation. + * + * TODO(davidben): This isn't a straight-up base64 decode either. Document + * and/or fix exactly what's going on here; maximum line length and such. */ +OPENSSL_EXPORT void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); + +/* EVP_DecodeUpdate decodes |in_len| bytes from |in| and writes the decoded + * data to |out| and sets |*out_len| to the number of bytes written. Some state + * may be contained in |ctx| so |EVP_DecodeFinal| must be used to flush it + * before using the encoded data. + * + * It returns -1 on error, one if a full line of input was processed and zero + * if the line was short (i.e. it was the last line). */ +OPENSSL_EXPORT int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, uint8_t *out, + int *out_len, const uint8_t *in, + size_t in_len); + +/* EVP_DecodeFinal flushes any remaining output bytes from |ctx| to |out| and + * sets |*out_len| to the number of bytes written. It returns one on success + * and minus one on error. */ +OPENSSL_EXPORT int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, uint8_t *out, + int *out_len); + +/* Deprecated: EVP_DecodeBlock encodes |src_len| bytes from |src| and + * writes the result to |dst|. It returns the number of bytes written + * or -1 on error. + * + * WARNING: EVP_DecodeBlock's return value does not take padding into + * account. It also strips leading whitespace and trailing + * whitespace. */ +OPENSSL_EXPORT int EVP_DecodeBlock(uint8_t *dst, const uint8_t *src, + size_t src_len); + + +struct evp_encode_ctx_st { + unsigned num; /* number saved in a partial encode/decode */ + unsigned length; /* The length is either the output line length + * (in input bytes) or the shortest input line + * length that is ok. Once decoding begins, + * the length is adjusted up each time a longer + * line is decoded */ + uint8_t enc_data[80]; /* data to encode */ + unsigned line_num; /* number read on current line */ + int expect_nl; +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_BASE64_H */ diff --git a/phonelibs/boringssl/include/openssl/bio.h b/phonelibs/boringssl/include/openssl/bio.h new file mode 100644 index 00000000000000..872465750b5aa7 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/bio.h @@ -0,0 +1,910 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_BIO_H +#define OPENSSL_HEADER_BIO_H + +#include + +#include /* For FILE */ + +#include /* for ERR_print_errors_fp */ +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* BIO abstracts over a file-descriptor like interface. */ + + +/* Allocation and freeing. */ + +DEFINE_STACK_OF(BIO); + +/* BIO_new creates a new BIO with the given type and a reference count of one. + * It returns the fresh |BIO|, or NULL on error. */ +OPENSSL_EXPORT BIO *BIO_new(const BIO_METHOD *type); + +/* BIO_free decrements the reference count of |bio|. If the reference count + * drops to zero, it (optionally) calls the BIO's callback with |BIO_CB_FREE|, + * frees the ex_data and then, if the BIO has a destroy callback for the + * method, calls it. Finally it frees |bio| itself. It then repeats that for + * the next BIO in the chain, if any. + * + * It returns one on success or zero otherwise. */ +OPENSSL_EXPORT int BIO_free(BIO *bio); + +/* BIO_vfree performs the same actions as |BIO_free|, but has a void return + * value. This is provided for API-compat. + * + * TODO(fork): remove. */ +OPENSSL_EXPORT void BIO_vfree(BIO *bio); + +/* BIO_up_ref increments the reference count of |bio| and returns it. */ +OPENSSL_EXPORT BIO *BIO_up_ref(BIO *bio); + + +/* Basic I/O. */ + +/* BIO_read attempts to read |len| bytes into |data|. It returns the number of + * bytes read, zero on EOF, or a negative number on error. */ +OPENSSL_EXPORT int BIO_read(BIO *bio, void *data, int len); + +/* BIO_gets "reads a line" from |bio| and puts at most |size| bytes into |buf|. + * It returns the number of bytes read or a negative number on error. The + * phrase "reads a line" is in quotes in the previous sentence because the + * exact operation depends on the BIO's method. For example, a digest BIO will + * return the digest in response to a |BIO_gets| call. + * + * TODO(fork): audit the set of BIOs that we end up needing. If all actually + * return a line for this call, remove the warning above. */ +OPENSSL_EXPORT int BIO_gets(BIO *bio, char *buf, int size); + +/* BIO_write writes |len| bytes from |data| to BIO. It returns the number of + * bytes written or a negative number on error. */ +OPENSSL_EXPORT int BIO_write(BIO *bio, const void *data, int len); + +/* BIO_puts writes a NUL terminated string from |buf| to |bio|. It returns the + * number of bytes written or a negative number on error. */ +OPENSSL_EXPORT int BIO_puts(BIO *bio, const char *buf); + +/* BIO_flush flushes any buffered output. It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int BIO_flush(BIO *bio); + + +/* Low-level control functions. + * + * These are generic functions for sending control requests to a BIO. In + * general one should use the wrapper functions like |BIO_get_close|. */ + +/* BIO_ctrl sends the control request |cmd| to |bio|. The |cmd| argument should + * be one of the |BIO_C_*| values. */ +OPENSSL_EXPORT long BIO_ctrl(BIO *bio, int cmd, long larg, void *parg); + +/* BIO_ptr_ctrl acts like |BIO_ctrl| but passes the address of a |void*| + * pointer as |parg| and returns the value that is written to it, or NULL if + * the control request returns <= 0. */ +OPENSSL_EXPORT char *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); + +/* BIO_int_ctrl acts like |BIO_ctrl| but passes the address of a copy of |iarg| + * as |parg|. */ +OPENSSL_EXPORT long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); + +/* BIO_reset resets |bio| to its initial state, the precise meaning of which + * depends on the concrete type of |bio|. It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int BIO_reset(BIO *bio); + +/* BIO_set_flags ORs |flags| with |bio->flags|. */ +OPENSSL_EXPORT void BIO_set_flags(BIO *bio, int flags); + +/* BIO_test_flags returns |bio->flags| AND |flags|. */ +OPENSSL_EXPORT int BIO_test_flags(const BIO *bio, int flags); + +/* BIO_should_read returns non-zero if |bio| encountered a temporary error + * while reading (i.e. EAGAIN), indicating that the caller should retry the + * read. */ +OPENSSL_EXPORT int BIO_should_read(const BIO *bio); + +/* BIO_should_write returns non-zero if |bio| encountered a temporary error + * while writing (i.e. EAGAIN), indicating that the caller should retry the + * write. */ +OPENSSL_EXPORT int BIO_should_write(const BIO *bio); + +/* BIO_should_retry returns non-zero if the reason that caused a failed I/O + * operation is temporary and thus the operation should be retried. Otherwise, + * it was a permanent error and it returns zero. */ +OPENSSL_EXPORT int BIO_should_retry(const BIO *bio); + +/* BIO_should_io_special returns non-zero if |bio| encountered a temporary + * error while performing a special I/O operation, indicating that the caller + * should retry. The operation that caused the error is returned by + * |BIO_get_retry_reason|. */ +OPENSSL_EXPORT int BIO_should_io_special(const BIO *bio); + +/* BIO_RR_SSL_X509_LOOKUP indicates that an SSL BIO blocked because the SSL + * library returned with SSL_ERROR_WANT_X509_LOOKUP. + * + * TODO(fork): remove. */ +#define BIO_RR_SSL_X509_LOOKUP 0x01 + +/* BIO_RR_CONNECT indicates that a connect would have blocked */ +#define BIO_RR_CONNECT 0x02 + +/* BIO_RR_ACCEPT indicates that an accept would have blocked */ +#define BIO_RR_ACCEPT 0x03 + +/* BIO_RR_SSL_CHANNEL_ID_LOOKUP indicates that the ChannelID code cannot find + * a private key for a TLS connection. */ +#define BIO_RR_SSL_CHANNEL_ID_LOOKUP 0x04 + +/* BIO_get_retry_reason returns the special I/O operation that needs to be + * retried. The return value is one of the |BIO_RR_*| values. */ +OPENSSL_EXPORT int BIO_get_retry_reason(const BIO *bio); + +/* BIO_clear_flags ANDs |bio->flags| with the bitwise-complement of |flags|. */ +OPENSSL_EXPORT void BIO_clear_flags(BIO *bio, int flags); + +/* BIO_set_retry_read sets the |BIO_FLAGS_READ| and |BIO_FLAGS_SHOULD_RETRY| + * flags on |bio|. */ +OPENSSL_EXPORT void BIO_set_retry_read(BIO *bio); + +/* BIO_set_retry_read sets the |BIO_FLAGS_WRITE| and |BIO_FLAGS_SHOULD_RETRY| + * flags on |bio|. */ +OPENSSL_EXPORT void BIO_set_retry_write(BIO *bio); + +/* BIO_get_retry_flags gets the |BIO_FLAGS_READ|, |BIO_FLAGS_WRITE|, + * |BIO_FLAGS_IO_SPECIAL| and |BIO_FLAGS_SHOULD_RETRY| flags from |bio|. */ +OPENSSL_EXPORT int BIO_get_retry_flags(BIO *bio); + +/* BIO_clear_retry_flags clears the |BIO_FLAGS_READ|, |BIO_FLAGS_WRITE|, + * |BIO_FLAGS_IO_SPECIAL| and |BIO_FLAGS_SHOULD_RETRY| flags from |bio|. */ +OPENSSL_EXPORT void BIO_clear_retry_flags(BIO *bio); + +/* BIO_method_type returns the type of |bio|, which is one of the |BIO_TYPE_*| + * values. */ +OPENSSL_EXPORT int BIO_method_type(const BIO *bio); + +/* bio_info_cb is the type of a callback function that can be called for most + * BIO operations. The |event| argument is one of |BIO_CB_*| and can be ORed + * with |BIO_CB_RETURN| if the callback is being made after the operation in + * question. In that case, |return_value| will contain the return value from + * the operation. */ +typedef long (*bio_info_cb)(BIO *bio, int event, const char *parg, int cmd, + long larg, long return_value); + +/* BIO_callback_ctrl allows the callback function to be manipulated. The |cmd| + * arg will generally be |BIO_CTRL_SET_CALLBACK| but arbitary command values + * can be interpreted by the |BIO|. */ +OPENSSL_EXPORT long BIO_callback_ctrl(BIO *bio, int cmd, bio_info_cb fp); + +/* BIO_pending returns the number of bytes pending to be read. */ +OPENSSL_EXPORT size_t BIO_pending(const BIO *bio); + +/* BIO_ctrl_pending calls |BIO_pending| and exists only for compatibility with + * OpenSSL. */ +OPENSSL_EXPORT size_t BIO_ctrl_pending(const BIO *bio); + +/* BIO_wpending returns the number of bytes pending to be written. */ +OPENSSL_EXPORT size_t BIO_wpending(const BIO *bio); + +/* BIO_set_close sets the close flag for |bio|. The meaning of which depends on + * the type of |bio| but, for example, a memory BIO interprets the close flag + * as meaning that it owns its buffer. It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int BIO_set_close(BIO *bio, int close_flag); + +/* BIO_set_callback sets a callback function that will be called before and + * after most operations. See the comment above |bio_info_cb|. */ +OPENSSL_EXPORT void BIO_set_callback(BIO *bio, bio_info_cb callback_func); + +/* BIO_set_callback_arg sets the opaque pointer value that can be read within a + * callback with |BIO_get_callback_arg|. */ +OPENSSL_EXPORT void BIO_set_callback_arg(BIO *bio, char *arg); + +/* BIO_get_callback_arg returns the last value of the opaque callback pointer + * set by |BIO_set_callback_arg|. */ +OPENSSL_EXPORT char *BIO_get_callback_arg(const BIO *bio); + +/* BIO_number_read returns the number of bytes that have been read from + * |bio|. */ +OPENSSL_EXPORT size_t BIO_number_read(const BIO *bio); + +/* BIO_number_written returns the number of bytes that have been written to + * |bio|. */ +OPENSSL_EXPORT size_t BIO_number_written(const BIO *bio); + + +/* Managing chains of BIOs. + * + * BIOs can be put into chains where the output of one is used as the input of + * the next etc. The most common case is a buffering BIO, which accepts and + * buffers writes until flushed into the next BIO in the chain. */ + +/* BIO_push adds |appended_bio| to the end of the chain with |bio| at the head. + * It returns |bio|. Note that |appended_bio| may be the head of a chain itself + * and thus this function can be used to join two chains. + * + * BIO_push takes ownership of the caller's reference to |appended_bio|. */ +OPENSSL_EXPORT BIO *BIO_push(BIO *bio, BIO *appended_bio); + +/* BIO_pop removes |bio| from the head of a chain and returns the next BIO in + * the chain, or NULL if there is no next BIO. + * + * The caller takes ownership of the chain's reference to |bio|. */ +OPENSSL_EXPORT BIO *BIO_pop(BIO *bio); + +/* BIO_next returns the next BIO in the chain after |bio|, or NULL if there is + * no such BIO. */ +OPENSSL_EXPORT BIO *BIO_next(BIO *bio); + +/* BIO_free_all calls |BIO_free|. + * + * TODO(fork): update callers and remove. */ +OPENSSL_EXPORT void BIO_free_all(BIO *bio); + +/* BIO_find_type walks a chain of BIOs and returns the first that matches + * |type|, which is one of the |BIO_TYPE_*| values. */ +OPENSSL_EXPORT BIO *BIO_find_type(BIO *bio, int type); + +/* BIO_copy_next_retry sets the retry flags and |retry_reason| of |bio| from + * the next BIO in the chain. */ +OPENSSL_EXPORT void BIO_copy_next_retry(BIO *bio); + + +/* Printf functions. + * + * These functions are versions of printf functions that output to a BIO rather + * than a FILE. */ +#ifdef __GNUC__ +#define __bio_h__attr__ __attribute__ +#else +#define __bio_h__attr__(x) +#endif +OPENSSL_EXPORT int BIO_printf(BIO *bio, const char *format, ...) + __bio_h__attr__((__format__(__printf__, 2, 3))); +#undef __bio_h__attr__ + + +/* Utility functions. */ + +/* BIO_indent prints min(|indent|, |max_indent|) spaces. It returns one on + * success and zero otherwise. */ +OPENSSL_EXPORT int BIO_indent(BIO *bio, unsigned indent, unsigned max_indent); + +/* BIO_hexdump writes a hex dump of |data| to |bio|. Each line will be indented + * by |indent| spaces. */ +OPENSSL_EXPORT int BIO_hexdump(BIO *bio, const uint8_t *data, size_t len, + unsigned indent); + +/* BIO_print_errors prints the current contents of the error stack to |bio| + * using human readable strings where possible. */ +OPENSSL_EXPORT void BIO_print_errors(BIO *bio); + +/* BIO_read_asn1 reads a single ASN.1 object from |bio|. If successful it sets + * |*out| to be an allocated buffer (that should be freed with |OPENSSL_free|), + * |*out_size| to the length, in bytes, of that buffer and returns one. + * Otherwise it returns zero. + * + * If the length of the object is greater than |max_len| or 2^32 then the + * function will fail. Long-form tags are not supported. If the length of the + * object is indefinite the full contents of |bio| are read, unless it would be + * greater than |max_len|, in which case the function fails. + * + * If the function fails then some unknown amount of data may have been read + * from |bio|. */ +OPENSSL_EXPORT int BIO_read_asn1(BIO *bio, uint8_t **out, size_t *out_len, + size_t max_len); + + +/* Memory BIOs. + * + * Memory BIOs can be used as a read-only source (with |BIO_new_mem_buf|) or a + * writable sink (with |BIO_new|, |BIO_s_mem| and |BIO_get_mem_buf|). Data + * written to a writable, memory BIO can be recalled by reading from it. + * + * Calling |BIO_reset| on a read-only BIO resets it to the original contents. + * On a writable BIO, it clears any data. + * + * If the close flag is set to |BIO_NOCLOSE| (not the default) then the + * underlying |BUF_MEM| will not be freed when the |BIO| is freed. + * + * Memory BIOs support |BIO_gets| and |BIO_puts|. + * + * |BIO_eof| is true if no data is in the BIO. + * + * |BIO_ctrl_pending| returns the number of bytes currently stored. */ + +/* BIO_s_mem returns a |BIO_METHOD| that uses a in-memory buffer. */ +OPENSSL_EXPORT const BIO_METHOD *BIO_s_mem(void); + +/* BIO_new_mem_buf creates BIO that reads and writes from |len| bytes at |buf|. + * It does not take ownership of |buf|. It returns the BIO or NULL on error. + * + * If |len| is negative, then |buf| is treated as a NUL-terminated string, but + * don't depend on this in new code. */ +OPENSSL_EXPORT BIO *BIO_new_mem_buf(void *buf, int len); + +/* BIO_mem_contents sets |*out_contents| to point to the current contents of + * |bio| and |*out_len| to contain the length of that data. It returns one on + * success and zero otherwise. */ +OPENSSL_EXPORT int BIO_mem_contents(const BIO *bio, + const uint8_t **out_contents, + size_t *out_len); + +/* BIO_get_mem_data sets |*contents| to point to the current contents of |bio| + * and returns the length of the data. + * + * WARNING: don't use this, use |BIO_mem_contents|. A return value of zero from + * this function can mean either that it failed or that the memory buffer is + * empty. */ +OPENSSL_EXPORT long BIO_get_mem_data(BIO *bio, char **contents); + +/* BIO_get_mem_ptr sets |*out| to a BUF_MEM containing the current contents of + * |bio|. It returns one on success or zero on error. */ +OPENSSL_EXPORT int BIO_get_mem_ptr(BIO *bio, BUF_MEM **out); + +/* BIO_set_mem_buf sets |b| as the contents of |bio|. If |take_ownership| is + * non-zero, then |b| will be freed when |bio| is closed. Returns one on + * success or zero otherwise. */ +OPENSSL_EXPORT int BIO_set_mem_buf(BIO *bio, BUF_MEM *b, int take_ownership); + +/* BIO_set_mem_eof_return sets the value that will be returned from reading + * |bio| when empty. If |eof_value| is zero then an empty memory BIO will + * return EOF (that is it will return zero and |BIO_should_retry| will be + * false). If |eof_value| is non zero then it will return |eof_value| when it + * is empty and it will set the read retry flag (that is |BIO_read_retry| is + * true). To avoid ambiguity with a normal positive return value, |eof_value| + * should be set to a negative value, typically -1. + * + * For a read-only BIO, the default is zero (EOF). For a writable BIO, the + * default is -1 so that additional data can be written once exhausted. */ +OPENSSL_EXPORT int BIO_set_mem_eof_return(BIO *bio, int eof_value); + + +/* File descriptor BIOs. + * + * File descriptor BIOs are wrappers around the system's |read| and |write| + * functions. If the close flag is set then then |close| is called on the + * underlying file descriptor when the BIO is freed. + * + * |BIO_reset| attempts to seek the file pointer to the start of file using + * |lseek|. + * + * |BIO_seek| sets the file pointer to position |off| from start of file using + * |lseek|. + * + * |BIO_tell| returns the current file position. */ + +/* BIO_s_fd returns a |BIO_METHOD| for file descriptor fds. */ +OPENSSL_EXPORT const BIO_METHOD *BIO_s_fd(void); + +/* BIO_new_fd creates a new file descriptor BIO wrapping |fd|. If |close_flag| + * is non-zero, then |fd| will be closed when the BIO is. */ +OPENSSL_EXPORT BIO *BIO_new_fd(int fd, int close_flag); + +/* BIO_set_fd sets the file descriptor of |bio| to |fd|. If |close_flag| is + * non-zero then |fd| will be closed when |bio| is. It returns one on success + * or zero on error. */ +OPENSSL_EXPORT int BIO_set_fd(BIO *bio, int fd, int close_flag); + +/* BIO_get_fd sets |*out_fd| to the file descriptor currently in use by |bio|. + * It returns one on success and zero on error. */ +OPENSSL_EXPORT int BIO_get_fd(BIO *bio, int *out_fd); + + +/* File BIOs. + * + * File BIOs are wrappers around a C |FILE| object. + * + * |BIO_flush| on a file BIO calls |fflush| on the wrapped stream. + * + * |BIO_reset| attempts to seek the file pointer to the start of file using + * |fseek|. + * + * |BIO_seek| sets the file pointer to the given position from the start of + * file using |fseek|. + * + * |BIO_eof| calls |feof|. + * + * Setting the close flag causes |fclose| to be called on the stream when the + * BIO is freed. */ + +/* BIO_s_file returns a BIO_METHOD that wraps a |FILE|. */ +OPENSSL_EXPORT const BIO_METHOD *BIO_s_file(void); + +/* BIO_new_file creates a file BIO by opening |filename| with the given mode. + * See the |fopen| manual page for details of the mode argument. */ +OPENSSL_EXPORT BIO *BIO_new_file(const char *filename, const char *mode); + +/* BIO_new_fp creates a new file BIO that wraps the given |FILE|. If + * |close_flag| is |BIO_CLOSE|, then |fclose| will be called on |stream| when + * the BIO is closed. */ +OPENSSL_EXPORT BIO *BIO_new_fp(FILE *stream, int close_flag); + +/* BIO_get_fp sets |*out_file| to the current |FILE| for |bio|. It returns one + * on success and zero otherwise. */ +OPENSSL_EXPORT int BIO_get_fp(BIO *bio, FILE **out_file); + +/* BIO_set_fp sets the |FILE| for |bio|. If |close_flag| is |BIO_CLOSE| then + * |fclose| will be called on |file| when |bio| is closed. It returns one on + * sucess and zero otherwise. */ +OPENSSL_EXPORT int BIO_set_fp(BIO *bio, FILE *file, int close_flag); + +/* BIO_read_filename opens |filename| for reading and sets the result as the + * |FILE| for |bio|. It returns one on success and zero otherwise. The |FILE| + * will be closed when |bio| is freed. */ +OPENSSL_EXPORT int BIO_read_filename(BIO *bio, const char *filename); + +/* BIO_write_filename opens |filename| for writing and sets the result as the + * |FILE| for |bio|. It returns one on success and zero otherwise. The |FILE| + * will be closed when |bio| is freed. */ +OPENSSL_EXPORT int BIO_write_filename(BIO *bio, const char *filename); + +/* BIO_append_filename opens |filename| for appending and sets the result as + * the |FILE| for |bio|. It returns one on success and zero otherwise. The + * |FILE| will be closed when |bio| is freed. */ +OPENSSL_EXPORT int BIO_append_filename(BIO *bio, const char *filename); + +/* BIO_rw_filename opens |filename| for reading and writing and sets the result + * as the |FILE| for |bio|. It returns one on success and zero otherwise. The + * |FILE| will be closed when |bio| is freed. */ +OPENSSL_EXPORT int BIO_rw_filename(BIO *bio, const char *filename); + + +/* Buffer BIOs. + * + * Buffer BIOs are a filter-type BIO, i.e. they are designed to be used in a + * chain of BIOs. They provide buffering to reduce the number of operations on + * the underlying BIOs. */ + +OPENSSL_EXPORT const BIO_METHOD *BIO_f_buffer(void); + +/* BIO_set_read_buffer_size sets the size, in bytes, of the read buffer and + * clears it. It returns one on success and zero on failure. */ +OPENSSL_EXPORT int BIO_set_read_buffer_size(BIO *bio, int buffer_size); + +/* BIO_set_write_buffer_size sets the size, in bytes, of the write buffer and + * clears it. It returns one on success and zero on failure. */ +OPENSSL_EXPORT int BIO_set_write_buffer_size(BIO *bio, int buffer_size); + + +/* Socket BIOs. */ + +OPENSSL_EXPORT const BIO_METHOD *BIO_s_socket(void); + +/* BIO_new_socket allocates and initialises a fresh BIO which will read and + * write to the socket |fd|. If |close_flag| is |BIO_CLOSE| then closing the + * BIO will close |fd|. It returns the fresh |BIO| or NULL on error. */ +OPENSSL_EXPORT BIO *BIO_new_socket(int fd, int close_flag); + + +/* Connect BIOs. + * + * A connection BIO creates a network connection and transfers data over the + * resulting socket. */ + +OPENSSL_EXPORT const BIO_METHOD *BIO_s_connect(void); + +/* BIO_new_connect returns a BIO that connects to the given hostname and port. + * The |host_and_optional_port| argument should be of the form + * "www.example.com" or "www.example.com:443". If the port is omitted, it must + * be provided with |BIO_set_conn_port|. + * + * It returns the new BIO on success, or NULL on error. */ +OPENSSL_EXPORT BIO *BIO_new_connect(const char *host_and_optional_port); + +/* BIO_set_conn_hostname sets |host_and_optional_port| as the hostname and + * optional port that |bio| will connect to. If the port is omitted, it must be + * provided with |BIO_set_conn_port|. + * + * It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int BIO_set_conn_hostname(BIO *bio, + const char *host_and_optional_port); + +/* BIO_set_conn_port sets |port_str| as the port or service name that |bio| + * will connect to. It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int BIO_set_conn_port(BIO *bio, const char *port_str); + +/* BIO_set_nbio sets whether |bio| will use non-blocking I/O operations. It + * returns one on success and zero otherwise. */ +OPENSSL_EXPORT int BIO_set_nbio(BIO *bio, int on); + + +/* Datagram BIOs. + * + * TODO(fork): not implemented. */ + +#define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU */ + +#define BIO_CTRL_DGRAM_SET_MTU 42 /* set cached value for MTU. want to use + this if asking the kernel fails */ + +#define BIO_CTRL_DGRAM_MTU_EXCEEDED 43 /* check whether the MTU was exceed in + the previous write operation. */ + +#define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT \ + 45 /* Next DTLS handshake timeout to adjust socket timeouts */ + +#define BIO_CTRL_DGRAM_GET_PEER 46 + +#define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 + + +/* BIO Pairs. + * + * BIO pairs provide a "loopback" like system: a pair of BIOs where data + * written to one can be read from the other and vice versa. */ + +/* BIO_new_bio_pair sets |*out1| and |*out2| to two freshly created BIOs where + * data written to one can be read from the other and vice versa. The + * |writebuf1| argument gives the size of the buffer used in |*out1| and + * |writebuf2| for |*out2|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int BIO_new_bio_pair(BIO **out1, size_t writebuf1, BIO **out2, + size_t writebuf2); + +/* BIO_new_bio_pair_external_buf is the same as |BIO_new_bio_pair| with the + * difference that the caller keeps ownership of the write buffers + * |ext_writebuf1_len| and |ext_writebuf2_len|. This is useful when using zero + * copy API for read and write operations, in cases where the buffers need to + * outlive the BIO pairs. It returns one on success and zero on error. */ +OPENSSL_EXPORT int BIO_new_bio_pair_external_buf(BIO** bio1_p, + size_t writebuf1_len, + uint8_t* ext_writebuf1, + BIO** bio2_p, + size_t writebuf2_len, + uint8_t* ext_writebuf2); + +/* BIO_ctrl_get_read_request returns the number of bytes that the other side of + * |bio| tried (unsuccessfully) to read. */ +OPENSSL_EXPORT size_t BIO_ctrl_get_read_request(BIO *bio); + +/* BIO_ctrl_get_write_guarantee returns the number of bytes that |bio| (which + * must have been returned by |BIO_new_bio_pair|) will accept on the next + * |BIO_write| call. */ +OPENSSL_EXPORT size_t BIO_ctrl_get_write_guarantee(BIO *bio); + +/* BIO_shutdown_wr marks |bio| as closed, from the point of view of the other + * side of the pair. Future |BIO_write| calls on |bio| will fail. It returns + * one on success and zero otherwise. */ +OPENSSL_EXPORT int BIO_shutdown_wr(BIO *bio); + + +/* Zero copy versions of BIO_read and BIO_write for BIO pairs. */ + +/* BIO_zero_copy_get_read_buf initiates a zero copy read operation. + * |out_read_buf| is set to the internal read buffer, and |out_buf_offset| is + * set to the current read position of |out_read_buf|. The number of bytes + * available for read from |out_read_buf| + |out_buf_offset| is returned in + * |out_available_bytes|. Note that this function might report fewer bytes + * available than |BIO_pending|, if the internal ring buffer is wrapped. It + * returns one on success. In case of error it returns zero and pushes to the + * error stack. + * + * The zero copy read operation is completed by calling + * |BIO_zero_copy_get_read_buf_done|. Neither |BIO_zero_copy_get_read_buf| nor + * any other I/O read operation may be called while a zero copy read operation + * is active. */ +OPENSSL_EXPORT int BIO_zero_copy_get_read_buf(BIO* bio, + uint8_t** out_read_buf, + size_t* out_buf_offset, + size_t* out_available_bytes); + +/* BIO_zero_copy_get_read_buf_done must be called after reading from a BIO using + * |BIO_zero_copy_get_read_buf| to finish the read operation. The |bytes_read| + * argument is the number of bytes read. + * + * It returns one on success. In case of error it returns zero and pushes to the + * error stack. */ +OPENSSL_EXPORT int BIO_zero_copy_get_read_buf_done(BIO* bio, size_t bytes_read); + +/* BIO_zero_copy_get_write_buf_done initiates a zero copy write operation. + * |out_write_buf| is set to to the internal write buffer, and |out_buf_offset| + * is set to the current write position of |out_write_buf|. + * The number of bytes available for write from |out_write_buf| + + * |out_buf_offset| is returned in |out_available_bytes|. Note that this + * function might report fewer bytes available than + * |BIO_ctrl_get_write_guarantee|, if the internal buffer is wrapped. It returns + * one on success. In case of error it returns zero and pushes to the error + * stack. + * + * The zero copy write operation is completed by calling + * |BIO_zero_copy_write_buf_done|. Neither |BIO_zero_copy_get_write_buf| + * nor any other I/O write operation may be called while a zero copy write + * operation is active. */ +OPENSSL_EXPORT int BIO_zero_copy_get_write_buf(BIO* bio, + uint8_t** out_write_buf, + size_t* out_buf_offset, + size_t* out_available_bytes); + +/* BIO_zero_copy_write_buf_done must be called after writing to a BIO using + * |BIO_zero_copy_get_write_buf_done| to finish the write operation. The + * |bytes_written| argument gives the number of bytes written. + * + * It returns one on success. In case of error it returns zero and pushes to the + * error stack. */ +OPENSSL_EXPORT int BIO_zero_copy_get_write_buf_done(BIO* bio, + size_t bytes_written); + + +/* BIO_NOCLOSE and |BIO_CLOSE| can be used as symbolic arguments when a "close + * flag" is passed to a BIO function. */ +#define BIO_NOCLOSE 0 +#define BIO_CLOSE 1 + +/* These are passed to the BIO callback */ +#define BIO_CB_FREE 0x01 +#define BIO_CB_READ 0x02 +#define BIO_CB_WRITE 0x03 +#define BIO_CB_PUTS 0x04 +#define BIO_CB_GETS 0x05 +#define BIO_CB_CTRL 0x06 + +/* The callback is called before and after the underling operation, + * The BIO_CB_RETURN flag indicates if it is after the call */ +#define BIO_CB_RETURN 0x80 + +/* These are values of the |cmd| argument to |BIO_ctrl|. */ +#define BIO_CTRL_RESET 1 /* opt - rewind/zero etc */ +#define BIO_CTRL_EOF 2 /* opt - are we at the eof */ +#define BIO_CTRL_INFO 3 /* opt - extra tit-bits */ +#define BIO_CTRL_SET 4 /* man - set the 'IO' type */ +#define BIO_CTRL_GET 5 /* man - get the 'IO' type */ +#define BIO_CTRL_GET_CLOSE 8 /* man - set the 'close' on free */ +#define BIO_CTRL_SET_CLOSE 9 /* man - set the 'close' on free */ +#define BIO_CTRL_PENDING 10 /* opt - is their more data buffered */ +#define BIO_CTRL_FLUSH 11 /* opt - 'flush' buffered output */ +#define BIO_CTRL_WPENDING 13 /* opt - number of bytes still to write */ +/* callback is int cb(BIO *bio,state,ret); */ +#define BIO_CTRL_SET_CALLBACK 14 /* opt - set callback function */ +#define BIO_CTRL_GET_CALLBACK 15 /* opt - set callback function */ +#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ + + +/* Android compatibility section. + * + * A previous version of BoringSSL used in Android renamed ERR_print_errors_fp + * to BIO_print_errors_fp. It has subsequently been renamed back to + * ERR_print_errors_fp. */ +#define BIO_print_errors_fp ERR_print_errors_fp + + +/* Private functions */ + +#define BIO_FLAGS_READ 0x01 +#define BIO_FLAGS_WRITE 0x02 +#define BIO_FLAGS_IO_SPECIAL 0x04 +#define BIO_FLAGS_RWS (BIO_FLAGS_READ | BIO_FLAGS_WRITE | BIO_FLAGS_IO_SPECIAL) +#define BIO_FLAGS_SHOULD_RETRY 0x08 +#define BIO_FLAGS_BASE64_NO_NL 0x100 +/* This is used with memory BIOs: it means we shouldn't free up or change the + * data in any way. */ +#define BIO_FLAGS_MEM_RDONLY 0x200 + +/* These are the 'types' of BIOs */ +#define BIO_TYPE_NONE 0 +#define BIO_TYPE_MEM (1 | 0x0400) +#define BIO_TYPE_FILE (2 | 0x0400) +#define BIO_TYPE_FD (4 | 0x0400 | 0x0100) +#define BIO_TYPE_SOCKET (5 | 0x0400 | 0x0100) +#define BIO_TYPE_NULL (6 | 0x0400) +#define BIO_TYPE_SSL (7 | 0x0200) +#define BIO_TYPE_MD (8 | 0x0200) /* passive filter */ +#define BIO_TYPE_BUFFER (9 | 0x0200) /* filter */ +#define BIO_TYPE_CIPHER (10 | 0x0200) /* filter */ +#define BIO_TYPE_BASE64 (11 | 0x0200) /* filter */ +#define BIO_TYPE_CONNECT (12 | 0x0400 | 0x0100) /* socket - connect */ +#define BIO_TYPE_ACCEPT (13 | 0x0400 | 0x0100) /* socket for accept */ +#define BIO_TYPE_PROXY_CLIENT (14 | 0x0200) /* client proxy BIO */ +#define BIO_TYPE_PROXY_SERVER (15 | 0x0200) /* server proxy BIO */ +#define BIO_TYPE_NBIO_TEST (16 | 0x0200) /* server proxy BIO */ +#define BIO_TYPE_NULL_FILTER (17 | 0x0200) +#define BIO_TYPE_BER (18 | 0x0200) /* BER -> bin filter */ +#define BIO_TYPE_BIO (19 | 0x0400) /* (half a) BIO pair */ +#define BIO_TYPE_LINEBUFFER (20 | 0x0200) /* filter */ +#define BIO_TYPE_DGRAM (21 | 0x0400 | 0x0100) +#define BIO_TYPE_ASN1 (22 | 0x0200) /* filter */ +#define BIO_TYPE_COMP (23 | 0x0200) /* filter */ + +#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ +#define BIO_TYPE_FILTER 0x0200 +#define BIO_TYPE_SOURCE_SINK 0x0400 + +struct bio_method_st { + int type; + const char *name; + int (*bwrite)(BIO *, const char *, int); + int (*bread)(BIO *, char *, int); + /* TODO(fork): remove bputs. */ + int (*bputs)(BIO *, const char *); + int (*bgets)(BIO *, char *, int); + long (*ctrl)(BIO *, int, long, void *); + int (*create)(BIO *); + int (*destroy)(BIO *); + long (*callback_ctrl)(BIO *, int, bio_info_cb); +}; + +struct bio_st { + const BIO_METHOD *method; + /* bio, mode, argp, argi, argl, ret */ + long (*callback)(struct bio_st *, int, const char *, int, long, long); + char *cb_arg; /* first argument for the callback */ + + /* init is non-zero if this |BIO| has been initialised. */ + int init; + /* shutdown is often used by specific |BIO_METHOD|s to determine whether + * they own some underlying resource. This flag can often by controlled by + * |BIO_set_close|. For example, whether an fd BIO closes the underlying fd + * when it, itself, is closed. */ + int shutdown; + int flags; + int retry_reason; + /* num is a BIO-specific value. For example, in fd BIOs it's used to store a + * file descriptor. */ + int num; + CRYPTO_refcount_t references; + void *ptr; + /* next_bio points to the next |BIO| in a chain. This |BIO| owns a reference + * to |next_bio|. */ + struct bio_st *next_bio; /* used by filter BIOs */ + size_t num_read, num_write; +}; + +#define BIO_C_SET_CONNECT 100 +#define BIO_C_DO_STATE_MACHINE 101 +#define BIO_C_SET_NBIO 102 +#define BIO_C_SET_PROXY_PARAM 103 +#define BIO_C_SET_FD 104 +#define BIO_C_GET_FD 105 +#define BIO_C_SET_FILE_PTR 106 +#define BIO_C_GET_FILE_PTR 107 +#define BIO_C_SET_FILENAME 108 +#define BIO_C_SET_SSL 109 +#define BIO_C_GET_SSL 110 +#define BIO_C_SET_MD 111 +#define BIO_C_GET_MD 112 +#define BIO_C_GET_CIPHER_STATUS 113 +#define BIO_C_SET_BUF_MEM 114 +#define BIO_C_GET_BUF_MEM_PTR 115 +#define BIO_C_GET_BUFF_NUM_LINES 116 +#define BIO_C_SET_BUFF_SIZE 117 +#define BIO_C_SET_ACCEPT 118 +#define BIO_C_SSL_MODE 119 +#define BIO_C_GET_MD_CTX 120 +#define BIO_C_GET_PROXY_PARAM 121 +#define BIO_C_SET_BUFF_READ_DATA 122 /* data to read first */ +#define BIO_C_GET_CONNECT 123 +#define BIO_C_GET_ACCEPT 124 +#define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 +#define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 +#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 +#define BIO_C_FILE_SEEK 128 +#define BIO_C_GET_CIPHER_CTX 129 +#define BIO_C_SET_BUF_MEM_EOF_RETURN 130/*return end of input value*/ +#define BIO_C_SET_BIND_MODE 131 +#define BIO_C_GET_BIND_MODE 132 +#define BIO_C_FILE_TELL 133 +#define BIO_C_GET_SOCKS 134 +#define BIO_C_SET_SOCKS 135 + +#define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ +#define BIO_C_GET_WRITE_BUF_SIZE 137 +#define BIO_C_GET_WRITE_GUARANTEE 140 +#define BIO_C_GET_READ_REQUEST 141 +#define BIO_C_SHUTDOWN_WR 142 +#define BIO_C_NREAD0 143 +#define BIO_C_NREAD 144 +#define BIO_C_NWRITE0 145 +#define BIO_C_NWRITE 146 +#define BIO_C_RESET_READ_REQUEST 147 +#define BIO_C_SET_MD_CTX 148 + +#define BIO_C_SET_PREFIX 149 +#define BIO_C_GET_PREFIX 150 +#define BIO_C_SET_SUFFIX 151 +#define BIO_C_GET_SUFFIX 152 + +#define BIO_C_SET_EX_ARG 153 +#define BIO_C_GET_EX_ARG 154 + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define BIO_F_BIO_callback_ctrl 100 +#define BIO_F_BIO_ctrl 101 +#define BIO_F_BIO_new 102 +#define BIO_F_BIO_new_file 103 +#define BIO_F_BIO_new_mem_buf 104 +#define BIO_F_BIO_zero_copy_get_read_buf 105 +#define BIO_F_BIO_zero_copy_get_read_buf_done 106 +#define BIO_F_BIO_zero_copy_get_write_buf 107 +#define BIO_F_BIO_zero_copy_get_write_buf_done 108 +#define BIO_F_bio_io 109 +#define BIO_F_bio_make_pair 110 +#define BIO_F_bio_write 111 +#define BIO_F_buffer_ctrl 112 +#define BIO_F_conn_ctrl 113 +#define BIO_F_conn_state 114 +#define BIO_F_file_ctrl 115 +#define BIO_F_file_read 116 +#define BIO_F_mem_write 117 +#define BIO_F_BIO_printf 118 +#define BIO_R_BAD_FOPEN_MODE 100 +#define BIO_R_BROKEN_PIPE 101 +#define BIO_R_CONNECT_ERROR 102 +#define BIO_R_ERROR_SETTING_NBIO 103 +#define BIO_R_INVALID_ARGUMENT 104 +#define BIO_R_IN_USE 105 +#define BIO_R_KEEPALIVE 106 +#define BIO_R_NBIO_CONNECT_ERROR 107 +#define BIO_R_NO_HOSTNAME_SPECIFIED 108 +#define BIO_R_NO_PORT_SPECIFIED 109 +#define BIO_R_NO_SUCH_FILE 110 +#define BIO_R_NULL_PARAMETER 111 +#define BIO_R_SYS_LIB 112 +#define BIO_R_UNABLE_TO_CREATE_SOCKET 113 +#define BIO_R_UNINITIALIZED 114 +#define BIO_R_UNSUPPORTED_METHOD 115 +#define BIO_R_WRITE_TO_READ_ONLY_BIO 116 + +#endif /* OPENSSL_HEADER_BIO_H */ diff --git a/phonelibs/boringssl/include/openssl/blowfish.h b/phonelibs/boringssl/include/openssl/blowfish.h new file mode 100644 index 00000000000000..fa60d5336fcb07 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/blowfish.h @@ -0,0 +1,93 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_BLOWFISH_H +#define OPENSSL_HEADER_BLOWFISH_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#define BF_ENCRYPT 1 +#define BF_DECRYPT 0 + +#define BF_ROUNDS 16 +#define BF_BLOCK 8 + +typedef struct bf_key_st { + uint32_t P[BF_ROUNDS + 2]; + uint32_t S[4 * 256]; +} BF_KEY; + +OPENSSL_EXPORT void BF_set_key(BF_KEY *key, size_t len, const uint8_t *data); +OPENSSL_EXPORT void BF_encrypt(uint32_t *data, const BF_KEY *key); +OPENSSL_EXPORT void BF_decrypt(uint32_t *data, const BF_KEY *key); + +OPENSSL_EXPORT void BF_ecb_encrypt(const uint8_t *in, uint8_t *out, + const BF_KEY *key, int enc); +OPENSSL_EXPORT void BF_cbc_encrypt(const uint8_t *in, uint8_t *out, long length, + const BF_KEY *schedule, uint8_t *ivec, + int enc); + + +#ifdef __cplusplus +} +#endif + +#endif /* OPENSSL_HEADER_BLOWFISH_H */ diff --git a/phonelibs/boringssl/include/openssl/bn.h b/phonelibs/boringssl/include/openssl/bn.h new file mode 100644 index 00000000000000..ec1c8ff5c32d1f --- /dev/null +++ b/phonelibs/boringssl/include/openssl/bn.h @@ -0,0 +1,875 @@ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the Eric Young open source + * license provided above. + * + * The binary polynomial arithmetic software is originally written by + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems + * Laboratories. */ + +#ifndef OPENSSL_HEADER_BN_H +#define OPENSSL_HEADER_BN_H + +#include +#include + +#include /* for PRIu64 and friends */ +#include /* for FILE* */ + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* BN provides support for working with arbitary sized integers. For example, + * although the largest integer supported by the compiler might be 64 bits, BN + * will allow you to work with numbers until you run out of memory. */ + + +/* BN_ULONG is the native word size when working with big integers. + * + * Note: on some platforms, inttypes.h does not define print format macros in + * C++ unless |__STDC_FORMAT_MACROS| defined. As this is a public header, bn.h + * does not define |__STDC_FORMAT_MACROS| itself. C++ source files which use the + * FMT macros must define it externally. */ +#if defined(OPENSSL_64_BIT) +#define BN_ULONG uint64_t +#define BN_BITS2 64 +#define BN_DEC_FMT1 "%" PRIu64 +#define BN_DEC_FMT2 "%019" PRIu64 +#define BN_HEX_FMT1 "%" PRIx64 +#elif defined(OPENSSL_32_BIT) +#define BN_ULONG uint32_t +#define BN_BITS2 32 +#define BN_DEC_FMT1 "%" PRIu32 +#define BN_DEC_FMT2 "%09" PRIu32 +#define BN_HEX_FMT1 "%" PRIx32 +#else +#error "Must define either OPENSSL_32_BIT or OPENSSL_64_BIT" +#endif + + +/* Allocation and freeing. */ + +/* BN_new creates a new, allocated BIGNUM and initialises it. */ +OPENSSL_EXPORT BIGNUM *BN_new(void); + +/* BN_init initialises a stack allocated |BIGNUM|. */ +OPENSSL_EXPORT void BN_init(BIGNUM *bn); + +/* BN_free frees the data referenced by |bn| and, if |bn| was originally + * allocated on the heap, frees |bn| also. */ +OPENSSL_EXPORT void BN_free(BIGNUM *bn); + +/* BN_clear_free erases and frees the data referenced by |bn| and, if |bn| was + * originally allocated on the heap, frees |bn| also. */ +OPENSSL_EXPORT void BN_clear_free(BIGNUM *bn); + +/* BN_dup allocates a new BIGNUM and sets it equal to |src|. It returns the + * allocated BIGNUM on success or NULL otherwise. */ +OPENSSL_EXPORT BIGNUM *BN_dup(const BIGNUM *src); + +/* BN_copy sets |dest| equal to |src| and returns |dest|. */ +OPENSSL_EXPORT BIGNUM *BN_copy(BIGNUM *dest, const BIGNUM *src); + +/* BN_clear sets |bn| to zero and erases the old data. */ +OPENSSL_EXPORT void BN_clear(BIGNUM *bn); + +/* BN_value_one returns a static BIGNUM with value 1. */ +OPENSSL_EXPORT const BIGNUM *BN_value_one(void); + +/* BN_with_flags initialises a stack allocated |BIGNUM| with pointers to the + * contents of |in| but with |flags| ORed into the flags field. + * + * Note: the two BIGNUMs share state and so |out| should /not/ be passed to + * |BN_free|. */ +OPENSSL_EXPORT void BN_with_flags(BIGNUM *out, const BIGNUM *in, int flags); + + +/* Basic functions. */ + +/* BN_num_bits returns the minimum number of bits needed to represent the + * absolute value of |bn|. */ +OPENSSL_EXPORT unsigned BN_num_bits(const BIGNUM *bn); + +/* BN_num_bytes returns the minimum number of bytes needed to represent the + * absolute value of |bn|. */ +OPENSSL_EXPORT unsigned BN_num_bytes(const BIGNUM *bn); + +/* BN_zero sets |bn| to zero. */ +OPENSSL_EXPORT void BN_zero(BIGNUM *bn); + +/* BN_one sets |bn| to one. It returns one on success or zero on allocation + * failure. */ +OPENSSL_EXPORT int BN_one(BIGNUM *bn); + +/* BN_set_word sets |bn| to |value|. It returns one on success or zero on + * allocation failure. */ +OPENSSL_EXPORT int BN_set_word(BIGNUM *bn, BN_ULONG value); + +/* BN_set_negative sets the sign of |bn|. */ +OPENSSL_EXPORT void BN_set_negative(BIGNUM *bn, int sign); + +/* BN_is_negative returns one if |bn| is negative and zero otherwise. */ +OPENSSL_EXPORT int BN_is_negative(const BIGNUM *bn); + +/* BN_get_flags returns |bn->flags| & |flags|. */ +OPENSSL_EXPORT int BN_get_flags(const BIGNUM *bn, int flags); + +/* BN_set_flags sets |flags| on |bn|. */ +OPENSSL_EXPORT void BN_set_flags(BIGNUM *bn, int flags); + + +/* Conversion functions. */ + +/* BN_bin2bn sets |*ret| to the value of |len| bytes from |in|, interpreted as + * a big-endian number, and returns |ret|. If |ret| is NULL then a fresh + * |BIGNUM| is allocated and returned. It returns NULL on allocation + * failure. */ +OPENSSL_EXPORT BIGNUM *BN_bin2bn(const uint8_t *in, size_t len, BIGNUM *ret); + +/* BN_bn2bin serialises the absolute value of |in| to |out| as a big-endian + * integer, which must have |BN_num_bytes| of space available. It returns the + * number of bytes written. */ +OPENSSL_EXPORT size_t BN_bn2bin(const BIGNUM *in, uint8_t *out); + +/* BN_bn2bin_padded serialises the absolute value of |in| to |out| as a + * big-endian integer. The integer is padded with leading zeros up to size + * |len|. If |len| is smaller than |BN_num_bytes|, the function fails and + * returns 0. Otherwise, it returns 1. */ +OPENSSL_EXPORT int BN_bn2bin_padded(uint8_t *out, size_t len, const BIGNUM *in); + +/* BN_bn2hex returns an allocated string that contains a NUL-terminated, hex + * representation of |bn|. If |bn| is negative, the first char in the resulting + * string will be '-'. Returns NULL on allocation failure. */ +OPENSSL_EXPORT char *BN_bn2hex(const BIGNUM *bn); + +/* BN_hex2bn parses the leading hex number from |in|, which may be proceeded by + * a '-' to indicate a negative number and may contain trailing, non-hex data. + * If |outp| is not NULL, it constructs a BIGNUM equal to the hex number and + * stores it in |*outp|. If |*outp| is NULL then it allocates a new BIGNUM and + * updates |*outp|. It returns the number of bytes of |in| processed or zero on + * error. */ +OPENSSL_EXPORT int BN_hex2bn(BIGNUM **outp, const char *in); + +/* BN_bn2dec returns an allocated string that contains a NUL-terminated, + * decimal representation of |bn|. If |bn| is negative, the first char in the + * resulting string will be '-'. Returns NULL on allocation failure. */ +OPENSSL_EXPORT char *BN_bn2dec(const BIGNUM *a); + +/* BN_dec2bn parses the leading decimal number from |in|, which may be + * proceeded by a '-' to indicate a negative number and may contain trailing, + * non-decimal data. If |outp| is not NULL, it constructs a BIGNUM equal to the + * decimal number and stores it in |*outp|. If |*outp| is NULL then it + * allocates a new BIGNUM and updates |*outp|. It returns the number of bytes + * of |in| processed or zero on error. */ +OPENSSL_EXPORT int BN_dec2bn(BIGNUM **outp, const char *in); + +/* BN_asc2bn acts like |BN_dec2bn| or |BN_hex2bn| depending on whether |in| + * begins with "0X" or "0x" (indicating hex) or not (indicating decimal). A + * leading '-' is still permitted and comes before the optional 0X/0x. It + * returns one on success or zero on error. */ +OPENSSL_EXPORT int BN_asc2bn(BIGNUM **outp, const char *in); + +/* BN_print writes a hex encoding of |a| to |bio|. It returns one on success + * and zero on error. */ +OPENSSL_EXPORT int BN_print(BIO *bio, const BIGNUM *a); + +/* BN_print_fp acts like |BIO_print|, but wraps |fp| in a |BIO| first. */ +OPENSSL_EXPORT int BN_print_fp(FILE *fp, const BIGNUM *a); + +/* BN_get_word returns the absolute value of |bn| as a single word. If |bn| is + * too large to be represented as a single word, the maximum possible value + * will be returned. */ +OPENSSL_EXPORT BN_ULONG BN_get_word(const BIGNUM *bn); + + +/* Internal functions. + * + * These functions are useful for code that is doing low-level manipulations of + * BIGNUM values. However, be sure that no other function in this file does + * what you want before turning to these. */ + +/* bn_correct_top decrements |bn->top| until |bn->d[top-1]| is non-zero or + * until |top| is zero. */ +OPENSSL_EXPORT void bn_correct_top(BIGNUM *bn); + +/* bn_wexpand ensures that |bn| has at least |words| works of space without + * altering its value. It returns one on success or zero on allocation + * failure. */ +OPENSSL_EXPORT BIGNUM *bn_wexpand(BIGNUM *bn, unsigned words); + + +/* BIGNUM pools. + * + * Certain BIGNUM operations need to use many temporary variables and + * allocating and freeing them can be quite slow. Thus such opertions typically + * take a |BN_CTX| parameter, which contains a pool of |BIGNUMs|. The |ctx| + * argument to a public function may be NULL, in which case a local |BN_CTX| + * will be created just for the lifetime of that call. + * + * A function must call |BN_CTX_start| first. Then, |BN_CTX_get| may be called + * repeatedly to obtain temporary |BIGNUM|s. All |BN_CTX_get| calls must be made + * before calling any other functions that use the |ctx| as an argument. + * + * Finally, |BN_CTX_end| must be called before returning from the function. + * When |BN_CTX_end| is called, the |BIGNUM| pointers obtained from + * |BN_CTX_get| become invalid. */ + +/* BN_CTX_new returns a new, empty BN_CTX or NULL on allocation failure. */ +OPENSSL_EXPORT BN_CTX *BN_CTX_new(void); + +/* BN_CTX_free frees all BIGNUMs contained in |ctx| and then frees |ctx| + * itself. */ +OPENSSL_EXPORT void BN_CTX_free(BN_CTX *ctx); + +/* BN_CTX_start "pushes" a new entry onto the |ctx| stack and allows future + * calls to |BN_CTX_get|. */ +OPENSSL_EXPORT void BN_CTX_start(BN_CTX *ctx); + +/* BN_CTX_get returns a new |BIGNUM|, or NULL on allocation failure. Once + * |BN_CTX_get| has returned NULL, all future calls will also return NULL until + * |BN_CTX_end| is called. */ +OPENSSL_EXPORT BIGNUM *BN_CTX_get(BN_CTX *ctx); + +/* BN_CTX_end invalidates all |BIGNUM|s returned from |BN_CTX_get| since the + * matching |BN_CTX_start| call. */ +OPENSSL_EXPORT void BN_CTX_end(BN_CTX *ctx); + + +/* Simple arithmetic */ + +/* BN_add sets |r| = |a| + |b|, where |r| may be the same pointer as either |a| + * or |b|. It returns one on success and zero on allocation failure. */ +OPENSSL_EXPORT int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); + +/* BN_uadd sets |r| = |a| + |b|, where |a| and |b| are non-negative and |r| may + * be the same pointer as either |a| or |b|. It returns one on success and zero + * on allocation failure. */ +OPENSSL_EXPORT int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); + +/* BN_add_word adds |w| to |a|. It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int BN_add_word(BIGNUM *a, BN_ULONG w); + +/* BN_sub sets |r| = |a| - |b|, where |r| must be a distinct pointer from |a| + * and |b|. It returns one on success and zero on allocation failure. */ +OPENSSL_EXPORT int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); + +/* BN_usub sets |r| = |a| - |b|, where |a| and |b| are non-negative integers, + * |b| < |a| and |r| must be a distinct pointer from |a| and |b|. It returns + * one on success and zero on allocation failure. */ +OPENSSL_EXPORT int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); + +/* BN_sub_word subtracts |w| from |a|. It returns one on success and zero on + * allocation failure. */ +OPENSSL_EXPORT int BN_sub_word(BIGNUM *a, BN_ULONG w); + +/* BN_mul sets |r| = |a| * |b|, where |r| may be the same pointer as |a| or + * |b|. Returns one on success and zero otherwise. */ +OPENSSL_EXPORT int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx); + +/* BN_mul_word sets |bn| = |bn| * |w|. It returns one on success or zero on + * allocation failure. */ +OPENSSL_EXPORT int BN_mul_word(BIGNUM *bn, BN_ULONG w); + +/* BN_sqr sets |r| = |a|^2 (i.e. squares), where |r| may be the same pointer as + * |a|. Returns one on success and zero otherwise. This is more efficient than + * BN_mul(r, a, a, ctx). */ +OPENSSL_EXPORT int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); + +/* BN_div divides |numerator| by |divisor| and places the result in |quotient| + * and the remainder in |rem|. Either of |quotient| or |rem| may be NULL, in + * which case the respective value is not returned. The result is rounded + * towards zero; thus if |numerator| is negative, the remainder will be zero or + * negative. It returns one on success or zero on error. */ +OPENSSL_EXPORT int BN_div(BIGNUM *quotient, BIGNUM *rem, + const BIGNUM *numerator, const BIGNUM *divisor, + BN_CTX *ctx); + +/* BN_div_word sets |numerator| = |numerator|/|divisor| and returns the + * remainder or (BN_ULONG)-1 on error. */ +OPENSSL_EXPORT BN_ULONG BN_div_word(BIGNUM *numerator, BN_ULONG divisor); + +/* BN_sqrt sets |*out_sqrt| (which may be the same |BIGNUM| as |in|) to the + * square root of |in|, using |ctx|. It returns one on success or zero on + * error. Negative numbers and non-square numbers will result in an error with + * appropriate errors on the error queue. */ +OPENSSL_EXPORT int BN_sqrt(BIGNUM *out_sqrt, const BIGNUM *in, BN_CTX *ctx); + + +/* Comparison functions */ + +/* BN_cmp returns a value less than, equal to or greater than zero if |a| is + * less than, equal to or greater than |b|, respectively. */ +OPENSSL_EXPORT int BN_cmp(const BIGNUM *a, const BIGNUM *b); + +/* BN_ucmp returns a value less than, equal to or greater than zero if the + * absolute value of |a| is less than, equal to or greater than the absolute + * value of |b|, respectively. */ +OPENSSL_EXPORT int BN_ucmp(const BIGNUM *a, const BIGNUM *b); + +/* BN_abs_is_word returns one if the absolute value of |bn| equals |w| and zero + * otherwise. */ +OPENSSL_EXPORT int BN_abs_is_word(const BIGNUM *bn, BN_ULONG w); + +/* BN_is_zero returns one if |bn| is zero and zero otherwise. */ +OPENSSL_EXPORT int BN_is_zero(const BIGNUM *bn); + +/* BN_is_one returns one if |bn| equals one and zero otherwise. */ +OPENSSL_EXPORT int BN_is_one(const BIGNUM *bn); + +/* BN_is_word returns one if |bn| is exactly |w| and zero otherwise. */ +OPENSSL_EXPORT int BN_is_word(const BIGNUM *bn, BN_ULONG w); + +/* BN_is_odd returns one if |bn| is odd and zero otherwise. */ +OPENSSL_EXPORT int BN_is_odd(const BIGNUM *bn); + + +/* Bitwise operations. */ + +/* BN_lshift sets |r| equal to |a| << n. The |a| and |r| arguments may be the + * same |BIGNUM|. It returns one on success and zero on allocation failure. */ +OPENSSL_EXPORT int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); + +/* BN_lshift1 sets |r| equal to |a| << 1, where |r| and |a| may be the same + * pointer. It returns one on success and zero on allocation failure. */ +OPENSSL_EXPORT int BN_lshift1(BIGNUM *r, const BIGNUM *a); + +/* BN_rshift sets |r| equal to |a| >> n, where |r| and |a| may be the same + * pointer. It returns one on success and zero on allocation failure. */ +OPENSSL_EXPORT int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); + +/* BN_rshift1 sets |r| equal to |a| >> 1, where |r| and |a| may be the same + * pointer. It returns one on success and zero on allocation failure. */ +OPENSSL_EXPORT int BN_rshift1(BIGNUM *r, const BIGNUM *a); + +/* BN_set_bit sets the |n|th, least-significant bit in |a|. For example, if |a| + * is 2 then setting bit zero will make it 3. It returns one on success or zero + * on allocation failure. */ +OPENSSL_EXPORT int BN_set_bit(BIGNUM *a, int n); + +/* BN_clear_bit clears the |n|th, least-significant bit in |a|. For example, if + * |a| is 3, clearing bit zero will make it two. It returns one on success or + * zero on allocation failure. */ +OPENSSL_EXPORT int BN_clear_bit(BIGNUM *a, int n); + +/* BN_is_bit_set returns the value of the |n|th, least-significant bit in |a|, + * or zero if the bit doesn't exist. */ +OPENSSL_EXPORT int BN_is_bit_set(const BIGNUM *a, int n); + +/* BN_mask_bits truncates |a| so that it is only |n| bits long. It returns one + * on success or zero if |n| is greater than the length of |a| already. */ +OPENSSL_EXPORT int BN_mask_bits(BIGNUM *a, int n); + + +/* Modulo arithmetic. */ + +/* BN_mod_word returns |a| mod |w|. */ +OPENSSL_EXPORT BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); + +/* BN_mod is a helper macro that calls |BN_div| and discards the quotient. */ +#define BN_mod(rem, numerator, divisor, ctx) \ + BN_div(NULL, (rem), (numerator), (divisor), (ctx)) + +/* BN_nnmod is a non-negative modulo function. It acts like |BN_mod|, but 0 <= + * |rem| < |divisor| is always true. It returns one on success and zero on + * error. */ +OPENSSL_EXPORT int BN_nnmod(BIGNUM *rem, const BIGNUM *numerator, + const BIGNUM *divisor, BN_CTX *ctx); + +/* BN_mod_add sets |r| = |a| + |b| mod |m|. It returns one on success and zero + * on error. */ +OPENSSL_EXPORT int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m, BN_CTX *ctx); + +/* BN_mod_add_quick acts like |BN_mod_add| but requires that |a| and |b| be + * non-negative and less than |m|. */ +OPENSSL_EXPORT int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); + +/* BN_mod_sub sets |r| = |a| - |b| mod |m|. It returns one on success and zero + * on error. */ +OPENSSL_EXPORT int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m, BN_CTX *ctx); + +/* BN_mod_sub_quick acts like |BN_mod_sub| but requires that |a| and |b| be + * non-negative and less than |m|. */ +OPENSSL_EXPORT int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); + +/* BN_mod_mul sets |r| = |a|*|b| mod |m|. It returns one on success and zero + * on error. */ +OPENSSL_EXPORT int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m, BN_CTX *ctx); + +/* BN_mod_mul sets |r| = |a|^2 mod |m|. It returns one on success and zero + * on error. */ +OPENSSL_EXPORT int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, + BN_CTX *ctx); + +/* BN_mod_lshift sets |r| = (|a| << n) mod |m|, where |r| and |a| may be the + * same pointer. It returns one on success and zero on error. */ +OPENSSL_EXPORT int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, + const BIGNUM *m, BN_CTX *ctx); + +/* BN_mod_lshift_quick acts like |BN_mod_lshift| but requires that |a| be + * non-negative and less than |m|. */ +OPENSSL_EXPORT int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, + const BIGNUM *m); + +/* BN_mod_lshift1 sets |r| = (|a| << 1) mod |m|, where |r| and |a| may be the + * same pointer. It returns one on success and zero on error. */ +OPENSSL_EXPORT int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, + BN_CTX *ctx); + +/* BN_mod_lshift1_quick acts like |BN_mod_lshift1| but requires that |a| be + * non-negative and less than |m|. */ +OPENSSL_EXPORT int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, + const BIGNUM *m); + +/* BN_mod_sqrt returns a |BIGNUM|, r, such that r^2 == a (mod p). */ +OPENSSL_EXPORT BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); + + +/* Random and prime number generation. */ + +/* BN_rand sets |rnd| to a random number of length |bits|. If |top| is zero, the + * most-significant bit, if any, will be set. If |top| is one, the two most + * significant bits, if any, will be set. + * + * If |top| is -1 then no extra action will be taken and |BN_num_bits(rnd)| may + * not equal |bits| if the most significant bits randomly ended up as zeros. + * + * If |bottom| is non-zero, the least-significant bit, if any, will be set. The + * function returns one on success or zero otherwise. */ +OPENSSL_EXPORT int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); + +/* BN_pseudo_rand is an alias for |BN_rand|. */ +OPENSSL_EXPORT int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); + +/* BN_rand_range sets |rnd| to a random value [0..range). It returns one on + * success and zero otherwise. */ +OPENSSL_EXPORT int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); + +/* BN_pseudo_rand_range is an alias for BN_rand_range. */ +OPENSSL_EXPORT int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); + +/* BN_generate_dsa_nonce generates a random number 0 <= out < range. Unlike + * BN_rand_range, it also includes the contents of |priv| and |message| in the + * generation so that an RNG failure isn't fatal as long as |priv| remains + * secret. This is intended for use in DSA and ECDSA where an RNG weakness + * leads directly to private key exposure unless this function is used. + * It returns one on success and zero on error. */ +OPENSSL_EXPORT int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, + const BIGNUM *priv, + const uint8_t *message, + size_t message_len, BN_CTX *ctx); + +/* BN_GENCB holds a callback function that is used by generation functions that + * can take a very long time to complete. Use |BN_GENCB_set| to initialise a + * |BN_GENCB| structure. + * + * The callback receives the address of that |BN_GENCB| structure as its last + * argument and the user is free to put an arbitary pointer in |arg|. The other + * arguments are set as follows: + * event=BN_GENCB_GENERATED, n=i: after generating the i'th possible prime + * number. + * event=BN_GENCB_PRIME_TEST, n=-1: when finished trial division primality + * checks. + * event=BN_GENCB_PRIME_TEST, n=i: when the i'th primality test has finished. + * + * The callback can return zero to abort the generation progress or one to + * allow it to continue. + * + * When other code needs to call a BN generation function it will often take a + * BN_GENCB argument and may call the function with other argument values. */ +#define BN_GENCB_GENERATED 0 +#define BN_GENCB_PRIME_TEST 1 + +struct bn_gencb_st { + void *arg; /* callback-specific data */ + int (*callback)(int event, int n, struct bn_gencb_st *); +}; + +/* BN_GENCB_set configures |callback| to call |f| and sets |callout->arg| to + * |arg|. */ +OPENSSL_EXPORT void BN_GENCB_set(BN_GENCB *callback, + int (*f)(int event, int n, + struct bn_gencb_st *), + void *arg); + +/* BN_GENCB_call calls |callback|, if not NULL, and returns the return value of + * the callback, or 1 if |callback| is NULL. */ +OPENSSL_EXPORT int BN_GENCB_call(BN_GENCB *callback, int event, int n); + +/* BN_generate_prime_ex sets |ret| to a prime number of |bits| length. If safe + * is non-zero then the prime will be such that (ret-1)/2 is also a prime. + * (This is needed for Diffie-Hellman groups to ensure that the only subgroups + * are of size 2 and (p-1)/2.). + * + * If |add| is not NULL, the prime will fulfill the condition |ret| % |add| == + * |rem| in order to suit a given generator. (If |rem| is NULL then |ret| % + * |add| == 1.) + * + * If |cb| is not NULL, it will be called during processing to give an + * indication of progress. See the comments for |BN_GENCB|. It returns one on + * success and zero otherwise. */ +OPENSSL_EXPORT int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, + const BIGNUM *add, const BIGNUM *rem, + BN_GENCB *cb); + +/* BN_prime_checks is magic value that can be used as the |checks| argument to + * the primality testing functions in order to automatically select a number of + * Miller-Rabin checks that gives a false positive rate of ~2^{-80}. */ +#define BN_prime_checks 0 + +/* BN_primality_test sets |*is_probably_prime| to one if |candidate| is + * probably a prime number by the Miller-Rabin test or zero if it's certainly + * not. + * + * If |do_trial_division| is non-zero then |candidate| will be tested against a + * list of small primes before Miller-Rabin tests. The probability of this + * function returning a false positive is 2^{2*checks}. If |checks| is + * |BN_prime_checks| then a value that results in approximately 2^{-80} false + * positive probability is used. If |cb| is not NULL then it is called during + * the checking process. See the comment above |BN_GENCB|. + * + * The function returns one on success and zero on error. + * + * (If you are unsure whether you want |do_trial_division|, don't set it.) */ +OPENSSL_EXPORT int BN_primality_test(int *is_probably_prime, + const BIGNUM *candidate, int checks, + BN_CTX *ctx, int do_trial_division, + BN_GENCB *cb); + +/* BN_is_prime_fasttest_ex returns one if |candidate| is probably a prime + * number by the Miller-Rabin test, zero if it's certainly not and -1 on error. + * + * If |do_trial_division| is non-zero then |candidate| will be tested against a + * list of small primes before Miller-Rabin tests. The probability of this + * function returning one when |candidate| is composite is 2^{2*checks}. If + * |checks| is |BN_prime_checks| then a value that results in approximately + * 2^{-80} false positive probability is used. If |cb| is not NULL then it is + * called during the checking process. See the comment above |BN_GENCB|. + * + * WARNING: deprecated. Use |BN_primality_test|. */ +OPENSSL_EXPORT int BN_is_prime_fasttest_ex(const BIGNUM *candidate, int checks, + BN_CTX *ctx, int do_trial_division, + BN_GENCB *cb); + +/* BN_is_prime_ex acts the same as |BN_is_prime_fasttest_ex| with + * |do_trial_division| set to zero. + * + * WARNING: deprecated: Use |BN_primality_test|. */ +OPENSSL_EXPORT int BN_is_prime_ex(const BIGNUM *candidate, int checks, + BN_CTX *ctx, BN_GENCB *cb); + + +/* Number theory functions */ + +/* BN_gcd sets |r| = gcd(|a|, |b|). It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx); + +/* BN_mod_inverse sets |out| equal to |a|^-1, mod |n|. If either of |a| or |n| + * have |BN_FLG_CONSTTIME| set then the operation is performed in constant + * time. If |out| is NULL, a fresh BIGNUM is allocated. It returns the result + * or NULL on error. */ +OPENSSL_EXPORT BIGNUM *BN_mod_inverse(BIGNUM *out, const BIGNUM *a, + const BIGNUM *n, BN_CTX *ctx); + +/* BN_kronecker returns the Kronecker symbol of |a| and |b| (which is -1, 0 or + * 1), or -2 on error. */ +OPENSSL_EXPORT int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); + + +/* Montgomery arithmetic. */ + +/* BN_MONT_CTX contains the precomputed values needed to work in a specific + * Montgomery domain. */ + +/* BN_MONT_CTX_new returns a fresh BN_MONT_CTX or NULL on allocation failure. */ +OPENSSL_EXPORT BN_MONT_CTX *BN_MONT_CTX_new(void); + +/* BN_MONT_CTX_init initialises a stack allocated |BN_MONT_CTX|. */ +OPENSSL_EXPORT void BN_MONT_CTX_init(BN_MONT_CTX *mont); + +/* BN_MONT_CTX_free frees the contexts of |mont| and, if it was originally + * allocated with |BN_MONT_CTX_new|, |mont| itself. */ +OPENSSL_EXPORT void BN_MONT_CTX_free(BN_MONT_CTX *mont); + +/* BN_MONT_CTX_copy sets |to| equal to |from|. It returns |to| on success or + * NULL on error. */ +OPENSSL_EXPORT BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, + BN_MONT_CTX *from); + +/* BN_MONT_CTX_set sets up a Montgomery context given the modulus, |mod|. It + * returns one on success and zero on error. */ +OPENSSL_EXPORT int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, + BN_CTX *ctx); + +/* BN_MONT_CTX_set_locked takes |lock| and checks whether |*pmont| is NULL. If + * so, it creates a new |BN_MONT_CTX| and sets the modulus for it to |mod|. It + * then stores it as |*pmont| and returns it, or NULL on error. + * + * If |*pmont| is already non-NULL then the existing value is returned. */ +BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_MUTEX *lock, + const BIGNUM *mod, BN_CTX *bn_ctx); + +/* BN_to_montgomery sets |ret| equal to |a| in the Montgomery domain. It + * returns one on success and zero on error. */ +OPENSSL_EXPORT int BN_to_montgomery(BIGNUM *ret, const BIGNUM *a, + const BN_MONT_CTX *mont, BN_CTX *ctx); + +/* BN_from_montgomery sets |ret| equal to |a| * R^-1, i.e. translates values + * out of the Montgomery domain. It returns one on success or zero on error. */ +OPENSSL_EXPORT int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, + const BN_MONT_CTX *mont, BN_CTX *ctx); + +/* BN_mod_mul_montgomery set |r| equal to |a| * |b|, in the Montgomery domain. + * Both |a| and |b| must already be in the Montgomery domain (by + * |BN_to_montgomery|). It returns one on success or zero on error. */ +OPENSSL_EXPORT int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, + const BIGNUM *b, + const BN_MONT_CTX *mont, BN_CTX *ctx); + + +/* Exponentiation. */ + +/* BN_exp sets |r| equal to |a|^{|p|}. It does so with a square-and-multiply + * algorithm that leaks side-channel information. It returns one on success or + * zero otherwise. */ +OPENSSL_EXPORT int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); + +/* BN_mod_exp sets |r| equal to |a|^{|p|} mod |m|. It does so with the best + * algorithm for the values provided and can run in constant time if + * |BN_FLG_CONSTTIME| is set for |p|. It returns one on success or zero + * otherwise. */ +OPENSSL_EXPORT int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); + +OPENSSL_EXPORT int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); + +OPENSSL_EXPORT int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, + const BIGNUM *p, const BIGNUM *m, + BN_CTX *ctx, BN_MONT_CTX *in_mont); + +OPENSSL_EXPORT int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); +OPENSSL_EXPORT int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, + const BIGNUM *p1, const BIGNUM *a2, + const BIGNUM *p2, const BIGNUM *m, + BN_CTX *ctx, BN_MONT_CTX *m_ctx); + + +/* Private functions */ + +struct bignum_st { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks in little-endian + order. */ + int top; /* Index of last used element in |d|, plus one. */ + int dmax; /* Size of |d|, in words. */ + int neg; /* one if the number is negative */ + int flags; /* bitmask of BN_FLG_* values */ +}; + +struct bn_mont_ctx_st { + BIGNUM RR; /* used to convert to montgomery form */ + BIGNUM N; /* The modulus */ + BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 + * (Ni is only stored for bignum algorithm) */ + BN_ULONG n0[2]; /* least significant word(s) of Ni; + (type changed with 0.9.9, was "BN_ULONG n0;" before) */ + int flags; + int ri; /* number of bits in R */ +}; + +OPENSSL_EXPORT unsigned BN_num_bits_word(BN_ULONG l); + +#define BN_FLG_MALLOCED 0x01 +#define BN_FLG_STATIC_DATA 0x02 +/* avoid leaking exponent information through timing, BN_mod_exp_mont() will + * call BN_mod_exp_mont_consttime, BN_div() will call BN_div_no_branch, + * BN_mod_inverse() will call BN_mod_inverse_no_branch. */ +#define BN_FLG_CONSTTIME 0x04 + + +/* Android compatibility section. + * + * These functions are declared, temporarily, for Android because + * wpa_supplicant will take a little time to sync with upstream. Outside of + * Android they'll have no definition. */ + +OPENSSL_EXPORT BIGNUM *get_rfc3526_prime_1536(BIGNUM *bn); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define BN_F_BN_CTX_get 100 +#define BN_F_BN_CTX_new 101 +#define BN_F_BN_CTX_start 102 +#define BN_F_BN_bn2dec 103 +#define BN_F_BN_bn2hex 104 +#define BN_F_BN_div 105 +#define BN_F_BN_div_recp 106 +#define BN_F_BN_exp 107 +#define BN_F_BN_generate_dsa_nonce 108 +#define BN_F_BN_generate_prime_ex 109 +#define BN_F_BN_mod_exp2_mont 110 +#define BN_F_BN_mod_exp_mont 111 +#define BN_F_BN_mod_exp_mont_consttime 112 +#define BN_F_BN_mod_exp_mont_word 113 +#define BN_F_BN_mod_inverse 114 +#define BN_F_BN_mod_inverse_no_branch 115 +#define BN_F_BN_mod_lshift_quick 116 +#define BN_F_BN_mod_sqrt 117 +#define BN_F_BN_new 118 +#define BN_F_BN_rand 119 +#define BN_F_BN_rand_range 120 +#define BN_F_BN_sqrt 121 +#define BN_F_BN_usub 122 +#define BN_F_bn_wexpand 123 +#define BN_F_mod_exp_recp 124 +#define BN_F_BN_lshift 125 +#define BN_F_BN_rshift 126 +#define BN_R_ARG2_LT_ARG3 100 +#define BN_R_BAD_RECIPROCAL 101 +#define BN_R_BIGNUM_TOO_LONG 102 +#define BN_R_BITS_TOO_SMALL 103 +#define BN_R_CALLED_WITH_EVEN_MODULUS 104 +#define BN_R_DIV_BY_ZERO 105 +#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 106 +#define BN_R_INPUT_NOT_REDUCED 107 +#define BN_R_INVALID_RANGE 108 +#define BN_R_NEGATIVE_NUMBER 109 +#define BN_R_NOT_A_SQUARE 110 +#define BN_R_NOT_INITIALIZED 111 +#define BN_R_NO_INVERSE 112 +#define BN_R_PRIVATE_KEY_TOO_LARGE 113 +#define BN_R_P_IS_NOT_PRIME 114 +#define BN_R_TOO_MANY_ITERATIONS 115 +#define BN_R_TOO_MANY_TEMPORARY_VARIABLES 116 + +#endif /* OPENSSL_HEADER_BN_H */ diff --git a/phonelibs/boringssl/include/openssl/buf.h b/phonelibs/boringssl/include/openssl/buf.h new file mode 100644 index 00000000000000..2b36ce40585c33 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/buf.h @@ -0,0 +1,123 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_BUFFER_H +#define OPENSSL_HEADER_BUFFER_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Memory and string functions, see also mem.h. */ + + +/* BUF_MEM is a generic buffer object used by OpenSSL. */ +struct buf_mem_st { + size_t length; /* current number of bytes */ + char *data; + size_t max; /* size of buffer */ +}; + +/* BUF_MEM_new creates a new BUF_MEM which has no allocated data buffer. */ +OPENSSL_EXPORT BUF_MEM *BUF_MEM_new(void); + +/* BUF_MEM_free frees |buf->data| if needed and then frees |buf| itself. */ +OPENSSL_EXPORT void BUF_MEM_free(BUF_MEM *buf); + +/* BUF_MEM_grow ensures that |buf| has length |len| and allocates memory if + * needed. If the length of |buf| increased, the new bytes are filled with + * zeros. It returns the length of |buf|, or zero if there's an error. */ +OPENSSL_EXPORT size_t BUF_MEM_grow(BUF_MEM *buf, size_t len); + +/* BUF_MEM_grow_clean acts the same as |BUF_MEM_grow|, but clears the previous + * contents of memory if reallocing. */ +OPENSSL_EXPORT size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); + +/* BUF_strdup returns an allocated, duplicate of |str|. */ +OPENSSL_EXPORT char *BUF_strdup(const char *str); + +/* BUF_strnlen returns the number of characters in |str|, excluding the NUL + * byte, but at most |max_len|. This function never reads more than |max_len| + * bytes from |str|. */ +OPENSSL_EXPORT size_t BUF_strnlen(const char *str, size_t max_len); + +/* BUF_strndup returns an allocated, duplicate of |str|, which is, at most, + * |size| bytes. The result is always NUL terminated. */ +OPENSSL_EXPORT char *BUF_strndup(const char *str, size_t size); + +/* BUF_memdup returns an allocated, duplicate of |size| bytes from |data|. */ +OPENSSL_EXPORT void *BUF_memdup(const void *data, size_t size); + +/* BUF_strlcpy acts like strlcpy(3). */ +OPENSSL_EXPORT size_t BUF_strlcpy(char *dst, const char *src, size_t dst_size); + +/* BUF_strlcat acts like strlcat(3). */ +OPENSSL_EXPORT size_t BUF_strlcat(char *dst, const char *src, size_t size); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define BUF_F_BUF_MEM_new 100 +#define BUF_F_BUF_memdup 101 +#define BUF_F_BUF_strndup 102 +#define BUF_F_buf_mem_grow 103 + +#endif /* OPENSSL_HEADER_BUFFER_H */ diff --git a/phonelibs/boringssl/include/openssl/buffer.h b/phonelibs/boringssl/include/openssl/buffer.h new file mode 100644 index 00000000000000..c6b721c277b4a9 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/buffer.h @@ -0,0 +1,18 @@ +/* Copyright (c) 2015, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* This header is provided in order to make compiling against code that expects + OpenSSL easier. */ + +#include "buf.h" diff --git a/phonelibs/boringssl/include/openssl/bytestring.h b/phonelibs/boringssl/include/openssl/bytestring.h new file mode 100644 index 00000000000000..9963426ca3f1db --- /dev/null +++ b/phonelibs/boringssl/include/openssl/bytestring.h @@ -0,0 +1,325 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_BYTESTRING_H +#define OPENSSL_HEADER_BYTESTRING_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Bytestrings are used for parsing and building TLS and ASN.1 messages. + * + * A "CBS" (CRYPTO ByteString) represents a string of bytes in memory and + * provides utility functions for safely parsing length-prefixed structures + * like TLS and ASN.1 from it. + * + * A "CBB" (CRYPTO ByteBuilder) is a memory buffer that grows as needed and + * provides utility functions for building length-prefixed messages. */ + + +/* CRYPTO ByteString */ + +struct cbs_st { + const uint8_t *data; + size_t len; +}; + +/* CBS_init sets |cbs| to point to |data|. It does not take ownership of + * |data|. */ +OPENSSL_EXPORT void CBS_init(CBS *cbs, const uint8_t *data, size_t len); + +/* CBS_skip advances |cbs| by |len| bytes. It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int CBS_skip(CBS *cbs, size_t len); + +/* CBS_data returns a pointer to the contents of |cbs|. */ +OPENSSL_EXPORT const uint8_t *CBS_data(const CBS *cbs); + +/* CBS_len returns the number of bytes remaining in |cbs|. */ +OPENSSL_EXPORT size_t CBS_len(const CBS *cbs); + +/* CBS_stow copies the current contents of |cbs| into |*out_ptr| and + * |*out_len|. If |*out_ptr| is not NULL, the contents are freed with + * OPENSSL_free. It returns one on success and zero on allocation failure. On + * success, |*out_ptr| should be freed with OPENSSL_free. If |cbs| is empty, + * |*out_ptr| will be NULL. */ +OPENSSL_EXPORT int CBS_stow(const CBS *cbs, uint8_t **out_ptr, size_t *out_len); + +/* CBS_strdup copies the current contents of |cbs| into |*out_ptr| as a + * NUL-terminated C string. If |*out_ptr| is not NULL, the contents are freed + * with OPENSSL_free. It returns one on success and zero on allocation + * failure. On success, |*out_ptr| should be freed with OPENSSL_free. + * + * NOTE: If |cbs| contains NUL bytes, the string will be truncated. Call + * |CBS_contains_zero_byte(cbs)| to check for NUL bytes. */ +OPENSSL_EXPORT int CBS_strdup(const CBS *cbs, char **out_ptr); + +/* CBS_contains_zero_byte returns one if the current contents of |cbs| contains + * a NUL byte and zero otherwise. */ +OPENSSL_EXPORT int CBS_contains_zero_byte(const CBS *cbs); + +/* CBS_mem_equal compares the current contents of |cbs| with the |len| bytes + * starting at |data|. If they're equal, it returns one, otherwise zero. If the + * lengths match, it uses a constant-time comparison. */ +OPENSSL_EXPORT int CBS_mem_equal(const CBS *cbs, const uint8_t *data, + size_t len); + +/* CBS_get_u8 sets |*out| to the next uint8_t from |cbs| and advances |cbs|. It + * returns one on success and zero on error. */ +OPENSSL_EXPORT int CBS_get_u8(CBS *cbs, uint8_t *out); + +/* CBS_get_u16 sets |*out| to the next, big-endian uint16_t from |cbs| and + * advances |cbs|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int CBS_get_u16(CBS *cbs, uint16_t *out); + +/* CBS_get_u24 sets |*out| to the next, big-endian 24-bit value from |cbs| and + * advances |cbs|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int CBS_get_u24(CBS *cbs, uint32_t *out); + +/* CBS_get_u32 sets |*out| to the next, big-endian uint32_t value from |cbs| + * and advances |cbs|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int CBS_get_u32(CBS *cbs, uint32_t *out); + +/* CBS_get_bytes sets |*out| to the next |len| bytes from |cbs| and advances + * |cbs|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int CBS_get_bytes(CBS *cbs, CBS *out, size_t len); + +/* CBS_get_u8_length_prefixed sets |*out| to the contents of an 8-bit, + * length-prefixed value from |cbs| and advances |cbs| over it. It returns one + * on success and zero on error. */ +OPENSSL_EXPORT int CBS_get_u8_length_prefixed(CBS *cbs, CBS *out); + +/* CBS_get_u16_length_prefixed sets |*out| to the contents of a 16-bit, + * big-endian, length-prefixed value from |cbs| and advances |cbs| over it. It + * returns one on success and zero on error. */ +OPENSSL_EXPORT int CBS_get_u16_length_prefixed(CBS *cbs, CBS *out); + +/* CBS_get_u24_length_prefixed sets |*out| to the contents of a 24-bit, + * big-endian, length-prefixed value from |cbs| and advances |cbs| over it. It + * returns one on success and zero on error. */ +OPENSSL_EXPORT int CBS_get_u24_length_prefixed(CBS *cbs, CBS *out); + + +/* Parsing ASN.1 */ + +#define CBS_ASN1_BOOLEAN 0x1 +#define CBS_ASN1_INTEGER 0x2 +#define CBS_ASN1_BITSTRING 0x3 +#define CBS_ASN1_OCTETSTRING 0x4 +#define CBS_ASN1_OBJECT 0x6 +#define CBS_ASN1_ENUMERATED 0xa +#define CBS_ASN1_SEQUENCE (0x10 | CBS_ASN1_CONSTRUCTED) +#define CBS_ASN1_SET (0x11 | CBS_ASN1_CONSTRUCTED) + +#define CBS_ASN1_CONSTRUCTED 0x20 +#define CBS_ASN1_CONTEXT_SPECIFIC 0x80 + +/* CBS_get_asn1 sets |*out| to the contents of DER-encoded, ASN.1 element (not + * including tag and length bytes) and advances |cbs| over it. The ASN.1 + * element must match |tag_value|. It returns one on success and zero + * on error. + * + * Tag numbers greater than 30 are not supported (i.e. short form only). */ +OPENSSL_EXPORT int CBS_get_asn1(CBS *cbs, CBS *out, unsigned tag_value); + +/* CBS_get_asn1_element acts like |CBS_get_asn1| but |out| will include the + * ASN.1 header bytes too. */ +OPENSSL_EXPORT int CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned tag_value); + +/* CBS_peek_asn1_tag looks ahead at the next ASN.1 tag and returns one + * if the next ASN.1 element on |cbs| would have tag |tag_value|. If + * |cbs| is empty or the tag does not match, it returns zero. Note: if + * it returns one, CBS_get_asn1 may still fail if the rest of the + * element is malformed. */ +OPENSSL_EXPORT int CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value); + +/* CBS_get_any_asn1_element sets |*out| to contain the next ASN.1 element from + * |*cbs| (including header bytes) and advances |*cbs|. It sets |*out_tag| to + * the tag number and |*out_header_len| to the length of the ASN.1 header. Each + * of |out|, |out_tag|, and |out_header_len| may be NULL to ignore the value. + * + * Tag numbers greater than 30 are not supported (i.e. short form only). */ +OPENSSL_EXPORT int CBS_get_any_asn1_element(CBS *cbs, CBS *out, + unsigned *out_tag, + size_t *out_header_len); + +/* CBS_get_asn1_uint64 gets an ASN.1 INTEGER from |cbs| using |CBS_get_asn1| + * and sets |*out| to its value. It returns one on success and zero on error, + * where error includes the integer being negative, or too large to represent + * in 64 bits. */ +OPENSSL_EXPORT int CBS_get_asn1_uint64(CBS *cbs, uint64_t *out); + +/* CBS_get_optional_asn1 gets an optional explicitly-tagged element + * from |cbs| tagged with |tag| and sets |*out| to its contents. If + * present, it sets |*out_present| to one, otherwise zero. It returns + * one on success, whether or not the element was present, and zero on + * decode failure. */ +OPENSSL_EXPORT int CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, + unsigned tag); + +/* CBS_get_optional_asn1_octet_string gets an optional + * explicitly-tagged OCTET STRING from |cbs|. If present, it sets + * |*out| to the string and |*out_present| to one. Otherwise, it sets + * |*out| to empty and |*out_present| to zero. |out_present| may be + * NULL. It returns one on success, whether or not the element was + * present, and zero on decode failure. */ +OPENSSL_EXPORT int CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, + int *out_present, + unsigned tag); + +/* CBS_get_optional_asn1_uint64 gets an optional explicitly-tagged + * INTEGER from |cbs|. If present, it sets |*out| to the + * value. Otherwise, it sets |*out| to |default_value|. It returns one + * on success, whether or not the element was present, and zero on + * decode failure. */ +OPENSSL_EXPORT int CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, + unsigned tag, + uint64_t default_value); + +/* CBS_get_optional_asn1_bool gets an optional, explicitly-tagged BOOLEAN from + * |cbs|. If present, it sets |*out| to either zero or one, based on the + * boolean. Otherwise, it sets |*out| to |default_value|. It returns one on + * success, whether or not the element was present, and zero on decode + * failure. */ +OPENSSL_EXPORT int CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned tag, + int default_value); + + +/* CRYPTO ByteBuilder. + * + * |CBB| objects allow one to build length-prefixed serialisations. A |CBB| + * object is associated with a buffer and new buffers are created with + * |CBB_init|. Several |CBB| objects can point at the same buffer when a + * length-prefix is pending, however only a single |CBB| can be 'current' at + * any one time. For example, if one calls |CBB_add_u8_length_prefixed| then + * the new |CBB| points at the same buffer as the original. But if the original + * |CBB| is used then the length prefix is written out and the new |CBB| must + * not be used again. + * + * If one needs to force a length prefix to be written out because a |CBB| is + * going out of scope, use |CBB_flush|. */ + +struct cbb_buffer_st { + uint8_t *buf; + size_t len; /* The number of valid bytes. */ + size_t cap; /* The size of buf. */ + char can_resize; /* One iff |buf| is owned by this object. If not then |buf| + cannot be resized. */ +}; + +struct cbb_st { + struct cbb_buffer_st *base; + /* offset is the offset from the start of |base->buf| to the position of any + * pending length-prefix. */ + size_t offset; + /* child points to a child CBB if a length-prefix is pending. */ + struct cbb_st *child; + /* pending_len_len contains the number of bytes in a pending length-prefix, + * or zero if no length-prefix is pending. */ + uint8_t pending_len_len; + char pending_is_asn1; + /* is_top_level is true iff this is a top-level |CBB| (as opposed to a child + * |CBB|). Top-level objects are valid arguments for |CBB_finish|. */ + char is_top_level; +}; + +/* CBB_init initialises |cbb| with |initial_capacity|. Since a |CBB| grows as + * needed, the |initial_capacity| is just a hint. It returns one on success or + * zero on error. */ +OPENSSL_EXPORT int CBB_init(CBB *cbb, size_t initial_capacity); + +/* CBB_init_fixed initialises |cbb| to write to |len| bytes at |buf|. Since + * |buf| cannot grow, trying to write more than |len| bytes will cause CBB + * functions to fail. It returns one on success or zero on error. */ +OPENSSL_EXPORT int CBB_init_fixed(CBB *cbb, uint8_t *buf, size_t len); + +/* CBB_cleanup frees all resources owned by |cbb| and other |CBB| objects + * writing to the same buffer. This should be used in an error case where a + * serialisation is abandoned. */ +OPENSSL_EXPORT void CBB_cleanup(CBB *cbb); + +/* CBB_finish completes any pending length prefix and sets |*out_data| to a + * malloced buffer and |*out_len| to the length of that buffer. The caller + * takes ownership of the buffer and, unless the buffer was fixed with + * |CBB_init_fixed|, must call |OPENSSL_free| when done. + * + * It can only be called on a "top level" |CBB|, i.e. one initialised with + * |CBB_init| or |CBB_init_fixed|. It returns one on success and zero on + * error. */ +OPENSSL_EXPORT int CBB_finish(CBB *cbb, uint8_t **out_data, size_t *out_len); + +/* CBB_flush causes any pending length prefixes to be written out and any child + * |CBB| objects of |cbb| to be invalidated. It returns one on success or zero + * on error. */ +OPENSSL_EXPORT int CBB_flush(CBB *cbb); + +/* CBB_add_u8_length_prefixed sets |*out_contents| to a new child of |cbb|. The + * data written to |*out_contents| will be prefixed in |cbb| with an 8-bit + * length. It returns one on success or zero on error. */ +OPENSSL_EXPORT int CBB_add_u8_length_prefixed(CBB *cbb, CBB *out_contents); + +/* CBB_add_u16_length_prefixed sets |*out_contents| to a new child of |cbb|. + * The data written to |*out_contents| will be prefixed in |cbb| with a 16-bit, + * big-endian length. It returns one on success or zero on error. */ +OPENSSL_EXPORT int CBB_add_u16_length_prefixed(CBB *cbb, CBB *out_contents); + +/* CBB_add_u24_length_prefixed sets |*out_contents| to a new child of |cbb|. + * The data written to |*out_contents| will be prefixed in |cbb| with a 24-bit, + * big-endian length. It returns one on success or zero on error. */ +OPENSSL_EXPORT int CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents); + +/* CBB_add_asn sets |*out_contents| to a |CBB| into which the contents of an + * ASN.1 object can be written. The |tag| argument will be used as the tag for + * the object. Passing in |tag| number 31 will return in an error since only + * single octet identifiers are supported. It returns one on success or zero + * on error. */ +OPENSSL_EXPORT int CBB_add_asn1(CBB *cbb, CBB *out_contents, uint8_t tag); + +/* CBB_add_bytes appends |len| bytes from |data| to |cbb|. It returns one on + * success and zero otherwise. */ +OPENSSL_EXPORT int CBB_add_bytes(CBB *cbb, const uint8_t *data, size_t len); + +/* CBB_add_space appends |len| bytes to |cbb| and sets |*out_data| to point to + * the beginning of that space. The caller must then write |len| bytes of + * actual contents to |*out_data|. It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int CBB_add_space(CBB *cbb, uint8_t **out_data, size_t len); + +/* CBB_add_u8 appends an 8-bit number from |value| to |cbb|. It returns one on + * success and zero otherwise. */ +OPENSSL_EXPORT int CBB_add_u8(CBB *cbb, uint8_t value); + +/* CBB_add_u8 appends a 16-bit, big-endian number from |value| to |cbb|. It + * returns one on success and zero otherwise. */ +OPENSSL_EXPORT int CBB_add_u16(CBB *cbb, uint16_t value); + +/* CBB_add_u24 appends a 24-bit, big-endian number from |value| to |cbb|. It + * returns one on success and zero otherwise. */ +OPENSSL_EXPORT int CBB_add_u24(CBB *cbb, uint32_t value); + +/* CBB_add_asn1_uint64 writes an ASN.1 INTEGER into |cbb| using |CBB_add_asn1| + * and writes |value| in its contents. It returns one on success and zero on + * error. */ +OPENSSL_EXPORT int CBB_add_asn1_uint64(CBB *cbb, uint64_t value); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_BYTESTRING_H */ diff --git a/phonelibs/boringssl/include/openssl/cast.h b/phonelibs/boringssl/include/openssl/cast.h new file mode 100644 index 00000000000000..802172394e5b12 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/cast.h @@ -0,0 +1,96 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_CAST_H +#define OPENSSL_HEADER_CAST_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#define CAST_ENCRYPT 1 +#define CAST_DECRYPT 0 + +#define CAST_BLOCK 8 +#define CAST_KEY_LENGTH 16 + +typedef struct cast_key_st { + uint32_t data[32]; + int short_key; /* Use reduced rounds for short key */ +} CAST_KEY; + +OPENSSL_EXPORT void CAST_set_key(CAST_KEY *key, size_t len, + const uint8_t *data); +OPENSSL_EXPORT void CAST_ecb_encrypt(const uint8_t *in, uint8_t *out, + const CAST_KEY *key, int enc); +OPENSSL_EXPORT void CAST_encrypt(uint32_t *data, const CAST_KEY *key); +OPENSSL_EXPORT void CAST_decrypt(uint32_t *data, const CAST_KEY *key); +OPENSSL_EXPORT void CAST_cbc_encrypt(const uint8_t *in, uint8_t *out, + long length, const CAST_KEY *ks, + uint8_t *iv, int enc); + +OPENSSL_EXPORT void CAST_cfb64_encrypt(const uint8_t *in, uint8_t *out, + long length, const CAST_KEY *schedule, + uint8_t *ivec, int *num, int enc); + +#ifdef __cplusplus +} +#endif + +#endif /* OPENSSL_HEADER_CAST_H */ diff --git a/phonelibs/boringssl/include/openssl/chacha.h b/phonelibs/boringssl/include/openssl/chacha.h new file mode 100644 index 00000000000000..ce53d49fdaefed --- /dev/null +++ b/phonelibs/boringssl/include/openssl/chacha.h @@ -0,0 +1,37 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_CHACHA_H +#define OPENSSL_HEADER_CHACHA_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* CRYPTO_chacha_20 encrypts |in_len| bytes from |in| with the given key and + * nonce and writes the result to |out|, which may be equal to |in|. The + * initial block counter is specified by |counter|. */ +void CRYPTO_chacha_20(uint8_t *out, const uint8_t *in, + size_t in_len, const uint8_t key[32], + const uint8_t nonce[8], size_t counter); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_CHACHA_H */ diff --git a/phonelibs/boringssl/include/openssl/cipher.h b/phonelibs/boringssl/include/openssl/cipher.h new file mode 100644 index 00000000000000..3e496f15b50e9a --- /dev/null +++ b/phonelibs/boringssl/include/openssl/cipher.h @@ -0,0 +1,598 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_CIPHER_H +#define OPENSSL_HEADER_CIPHER_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Ciphers. */ + + +/* Cipher primitives. + * + * The following functions return |EVP_CIPHER| objects that implement the named + * cipher algorithm. */ + +OPENSSL_EXPORT const EVP_CIPHER *EVP_rc4(void); + +OPENSSL_EXPORT const EVP_CIPHER *EVP_des_cbc(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ecb(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_cbc(void); + +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_ecb(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cbc(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_ctr(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_ofb(void); + +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_ecb(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_cbc(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_ctr(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_ofb(void); + +/* Deprecated AES-GCM implementations that set |EVP_CIPH_FLAG_CUSTOM_CIPHER|. + * Use |EVP_aead_aes_128_gcm| and |EVP_aead_aes_256_gcm| instead. */ +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_gcm(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_gcm(void); + +/* Deprecated 192-bit version of AES. */ +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_ecb(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_cbc(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_ctr(void); +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_gcm(void); + +/* EVP_enc_null returns a 'cipher' that passes plaintext through as + * ciphertext. */ +OPENSSL_EXPORT const EVP_CIPHER *EVP_enc_null(void); + +/* EVP_rc2_40_cbc returns a cipher that implements 40-bit RC2 in CBC mode. This + * is obviously very, very weak and is included only in order to read PKCS#12 + * files, which often encrypt the certificate chain using this cipher. It is + * deliberately not exported. */ +const EVP_CIPHER *EVP_rc2_40_cbc(void); + +/* EVP_get_cipherbynid returns the cipher corresponding to the given NID, or + * NULL if no such cipher is known. */ +OPENSSL_EXPORT const EVP_CIPHER *EVP_get_cipherbynid(int nid); + + +/* Cipher context allocation. + * + * An |EVP_CIPHER_CTX| represents the state of an encryption or decryption in + * progress. */ + +/* EVP_CIPHER_CTX_init initialises an, already allocated, |EVP_CIPHER_CTX|. */ +OPENSSL_EXPORT void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_new allocates a fresh |EVP_CIPHER_CTX|, calls + * |EVP_CIPHER_CTX_init| and returns it, or NULL on allocation failure. */ +OPENSSL_EXPORT EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); + +/* EVP_CIPHER_CTX_cleanup frees any memory referenced by |ctx|. It returns + * one. */ +OPENSSL_EXPORT int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_free calls |EVP_CIPHER_CTX_cleanup| on |ctx| and then frees + * |ctx| itself. */ +OPENSSL_EXPORT void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_copy sets |out| to be a duplicate of the current state of + * |in|. The |out| argument must have been previously initialised. */ +OPENSSL_EXPORT int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, + const EVP_CIPHER_CTX *in); + + +/* Cipher context configuration. */ + +/* EVP_CipherInit_ex configures |ctx| for a fresh encryption (or decryption, if + * |enc| is zero) operation using |cipher|. If |ctx| has been previously + * configured with a cipher then |cipher|, |key| and |iv| may be |NULL| and + * |enc| may be -1 to reuse the previous values. The operation will use |key| + * as the key and |iv| as the IV (if any). These should have the correct + * lengths given by |EVP_CIPHER_key_length| and |EVP_CIPHER_iv_length|. It + * returns one on success and zero on error. */ +OPENSSL_EXPORT int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *engine, + const uint8_t *key, const uint8_t *iv, + int enc); + +/* EVP_EncryptInit_ex calls |EVP_CipherInit_ex| with |enc| equal to one. */ +OPENSSL_EXPORT int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const uint8_t *key, const uint8_t *iv); + +/* EVP_DecryptInit_ex calls |EVP_CipherInit_ex| with |enc| equal to zero. */ +OPENSSL_EXPORT int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const uint8_t *key, const uint8_t *iv); + + +/* Cipher operations. */ + +/* EVP_EncryptUpdate encrypts |in_len| bytes from |in| to |out|. The number + * of output bytes may be up to |in_len| plus the block length minus one and + * |out| must have sufficient space. The number of bytes actually output is + * written to |*out_len|. It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, uint8_t *out, + int *out_len, const uint8_t *in, + int in_len); + +/* EVP_EncryptFinal_ex writes at most a block of ciphertext to |out| and sets + * |*out_len| to the number of bytes written. If padding is enabled (the + * default) then standard padding is applied to create the final block. If + * padding is disabled (with |EVP_CIPHER_CTX_set_padding|) then any partial + * block remaining will cause an error. The function returns one on success and + * zero otherwise. */ +OPENSSL_EXPORT int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, uint8_t *out, + int *out_len); + +/* EVP_DecryptUpdate decrypts |in_len| bytes from |in| to |out|. The number of + * output bytes may be up to |in_len| plus the block length minus one and |out| + * must have sufficient space. The number of bytes actually output is written + * to |*out_len|. It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, uint8_t *out, + int *out_len, const uint8_t *in, + int in_len); + +/* EVP_DecryptFinal_ex writes at most a block of ciphertext to |out| and sets + * |*out_len| to the number of bytes written. If padding is enabled (the + * default) then padding is removed from the final block. + * + * WARNING: it is unsafe to call this function with unauthenticted + * ciphertext if padding is enabled. */ +OPENSSL_EXPORT int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *out_len); + +/* EVP_Cipher performs a one-shot encryption/decryption operation. No partial + * blocks are maintained between calls. However, any internal cipher state is + * still updated. For CBC-mode ciphers, the IV is updated to the final + * ciphertext block. For stream ciphers, the stream is advanced past the bytes + * used. It returns one on success and zero otherwise, unless |EVP_CIPHER_flags| + * has |EVP_CIPH_FLAG_CUSTOM_CIPHER| set. Then it returns the number of bytes + * written or -1 on error. + * + * WARNING: this differs from the usual return value convention when using + * |EVP_CIPH_FLAG_CUSTOM_CIPHER|. + * + * TODO(davidben): The normal ciphers currently never fail, even if, e.g., + * |in_len| is not a multiple of the block size for CBC-mode decryption. The + * input just gets rounded up while the output gets truncated. This should + * either be officially documented or fail. */ +OPENSSL_EXPORT int EVP_Cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, + const uint8_t *in, size_t in_len); + +/* EVP_CipherUpdate calls either |EVP_EncryptUpdate| or |EVP_DecryptUpdate| + * depending on how |ctx| has been setup. */ +OPENSSL_EXPORT int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, uint8_t *out, + int *out_len, const uint8_t *in, + int in_len); + +/* EVP_CipherFinal_ex calls either |EVP_EncryptFinal_ex| or + * |EVP_DecryptFinal_ex| depending on how |ctx| has been setup. */ +OPENSSL_EXPORT int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, uint8_t *out, + int *out_len); + + +/* Cipher context accessors. */ + +/* EVP_CIPHER_CTX_cipher returns the |EVP_CIPHER| underlying |ctx|, or NULL if + * none has been set. */ +OPENSSL_EXPORT const EVP_CIPHER *EVP_CIPHER_CTX_cipher( + const EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_nid returns a NID identifying the |EVP_CIPHER| underlying + * |ctx| (e.g. |NID_aes_128_gcm|). It will crash if no cipher has been + * configured. */ +OPENSSL_EXPORT int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_block_size returns the block size, in bytes, of the cipher + * underlying |ctx|, or one if the cipher is a stream cipher. It will crash if + * no cipher has been configured. */ +OPENSSL_EXPORT unsigned EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_key_length returns the key size, in bytes, of the cipher + * underlying |ctx| or zero if no cipher has been configured. */ +OPENSSL_EXPORT unsigned EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_iv_length returns the IV size, in bytes, of the cipher + * underlying |ctx|. It will crash if no cipher has been configured. */ +OPENSSL_EXPORT unsigned EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_get_app_data returns the opaque, application data pointer for + * |ctx|, or NULL if none has been set. */ +OPENSSL_EXPORT void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_set_app_data sets the opaque, application data pointer for + * |ctx| to |data|. */ +OPENSSL_EXPORT void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, + void *data); + +/* EVP_CIPHER_CTX_flags returns a value which is the OR of zero or more + * |EVP_CIPH_*| flags. It will crash if no cipher has been configured. */ +OPENSSL_EXPORT uint32_t EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_mode returns one of the |EVP_CIPH_*| cipher mode values + * enumerated below. It will crash if no cipher has been configured. */ +OPENSSL_EXPORT uint32_t EVP_CIPHER_CTX_mode(const EVP_CIPHER_CTX *ctx); + +/* EVP_CIPHER_CTX_ctrl is an |ioctl| like function. The |command| argument + * should be one of the |EVP_CTRL_*| values. The |arg| and |ptr| arguments are + * specific to the command in question. */ +OPENSSL_EXPORT int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int command, + int arg, void *ptr); + +/* EVP_CIPHER_CTX_set_padding sets whether padding is enabled for |ctx| and + * returns one. Pass a non-zero |pad| to enable padding (the default) or zero + * to disable. */ +OPENSSL_EXPORT int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad); + +/* EVP_CIPHER_CTX_set_key_length sets the key length for |ctx|. This is only + * valid for ciphers that can take a variable length key. It returns one on + * success and zero on error. */ +OPENSSL_EXPORT int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *ctx, unsigned key_len); + + +/* Cipher accessors. */ + +/* EVP_CIPHER_nid returns a NID identifing |cipher|. (For example, + * |NID_aes_128_gcm|.) */ +OPENSSL_EXPORT int EVP_CIPHER_nid(const EVP_CIPHER *cipher); + +/* EVP_CIPHER_block_size returns the block size, in bytes, for |cipher|, or one + * if |cipher| is a stream cipher. */ +OPENSSL_EXPORT unsigned EVP_CIPHER_block_size(const EVP_CIPHER *cipher); + +/* EVP_CIPHER_key_length returns the key size, in bytes, for |cipher|. If + * |cipher| can take a variable key length then this function returns the + * default key length and |EVP_CIPHER_flags| will return a value with + * |EVP_CIPH_VARIABLE_LENGTH| set. */ +OPENSSL_EXPORT unsigned EVP_CIPHER_key_length(const EVP_CIPHER *cipher); + +/* EVP_CIPHER_iv_length returns the IV size, in bytes, of |cipher|, or zero if + * |cipher| doesn't take an IV. */ +OPENSSL_EXPORT unsigned EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); + +/* EVP_CIPHER_flags returns a value which is the OR of zero or more + * |EVP_CIPH_*| flags. */ +OPENSSL_EXPORT uint32_t EVP_CIPHER_flags(const EVP_CIPHER *cipher); + +/* EVP_CIPHER_mode returns one of the cipher mode values enumerated below. */ +OPENSSL_EXPORT uint32_t EVP_CIPHER_mode(const EVP_CIPHER *cipher); + + +/* Key derivation. */ + +/* EVP_BytesToKey generates a key and IV for the cipher |type| by iterating + * |md| |count| times using |data| and |salt|. On entry, the |key| and |iv| + * buffers must have enough space to hold a key and IV for |type|. It returns + * the length of the key on success or zero on error. */ +OPENSSL_EXPORT int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, + const uint8_t *salt, const uint8_t *data, + size_t data_len, unsigned count, uint8_t *key, + uint8_t *iv); + + +/* Cipher modes (for |EVP_CIPHER_mode|). */ + +#define EVP_CIPH_STREAM_CIPHER 0x0 +#define EVP_CIPH_ECB_MODE 0x1 +#define EVP_CIPH_CBC_MODE 0x2 +#define EVP_CIPH_CFB_MODE 0x3 +#define EVP_CIPH_OFB_MODE 0x4 +#define EVP_CIPH_CTR_MODE 0x5 +#define EVP_CIPH_GCM_MODE 0x6 + + +/* Cipher flags (for |EVP_CIPHER_flags|). */ + +/* EVP_CIPH_VARIABLE_LENGTH indicates that the cipher takes a variable length + * key. */ +#define EVP_CIPH_VARIABLE_LENGTH 0x40 + +/* EVP_CIPH_ALWAYS_CALL_INIT indicates that the |init| function for the cipher + * should always be called when initialising a new operation, even if the key + * is NULL to indicate that the same key is being used. */ +#define EVP_CIPH_ALWAYS_CALL_INIT 0x80 + +/* EVP_CIPH_CUSTOM_IV indicates that the cipher manages the IV itself rather + * than keeping it in the |iv| member of |EVP_CIPHER_CTX|. */ +#define EVP_CIPH_CUSTOM_IV 0x100 + +/* EVP_CIPH_CTRL_INIT indicates that EVP_CTRL_INIT should be used when + * initialising an |EVP_CIPHER_CTX|. */ +#define EVP_CIPH_CTRL_INIT 0x200 + +/* EVP_CIPH_FLAG_CUSTOM_CIPHER indicates that the cipher manages blocking + * itself. This causes EVP_(En|De)crypt_ex to be simple wrapper functions. */ +#define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x400 + +/* EVP_CIPH_FLAG_AEAD_CIPHER specifies that the cipher is an AEAD. This is an + * older version of the proper AEAD interface. See aead.h for the current + * one. */ +#define EVP_CIPH_FLAG_AEAD_CIPHER 0x800 + +/* EVP_CIPH_CUSTOM_COPY indicates that the |ctrl| callback should be called + * with |EVP_CTRL_COPY| at the end of normal |EVP_CIPHER_CTX_copy| + * processing. */ +#define EVP_CIPH_CUSTOM_COPY 0x1000 + + +/* Deprecated functions */ + +/* EVP_CipherInit acts like EVP_CipherInit_ex except that |EVP_CIPHER_CTX_init| + * is called on |cipher| first, if |cipher| is not NULL. */ +OPENSSL_EXPORT int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const uint8_t *key, const uint8_t *iv, + int enc); + +/* EVP_EncryptInit calls |EVP_CipherInit| with |enc| equal to one. */ +OPENSSL_EXPORT int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, const uint8_t *key, + const uint8_t *iv); + +/* EVP_DecryptInit calls |EVP_CipherInit| with |enc| equal to zero. */ +OPENSSL_EXPORT int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, const uint8_t *key, + const uint8_t *iv); + +/* EVP_add_cipher_alias does nothing and returns one. */ +OPENSSL_EXPORT int EVP_add_cipher_alias(const char *a, const char *b); + +/* EVP_get_cipherbyname returns an |EVP_CIPHER| given a human readable name in + * |name|, or NULL if the name is unknown. */ +OPENSSL_EXPORT const EVP_CIPHER *EVP_get_cipherbyname(const char *name); + + +/* Private functions. */ + +/* EVP_CIPH_NO_PADDING disables padding in block ciphers. */ +#define EVP_CIPH_NO_PADDING 0x800 + +/* EVP_CIPHER_CTX_ctrl commands. */ +#define EVP_CTRL_INIT 0x0 +#define EVP_CTRL_SET_KEY_LENGTH 0x1 +#define EVP_CTRL_GET_RC2_KEY_BITS 0x2 +#define EVP_CTRL_SET_RC2_KEY_BITS 0x3 +#define EVP_CTRL_GET_RC5_ROUNDS 0x4 +#define EVP_CTRL_SET_RC5_ROUNDS 0x5 +#define EVP_CTRL_RAND_KEY 0x6 +#define EVP_CTRL_PBE_PRF_NID 0x7 +#define EVP_CTRL_COPY 0x8 +#define EVP_CTRL_GCM_SET_IVLEN 0x9 +#define EVP_CTRL_GCM_GET_TAG 0x10 +#define EVP_CTRL_GCM_SET_TAG 0x11 +#define EVP_CTRL_GCM_SET_IV_FIXED 0x12 +#define EVP_CTRL_GCM_IV_GEN 0x13 +#define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 +/* Set the GCM invocation field, decrypt only */ +#define EVP_CTRL_GCM_SET_IV_INV 0x18 + +/* GCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +#define EVP_GCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +#define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 +/* Length of tag for TLS */ +#define EVP_GCM_TLS_TAG_LEN 16 + +#define EVP_MAX_KEY_LENGTH 64 +#define EVP_MAX_IV_LENGTH 16 +#define EVP_MAX_BLOCK_LENGTH 32 + +struct evp_cipher_ctx_st { + /* cipher contains the underlying cipher for this context. */ + const EVP_CIPHER *cipher; + + /* app_data is a pointer to opaque, user data. */ + void *app_data; /* application stuff */ + + /* cipher_data points to the |cipher| specific state. */ + void *cipher_data; + + /* key_len contains the length of the key, which may differ from + * |cipher->key_len| if the cipher can take a variable key length. */ + unsigned key_len; + + /* encrypt is one if encrypting and zero if decrypting. */ + int encrypt; + + /* flags contains the OR of zero or more |EVP_CIPH_*| flags, above. */ + uint32_t flags; + + /* oiv contains the original IV value. */ + uint8_t oiv[EVP_MAX_IV_LENGTH]; + + /* iv contains the current IV value, which may have been updated. */ + uint8_t iv[EVP_MAX_IV_LENGTH]; + + /* buf contains a partial block which is used by, for example, CTR mode to + * store unused keystream bytes. */ + uint8_t buf[EVP_MAX_BLOCK_LENGTH]; + + /* buf_len contains the number of bytes of a partial block contained in + * |buf|. */ + int buf_len; + + /* num contains the number of bytes of |iv| which are valid for modes that + * manage partial blocks themselves. */ + int num; + + /* final_used is non-zero if the |final| buffer contains plaintext. */ + int final_used; + + /* block_mask contains |cipher->block_size| minus one. (The block size + * assumed to be a power of two.) */ + int block_mask; + + uint8_t final[EVP_MAX_BLOCK_LENGTH]; /* possible final block */ +} /* EVP_CIPHER_CTX */; + +typedef struct evp_cipher_info_st { + const EVP_CIPHER *cipher; + unsigned char iv[EVP_MAX_IV_LENGTH]; +} EVP_CIPHER_INFO; + +struct evp_cipher_st { + /* type contains a NID identifing the cipher. (e.g. NID_aes_128_gcm.) */ + int nid; + + /* block_size contains the block size, in bytes, of the cipher, or 1 for a + * stream cipher. */ + unsigned block_size; + + /* key_len contains the key size, in bytes, for the cipher. If the cipher + * takes a variable key size then this contains the default size. */ + unsigned key_len; + + /* iv_len contains the IV size, in bytes, or zero if inapplicable. */ + unsigned iv_len; + + /* ctx_size contains the size, in bytes, of the per-key context for this + * cipher. */ + unsigned ctx_size; + + /* flags contains the OR of a number of flags. See |EVP_CIPH_*|. */ + uint32_t flags; + + /* app_data is a pointer to opaque, user data. */ + void *app_data; + + int (*init)(EVP_CIPHER_CTX *ctx, const uint8_t *key, const uint8_t *iv, + int enc); + + int (*cipher)(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in, + size_t inl); + + /* cleanup, if non-NULL, releases memory associated with the context. It is + * called if |EVP_CTRL_INIT| succeeds. Note that |init| may not have been + * called at this point. */ + void (*cleanup)(EVP_CIPHER_CTX *); + + int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define CIPHER_F_EVP_AEAD_CTX_init 100 +#define CIPHER_F_EVP_AEAD_CTX_open 101 +#define CIPHER_F_EVP_AEAD_CTX_seal 102 +#define CIPHER_F_EVP_CIPHER_CTX_copy 103 +#define CIPHER_F_EVP_CIPHER_CTX_ctrl 104 +#define CIPHER_F_EVP_CIPHER_CTX_set_key_length 105 +#define CIPHER_F_EVP_CipherInit_ex 106 +#define CIPHER_F_EVP_DecryptFinal_ex 107 +#define CIPHER_F_EVP_EncryptFinal_ex 108 +#define CIPHER_F_aead_aes_gcm_init 109 +#define CIPHER_F_aead_aes_gcm_open 110 +#define CIPHER_F_aead_aes_gcm_seal 111 +#define CIPHER_F_aead_aes_key_wrap_init 112 +#define CIPHER_F_aead_aes_key_wrap_open 113 +#define CIPHER_F_aead_aes_key_wrap_seal 114 +#define CIPHER_F_aead_chacha20_poly1305_init 115 +#define CIPHER_F_aead_chacha20_poly1305_open 116 +#define CIPHER_F_aead_chacha20_poly1305_seal 117 +#define CIPHER_F_aead_rc4_md5_tls_init 118 +#define CIPHER_F_aead_rc4_md5_tls_open 119 +#define CIPHER_F_aead_rc4_md5_tls_seal 120 +#define CIPHER_F_aead_ssl3_ensure_cipher_init 121 +#define CIPHER_F_aead_ssl3_init 122 +#define CIPHER_F_aead_ssl3_open 123 +#define CIPHER_F_aead_ssl3_seal 124 +#define CIPHER_F_aead_tls_ensure_cipher_init 125 +#define CIPHER_F_aead_tls_init 126 +#define CIPHER_F_aead_tls_open 127 +#define CIPHER_F_aead_tls_seal 128 +#define CIPHER_F_aes_init_key 129 +#define CIPHER_F_aesni_init_key 130 +#define CIPHER_F_EVP_AEAD_CTX_init_with_direction 131 +#define CIPHER_F_aead_aes_ctr_hmac_sha256_init 132 +#define CIPHER_F_aead_aes_ctr_hmac_sha256_open 133 +#define CIPHER_F_aead_aes_ctr_hmac_sha256_seal 134 +#define CIPHER_R_AES_KEY_SETUP_FAILED 100 +#define CIPHER_R_BAD_DECRYPT 101 +#define CIPHER_R_BAD_KEY_LENGTH 102 +#define CIPHER_R_BUFFER_TOO_SMALL 103 +#define CIPHER_R_CTRL_NOT_IMPLEMENTED 104 +#define CIPHER_R_CTRL_OPERATION_NOT_IMPLEMENTED 105 +#define CIPHER_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 106 +#define CIPHER_R_INITIALIZATION_ERROR 107 +#define CIPHER_R_INPUT_NOT_INITIALIZED 108 +#define CIPHER_R_INVALID_AD_SIZE 109 +#define CIPHER_R_INVALID_KEY_LENGTH 110 +#define CIPHER_R_INVALID_NONCE_SIZE 111 +#define CIPHER_R_INVALID_OPERATION 112 +#define CIPHER_R_IV_TOO_LARGE 113 +#define CIPHER_R_NO_CIPHER_SET 114 +#define CIPHER_R_OUTPUT_ALIASES_INPUT 115 +#define CIPHER_R_TAG_TOO_LARGE 116 +#define CIPHER_R_TOO_LARGE 117 +#define CIPHER_R_UNSUPPORTED_AD_SIZE 118 +#define CIPHER_R_UNSUPPORTED_INPUT_SIZE 119 +#define CIPHER_R_UNSUPPORTED_KEY_SIZE 120 +#define CIPHER_R_UNSUPPORTED_NONCE_SIZE 121 +#define CIPHER_R_UNSUPPORTED_TAG_SIZE 122 +#define CIPHER_R_WRONG_FINAL_BLOCK_LENGTH 123 +#define CIPHER_R_NO_DIRECTION_SET 124 + +#endif /* OPENSSL_HEADER_CIPHER_H */ diff --git a/phonelibs/boringssl/include/openssl/cmac.h b/phonelibs/boringssl/include/openssl/cmac.h new file mode 100644 index 00000000000000..183f41bca05630 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/cmac.h @@ -0,0 +1,76 @@ +/* Copyright (c) 2015, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_CMAC_H +#define OPENSSL_HEADER_CMAC_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* CMAC. + * + * CMAC is a MAC based on AES-CBC and defined in + * https://tools.ietf.org/html/rfc4493#section-2.3. */ + + +/* One-shot functions. */ + +/* AES_CMAC calculates the 16-byte, CMAC authenticator of |in_len| bytes of + * |in| and writes it to |out|. The |key_len| may be 16 or 32 bytes to select + * between AES-128 and AES-256. It returns one on success or zero on error. */ +OPENSSL_EXPORT int AES_CMAC(uint8_t out[16], const uint8_t *key, size_t key_len, + const uint8_t *in, size_t in_len); + + +/* Incremental interface. */ + +/* CMAC_CTX_new allocates a fresh |CMAC_CTX| and returns it, or NULL on + * error. */ +OPENSSL_EXPORT CMAC_CTX *CMAC_CTX_new(void); + +/* CMAC_CTX_free frees a |CMAC_CTX|. */ +OPENSSL_EXPORT void CMAC_CTX_free(CMAC_CTX *ctx); + +/* CMAC_Init configures |ctx| to use the given |key| and |cipher|. The CMAC RFC + * only specifies the use of AES-128 thus |key_len| should be 16 and |cipher| + * should be |EVP_aes_128_cbc()|. However, this implementation also supports + * AES-256 by setting |key_len| to 32 and |cipher| to |EVP_aes_256_cbc()|. The + * |engine| argument is ignored. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t key_len, + const EVP_CIPHER *cipher, ENGINE *engine); + + +/* CMAC_Reset resets |ctx| so that a fresh message can be authenticated. */ +OPENSSL_EXPORT int CMAC_Reset(CMAC_CTX *ctx); + +/* CMAC_Update processes |in_len| bytes of message from |in|. It returns one on + * success or zero on error. */ +OPENSSL_EXPORT int CMAC_Update(CMAC_CTX *ctx, const uint8_t *in, size_t in_len); + +/* CMAC_Final sets |*out_len| to 16 and, if |out| is not NULL, writes 16 bytes + * of authenticator to it. It returns one on success or zero on error. */ +OPENSSL_EXPORT int CMAC_Final(CMAC_CTX *ctx, uint8_t *out, size_t *out_len); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_CBC_H */ diff --git a/phonelibs/boringssl/include/openssl/conf.h b/phonelibs/boringssl/include/openssl/conf.h new file mode 100644 index 00000000000000..84fc94f99e5b63 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/conf.h @@ -0,0 +1,149 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_CONF_H +#define OPENSSL_HEADER_CONF_H + +#include + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Config files look like: + * + * # Comment + * + * # This key is in the default section. + * key=value + * + * [section_name] + * key2=value2 + * + * Config files are representated by a |CONF|. */ + +struct conf_value_st { + char *section; + char *name; + char *value; +}; + +struct conf_st { + LHASH_OF(CONF_VALUE) *data; +}; + + +/* NCONF_new returns a fresh, empty |CONF|, or NULL on error. The |method| + * argument must be NULL. */ +CONF *NCONF_new(void *method); + +/* NCONF_free frees all the data owned by |conf| and then |conf| itself. */ +void NCONF_free(CONF *conf); + +/* NCONF_load parses the file named |filename| and adds the values found to + * |conf|. It returns one on success and zero on error. In the event of an + * error, if |out_error_line| is not NULL, |*out_error_line| is set to the + * number of the line that contained the error. */ +int NCONF_load(CONF *conf, const char *filename, long *out_error_line); + +/* NCONF_load_bio acts like |NCONF_load| but reads from |bio| rather than from + * a named file. */ +int NCONF_load_bio(CONF *conf, BIO *bio, long *out_error_line); + +/* NCONF_get_section returns a stack of values for a given section in |conf|. + * If |section| is NULL, the default section is returned. It returns NULL on + * error. */ +STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section); + +/* NCONF_get_string returns the value of the key |name|, in section |section|. + * The |section| argument may be NULL to indicate the default section. It + * returns the value or NULL on error. */ +const char *NCONF_get_string(const CONF *conf, const char *section, + const char *name); + + +/* Utility functions */ + +/* CONF_parse_list takes a list separated by 'sep' and calls |list_cb| giving + * the start and length of each member, optionally stripping leading and + * trailing whitespace. This can be used to parse comma separated lists for + * example. If |list_cb| returns <= 0, then the iteration is halted and that + * value is returned immediately. Otherwise it returns one. Note that |list_cb| + * may be called on an empty member. */ +int CONF_parse_list(const char *list, char sep, int remove_whitespace, + int (*list_cb)(const char *elem, int len, void *usr), + void *arg); + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define CONF_F_CONF_parse_list 100 +#define CONF_F_NCONF_load 101 +#define CONF_F_def_load_bio 102 +#define CONF_F_str_copy 103 +#define CONF_R_LIST_CANNOT_BE_NULL 100 +#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 101 +#define CONF_R_MISSING_EQUAL_SIGN 102 +#define CONF_R_NO_CLOSE_BRACE 103 +#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 104 +#define CONF_R_VARIABLE_HAS_NO_VALUE 105 + +#endif /* OPENSSL_HEADER_THREAD_H */ diff --git a/phonelibs/boringssl/include/openssl/cpu.h b/phonelibs/boringssl/include/openssl/cpu.h new file mode 100644 index 00000000000000..83ec473fabcb8f --- /dev/null +++ b/phonelibs/boringssl/include/openssl/cpu.h @@ -0,0 +1,121 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + +#ifndef OPENSSL_HEADER_CPU_H +#define OPENSSL_HEADER_CPU_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Runtime CPU feature support */ + + +#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64) +/* OPENSSL_ia32cap_P contains the Intel CPUID bits when running on an x86 or + * x86-64 system. + * + * Index 0: + * EDX for CPUID where EAX = 1 + * Bit 30 is used to indicate an Intel CPU + * Index 1: + * ECX for CPUID where EAX = 1 + * Index 2: + * EBX for CPUID where EAX = 7 + * + * Note: the CPUID bits are pre-adjusted for the OSXSAVE bit and the YMM and XMM + * bits in XCR0, so it is not necessary to check those. */ +extern uint32_t OPENSSL_ia32cap_P[4]; +#endif + +#if defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64) +/* CRYPTO_is_NEON_capable returns true if the current CPU has a NEON unit. Note + * that |OPENSSL_armcap_P| also exists and contains the same information in a + * form that's easier for assembly to use. */ +OPENSSL_EXPORT char CRYPTO_is_NEON_capable(void); + +/* CRYPTO_set_NEON_capable sets the return value of |CRYPTO_is_NEON_capable|. + * By default, unless the code was compiled with |-mfpu=neon|, NEON is assumed + * not to be present. It is not autodetected. Calling this with a zero + * argument also causes |CRYPTO_is_NEON_functional| to return false. */ +OPENSSL_EXPORT void CRYPTO_set_NEON_capable(char neon_capable); + +/* CRYPTO_is_NEON_functional returns true if the current CPU has a /working/ + * NEON unit. Some phones have a NEON unit, but the Poly1305 NEON code causes + * it to fail. See https://code.google.com/p/chromium/issues/detail?id=341598 */ +OPENSSL_EXPORT char CRYPTO_is_NEON_functional(void); + +/* CRYPTO_set_NEON_functional sets the "NEON functional" flag. For + * |CRYPTO_is_NEON_functional| to return true, both this flag and the NEON flag + * must be true. By default NEON is assumed to be functional if the code was + * compiled with |-mfpu=neon| or if |CRYPTO_set_NEON_capable| has been called + * with a non-zero argument. */ +OPENSSL_EXPORT void CRYPTO_set_NEON_functional(char neon_functional); +#endif /* OPENSSL_ARM */ + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_CPU_H */ diff --git a/phonelibs/boringssl/include/openssl/crypto.h b/phonelibs/boringssl/include/openssl/crypto.h new file mode 100644 index 00000000000000..3af1547d87ebbc --- /dev/null +++ b/phonelibs/boringssl/include/openssl/crypto.h @@ -0,0 +1,63 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_CRYPTO_H +#define OPENSSL_HEADER_CRYPTO_H + +#include + +/* Upstream OpenSSL defines |OPENSSL_malloc|, etc., in crypto.h rather than + * mem.h. */ +#include + + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* crypto.h contains functions for initializing the crypto library. */ + + +/* CRYPTO_library_init initializes the crypto library. It must be called if the + * library is built with BORINGSSL_NO_STATIC_INITIALIZER. Otherwise, it does + * nothing and a static initializer is used instead. */ +OPENSSL_EXPORT void CRYPTO_library_init(void); + + +/* Deprecated functions. */ + +#define OPENSSL_VERSION_TEXT "BoringSSL" + +#define SSLEAY_VERSION 0 + +/* SSLeay_version is a compatibility function that returns the string + * "BoringSSL". */ +OPENSSL_EXPORT const char *SSLeay_version(int unused); + +/* SSLeay is a compatibility function that returns OPENSSL_VERSION_NUMBER from + * base.h. */ +OPENSSL_EXPORT unsigned long SSLeay(void); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define CRYPTO_F_CRYPTO_get_ex_new_index 100 +#define CRYPTO_F_CRYPTO_set_ex_data 101 +#define CRYPTO_F_get_class 102 +#define CRYPTO_F_get_func_pointers 103 + +#endif /* OPENSSL_HEADER_CRYPTO_H */ diff --git a/phonelibs/boringssl/include/openssl/des.h b/phonelibs/boringssl/include/openssl/des.h new file mode 100644 index 00000000000000..6e1b0cfe5f76da --- /dev/null +++ b/phonelibs/boringssl/include/openssl/des.h @@ -0,0 +1,149 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_DES_H +#define OPENSSL_HEADER_DES_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* DES. */ + + +typedef struct DES_cblock_st { + uint8_t bytes[8]; +} DES_cblock; + +typedef struct DES_ks { + union { + DES_cblock cblock; + /* make sure things are correct size on machines with + * 8 byte longs */ + uint32_t deslong[2]; + } ks[16]; +} DES_key_schedule; + + +#define DES_KEY_SZ (sizeof(DES_cblock)) +#define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) + +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#define DES_CBC_MODE 0 +#define DES_PCBC_MODE 1 + +/* DES_set_key performs a key schedule and initialises |schedule| with |key|. */ +OPENSSL_EXPORT void DES_set_key(const DES_cblock *key, + DES_key_schedule *schedule); + +/* DES_set_odd_parity sets the parity bits (the least-significant bits in each + * byte) of |key| given the other bits in each byte. */ +OPENSSL_EXPORT void DES_set_odd_parity(DES_cblock *key); + +/* DES_ecb_encrypt encrypts (or decrypts, if |is_encrypt| is |DES_DECRYPT|) a + * single DES block (8 bytes) from in to out, using the key configured in + * |schedule|. */ +OPENSSL_EXPORT void DES_ecb_encrypt(const DES_cblock *in, DES_cblock *out, + const DES_key_schedule *schedule, + int is_encrypt); + +/* DES_ncbc_encrypt encrypts (or decrypts, if |enc| is |DES_DECRYPT|) |len| + * bytes from |in| to |out| with DES in CBC mode. */ +OPENSSL_EXPORT void DES_ncbc_encrypt(const uint8_t *in, uint8_t *out, + size_t len, + const DES_key_schedule *schedule, + DES_cblock *ivec, int enc); + +/* DES_ecb3_encrypt encrypts (or decrypts, if |enc| is |DES_DECRYPT|) a single + * block (8 bytes) of data from |input| to |output| using 3DES. */ +OPENSSL_EXPORT void DES_ecb3_encrypt(const DES_cblock *input, + DES_cblock *output, + const DES_key_schedule *ks1, + const DES_key_schedule *ks2, + const DES_key_schedule *ks3, + int enc); + +/* DES_ede3_cbc_encrypt encrypts (or decrypts, if |enc| is |DES_DECRYPT|) |len| + * bytes from |in| to |out| with 3DES in CBC mode. 3DES uses three keys, thus + * the function takes three different |DES_key_schedule|s. */ +OPENSSL_EXPORT void DES_ede3_cbc_encrypt(const uint8_t *in, uint8_t *out, + size_t len, + const DES_key_schedule *ks1, + const DES_key_schedule *ks2, + const DES_key_schedule *ks3, + DES_cblock *ivec, int enc); + +/* DES_ede2_cbc_encrypt encrypts (or decrypts, if |enc| is |DES_DECRYPT|) |len| + * bytes from |in| to |out| with 3DES in CBC mode. With this keying option, the + * first and third 3DES keys are identical. Thus, this function takes only two + * different |DES_key_schedule|s. */ +OPENSSL_EXPORT void DES_ede2_cbc_encrypt(const uint8_t *in, uint8_t *out, + size_t len, + const DES_key_schedule *ks1, + const DES_key_schedule *ks2, + DES_cblock *ivec, int enc); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_DES_H */ diff --git a/phonelibs/boringssl/include/openssl/dh.h b/phonelibs/boringssl/include/openssl/dh.h new file mode 100644 index 00000000000000..17574d51edf5b1 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/dh.h @@ -0,0 +1,274 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_DH_H +#define OPENSSL_HEADER_DH_H + +#include + +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* DH contains functions for performing Diffie-Hellman key agreement in + * multiplicative groups. */ + + +/* Allocation and destruction. */ + +/* DH_new returns a new, empty DH object or NULL on error. */ +OPENSSL_EXPORT DH *DH_new(void); + +/* DH_new_method acts the same as |DH_new| but takes an explicit |ENGINE|. */ +OPENSSL_EXPORT DH *DH_new_method(const ENGINE *engine); + +/* DH_free decrements the reference count of |dh| and frees it if the reference + * count drops to zero. */ +OPENSSL_EXPORT void DH_free(DH *dh); + +/* DH_up_ref increments the reference count of |dh|. */ +OPENSSL_EXPORT int DH_up_ref(DH *dh); + + +/* Standard parameters. + * + * These functions return new DH objects with standard parameters configured + * that use the given ENGINE, which may be NULL. They return NULL on allocation + * failure. */ + +/* These parameters are taken from RFC 5114. */ + +OPENSSL_EXPORT DH *DH_get_1024_160(const ENGINE *engine); +OPENSSL_EXPORT DH *DH_get_2048_224(const ENGINE *engine); +OPENSSL_EXPORT DH *DH_get_2048_256(const ENGINE *engine); + + +/* Parameter generation. */ + +#define DH_GENERATOR_2 2 +#define DH_GENERATOR_5 5 + +/* DH_generate_parameters_ex generates a suitable Diffie-Hellman group with a + * prime that is |prime_bits| long and stores it in |dh|. The generator of the + * group will be |generator|, which should be |DH_GENERATOR_2| unless there's a + * good reason to use a different value. The |cb| argument contains a callback + * function that will be called during the generation. See the documentation in + * |bn.h| about this. In addition to the callback invocations from |BN|, |cb| + * will also be called with |event| equal to three when the generation is + * complete. */ +OPENSSL_EXPORT int DH_generate_parameters_ex(DH *dh, int prime_bits, + int generator, BN_GENCB *cb); + + +/* Diffie-Hellman operations. */ + +/* DH_generate_key generates a new, random, private key and stores it in + * |dh|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int DH_generate_key(DH *dh); + +/* DH_compute_key calculates the shared key between |dh| and |peers_key| and + * writes it as a big-endian integer into |out|, which must have |DH_size| + * bytes of space. It returns the number of bytes written, or a negative number + * on error. */ +OPENSSL_EXPORT int DH_compute_key(uint8_t *out, const BIGNUM *peers_key, + DH *dh); + + +/* Utility functions. */ + +/* DH_size returns the number of bytes in the DH group's prime. */ +OPENSSL_EXPORT int DH_size(const DH *dh); + +/* DH_num_bits returns the minimum number of bits needed to represent the + * absolute value of the DH group's prime. */ +OPENSSL_EXPORT unsigned DH_num_bits(const DH *dh); + +#define DH_CHECK_P_NOT_PRIME 0x01 +#define DH_CHECK_P_NOT_SAFE_PRIME 0x02 +#define DH_CHECK_UNABLE_TO_CHECK_GENERATOR 0x04 +#define DH_CHECK_NOT_SUITABLE_GENERATOR 0x08 +#define DH_CHECK_Q_NOT_PRIME 0x10 +#define DH_CHECK_INVALID_Q_VALUE 0x20 +#define DH_CHECK_INVALID_J_VALUE 0x40 + +/* These are compatibility defines. */ +#define DH_NOT_SUITABLE_GENERATOR DH_CHECK_NOT_SUITABLE_GENERATOR +#define DH_UNABLE_TO_CHECK_GENERATOR DH_CHECK_UNABLE_TO_CHECK_GENERATOR + +/* DH_check checks the suitability of |dh| as a Diffie-Hellman group. and sets + * |DH_CHECK_*| flags in |*out_flags| if it finds any errors. It returns one if + * |*out_flags| was successfully set and zero on error. + * + * Note: these checks may be quite computationally expensive. */ +OPENSSL_EXPORT int DH_check(const DH *dh, int *out_flags); + +#define DH_CHECK_PUBKEY_TOO_SMALL 1 +#define DH_CHECK_PUBKEY_TOO_LARGE 2 + +/* DH_check_pub_key checks the suitability of |pub_key| as a public key for the + * DH group in |dh| and sets |DH_CHECK_PUBKEY_*| flags in |*out_flags| if it + * finds any errors. It returns one if |*out_flags| was successfully set and + * zero on error. */ +OPENSSL_EXPORT int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, + int *out_flags); + +/* DHparams_dup allocates a fresh |DH| and copies the parameters from |dh| into + * it. It returns the new |DH| or NULL on error. */ +OPENSSL_EXPORT DH *DHparams_dup(const DH *dh); + + +/* ASN.1 functions. */ + +/* d2i_DHparams parses an ASN.1, DER encoded Diffie-Hellman parameters + * structure from |len| bytes at |*inp|. If |ret| is not NULL then, on exit, a + * pointer to the result is in |*ret|. If |*ret| is already non-NULL on entry + * then the result is written directly into |*ret|, otherwise a fresh |DH| is + * allocated. On successful exit, |*inp| is advanced past the DER structure. It + * returns the result or NULL on error. */ +OPENSSL_EXPORT DH *d2i_DHparams(DH **ret, const unsigned char **inp, long len); + +/* i2d_DHparams marshals |in| to an ASN.1, DER structure. If |outp| is not NULL + * then the result is written to |*outp| and |*outp| is advanced just past the + * output. It returns the number of bytes in the result, whether written or + * not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_DHparams(const DH *in, unsigned char **outp); + + +/* ex_data functions. + * + * See |ex_data.h| for details. */ + +OPENSSL_EXPORT int DH_get_ex_new_index(long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +OPENSSL_EXPORT int DH_set_ex_data(DH *d, int idx, void *arg); +OPENSSL_EXPORT void *DH_get_ex_data(DH *d, int idx); + + +/* dh_method contains function pointers to override the implementation of DH. + * See |engine.h| for details. */ +struct dh_method { + struct openssl_method_common_st common; + + /* app_data is an opaque pointer for the method to use. */ + void *app_data; + + /* init is called just before the return of |DH_new_method|. It returns one + * on success or zero on error. */ + int (*init)(DH *dh); + + /* finish is called before |dh| is destructed. */ + void (*finish)(DH *dh); + + /* generate_parameters is called by |DH_generate_parameters_ex|. */ + int (*generate_parameters)(DH *dh, int prime_bits, int generator, + BN_GENCB *cb); + + /* generate_parameters is called by |DH_generate_key|. */ + int (*generate_key)(DH *dh); + + /* compute_key is called by |DH_compute_key|. */ + int (*compute_key)(DH *dh, uint8_t *out, const BIGNUM *pub_key); +}; + +struct dh_st { + DH_METHOD *meth; + + BIGNUM *p; + BIGNUM *g; + BIGNUM *pub_key; /* g^x */ + BIGNUM *priv_key; /* x */ + + /* priv_length contains the length, in bits, of the private value. If zero, + * the private value will be the same length as |p|. */ + unsigned priv_length; + + CRYPTO_MUTEX method_mont_p_lock; + BN_MONT_CTX *method_mont_p; + + /* Place holders if we want to do X9.42 DH */ + BIGNUM *q; + BIGNUM *j; + unsigned char *seed; + int seedlen; + BIGNUM *counter; + + int flags; + CRYPTO_refcount_t references; + CRYPTO_EX_DATA ex_data; +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define DH_F_DH_new_method 100 +#define DH_F_compute_key 101 +#define DH_F_generate_key 102 +#define DH_F_generate_parameters 103 +#define DH_R_BAD_GENERATOR 100 +#define DH_R_INVALID_PUBKEY 101 +#define DH_R_MODULUS_TOO_LARGE 102 +#define DH_R_NO_PRIVATE_VALUE 103 + +#endif /* OPENSSL_HEADER_DH_H */ diff --git a/phonelibs/boringssl/include/openssl/digest.h b/phonelibs/boringssl/include/openssl/digest.h new file mode 100644 index 00000000000000..2ea4ec4d7d3dda --- /dev/null +++ b/phonelibs/boringssl/include/openssl/digest.h @@ -0,0 +1,265 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_DIGEST_H +#define OPENSSL_HEADER_DIGEST_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Digest functions. + * + * An EVP_MD abstracts the details of a specific hash function allowing code to + * deal with the concept of a "hash function" without needing to know exactly + * which hash function it is. */ + + +/* Hash algorithms. + * + * The following functions return |EVP_MD| objects that implement the named hash + * function. */ + +OPENSSL_EXPORT const EVP_MD *EVP_md4(void); +OPENSSL_EXPORT const EVP_MD *EVP_md5(void); +OPENSSL_EXPORT const EVP_MD *EVP_sha1(void); +OPENSSL_EXPORT const EVP_MD *EVP_sha224(void); +OPENSSL_EXPORT const EVP_MD *EVP_sha256(void); +OPENSSL_EXPORT const EVP_MD *EVP_sha384(void); +OPENSSL_EXPORT const EVP_MD *EVP_sha512(void); + +/* EVP_md5_sha1 is a TLS-specific |EVP_MD| which computes the concatenation of + * MD5 and SHA-1, as used in TLS 1.1 and below. */ +OPENSSL_EXPORT const EVP_MD *EVP_md5_sha1(void); + +/* EVP_get_digestbynid returns an |EVP_MD| for the given NID, or NULL if no + * such digest is known. */ +OPENSSL_EXPORT const EVP_MD *EVP_get_digestbynid(int nid); + +/* EVP_get_digestbyobj returns an |EVP_MD| for the given |ASN1_OBJECT|, or NULL + * if no such digest is known. */ +OPENSSL_EXPORT const EVP_MD *EVP_get_digestbyobj(const ASN1_OBJECT *obj); + + +/* Digest contexts. + * + * An EVP_MD_CTX represents the state of a specific digest operation in + * progress. */ + +/* EVP_MD_CTX_init initialises an, already allocated, |EVP_MD_CTX|. */ +OPENSSL_EXPORT void EVP_MD_CTX_init(EVP_MD_CTX *ctx); + +/* EVP_MD_CTX_create allocates and initialises a fresh |EVP_MD_CTX| and returns + * it, or NULL on allocation failure. */ +OPENSSL_EXPORT EVP_MD_CTX *EVP_MD_CTX_create(void); + +/* EVP_MD_CTX_cleanup frees any resources owned by |ctx| and resets it to a + * freshly initialised state. It does not free |ctx| itself. It returns one. */ +OPENSSL_EXPORT int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); + +/* EVP_MD_CTX_destroy calls |EVP_MD_CTX_cleanup| and then frees |ctx| itself. */ +OPENSSL_EXPORT void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); + +/* EVP_MD_CTX_copy_ex sets |out|, which must already be initialised, to be a + * copy of |in|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); + + +/* Digest operations. */ + +/* EVP_DigestInit_ex configures |ctx|, which must already have been + * initialised, for a fresh hashing operation using |type|. It returns one on + * success and zero otherwise. */ +OPENSSL_EXPORT int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, + ENGINE *engine); + +/* EVP_DigestInit acts like |EVP_DigestInit_ex| except that |ctx| is + * initialised before use. */ +OPENSSL_EXPORT int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); + +/* EVP_DigestUpdate hashes |len| bytes from |data| into the hashing operation + * in |ctx|. It returns one. */ +OPENSSL_EXPORT int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, + size_t len); + +/* EVP_MAX_MD_SIZE is the largest digest size supported. Functions that output + * a digest generally require the buffer have at least this much space. */ +#define EVP_MAX_MD_SIZE 64 /* SHA-512 is the longest so far. */ + +/* EVP_DigestFinal_ex finishes the digest in |ctx| and writes the output to + * |md_out|. At most |EVP_MAX_MD_SIZE| bytes are written. If |out_size| is not + * NULL then |*out_size| is set to the number of bytes written. It returns one. + * After this call, the hash cannot be updated or finished again until + * |EVP_DigestInit_ex| is called to start another hashing operation. */ +OPENSSL_EXPORT int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, uint8_t *md_out, + unsigned int *out_size); + +/* EVP_DigestFinal acts like |EVP_DigestFinal_ex| except that + * |EVP_MD_CTX_cleanup| is called on |ctx| before returning. */ +OPENSSL_EXPORT int EVP_DigestFinal(EVP_MD_CTX *ctx, uint8_t *md_out, + unsigned int *out_size); + +/* EVP_Digest performs a complete hashing operation in one call. It hashes + * |len| bytes from |data| and writes the digest to |md_out|. At most + * |EVP_MAX_MD_SIZE| bytes are written. If |out_size| is not NULL then + * |*out_size| is set to the number of bytes written. It returns one on success + * and zero otherwise. */ +OPENSSL_EXPORT int EVP_Digest(const void *data, size_t len, uint8_t *md_out, + unsigned int *md_out_size, const EVP_MD *type, + ENGINE *impl); + + +/* Digest function accessors. + * + * These functions allow code to learn details about an abstract hash + * function. */ + +/* EVP_MD_type returns a NID identifing |md|. (For example, |NID_sha256|.) */ +OPENSSL_EXPORT int EVP_MD_type(const EVP_MD *md); + +/* EVP_MD_flags returns the flags for |md|, which is a set of |EVP_MD_FLAG_*| + * values, ORed together. */ +OPENSSL_EXPORT uint32_t EVP_MD_flags(const EVP_MD *md); + +/* EVP_MD_size returns the digest size of |md|, in bytes. */ +OPENSSL_EXPORT size_t EVP_MD_size(const EVP_MD *md); + +/* EVP_MD_block_size returns the native block-size of |md|. */ +OPENSSL_EXPORT size_t EVP_MD_block_size(const EVP_MD *md); + +/* EVP_MD_FLAG_PKEY_DIGEST indicates the the digest function is used with a + * specific public key in order to verify signatures. (For example, + * EVP_dss1.) */ +#define EVP_MD_FLAG_PKEY_DIGEST 1 + +/* EVP_MD_FLAG_DIGALGID_ABSENT indicates that the parameter type in an X.509 + * DigestAlgorithmIdentifier representing this digest function should be + * undefined rather than NULL. */ +#define EVP_MD_FLAG_DIGALGID_ABSENT 2 + + +/* Deprecated functions. */ + +/* EVP_MD_CTX_copy sets |out|, which must /not/ be initialised, to be a copy of + * |in|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); + +/* EVP_add_digest does nothing and returns one. It exists only for + * compatibility with OpenSSL. */ +OPENSSL_EXPORT int EVP_add_digest(const EVP_MD *digest); + +/* EVP_get_cipherbyname returns an |EVP_MD| given a human readable name in + * |name|, or NULL if the name is unknown. */ +OPENSSL_EXPORT const EVP_MD *EVP_get_digestbyname(const char *); + + +/* Digest operation accessors. */ + +/* EVP_MD_CTX_md returns the underlying digest function, or NULL if one has not + * been set. */ +OPENSSL_EXPORT const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); + +/* EVP_MD_CTX_size returns the digest size of |ctx|. It will crash if a digest + * hasn't been set on |ctx|. */ +OPENSSL_EXPORT unsigned EVP_MD_CTX_size(const EVP_MD_CTX *ctx); + +/* EVP_MD_CTX_block_size returns the block size of the digest function used by + * |ctx|. It will crash if a digest hasn't been set on |ctx|. */ +OPENSSL_EXPORT unsigned EVP_MD_CTX_block_size(const EVP_MD_CTX *ctx); + +/* EVP_MD_CTX_type returns a NID describing the digest function used by |ctx|. + * (For example, |NID_sha256|.) It will crash if a digest hasn't been set on + * |ctx|. */ +OPENSSL_EXPORT int EVP_MD_CTX_type(const EVP_MD_CTX *ctx); + + +struct evp_md_pctx_ops; + +struct env_md_ctx_st { + /* digest is the underlying digest function, or NULL if not set. */ + const EVP_MD *digest; + /* flags is the OR of a number of |EVP_MD_CTX_FLAG_*| values. */ + uint32_t flags; + /* md_data points to a block of memory that contains the hash-specific + * context. */ + void *md_data; + /* update is usually copied from |digest->update| but can differ in some + * cases, i.e. HMAC. + * TODO(davidben): Remove this hook once |EVP_PKEY_HMAC| is gone. */ + void (*update)(EVP_MD_CTX *ctx, const void *data, size_t count); + + /* pctx is an opaque (at this layer) pointer to additional context that + * EVP_PKEY functions may store in this object. */ + EVP_PKEY_CTX *pctx; + + /* pctx_ops, if not NULL, points to a vtable that contains functions to + * manipulate |pctx|. */ + const struct evp_md_pctx_ops *pctx_ops; +} /* EVP_MD_CTX */; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define DIGEST_F_EVP_DigestInit_ex 100 +#define DIGEST_F_EVP_MD_CTX_copy_ex 101 +#define DIGEST_R_INPUT_NOT_INITIALIZED 100 + +#endif /* OPENSSL_HEADER_DIGEST_H */ diff --git a/phonelibs/boringssl/include/openssl/dsa.h b/phonelibs/boringssl/include/openssl/dsa.h new file mode 100644 index 00000000000000..7274e4c8c90d29 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/dsa.h @@ -0,0 +1,379 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + * + * The DSS routines are based on patches supplied by + * Steven Schoch . */ + +#ifndef OPENSSL_HEADER_DSA_H +#define OPENSSL_HEADER_DSA_H + +#include + +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* DSA contains functions for signing and verifing with the Digital Signature + * Algorithm. */ + + +/* Allocation and destruction. */ + +/* DSA_new returns a new, empty DSA object or NULL on error. */ +OPENSSL_EXPORT DSA *DSA_new(void); + +/* DSA_new_method acts the same as |DH_new| but takes an explicit |ENGINE|. */ +OPENSSL_EXPORT DSA *DSA_new_method(const ENGINE *engine); + +/* DSA_free decrements the reference count of |dsa| and frees it if the + * reference count drops to zero. */ +OPENSSL_EXPORT void DSA_free(DSA *dsa); + +/* DSA_up_ref increments the reference count of |dsa|. */ +OPENSSL_EXPORT int DSA_up_ref(DSA *dsa); + + +/* Parameter generation. */ + +/* DSA_generate_parameters_ex generates a set of DSA parameters by following + * the procedure given in FIPS 186-4, appendix A. + * (http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf) + * + * The larger prime will have a length of |bits| (e.g. 2048). The |seed| value + * allows others to generate and verify the same parameters and should be + * random input which is kept for reference. If |out_counter| or |out_h| are + * not NULL then the counter and h value used in the generation are written to + * them. + * + * The |cb| argument is passed to |BN_generate_prime_ex| and is thus called + * during the generation process in order to indicate progress. See the + * comments for that function for details. In addition to the calls made by + * |BN_generate_prime_ex|, |DSA_generate_parameters_ex| will call it with + * |event| equal to 2 and 3 at different stages of the process. + * + * It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int DSA_generate_parameters_ex(DSA *dsa, unsigned bits, + const uint8_t *seed, + size_t seed_len, int *out_counter, + unsigned long *out_h, + BN_GENCB *cb); + +/* DSAparams_dup returns a freshly allocated |DSA| that contains a copy of the + * parameters from |dsa|. It returns NULL on error. */ +OPENSSL_EXPORT DSA *DSAparams_dup(const DSA *dsa); + + +/* Key generation. */ + +/* DSA_generate_key generates a public/private key pair in |dsa|, which must + * already have parameters setup. It returns one on success and zero on + * error. */ +OPENSSL_EXPORT int DSA_generate_key(DSA *dsa); + + +/* Signatures. */ + +/* DSA_SIG contains a DSA signature as a pair of integers. */ +typedef struct DSA_SIG_st { + BIGNUM *r, *s; +} DSA_SIG; + +/* DSA_SIG_new returns a freshly allocated, DIG_SIG structure or NULL on error. + * Both |r| and |s| in the signature will be NULL. */ +OPENSSL_EXPORT DSA_SIG *DSA_SIG_new(void); + +/* DSA_SIG_free frees the contents of |sig| and then frees |sig| itself. */ +OPENSSL_EXPORT void DSA_SIG_free(DSA_SIG *sig); + +/* DSA_do_sign returns a signature of the hash in |digest| by the key in |dsa| + * and returns an allocated, DSA_SIG structure, or NULL on error. */ +OPENSSL_EXPORT DSA_SIG *DSA_do_sign(const uint8_t *digest, size_t digest_len, + DSA *dsa); + +/* DSA_do_verify verifies that |sig| is a valid signature, by the public key in + * |dsa|, of the hash in |digest|. It returns one if so, zero if invalid and -1 + * on error. + * + * WARNING: do not use. This function returns -1 for error, 0 for invalid and 1 + * for valid. However, this is dangerously different to the usual OpenSSL + * convention and could be a disaster if a user did |if (DSA_do_verify(...))|. + * Because of this, |DSA_check_signature| is a safer version of this. + * + * TODO(fork): deprecate. */ +OPENSSL_EXPORT int DSA_do_verify(const uint8_t *digest, size_t digest_len, + DSA_SIG *sig, const DSA *dsa); + +/* DSA_do_check_signature sets |*out_valid| to zero. Then it verifies that |sig| + * is a valid signature, by the public key in |dsa| of the hash in |digest| + * and, if so, it sets |*out_valid| to one. + * + * It returns one if it was able to verify the signature as valid or invalid, + * and zero on error. */ +OPENSSL_EXPORT int DSA_do_check_signature(int *out_valid, const uint8_t *digest, + size_t digest_len, DSA_SIG *sig, + const DSA *dsa); + + +/* ASN.1 signatures. + * + * These functions also perform DSA signature operations, but deal with ASN.1 + * encoded signatures as opposed to raw |BIGNUM|s. If you don't know what + * encoding a DSA signature is in, it's probably ASN.1. */ + +/* DSA_sign signs |digest| with the key in |dsa| and writes the resulting + * signature, in ASN.1 form, to |out_sig| and the length of the signature to + * |*out_siglen|. There must be, at least, |DSA_size(dsa)| bytes of space in + * |out_sig|. It returns one on success and zero otherwise. + * + * (The |type| argument is ignored.) */ +OPENSSL_EXPORT int DSA_sign(int type, const uint8_t *digest, size_t digest_len, + uint8_t *out_sig, unsigned int *out_siglen, + DSA *dsa); + +/* DSA_verify verifies that |sig| is a valid, ASN.1 signature, by the public + * key in |dsa|, of the hash in |digest|. It returns one if so, zero if invalid + * and -1 on error. + * + * (The |type| argument is ignored.) + * + * WARNING: do not use. This function returns -1 for error, 0 for invalid and 1 + * for valid. However, this is dangerously different to the usual OpenSSL + * convention and could be a disaster if a user did |if (DSA_do_verify(...))|. + * Because of this, |DSA_check_signature| is a safer version of this. + * + * TODO(fork): deprecate. */ +OPENSSL_EXPORT int DSA_verify(int type, const uint8_t *digest, + size_t digest_len, const uint8_t *sig, + size_t sig_len, const DSA *dsa); + +/* DSA_check_signature sets |*out_valid| to zero. Then it verifies that |sig| + * is a valid, ASN.1 signature, by the public key in |dsa|, of the hash in + * |digest|. If so, it sets |*out_valid| to one. + * + * It returns one if it was able to verify the signature as valid or invalid, + * and zero on error. */ +OPENSSL_EXPORT int DSA_check_signature(int *out_valid, const uint8_t *digest, + size_t digest_len, const uint8_t *sig, + size_t sig_len, const DSA *dsa); + +/* DSA_size returns the size, in bytes, of an ASN.1 encoded, DSA signature + * generated by |dsa|. Parameters must already have been setup in |dsa|. */ +OPENSSL_EXPORT int DSA_size(const DSA *dsa); + + +/* ASN.1 encoding. */ + +/* d2i_DSA_SIG parses an ASN.1, DER-encoded, DSA signature from |len| bytes at + * |*inp|. If |out_sig| is not NULL then, on exit, a pointer to the result is + * in |*out_sig|. If |*out_sig| is already non-NULL on entry then the result is + * written directly into |*out_sig|, otherwise a fresh |DSA_SIG| is allocated. + * On successful exit, |*inp| is advanced past the DER structure. It returns + * the result or NULL on error. */ +OPENSSL_EXPORT DSA_SIG *d2i_DSA_SIG(DSA_SIG **out_sig, const uint8_t **inp, + long len); + +/* i2d_DSA_SIG marshals |in| to an ASN.1, DER structure. If |outp| is not NULL + * then the result is written to |*outp| and |*outp| is advanced just past the + * output. It returns the number of bytes in the result, whether written or not, + * or a negative value on error. */ +OPENSSL_EXPORT int i2d_DSA_SIG(const DSA_SIG *in, uint8_t **outp); + +/* d2i_DSAPublicKey parses an ASN.1, DER-encoded, DSA public key from |len| + * bytes at |*inp|. If |out| is not NULL then, on exit, a pointer to the result + * is in |*out|. If |*out| is already non-NULL on entry then the result is + * written directly into |*out|, otherwise a fresh |DSA| is allocated. On + * successful exit, |*inp| is advanced past the DER structure. It returns the + * result or NULL on error. */ +OPENSSL_EXPORT DSA *d2i_DSAPublicKey(DSA **out, const uint8_t **inp, long len); + +/* i2d_DSAPublicKey marshals a public key from |in| to an ASN.1, DER structure. + * If |outp| is not NULL then the result is written to |*outp| and |*outp| is + * advanced just past the output. It returns the number of bytes in the result, + * whether written or not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_DSAPublicKey(const DSA *in, unsigned char **outp); + +/* d2i_DSAPrivateKey parses an ASN.1, DER-encoded, DSA private key from |len| + * bytes at |*inp|. If |out| is not NULL then, on exit, a pointer to the result + * is in |*out|. If |*out| is already non-NULL on entry then the result is + * written directly into |*out|, otherwise a fresh |DSA| is allocated. On + * successful exit, |*inp| is advanced past the DER structure. It returns the + * result or NULL on error. */ +OPENSSL_EXPORT DSA *d2i_DSAPrivateKey(DSA **out, const uint8_t **inp, long len); + +/* i2d_DSAPrivateKey marshals a private key from |in| to an ASN.1, DER structure. + * If |outp| is not NULL then the result is written to |*outp| and |*outp| is + * advanced just past the output. It returns the number of bytes in the result, + * whether written or not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_DSAPrivateKey(const DSA *in, unsigned char **outp); + +/* d2i_DSAparams parses ASN.1, DER-encoded, DSA parameters from |len| bytes at + * |*inp|. If |out| is not NULL then, on exit, a pointer to the result is in + * |*out|. If |*out| is already non-NULL on entry then the result is written + * directly into |*out|, otherwise a fresh |DSA| is allocated. On successful + * exit, |*inp| is advanced past the DER structure. It returns the result or + * NULL on error. */ +OPENSSL_EXPORT DSA *d2i_DSAparams(DSA **out, const uint8_t **inp, long len); + +/* i2d_DSAparams marshals DSA parameters from |in| to an ASN.1, DER structure. + * If |outp| is not NULL then the result is written to |*outp| and |*outp| is + * advanced just past the output. It returns the number of bytes in the result, + * whether written or not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_DSAparams(const DSA *in, unsigned char **outp); + + +/* Precomputation. */ + +/* DSA_sign_setup precomputes the message independent part of the DSA signature + * and writes them to |*out_kinv| and |*out_r|. Returns one on success, zero on + * error. + * + * TODO(fork): decide what to do with this. Since making DSA* opaque there's no + * way for the user to install them. Also, it forces the DSA* not to be const + * when passing to the signing function. */ +OPENSSL_EXPORT int DSA_sign_setup(const DSA *dsa, BN_CTX *ctx, + BIGNUM **out_kinv, BIGNUM **out_r); + + +/* Conversion. */ + +/* DSA_dup_DH returns a |DH| constructed from the parameters of |dsa|. This is + * sometimes needed when Diffie-Hellman parameters are stored in the form of + * DSA parameters. It returns an allocated |DH| on success or NULL on error. */ +OPENSSL_EXPORT DH *DSA_dup_DH(const DSA *dsa); + + +/* ex_data functions. + * + * See |ex_data.h| for details. */ + +OPENSSL_EXPORT int DSA_get_ex_new_index(long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +OPENSSL_EXPORT int DSA_set_ex_data(DSA *d, int idx, void *arg); +OPENSSL_EXPORT void *DSA_get_ex_data(const DSA *d, int idx); + + +struct dsa_method { + struct openssl_method_common_st common; + + void *app_data; + + int (*init)(DSA *dsa); + int (*finish)(DSA *dsa); + + DSA_SIG *(*sign)(const uint8_t *digest, size_t digest_len, DSA *dsa); + + int (*sign_setup)(const DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp, + const uint8_t *digest, size_t digest_len); + + int (*verify)(int *out_valid, const uint8_t *digest, size_t digest_len, + DSA_SIG *sig, const DSA *dsa); + + /* generate_parameters, if non-NULL, is used to generate DSA parameters. */ + int (*generate_parameters)(DSA *dsa, unsigned bits, const uint8_t *seed, + size_t seed_len, int *counter_ret, + unsigned long *h_ret, BN_GENCB *cb); + + /* keygen, if non-NULL, is used to generate DSA keys. */ + int (*keygen)(DSA *dsa); +}; + +struct dsa_st { + long version; + int write_params; + BIGNUM *p; + BIGNUM *q; /* == 20 */ + BIGNUM *g; + + BIGNUM *pub_key; /* y public key */ + BIGNUM *priv_key; /* x private key */ + + BIGNUM *kinv; /* Signing pre-calc */ + BIGNUM *r; /* Signing pre-calc */ + + int flags; + /* Normally used to cache montgomery values */ + CRYPTO_MUTEX method_mont_p_lock; + BN_MONT_CTX *method_mont_p; + CRYPTO_refcount_t references; + CRYPTO_EX_DATA ex_data; + DSA_METHOD *meth; + /* functional reference if 'meth' is ENGINE-provided */ + ENGINE *engine; +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define DSA_F_DSA_new_method 100 +#define DSA_F_dsa_sig_cb 101 +#define DSA_F_sign 102 +#define DSA_F_sign_setup 103 +#define DSA_F_verify 104 +#define DSA_R_BAD_Q_VALUE 100 +#define DSA_R_MISSING_PARAMETERS 101 +#define DSA_R_MODULUS_TOO_LARGE 102 +#define DSA_R_NEED_NEW_SETUP_VALUES 103 + +#endif /* OPENSSL_HEADER_DSA_H */ diff --git a/phonelibs/boringssl/include/openssl/dtls1.h b/phonelibs/boringssl/include/openssl/dtls1.h new file mode 100644 index 00000000000000..38ca801cb1044e --- /dev/null +++ b/phonelibs/boringssl/include/openssl/dtls1.h @@ -0,0 +1,16 @@ +/* Copyright (c) 2015, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* This header is provided in order to make compiling against code that expects + OpenSSL easier. */ diff --git a/phonelibs/boringssl/include/openssl/ec.h b/phonelibs/boringssl/include/openssl/ec.h new file mode 100644 index 00000000000000..25b455185e7503 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ec.h @@ -0,0 +1,433 @@ +/* Originally written by Bodo Moeller for the OpenSSL project. + * ==================================================================== + * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the OpenSSL open source + * license provided above. + * + * The elliptic curve binary polynomial software is originally written by + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems + * Laboratories. */ + +#ifndef OPENSSL_HEADER_EC_H +#define OPENSSL_HEADER_EC_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Low-level operations on elliptic curves. */ + + +typedef struct ec_group_st EC_GROUP; +typedef struct ec_point_st EC_POINT; + +/** Enum for the point conversion form as defined in X9.62 (ECDSA) + * for the encoding of a elliptic curve point (x,y) */ +typedef enum { + /** the point is encoded as z||x, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_COMPRESSED = 2, + /** the point is encoded as z||x||y, where z is the octet 0x02 */ + POINT_CONVERSION_UNCOMPRESSED = 4 +} point_conversion_form_t; + + +/* Elliptic curve groups. */ + +/* EC_GROUP_new_by_curve_name returns a fresh EC_GROUP object for the elliptic + * curve specified by |nid|, or NULL on error. + * + * The supported NIDs are: + * NID_secp224r1, + * NID_X9_62_prime256v1, + * NID_secp384r1, + * NID_secp521r1 */ +OPENSSL_EXPORT EC_GROUP *EC_GROUP_new_by_curve_name(int nid); + +/* EC_GROUP_free frees |group| and the data that it points to. */ +OPENSSL_EXPORT void EC_GROUP_free(EC_GROUP *group); + +/* EC_GROUP_dup returns a fresh |EC_GROUP| which is equal to |a| or NULL on + * error. */ +OPENSSL_EXPORT EC_GROUP *EC_GROUP_dup(const EC_GROUP *a); + +/* EC_GROUP_cmp returns zero if |a| and |b| are the same group and non-zero + * otherwise. */ +OPENSSL_EXPORT int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, + BN_CTX *ignored); + +/* EC_GROUP_get0_generator returns a pointer to the internal |EC_POINT| object + * in |group| that specifies the generator for the group. */ +OPENSSL_EXPORT const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); + +/* EC_GROUP_get_order sets |*order| to the order of |group|, if it's not + * NULL. It returns one on success and zero otherwise. |ctx| is ignored. */ +OPENSSL_EXPORT int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, + BN_CTX *ctx); + +/* EC_GROUP_get_cofactor sets |*cofactor| to the cofactor of |group| using + * |ctx|, if it's not NULL. It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int EC_GROUP_get_cofactor(const EC_GROUP *group, + BIGNUM *cofactor, BN_CTX *ctx); + +/* EC_GROUP_get_curve_GFp gets various parameters about a group. It sets + * |*out_p| to the order of the coordinate field and |*out_a| and |*out_b| to + * the parameters of the curve when expressed as y² = x³ + ax + b. Any of the + * output parameters can be NULL. It returns one on success and zero on + * error. */ +OPENSSL_EXPORT int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *out_p, + BIGNUM *out_a, BIGNUM *out_b, + BN_CTX *ctx); + +/* EC_GROUP_get_curve_name returns a NID that identifies |group|. */ +OPENSSL_EXPORT int EC_GROUP_get_curve_name(const EC_GROUP *group); + +/* EC_GROUP_get_degree returns the number of bits needed to represent an + * element of the field underlying |group|. */ +OPENSSL_EXPORT int EC_GROUP_get_degree(const EC_GROUP *group); + +/* EC_GROUP_precompute_mult precomputes multiplies of the generator in order to + * speed up operations that involve calculating generator multiples. It returns + * one on sucess and zero otherwise. If |ctx| is not NULL, it may be used. */ +OPENSSL_EXPORT int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); + +/* EC_GROUP_have_precompute_mult returns one if |group| contains precomputed + * generator multiples. */ +OPENSSL_EXPORT int EC_GROUP_have_precompute_mult(const EC_GROUP *group); + + +/* Points on elliptic curves. */ + +/* EC_POINT_new returns a fresh |EC_POINT| object in the given group, or NULL + * on error. */ +OPENSSL_EXPORT EC_POINT *EC_POINT_new(const EC_GROUP *group); + +/* EC_POINT_free frees |point| and the data that it points to. */ +OPENSSL_EXPORT void EC_POINT_free(EC_POINT *point); + +/* EC_POINT_clear_free clears the data that |point| points to, frees it and + * then frees |point| itself. */ +OPENSSL_EXPORT void EC_POINT_clear_free(EC_POINT *point); + +/* EC_POINT_copy sets |*dest| equal to |*src|. It returns one on success and + * zero otherwise. */ +OPENSSL_EXPORT int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src); + +/* EC_POINT_dup returns a fresh |EC_POINT| that contains the same values as + * |src|, or NULL on error. */ +OPENSSL_EXPORT EC_POINT *EC_POINT_dup(const EC_POINT *src, + const EC_GROUP *group); + +/* EC_POINT_set_to_infinity sets |point| to be the "point at infinity" for the + * given group. */ +OPENSSL_EXPORT int EC_POINT_set_to_infinity(const EC_GROUP *group, + EC_POINT *point); + +/* EC_POINT_is_at_infinity returns one iff |point| is the point at infinity and + * zero otherwise. */ +OPENSSL_EXPORT int EC_POINT_is_at_infinity(const EC_GROUP *group, + const EC_POINT *point); + +/* EC_POINT_is_on_curve returns one if |point| is an element of |group| and + * zero otheriwse. If |ctx| is non-NULL, it may be used. */ +OPENSSL_EXPORT int EC_POINT_is_on_curve(const EC_GROUP *group, + const EC_POINT *point, BN_CTX *ctx); + +/* EC_POINT_cmp returns zero if |a| is equal to |b|, greater than zero is + * non-equal and -1 on error. If |ctx| is not NULL, it may be used. */ +OPENSSL_EXPORT int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, + const EC_POINT *b, BN_CTX *ctx); + +/* EC_POINT_make_affine converts |point| to affine form, internally. It returns + * one on success and zero otherwise. If |ctx| is not NULL, it may be used. */ +OPENSSL_EXPORT int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, + BN_CTX *ctx); + +/* EC_POINTs_make_affine converts |num| points from |points| to affine form, + * internally. It returns one on success and zero otherwise. If |ctx| is not + * NULL, it may be used. */ +OPENSSL_EXPORT int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, + EC_POINT *points[], BN_CTX *ctx); + + +/* Point conversion. */ + +/* EC_POINT_get_affine_coordinates_GFp sets |x| and |y| to the affine value of + * |point| using |ctx|, if it's not NULL. It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, + const EC_POINT *point, + BIGNUM *x, BIGNUM *y, + BN_CTX *ctx); + +/* EC_POINT_set_affine_coordinates sets the value of |p| to be (|x|, |y|). The + * |ctx| argument may be used if not NULL. */ +OPENSSL_EXPORT int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, + EC_POINT *point, + const BIGNUM *x, + const BIGNUM *y, + BN_CTX *ctx); + +/* EC_POINT_point2oct serialises |point| into the X9.62 form given by |form| + * into, at most, |len| bytes at |buf|. It returns the number of bytes written + * or zero on error if |buf| is non-NULL, else the number of bytes needed. The + * |ctx| argument may be used if not NULL. */ +OPENSSL_EXPORT size_t EC_POINT_point2oct(const EC_GROUP *group, + const EC_POINT *point, + point_conversion_form_t form, + uint8_t *buf, size_t len, BN_CTX *ctx); + +/* EC_POINT_oct2point sets |point| from |len| bytes of X9.62 format + * serialisation in |buf|. It returns one on success and zero otherwise. The + * |ctx| argument may be used if not NULL. */ +OPENSSL_EXPORT int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, + const uint8_t *buf, size_t len, + BN_CTX *ctx); + +/* EC_POINT_set_compressed_coordinates_GFp sets |point| to equal the point with + * the given |x| coordinate and the y coordinate specified by |y_bit| (see + * X9.62). It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int EC_POINT_set_compressed_coordinates_GFp( + const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, int y_bit, + BN_CTX *ctx); + + +/* Group operations. */ + +/* EC_POINT_add sets |r| equal to |a| plus |b|. It returns one on success and + * zero otherwise. If |ctx| is not NULL, it may be used. */ +OPENSSL_EXPORT int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, + const EC_POINT *a, const EC_POINT *b, + BN_CTX *ctx); + +/* EC_POINT_dbl sets |r| equal to |a| plus |a|. It returns one on success and + * zero otherwise. If |ctx| is not NULL, it may be used. */ +OPENSSL_EXPORT int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, + const EC_POINT *a, BN_CTX *ctx); + +/* EC_POINT_dbl sets |a| equal to minus |a|. It returns one on success and zero + * otherwise. If |ctx| is not NULL, it may be used. */ +OPENSSL_EXPORT int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, + BN_CTX *ctx); + +/* EC_POINT_mul sets r = generator*n + q*m. It returns one on success and zero + * otherwise. If |ctx| is not NULL, it may be used. */ +OPENSSL_EXPORT int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, + const BIGNUM *n, const EC_POINT *q, + const BIGNUM *m, BN_CTX *ctx); + +/* EC_POINTs_mul sets r = generator*n + sum(p[i]*m[i]). It returns one on + * success and zero otherwise. If |ctx| is not NULL, it may be used. */ +OPENSSL_EXPORT int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, + const BIGNUM *n, size_t num, + const EC_POINT *p[], const BIGNUM *m[], + BN_CTX *ctx); + + +/* Deprecated functions. */ + +/* EC_GROUP_new_curve_GFp creates a new, arbitrary elliptic curve group based + * on the equation y² = x³ + a·x + b. It returns the new group or NULL on + * error. + * + * |EC_GROUP|s returned by this function will always compare as unequal via + * |EC_GROUP_cmp| (even to themselves). |EC_GROUP_get_curve_name| will always + * return |NID_undef|. */ +OPENSSL_EXPORT EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, + const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); + +/* EC_GROUP_set_generator sets the generator for |group| to |generator|, which + * must have the given order and cofactor. This should only be used with + * |EC_GROUP| objects returned by |EC_GROUP_new_curve_GFp|. */ +OPENSSL_EXPORT int EC_GROUP_set_generator(EC_GROUP *group, + const EC_POINT *generator, + const BIGNUM *order, + const BIGNUM *cofactor); + +/* EC_GROUP_set_asn1_flag does nothing. */ +OPENSSL_EXPORT void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); + +#define OPENSSL_EC_NAMED_CURVE 0 + +typedef struct ec_method_st EC_METHOD; + +/* EC_GROUP_method_of returns NULL. */ +OPENSSL_EXPORT const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); + +/* EC_METHOD_get_field_type returns NID_X9_62_prime_field. */ +OPENSSL_EXPORT int EC_METHOD_get_field_type(const EC_METHOD *meth); + +/* EC_GROUP_set_point_conversion_form aborts the process if |form| is not + * |POINT_CONVERSION_UNCOMPRESSED| and otherwise does nothing. */ +OPENSSL_EXPORT void EC_GROUP_set_point_conversion_form( + EC_GROUP *group, point_conversion_form_t form); + + +/* Old code expects to get EC_KEY from ec.h. */ +#if !defined(OPENSSL_HEADER_EC_KEY_H) +#include +#endif + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define EC_F_EC_GROUP_copy 100 +#define EC_F_EC_GROUP_get_curve_GFp 101 +#define EC_F_EC_GROUP_get_degree 102 +#define EC_F_EC_GROUP_new_by_curve_name 103 +#define EC_F_EC_KEY_check_key 104 +#define EC_F_EC_KEY_copy 105 +#define EC_F_EC_KEY_generate_key 106 +#define EC_F_EC_KEY_new_method 107 +#define EC_F_EC_KEY_set_public_key_affine_coordinates 108 +#define EC_F_EC_POINT_add 109 +#define EC_F_EC_POINT_cmp 110 +#define EC_F_EC_POINT_copy 111 +#define EC_F_EC_POINT_dbl 112 +#define EC_F_EC_POINT_dup 113 +#define EC_F_EC_POINT_get_affine_coordinates_GFp 114 +#define EC_F_EC_POINT_invert 115 +#define EC_F_EC_POINT_is_at_infinity 116 +#define EC_F_EC_POINT_is_on_curve 117 +#define EC_F_EC_POINT_make_affine 118 +#define EC_F_EC_POINT_new 119 +#define EC_F_EC_POINT_oct2point 120 +#define EC_F_EC_POINT_point2oct 121 +#define EC_F_EC_POINT_set_affine_coordinates_GFp 122 +#define EC_F_EC_POINT_set_compressed_coordinates_GFp 123 +#define EC_F_EC_POINT_set_to_infinity 124 +#define EC_F_EC_POINTs_make_affine 125 +#define EC_F_compute_wNAF 126 +#define EC_F_d2i_ECPKParameters 127 +#define EC_F_d2i_ECParameters 128 +#define EC_F_d2i_ECPrivateKey 129 +#define EC_F_ec_GFp_mont_field_decode 130 +#define EC_F_ec_GFp_mont_field_encode 131 +#define EC_F_ec_GFp_mont_field_mul 132 +#define EC_F_ec_GFp_mont_field_set_to_one 133 +#define EC_F_ec_GFp_mont_field_sqr 134 +#define EC_F_ec_GFp_mont_group_set_curve 135 +#define EC_F_ec_GFp_simple_group_check_discriminant 136 +#define EC_F_ec_GFp_simple_group_set_curve 137 +#define EC_F_ec_GFp_simple_make_affine 138 +#define EC_F_ec_GFp_simple_oct2point 139 +#define EC_F_ec_GFp_simple_point2oct 140 +#define EC_F_ec_GFp_simple_point_get_affine_coordinates 141 +#define EC_F_ec_GFp_simple_point_set_affine_coordinates 142 +#define EC_F_ec_GFp_simple_points_make_affine 143 +#define EC_F_ec_GFp_simple_set_compressed_coordinates 144 +#define EC_F_ec_asn1_group2pkparameters 145 +#define EC_F_ec_asn1_pkparameters2group 146 +#define EC_F_ec_group_new 147 +#define EC_F_ec_group_new_curve_GFp 148 +#define EC_F_ec_group_new_from_data 149 +#define EC_F_ec_point_set_Jprojective_coordinates_GFp 150 +#define EC_F_ec_pre_comp_new 151 +#define EC_F_ec_wNAF_mul 152 +#define EC_F_ec_wNAF_precompute_mult 153 +#define EC_F_i2d_ECPKParameters 154 +#define EC_F_i2d_ECParameters 155 +#define EC_F_i2d_ECPrivateKey 156 +#define EC_F_i2o_ECPublicKey 157 +#define EC_F_o2i_ECPublicKey 158 +#define EC_F_BN_to_felem 159 +#define EC_F_ec_GFp_nistp256_group_set_curve 160 +#define EC_F_ec_GFp_nistp256_point_get_affine_coordinates 161 +#define EC_F_ec_GFp_nistp256_points_mul 162 +#define EC_F_ec_group_copy 163 +#define EC_F_nistp256_pre_comp_new 164 +#define EC_F_EC_KEY_new_by_curve_name 165 +#define EC_F_EC_GROUP_new_curve_GFp 166 +#define EC_R_BUFFER_TOO_SMALL 100 +#define EC_R_COORDINATES_OUT_OF_RANGE 101 +#define EC_R_D2I_ECPKPARAMETERS_FAILURE 102 +#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 103 +#define EC_R_GROUP2PKPARAMETERS_FAILURE 104 +#define EC_R_I2D_ECPKPARAMETERS_FAILURE 105 +#define EC_R_INCOMPATIBLE_OBJECTS 106 +#define EC_R_INVALID_COMPRESSED_POINT 107 +#define EC_R_INVALID_COMPRESSION_BIT 108 +#define EC_R_INVALID_ENCODING 109 +#define EC_R_INVALID_FIELD 110 +#define EC_R_INVALID_FORM 111 +#define EC_R_INVALID_GROUP_ORDER 112 +#define EC_R_INVALID_PRIVATE_KEY 113 +#define EC_R_MISSING_PARAMETERS 114 +#define EC_R_MISSING_PRIVATE_KEY 115 +#define EC_R_NON_NAMED_CURVE 116 +#define EC_R_NOT_INITIALIZED 117 +#define EC_R_PKPARAMETERS2GROUP_FAILURE 118 +#define EC_R_POINT_AT_INFINITY 119 +#define EC_R_POINT_IS_NOT_ON_CURVE 120 +#define EC_R_SLOT_FULL 121 +#define EC_R_UNDEFINED_GENERATOR 122 +#define EC_R_UNKNOWN_GROUP 123 +#define EC_R_UNKNOWN_ORDER 124 +#define EC_R_WRONG_ORDER 125 +#define EC_R_BIGNUM_OUT_OF_RANGE 126 +#define EC_R_WRONG_CURVE_PARAMETERS 127 + +#endif /* OPENSSL_HEADER_EC_H */ diff --git a/phonelibs/boringssl/include/openssl/ec_key.h b/phonelibs/boringssl/include/openssl/ec_key.h new file mode 100644 index 00000000000000..ee64030b8efca9 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ec_key.h @@ -0,0 +1,286 @@ +/* Originally written by Bodo Moeller for the OpenSSL project. + * ==================================================================== + * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the OpenSSL open source + * license provided above. + * + * The elliptic curve binary polynomial software is originally written by + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems + * Laboratories. */ + +#ifndef OPENSSL_HEADER_EC_KEY_H +#define OPENSSL_HEADER_EC_KEY_H + +#include + +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* ec_key.h contains functions that handle elliptic-curve points that are + * public/private keys. */ + + +/* EC key objects. */ + +/* EC_KEY_new returns a fresh |EC_KEY| object or NULL on error. */ +OPENSSL_EXPORT EC_KEY *EC_KEY_new(void); + +/* EC_KEY_new_method acts the same as |EC_KEY_new|, but takes an explicit + * |ENGINE|. */ +OPENSSL_EXPORT EC_KEY *EC_KEY_new_method(const ENGINE *engine); + +/* EC_KEY_new_by_curve_name returns a fresh EC_KEY for group specified by |nid| + * or NULL on error. */ +OPENSSL_EXPORT EC_KEY *EC_KEY_new_by_curve_name(int nid); + +/* EC_KEY_free frees all the data owned by |key| and |key| itself. */ +OPENSSL_EXPORT void EC_KEY_free(EC_KEY *key); + +/* EC_KEY_copy sets |dst| equal to |src| and returns |dst| or NULL on error. */ +OPENSSL_EXPORT EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); + +/* EC_KEY_dup returns a fresh copy of |src| or NULL on error. */ +OPENSSL_EXPORT EC_KEY *EC_KEY_dup(const EC_KEY *src); + +/* EC_KEY_up_ref increases the reference count of |key|. It returns one on + * success and zero otherwise. */ +OPENSSL_EXPORT int EC_KEY_up_ref(EC_KEY *key); + +/* EC_KEY_is_opaque returns one if |key| is opaque and doesn't expose its key + * material. Otherwise it return zero. */ +OPENSSL_EXPORT int EC_KEY_is_opaque(const EC_KEY *key); + +/* EC_KEY_get0_group returns a pointer to the |EC_GROUP| object inside |key|. */ +OPENSSL_EXPORT const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); + +/* EC_KEY_set_group sets the |EC_GROUP| object that |key| will use to |group|. + * It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); + +/* EC_KEY_get0_private_key returns a pointer to the private key inside |key|. */ +OPENSSL_EXPORT const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); + +/* EC_KEY_set_private_key sets the private key of |key| to |priv|. It returns + * one on success and zero otherwise. */ +OPENSSL_EXPORT int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); + +/* EC_KEY_get0_public_key returns a pointer to the public key point inside + * |key|. */ +OPENSSL_EXPORT const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); + +/* EC_KEY_set_public_key sets the public key of |key| to |pub|, by copying it. + * It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); + +#define EC_PKEY_NO_PARAMETERS 0x001 +#define EC_PKEY_NO_PUBKEY 0x002 + +/* EC_KEY_get_enc_flags returns the encoding flags for |key|, which is a + * bitwise-OR of |EC_PKEY_*| values. */ +OPENSSL_EXPORT unsigned EC_KEY_get_enc_flags(const EC_KEY *key); + +/* EC_KEY_set_enc_flags sets the encoding flags for |key|, which is a + * bitwise-OR of |EC_PKEY_*| values. */ +OPENSSL_EXPORT void EC_KEY_set_enc_flags(EC_KEY *key, unsigned flags); + +/* EC_KEY_get_conv_form returns the conversation form that will be used by + * |key|. */ +OPENSSL_EXPORT point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); + +/* EC_KEY_set_conv_form sets the conversion form to be used by |key|. */ +OPENSSL_EXPORT void EC_KEY_set_conv_form(EC_KEY *key, + point_conversion_form_t cform); + +/* EC_KEY_precompute_mult precomputes multiplies of the generator of the + * underlying group in order to speed up operations that calculate generator + * multiples. If |ctx| is not NULL, it may be used. It returns one on success + * and zero otherwise. */ +OPENSSL_EXPORT int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); + +/* EC_KEY_check_key performs several checks on |key| (possibly including an + * expensive check that the public key is in the primary subgroup). It returns + * one if all checks pass and zero otherwise. If it returns zero then detail + * about the problem can be found on the error stack. */ +OPENSSL_EXPORT int EC_KEY_check_key(const EC_KEY *key); + +/* EC_KEY_set_public_key_affine_coordinates sets the public key in |key| to + * (|x|, |y|). It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, + BIGNUM *x, + BIGNUM *y); + + +/* Key generation. */ + +/* EC_KEY_generate_key generates a random, private key, calculates the + * corresponding public key and stores both in |key|. It returns one on success + * or zero otherwise. */ +OPENSSL_EXPORT int EC_KEY_generate_key(EC_KEY *key); + + +/* Serialisation. */ + +/* d2i_ECPrivateKey parses an ASN.1, DER-encoded, private key from |len| bytes + * at |*inp|. If |out_key| is not NULL then, on exit, a pointer to the result + * is in |*out_key|. If |*out_key| is already non-NULL on entry then the result + * is written directly into |*out_key|, otherwise a fresh |EC_KEY| is + * allocated. On successful exit, |*inp| is advanced past the DER structure. It + * returns the result or NULL on error. */ +OPENSSL_EXPORT EC_KEY *d2i_ECPrivateKey(EC_KEY **out_key, const uint8_t **inp, + long len); + +/* i2d_ECParameters marshals an EC private key from |key| to an ASN.1, DER + * structure. If |outp| is not NULL then the result is written to |*outp| and + * |*outp| is advanced just past the output. It returns the number of bytes in + * the result, whether written or not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_ECPrivateKey(const EC_KEY *key, uint8_t **outp); + +/* d2i_ECParameters parses an ASN.1, DER-encoded, set of EC parameters from + * |len| bytes at |*inp|. If |out_key| is not NULL then, on exit, a pointer to + * the result is in |*out_key|. If |*out_key| is already non-NULL on entry then + * the result is written directly into |*out_key|, otherwise a fresh |EC_KEY| + * is allocated. On successful exit, |*inp| is advanced past the DER structure. + * It returns the result or NULL on error. */ +OPENSSL_EXPORT EC_KEY *d2i_ECParameters(EC_KEY **out_key, const uint8_t **inp, + long len); + +/* i2d_ECParameters marshals EC parameters from |key| to an ASN.1, DER + * structure. If |outp| is not NULL then the result is written to |*outp| and + * |*outp| is advanced just past the output. It returns the number of bytes in + * the result, whether written or not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_ECParameters(const EC_KEY *key, uint8_t **outp); + +/* o2i_ECPublicKey parses an EC point from |len| bytes at |*inp| into + * |*out_key|. Note that this differs from the d2i format in that |*out_key| + * must be non-NULL. On successful exit, |*inp| is advanced past the DER + * structure. It returns |*out_key| or NULL on error. */ +OPENSSL_EXPORT EC_KEY *o2i_ECPublicKey(EC_KEY **out_key, const uint8_t **inp, + long len); + +/* i2o_ECPublicKey marshals an EC point from |key|. If |outp| is not NULL then + * the result is written to |*outp| and |*outp| is advanced just past the + * output. It returns the number of bytes in the result, whether written or + * not, or a negative value on error. */ +OPENSSL_EXPORT int i2o_ECPublicKey(const EC_KEY *key, unsigned char **outp); + + +/* ex_data functions. + * + * These functions are wrappers. See |ex_data.h| for details. */ + +OPENSSL_EXPORT int EC_KEY_get_ex_new_index(long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +OPENSSL_EXPORT int EC_KEY_set_ex_data(EC_KEY *r, int idx, void *arg); +OPENSSL_EXPORT void *EC_KEY_get_ex_data(const EC_KEY *r, int idx); + + +/* ECDSA method. */ + +/* ECDSA_FLAG_OPAQUE specifies that this ECDSA_METHOD does not expose its key + * material. This may be set if, for instance, it is wrapping some other crypto + * API, like a platform key store. */ +#define ECDSA_FLAG_OPAQUE 1 + +/* ecdsa_method_st is a structure of function pointers for implementing ECDSA. + * See engine.h. */ +struct ecdsa_method_st { + struct openssl_method_common_st common; + + void *app_data; + + int (*init)(EC_KEY *key); + int (*finish)(EC_KEY *key); + + /* group_order_size returns the number of bytes needed to represent the order + * of the group. This is used to calculate the maximum size of an ECDSA + * signature in |ECDSA_size|. */ + size_t (*group_order_size)(const EC_KEY *key); + + /* sign matches the arguments and behaviour of |ECDSA_sign|. */ + int (*sign)(const uint8_t *digest, size_t digest_len, uint8_t *sig, + unsigned int *sig_len, EC_KEY *eckey); + + /* verify matches the arguments and behaviour of |ECDSA_verify|. */ + int (*verify)(const uint8_t *digest, size_t digest_len, const uint8_t *sig, + size_t sig_len, EC_KEY *eckey); + + int flags; +}; + + +/* Deprecated functions. */ + +/* EC_KEY_set_asn1_flag does nothing. */ +OPENSSL_EXPORT void EC_KEY_set_asn1_flag(EC_KEY *key, int flag); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_EC_KEY_H */ diff --git a/phonelibs/boringssl/include/openssl/ecdh.h b/phonelibs/boringssl/include/openssl/ecdh.h new file mode 100644 index 00000000000000..27a85781275ddf --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ecdh.h @@ -0,0 +1,103 @@ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * The Elliptic Curve Public-Key Crypto Library (ECC Code) included + * herein is developed by SUN MICROSYSTEMS, INC., and is contributed + * to the OpenSSL project. + * + * The ECC Code is licensed pursuant to the OpenSSL open source + * license provided below. + * + * The ECDH software is originally written by Douglas Stebila of + * Sun Microsystems Laboratories. + * + */ +/* ==================================================================== + * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + +#ifndef OPENSSL_HEADER_ECDH_H +#define OPENSSL_HEADER_ECDH_H + +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Elliptic curve Diffie-Hellman. */ + + +/* ECDH_compute_key calculates the shared key between |pub_key| and |priv_key|. + * If |KDF| is not NULL, then it is called with the bytes of the shared key and + * the parameter |out|. When |KDF| returns, the value of |*outlen| becomes the + * return value. Otherwise, as many bytes of the shared key as will fit are + * copied directly to, at most, |outlen| bytes at |out|. It returns the number + * of bytes written to |out|, or -1 on error. */ +OPENSSL_EXPORT int ECDH_compute_key(void *out, size_t outlen, + const EC_POINT *pub_key, EC_KEY *priv_key, + void *(*KDF)(const void *in, size_t inlen, + void *out, size_t *outlen)); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define ECDH_F_ECDH_compute_key 100 +#define ECDH_R_KDF_FAILED 100 +#define ECDH_R_NO_PRIVATE_VALUE 101 +#define ECDH_R_POINT_ARITHMETIC_FAILURE 102 + +#endif /* OPENSSL_HEADER_ECDH_H */ diff --git a/phonelibs/boringssl/include/openssl/ecdsa.h b/phonelibs/boringssl/include/openssl/ecdsa.h new file mode 100644 index 00000000000000..e04546345660c3 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ecdsa.h @@ -0,0 +1,182 @@ +/* ==================================================================== + * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + +#ifndef OPENSSL_HEADER_ECDSA_H +#define OPENSSL_HEADER_ECDSA_H + +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* ECDSA contains functions for signing and verifying with the Digital Signature + * Algorithm over elliptic curves. */ + + +/* Signing and verifing. */ + +/* ECDSA_sign signs |digest_len| bytes from |digest| with |key| and writes the + * resulting signature to |sig|, which must have |ECDSA_size(key)| bytes of + * space. On successful exit, |*sig_len| is set to the actual number of bytes + * written. The |type| argument should be zero. It returns one on success and + * zero otherwise. */ +OPENSSL_EXPORT int ECDSA_sign(int type, const uint8_t *digest, + size_t digest_len, uint8_t *sig, + unsigned int *sig_len, EC_KEY *key); + +/* ECDSA_verify verifies that |sig_len| bytes from |sig| constitute a valid + * signature by |key| of |digest|. (The |type| argument should be zero.) It + * returns one on success or zero if the signature is invalid or an error + * occured. */ +OPENSSL_EXPORT int ECDSA_verify(int type, const uint8_t *digest, + size_t digest_len, const uint8_t *sig, + size_t sig_len, EC_KEY *key); + +/* ECDSA_size returns the maximum size of an ECDSA signature using |key|. It + * returns zero on error. */ +OPENSSL_EXPORT size_t ECDSA_size(const EC_KEY *key); + + +/* Low-level signing and verification. + * + * Low-level functions handle signatures as |ECDSA_SIG| structures which allow + * the two values in an ECDSA signature to be handled separately. */ + +struct ecdsa_sig_st { + BIGNUM *r; + BIGNUM *s; +}; + +/* ECDSA_SIG_new returns a fresh |ECDSA_SIG| structure or NULL on error. */ +OPENSSL_EXPORT ECDSA_SIG *ECDSA_SIG_new(void); + +/* ECDSA_SIG_free frees |sig| its member |BIGNUM|s. */ +OPENSSL_EXPORT void ECDSA_SIG_free(ECDSA_SIG *sig); + +/* ECDSA_sign signs |digest_len| bytes from |digest| with |key| and returns the + * resulting signature structure, or NULL on error. */ +OPENSSL_EXPORT ECDSA_SIG *ECDSA_do_sign(const uint8_t *digest, + size_t digest_len, EC_KEY *key); + +/* ECDSA_verify verifies that |sig| constitutes a valid signature by |key| of + * |digest|. It returns one on success or zero if the signature is invalid or + * on error. */ +OPENSSL_EXPORT int ECDSA_do_verify(const uint8_t *digest, size_t digest_len, + const ECDSA_SIG *sig, EC_KEY *key); + + +/* Signing with precomputation. + * + * Parts of the ECDSA signature can be independent of the message to be signed + * thus it's possible to precompute them and reduce the signing latency. + * + * TODO(fork): remove support for this as it cannot support safe-randomness. */ + +/* ECDSA_sign_setup precomputes parts of an ECDSA signing operation. It sets + * |*kinv| and |*rp| to the precomputed values and uses the |ctx| argument, if + * not NULL. It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, + BIGNUM **rp); + +/* ECDSA_do_sign_ex is the same as |ECDSA_do_sign| but takes precomputed values + * as generated by |ECDSA_sign_setup|. */ +OPENSSL_EXPORT ECDSA_SIG *ECDSA_do_sign_ex(const uint8_t *digest, + size_t digest_len, + const BIGNUM *kinv, const BIGNUM *rp, + EC_KEY *eckey); + +/* ECDSA_sign_ex is the same as |ECDSA_sign| but takes precomputed values as + * generated by |ECDSA_sign_setup|. */ +OPENSSL_EXPORT int ECDSA_sign_ex(int type, const uint8_t *digest, + size_t digest_len, uint8_t *sig, + unsigned int *sig_len, const BIGNUM *kinv, + const BIGNUM *rp, EC_KEY *eckey); + + +/* ASN.1 functions. */ + +/* d2i_ECDSA_SIG parses an ASN.1, DER-encoded, signature from |len| bytes at + * |*inp|. If |out| is not NULL then, on exit, a pointer to the result is in + * |*out|. If |*out| is already non-NULL on entry then the result is written + * directly into |*out|, otherwise a fresh |ECDSA_SIG| is allocated. On + * successful exit, |*inp| is advanced past the DER structure. It returns the + * result or NULL on error. */ +OPENSSL_EXPORT ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **out, const uint8_t **inp, + long len); + +/* i2d_ECDSA_SIG marshals a signature from |sig| to an ASN.1, DER + * structure. If |outp| is not NULL then the result is written to |*outp| and + * |*outp| is advanced just past the output. It returns the number of bytes in + * the result, whether written or not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_ECDSA_SIG(const ECDSA_SIG *sig, uint8_t **outp); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define ECDSA_F_ECDSA_do_sign_ex 100 +#define ECDSA_F_ECDSA_do_verify 101 +#define ECDSA_F_ECDSA_sign_ex 102 +#define ECDSA_F_digest_to_bn 103 +#define ECDSA_F_ecdsa_sign_setup 104 +#define ECDSA_R_BAD_SIGNATURE 100 +#define ECDSA_R_MISSING_PARAMETERS 101 +#define ECDSA_R_NEED_NEW_SETUP_VALUES 102 +#define ECDSA_R_NOT_IMPLEMENTED 103 +#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104 + +#endif /* OPENSSL_HEADER_ECDSA_H */ diff --git a/phonelibs/boringssl/include/openssl/engine.h b/phonelibs/boringssl/include/openssl/engine.h new file mode 100644 index 00000000000000..d3d278a69b77a4 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/engine.h @@ -0,0 +1,107 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_ENGINE_H +#define OPENSSL_HEADER_ENGINE_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Engines are collections of methods. Methods are tables of function pointers, + * defined for certain algorithms, that allow operations on those algorithms to + * be overridden via a callback. This can be used, for example, to implement an + * RSA* that forwards operations to a hardware module. + * + * Methods are reference counted but |ENGINE|s are not. When creating a method, + * you should zero the whole structure and fill in the function pointers that + * you wish before setting it on an |ENGINE|. Any functions pointers that + * are NULL indicate that the default behaviour should be used. */ + + +/* Allocation and destruction. */ + +/* ENGINE_new returns an empty ENGINE that uses the default method for all + * algorithms. */ +OPENSSL_EXPORT ENGINE *ENGINE_new(void); + +/* ENGINE_free decrements the reference counts for all methods linked from + * |engine| and frees |engine| itself. */ +OPENSSL_EXPORT void ENGINE_free(ENGINE *engine); + + +/* Method accessors. + * + * Method accessors take a method pointer and the size of the structure. The + * size allows for ABI compatibility in the case that the method structure is + * extended with extra elements at the end. Methods are always copied by the + * set functions. + * + * Set functions return one on success and zero on allocation failure. */ + +OPENSSL_EXPORT int ENGINE_set_DH_method(ENGINE *engine, const DH_METHOD *method, + size_t method_size); +OPENSSL_EXPORT DH_METHOD *ENGINE_get_DH_method(const ENGINE *engine); + +OPENSSL_EXPORT int ENGINE_set_DSA_method(ENGINE *engine, + const DSA_METHOD *method, + size_t method_size); +OPENSSL_EXPORT DSA_METHOD *ENGINE_get_DSA_method(const ENGINE *engine); + +OPENSSL_EXPORT int ENGINE_set_RSA_method(ENGINE *engine, + const RSA_METHOD *method, + size_t method_size); +OPENSSL_EXPORT RSA_METHOD *ENGINE_get_RSA_method(const ENGINE *engine); + +OPENSSL_EXPORT int ENGINE_set_ECDSA_method(ENGINE *engine, + const ECDSA_METHOD *method, + size_t method_size); +OPENSSL_EXPORT ECDSA_METHOD *ENGINE_get_ECDSA_method(const ENGINE *engine); + + +/* Generic method functions. + * + * These functions take a void* type but actually operate on all method + * structures. */ + +/* METHOD_ref increments the reference count of |method|. This is a no-op for + * now because all methods are currently static. */ +void METHOD_ref(void *method); + +/* METHOD_unref decrements the reference count of |method| and frees it if the + * reference count drops to zero. This is a no-op for now because all methods + * are currently static. */ +void METHOD_unref(void *method); + + +/* Private functions. */ + +/* openssl_method_common_st contains the common part of all method structures. + * This must be the first member of all method structures. */ +struct openssl_method_common_st { + int references; /* dummy – not used. */ + char is_static; +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define ENGINE_R_OPERATION_NOT_SUPPORTED 100 + +#endif /* OPENSSL_HEADER_ENGINE_H */ diff --git a/phonelibs/boringssl/include/openssl/err.h b/phonelibs/boringssl/include/openssl/err.h new file mode 100644 index 00000000000000..30dc4afe9b9a54 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/err.h @@ -0,0 +1,509 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + +#ifndef OPENSSL_HEADER_ERR_H +#define OPENSSL_HEADER_ERR_H + +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Error queue handling functions. + * + * Errors in OpenSSL are generally signalled by the return value of a function. + * When a function fails it may add an entry to a per-thread error queue, + * which is managed by the functions in this header. + * + * Each error contains: + * 1) The library (i.e. ec, pem, rsa) which created it. + * 2) A function identifier and reason code. + * 3) The file and line number of the call that added the error. + * 4) A pointer to some error specific data, which may be NULL. + * + * The library identifier, function identifier and reason code are packed in a + * uint32_t and there exist various functions for unpacking it. + * + * The typical behaviour is that an error will occur deep in a call queue and + * that code will push an error onto the error queue. As the error queue + * unwinds, other functions will push their own errors. Thus, the "least + * recent" error is the most specific and the other errors will provide a + * backtrace of sorts. */ + + +/* Startup and shutdown. */ + +/* ERR_load_BIO_strings does nothing. + * + * TODO(fork): remove. libjingle calls this. */ +OPENSSL_EXPORT void ERR_load_BIO_strings(void); + +/* ERR_load_ERR_strings does nothing. */ +OPENSSL_EXPORT void ERR_load_ERR_strings(void); + +/* ERR_load_crypto_strings does nothing. */ +OPENSSL_EXPORT void ERR_load_crypto_strings(void); + +/* ERR_free_strings does nothing. */ +OPENSSL_EXPORT void ERR_free_strings(void); + + +/* Reading and formatting errors. */ + +/* ERR_get_error gets the packed error code for the least recent error and + * removes that error from the queue. If there are no errors in the queue then + * it returns zero. */ +OPENSSL_EXPORT uint32_t ERR_get_error(void); + +/* ERR_get_error_line acts like |ERR_get_error|, except that the file and line + * number of the call that added the error are also returned. */ +OPENSSL_EXPORT uint32_t ERR_get_error_line(const char **file, int *line); + +/* ERR_get_error_line_data acts like |ERR_get_error_line|, but also returns the + * error-specific data pointer and flags. The flags are a bitwise-OR of + * |ERR_FLAG_*| values. The error-specific data is owned by the error queue + * and the pointer becomes invalid after the next call that affects the same + * thread's error queue. If |*flags| contains |ERR_FLAG_STRING| then |*data| is + * human-readable. */ +OPENSSL_EXPORT uint32_t ERR_get_error_line_data(const char **file, int *line, + const char **data, int *flags); + +/* The "peek" functions act like the |ERR_get_error| functions, above, but they + * do not remove the error from the queue. */ +OPENSSL_EXPORT uint32_t ERR_peek_error(void); +OPENSSL_EXPORT uint32_t ERR_peek_error_line(const char **file, int *line); +OPENSSL_EXPORT uint32_t ERR_peek_error_line_data(const char **file, int *line, + const char **data, int *flags); + +/* The "peek last" functions act like the "peek" functions, above, except that + * they return the most recent error. */ +OPENSSL_EXPORT uint32_t ERR_peek_last_error(void); +OPENSSL_EXPORT uint32_t ERR_peek_last_error_line(const char **file, int *line); +OPENSSL_EXPORT uint32_t ERR_peek_last_error_line_data(const char **file, + int *line, + const char **data, + int *flags); + +/* ERR_error_string generates a human-readable string representing + * |packed_error|, places it at |buf| (which must be at least + * ERR_ERROR_STRING_BUF_LEN bytes long) and returns |buf|. If |buf| is NULL, + * the error string is placed in a static buffer which is returned. (The static + * buffer may be overridden by concurrent calls in other threads so this form + * is deprecated.) + * + * The string will have the following format: + * + * error:[error code]:[library name]:[function name]:[reason string] + * + * error code is an 8 digit hexadecimal number; library name, function name + * and reason string are ASCII text. + * + * TODO(fork): remove in favour of |ERR_error_string_n|. */ +OPENSSL_EXPORT char *ERR_error_string(uint32_t packed_error, char *buf); +#define ERR_ERROR_STRING_BUF_LEN 256 + +/* ERR_error_string_n is a variant of |ERR_error_string| that writes at most + * len characters (including the terminating NUL) and truncates the string if + * necessary. If |len| is greater than zero then |buf| is always NUL + * terminated. */ +OPENSSL_EXPORT void ERR_error_string_n(uint32_t packed_error, char *buf, + size_t len); + +/* ERR_lib_error_string returns a string representation of the library that + * generated |packed_error|. */ +OPENSSL_EXPORT const char *ERR_lib_error_string(uint32_t packed_error); + +/* ERR_func_error_string returns a string representation of the function that + * generated |packed_error|. */ +OPENSSL_EXPORT const char *ERR_func_error_string(uint32_t packed_error); + +/* ERR_reason_error_string returns a string representation of the reason for + * |packed_error|. */ +OPENSSL_EXPORT const char *ERR_reason_error_string(uint32_t packed_error); + +/* ERR_print_errors_callback_t is the type of a function used by + * |ERR_print_errors_cb|. It takes a pointer to a human readable string (and + * its length) that describes an entry in the error queue. The |ctx| argument + * is an opaque pointer given to |ERR_print_errors_cb|. + * + * It should return one on success or zero on error, which will stop the + * iteration over the error queue. */ +typedef int (*ERR_print_errors_callback_t)(const char *str, size_t len, + void *ctx); + +/* ERR_print_errors_cb calls |callback| with a string representation of each + * error in the current thread's error queue, from the least recent to the most + * recent error. + * + * The string will have the following format (which differs from + * |ERR_error_string|): + * + * [thread id]:error:[error code]:[library name]:[function name]: + * [reason string]:[file]:[line number]:[optional string data] + * + * (All in one line.) + * + * The callback can return one to continue the iteration or zero to stop it. + * The |ctx| argument is an opaque value that is passed through to the + * callback. */ +OPENSSL_EXPORT void ERR_print_errors_cb(ERR_print_errors_callback_t callback, + void *ctx); + + +/* ERR_print_errors_fp prints the current contents of the error stack to |file| + * using human readable strings where possible. */ +OPENSSL_EXPORT void ERR_print_errors_fp(FILE *file); + +/* Clearing errors. */ + +/* ERR_clear_error clears the error queue for the current thread. */ +OPENSSL_EXPORT void ERR_clear_error(void); + +/* ERR_remove_thread_state clears the error queue for the current thread if + * |tid| is NULL. Otherwise it calls |assert(0)|, because it's no longer + * possible to delete the error queue for other threads. + * + * Error queues are thread-local data and are deleted automatically. You do not + * need to call this function. Use |ERR_clear_error|. */ +OPENSSL_EXPORT void ERR_remove_thread_state(const CRYPTO_THREADID *tid); + + +/* Custom errors. */ + +/* ERR_get_next_error_library returns a value suitable for passing as the + * |library| argument to |ERR_put_error|. This is intended for code that wishes + * to push its own, non-standard errors to the error queue. */ +OPENSSL_EXPORT int ERR_get_next_error_library(void); + + +/* Deprecated functions. */ + +/* |ERR_remove_state| calls |ERR_clear_error|. */ +OPENSSL_EXPORT void ERR_remove_state(unsigned long pid); + + +/* Private functions. */ + +/* ERR_clear_system_error clears the system's error value (i.e. errno). */ +OPENSSL_EXPORT void ERR_clear_system_error(void); + +/* OPENSSL_PUT_ERROR is used by OpenSSL code to add an error to the error + * queue. */ +#define OPENSSL_PUT_ERROR(library, func, reason) \ + ERR_put_error(ERR_LIB_##library, library##_F_##func, reason, __FILE__, \ + __LINE__) + +/* OPENSSL_PUT_SYSTEM_ERROR is used by OpenSSL code to add an error from the + * operating system to the error queue. */ +/* TODO(fork): include errno. */ +#define OPENSSL_PUT_SYSTEM_ERROR(func) \ + ERR_put_error(ERR_LIB_SYS, SYS_F_##func, 0, __FILE__, __LINE__); + +/* ERR_put_error adds an error to the error queue, dropping the least recent + * error if neccessary for space reasons. */ +OPENSSL_EXPORT void ERR_put_error(int library, int func, int reason, + const char *file, unsigned line); + +/* ERR_add_error_data takes a variable number (|count|) of const char* + * pointers, concatenates them and sets the result as the data on the most + * recent error. */ +OPENSSL_EXPORT void ERR_add_error_data(unsigned count, ...); + +/* ERR_add_error_dataf takes a printf-style format and arguments, and sets the + * result as the data on the most recent error. */ +OPENSSL_EXPORT void ERR_add_error_dataf(const char *format, ...); + +/* ERR_set_mark "marks" the most recent error for use with |ERR_pop_to_mark|. + * It returns one if an error was marked and zero if there are no errors. */ +OPENSSL_EXPORT int ERR_set_mark(void); + +/* ERR_pop_to_mark removes errors from the most recent to the least recent + * until (and not including) a "marked" error. It returns zero if no marked + * error was found (and thus all errors were removed) and one otherwise. Errors + * are marked using |ERR_set_mark|. */ +OPENSSL_EXPORT int ERR_pop_to_mark(void); + +struct err_error_st { + /* file contains the filename where the error occured. */ + const char *file; + /* data contains optional data. It must be freed with |OPENSSL_free| if + * |flags&ERR_FLAG_MALLOCED|. */ + char *data; + /* packed contains the error library, function and reason, as packed by + * ERR_PACK. */ + uint32_t packed; + /* line contains the line number where the error occured. */ + uint16_t line; + /* flags contains a bitwise-OR of ERR_FLAG_* values. */ + uint8_t flags; +}; + +/* ERR_FLAG_STRING means that the |data| member is a NUL-terminated string that + * can be printed. */ +#define ERR_FLAG_STRING 1 +/* ERR_TXT_STRING is provided for compatibility with code that assumes that + * it's using OpenSSL. */ +#define ERR_TXT_STRING ERR_FLAG_STRING + +/* ERR_FLAG_PUBLIC_MASK is applied to the flags field before it is returned + * from functions like |ERR_get_error_line_data|. */ +#define ERR_FLAG_PUBLIC_MASK 0xf + +/* The following flag values are internal and are masked when flags are + * returned from functions like |ERR_get_error_line_data|. */ + +/* ERR_FLAG_MALLOCED means the the |data| member must be freed when no longer + * needed. */ +#define ERR_FLAG_MALLOCED 16 +/* ERR_FLAG_MARK is used to indicate a reversion point in the queue. See + * |ERR_pop_to_mark|. */ +#define ERR_FLAG_MARK 32 + +/* ERR_NUM_ERRORS is the limit of the number of errors in the queue. */ +#define ERR_NUM_ERRORS 16 + +/* ERR_STATE contains the per-thread, error queue. */ +typedef struct err_state_st { + /* errors contains the ERR_NUM_ERRORS most recent errors, organised as a ring + * buffer. */ + struct err_error_st errors[ERR_NUM_ERRORS]; + /* top contains the index one past the most recent error. If |top| equals + * |bottom| then the queue is empty. */ + unsigned top; + /* bottom contains the index of the last error in the queue. */ + unsigned bottom; + + /* to_free, if not NULL, contains a pointer owned by this structure that was + * previously a |data| pointer of one of the elements of |errors|. */ + void *to_free; +} ERR_STATE; + +enum { + ERR_LIB_NONE = 1, + ERR_LIB_SYS, + ERR_LIB_BN, + ERR_LIB_RSA, + ERR_LIB_DH, + ERR_LIB_EVP, + ERR_LIB_BUF, + ERR_LIB_OBJ, + ERR_LIB_PEM, + ERR_LIB_DSA, + ERR_LIB_X509, + ERR_LIB_ASN1, + ERR_LIB_CONF, + ERR_LIB_CRYPTO, + ERR_LIB_EC, + ERR_LIB_SSL, + ERR_LIB_BIO, + ERR_LIB_PKCS7, + ERR_LIB_PKCS8, + ERR_LIB_X509V3, + ERR_LIB_RAND, + ERR_LIB_ENGINE, + ERR_LIB_OCSP, + ERR_LIB_UI, + ERR_LIB_COMP, + ERR_LIB_ECDSA, + ERR_LIB_ECDH, + ERR_LIB_HMAC, + ERR_LIB_DIGEST, + ERR_LIB_CIPHER, + ERR_LIB_USER, + ERR_LIB_HKDF, + ERR_NUM_LIBS +}; + +#define ERR_R_SYS_LIB ERR_LIB_SYS +#define ERR_R_BN_LIB ERR_LIB_BN +#define ERR_R_RSA_LIB ERR_LIB_RSA +#define ERR_R_DH_LIB ERR_LIB_DH +#define ERR_R_EVP_LIB ERR_LIB_EVP +#define ERR_R_BUF_LIB ERR_LIB_BUF +#define ERR_R_OBJ_LIB ERR_LIB_OBJ +#define ERR_R_PEM_LIB ERR_LIB_PEM +#define ERR_R_DSA_LIB ERR_LIB_DSA +#define ERR_R_X509_LIB ERR_LIB_X509 +#define ERR_R_ASN1_LIB ERR_LIB_ASN1 +#define ERR_R_CONF_LIB ERR_LIB_CONF +#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO +#define ERR_R_EC_LIB ERR_LIB_EC +#define ERR_R_SSL_LIB ERR_LIB_SSL +#define ERR_R_BIO_LIB ERR_LIB_BIO +#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 +#define ERR_R_PKCS8_LIB ERR_LIB_PKCS8 +#define ERR_R_X509V3_LIB ERR_LIB_X509V3 +#define ERR_R_RAND_LIB ERR_LIB_RAND +#define ERR_R_DSO_LIB ERR_LIB_DSO +#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE +#define ERR_R_OCSP_LIB ERR_LIB_OCSP +#define ERR_R_UI_LIB ERR_LIB_UI +#define ERR_R_COMP_LIB ERR_LIB_COMP +#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA +#define ERR_R_ECDH_LIB ERR_LIB_ECDH +#define ERR_R_STORE_LIB ERR_LIB_STORE +#define ERR_R_FIPS_LIB ERR_LIB_FIPS +#define ERR_R_CMS_LIB ERR_LIB_CMS +#define ERR_R_TS_LIB ERR_LIB_TS +#define ERR_R_HMAC_LIB ERR_LIB_HMAC +#define ERR_R_JPAKE_LIB ERR_LIB_JPAKE +#define ERR_R_USER_LIB ERR_LIB_USER +#define ERR_R_DIGEST_LIB ERR_LIB_DIGEST +#define ERR_R_CIPHER_LIB ERR_LIB_CIPHER +#define ERR_R_HKDF_LIB ERR_LIB_HKDF + +/* Global reasons. */ +#define ERR_R_FATAL 64 +#define ERR_R_MALLOC_FAILURE (1 | ERR_R_FATAL) +#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2 | ERR_R_FATAL) +#define ERR_R_PASSED_NULL_PARAMETER (3 | ERR_R_FATAL) +#define ERR_R_INTERNAL_ERROR (4 | ERR_R_FATAL) +#define ERR_R_OVERFLOW (5 | ERR_R_FATAL) + +/* System error functions */ +#define SYS_F_fopen 100 +#define SYS_F_fclose 101 +#define SYS_F_fread 102 +#define SYS_F_fwrite 103 +#define SYS_F_socket 104 +#define SYS_F_setsockopt 105 +#define SYS_F_connect 106 +#define SYS_F_getaddrinfo 107 + +#define ERR_PACK(lib, func, reason) \ + (((((uint32_t)lib) & 0xff) << 24) | ((((uint32_t)func) & 0xfff) << 12) | \ + ((((uint32_t)reason) & 0xfff))) + +#define ERR_GET_LIB(packed_error) ((int)(((packed_error) >> 24) & 0xff)) +#define ERR_GET_FUNC(packed_error) ((int)(((packed_error) >> 12) & 0xfff)) +#define ERR_GET_REASON(packed_error) ((int)((packed_error) & 0xfff)) + +/* OPENSSL_DECLARE_ERROR_REASON is used by util/make_errors.h (which generates + * the error defines) to recognise that an additional reason value is needed. + * This is needed when the reason value is used outside of an + * |OPENSSL_PUT_ERROR| macro. The resulting define will be + * ${lib}_R_${reason}. */ +#define OPENSSL_DECLARE_ERROR_REASON(lib, reason) + +/* OPENSSL_DECLARE_ERROR_FUNCTION is used by util/make_errors.h (which + * generates the error * defines to recognise that an additional function value + * is needed. This is * needed when the function value is used outside of an + * |OPENSSL_PUT_ERROR| * macro. The resulting define will be + * ${lib}_F_${reason}. */ +#define OPENSSL_DECLARE_ERROR_FUNCTION(lib, function_name) + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_ERR_H */ diff --git a/phonelibs/boringssl/include/openssl/evp.h b/phonelibs/boringssl/include/openssl/evp.h new file mode 100644 index 00000000000000..490a9514c33281 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/evp.h @@ -0,0 +1,826 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_EVP_H +#define OPENSSL_HEADER_EVP_H + +#include + +#include + +/* OpenSSL included digest and cipher functions in this header so we include + * them for users that still expect that. + * + * TODO(fork): clean up callers so that they include what they use. */ +#include +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* EVP abstracts over public/private key algorithms. */ + + +/* Public key objects. */ + +/* EVP_PKEY_new creates a new, empty public-key object and returns it or NULL + * on allocation failure. */ +OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_new(void); + +/* EVP_PKEY_free frees all data referenced by |pkey| and then frees |pkey| + * itself. */ +OPENSSL_EXPORT void EVP_PKEY_free(EVP_PKEY *pkey); + +/* EVP_PKEY_up_ref increments the reference count of |pkey| and returns it. */ +OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_up_ref(EVP_PKEY *pkey); + +/* EVP_PKEY_is_opaque returns one if |pkey| is opaque. Opaque keys are backed by + * custom implementations which do not expose key material and parameters. It is + * an error to attempt to duplicate, export, or compare an opaque key. */ +OPENSSL_EXPORT int EVP_PKEY_is_opaque(const EVP_PKEY *pkey); + +/* EVP_PKEY_supports_digest returns one if |pkey| supports digests of + * type |md|. This is intended for use with EVP_PKEYs backing custom + * implementations which can't sign all digests. */ +OPENSSL_EXPORT int EVP_PKEY_supports_digest(const EVP_PKEY *pkey, + const EVP_MD *md); + +/* EVP_PKEY_cmp compares |a| and |b| and returns one if they are equal, zero if + * not and a negative number on error. + * + * WARNING: this differs from the traditional return value of a "cmp" + * function. */ +OPENSSL_EXPORT int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); + +/* EVP_PKEY_copy_parameters sets the parameters of |to| to equal the parameters + * of |from|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); + +/* EVP_PKEY_missing_parameters returns one if |pkey| is missing needed + * parameters or zero if not, or if the algorithm doesn't take parameters. */ +OPENSSL_EXPORT int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); + +/* EVP_PKEY_size returns the maximum size, in bytes, of a signature signed by + * |pkey|. For an RSA key, this returns the number of bytes needed to represent + * the modulus. For an EC key, this returns the maximum size of a DER-encoded + * ECDSA signature. */ +OPENSSL_EXPORT int EVP_PKEY_size(const EVP_PKEY *pkey); + +/* EVP_PKEY_bits returns the "size", in bits, of |pkey|. For an RSA key, this + * returns the bit length of the modulus. For an EC key, this returns the bit + * length of the group order. */ +OPENSSL_EXPORT int EVP_PKEY_bits(EVP_PKEY *pkey); + +/* EVP_PKEY_id returns the type of |pkey|, which is one of the |EVP_PKEY_*| + * values. */ +OPENSSL_EXPORT int EVP_PKEY_id(const EVP_PKEY *pkey); + +/* EVP_PKEY_type returns a canonicalised form of |NID|. For example, + * |EVP_PKEY_RSA2| will be turned into |EVP_PKEY_RSA|. */ +OPENSSL_EXPORT int EVP_PKEY_type(int nid); + +/* Deprecated: EVP_PKEY_new_mac_key allocates a fresh |EVP_PKEY| of the given + * type (e.g. |EVP_PKEY_HMAC|), sets |mac_key| as the MAC key and "generates" a + * new key, suitable for signing. It returns the fresh |EVP_PKEY|, or NULL on + * error. Use |HMAC_CTX| directly instead. */ +OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *engine, + const uint8_t *mac_key, + size_t mac_key_len); + + +/* Getting and setting concrete public key types. + * + * The following functions get and set the underlying public key in an + * |EVP_PKEY| object. The |set1| functions take an additional reference to the + * underlying key and return one on success or zero on error. The |assign| + * functions adopt the caller's reference. The getters return a fresh reference + * to the underlying object. */ + +OPENSSL_EXPORT int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key); +OPENSSL_EXPORT int EVP_PKEY_assign_RSA(EVP_PKEY *pkey, RSA *key); +OPENSSL_EXPORT RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); + +OPENSSL_EXPORT int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); +OPENSSL_EXPORT int EVP_PKEY_assign_DSA(EVP_PKEY *pkey, DSA *key); +OPENSSL_EXPORT struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); + +OPENSSL_EXPORT int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); +OPENSSL_EXPORT int EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey, EC_KEY *key); +OPENSSL_EXPORT struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); + +OPENSSL_EXPORT int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); +OPENSSL_EXPORT int EVP_PKEY_assign_DH(EVP_PKEY *pkey, DH *key); +OPENSSL_EXPORT struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); + +#define EVP_PKEY_NONE NID_undef +#define EVP_PKEY_RSA NID_rsaEncryption +#define EVP_PKEY_RSA2 NID_rsa +#define EVP_PKEY_DSA NID_dsa +#define EVP_PKEY_DH NID_dhKeyAgreement +#define EVP_PKEY_DHX NID_dhpublicnumber +#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey + +/* Deprecated: Use |HMAC_CTX| directly instead. */ +#define EVP_PKEY_HMAC NID_hmac + +/* EVP_PKEY_assign sets the underlying key of |pkey| to |key|, which must be of + * the given type. The |type| argument should be one of the |EVP_PKEY_*| + * values. */ +OPENSSL_EXPORT int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); + +/* EVP_PKEY_set_type sets the type of |pkey| to |type|, which should be one of + * the |EVP_PKEY_*| values. It returns one if sucessful or zero otherwise. If + * |pkey| is NULL, it simply reports whether the type is known. */ +OPENSSL_EXPORT int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); + +/* EVP_PKEY_cmp_parameters compares the parameters of |a| and |b|. It returns + * one if they match, zero if not, or a negative number of on error. + * + * WARNING: the return value differs from the usual return value convention. */ +OPENSSL_EXPORT int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, + const EVP_PKEY *b); + + +/* ASN.1 functions */ + +/* d2i_PrivateKey parses an ASN.1, DER-encoded, private key from |len| bytes at + * |*inp|. If |out| is not NULL then, on exit, a pointer to the result is in + * |*out|. If |*out| is already non-NULL on entry then the result is written + * directly into |*out|, otherwise a fresh |EVP_PKEY| is allocated. On + * successful exit, |*inp| is advanced past the DER structure. It returns the + * result or NULL on error. */ +OPENSSL_EXPORT EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **out, + const uint8_t **inp, long len); + +/* d2i_AutoPrivateKey acts the same as |d2i_PrivateKey|, but detects the type + * of the private key. */ +OPENSSL_EXPORT EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **out, const uint8_t **inp, + long len); + +/* i2d_PrivateKey marshals a private key from |key| to an ASN.1, DER + * structure. If |outp| is not NULL then the result is written to |*outp| and + * |*outp| is advanced just past the output. It returns the number of bytes in + * the result, whether written or not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_PrivateKey(const EVP_PKEY *key, uint8_t **outp); + +/* i2d_PublicKey marshals a public key from |key| to an ASN.1, DER + * structure. If |outp| is not NULL then the result is written to |*outp| and + * |*outp| is advanced just past the output. It returns the number of bytes in + * the result, whether written or not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_PublicKey(EVP_PKEY *key, uint8_t **outp); + + +/* Signing */ + +/* EVP_DigestSignInit sets up |ctx| for a signing operation with |type| and + * |pkey|. The |ctx| argument must have been initialised with + * |EVP_MD_CTX_init|. If |pctx| is not NULL, the |EVP_PKEY_CTX| of the signing + * operation will be written to |*pctx|; this can be used to set alternative + * signing options. + * + * It returns one on success, or zero on error. */ +OPENSSL_EXPORT int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); + +/* EVP_DigestSignUpdate appends |len| bytes from |data| to the data which will + * be signed in |EVP_DigestSignFinal|. It returns one. */ +OPENSSL_EXPORT int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, + size_t len); + +/* EVP_DigestSignFinal signs the data that has been included by one or more + * calls to |EVP_DigestSignUpdate|. If |out_sig| is NULL then |*out_sig_len| is + * set to the maximum number of output bytes. Otherwise, on entry, + * |*out_sig_len| must contain the length of the |out_sig| buffer. If the call + * is successful, the signature is written to |out_sig| and |*out_sig_len| is + * set to its length. + * + * It returns one on success, or zero on error. */ +OPENSSL_EXPORT int EVP_DigestSignFinal(EVP_MD_CTX *ctx, uint8_t *out_sig, + size_t *out_sig_len); + +/* EVP_DigestSignAlgorithm encodes the signing parameters of |ctx| as an + * AlgorithmIdentifer and saves the result in |algor|. + * + * It returns one on success, or zero on error. + * + * TODO(davidben): This API should eventually lose the dependency on + * crypto/asn1/. */ +OPENSSL_EXPORT int EVP_DigestSignAlgorithm(EVP_MD_CTX *ctx, X509_ALGOR *algor); + + +/* Verifying */ + +/* EVP_DigestVerifyInit sets up |ctx| for a signature verification operation + * with |type| and |pkey|. The |ctx| argument must have been initialised with + * |EVP_MD_CTX_init|. If |pctx| is not NULL, the |EVP_PKEY_CTX| of the signing + * operation will be written to |*pctx|; this can be used to set alternative + * signing options. + * + * It returns one on success, or zero on error. */ +OPENSSL_EXPORT int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); + +/* EVP_DigestVerifyInitFromAlgorithm sets up |ctx| for a signature verification + * operation with public key |pkey| and parameters from |algor|. The |ctx| + * argument must have been initialised with |EVP_MD_CTX_init|. + * + * It returns one on success, or zero on error. + * + * TODO(davidben): This API should eventually lose the dependency on + * crypto/asn1/. */ +OPENSSL_EXPORT int EVP_DigestVerifyInitFromAlgorithm(EVP_MD_CTX *ctx, + X509_ALGOR *algor, + EVP_PKEY *pkey); + +/* EVP_DigestVerifyUpdate appends |len| bytes from |data| to the data which + * will be verified by |EVP_DigestVerifyFinal|. It returns one. */ +OPENSSL_EXPORT int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *data, + size_t len); + +/* EVP_DigestVerifyFinal verifies that |sig_len| bytes of |sig| are a valid + * signature for the data that has been included by one or more calls to + * |EVP_DigestVerifyUpdate|. It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const uint8_t *sig, + size_t sig_len); + + +/* Signing (old functions) */ + +/* EVP_SignInit_ex configures |ctx|, which must already have been initialised, + * for a fresh signing operation using the hash function |type|. It returns one + * on success and zero otherwise. + * + * (In order to initialise |ctx|, either obtain it initialised with + * |EVP_MD_CTX_create|, or use |EVP_MD_CTX_init|.) */ +OPENSSL_EXPORT int EVP_SignInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, + ENGINE *impl); + +/* EVP_SignInit is a deprecated version of |EVP_SignInit_ex|. + * + * TODO(fork): remove. */ +OPENSSL_EXPORT int EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type); + +/* EVP_SignUpdate appends |len| bytes from |data| to the data which will be + * signed in |EVP_SignFinal|. */ +OPENSSL_EXPORT int EVP_SignUpdate(EVP_MD_CTX *ctx, const void *data, + size_t len); + +/* EVP_SignFinal signs the data that has been included by one or more calls to + * |EVP_SignUpdate|, using the key |pkey|, and writes it to |sig|. On entry, + * |sig| must point to at least |EVP_PKEY_size(pkey)| bytes of space. The + * actual size of the signature is written to |*out_sig_len|. + * + * It returns one on success and zero otherwise. + * + * It does not modify |ctx|, thus it's possible to continue to use |ctx| in + * order to sign a longer message. */ +OPENSSL_EXPORT int EVP_SignFinal(const EVP_MD_CTX *ctx, uint8_t *sig, + unsigned int *out_sig_len, EVP_PKEY *pkey); + + +/* Verifying (old functions) */ + +/* EVP_VerifyInit_ex configures |ctx|, which must already have been + * initialised, for a fresh signature verification operation using the hash + * function |type|. It returns one on success and zero otherwise. + * + * (In order to initialise |ctx|, either obtain it initialised with + * |EVP_MD_CTX_create|, or use |EVP_MD_CTX_init|.) */ +OPENSSL_EXPORT int EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, + ENGINE *impl); + +/* EVP_VerifyInit is a deprecated version of |EVP_VerifyInit_ex|. + * + * TODO(fork): remove. */ +OPENSSL_EXPORT int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type); + +/* EVP_VerifyUpdate appends |len| bytes from |data| to the data which will be + * signed in |EVP_VerifyFinal|. */ +OPENSSL_EXPORT int EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *data, + size_t len); + +/* EVP_VerifyFinal verifies that |sig_len| bytes of |sig| are a valid + * signature, by |pkey|, for the data that has been included by one or more + * calls to |EVP_VerifyUpdate|. + * + * It returns one on success and zero otherwise. + * + * It does not modify |ctx|, thus it's possible to continue to use |ctx| in + * order to sign a longer message. */ +OPENSSL_EXPORT int EVP_VerifyFinal(EVP_MD_CTX *ctx, const uint8_t *sig, + size_t sig_len, EVP_PKEY *pkey); + + +/* Printing */ + +/* EVP_PKEY_print_public prints a textual representation of the public key in + * |pkey| to |out|. Returns one on success or zero otherwise. */ +OPENSSL_EXPORT int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); + +/* EVP_PKEY_print_public prints a textual representation of the private key in + * |pkey| to |out|. Returns one on success or zero otherwise. */ +OPENSSL_EXPORT int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); + +/* EVP_PKEY_print_public prints a textual representation of the parameters in + * |pkey| to |out|. Returns one on success or zero otherwise. */ +OPENSSL_EXPORT int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); + + +/* Password stretching. + * + * Password stretching functions take a low-entropy password and apply a slow + * function that results in a key suitable for use in symmetric + * cryptography. */ + +/* PKCS5_PBKDF2_HMAC computes |iterations| iterations of PBKDF2 of |password| + * and |salt|, using |digest|, and outputs |key_len| bytes to |out_key|. It + * returns one on success and zero on error. */ +OPENSSL_EXPORT int PKCS5_PBKDF2_HMAC(const char *password, size_t password_len, + const uint8_t *salt, size_t salt_len, + unsigned iterations, const EVP_MD *digest, + size_t key_len, uint8_t *out_key); + +/* PKCS5_PBKDF2_HMAC_SHA1 is the same as PKCS5_PBKDF2_HMAC, but with |digest| + * fixed to |EVP_sha1|. */ +OPENSSL_EXPORT int PKCS5_PBKDF2_HMAC_SHA1(const char *password, + size_t password_len, const uint8_t *salt, + size_t salt_len, unsigned iterations, + size_t key_len, uint8_t *out_key); + + +/* Public key contexts. + * + * |EVP_PKEY_CTX| objects hold the context of an operation (e.g. signing or + * encrypting) that uses a public key. */ + +/* EVP_PKEY_CTX_new allocates a fresh |EVP_PKEY_CTX| for use with |pkey|. It + * returns the context or NULL on error. */ +OPENSSL_EXPORT EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); + +/* EVP_PKEY_CTX_new allocates a fresh |EVP_PKEY_CTX| for a key of type |id| + * (e.g. |EVP_PKEY_HMAC|). This can be used for key generation where + * |EVP_PKEY_CTX_new| can't be used because there isn't an |EVP_PKEY| to pass + * it. It returns the context or NULL on error. */ +OPENSSL_EXPORT EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); + +/* EVP_KEY_CTX_free frees |ctx| and the data it owns. */ +OPENSSL_EXPORT void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_CTX_dup allocates a fresh |EVP_PKEY_CTX| and sets it equal to the + * state of |ctx|. It returns the fresh |EVP_PKEY_CTX| or NULL on error. */ +OPENSSL_EXPORT EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_CTX_get0_pkey returns the |EVP_PKEY| associated with |ctx|. */ +OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_CTX_set_app_data sets an opaque pointer on |ctx|. */ +OPENSSL_EXPORT void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); + +/* EVP_PKEY_CTX_get_app_data returns the opaque pointer from |ctx| that was + * previously set with |EVP_PKEY_CTX_set_app_data|, or NULL if none has been + * set. */ +OPENSSL_EXPORT void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_sign_init initialises an |EVP_PKEY_CTX| for a signing operation. It + * should be called before |EVP_PKEY_sign|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_sign signs |data_len| bytes from |data| using |ctx|. If |sig| is + * NULL, the maximum size of the signature is written to + * |out_sig_len|. Otherwise, |*sig_len| must contain the number of bytes of + * space available at |sig|. If sufficient, the signature will be written to + * |sig| and |*sig_len| updated with the true length. + * + * WARNING: Setting |sig| to NULL only gives the maximum size of the + * signature. The actual signature may be smaller. + * + * It returns one on success or zero on error. (Note: this differs from + * OpenSSL, which can also return negative values to indicate an error. ) */ +OPENSSL_EXPORT int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, uint8_t *sig, + size_t *sig_len, const uint8_t *data, + size_t data_len); + +/* EVP_PKEY_verify_init initialises an |EVP_PKEY_CTX| for a signature + * verification operation. It should be called before |EVP_PKEY_verify|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_verify verifies that |sig_len| bytes from |sig| are a valid signature + * for |data|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, const uint8_t *sig, + size_t sig_len, const uint8_t *data, + size_t data_len); + +/* EVP_PKEY_encrypt_init initialises an |EVP_PKEY_CTX| for an encryption + * operation. It should be called before |EVP_PKEY_encrypt|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_encrypt encrypts |in_len| bytes from |in|. If |out| is NULL, the + * maximum size of the ciphertext is written to |out_len|. Otherwise, |*out_len| + * must contain the number of bytes of space available at |out|. If sufficient, + * the ciphertext will be written to |out| and |*out_len| updated with the true + * length. + * + * WARNING: Setting |out| to NULL only gives the maximum size of the + * ciphertext. The actual ciphertext may be smaller. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, uint8_t *out, + size_t *out_len, const uint8_t *in, + size_t in_len); + +/* EVP_PKEY_decrypt_init initialises an |EVP_PKEY_CTX| for a decryption + * operation. It should be called before |EVP_PKEY_decrypt|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_decrypt decrypts |in_len| bytes from |in|. If |out| is NULL, the + * maximum size of the plaintext is written to |out_len|. Otherwise, |*out_len| + * must contain the number of bytes of space available at |out|. If sufficient, + * the ciphertext will be written to |out| and |*out_len| updated with the true + * length. + * + * WARNING: Setting |out| to NULL only gives the maximum size of the + * plaintext. The actual plaintext may be smaller. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, uint8_t *out, + size_t *out_len, const uint8_t *in, + size_t in_len); + +/* EVP_PKEY_derive_init initialises an |EVP_PKEY_CTX| for a key derivation + * operation. It should be called before |EVP_PKEY_derive_set_peer| and + * |EVP_PKEY_derive|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_derive_set_peer sets the peer's key to be used for key derivation + * by |ctx| to |peer|. It should be called after |EVP_PKEY_derive_init|. (For + * example, this is used to set the peer's key in (EC)DH.) It returns one on + * success and zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); + +/* EVP_PKEY_derive derives a shared key between the two keys configured in + * |ctx|. If |key| is non-NULL then, on entry, |out_key_len| must contain the + * amount of space at |key|. If sufficient then the shared key will be written + * to |key| and |*out_key_len| will be set to the length. If |key| is NULL then + * |out_key_len| will be set to the maximum length. + * + * WARNING: Setting |out| to NULL only gives the maximum size of the key. The + * actual key may be smaller. + * + * It returns one on success and zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, uint8_t *key, + size_t *out_key_len); + +/* EVP_PKEY_keygen_init initialises an |EVP_PKEY_CTX| for a key generation + * operation. It should be called before |EVP_PKEY_keygen|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); + +/* EVP_PKEY_keygen performs a key generation operation using the values from + * |ctx| and sets |*ppkey| to a fresh |EVP_PKEY| containing the resulting key. + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); + + +/* Generic control functions. */ + +/* EVP_PKEY_CTX_set_signature_md sets |md| as the digest to be used in a + * signature operation. It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, + const EVP_MD *md); + +/* EVP_PKEY_CTX_get_signature_md sets |*out_md| to the digest to be used in a + * signature operation. It returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx, + const EVP_MD **out_md); + + +/* RSA specific control functions. */ + +/* EVP_PKEY_CTX_set_rsa_padding sets the padding type to use. It should be one + * of the |RSA_*_PADDING| values. Returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int padding); + +/* EVP_PKEY_CTX_get_rsa_padding sets |*out_padding| to the current padding + * value, which is one of the |RSA_*_PADDING| values. Returns one on success or + * zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_get_rsa_padding(EVP_PKEY_CTX *ctx, + int *out_padding); + +/* EVP_PKEY_CTX_set_rsa_pss_saltlen sets the length of the salt in a PSS-padded + * signature. A value of -1 cause the salt to be the same length as the digest + * in the signature. A value of -2 causes the salt to be the maximum length + * that will fit. Otherwise the value gives the size of the salt in bytes. + * + * Returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, + int salt_len); + +/* EVP_PKEY_CTX_get_rsa_pss_saltlen sets |*out_salt_len| to the salt length of + * a PSS-padded signature. See the documentation for + * |EVP_PKEY_CTX_set_rsa_pss_saltlen| for details of the special values that it + * can take. + * + * Returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_get_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, + int *out_salt_len); + +/* EVP_PKEY_CTX_set_rsa_keygen_bits sets the size of the desired RSA modulus, + * in bits, for key generation. Returns one on success or zero on + * error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX *ctx, + int bits); + +/* EVP_PKEY_CTX_set_rsa_keygen_pubexp sets |e| as the public exponent for key + * generation. Returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, + BIGNUM *e); + +/* EVP_PKEY_CTX_set_rsa_oaep_md sets |md| as the digest used in OAEP padding. + * Returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, + const EVP_MD *md); + +/* EVP_PKEY_CTX_get_rsa_oaep_md sets |*out_md| to the digest function used in + * OAEP padding. Returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_get_rsa_oaep_md(EVP_PKEY_CTX *ctx, + const EVP_MD **out_md); + +/* EVP_PKEY_CTX_set_rsa_mgf1_md sets |md| as the digest used in MGF1. Returns + * one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, + const EVP_MD *md); + +/* EVP_PKEY_CTX_get_rsa_mgf1_md sets |*out_md| to the digest function used in + * MGF1. Returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_get_rsa_mgf1_md(EVP_PKEY_CTX *ctx, + const EVP_MD **out_md); + +/* EVP_PKEY_CTX_set0_rsa_oaep_label sets |label_len| bytes from |label| as the + * label used in OAEP. DANGER: On success, this call takes ownership of |label| + * and will call |OPENSSL_free| on it when |ctx| is destroyed. + * + * Returns one on success or zero on error. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, + const uint8_t *label, + size_t label_len); + +/* EVP_PKEY_CTX_get0_rsa_oaep_label sets |*out_label| to point to the internal + * buffer containing the OAEP label (which may be NULL) and returns the length + * of the label or a negative value on error. + * + * WARNING: the return value differs from the usual return value convention. */ +OPENSSL_EXPORT int EVP_PKEY_CTX_get0_rsa_oaep_label(EVP_PKEY_CTX *ctx, + const uint8_t **out_label); + + +/* Deprecated functions. */ + +/* EVP_PKEY_dup adds one to the reference count of |pkey| and returns + * |pkey|. + * + * WARNING: this is a |_dup| function that doesn't actually duplicate! Use + * |EVP_PKEY_up_ref| if you want to increment the reference count without + * confusion. */ +OPENSSL_EXPORT EVP_PKEY *EVP_PKEY_dup(EVP_PKEY *pkey); + + +/* Private functions */ + +/* OpenSSL_add_all_algorithms does nothing. */ +OPENSSL_EXPORT void OpenSSL_add_all_algorithms(void); + +/* OpenSSL_add_all_ciphers does nothing. */ +OPENSSL_EXPORT void OpenSSL_add_all_ciphers(void); + +/* OpenSSL_add_all_digests does nothing. */ +OPENSSL_EXPORT void OpenSSL_add_all_digests(void); + +/* EVP_cleanup does nothing. */ +OPENSSL_EXPORT void EVP_cleanup(void); + +/* EVP_PKEY_asn1_find returns the ASN.1 method table for the given |nid|, which + * should be one of the |EVP_PKEY_*| values. It returns NULL if |nid| is + * unknown. */ +OPENSSL_EXPORT const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pengine, + int nid); + +/* TODO(fork): move to PEM? */ +OPENSSL_EXPORT const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str( + ENGINE **pengine, const char *name, size_t len); + +struct evp_pkey_st { + CRYPTO_refcount_t references; + + /* type contains one of the EVP_PKEY_* values or NID_undef and determines + * which element (if any) of the |pkey| union is valid. */ + int type; + + union { + char *ptr; + struct rsa_st *rsa; /* RSA */ + struct dsa_st *dsa; /* DSA */ + struct dh_st *dh; /* DH */ + struct ec_key_st *ec; /* ECC */ + } pkey; + + /* ameth contains a pointer to a method table that contains many ASN.1 + * methods for the key type. */ + const EVP_PKEY_ASN1_METHOD *ameth; +} /* EVP_PKEY */; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define EVP_F_EVP_PKEY_derive_init 108 +#define EVP_F_EVP_PKEY_encrypt 110 +#define EVP_F_EVP_PKEY_encrypt_init 111 +#define EVP_F_EVP_PKEY_get1_DH 112 +#define EVP_F_EVP_PKEY_get1_EC_KEY 114 +#define EVP_F_EVP_PKEY_get1_RSA 115 +#define EVP_F_EVP_PKEY_keygen 116 +#define EVP_F_EVP_PKEY_sign 120 +#define EVP_F_EVP_PKEY_sign_init 121 +#define EVP_F_EVP_PKEY_verify 122 +#define EVP_F_EVP_PKEY_verify_init 123 +#define EVP_F_d2i_AutoPrivateKey 125 +#define EVP_F_d2i_PrivateKey 126 +#define EVP_F_do_EC_KEY_print 127 +#define EVP_F_do_sigver_init 129 +#define EVP_F_eckey_param2type 130 +#define EVP_F_eckey_param_decode 131 +#define EVP_F_eckey_priv_decode 132 +#define EVP_F_eckey_priv_encode 133 +#define EVP_F_eckey_pub_decode 134 +#define EVP_F_eckey_pub_encode 135 +#define EVP_F_eckey_type2param 136 +#define EVP_F_evp_pkey_ctx_new 137 +#define EVP_F_hmac_signctx 138 +#define EVP_F_i2d_PublicKey 139 +#define EVP_F_old_ec_priv_decode 140 +#define EVP_F_old_rsa_priv_decode 141 +#define EVP_F_pkey_ec_ctrl 142 +#define EVP_F_pkey_ec_derive 143 +#define EVP_F_pkey_ec_keygen 144 +#define EVP_F_pkey_ec_paramgen 145 +#define EVP_F_pkey_ec_sign 146 +#define EVP_F_pkey_rsa_ctrl 147 +#define EVP_F_pkey_rsa_decrypt 148 +#define EVP_F_pkey_rsa_encrypt 149 +#define EVP_F_pkey_rsa_sign 150 +#define EVP_F_rsa_algor_to_md 151 +#define EVP_F_rsa_digest_verify_init_from_algorithm 152 +#define EVP_F_rsa_mgf1_to_md 153 +#define EVP_F_rsa_priv_decode 154 +#define EVP_F_rsa_priv_encode 155 +#define EVP_F_rsa_pss_to_ctx 156 +#define EVP_F_rsa_pub_decode 157 +#define EVP_F_pkey_hmac_ctrl 158 +#define EVP_F_EVP_PKEY_CTX_get0_rsa_oaep_label 159 +#define EVP_F_EVP_DigestSignAlgorithm 160 +#define EVP_F_EVP_DigestVerifyInitFromAlgorithm 161 +#define EVP_F_EVP_PKEY_CTX_ctrl 162 +#define EVP_F_EVP_PKEY_CTX_dup 163 +#define EVP_F_EVP_PKEY_copy_parameters 164 +#define EVP_F_EVP_PKEY_decrypt 165 +#define EVP_F_EVP_PKEY_decrypt_init 166 +#define EVP_F_EVP_PKEY_derive 167 +#define EVP_F_EVP_PKEY_derive_set_peer 168 +#define EVP_F_EVP_PKEY_get1_DSA 169 +#define EVP_F_EVP_PKEY_keygen_init 170 +#define EVP_F_EVP_PKEY_new 171 +#define EVP_F_EVP_PKEY_set_type 172 +#define EVP_F_check_padding_md 173 +#define EVP_F_do_dsa_print 174 +#define EVP_F_do_rsa_print 175 +#define EVP_F_dsa_param_decode 176 +#define EVP_F_dsa_priv_decode 177 +#define EVP_F_dsa_priv_encode 178 +#define EVP_F_dsa_pub_decode 179 +#define EVP_F_dsa_pub_encode 180 +#define EVP_F_dsa_sig_print 181 +#define EVP_F_old_dsa_priv_decode 182 +#define EVP_R_BUFFER_TOO_SMALL 100 +#define EVP_R_COMMAND_NOT_SUPPORTED 101 +#define EVP_R_DIFFERENT_KEY_TYPES 104 +#define EVP_R_DIFFERENT_PARAMETERS 105 +#define EVP_R_EXPECTING_AN_EC_KEY_KEY 107 +#define EVP_R_EXPECTING_A_DH_KEY 109 +#define EVP_R_EXPECTING_A_DSA_KEY 110 +#define EVP_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 111 +#define EVP_R_INVALID_CURVE 112 +#define EVP_R_INVALID_DIGEST_LENGTH 113 +#define EVP_R_INVALID_DIGEST_TYPE 114 +#define EVP_R_INVALID_KEYBITS 115 +#define EVP_R_INVALID_MGF1_MD 116 +#define EVP_R_INVALID_PADDING_MODE 118 +#define EVP_R_INVALID_PSS_PARAMETERS 119 +#define EVP_R_INVALID_SALT_LENGTH 121 +#define EVP_R_INVALID_TRAILER 122 +#define EVP_R_KEYS_NOT_SET 123 +#define EVP_R_MISSING_PARAMETERS 124 +#define EVP_R_NO_DEFAULT_DIGEST 125 +#define EVP_R_NO_KEY_SET 126 +#define EVP_R_NO_MDC2_SUPPORT 127 +#define EVP_R_NO_NID_FOR_CURVE 128 +#define EVP_R_NO_OPERATION_SET 129 +#define EVP_R_NO_PARAMETERS_SET 130 +#define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 131 +#define EVP_R_OPERATON_NOT_INITIALIZED 132 +#define EVP_R_UNKNOWN_DIGEST 133 +#define EVP_R_UNKNOWN_MASK_DIGEST 134 +#define EVP_R_UNSUPPORTED_ALGORITHM 138 +#define EVP_R_UNSUPPORTED_MASK_ALGORITHM 139 +#define EVP_R_UNSUPPORTED_MASK_PARAMETER 140 +#define EVP_R_EXPECTING_AN_RSA_KEY 141 +#define EVP_R_INVALID_OPERATION 142 +#define EVP_R_DECODE_ERROR 143 +#define EVP_R_INVALID_PSS_SALTLEN 144 +#define EVP_R_UNKNOWN_PUBLIC_KEY_TYPE 145 +#define EVP_R_CONTEXT_NOT_INITIALISED 146 +#define EVP_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 147 +#define EVP_R_WRONG_PUBLIC_KEY_TYPE 148 +#define EVP_R_UNKNOWN_SIGNATURE_ALGORITHM 149 +#define EVP_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 150 +#define EVP_R_BN_DECODE_ERROR 151 +#define EVP_R_PARAMETER_ENCODING_ERROR 152 +#define EVP_R_UNSUPPORTED_PUBLIC_KEY_TYPE 153 +#define EVP_R_UNSUPPORTED_SIGNATURE_TYPE 154 + +#endif /* OPENSSL_HEADER_EVP_H */ diff --git a/phonelibs/boringssl/include/openssl/ex_data.h b/phonelibs/boringssl/include/openssl/ex_data.h new file mode 100644 index 00000000000000..2303eb425014e2 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ex_data.h @@ -0,0 +1,214 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + +#ifndef OPENSSL_HEADER_EX_DATA_H +#define OPENSSL_HEADER_EX_DATA_H + +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* ex_data is a mechanism for associating arbitrary extra data with objects. + * For each type of object that supports ex_data, different users can be + * assigned indexes in which to store their data. Each index has callback + * functions that are called when a new object of that type is created, freed + * and duplicated. */ + + +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; + + +/* Type-specific functions. + * + * Each type that supports ex_data provides three functions: */ + +#if 0 /* Sample */ + +/* |TYPE_get_ex_new_index| allocates a new index for |TYPE|. See the + * descriptions of the callback typedefs for details of when they are + * called. Any of the callback arguments may be NULL. The |argl| and |argp| + * arguments are opaque values that are passed to the callbacks. It returns the + * new index or a negative number on error. + * + * TODO(fork): this should follow the standard calling convention. */ +OPENSSL_EXPORT int TYPE_get_ex_new_index(long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); + +/* |TYPE_set_ex_data| sets an extra data pointer on |t|. The |index| argument + * should have been returned from a previous call to |TYPE_get_ex_new_index|. */ +OPENSSL_EXPORT int TYPE_set_ex_data(TYPE *t, int index, void *arg); + +/* |TYPE_get_ex_data| returns an extra data pointer for |t|, or NULL if no such + * pointer exists. The |index| argument should have been returned from a + * previous call to |TYPE_get_ex_new_index|. */ +OPENSSL_EXPORT void *TYPE_get_ex_data(const TYPE *t, int index); + +#endif /* Sample */ + + +/* Callback types. */ + +/* CRYPTO_EX_new is the type of a callback function that is called whenever a + * new object of a given class is created. For example, if this callback has + * been passed to |SSL_get_ex_new_index| then it'll be called each time an SSL* + * is created. + * + * The callback is passed the new object (i.e. the SSL*) in |parent|. The + * arguments |argl| and |argp| contain opaque values that were given to + * |CRYPTO_get_ex_new_index|. The callback should return one on success, but + * the value is ignored. + * + * TODO(fork): the |ptr| argument is always NULL, no? */ +typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int index, long argl, void *argp); + +/* CRYPTO_EX_free is a callback function that is called when an object of the + * class is being destroyed. See |CRYPTO_EX_new| for a discussion of the + * arguments. + * + * If |CRYPTO_get_ex_new_index| was called after the creation of objects of the + * class that this applies to then, when those those objects are destroyed, + * this callback will be called with a NULL value for |ptr|. */ +typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int index, long argl, void *argp); + +/* CRYPTO_EX_dup is a callback function that is called when an object of the + * class is being copied and thus the ex_data linked to it also needs to be + * copied. On entry, |*from_d| points to the data for this index from the + * original object. When the callback returns, |*from_d| will be set as the + * data for this index in |to|. + * + * If |CRYPTO_get_ex_new_index| was called after the creation of objects of the + * class that this applies to then, when those those objects are copies, this + * callback will be called with a NULL value for |*from_d|. */ +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, + void **from_d, int index, long argl, void *argp); + + +/* Deprecated functions. */ + +/* CRYPTO_cleanup_all_ex_data does nothing. */ +OPENSSL_EXPORT void CRYPTO_cleanup_all_ex_data(void); + +struct crypto_ex_data_st { + STACK_OF(void) *sk; +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_EX_DATA_H */ diff --git a/phonelibs/boringssl/include/openssl/hkdf.h b/phonelibs/boringssl/include/openssl/hkdf.h new file mode 100644 index 00000000000000..4091b84beb8eff --- /dev/null +++ b/phonelibs/boringssl/include/openssl/hkdf.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_HKDF_H +#define OPENSSL_HEADER_HKDF_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Computes HKDF (as specified by RFC 5869) of initial keying material |secret| + * with |salt| and |info| using |digest|, and outputs |out_len| bytes to + * |out_key|. It returns one on success and zero on error. + * + * HKDF is an Extract-and-Expand algorithm. It does not do any key stretching, + * and as such, is not suited to be used alone to generate a key from a + * password. */ +OPENSSL_EXPORT int HKDF(uint8_t *out_key, size_t out_len, const EVP_MD *digest, + const uint8_t *secret, size_t secret_len, + const uint8_t *salt, size_t salt_len, + const uint8_t *info, size_t info_len); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define HKDF_F_HKDF 100 +#define HKDF_R_OUTPUT_TOO_LARGE 100 + +#endif /* OPENSSL_HEADER_HKDF_H */ diff --git a/phonelibs/boringssl/include/openssl/hmac.h b/phonelibs/boringssl/include/openssl/hmac.h new file mode 100644 index 00000000000000..e521212d4cd254 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/hmac.h @@ -0,0 +1,160 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_HMAC_H +#define OPENSSL_HEADER_HMAC_H + +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* HMAC contains functions for constructing PRFs from Merkle–Damgård hash + * functions using HMAC. */ + + +/* One-shot operation. */ + +/* HMAC calculates the HMAC of |data_len| bytes of |data|, using the given key + * and hash function, and writes the result to |out|. On entry, |out| must + * contain |EVP_MAX_MD_SIZE| bytes of space. The actual length of the result is + * written to |*out_len|. It returns |out| or NULL on error. */ +OPENSSL_EXPORT uint8_t *HMAC(const EVP_MD *evp_md, const void *key, + size_t key_len, const uint8_t *data, + size_t data_len, uint8_t *out, + unsigned int *out_len); + + +/* Incremental operation. */ + +/* HMAC_CTX_init initialises |ctx| for use in an HMAC operation. It's assumed + * that HMAC_CTX objects will be allocated on the stack thus no allocation + * function is provided. If needed, allocate |sizeof(HMAC_CTX)| and call + * |HMAC_CTX_init| on it. */ +OPENSSL_EXPORT void HMAC_CTX_init(HMAC_CTX *ctx); + +/* HMAC_CTX_cleanup frees data owned by |ctx|. */ +OPENSSL_EXPORT void HMAC_CTX_cleanup(HMAC_CTX *ctx); + +/* HMAC_Init_ex sets up an initialised |HMAC_CTX| to use |md| as the hash + * function and |key| as the key. For a non-initial call, |md| may be NULL, in + * which case the previous hash function will be used. If the hash function has + * not changed and |key| is NULL, |ctx| reuses the previous key. It returns one + * on success or zero otherwise. + * + * WARNING: NULL and empty keys are ambiguous on non-initial calls. Passing NULL + * |key| but repeating the previous |md| reuses the previous key rather than the + * empty key. */ +OPENSSL_EXPORT int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t key_len, + const EVP_MD *md, ENGINE *impl); + +/* HMAC_Update hashes |data_len| bytes from |data| into the current HMAC + * operation in |ctx|. It returns one. */ +OPENSSL_EXPORT int HMAC_Update(HMAC_CTX *ctx, const uint8_t *data, + size_t data_len); + +/* HMAC_Final completes the HMAC operation in |ctx| and writes the result to + * |out| and the sets |*out_len| to the length of the result. On entry, |out| + * must contain at least |EVP_MAX_MD_SIZE| bytes of space. It returns one on + * success or zero on error. */ +OPENSSL_EXPORT int HMAC_Final(HMAC_CTX *ctx, uint8_t *out, + unsigned int *out_len); + + +/* Utility functions. */ + +/* HMAC_size returns the size, in bytes, of the HMAC that will be produced by + * |ctx|. On entry, |ctx| must have been setup with |HMAC_Init_ex|. */ +OPENSSL_EXPORT size_t HMAC_size(const HMAC_CTX *ctx); + +/* HMAC_CTX_copy_ex sets |dest| equal to |src|. On entry, |dest| must have been + * initialised by calling |HMAC_CTX_init|. It returns one on success and zero + * on error. */ +OPENSSL_EXPORT int HMAC_CTX_copy_ex(HMAC_CTX *dest, const HMAC_CTX *src); + + +/* Deprecated functions. */ + +OPENSSL_EXPORT int HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, + const EVP_MD *md); + +/* HMAC_CTX_copy calls |HMAC_CTX_init| on |dest| and then sets it equal to + * |src|. On entry, |dest| must /not/ be initialised for an operation with + * |HMAC_Init_ex|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int HMAC_CTX_copy(HMAC_CTX *dest, const HMAC_CTX *src); + + +/* Private functions */ + +#define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */ + +struct hmac_ctx_st { + const EVP_MD *md; + EVP_MD_CTX md_ctx; + EVP_MD_CTX i_ctx; + EVP_MD_CTX o_ctx; +} /* HMAC_CTX */; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_HMAC_H */ diff --git a/phonelibs/boringssl/include/openssl/lhash.h b/phonelibs/boringssl/include/openssl/lhash.h new file mode 100644 index 00000000000000..d2ee982ebccb4e --- /dev/null +++ b/phonelibs/boringssl/include/openssl/lhash.h @@ -0,0 +1,191 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_LHASH_H +#define OPENSSL_HEADER_LHASH_H + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* lhash is a traditional, chaining hash table that automatically expands and + * contracts as needed. One should not use the lh_* functions directly, rather + * use the type-safe macro wrappers: + * + * A hash table of a specific type of object has type |LHASH_OF(type)|. This + * can be defined (once) with |DEFINE_LHASH_OF(type)| and declared where needed + * with |DECLARE_LHASH_OF(type)|. For example: + * + * struct foo { + * int bar; + * }; + * + * DEFINE_LHASH_OF(struct foo); + * + * Although note that the hash table will contain /pointers/ to |foo|. + * + * A macro will be defined for each of the lh_* functions below. For + * LHASH_OF(foo), the macros would be lh_foo_new, lh_foo_num_items etc. */ + + +#define LHASH_OF(type) struct lhash_st_##type + +#define DEFINE_LHASH_OF(type) LHASH_OF(type) { int dummy; } + +#define DECLARE_LHASH_OF(type) LHASH_OF(type); + +/* The make_macros.sh script in this directory parses the following lines and + * generates the lhash_macros.h file that contains macros for the following + * types of stacks: + * + * LHASH_OF:ASN1_OBJECT + * LHASH_OF:CONF_VALUE + * LHASH_OF:SSL_SESSION */ + +#define IN_LHASH_H +#include +#undef IN_LHASH_H + + +/* lhash_item_st is an element of a hash chain. It points to the opaque data + * for this element and to the next item in the chain. The linked-list is NULL + * terminated. */ +typedef struct lhash_item_st { + void *data; + struct lhash_item_st *next; + /* hash contains the cached, hash value of |data|. */ + uint32_t hash; +} LHASH_ITEM; + +/* lhash_cmp_func is a comparison function that returns a value equal, or not + * equal, to zero depending on whether |*a| is equal, or not equal to |*b|, + * respectively. Note the difference between this and |stack_cmp_func| in that + * this takes pointers to the objects directly. */ +typedef int (*lhash_cmp_func)(const void *a, const void *b); + +/* lhash_hash_func is a function that maps an object to a uniformly distributed + * uint32_t. */ +typedef uint32_t (*lhash_hash_func)(const void *a); + +typedef struct lhash_st { + /* num_items contains the total number of items in the hash table. */ + size_t num_items; + /* buckets is an array of |num_buckets| pointers. Each points to the head of + * a chain of LHASH_ITEM objects that have the same hash value, mod + * |num_buckets|. */ + LHASH_ITEM **buckets; + /* num_buckets contains the length of |buckets|. This value is always >= + * kMinNumBuckets. */ + size_t num_buckets; + /* callback_depth contains the current depth of |lh_doall| or |lh_doall_arg| + * calls. If non-zero then this suppresses resizing of the |buckets| array, + * which would otherwise disrupt the iteration. */ + unsigned callback_depth; + + lhash_cmp_func comp; + lhash_hash_func hash; +} _LHASH; + +/* lh_new returns a new, empty hash table or NULL on error. If |comp| is NULL, + * |strcmp| will be used. If |hash| is NULL, a generic hash function will be + * used. */ +OPENSSL_EXPORT _LHASH *lh_new(lhash_hash_func hash, lhash_cmp_func comp); + +/* lh_free frees the hash table itself but none of the elements. See + * |lh_doall|. */ +OPENSSL_EXPORT void lh_free(_LHASH *lh); + +/* lh_num_items returns the number of items in |lh|. */ +OPENSSL_EXPORT size_t lh_num_items(const _LHASH *lh); + +/* lh_retrieve finds an element equal to |data| in the hash table and returns + * it. If no such element exists, it returns NULL. */ +OPENSSL_EXPORT void *lh_retrieve(const _LHASH *lh, const void *data); + +/* lh_insert inserts |data| into the hash table. If an existing element is + * equal to |data| (with respect to the comparison function) then |*old_data| + * will be set to that value and it will be replaced. Otherwise, or in the + * event of an error, |*old_data| will be set to NULL. It returns one on + * success or zero in the case of an allocation error. */ +OPENSSL_EXPORT int lh_insert(_LHASH *lh, void **old_data, void *data); + +/* lh_delete removes an element equal to |data| from the hash table and returns + * it. If no such element is found, it returns NULL. */ +OPENSSL_EXPORT void *lh_delete(_LHASH *lh, const void *data); + +/* lh_doall calls |func| on each element of the hash table. + * TODO(fork): rename this */ +OPENSSL_EXPORT void lh_doall(_LHASH *lh, void (*func)(void *)); + +/* lh_doall_arg calls |func| on each element of the hash table and also passes + * |arg| as the second argument. + * TODO(fork): rename this */ +OPENSSL_EXPORT void lh_doall_arg(_LHASH *lh, void (*func)(void *, void *), + void *arg); + +/* lh_strhash is the default hash function which processes NUL-terminated + * strings. */ +OPENSSL_EXPORT uint32_t lh_strhash(const char *c); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_STACK_H */ diff --git a/phonelibs/boringssl/include/openssl/lhash_macros.h b/phonelibs/boringssl/include/openssl/lhash_macros.h new file mode 100644 index 00000000000000..1d981073ea9e7c --- /dev/null +++ b/phonelibs/boringssl/include/openssl/lhash_macros.h @@ -0,0 +1,132 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#if !defined(IN_LHASH_H) +#error "Don't include this file directly. Include lhash.h" +#endif + +/* ASN1_OBJECT */ +#define lh_ASN1_OBJECT_new(hash, comp) \ + ((LHASH_OF(ASN1_OBJECT) *)lh_new( \ + CHECKED_CAST(lhash_hash_func, uint32_t (*)(const ASN1_OBJECT *), hash), \ + CHECKED_CAST(lhash_cmp_func, \ + int (*)(const ASN1_OBJECT *a, const ASN1_OBJECT *b), \ + comp))) + +#define lh_ASN1_OBJECT_free(lh) \ + lh_free(CHECKED_CAST(_LHASH *, LHASH_OF(ASN1_OBJECT) *, lh)); + +#define lh_ASN1_OBJECT_num_items(lh) \ + lh_num_items(CHECKED_CAST(_LHASH *, LHASH_OF(ASN1_OBJECT) *, lh)) + +#define lh_ASN1_OBJECT_retrieve(lh, data) \ + ((ASN1_OBJECT *)lh_retrieve( \ + CHECKED_CAST(_LHASH *, LHASH_OF(ASN1_OBJECT) *, lh), \ + CHECKED_CAST(void *, ASN1_OBJECT *, data))) + +#define lh_ASN1_OBJECT_insert(lh, old_data, data) \ + lh_insert(CHECKED_CAST(_LHASH *, LHASH_OF(ASN1_OBJECT) *, lh), \ + CHECKED_CAST(void **, ASN1_OBJECT **, old_data), \ + CHECKED_CAST(void *, ASN1_OBJECT *, data)) + +#define lh_ASN1_OBJECT_delete(lh, data) \ + ((ASN1_OBJECT *)lh_delete( \ + CHECKED_CAST(_LHASH *, LHASH_OF(ASN1_OBJECT) *, lh), \ + CHECKED_CAST(void *, ASN1_OBJECT *, data))) + +#define lh_ASN1_OBJECT_doall(lh, func) \ + lh_doall(CHECKED_CAST(_LHASH *, LHASH_OF(ASN1_OBJECT) *, lh), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_OBJECT *), func)); + +#define lh_ASN1_OBJECT_doall_arg(lh, func, arg) \ + lh_doall_arg(CHECKED_CAST(_LHASH *, LHASH_OF(ASN1_OBJECT) *, lh), \ + CHECKED_CAST(void (*)(void *, void *), \ + void (*)(ASN1_OBJECT *, void *), func), \ + arg); + +/* CONF_VALUE */ +#define lh_CONF_VALUE_new(hash, comp) \ + ((LHASH_OF(CONF_VALUE) *)lh_new( \ + CHECKED_CAST(lhash_hash_func, uint32_t (*)(const CONF_VALUE *), hash), \ + CHECKED_CAST(lhash_cmp_func, \ + int (*)(const CONF_VALUE *a, const CONF_VALUE *b), comp))) + +#define lh_CONF_VALUE_free(lh) \ + lh_free(CHECKED_CAST(_LHASH *, LHASH_OF(CONF_VALUE) *, lh)); + +#define lh_CONF_VALUE_num_items(lh) \ + lh_num_items(CHECKED_CAST(_LHASH *, LHASH_OF(CONF_VALUE) *, lh)) + +#define lh_CONF_VALUE_retrieve(lh, data) \ + ((CONF_VALUE *)lh_retrieve( \ + CHECKED_CAST(_LHASH *, LHASH_OF(CONF_VALUE) *, lh), \ + CHECKED_CAST(void *, CONF_VALUE *, data))) + +#define lh_CONF_VALUE_insert(lh, old_data, data) \ + lh_insert(CHECKED_CAST(_LHASH *, LHASH_OF(CONF_VALUE) *, lh), \ + CHECKED_CAST(void **, CONF_VALUE **, old_data), \ + CHECKED_CAST(void *, CONF_VALUE *, data)) + +#define lh_CONF_VALUE_delete(lh, data) \ + ((CONF_VALUE *)lh_delete(CHECKED_CAST(_LHASH *, LHASH_OF(CONF_VALUE) *, lh), \ + CHECKED_CAST(void *, CONF_VALUE *, data))) + +#define lh_CONF_VALUE_doall(lh, func) \ + lh_doall(CHECKED_CAST(_LHASH *, LHASH_OF(CONF_VALUE) *, lh), \ + CHECKED_CAST(void (*)(void *), void (*)(CONF_VALUE *), func)); + +#define lh_CONF_VALUE_doall_arg(lh, func, arg) \ + lh_doall_arg(CHECKED_CAST(_LHASH *, LHASH_OF(CONF_VALUE) *, lh), \ + CHECKED_CAST(void (*)(void *, void *), \ + void (*)(CONF_VALUE *, void *), func), \ + arg); + +/* SSL_SESSION */ +#define lh_SSL_SESSION_new(hash, comp) \ + ((LHASH_OF(SSL_SESSION) *)lh_new( \ + CHECKED_CAST(lhash_hash_func, uint32_t (*)(const SSL_SESSION *), hash), \ + CHECKED_CAST(lhash_cmp_func, \ + int (*)(const SSL_SESSION *a, const SSL_SESSION *b), \ + comp))) + +#define lh_SSL_SESSION_free(lh) \ + lh_free(CHECKED_CAST(_LHASH *, LHASH_OF(SSL_SESSION) *, lh)); + +#define lh_SSL_SESSION_num_items(lh) \ + lh_num_items(CHECKED_CAST(_LHASH *, LHASH_OF(SSL_SESSION) *, lh)) + +#define lh_SSL_SESSION_retrieve(lh, data) \ + ((SSL_SESSION *)lh_retrieve( \ + CHECKED_CAST(_LHASH *, LHASH_OF(SSL_SESSION) *, lh), \ + CHECKED_CAST(void *, SSL_SESSION *, data))) + +#define lh_SSL_SESSION_insert(lh, old_data, data) \ + lh_insert(CHECKED_CAST(_LHASH *, LHASH_OF(SSL_SESSION) *, lh), \ + CHECKED_CAST(void **, SSL_SESSION **, old_data), \ + CHECKED_CAST(void *, SSL_SESSION *, data)) + +#define lh_SSL_SESSION_delete(lh, data) \ + ((SSL_SESSION *)lh_delete( \ + CHECKED_CAST(_LHASH *, LHASH_OF(SSL_SESSION) *, lh), \ + CHECKED_CAST(void *, SSL_SESSION *, data))) + +#define lh_SSL_SESSION_doall(lh, func) \ + lh_doall(CHECKED_CAST(_LHASH *, LHASH_OF(SSL_SESSION) *, lh), \ + CHECKED_CAST(void (*)(void *), void (*)(SSL_SESSION *), func)); + +#define lh_SSL_SESSION_doall_arg(lh, func, arg) \ + lh_doall_arg(CHECKED_CAST(_LHASH *, LHASH_OF(SSL_SESSION) *, lh), \ + CHECKED_CAST(void (*)(void *, void *), \ + void (*)(SSL_SESSION *, void *), func), \ + arg); diff --git a/phonelibs/boringssl/include/openssl/md4.h b/phonelibs/boringssl/include/openssl/md4.h new file mode 100644 index 00000000000000..ce4fa99bb8c010 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/md4.h @@ -0,0 +1,101 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_MD4_H +#define OPENSSL_HEADER_MD4_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* MD4. */ + +/* MD4_CBLOCK is the block size of MD4. */ +#define MD4_CBLOCK 64 + +/* MD4_DIGEST_LENGTH is the length of an MD4 digest. */ +#define MD4_DIGEST_LENGTH 16 + +/* MD41_Init initialises |md4| and returns one. */ +OPENSSL_EXPORT int MD4_Init(MD4_CTX *md4); + +/* MD4_Update adds |len| bytes from |data| to |md4| and returns one. */ +OPENSSL_EXPORT int MD4_Update(MD4_CTX *md4, const void *data, size_t len); + +/* MD4_Final adds the final padding to |md4| and writes the resulting digest to + * |md|, which must have at least |MD4_DIGEST_LENGTH| bytes of space. It + * returns one. */ +OPENSSL_EXPORT int MD4_Final(uint8_t *md, MD4_CTX *md4); + +/* MD4_Transform is a low-level function that performs a single, MD4 block + * transformation using the state from |md4| and 64 bytes from |block|. */ +OPENSSL_EXPORT void MD4_Transform(MD4_CTX *md4, const uint8_t *block); + +struct md4_state_st { + uint32_t A, B, C, D; + uint32_t Nl, Nh; + uint32_t data[16]; + unsigned int num; +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_MD4_H */ diff --git a/phonelibs/boringssl/include/openssl/md5.h b/phonelibs/boringssl/include/openssl/md5.h new file mode 100644 index 00000000000000..efedc983debdcd --- /dev/null +++ b/phonelibs/boringssl/include/openssl/md5.h @@ -0,0 +1,106 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_MD5_H +#define OPENSSL_HEADER_MD5_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* MD5. */ + + +/* MD5_CBLOCK is the block size of MD5. */ +#define MD5_CBLOCK 64 + +/* MD5_DIGEST_LENGTH is the length of an MD5 digest. */ +#define MD5_DIGEST_LENGTH 16 + +/* MD51_Init initialises |md5| and returns one. */ +OPENSSL_EXPORT int MD5_Init(MD5_CTX *md5); + +/* MD5_Update adds |len| bytes from |data| to |md5| and returns one. */ +OPENSSL_EXPORT int MD5_Update(MD5_CTX *md5, const void *data, size_t len); + +/* MD5_Final adds the final padding to |md5| and writes the resulting digest to + * |md|, which must have at least |MD5_DIGEST_LENGTH| bytes of space. It + * returns one. */ +OPENSSL_EXPORT int MD5_Final(uint8_t *md, MD5_CTX *md5); + +/* MD5 writes the digest of |len| bytes from |data| to |out| and returns |out|. + * There must be at least |MD5_DIGEST_LENGTH| bytes of space in |out|. */ +OPENSSL_EXPORT uint8_t *MD5(const uint8_t *data, size_t len, uint8_t *out); + +/* MD5_Transform is a low-level function that performs a single, MD5 block + * transformation using the state from |md5| and 64 bytes from |block|. */ +OPENSSL_EXPORT void MD5_Transform(MD5_CTX *md5, const uint8_t *block); + +struct md5_state_st { + uint32_t A, B, C, D; + uint32_t Nl, Nh; + uint32_t data[16]; + unsigned int num; +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_MD5_H */ diff --git a/phonelibs/boringssl/include/openssl/mem.h b/phonelibs/boringssl/include/openssl/mem.h new file mode 100644 index 00000000000000..42ec46a073e19f --- /dev/null +++ b/phonelibs/boringssl/include/openssl/mem.h @@ -0,0 +1,139 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_MEM_H +#define OPENSSL_HEADER_MEM_H + +#include + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Memory and string functions, see also buf.h. + * + * OpenSSL has, historically, had a complex set of malloc debugging options. + * However, that was written in a time before Valgrind and ASAN. Since we now + * have those tools, the OpenSSL allocation functions are simply macros around + * the standard memory functions. */ + + +#define OPENSSL_malloc malloc +#define OPENSSL_realloc realloc +#define OPENSSL_free free + +/* OPENSSL_realloc_clean acts like |realloc|, but clears the previous memory + * buffer. Because this is implemented as a wrapper around |malloc|, it needs + * to be given the size of the buffer pointed to by |ptr|. */ +void *OPENSSL_realloc_clean(void *ptr, size_t old_size, size_t new_size); + +/* OPENSSL_cleanse zeros out |len| bytes of memory at |ptr|. This is similar to + * |memset_s| from C11. */ +OPENSSL_EXPORT void OPENSSL_cleanse(void *ptr, size_t len); + +/* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It + * takes an amount of time dependent on |len|, but independent of the contents + * of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a + * defined order as the return value when a != b is undefined, other than to be + * non-zero. */ +OPENSSL_EXPORT int CRYPTO_memcmp(const void *a, const void *b, size_t len); + +/* OPENSSL_hash32 implements the 32 bit, FNV-1a hash. */ +OPENSSL_EXPORT uint32_t OPENSSL_hash32(const void *ptr, size_t len); + +/* OPENSSL_strdup has the same behaviour as strdup(3). */ +OPENSSL_EXPORT char *OPENSSL_strdup(const char *s); + +/* OPENSSL_strnlen has the same behaviour as strnlen(3). */ +OPENSSL_EXPORT size_t OPENSSL_strnlen(const char *s, size_t len); + +/* OPENSSL_strcasecmp has the same behaviour as strcasecmp(3). */ +OPENSSL_EXPORT int OPENSSL_strcasecmp(const char *a, const char *b); + +/* OPENSSL_strncasecmp has the same behaviour as strncasecmp(3). */ +OPENSSL_EXPORT int OPENSSL_strncasecmp(const char *a, const char *b, size_t n); + +/* DECIMAL_SIZE returns an upper bound for the length of the decimal + * representation of the given type. */ +#define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1) + +/* Printf functions. + * + * These functions are either OpenSSL wrappers for standard functions (i.e. + * |BIO_snprintf| and |BIO_vsnprintf|) which don't exist in C89, or are + * versions of printf functions that output to a BIO rather than a FILE. */ +#ifdef __GNUC__ +#define __bio_h__attr__ __attribute__ +#else +#define __bio_h__attr__(x) +#endif +OPENSSL_EXPORT int BIO_snprintf(char *buf, size_t n, const char *format, ...) + __bio_h__attr__((__format__(__printf__, 3, 4))); + +OPENSSL_EXPORT int BIO_vsnprintf(char *buf, size_t n, const char *format, + va_list args) + __bio_h__attr__((__format__(__printf__, 3, 0))); +#undef __bio_h__attr__ + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_MEM_H */ diff --git a/phonelibs/boringssl/include/openssl/modes.h b/phonelibs/boringssl/include/openssl/modes.h new file mode 100644 index 00000000000000..220adec552d8be --- /dev/null +++ b/phonelibs/boringssl/include/openssl/modes.h @@ -0,0 +1,223 @@ +/* ==================================================================== + * Copyright (c) 2008 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== */ + +#ifndef OPENSSL_HEADER_MODES_H +#define OPENSSL_HEADER_MODES_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* modes.h contains functions that implement various block-cipher modes. */ + + +/* block128_f is the type of a 128-bit, block cipher. */ +typedef void (*block128_f)(const uint8_t in[16], uint8_t out[16], + const void *key); + + +/* CTR. */ + +/* ctr128_f is the type of a function that performs CTR-mode encryption. */ +typedef void (*ctr128_f)(const uint8_t *in, uint8_t *out, size_t blocks, + const void *key, const uint8_t ivec[16]); + +/* CRYPTO_ctr128_encrypt encrypts (or decrypts, it's the same in CTR mode) + * |len| bytes from |in| to |out| using |block| in counter mode. There's no + * requirement that |len| be a multiple of any value and any partial blocks are + * stored in |ecount_buf| and |*num|, which must be zeroed before the initial + * call. The counter is a 128-bit, big-endian value in |ivec| and is + * incremented by this function. */ +OPENSSL_EXPORT void CRYPTO_ctr128_encrypt(const uint8_t *in, uint8_t *out, + size_t len, const void *key, + uint8_t ivec[16], + uint8_t ecount_buf[16], + unsigned int *num, block128_f block); + +/* CRYPTO_ctr128_encrypt_ctr32 acts like |CRYPTO_ctr128_encrypt| but takes + * |ctr|, a function that performs CTR mode but only deals with the lower 32 + * bits of the counter. This is useful when |ctr| can be an optimised + * function. */ +OPENSSL_EXPORT void CRYPTO_ctr128_encrypt_ctr32( + const uint8_t *in, uint8_t *out, size_t len, const void *key, + uint8_t ivec[16], uint8_t ecount_buf[16], unsigned int *num, ctr128_f ctr); + + +/* GCM. */ + +typedef struct gcm128_context GCM128_CONTEXT; + +/* CRYPTO_gcm128_new allocates a fresh |GCM128_CONTEXT| and calls + * |CRYPTO_gcm128_init|. It returns the new context, or NULL on error. */ +OPENSSL_EXPORT GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); + +/* CRYPTO_gcm128_init initialises |ctx| to use |block| (typically AES) with the + * given key. */ +OPENSSL_EXPORT void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, + block128_f block); + +/* CRYPTO_gcm128_setiv sets the IV (nonce) for |ctx|. */ +OPENSSL_EXPORT void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const uint8_t *iv, + size_t len); + +/* CRYPTO_gcm128_aad sets the authenticated data for an instance of GCM. This + * must be called before and data is encrypted. It returns one on success and + * zero otherwise. */ +OPENSSL_EXPORT int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const uint8_t *aad, + size_t len); + +/* CRYPTO_gcm128_encrypt encrypts |len| bytes from |in| to |out|. It returns + * one on success and zero otherwise. */ +OPENSSL_EXPORT int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, const uint8_t *in, + uint8_t *out, size_t len); + +/* CRYPTO_gcm128_decrypt decrypts |len| bytes from |in| to |out|. It returns + * one on success and zero otherwise. */ +OPENSSL_EXPORT int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, const uint8_t *in, + uint8_t *out, size_t len); + +/* CRYPTO_gcm128_encrypt_ctr32 encrypts |len| bytes from |in| to |out| using a + * CTR function that only handles the bottom 32 bits of the nonce, like + * |CRYPTO_ctr128_encrypt_ctr32|. It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, + const uint8_t *in, uint8_t *out, + size_t len, ctr128_f stream); + +/* CRYPTO_gcm128_decrypt_ctr32 decrypts |len| bytes from |in| to |out| using a + * CTR function that only handles the bottom 32 bits of the nonce, like + * |CRYPTO_ctr128_encrypt_ctr32|. It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, + const uint8_t *in, uint8_t *out, + size_t len, ctr128_f stream); + +/* CRYPTO_gcm128_finish calculates the authenticator and compares it against + * |len| bytes of |tag|. It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const uint8_t *tag, + size_t len); + +/* CRYPTO_gcm128_tag calculates the authenticator and copies it into |tag|. The + * minimum of |len| and 16 bytes are copied into |tag|. */ +OPENSSL_EXPORT void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, uint8_t *tag, + size_t len); + +/* CRYPTO_gcm128_release clears and frees |ctx|. */ +OPENSSL_EXPORT void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); + + +/* CBC. */ + +/* cbc128_f is the type of a function that performs CBC-mode encryption. */ +typedef void (*cbc128_f)(const uint8_t *in, uint8_t *out, size_t len, + const void *key, uint8_t ivec[16], int enc); + +/* CRYPTO_cbc128_encrypt encrypts |len| bytes from |in| to |out| using the + * given IV and block cipher in CBC mode. The input need not be a multiple of + * 128 bits long, but the output will round up to the nearest 128 bit multiple, + * zero padding the input if needed. The IV will be updated on return. */ +void CRYPTO_cbc128_encrypt(const uint8_t *in, uint8_t *out, size_t len, + const void *key, uint8_t ivec[16], block128_f block); + +/* CRYPTO_cbc128_decrypt decrypts |len| bytes from |in| to |out| using the + * given IV and block cipher in CBC mode. If |len| is not a multiple of 128 + * bits then only that many bytes will be written, but a multiple of 128 bits + * is always read from |in|. The IV will be updated on return. */ +void CRYPTO_cbc128_decrypt(const uint8_t *in, uint8_t *out, size_t len, + const void *key, uint8_t ivec[16], block128_f block); + + +/* OFB. */ + +/* CRYPTO_ofb128_encrypt encrypts (or decrypts, it's the same with OFB mode) + * |len| bytes from |in| to |out| using |block| in OFB mode. There's no + * requirement that |len| be a multiple of any value and any partial blocks are + * stored in |ivec| and |*num|, the latter must be zero before the initial + * call. */ +void CRYPTO_ofb128_encrypt(const uint8_t *in, uint8_t *out, + size_t len, const void *key, uint8_t ivec[16], + int *num, block128_f block); + + +/* CFB. */ + +/* CRYPTO_cfb128_encrypt encrypts (or decrypts, if |enc| is zero) |len| bytes + * from |in| to |out| using |block| in CFB mode. There's no requirement that + * |len| be a multiple of any value and any partial blocks are stored in |ivec| + * and |*num|, the latter must be zero before the initial call. */ +void CRYPTO_cfb128_encrypt(const uint8_t *in, uint8_t *out, size_t len, + const void *key, uint8_t ivec[16], int *num, int enc, + block128_f block); + +/* CRYPTO_cfb128_8_encrypt encrypts (or decrypts, if |enc| is zero) |len| bytes + * from |in| to |out| using |block| in CFB-8 mode. Prior to the first call + * |num| should be set to zero. */ +void CRYPTO_cfb128_8_encrypt(const uint8_t *in, uint8_t *out, size_t len, + const void *key, uint8_t ivec[16], int *num, + int enc, block128_f block); + +/* CRYPTO_cfb128_1_encrypt encrypts (or decrypts, if |enc| is zero) |len| bytes + * from |in| to |out| using |block| in CFB-1 mode. Prior to the first call + * |num| should be set to zero. */ +void CRYPTO_cfb128_1_encrypt(const uint8_t *in, uint8_t *out, size_t bits, + const void *key, uint8_t ivec[16], int *num, + int enc, block128_f block); + +size_t CRYPTO_cts128_encrypt_block(const uint8_t *in, uint8_t *out, size_t len, + const void *key, uint8_t ivec[16], + block128_f block); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_MODES_H */ diff --git a/phonelibs/boringssl/include/openssl/obj.h b/phonelibs/boringssl/include/openssl/obj.h new file mode 100644 index 00000000000000..f476617e18e427 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/obj.h @@ -0,0 +1,202 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_OBJECTS_H +#define OPENSSL_HEADER_OBJECTS_H + +#include + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* The objects library deals with the registration and indexing of ASN.1 object + * identifiers. These values are often written as a dotted sequence of numbers, + * e.g. 1.2.840.113549.1.9.16.3.9. + * + * Internally, OpenSSL likes to deal with these values by numbering them with + * numbers called "nids". OpenSSL has a large, built-in database of common + * object identifiers and also has both short and long names for them. + * + * This library provides functions for translating between object identifiers, + * nids, short names and long names. + * + * The nid values should not be used outside of a single process: they are not + * stable identifiers. */ + + +/* Basic operations. */ + +/* OBJ_dup returns a duplicate copy of |obj| or NULL on allocation failure. */ +OPENSSL_EXPORT ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *obj); + +/* OBJ_cmp returns a value less than, equal to or greater than zero if |a| is + * less than, equal to or greater than |b|, respectively. */ +OPENSSL_EXPORT int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); + + +/* Looking up nids. */ + +/* OBJ_obj2nid returns the nid corresponding to |obj|, or |NID_undef| if no + * such object is known. */ +OPENSSL_EXPORT int OBJ_obj2nid(const ASN1_OBJECT *obj); + +/* OBJ_cbs2nid returns the nid corresponding to the DER data in |cbs|, or + * |NID_undef| if no such object is known. */ +OPENSSL_EXPORT int OBJ_cbs2nid(const CBS *cbs); + +/* OBJ_sn2nid returns the nid corresponding to |short_name|, or |NID_undef| if + * no such short name is known. */ +OPENSSL_EXPORT int OBJ_sn2nid(const char *short_name); + +/* OBJ_ln2nid returns the nid corresponding to |long_name|, or |NID_undef| if + * no such long name is known. */ +OPENSSL_EXPORT int OBJ_ln2nid(const char *long_name); + +/* OBJ_txt2nid returns the nid corresponding to |s|, which may be a short name, + * long name, or an ASCII string containing a dotted sequence of numbers. It + * returns the nid or NID_undef if unknown. */ +OPENSSL_EXPORT int OBJ_txt2nid(const char *s); + + +/* Getting information about nids. */ + +/* OBJ_nid2obj returns the ASN1_OBJECT corresponding to |nid|, or NULL if |nid| + * is unknown. */ +OPENSSL_EXPORT const ASN1_OBJECT *OBJ_nid2obj(int nid); + +/* OBJ_nid2sn returns the short name for |nid|, or NULL if |nid| is unknown. */ +OPENSSL_EXPORT const char *OBJ_nid2sn(int nid); + +/* OBJ_nid2sn returns the long name for |nid|, or NULL if |nid| is unknown. */ +OPENSSL_EXPORT const char *OBJ_nid2ln(int nid); + +/* OBJ_nid2cbs writes |nid| as an ASN.1 OBJECT IDENTIFIER to |out|. It returns + * one on success or zero otherwise. */ +OPENSSL_EXPORT int OBJ_nid2cbb(CBB *out, int nid); + + +/* Dealing with textual representations of object identifiers. */ + +/* OBJ_txt2obj returns an ASN1_OBJECT for the textual respresentation in |s|. + * If |dont_search_names| is zero, then |s| will be matched against the long + * and short names of a known objects to find a match. Otherwise |s| must + * contain an ASCII string with a dotted sequence of numbers. The resulting + * object need not be previously known. It returns a freshly allocated + * |ASN1_OBJECT| or NULL on error. */ +OPENSSL_EXPORT ASN1_OBJECT *OBJ_txt2obj(const char *s, int dont_search_names); + +/* OBJ_obj2txt converts |obj| to a textual representation. If + * |dont_return_name| is zero then |obj| will be matched against known objects + * and the long (preferably) or short name will be used if found. Otherwise + * |obj| will be converted into a dotted sequence of integers. If |out| is not + * NULL, then at most |out_len| bytes of the textual form will be written + * there. If |out_len| is at least one, then string written to |out| will + * always be NUL terminated. It returns the number of characters that could + * have been written, not including the final NUL, or -1 on error. */ +OPENSSL_EXPORT int OBJ_obj2txt(char *out, int out_len, const ASN1_OBJECT *obj, + int dont_return_name); + + +/* Adding objects at runtime. */ + +/* OBJ_create adds a known object and returns the nid of the new object, or + * NID_undef on error. */ +OPENSSL_EXPORT int OBJ_create(const char *oid, const char *short_name, + const char *long_name); + + +/* Handling signature algorithm identifiers. + * + * Some NIDs (e.g. sha256WithRSAEncryption) specify both a digest algorithm and + * a public key algorithm. The following functions map between pairs of digest + * and public-key algorithms and the NIDs that specify their combination. + * + * Sometimes the combination NID leaves the digest unspecified (e.g. + * rsassaPss). In these cases, the digest NID is |NID_undef|. */ + +/* OBJ_find_sigid_algs finds the digest and public-key NIDs that correspond to + * the signing algorithm |sign_nid|. If successful, it sets |*out_digest_nid| + * and |*out_pkey_nid| and returns one. Otherwise it returns zero. Any of + * |out_digest_nid| or |out_pkey_nid| can be NULL if the caller doesn't need + * that output value. */ +OPENSSL_EXPORT int OBJ_find_sigid_algs(int sign_nid, int *out_digest_nid, + int *out_pkey_nid); + +/* OBJ_find_sigid_by_algs finds the signature NID that corresponds to the + * combination of |digest_nid| and |pkey_nid|. If success, it sets + * |*out_sign_nid| and returns one. Otherwise it returns zero. The + * |out_sign_nid| argument can be NULL if the caller only wishes to learn + * whether the combination is valid. */ +OPENSSL_EXPORT int OBJ_find_sigid_by_algs(int *out_sign_nid, int digest_nid, + int pkey_nid); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define OBJ_F_OBJ_create 100 +#define OBJ_F_OBJ_dup 101 +#define OBJ_F_OBJ_nid2obj 102 +#define OBJ_F_OBJ_txt2obj 103 +#define OBJ_R_UNKNOWN_NID 100 + +#endif /* OPENSSL_HEADER_OBJECTS_H */ diff --git a/phonelibs/boringssl/include/openssl/obj_mac.h b/phonelibs/boringssl/include/openssl/obj_mac.h new file mode 100644 index 00000000000000..55e1cba2fee7bc --- /dev/null +++ b/phonelibs/boringssl/include/openssl/obj_mac.h @@ -0,0 +1,4140 @@ +/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the + * following command: + * perl objects.pl objects.txt obj_mac.num ../../include/openssl/obj_mac.h */ + +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_itu_t "ITU-T" +#define LN_itu_t "itu-t" +#define NID_itu_t 645 +#define OBJ_itu_t 0L + +#define NID_ccitt 404 +#define OBJ_ccitt OBJ_itu_t + +#define SN_iso "ISO" +#define LN_iso "iso" +#define NID_iso 181 +#define OBJ_iso 1L + +#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" +#define LN_joint_iso_itu_t "joint-iso-itu-t" +#define NID_joint_iso_itu_t 646 +#define OBJ_joint_iso_itu_t 2L + +#define NID_joint_iso_ccitt 393 +#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t + +#define SN_member_body "member-body" +#define LN_member_body "ISO Member Body" +#define NID_member_body 182 +#define OBJ_member_body OBJ_iso,2L + +#define SN_identified_organization "identified-organization" +#define NID_identified_organization 676 +#define OBJ_identified_organization OBJ_iso,3L + +#define SN_hmac_md5 "HMAC-MD5" +#define LN_hmac_md5 "hmac-md5" +#define NID_hmac_md5 780 +#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L + +#define SN_hmac_sha1 "HMAC-SHA1" +#define LN_hmac_sha1 "hmac-sha1" +#define NID_hmac_sha1 781 +#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L + +#define SN_certicom_arc "certicom-arc" +#define NID_certicom_arc 677 +#define OBJ_certicom_arc OBJ_identified_organization,132L + +#define SN_international_organizations "international-organizations" +#define LN_international_organizations "International Organizations" +#define NID_international_organizations 647 +#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L + +#define SN_wap "wap" +#define NID_wap 678 +#define OBJ_wap OBJ_international_organizations,43L + +#define SN_wap_wsg "wap-wsg" +#define NID_wap_wsg 679 +#define OBJ_wap_wsg OBJ_wap,1L + +#define SN_selected_attribute_types "selected-attribute-types" +#define LN_selected_attribute_types "Selected Attribute Types" +#define NID_selected_attribute_types 394 +#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L + +#define SN_clearance "clearance" +#define NID_clearance 395 +#define OBJ_clearance OBJ_selected_attribute_types,55L + +#define SN_ISO_US "ISO-US" +#define LN_ISO_US "ISO US Member Body" +#define NID_ISO_US 183 +#define OBJ_ISO_US OBJ_member_body,840L + +#define SN_X9_57 "X9-57" +#define LN_X9_57 "X9.57" +#define NID_X9_57 184 +#define OBJ_X9_57 OBJ_ISO_US,10040L + +#define SN_X9cm "X9cm" +#define LN_X9cm "X9.57 CM ?" +#define NID_X9cm 185 +#define OBJ_X9cm OBJ_X9_57,4L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa OBJ_X9cm,1L + +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 OBJ_X9cm,3L + +#define SN_ansi_X9_62 "ansi-X9-62" +#define LN_ansi_X9_62 "ANSI X9.62" +#define NID_ansi_X9_62 405 +#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L + +#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L + +#define SN_X9_62_prime_field "prime-field" +#define NID_X9_62_prime_field 406 +#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L + +#define SN_X9_62_characteristic_two_field "characteristic-two-field" +#define NID_X9_62_characteristic_two_field 407 +#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L + +#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" +#define NID_X9_62_id_characteristic_two_basis 680 +#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L + +#define SN_X9_62_onBasis "onBasis" +#define NID_X9_62_onBasis 681 +#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L + +#define SN_X9_62_tpBasis "tpBasis" +#define NID_X9_62_tpBasis 682 +#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L + +#define SN_X9_62_ppBasis "ppBasis" +#define NID_X9_62_ppBasis 683 +#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L + +#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L + +#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" +#define NID_X9_62_id_ecPublicKey 408 +#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L + +#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L + +#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L + +#define SN_X9_62_c2pnb163v1 "c2pnb163v1" +#define NID_X9_62_c2pnb163v1 684 +#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L + +#define SN_X9_62_c2pnb163v2 "c2pnb163v2" +#define NID_X9_62_c2pnb163v2 685 +#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L + +#define SN_X9_62_c2pnb163v3 "c2pnb163v3" +#define NID_X9_62_c2pnb163v3 686 +#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L + +#define SN_X9_62_c2pnb176v1 "c2pnb176v1" +#define NID_X9_62_c2pnb176v1 687 +#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L + +#define SN_X9_62_c2tnb191v1 "c2tnb191v1" +#define NID_X9_62_c2tnb191v1 688 +#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L + +#define SN_X9_62_c2tnb191v2 "c2tnb191v2" +#define NID_X9_62_c2tnb191v2 689 +#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L + +#define SN_X9_62_c2tnb191v3 "c2tnb191v3" +#define NID_X9_62_c2tnb191v3 690 +#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L + +#define SN_X9_62_c2onb191v4 "c2onb191v4" +#define NID_X9_62_c2onb191v4 691 +#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L + +#define SN_X9_62_c2onb191v5 "c2onb191v5" +#define NID_X9_62_c2onb191v5 692 +#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L + +#define SN_X9_62_c2pnb208w1 "c2pnb208w1" +#define NID_X9_62_c2pnb208w1 693 +#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L + +#define SN_X9_62_c2tnb239v1 "c2tnb239v1" +#define NID_X9_62_c2tnb239v1 694 +#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L + +#define SN_X9_62_c2tnb239v2 "c2tnb239v2" +#define NID_X9_62_c2tnb239v2 695 +#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L + +#define SN_X9_62_c2tnb239v3 "c2tnb239v3" +#define NID_X9_62_c2tnb239v3 696 +#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L + +#define SN_X9_62_c2onb239v4 "c2onb239v4" +#define NID_X9_62_c2onb239v4 697 +#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L + +#define SN_X9_62_c2onb239v5 "c2onb239v5" +#define NID_X9_62_c2onb239v5 698 +#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L + +#define SN_X9_62_c2pnb272w1 "c2pnb272w1" +#define NID_X9_62_c2pnb272w1 699 +#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L + +#define SN_X9_62_c2pnb304w1 "c2pnb304w1" +#define NID_X9_62_c2pnb304w1 700 +#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L + +#define SN_X9_62_c2tnb359v1 "c2tnb359v1" +#define NID_X9_62_c2tnb359v1 701 +#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L + +#define SN_X9_62_c2pnb368w1 "c2pnb368w1" +#define NID_X9_62_c2pnb368w1 702 +#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L + +#define SN_X9_62_c2tnb431r1 "c2tnb431r1" +#define NID_X9_62_c2tnb431r1 703 +#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L + +#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L + +#define SN_X9_62_prime192v1 "prime192v1" +#define NID_X9_62_prime192v1 409 +#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L + +#define SN_X9_62_prime192v2 "prime192v2" +#define NID_X9_62_prime192v2 410 +#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L + +#define SN_X9_62_prime192v3 "prime192v3" +#define NID_X9_62_prime192v3 411 +#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L + +#define SN_X9_62_prime239v1 "prime239v1" +#define NID_X9_62_prime239v1 412 +#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L + +#define SN_X9_62_prime239v2 "prime239v2" +#define NID_X9_62_prime239v2 413 +#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L + +#define SN_X9_62_prime239v3 "prime239v3" +#define NID_X9_62_prime239v3 414 +#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L + +#define SN_X9_62_prime256v1 "prime256v1" +#define NID_X9_62_prime256v1 415 +#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L + +#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L + +#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" +#define NID_ecdsa_with_SHA1 416 +#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L + +#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" +#define NID_ecdsa_with_Recommended 791 +#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L + +#define SN_ecdsa_with_Specified "ecdsa-with-Specified" +#define NID_ecdsa_with_Specified 792 +#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L + +#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" +#define NID_ecdsa_with_SHA224 793 +#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L + +#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" +#define NID_ecdsa_with_SHA256 794 +#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L + +#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" +#define NID_ecdsa_with_SHA384 795 +#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L + +#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" +#define NID_ecdsa_with_SHA512 796 +#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L + +#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L + +#define SN_secp112r1 "secp112r1" +#define NID_secp112r1 704 +#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L + +#define SN_secp112r2 "secp112r2" +#define NID_secp112r2 705 +#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L + +#define SN_secp128r1 "secp128r1" +#define NID_secp128r1 706 +#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L + +#define SN_secp128r2 "secp128r2" +#define NID_secp128r2 707 +#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L + +#define SN_secp160k1 "secp160k1" +#define NID_secp160k1 708 +#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L + +#define SN_secp160r1 "secp160r1" +#define NID_secp160r1 709 +#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L + +#define SN_secp160r2 "secp160r2" +#define NID_secp160r2 710 +#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L + +#define SN_secp192k1 "secp192k1" +#define NID_secp192k1 711 +#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L + +#define SN_secp224k1 "secp224k1" +#define NID_secp224k1 712 +#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L + +#define SN_secp224r1 "secp224r1" +#define NID_secp224r1 713 +#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L + +#define SN_secp256k1 "secp256k1" +#define NID_secp256k1 714 +#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L + +#define SN_secp384r1 "secp384r1" +#define NID_secp384r1 715 +#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L + +#define SN_secp521r1 "secp521r1" +#define NID_secp521r1 716 +#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L + +#define SN_sect113r1 "sect113r1" +#define NID_sect113r1 717 +#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L + +#define SN_sect113r2 "sect113r2" +#define NID_sect113r2 718 +#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L + +#define SN_sect131r1 "sect131r1" +#define NID_sect131r1 719 +#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L + +#define SN_sect131r2 "sect131r2" +#define NID_sect131r2 720 +#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L + +#define SN_sect163k1 "sect163k1" +#define NID_sect163k1 721 +#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L + +#define SN_sect163r1 "sect163r1" +#define NID_sect163r1 722 +#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L + +#define SN_sect163r2 "sect163r2" +#define NID_sect163r2 723 +#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L + +#define SN_sect193r1 "sect193r1" +#define NID_sect193r1 724 +#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L + +#define SN_sect193r2 "sect193r2" +#define NID_sect193r2 725 +#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L + +#define SN_sect233k1 "sect233k1" +#define NID_sect233k1 726 +#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L + +#define SN_sect233r1 "sect233r1" +#define NID_sect233r1 727 +#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L + +#define SN_sect239k1 "sect239k1" +#define NID_sect239k1 728 +#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L + +#define SN_sect283k1 "sect283k1" +#define NID_sect283k1 729 +#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L + +#define SN_sect283r1 "sect283r1" +#define NID_sect283r1 730 +#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L + +#define SN_sect409k1 "sect409k1" +#define NID_sect409k1 731 +#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L + +#define SN_sect409r1 "sect409r1" +#define NID_sect409r1 732 +#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L + +#define SN_sect571k1 "sect571k1" +#define NID_sect571k1 733 +#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L + +#define SN_sect571r1 "sect571r1" +#define NID_sect571r1 734 +#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L + +#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L + +#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" +#define NID_wap_wsg_idm_ecid_wtls1 735 +#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L + +#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" +#define NID_wap_wsg_idm_ecid_wtls3 736 +#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L + +#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" +#define NID_wap_wsg_idm_ecid_wtls4 737 +#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L + +#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" +#define NID_wap_wsg_idm_ecid_wtls5 738 +#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L + +#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" +#define NID_wap_wsg_idm_ecid_wtls6 739 +#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L + +#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" +#define NID_wap_wsg_idm_ecid_wtls7 740 +#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L + +#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" +#define NID_wap_wsg_idm_ecid_wtls8 741 +#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L + +#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" +#define NID_wap_wsg_idm_ecid_wtls9 742 +#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L + +#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" +#define NID_wap_wsg_idm_ecid_wtls10 743 +#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L + +#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" +#define NID_wap_wsg_idm_ecid_wtls11 744 +#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L + +#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" +#define NID_wap_wsg_idm_ecid_wtls12 745 +#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L + +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L + +#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" +#define LN_id_PasswordBasedMAC "password based MAC" +#define NID_id_PasswordBasedMAC 782 +#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L + +#define SN_id_DHBasedMac "id-DHBasedMac" +#define LN_id_DHBasedMac "Diffie-Hellman based MAC" +#define NID_id_DHBasedMac 783 +#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L + +#define SN_rsadsi "rsadsi" +#define LN_rsadsi "RSA Data Security, Inc." +#define NID_rsadsi 1 +#define OBJ_rsadsi OBJ_ISO_US,113549L + +#define SN_pkcs "pkcs" +#define LN_pkcs "RSA Data Security, Inc. PKCS" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi,1L + +#define SN_pkcs1 "pkcs1" +#define NID_pkcs1 186 +#define OBJ_pkcs1 OBJ_pkcs,1L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs1,1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L + +#define SN_md4WithRSAEncryption "RSA-MD4" +#define LN_md4WithRSAEncryption "md4WithRSAEncryption" +#define NID_md4WithRSAEncryption 396 +#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L + +#define SN_rsaesOaep "RSAES-OAEP" +#define LN_rsaesOaep "rsaesOaep" +#define NID_rsaesOaep 919 +#define OBJ_rsaesOaep OBJ_pkcs1,7L + +#define SN_mgf1 "MGF1" +#define LN_mgf1 "mgf1" +#define NID_mgf1 911 +#define OBJ_mgf1 OBJ_pkcs1,8L + +#define SN_pSpecified "PSPECIFIED" +#define LN_pSpecified "pSpecified" +#define NID_pSpecified 935 +#define OBJ_pSpecified OBJ_pkcs1,9L + +#define SN_rsassaPss "RSASSA-PSS" +#define LN_rsassaPss "rsassaPss" +#define NID_rsassaPss 912 +#define OBJ_rsassaPss OBJ_pkcs1,10L + +#define SN_sha256WithRSAEncryption "RSA-SHA256" +#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" +#define NID_sha256WithRSAEncryption 668 +#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L + +#define SN_sha384WithRSAEncryption "RSA-SHA384" +#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" +#define NID_sha384WithRSAEncryption 669 +#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L + +#define SN_sha512WithRSAEncryption "RSA-SHA512" +#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" +#define NID_sha512WithRSAEncryption 670 +#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L + +#define SN_sha224WithRSAEncryption "RSA-SHA224" +#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" +#define NID_sha224WithRSAEncryption 671 +#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L + +#define SN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs,3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3,1L + +#define SN_pkcs5 "pkcs5" +#define NID_pkcs5 187 +#define OBJ_pkcs5 OBJ_pkcs,5L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L + +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L + +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs5,12L + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs5,13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs5,14L + +#define SN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs,7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7,1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7,2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7,5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L + +#define SN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs,9L + +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9,3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L + +#define SN_ext_req "extReq" +#define LN_ext_req "Extension Request" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9,14L + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9,15L + +#define SN_SMIME "SMIME" +#define LN_SMIME "S/MIME" +#define NID_SMIME 188 +#define OBJ_SMIME OBJ_pkcs9,16L + +#define SN_id_smime_mod "id-smime-mod" +#define NID_id_smime_mod 189 +#define OBJ_id_smime_mod OBJ_SMIME,0L + +#define SN_id_smime_ct "id-smime-ct" +#define NID_id_smime_ct 190 +#define OBJ_id_smime_ct OBJ_SMIME,1L + +#define SN_id_smime_aa "id-smime-aa" +#define NID_id_smime_aa 191 +#define OBJ_id_smime_aa OBJ_SMIME,2L + +#define SN_id_smime_alg "id-smime-alg" +#define NID_id_smime_alg 192 +#define OBJ_id_smime_alg OBJ_SMIME,3L + +#define SN_id_smime_cd "id-smime-cd" +#define NID_id_smime_cd 193 +#define OBJ_id_smime_cd OBJ_SMIME,4L + +#define SN_id_smime_spq "id-smime-spq" +#define NID_id_smime_spq 194 +#define OBJ_id_smime_spq OBJ_SMIME,5L + +#define SN_id_smime_cti "id-smime-cti" +#define NID_id_smime_cti 195 +#define OBJ_id_smime_cti OBJ_SMIME,6L + +#define SN_id_smime_mod_cms "id-smime-mod-cms" +#define NID_id_smime_mod_cms 196 +#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L + +#define SN_id_smime_mod_ess "id-smime-mod-ess" +#define NID_id_smime_mod_ess 197 +#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L + +#define SN_id_smime_mod_oid "id-smime-mod-oid" +#define NID_id_smime_mod_oid 198 +#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L + +#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" +#define NID_id_smime_mod_msg_v3 199 +#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L + +#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" +#define NID_id_smime_mod_ets_eSignature_88 200 +#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L + +#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" +#define NID_id_smime_mod_ets_eSignature_97 201 +#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L + +#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" +#define NID_id_smime_mod_ets_eSigPolicy_88 202 +#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L + +#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" +#define NID_id_smime_mod_ets_eSigPolicy_97 203 +#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L + +#define SN_id_smime_ct_receipt "id-smime-ct-receipt" +#define NID_id_smime_ct_receipt 204 +#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L + +#define SN_id_smime_ct_authData "id-smime-ct-authData" +#define NID_id_smime_ct_authData 205 +#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L + +#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" +#define NID_id_smime_ct_publishCert 206 +#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L + +#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" +#define NID_id_smime_ct_TSTInfo 207 +#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L + +#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" +#define NID_id_smime_ct_TDTInfo 208 +#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L + +#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" +#define NID_id_smime_ct_contentInfo 209 +#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L + +#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" +#define NID_id_smime_ct_DVCSRequestData 210 +#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L + +#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" +#define NID_id_smime_ct_DVCSResponseData 211 +#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L + +#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" +#define NID_id_smime_ct_compressedData 786 +#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L + +#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" +#define NID_id_ct_asciiTextWithCRLF 787 +#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L + +#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" +#define NID_id_smime_aa_receiptRequest 212 +#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L + +#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" +#define NID_id_smime_aa_securityLabel 213 +#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L + +#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" +#define NID_id_smime_aa_mlExpandHistory 214 +#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L + +#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" +#define NID_id_smime_aa_contentHint 215 +#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L + +#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" +#define NID_id_smime_aa_msgSigDigest 216 +#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L + +#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" +#define NID_id_smime_aa_encapContentType 217 +#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L + +#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" +#define NID_id_smime_aa_contentIdentifier 218 +#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L + +#define SN_id_smime_aa_macValue "id-smime-aa-macValue" +#define NID_id_smime_aa_macValue 219 +#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L + +#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" +#define NID_id_smime_aa_equivalentLabels 220 +#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L + +#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" +#define NID_id_smime_aa_contentReference 221 +#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L + +#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" +#define NID_id_smime_aa_encrypKeyPref 222 +#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L + +#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" +#define NID_id_smime_aa_signingCertificate 223 +#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L + +#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" +#define NID_id_smime_aa_smimeEncryptCerts 224 +#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L + +#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" +#define NID_id_smime_aa_timeStampToken 225 +#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L + +#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" +#define NID_id_smime_aa_ets_sigPolicyId 226 +#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L + +#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" +#define NID_id_smime_aa_ets_commitmentType 227 +#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L + +#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" +#define NID_id_smime_aa_ets_signerLocation 228 +#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L + +#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" +#define NID_id_smime_aa_ets_signerAttr 229 +#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L + +#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" +#define NID_id_smime_aa_ets_otherSigCert 230 +#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L + +#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" +#define NID_id_smime_aa_ets_contentTimestamp 231 +#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L + +#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" +#define NID_id_smime_aa_ets_CertificateRefs 232 +#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L + +#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" +#define NID_id_smime_aa_ets_RevocationRefs 233 +#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L + +#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" +#define NID_id_smime_aa_ets_certValues 234 +#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L + +#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" +#define NID_id_smime_aa_ets_revocationValues 235 +#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L + +#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" +#define NID_id_smime_aa_ets_escTimeStamp 236 +#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L + +#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" +#define NID_id_smime_aa_ets_certCRLTimestamp 237 +#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L + +#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" +#define NID_id_smime_aa_ets_archiveTimeStamp 238 +#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L + +#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" +#define NID_id_smime_aa_signatureType 239 +#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L + +#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" +#define NID_id_smime_aa_dvcs_dvc 240 +#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L + +#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" +#define NID_id_smime_alg_ESDHwith3DES 241 +#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L + +#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" +#define NID_id_smime_alg_ESDHwithRC2 242 +#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L + +#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" +#define NID_id_smime_alg_3DESwrap 243 +#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L + +#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" +#define NID_id_smime_alg_RC2wrap 244 +#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L + +#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" +#define NID_id_smime_alg_ESDH 245 +#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L + +#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" +#define NID_id_smime_alg_CMS3DESwrap 246 +#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L + +#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" +#define NID_id_smime_alg_CMSRC2wrap 247 +#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L + +#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" +#define NID_id_alg_PWRI_KEK 893 +#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L + +#define SN_id_smime_cd_ldap "id-smime-cd-ldap" +#define NID_id_smime_cd_ldap 248 +#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L + +#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" +#define NID_id_smime_spq_ets_sqt_uri 249 +#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L + +#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" +#define NID_id_smime_spq_ets_sqt_unotice 250 +#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L + +#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" +#define NID_id_smime_cti_ets_proofOfOrigin 251 +#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L + +#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" +#define NID_id_smime_cti_ets_proofOfReceipt 252 +#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L + +#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" +#define NID_id_smime_cti_ets_proofOfDelivery 253 +#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L + +#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" +#define NID_id_smime_cti_ets_proofOfSender 254 +#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L + +#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" +#define NID_id_smime_cti_ets_proofOfApproval 255 +#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L + +#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" +#define NID_id_smime_cti_ets_proofOfCreation 256 +#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9,20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9,21L + +#define SN_ms_csp_name "CSPName" +#define LN_ms_csp_name "Microsoft CSP Name" +#define NID_ms_csp_name 417 +#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L + +#define SN_LocalKeySet "LocalKeySet" +#define LN_LocalKeySet "Microsoft Local Key set" +#define NID_LocalKeySet 856 +#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L + +#define OBJ_certTypes OBJ_pkcs9,22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes,1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes,2L + +#define OBJ_crlTypes OBJ_pkcs9,23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes,1L + +#define OBJ_pkcs12 OBJ_pkcs,12L + +#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds,1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds,3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds,4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds,5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi,2L,2L + +#define SN_md4 "MD4" +#define LN_md4 "md4" +#define NID_md4 257 +#define OBJ_md4 OBJ_rsadsi,2L,4L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi,2L,5L + +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" +#define NID_md5_sha1 114 + +#define LN_hmacWithMD5 "hmacWithMD5" +#define NID_hmacWithMD5 797 +#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L + +#define LN_hmacWithSHA224 "hmacWithSHA224" +#define NID_hmacWithSHA224 798 +#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L + +#define LN_hmacWithSHA256 "hmacWithSHA256" +#define NID_hmacWithSHA256 799 +#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L + +#define LN_hmacWithSHA384 "hmacWithSHA384" +#define NID_hmacWithSHA384 800 +#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L + +#define LN_hmacWithSHA512 "hmacWithSHA512" +#define NID_hmacWithSHA512 801 +#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi,3L,4L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L + +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_ms_ext_req "msExtReq" +#define LN_ms_ext_req "Microsoft Extension Request" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L + +#define SN_ms_smartcard_login "msSmartcardLogin" +#define LN_ms_smartcard_login "Microsoft Smartcardlogin" +#define NID_ms_smartcard_login 648 +#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L + +#define SN_ms_upn "msUPN" +#define LN_ms_upn "Microsoft Universal Principal Name" +#define NID_ms_upn 649 +#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L + +#define SN_id_pkix_mod "id-pkix-mod" +#define NID_id_pkix_mod 258 +#define OBJ_id_pkix_mod OBJ_id_pkix,0L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix,1L + +#define SN_id_qt "id-qt" +#define NID_id_qt 259 +#define OBJ_id_qt OBJ_id_pkix,2L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix,3L + +#define SN_id_it "id-it" +#define NID_id_it 260 +#define OBJ_id_it OBJ_id_pkix,4L + +#define SN_id_pkip "id-pkip" +#define NID_id_pkip 261 +#define OBJ_id_pkip OBJ_id_pkix,5L + +#define SN_id_alg "id-alg" +#define NID_id_alg 262 +#define OBJ_id_alg OBJ_id_pkix,6L + +#define SN_id_cmc "id-cmc" +#define NID_id_cmc 263 +#define OBJ_id_cmc OBJ_id_pkix,7L + +#define SN_id_on "id-on" +#define NID_id_on 264 +#define OBJ_id_on OBJ_id_pkix,8L + +#define SN_id_pda "id-pda" +#define NID_id_pda 265 +#define OBJ_id_pda OBJ_id_pkix,9L + +#define SN_id_aca "id-aca" +#define NID_id_aca 266 +#define OBJ_id_aca OBJ_id_pkix,10L + +#define SN_id_qcs "id-qcs" +#define NID_id_qcs 267 +#define OBJ_id_qcs OBJ_id_pkix,11L + +#define SN_id_cct "id-cct" +#define NID_id_cct 268 +#define OBJ_id_cct OBJ_id_pkix,12L + +#define SN_id_ppl "id-ppl" +#define NID_id_ppl 662 +#define OBJ_id_ppl OBJ_id_pkix,21L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix,48L + +#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" +#define NID_id_pkix1_explicit_88 269 +#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L + +#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" +#define NID_id_pkix1_implicit_88 270 +#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L + +#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" +#define NID_id_pkix1_explicit_93 271 +#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L + +#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" +#define NID_id_pkix1_implicit_93 272 +#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L + +#define SN_id_mod_crmf "id-mod-crmf" +#define NID_id_mod_crmf 273 +#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L + +#define SN_id_mod_cmc "id-mod-cmc" +#define NID_id_mod_cmc 274 +#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L + +#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" +#define NID_id_mod_kea_profile_88 275 +#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L + +#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" +#define NID_id_mod_kea_profile_93 276 +#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L + +#define SN_id_mod_cmp "id-mod-cmp" +#define NID_id_mod_cmp 277 +#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L + +#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" +#define NID_id_mod_qualified_cert_88 278 +#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L + +#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" +#define NID_id_mod_qualified_cert_93 279 +#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L + +#define SN_id_mod_attribute_cert "id-mod-attribute-cert" +#define NID_id_mod_attribute_cert 280 +#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L + +#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" +#define NID_id_mod_timestamp_protocol 281 +#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L + +#define SN_id_mod_ocsp "id-mod-ocsp" +#define NID_id_mod_ocsp 282 +#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L + +#define SN_id_mod_dvcs "id-mod-dvcs" +#define NID_id_mod_dvcs 283 +#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L + +#define SN_id_mod_cmp2000 "id-mod-cmp2000" +#define NID_id_mod_cmp2000 284 +#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe,1L + +#define SN_biometricInfo "biometricInfo" +#define LN_biometricInfo "Biometric Info" +#define NID_biometricInfo 285 +#define OBJ_biometricInfo OBJ_id_pe,2L + +#define SN_qcStatements "qcStatements" +#define NID_qcStatements 286 +#define OBJ_qcStatements OBJ_id_pe,3L + +#define SN_ac_auditEntity "ac-auditEntity" +#define NID_ac_auditEntity 287 +#define OBJ_ac_auditEntity OBJ_id_pe,4L + +#define SN_ac_targeting "ac-targeting" +#define NID_ac_targeting 288 +#define OBJ_ac_targeting OBJ_id_pe,5L + +#define SN_aaControls "aaControls" +#define NID_aaControls 289 +#define OBJ_aaControls OBJ_id_pe,6L + +#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" +#define NID_sbgp_ipAddrBlock 290 +#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L + +#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" +#define NID_sbgp_autonomousSysNum 291 +#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L + +#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" +#define NID_sbgp_routerIdentifier 292 +#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L + +#define SN_ac_proxying "ac-proxying" +#define NID_ac_proxying 397 +#define OBJ_ac_proxying OBJ_id_pe,10L + +#define SN_sinfo_access "subjectInfoAccess" +#define LN_sinfo_access "Subject Information Access" +#define NID_sinfo_access 398 +#define OBJ_sinfo_access OBJ_id_pe,11L + +#define SN_proxyCertInfo "proxyCertInfo" +#define LN_proxyCertInfo "Proxy Certificate Information" +#define NID_proxyCertInfo 663 +#define OBJ_proxyCertInfo OBJ_id_pe,14L + +#define SN_id_qt_cps "id-qt-cps" +#define LN_id_qt_cps "Policy Qualifier CPS" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_qt,1L + +#define SN_id_qt_unotice "id-qt-unotice" +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_qt,2L + +#define SN_textNotice "textNotice" +#define NID_textNotice 293 +#define OBJ_textNotice OBJ_id_qt,3L + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp,1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp,2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp,3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp,4L + +#define SN_ipsecEndSystem "ipsecEndSystem" +#define LN_ipsecEndSystem "IPSec End System" +#define NID_ipsecEndSystem 294 +#define OBJ_ipsecEndSystem OBJ_id_kp,5L + +#define SN_ipsecTunnel "ipsecTunnel" +#define LN_ipsecTunnel "IPSec Tunnel" +#define NID_ipsecTunnel 295 +#define OBJ_ipsecTunnel OBJ_id_kp,6L + +#define SN_ipsecUser "ipsecUser" +#define LN_ipsecUser "IPSec User" +#define NID_ipsecUser 296 +#define OBJ_ipsecUser OBJ_id_kp,7L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp,8L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp,9L + +#define SN_dvcs "DVCS" +#define LN_dvcs "dvcs" +#define NID_dvcs 297 +#define OBJ_dvcs OBJ_id_kp,10L + +#define SN_id_it_caProtEncCert "id-it-caProtEncCert" +#define NID_id_it_caProtEncCert 298 +#define OBJ_id_it_caProtEncCert OBJ_id_it,1L + +#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" +#define NID_id_it_signKeyPairTypes 299 +#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L + +#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" +#define NID_id_it_encKeyPairTypes 300 +#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L + +#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" +#define NID_id_it_preferredSymmAlg 301 +#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L + +#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" +#define NID_id_it_caKeyUpdateInfo 302 +#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L + +#define SN_id_it_currentCRL "id-it-currentCRL" +#define NID_id_it_currentCRL 303 +#define OBJ_id_it_currentCRL OBJ_id_it,6L + +#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" +#define NID_id_it_unsupportedOIDs 304 +#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L + +#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" +#define NID_id_it_subscriptionRequest 305 +#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L + +#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" +#define NID_id_it_subscriptionResponse 306 +#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L + +#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" +#define NID_id_it_keyPairParamReq 307 +#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L + +#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" +#define NID_id_it_keyPairParamRep 308 +#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L + +#define SN_id_it_revPassphrase "id-it-revPassphrase" +#define NID_id_it_revPassphrase 309 +#define OBJ_id_it_revPassphrase OBJ_id_it,12L + +#define SN_id_it_implicitConfirm "id-it-implicitConfirm" +#define NID_id_it_implicitConfirm 310 +#define OBJ_id_it_implicitConfirm OBJ_id_it,13L + +#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" +#define NID_id_it_confirmWaitTime 311 +#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L + +#define SN_id_it_origPKIMessage "id-it-origPKIMessage" +#define NID_id_it_origPKIMessage 312 +#define OBJ_id_it_origPKIMessage OBJ_id_it,15L + +#define SN_id_it_suppLangTags "id-it-suppLangTags" +#define NID_id_it_suppLangTags 784 +#define OBJ_id_it_suppLangTags OBJ_id_it,16L + +#define SN_id_regCtrl "id-regCtrl" +#define NID_id_regCtrl 313 +#define OBJ_id_regCtrl OBJ_id_pkip,1L + +#define SN_id_regInfo "id-regInfo" +#define NID_id_regInfo 314 +#define OBJ_id_regInfo OBJ_id_pkip,2L + +#define SN_id_regCtrl_regToken "id-regCtrl-regToken" +#define NID_id_regCtrl_regToken 315 +#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L + +#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" +#define NID_id_regCtrl_authenticator 316 +#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L + +#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" +#define NID_id_regCtrl_pkiPublicationInfo 317 +#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L + +#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" +#define NID_id_regCtrl_pkiArchiveOptions 318 +#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L + +#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" +#define NID_id_regCtrl_oldCertID 319 +#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L + +#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" +#define NID_id_regCtrl_protocolEncrKey 320 +#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L + +#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" +#define NID_id_regInfo_utf8Pairs 321 +#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L + +#define SN_id_regInfo_certReq "id-regInfo-certReq" +#define NID_id_regInfo_certReq 322 +#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L + +#define SN_id_alg_des40 "id-alg-des40" +#define NID_id_alg_des40 323 +#define OBJ_id_alg_des40 OBJ_id_alg,1L + +#define SN_id_alg_noSignature "id-alg-noSignature" +#define NID_id_alg_noSignature 324 +#define OBJ_id_alg_noSignature OBJ_id_alg,2L + +#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" +#define NID_id_alg_dh_sig_hmac_sha1 325 +#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L + +#define SN_id_alg_dh_pop "id-alg-dh-pop" +#define NID_id_alg_dh_pop 326 +#define OBJ_id_alg_dh_pop OBJ_id_alg,4L + +#define SN_id_cmc_statusInfo "id-cmc-statusInfo" +#define NID_id_cmc_statusInfo 327 +#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L + +#define SN_id_cmc_identification "id-cmc-identification" +#define NID_id_cmc_identification 328 +#define OBJ_id_cmc_identification OBJ_id_cmc,2L + +#define SN_id_cmc_identityProof "id-cmc-identityProof" +#define NID_id_cmc_identityProof 329 +#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L + +#define SN_id_cmc_dataReturn "id-cmc-dataReturn" +#define NID_id_cmc_dataReturn 330 +#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L + +#define SN_id_cmc_transactionId "id-cmc-transactionId" +#define NID_id_cmc_transactionId 331 +#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L + +#define SN_id_cmc_senderNonce "id-cmc-senderNonce" +#define NID_id_cmc_senderNonce 332 +#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L + +#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" +#define NID_id_cmc_recipientNonce 333 +#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L + +#define SN_id_cmc_addExtensions "id-cmc-addExtensions" +#define NID_id_cmc_addExtensions 334 +#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L + +#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" +#define NID_id_cmc_encryptedPOP 335 +#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L + +#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" +#define NID_id_cmc_decryptedPOP 336 +#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L + +#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" +#define NID_id_cmc_lraPOPWitness 337 +#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L + +#define SN_id_cmc_getCert "id-cmc-getCert" +#define NID_id_cmc_getCert 338 +#define OBJ_id_cmc_getCert OBJ_id_cmc,15L + +#define SN_id_cmc_getCRL "id-cmc-getCRL" +#define NID_id_cmc_getCRL 339 +#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L + +#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" +#define NID_id_cmc_revokeRequest 340 +#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L + +#define SN_id_cmc_regInfo "id-cmc-regInfo" +#define NID_id_cmc_regInfo 341 +#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L + +#define SN_id_cmc_responseInfo "id-cmc-responseInfo" +#define NID_id_cmc_responseInfo 342 +#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L + +#define SN_id_cmc_queryPending "id-cmc-queryPending" +#define NID_id_cmc_queryPending 343 +#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L + +#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" +#define NID_id_cmc_popLinkRandom 344 +#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L + +#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" +#define NID_id_cmc_popLinkWitness 345 +#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L + +#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" +#define NID_id_cmc_confirmCertAcceptance 346 +#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L + +#define SN_id_on_personalData "id-on-personalData" +#define NID_id_on_personalData 347 +#define OBJ_id_on_personalData OBJ_id_on,1L + +#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" +#define LN_id_on_permanentIdentifier "Permanent Identifier" +#define NID_id_on_permanentIdentifier 858 +#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L + +#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" +#define NID_id_pda_dateOfBirth 348 +#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L + +#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" +#define NID_id_pda_placeOfBirth 349 +#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L + +#define SN_id_pda_gender "id-pda-gender" +#define NID_id_pda_gender 351 +#define OBJ_id_pda_gender OBJ_id_pda,3L + +#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" +#define NID_id_pda_countryOfCitizenship 352 +#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L + +#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" +#define NID_id_pda_countryOfResidence 353 +#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L + +#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" +#define NID_id_aca_authenticationInfo 354 +#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L + +#define SN_id_aca_accessIdentity "id-aca-accessIdentity" +#define NID_id_aca_accessIdentity 355 +#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L + +#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" +#define NID_id_aca_chargingIdentity 356 +#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L + +#define SN_id_aca_group "id-aca-group" +#define NID_id_aca_group 357 +#define OBJ_id_aca_group OBJ_id_aca,4L + +#define SN_id_aca_role "id-aca-role" +#define NID_id_aca_role 358 +#define OBJ_id_aca_role OBJ_id_aca,5L + +#define SN_id_aca_encAttrs "id-aca-encAttrs" +#define NID_id_aca_encAttrs 399 +#define OBJ_id_aca_encAttrs OBJ_id_aca,6L + +#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" +#define NID_id_qcs_pkixQCSyntax_v1 359 +#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L + +#define SN_id_cct_crs "id-cct-crs" +#define NID_id_cct_crs 360 +#define OBJ_id_cct_crs OBJ_id_cct,1L + +#define SN_id_cct_PKIData "id-cct-PKIData" +#define NID_id_cct_PKIData 361 +#define OBJ_id_cct_PKIData OBJ_id_cct,2L + +#define SN_id_cct_PKIResponse "id-cct-PKIResponse" +#define NID_id_cct_PKIResponse 362 +#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L + +#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" +#define LN_id_ppl_anyLanguage "Any language" +#define NID_id_ppl_anyLanguage 664 +#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L + +#define SN_id_ppl_inheritAll "id-ppl-inheritAll" +#define LN_id_ppl_inheritAll "Inherit all" +#define NID_id_ppl_inheritAll 665 +#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L + +#define SN_Independent "id-ppl-independent" +#define LN_Independent "Independent" +#define NID_Independent 667 +#define OBJ_Independent OBJ_id_ppl,2L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad,1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad,2L + +#define SN_ad_timeStamping "ad_timestamping" +#define LN_ad_timeStamping "AD Time Stamping" +#define NID_ad_timeStamping 363 +#define OBJ_ad_timeStamping OBJ_id_ad,3L + +#define SN_ad_dvcs "AD_DVCS" +#define LN_ad_dvcs "ad dvcs" +#define NID_ad_dvcs 364 +#define OBJ_ad_dvcs OBJ_id_ad,4L + +#define SN_caRepository "caRepository" +#define LN_caRepository "CA Repository" +#define NID_caRepository 785 +#define OBJ_caRepository OBJ_id_ad,5L + +#define OBJ_id_pkix_OCSP OBJ_ad_OCSP + +#define SN_id_pkix_OCSP_basic "basicOCSPResponse" +#define LN_id_pkix_OCSP_basic "Basic OCSP Response" +#define NID_id_pkix_OCSP_basic 365 +#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L + +#define SN_id_pkix_OCSP_Nonce "Nonce" +#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" +#define NID_id_pkix_OCSP_Nonce 366 +#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L + +#define SN_id_pkix_OCSP_CrlID "CrlID" +#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" +#define NID_id_pkix_OCSP_CrlID 367 +#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L + +#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" +#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" +#define NID_id_pkix_OCSP_acceptableResponses 368 +#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L + +#define SN_id_pkix_OCSP_noCheck "noCheck" +#define LN_id_pkix_OCSP_noCheck "OCSP No Check" +#define NID_id_pkix_OCSP_noCheck 369 +#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L + +#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" +#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" +#define NID_id_pkix_OCSP_archiveCutoff 370 +#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L + +#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" +#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" +#define NID_id_pkix_OCSP_serviceLocator 371 +#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L + +#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" +#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" +#define NID_id_pkix_OCSP_extendedStatus 372 +#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L + +#define SN_id_pkix_OCSP_valid "valid" +#define NID_id_pkix_OCSP_valid 373 +#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L + +#define SN_id_pkix_OCSP_path "path" +#define NID_id_pkix_OCSP_path 374 +#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L + +#define SN_id_pkix_OCSP_trustRoot "trustRoot" +#define LN_id_pkix_OCSP_trustRoot "Trust Root" +#define NID_id_pkix_OCSP_trustRoot 375 +#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L + +#define SN_algorithm "algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 376 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm,3L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm,6L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +#define OBJ_des_cbc OBJ_algorithm,7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm,8L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +#define OBJ_des_cfb64 OBJ_algorithm,9L + +#define SN_rsaSignature "rsaSignature" +#define NID_rsaSignature 377 +#define OBJ_rsaSignature OBJ_algorithm,11L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm,12L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm,13L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L + +#define SN_des_ede_ecb "DES-EDE" +#define LN_des_ede_ecb "des-ede" +#define NID_des_ede_ecb 32 +#define OBJ_des_ede_ecb OBJ_algorithm,17L + +#define SN_des_ede3_ecb "DES-EDE3" +#define LN_des_ede3_ecb "des-ede3" +#define NID_des_ede3_ecb 33 + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm,18L + +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm,26L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm,29L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L + +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L,3L,101L,1L,4L,1L + +#define SN_X500 "X500" +#define LN_X500 "directory services (X.500)" +#define NID_X500 11 +#define OBJ_X500 2L,5L + +#define SN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500,4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509,3L + +#define SN_surname "SN" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509,4L + +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509,5L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509,6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509,7L + +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509,8L + +#define SN_streetAddress "street" +#define LN_streetAddress "streetAddress" +#define NID_streetAddress 660 +#define OBJ_streetAddress OBJ_X509,9L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509,10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509,11L + +#define SN_title "title" +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509,12L + +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509,13L + +#define LN_searchGuide "searchGuide" +#define NID_searchGuide 859 +#define OBJ_searchGuide OBJ_X509,14L + +#define LN_businessCategory "businessCategory" +#define NID_businessCategory 860 +#define OBJ_businessCategory OBJ_X509,15L + +#define LN_postalAddress "postalAddress" +#define NID_postalAddress 861 +#define OBJ_postalAddress OBJ_X509,16L + +#define LN_postalCode "postalCode" +#define NID_postalCode 661 +#define OBJ_postalCode OBJ_X509,17L + +#define LN_postOfficeBox "postOfficeBox" +#define NID_postOfficeBox 862 +#define OBJ_postOfficeBox OBJ_X509,18L + +#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" +#define NID_physicalDeliveryOfficeName 863 +#define OBJ_physicalDeliveryOfficeName OBJ_X509,19L + +#define LN_telephoneNumber "telephoneNumber" +#define NID_telephoneNumber 864 +#define OBJ_telephoneNumber OBJ_X509,20L + +#define LN_telexNumber "telexNumber" +#define NID_telexNumber 865 +#define OBJ_telexNumber OBJ_X509,21L + +#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" +#define NID_teletexTerminalIdentifier 866 +#define OBJ_teletexTerminalIdentifier OBJ_X509,22L + +#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" +#define NID_facsimileTelephoneNumber 867 +#define OBJ_facsimileTelephoneNumber OBJ_X509,23L + +#define LN_x121Address "x121Address" +#define NID_x121Address 868 +#define OBJ_x121Address OBJ_X509,24L + +#define LN_internationaliSDNNumber "internationaliSDNNumber" +#define NID_internationaliSDNNumber 869 +#define OBJ_internationaliSDNNumber OBJ_X509,25L + +#define LN_registeredAddress "registeredAddress" +#define NID_registeredAddress 870 +#define OBJ_registeredAddress OBJ_X509,26L + +#define LN_destinationIndicator "destinationIndicator" +#define NID_destinationIndicator 871 +#define OBJ_destinationIndicator OBJ_X509,27L + +#define LN_preferredDeliveryMethod "preferredDeliveryMethod" +#define NID_preferredDeliveryMethod 872 +#define OBJ_preferredDeliveryMethod OBJ_X509,28L + +#define LN_presentationAddress "presentationAddress" +#define NID_presentationAddress 873 +#define OBJ_presentationAddress OBJ_X509,29L + +#define LN_supportedApplicationContext "supportedApplicationContext" +#define NID_supportedApplicationContext 874 +#define OBJ_supportedApplicationContext OBJ_X509,30L + +#define SN_member "member" +#define NID_member 875 +#define OBJ_member OBJ_X509,31L + +#define SN_owner "owner" +#define NID_owner 876 +#define OBJ_owner OBJ_X509,32L + +#define LN_roleOccupant "roleOccupant" +#define NID_roleOccupant 877 +#define OBJ_roleOccupant OBJ_X509,33L + +#define SN_seeAlso "seeAlso" +#define NID_seeAlso 878 +#define OBJ_seeAlso OBJ_X509,34L + +#define LN_userPassword "userPassword" +#define NID_userPassword 879 +#define OBJ_userPassword OBJ_X509,35L + +#define LN_userCertificate "userCertificate" +#define NID_userCertificate 880 +#define OBJ_userCertificate OBJ_X509,36L + +#define LN_cACertificate "cACertificate" +#define NID_cACertificate 881 +#define OBJ_cACertificate OBJ_X509,37L + +#define LN_authorityRevocationList "authorityRevocationList" +#define NID_authorityRevocationList 882 +#define OBJ_authorityRevocationList OBJ_X509,38L + +#define LN_certificateRevocationList "certificateRevocationList" +#define NID_certificateRevocationList 883 +#define OBJ_certificateRevocationList OBJ_X509,39L + +#define LN_crossCertificatePair "crossCertificatePair" +#define NID_crossCertificatePair 884 +#define OBJ_crossCertificatePair OBJ_X509,40L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509,41L + +#define SN_givenName "GN" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509,42L + +#define SN_initials "initials" +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509,43L + +#define LN_generationQualifier "generationQualifier" +#define NID_generationQualifier 509 +#define OBJ_generationQualifier OBJ_X509,44L + +#define LN_x500UniqueIdentifier "x500UniqueIdentifier" +#define NID_x500UniqueIdentifier 503 +#define OBJ_x500UniqueIdentifier OBJ_X509,45L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509,46L + +#define LN_enhancedSearchGuide "enhancedSearchGuide" +#define NID_enhancedSearchGuide 885 +#define OBJ_enhancedSearchGuide OBJ_X509,47L + +#define LN_protocolInformation "protocolInformation" +#define NID_protocolInformation 886 +#define OBJ_protocolInformation OBJ_X509,48L + +#define LN_distinguishedName "distinguishedName" +#define NID_distinguishedName 887 +#define OBJ_distinguishedName OBJ_X509,49L + +#define LN_uniqueMember "uniqueMember" +#define NID_uniqueMember 888 +#define OBJ_uniqueMember OBJ_X509,50L + +#define LN_houseIdentifier "houseIdentifier" +#define NID_houseIdentifier 889 +#define OBJ_houseIdentifier OBJ_X509,51L + +#define LN_supportedAlgorithms "supportedAlgorithms" +#define NID_supportedAlgorithms 890 +#define OBJ_supportedAlgorithms OBJ_X509,52L + +#define LN_deltaRevocationList "deltaRevocationList" +#define NID_deltaRevocationList 891 +#define OBJ_deltaRevocationList OBJ_X509,53L + +#define SN_dmdName "dmdName" +#define NID_dmdName 892 +#define OBJ_dmdName OBJ_X509,54L + +#define LN_pseudonym "pseudonym" +#define NID_pseudonym 510 +#define OBJ_pseudonym OBJ_X509,65L + +#define SN_role "role" +#define LN_role "role" +#define NID_role 400 +#define OBJ_role OBJ_X509,72L + +#define SN_X500algorithms "X500algorithms" +#define LN_X500algorithms "directory services - algorithms" +#define NID_X500algorithms 378 +#define OBJ_X500algorithms OBJ_X500,8L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500algorithms,1L,1L + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2WithRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 OBJ_X500algorithms,3L,101L + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce OBJ_X500,29L + +#define SN_subject_directory_attributes "subjectDirectoryAttributes" +#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" +#define NID_subject_directory_attributes 769 +#define OBJ_subject_directory_attributes OBJ_id_ce,9L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce,14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce,15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce,16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce,17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce,18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce,19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce,20L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "X509v3 CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce,21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce,24L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce,27L + +#define SN_issuing_distribution_point "issuingDistributionPoint" +#define LN_issuing_distribution_point "X509v3 Issuing Distribution Point" +#define NID_issuing_distribution_point 770 +#define OBJ_issuing_distribution_point OBJ_id_ce,28L + +#define SN_certificate_issuer "certificateIssuer" +#define LN_certificate_issuer "X509v3 Certificate Issuer" +#define NID_certificate_issuer 771 +#define OBJ_certificate_issuer OBJ_id_ce,29L + +#define SN_name_constraints "nameConstraints" +#define LN_name_constraints "X509v3 Name Constraints" +#define NID_name_constraints 666 +#define OBJ_name_constraints OBJ_id_ce,30L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce,31L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce,32L + +#define SN_any_policy "anyPolicy" +#define LN_any_policy "X509v3 Any Policy" +#define NID_any_policy 746 +#define OBJ_any_policy OBJ_certificate_policies,0L + +#define SN_policy_mappings "policyMappings" +#define LN_policy_mappings "X509v3 Policy Mappings" +#define NID_policy_mappings 747 +#define OBJ_policy_mappings OBJ_id_ce,33L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce,35L + +#define SN_policy_constraints "policyConstraints" +#define LN_policy_constraints "X509v3 Policy Constraints" +#define NID_policy_constraints 401 +#define OBJ_policy_constraints OBJ_id_ce,36L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce,37L + +#define SN_freshest_crl "freshestCRL" +#define LN_freshest_crl "X509v3 Freshest CRL" +#define NID_freshest_crl 857 +#define OBJ_freshest_crl OBJ_id_ce,46L + +#define SN_inhibit_any_policy "inhibitAnyPolicy" +#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" +#define NID_inhibit_any_policy 748 +#define OBJ_inhibit_any_policy OBJ_id_ce,54L + +#define SN_target_information "targetInformation" +#define LN_target_information "X509v3 AC Targeting" +#define NID_target_information 402 +#define OBJ_target_information OBJ_id_ce,55L + +#define SN_no_rev_avail "noRevAvail" +#define LN_no_rev_avail "X509v3 No Revocation Available" +#define NID_no_rev_avail 403 +#define OBJ_no_rev_avail OBJ_id_ce,56L + +#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" +#define LN_anyExtendedKeyUsage "Any Extended Key Usage" +#define NID_anyExtendedKeyUsage 910 +#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L,16L,840L,1L,113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape,1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape,2L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape,4L,1L + +#define SN_org "ORG" +#define LN_org "org" +#define NID_org 379 +#define OBJ_org OBJ_iso,3L + +#define SN_dod "DOD" +#define LN_dod "dod" +#define NID_dod 380 +#define OBJ_dod OBJ_org,6L + +#define SN_iana "IANA" +#define LN_iana "iana" +#define NID_iana 381 +#define OBJ_iana OBJ_dod,1L + +#define OBJ_internet OBJ_iana + +#define SN_Directory "directory" +#define LN_Directory "Directory" +#define NID_Directory 382 +#define OBJ_Directory OBJ_internet,1L + +#define SN_Management "mgmt" +#define LN_Management "Management" +#define NID_Management 383 +#define OBJ_Management OBJ_internet,2L + +#define SN_Experimental "experimental" +#define LN_Experimental "Experimental" +#define NID_Experimental 384 +#define OBJ_Experimental OBJ_internet,3L + +#define SN_Private "private" +#define LN_Private "Private" +#define NID_Private 385 +#define OBJ_Private OBJ_internet,4L + +#define SN_Security "security" +#define LN_Security "Security" +#define NID_Security 386 +#define OBJ_Security OBJ_internet,5L + +#define SN_SNMPv2 "snmpv2" +#define LN_SNMPv2 "SNMPv2" +#define NID_SNMPv2 387 +#define OBJ_SNMPv2 OBJ_internet,6L + +#define LN_Mail "Mail" +#define NID_Mail 388 +#define OBJ_Mail OBJ_internet,7L + +#define SN_Enterprises "enterprises" +#define LN_Enterprises "Enterprises" +#define NID_Enterprises 389 +#define OBJ_Enterprises OBJ_Private,1L + +#define SN_dcObject "dcobject" +#define LN_dcObject "dcObject" +#define NID_dcObject 390 +#define OBJ_dcObject OBJ_Enterprises,1466L,344L + +#define SN_mime_mhs "mime-mhs" +#define LN_mime_mhs "MIME MHS" +#define NID_mime_mhs 504 +#define OBJ_mime_mhs OBJ_Mail,1L + +#define SN_mime_mhs_headings "mime-mhs-headings" +#define LN_mime_mhs_headings "mime-mhs-headings" +#define NID_mime_mhs_headings 505 +#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L + +#define SN_mime_mhs_bodies "mime-mhs-bodies" +#define LN_mime_mhs_bodies "mime-mhs-bodies" +#define NID_mime_mhs_bodies 506 +#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L + +#define SN_id_hex_partial_message "id-hex-partial-message" +#define LN_id_hex_partial_message "id-hex-partial-message" +#define NID_id_hex_partial_message 507 +#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L + +#define SN_id_hex_multipart_message "id-hex-multipart-message" +#define LN_id_hex_multipart_message "id-hex-multipart-message" +#define NID_id_hex_multipart_message 508 +#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression OBJ_id_smime_alg,8L + +#define OBJ_csor 2L,16L,840L,1L,101L,3L + +#define OBJ_nistAlgorithms OBJ_csor,4L + +#define OBJ_aes OBJ_nistAlgorithms,1L + +#define SN_aes_128_ecb "AES-128-ECB" +#define LN_aes_128_ecb "aes-128-ecb" +#define NID_aes_128_ecb 418 +#define OBJ_aes_128_ecb OBJ_aes,1L + +#define SN_aes_128_cbc "AES-128-CBC" +#define LN_aes_128_cbc "aes-128-cbc" +#define NID_aes_128_cbc 419 +#define OBJ_aes_128_cbc OBJ_aes,2L + +#define SN_aes_128_ofb128 "AES-128-OFB" +#define LN_aes_128_ofb128 "aes-128-ofb" +#define NID_aes_128_ofb128 420 +#define OBJ_aes_128_ofb128 OBJ_aes,3L + +#define SN_aes_128_cfb128 "AES-128-CFB" +#define LN_aes_128_cfb128 "aes-128-cfb" +#define NID_aes_128_cfb128 421 +#define OBJ_aes_128_cfb128 OBJ_aes,4L + +#define SN_id_aes128_wrap "id-aes128-wrap" +#define NID_id_aes128_wrap 788 +#define OBJ_id_aes128_wrap OBJ_aes,5L + +#define SN_aes_128_gcm "id-aes128-GCM" +#define LN_aes_128_gcm "aes-128-gcm" +#define NID_aes_128_gcm 895 +#define OBJ_aes_128_gcm OBJ_aes,6L + +#define SN_aes_128_ccm "id-aes128-CCM" +#define LN_aes_128_ccm "aes-128-ccm" +#define NID_aes_128_ccm 896 +#define OBJ_aes_128_ccm OBJ_aes,7L + +#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" +#define NID_id_aes128_wrap_pad 897 +#define OBJ_id_aes128_wrap_pad OBJ_aes,8L + +#define SN_aes_192_ecb "AES-192-ECB" +#define LN_aes_192_ecb "aes-192-ecb" +#define NID_aes_192_ecb 422 +#define OBJ_aes_192_ecb OBJ_aes,21L + +#define SN_aes_192_cbc "AES-192-CBC" +#define LN_aes_192_cbc "aes-192-cbc" +#define NID_aes_192_cbc 423 +#define OBJ_aes_192_cbc OBJ_aes,22L + +#define SN_aes_192_ofb128 "AES-192-OFB" +#define LN_aes_192_ofb128 "aes-192-ofb" +#define NID_aes_192_ofb128 424 +#define OBJ_aes_192_ofb128 OBJ_aes,23L + +#define SN_aes_192_cfb128 "AES-192-CFB" +#define LN_aes_192_cfb128 "aes-192-cfb" +#define NID_aes_192_cfb128 425 +#define OBJ_aes_192_cfb128 OBJ_aes,24L + +#define SN_id_aes192_wrap "id-aes192-wrap" +#define NID_id_aes192_wrap 789 +#define OBJ_id_aes192_wrap OBJ_aes,25L + +#define SN_aes_192_gcm "id-aes192-GCM" +#define LN_aes_192_gcm "aes-192-gcm" +#define NID_aes_192_gcm 898 +#define OBJ_aes_192_gcm OBJ_aes,26L + +#define SN_aes_192_ccm "id-aes192-CCM" +#define LN_aes_192_ccm "aes-192-ccm" +#define NID_aes_192_ccm 899 +#define OBJ_aes_192_ccm OBJ_aes,27L + +#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" +#define NID_id_aes192_wrap_pad 900 +#define OBJ_id_aes192_wrap_pad OBJ_aes,28L + +#define SN_aes_256_ecb "AES-256-ECB" +#define LN_aes_256_ecb "aes-256-ecb" +#define NID_aes_256_ecb 426 +#define OBJ_aes_256_ecb OBJ_aes,41L + +#define SN_aes_256_cbc "AES-256-CBC" +#define LN_aes_256_cbc "aes-256-cbc" +#define NID_aes_256_cbc 427 +#define OBJ_aes_256_cbc OBJ_aes,42L + +#define SN_aes_256_ofb128 "AES-256-OFB" +#define LN_aes_256_ofb128 "aes-256-ofb" +#define NID_aes_256_ofb128 428 +#define OBJ_aes_256_ofb128 OBJ_aes,43L + +#define SN_aes_256_cfb128 "AES-256-CFB" +#define LN_aes_256_cfb128 "aes-256-cfb" +#define NID_aes_256_cfb128 429 +#define OBJ_aes_256_cfb128 OBJ_aes,44L + +#define SN_id_aes256_wrap "id-aes256-wrap" +#define NID_id_aes256_wrap 790 +#define OBJ_id_aes256_wrap OBJ_aes,45L + +#define SN_aes_256_gcm "id-aes256-GCM" +#define LN_aes_256_gcm "aes-256-gcm" +#define NID_aes_256_gcm 901 +#define OBJ_aes_256_gcm OBJ_aes,46L + +#define SN_aes_256_ccm "id-aes256-CCM" +#define LN_aes_256_ccm "aes-256-ccm" +#define NID_aes_256_ccm 902 +#define OBJ_aes_256_ccm OBJ_aes,47L + +#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" +#define NID_id_aes256_wrap_pad 903 +#define OBJ_id_aes256_wrap_pad OBJ_aes,48L + +#define SN_aes_128_cfb1 "AES-128-CFB1" +#define LN_aes_128_cfb1 "aes-128-cfb1" +#define NID_aes_128_cfb1 650 + +#define SN_aes_192_cfb1 "AES-192-CFB1" +#define LN_aes_192_cfb1 "aes-192-cfb1" +#define NID_aes_192_cfb1 651 + +#define SN_aes_256_cfb1 "AES-256-CFB1" +#define LN_aes_256_cfb1 "aes-256-cfb1" +#define NID_aes_256_cfb1 652 + +#define SN_aes_128_cfb8 "AES-128-CFB8" +#define LN_aes_128_cfb8 "aes-128-cfb8" +#define NID_aes_128_cfb8 653 + +#define SN_aes_192_cfb8 "AES-192-CFB8" +#define LN_aes_192_cfb8 "aes-192-cfb8" +#define NID_aes_192_cfb8 654 + +#define SN_aes_256_cfb8 "AES-256-CFB8" +#define LN_aes_256_cfb8 "aes-256-cfb8" +#define NID_aes_256_cfb8 655 + +#define SN_aes_128_ctr "AES-128-CTR" +#define LN_aes_128_ctr "aes-128-ctr" +#define NID_aes_128_ctr 904 + +#define SN_aes_192_ctr "AES-192-CTR" +#define LN_aes_192_ctr "aes-192-ctr" +#define NID_aes_192_ctr 905 + +#define SN_aes_256_ctr "AES-256-CTR" +#define LN_aes_256_ctr "aes-256-ctr" +#define NID_aes_256_ctr 906 + +#define SN_aes_128_xts "AES-128-XTS" +#define LN_aes_128_xts "aes-128-xts" +#define NID_aes_128_xts 913 + +#define SN_aes_256_xts "AES-256-XTS" +#define LN_aes_256_xts "aes-256-xts" +#define NID_aes_256_xts 914 + +#define SN_des_cfb1 "DES-CFB1" +#define LN_des_cfb1 "des-cfb1" +#define NID_des_cfb1 656 + +#define SN_des_cfb8 "DES-CFB8" +#define LN_des_cfb8 "des-cfb8" +#define NID_des_cfb8 657 + +#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" +#define LN_des_ede3_cfb1 "des-ede3-cfb1" +#define NID_des_ede3_cfb1 658 + +#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" +#define LN_des_ede3_cfb8 "des-ede3-cfb8" +#define NID_des_ede3_cfb8 659 + +#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L + +#define SN_sha256 "SHA256" +#define LN_sha256 "sha256" +#define NID_sha256 672 +#define OBJ_sha256 OBJ_nist_hashalgs,1L + +#define SN_sha384 "SHA384" +#define LN_sha384 "sha384" +#define NID_sha384 673 +#define OBJ_sha384 OBJ_nist_hashalgs,2L + +#define SN_sha512 "SHA512" +#define LN_sha512 "sha512" +#define NID_sha512 674 +#define OBJ_sha512 OBJ_nist_hashalgs,3L + +#define SN_sha224 "SHA224" +#define LN_sha224 "sha224" +#define NID_sha224 675 +#define OBJ_sha224 OBJ_nist_hashalgs,4L + +#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA224 "dsa_with_SHA224" +#define NID_dsa_with_SHA224 802 +#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L + +#define SN_dsa_with_SHA256 "dsa_with_SHA256" +#define NID_dsa_with_SHA256 803 +#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L + +#define SN_hold_instruction_code "holdInstructionCode" +#define LN_hold_instruction_code "Hold Instruction Code" +#define NID_hold_instruction_code 430 +#define OBJ_hold_instruction_code OBJ_id_ce,23L + +#define OBJ_holdInstruction OBJ_X9_57,2L + +#define SN_hold_instruction_none "holdInstructionNone" +#define LN_hold_instruction_none "Hold Instruction None" +#define NID_hold_instruction_none 431 +#define OBJ_hold_instruction_none OBJ_holdInstruction,1L + +#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" +#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" +#define NID_hold_instruction_call_issuer 432 +#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L + +#define SN_hold_instruction_reject "holdInstructionReject" +#define LN_hold_instruction_reject "Hold Instruction Reject" +#define NID_hold_instruction_reject 433 +#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L + +#define SN_data "data" +#define NID_data 434 +#define OBJ_data OBJ_itu_t,9L + +#define SN_pss "pss" +#define NID_pss 435 +#define OBJ_pss OBJ_data,2342L + +#define SN_ucl "ucl" +#define NID_ucl 436 +#define OBJ_ucl OBJ_pss,19200300L + +#define SN_pilot "pilot" +#define NID_pilot 437 +#define OBJ_pilot OBJ_ucl,100L + +#define LN_pilotAttributeType "pilotAttributeType" +#define NID_pilotAttributeType 438 +#define OBJ_pilotAttributeType OBJ_pilot,1L + +#define LN_pilotAttributeSyntax "pilotAttributeSyntax" +#define NID_pilotAttributeSyntax 439 +#define OBJ_pilotAttributeSyntax OBJ_pilot,3L + +#define LN_pilotObjectClass "pilotObjectClass" +#define NID_pilotObjectClass 440 +#define OBJ_pilotObjectClass OBJ_pilot,4L + +#define LN_pilotGroups "pilotGroups" +#define NID_pilotGroups 441 +#define OBJ_pilotGroups OBJ_pilot,10L + +#define LN_iA5StringSyntax "iA5StringSyntax" +#define NID_iA5StringSyntax 442 +#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L + +#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" +#define NID_caseIgnoreIA5StringSyntax 443 +#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L + +#define LN_pilotObject "pilotObject" +#define NID_pilotObject 444 +#define OBJ_pilotObject OBJ_pilotObjectClass,3L + +#define LN_pilotPerson "pilotPerson" +#define NID_pilotPerson 445 +#define OBJ_pilotPerson OBJ_pilotObjectClass,4L + +#define SN_account "account" +#define NID_account 446 +#define OBJ_account OBJ_pilotObjectClass,5L + +#define SN_document "document" +#define NID_document 447 +#define OBJ_document OBJ_pilotObjectClass,6L + +#define SN_room "room" +#define NID_room 448 +#define OBJ_room OBJ_pilotObjectClass,7L + +#define LN_documentSeries "documentSeries" +#define NID_documentSeries 449 +#define OBJ_documentSeries OBJ_pilotObjectClass,9L + +#define SN_Domain "domain" +#define LN_Domain "Domain" +#define NID_Domain 392 +#define OBJ_Domain OBJ_pilotObjectClass,13L + +#define LN_rFC822localPart "rFC822localPart" +#define NID_rFC822localPart 450 +#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L + +#define LN_dNSDomain "dNSDomain" +#define NID_dNSDomain 451 +#define OBJ_dNSDomain OBJ_pilotObjectClass,15L + +#define LN_domainRelatedObject "domainRelatedObject" +#define NID_domainRelatedObject 452 +#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L + +#define LN_friendlyCountry "friendlyCountry" +#define NID_friendlyCountry 453 +#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L + +#define LN_simpleSecurityObject "simpleSecurityObject" +#define NID_simpleSecurityObject 454 +#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L + +#define LN_pilotOrganization "pilotOrganization" +#define NID_pilotOrganization 455 +#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L + +#define LN_pilotDSA "pilotDSA" +#define NID_pilotDSA 456 +#define OBJ_pilotDSA OBJ_pilotObjectClass,21L + +#define LN_qualityLabelledData "qualityLabelledData" +#define NID_qualityLabelledData 457 +#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L + +#define SN_userId "UID" +#define LN_userId "userId" +#define NID_userId 458 +#define OBJ_userId OBJ_pilotAttributeType,1L + +#define LN_textEncodedORAddress "textEncodedORAddress" +#define NID_textEncodedORAddress 459 +#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L + +#define SN_rfc822Mailbox "mail" +#define LN_rfc822Mailbox "rfc822Mailbox" +#define NID_rfc822Mailbox 460 +#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L + +#define SN_info "info" +#define NID_info 461 +#define OBJ_info OBJ_pilotAttributeType,4L + +#define LN_favouriteDrink "favouriteDrink" +#define NID_favouriteDrink 462 +#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L + +#define LN_roomNumber "roomNumber" +#define NID_roomNumber 463 +#define OBJ_roomNumber OBJ_pilotAttributeType,6L + +#define SN_photo "photo" +#define NID_photo 464 +#define OBJ_photo OBJ_pilotAttributeType,7L + +#define LN_userClass "userClass" +#define NID_userClass 465 +#define OBJ_userClass OBJ_pilotAttributeType,8L + +#define SN_host "host" +#define NID_host 466 +#define OBJ_host OBJ_pilotAttributeType,9L + +#define SN_manager "manager" +#define NID_manager 467 +#define OBJ_manager OBJ_pilotAttributeType,10L + +#define LN_documentIdentifier "documentIdentifier" +#define NID_documentIdentifier 468 +#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L + +#define LN_documentTitle "documentTitle" +#define NID_documentTitle 469 +#define OBJ_documentTitle OBJ_pilotAttributeType,12L + +#define LN_documentVersion "documentVersion" +#define NID_documentVersion 470 +#define OBJ_documentVersion OBJ_pilotAttributeType,13L + +#define LN_documentAuthor "documentAuthor" +#define NID_documentAuthor 471 +#define OBJ_documentAuthor OBJ_pilotAttributeType,14L + +#define LN_documentLocation "documentLocation" +#define NID_documentLocation 472 +#define OBJ_documentLocation OBJ_pilotAttributeType,15L + +#define LN_homeTelephoneNumber "homeTelephoneNumber" +#define NID_homeTelephoneNumber 473 +#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L + +#define SN_secretary "secretary" +#define NID_secretary 474 +#define OBJ_secretary OBJ_pilotAttributeType,21L + +#define LN_otherMailbox "otherMailbox" +#define NID_otherMailbox 475 +#define OBJ_otherMailbox OBJ_pilotAttributeType,22L + +#define LN_lastModifiedTime "lastModifiedTime" +#define NID_lastModifiedTime 476 +#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L + +#define LN_lastModifiedBy "lastModifiedBy" +#define NID_lastModifiedBy 477 +#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L + +#define SN_domainComponent "DC" +#define LN_domainComponent "domainComponent" +#define NID_domainComponent 391 +#define OBJ_domainComponent OBJ_pilotAttributeType,25L + +#define LN_aRecord "aRecord" +#define NID_aRecord 478 +#define OBJ_aRecord OBJ_pilotAttributeType,26L + +#define LN_pilotAttributeType27 "pilotAttributeType27" +#define NID_pilotAttributeType27 479 +#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L + +#define LN_mXRecord "mXRecord" +#define NID_mXRecord 480 +#define OBJ_mXRecord OBJ_pilotAttributeType,28L + +#define LN_nSRecord "nSRecord" +#define NID_nSRecord 481 +#define OBJ_nSRecord OBJ_pilotAttributeType,29L + +#define LN_sOARecord "sOARecord" +#define NID_sOARecord 482 +#define OBJ_sOARecord OBJ_pilotAttributeType,30L + +#define LN_cNAMERecord "cNAMERecord" +#define NID_cNAMERecord 483 +#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L + +#define LN_associatedDomain "associatedDomain" +#define NID_associatedDomain 484 +#define OBJ_associatedDomain OBJ_pilotAttributeType,37L + +#define LN_associatedName "associatedName" +#define NID_associatedName 485 +#define OBJ_associatedName OBJ_pilotAttributeType,38L + +#define LN_homePostalAddress "homePostalAddress" +#define NID_homePostalAddress 486 +#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L + +#define LN_personalTitle "personalTitle" +#define NID_personalTitle 487 +#define OBJ_personalTitle OBJ_pilotAttributeType,40L + +#define LN_mobileTelephoneNumber "mobileTelephoneNumber" +#define NID_mobileTelephoneNumber 488 +#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L + +#define LN_pagerTelephoneNumber "pagerTelephoneNumber" +#define NID_pagerTelephoneNumber 489 +#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L + +#define LN_friendlyCountryName "friendlyCountryName" +#define NID_friendlyCountryName 490 +#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L + +#define LN_organizationalStatus "organizationalStatus" +#define NID_organizationalStatus 491 +#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L + +#define LN_janetMailbox "janetMailbox" +#define NID_janetMailbox 492 +#define OBJ_janetMailbox OBJ_pilotAttributeType,46L + +#define LN_mailPreferenceOption "mailPreferenceOption" +#define NID_mailPreferenceOption 493 +#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L + +#define LN_buildingName "buildingName" +#define NID_buildingName 494 +#define OBJ_buildingName OBJ_pilotAttributeType,48L + +#define LN_dSAQuality "dSAQuality" +#define NID_dSAQuality 495 +#define OBJ_dSAQuality OBJ_pilotAttributeType,49L + +#define LN_singleLevelQuality "singleLevelQuality" +#define NID_singleLevelQuality 496 +#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L + +#define LN_subtreeMinimumQuality "subtreeMinimumQuality" +#define NID_subtreeMinimumQuality 497 +#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L + +#define LN_subtreeMaximumQuality "subtreeMaximumQuality" +#define NID_subtreeMaximumQuality 498 +#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L + +#define LN_personalSignature "personalSignature" +#define NID_personalSignature 499 +#define OBJ_personalSignature OBJ_pilotAttributeType,53L + +#define LN_dITRedirect "dITRedirect" +#define NID_dITRedirect 500 +#define OBJ_dITRedirect OBJ_pilotAttributeType,54L + +#define SN_audio "audio" +#define NID_audio 501 +#define OBJ_audio OBJ_pilotAttributeType,55L + +#define LN_documentPublisher "documentPublisher" +#define NID_documentPublisher 502 +#define OBJ_documentPublisher OBJ_pilotAttributeType,56L + +#define SN_id_set "id-set" +#define LN_id_set "Secure Electronic Transactions" +#define NID_id_set 512 +#define OBJ_id_set OBJ_international_organizations,42L + +#define SN_set_ctype "set-ctype" +#define LN_set_ctype "content types" +#define NID_set_ctype 513 +#define OBJ_set_ctype OBJ_id_set,0L + +#define SN_set_msgExt "set-msgExt" +#define LN_set_msgExt "message extensions" +#define NID_set_msgExt 514 +#define OBJ_set_msgExt OBJ_id_set,1L + +#define SN_set_attr "set-attr" +#define NID_set_attr 515 +#define OBJ_set_attr OBJ_id_set,3L + +#define SN_set_policy "set-policy" +#define NID_set_policy 516 +#define OBJ_set_policy OBJ_id_set,5L + +#define SN_set_certExt "set-certExt" +#define LN_set_certExt "certificate extensions" +#define NID_set_certExt 517 +#define OBJ_set_certExt OBJ_id_set,7L + +#define SN_set_brand "set-brand" +#define NID_set_brand 518 +#define OBJ_set_brand OBJ_id_set,8L + +#define SN_setct_PANData "setct-PANData" +#define NID_setct_PANData 519 +#define OBJ_setct_PANData OBJ_set_ctype,0L + +#define SN_setct_PANToken "setct-PANToken" +#define NID_setct_PANToken 520 +#define OBJ_setct_PANToken OBJ_set_ctype,1L + +#define SN_setct_PANOnly "setct-PANOnly" +#define NID_setct_PANOnly 521 +#define OBJ_setct_PANOnly OBJ_set_ctype,2L + +#define SN_setct_OIData "setct-OIData" +#define NID_setct_OIData 522 +#define OBJ_setct_OIData OBJ_set_ctype,3L + +#define SN_setct_PI "setct-PI" +#define NID_setct_PI 523 +#define OBJ_setct_PI OBJ_set_ctype,4L + +#define SN_setct_PIData "setct-PIData" +#define NID_setct_PIData 524 +#define OBJ_setct_PIData OBJ_set_ctype,5L + +#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" +#define NID_setct_PIDataUnsigned 525 +#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L + +#define SN_setct_HODInput "setct-HODInput" +#define NID_setct_HODInput 526 +#define OBJ_setct_HODInput OBJ_set_ctype,7L + +#define SN_setct_AuthResBaggage "setct-AuthResBaggage" +#define NID_setct_AuthResBaggage 527 +#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L + +#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" +#define NID_setct_AuthRevReqBaggage 528 +#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L + +#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" +#define NID_setct_AuthRevResBaggage 529 +#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L + +#define SN_setct_CapTokenSeq "setct-CapTokenSeq" +#define NID_setct_CapTokenSeq 530 +#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L + +#define SN_setct_PInitResData "setct-PInitResData" +#define NID_setct_PInitResData 531 +#define OBJ_setct_PInitResData OBJ_set_ctype,12L + +#define SN_setct_PI_TBS "setct-PI-TBS" +#define NID_setct_PI_TBS 532 +#define OBJ_setct_PI_TBS OBJ_set_ctype,13L + +#define SN_setct_PResData "setct-PResData" +#define NID_setct_PResData 533 +#define OBJ_setct_PResData OBJ_set_ctype,14L + +#define SN_setct_AuthReqTBS "setct-AuthReqTBS" +#define NID_setct_AuthReqTBS 534 +#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L + +#define SN_setct_AuthResTBS "setct-AuthResTBS" +#define NID_setct_AuthResTBS 535 +#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L + +#define SN_setct_AuthResTBSX "setct-AuthResTBSX" +#define NID_setct_AuthResTBSX 536 +#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L + +#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" +#define NID_setct_AuthTokenTBS 537 +#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L + +#define SN_setct_CapTokenData "setct-CapTokenData" +#define NID_setct_CapTokenData 538 +#define OBJ_setct_CapTokenData OBJ_set_ctype,20L + +#define SN_setct_CapTokenTBS "setct-CapTokenTBS" +#define NID_setct_CapTokenTBS 539 +#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L + +#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" +#define NID_setct_AcqCardCodeMsg 540 +#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L + +#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" +#define NID_setct_AuthRevReqTBS 541 +#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L + +#define SN_setct_AuthRevResData "setct-AuthRevResData" +#define NID_setct_AuthRevResData 542 +#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L + +#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" +#define NID_setct_AuthRevResTBS 543 +#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L + +#define SN_setct_CapReqTBS "setct-CapReqTBS" +#define NID_setct_CapReqTBS 544 +#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L + +#define SN_setct_CapReqTBSX "setct-CapReqTBSX" +#define NID_setct_CapReqTBSX 545 +#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L + +#define SN_setct_CapResData "setct-CapResData" +#define NID_setct_CapResData 546 +#define OBJ_setct_CapResData OBJ_set_ctype,28L + +#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" +#define NID_setct_CapRevReqTBS 547 +#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L + +#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" +#define NID_setct_CapRevReqTBSX 548 +#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L + +#define SN_setct_CapRevResData "setct-CapRevResData" +#define NID_setct_CapRevResData 549 +#define OBJ_setct_CapRevResData OBJ_set_ctype,31L + +#define SN_setct_CredReqTBS "setct-CredReqTBS" +#define NID_setct_CredReqTBS 550 +#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L + +#define SN_setct_CredReqTBSX "setct-CredReqTBSX" +#define NID_setct_CredReqTBSX 551 +#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L + +#define SN_setct_CredResData "setct-CredResData" +#define NID_setct_CredResData 552 +#define OBJ_setct_CredResData OBJ_set_ctype,34L + +#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" +#define NID_setct_CredRevReqTBS 553 +#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L + +#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" +#define NID_setct_CredRevReqTBSX 554 +#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L + +#define SN_setct_CredRevResData "setct-CredRevResData" +#define NID_setct_CredRevResData 555 +#define OBJ_setct_CredRevResData OBJ_set_ctype,37L + +#define SN_setct_PCertReqData "setct-PCertReqData" +#define NID_setct_PCertReqData 556 +#define OBJ_setct_PCertReqData OBJ_set_ctype,38L + +#define SN_setct_PCertResTBS "setct-PCertResTBS" +#define NID_setct_PCertResTBS 557 +#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L + +#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" +#define NID_setct_BatchAdminReqData 558 +#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L + +#define SN_setct_BatchAdminResData "setct-BatchAdminResData" +#define NID_setct_BatchAdminResData 559 +#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L + +#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" +#define NID_setct_CardCInitResTBS 560 +#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L + +#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" +#define NID_setct_MeAqCInitResTBS 561 +#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L + +#define SN_setct_RegFormResTBS "setct-RegFormResTBS" +#define NID_setct_RegFormResTBS 562 +#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L + +#define SN_setct_CertReqData "setct-CertReqData" +#define NID_setct_CertReqData 563 +#define OBJ_setct_CertReqData OBJ_set_ctype,45L + +#define SN_setct_CertReqTBS "setct-CertReqTBS" +#define NID_setct_CertReqTBS 564 +#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L + +#define SN_setct_CertResData "setct-CertResData" +#define NID_setct_CertResData 565 +#define OBJ_setct_CertResData OBJ_set_ctype,47L + +#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" +#define NID_setct_CertInqReqTBS 566 +#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L + +#define SN_setct_ErrorTBS "setct-ErrorTBS" +#define NID_setct_ErrorTBS 567 +#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L + +#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" +#define NID_setct_PIDualSignedTBE 568 +#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L + +#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" +#define NID_setct_PIUnsignedTBE 569 +#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L + +#define SN_setct_AuthReqTBE "setct-AuthReqTBE" +#define NID_setct_AuthReqTBE 570 +#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L + +#define SN_setct_AuthResTBE "setct-AuthResTBE" +#define NID_setct_AuthResTBE 571 +#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L + +#define SN_setct_AuthResTBEX "setct-AuthResTBEX" +#define NID_setct_AuthResTBEX 572 +#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L + +#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" +#define NID_setct_AuthTokenTBE 573 +#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L + +#define SN_setct_CapTokenTBE "setct-CapTokenTBE" +#define NID_setct_CapTokenTBE 574 +#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L + +#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" +#define NID_setct_CapTokenTBEX 575 +#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L + +#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" +#define NID_setct_AcqCardCodeMsgTBE 576 +#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L + +#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" +#define NID_setct_AuthRevReqTBE 577 +#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L + +#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" +#define NID_setct_AuthRevResTBE 578 +#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L + +#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" +#define NID_setct_AuthRevResTBEB 579 +#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L + +#define SN_setct_CapReqTBE "setct-CapReqTBE" +#define NID_setct_CapReqTBE 580 +#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L + +#define SN_setct_CapReqTBEX "setct-CapReqTBEX" +#define NID_setct_CapReqTBEX 581 +#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L + +#define SN_setct_CapResTBE "setct-CapResTBE" +#define NID_setct_CapResTBE 582 +#define OBJ_setct_CapResTBE OBJ_set_ctype,64L + +#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" +#define NID_setct_CapRevReqTBE 583 +#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L + +#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" +#define NID_setct_CapRevReqTBEX 584 +#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L + +#define SN_setct_CapRevResTBE "setct-CapRevResTBE" +#define NID_setct_CapRevResTBE 585 +#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L + +#define SN_setct_CredReqTBE "setct-CredReqTBE" +#define NID_setct_CredReqTBE 586 +#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L + +#define SN_setct_CredReqTBEX "setct-CredReqTBEX" +#define NID_setct_CredReqTBEX 587 +#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L + +#define SN_setct_CredResTBE "setct-CredResTBE" +#define NID_setct_CredResTBE 588 +#define OBJ_setct_CredResTBE OBJ_set_ctype,70L + +#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" +#define NID_setct_CredRevReqTBE 589 +#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L + +#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" +#define NID_setct_CredRevReqTBEX 590 +#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L + +#define SN_setct_CredRevResTBE "setct-CredRevResTBE" +#define NID_setct_CredRevResTBE 591 +#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L + +#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" +#define NID_setct_BatchAdminReqTBE 592 +#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L + +#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" +#define NID_setct_BatchAdminResTBE 593 +#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L + +#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" +#define NID_setct_RegFormReqTBE 594 +#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L + +#define SN_setct_CertReqTBE "setct-CertReqTBE" +#define NID_setct_CertReqTBE 595 +#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L + +#define SN_setct_CertReqTBEX "setct-CertReqTBEX" +#define NID_setct_CertReqTBEX 596 +#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L + +#define SN_setct_CertResTBE "setct-CertResTBE" +#define NID_setct_CertResTBE 597 +#define OBJ_setct_CertResTBE OBJ_set_ctype,79L + +#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" +#define NID_setct_CRLNotificationTBS 598 +#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L + +#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" +#define NID_setct_CRLNotificationResTBS 599 +#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L + +#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" +#define NID_setct_BCIDistributionTBS 600 +#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L + +#define SN_setext_genCrypt "setext-genCrypt" +#define LN_setext_genCrypt "generic cryptogram" +#define NID_setext_genCrypt 601 +#define OBJ_setext_genCrypt OBJ_set_msgExt,1L + +#define SN_setext_miAuth "setext-miAuth" +#define LN_setext_miAuth "merchant initiated auth" +#define NID_setext_miAuth 602 +#define OBJ_setext_miAuth OBJ_set_msgExt,3L + +#define SN_setext_pinSecure "setext-pinSecure" +#define NID_setext_pinSecure 603 +#define OBJ_setext_pinSecure OBJ_set_msgExt,4L + +#define SN_setext_pinAny "setext-pinAny" +#define NID_setext_pinAny 604 +#define OBJ_setext_pinAny OBJ_set_msgExt,5L + +#define SN_setext_track2 "setext-track2" +#define NID_setext_track2 605 +#define OBJ_setext_track2 OBJ_set_msgExt,7L + +#define SN_setext_cv "setext-cv" +#define LN_setext_cv "additional verification" +#define NID_setext_cv 606 +#define OBJ_setext_cv OBJ_set_msgExt,8L + +#define SN_set_policy_root "set-policy-root" +#define NID_set_policy_root 607 +#define OBJ_set_policy_root OBJ_set_policy,0L + +#define SN_setCext_hashedRoot "setCext-hashedRoot" +#define NID_setCext_hashedRoot 608 +#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L + +#define SN_setCext_certType "setCext-certType" +#define NID_setCext_certType 609 +#define OBJ_setCext_certType OBJ_set_certExt,1L + +#define SN_setCext_merchData "setCext-merchData" +#define NID_setCext_merchData 610 +#define OBJ_setCext_merchData OBJ_set_certExt,2L + +#define SN_setCext_cCertRequired "setCext-cCertRequired" +#define NID_setCext_cCertRequired 611 +#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L + +#define SN_setCext_tunneling "setCext-tunneling" +#define NID_setCext_tunneling 612 +#define OBJ_setCext_tunneling OBJ_set_certExt,4L + +#define SN_setCext_setExt "setCext-setExt" +#define NID_setCext_setExt 613 +#define OBJ_setCext_setExt OBJ_set_certExt,5L + +#define SN_setCext_setQualf "setCext-setQualf" +#define NID_setCext_setQualf 614 +#define OBJ_setCext_setQualf OBJ_set_certExt,6L + +#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" +#define NID_setCext_PGWYcapabilities 615 +#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L + +#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" +#define NID_setCext_TokenIdentifier 616 +#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L + +#define SN_setCext_Track2Data "setCext-Track2Data" +#define NID_setCext_Track2Data 617 +#define OBJ_setCext_Track2Data OBJ_set_certExt,9L + +#define SN_setCext_TokenType "setCext-TokenType" +#define NID_setCext_TokenType 618 +#define OBJ_setCext_TokenType OBJ_set_certExt,10L + +#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" +#define NID_setCext_IssuerCapabilities 619 +#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L + +#define SN_setAttr_Cert "setAttr-Cert" +#define NID_setAttr_Cert 620 +#define OBJ_setAttr_Cert OBJ_set_attr,0L + +#define SN_setAttr_PGWYcap "setAttr-PGWYcap" +#define LN_setAttr_PGWYcap "payment gateway capabilities" +#define NID_setAttr_PGWYcap 621 +#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L + +#define SN_setAttr_TokenType "setAttr-TokenType" +#define NID_setAttr_TokenType 622 +#define OBJ_setAttr_TokenType OBJ_set_attr,2L + +#define SN_setAttr_IssCap "setAttr-IssCap" +#define LN_setAttr_IssCap "issuer capabilities" +#define NID_setAttr_IssCap 623 +#define OBJ_setAttr_IssCap OBJ_set_attr,3L + +#define SN_set_rootKeyThumb "set-rootKeyThumb" +#define NID_set_rootKeyThumb 624 +#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L + +#define SN_set_addPolicy "set-addPolicy" +#define NID_set_addPolicy 625 +#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L + +#define SN_setAttr_Token_EMV "setAttr-Token-EMV" +#define NID_setAttr_Token_EMV 626 +#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L + +#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" +#define NID_setAttr_Token_B0Prime 627 +#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L + +#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" +#define NID_setAttr_IssCap_CVM 628 +#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L + +#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" +#define NID_setAttr_IssCap_T2 629 +#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L + +#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" +#define NID_setAttr_IssCap_Sig 630 +#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L + +#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" +#define LN_setAttr_GenCryptgrm "generate cryptogram" +#define NID_setAttr_GenCryptgrm 631 +#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L + +#define SN_setAttr_T2Enc "setAttr-T2Enc" +#define LN_setAttr_T2Enc "encrypted track 2" +#define NID_setAttr_T2Enc 632 +#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L + +#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" +#define LN_setAttr_T2cleartxt "cleartext track 2" +#define NID_setAttr_T2cleartxt 633 +#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L + +#define SN_setAttr_TokICCsig "setAttr-TokICCsig" +#define LN_setAttr_TokICCsig "ICC or token signature" +#define NID_setAttr_TokICCsig 634 +#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L + +#define SN_setAttr_SecDevSig "setAttr-SecDevSig" +#define LN_setAttr_SecDevSig "secure device signature" +#define NID_setAttr_SecDevSig 635 +#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L + +#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" +#define NID_set_brand_IATA_ATA 636 +#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L + +#define SN_set_brand_Diners "set-brand-Diners" +#define NID_set_brand_Diners 637 +#define OBJ_set_brand_Diners OBJ_set_brand,30L + +#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" +#define NID_set_brand_AmericanExpress 638 +#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L + +#define SN_set_brand_JCB "set-brand-JCB" +#define NID_set_brand_JCB 639 +#define OBJ_set_brand_JCB OBJ_set_brand,35L + +#define SN_set_brand_Visa "set-brand-Visa" +#define NID_set_brand_Visa 640 +#define OBJ_set_brand_Visa OBJ_set_brand,4L + +#define SN_set_brand_MasterCard "set-brand-MasterCard" +#define NID_set_brand_MasterCard 641 +#define OBJ_set_brand_MasterCard OBJ_set_brand,5L + +#define SN_set_brand_Novus "set-brand-Novus" +#define NID_set_brand_Novus 642 +#define OBJ_set_brand_Novus OBJ_set_brand,6011L + +#define SN_des_cdmf "DES-CDMF" +#define LN_des_cdmf "des-cdmf" +#define NID_des_cdmf 643 +#define OBJ_des_cdmf OBJ_rsadsi,3L,10L + +#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" +#define NID_rsaOAEPEncryptionSET 644 +#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L + +#define SN_ipsec3 "Oakley-EC2N-3" +#define LN_ipsec3 "ipsec3" +#define NID_ipsec3 749 + +#define SN_ipsec4 "Oakley-EC2N-4" +#define LN_ipsec4 "ipsec4" +#define NID_ipsec4 750 + +#define SN_whirlpool "whirlpool" +#define NID_whirlpool 804 +#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L + +#define SN_cryptopro "cryptopro" +#define NID_cryptopro 805 +#define OBJ_cryptopro OBJ_member_body,643L,2L,2L + +#define SN_cryptocom "cryptocom" +#define NID_cryptocom 806 +#define OBJ_cryptocom OBJ_member_body,643L,2L,9L + +#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" +#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" +#define NID_id_GostR3411_94_with_GostR3410_2001 807 +#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L + +#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" +#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" +#define NID_id_GostR3411_94_with_GostR3410_94 808 +#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L + +#define SN_id_GostR3411_94 "md_gost94" +#define LN_id_GostR3411_94 "GOST R 34.11-94" +#define NID_id_GostR3411_94 809 +#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L + +#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" +#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" +#define NID_id_HMACGostR3411_94 810 +#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L + +#define SN_id_GostR3410_2001 "gost2001" +#define LN_id_GostR3410_2001 "GOST R 34.10-2001" +#define NID_id_GostR3410_2001 811 +#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L + +#define SN_id_GostR3410_94 "gost94" +#define LN_id_GostR3410_94 "GOST R 34.10-94" +#define NID_id_GostR3410_94 812 +#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L + +#define SN_id_Gost28147_89 "gost89" +#define LN_id_Gost28147_89 "GOST 28147-89" +#define NID_id_Gost28147_89 813 +#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L + +#define SN_gost89_cnt "gost89-cnt" +#define NID_gost89_cnt 814 + +#define SN_id_Gost28147_89_MAC "gost-mac" +#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" +#define NID_id_Gost28147_89_MAC 815 +#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L + +#define SN_id_GostR3411_94_prf "prf-gostr3411-94" +#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" +#define NID_id_GostR3411_94_prf 816 +#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L + +#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" +#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" +#define NID_id_GostR3410_2001DH 817 +#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L + +#define SN_id_GostR3410_94DH "id-GostR3410-94DH" +#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" +#define NID_id_GostR3410_94DH 818 +#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L + +#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" +#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 +#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L + +#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" +#define NID_id_Gost28147_89_None_KeyMeshing 820 +#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L + +#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" +#define NID_id_GostR3411_94_TestParamSet 821 +#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L + +#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" +#define NID_id_GostR3411_94_CryptoProParamSet 822 +#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L + +#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" +#define NID_id_Gost28147_89_TestParamSet 823 +#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L + +#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 +#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L + +#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 +#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L + +#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 +#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L + +#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 +#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L + +#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 +#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L + +#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" +#define NID_id_GostR3410_94_TestParamSet 831 +#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L + +#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 +#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L + +#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 +#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L + +#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 +#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L + +#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 +#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L + +#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 +#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L + +#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 +#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L + +#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 +#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L + +#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" +#define NID_id_GostR3410_2001_TestParamSet 839 +#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L + +#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 +#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L + +#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 +#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L + +#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 +#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L + +#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 +#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L + +#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 +#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L + +#define SN_id_GostR3410_94_a "id-GostR3410-94-a" +#define NID_id_GostR3410_94_a 845 +#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L + +#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" +#define NID_id_GostR3410_94_aBis 846 +#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L + +#define SN_id_GostR3410_94_b "id-GostR3410-94-b" +#define NID_id_GostR3410_94_b 847 +#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L + +#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" +#define NID_id_GostR3410_94_bBis 848 +#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L + +#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" +#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" +#define NID_id_Gost28147_89_cc 849 +#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L + +#define SN_id_GostR3410_94_cc "gost94cc" +#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" +#define NID_id_GostR3410_94_cc 850 +#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L + +#define SN_id_GostR3410_2001_cc "gost2001cc" +#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" +#define NID_id_GostR3410_2001_cc 851 +#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L + +#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" +#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 +#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L + +#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" +#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 +#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L + +#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" +#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" +#define NID_id_GostR3410_2001_ParamSet_cc 854 +#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L + +#define SN_camellia_128_cbc "CAMELLIA-128-CBC" +#define LN_camellia_128_cbc "camellia-128-cbc" +#define NID_camellia_128_cbc 751 +#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L + +#define SN_camellia_192_cbc "CAMELLIA-192-CBC" +#define LN_camellia_192_cbc "camellia-192-cbc" +#define NID_camellia_192_cbc 752 +#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L + +#define SN_camellia_256_cbc "CAMELLIA-256-CBC" +#define LN_camellia_256_cbc "camellia-256-cbc" +#define NID_camellia_256_cbc 753 +#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L + +#define SN_id_camellia128_wrap "id-camellia128-wrap" +#define NID_id_camellia128_wrap 907 +#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L + +#define SN_id_camellia192_wrap "id-camellia192-wrap" +#define NID_id_camellia192_wrap 908 +#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L + +#define SN_id_camellia256_wrap "id-camellia256-wrap" +#define NID_id_camellia256_wrap 909 +#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L + +#define OBJ_ntt_ds 0L,3L,4401L,5L + +#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L + +#define SN_camellia_128_ecb "CAMELLIA-128-ECB" +#define LN_camellia_128_ecb "camellia-128-ecb" +#define NID_camellia_128_ecb 754 +#define OBJ_camellia_128_ecb OBJ_camellia,1L + +#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" +#define LN_camellia_128_ofb128 "camellia-128-ofb" +#define NID_camellia_128_ofb128 766 +#define OBJ_camellia_128_ofb128 OBJ_camellia,3L + +#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" +#define LN_camellia_128_cfb128 "camellia-128-cfb" +#define NID_camellia_128_cfb128 757 +#define OBJ_camellia_128_cfb128 OBJ_camellia,4L + +#define SN_camellia_192_ecb "CAMELLIA-192-ECB" +#define LN_camellia_192_ecb "camellia-192-ecb" +#define NID_camellia_192_ecb 755 +#define OBJ_camellia_192_ecb OBJ_camellia,21L + +#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" +#define LN_camellia_192_ofb128 "camellia-192-ofb" +#define NID_camellia_192_ofb128 767 +#define OBJ_camellia_192_ofb128 OBJ_camellia,23L + +#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" +#define LN_camellia_192_cfb128 "camellia-192-cfb" +#define NID_camellia_192_cfb128 758 +#define OBJ_camellia_192_cfb128 OBJ_camellia,24L + +#define SN_camellia_256_ecb "CAMELLIA-256-ECB" +#define LN_camellia_256_ecb "camellia-256-ecb" +#define NID_camellia_256_ecb 756 +#define OBJ_camellia_256_ecb OBJ_camellia,41L + +#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" +#define LN_camellia_256_ofb128 "camellia-256-ofb" +#define NID_camellia_256_ofb128 768 +#define OBJ_camellia_256_ofb128 OBJ_camellia,43L + +#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" +#define LN_camellia_256_cfb128 "camellia-256-cfb" +#define NID_camellia_256_cfb128 759 +#define OBJ_camellia_256_cfb128 OBJ_camellia,44L + +#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" +#define LN_camellia_128_cfb1 "camellia-128-cfb1" +#define NID_camellia_128_cfb1 760 + +#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" +#define LN_camellia_192_cfb1 "camellia-192-cfb1" +#define NID_camellia_192_cfb1 761 + +#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" +#define LN_camellia_256_cfb1 "camellia-256-cfb1" +#define NID_camellia_256_cfb1 762 + +#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" +#define LN_camellia_128_cfb8 "camellia-128-cfb8" +#define NID_camellia_128_cfb8 763 + +#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" +#define LN_camellia_192_cfb8 "camellia-192-cfb8" +#define NID_camellia_192_cfb8 764 + +#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" +#define LN_camellia_256_cfb8 "camellia-256-cfb8" +#define NID_camellia_256_cfb8 765 + +#define SN_kisa "KISA" +#define LN_kisa "kisa" +#define NID_kisa 773 +#define OBJ_kisa OBJ_member_body,410L,200004L + +#define SN_seed_ecb "SEED-ECB" +#define LN_seed_ecb "seed-ecb" +#define NID_seed_ecb 776 +#define OBJ_seed_ecb OBJ_kisa,1L,3L + +#define SN_seed_cbc "SEED-CBC" +#define LN_seed_cbc "seed-cbc" +#define NID_seed_cbc 777 +#define OBJ_seed_cbc OBJ_kisa,1L,4L + +#define SN_seed_cfb128 "SEED-CFB" +#define LN_seed_cfb128 "seed-cfb" +#define NID_seed_cfb128 779 +#define OBJ_seed_cfb128 OBJ_kisa,1L,5L + +#define SN_seed_ofb128 "SEED-OFB" +#define LN_seed_ofb128 "seed-ofb" +#define NID_seed_ofb128 778 +#define OBJ_seed_ofb128 OBJ_kisa,1L,6L + +#define SN_hmac "HMAC" +#define LN_hmac "hmac" +#define NID_hmac 855 + +#define SN_cmac "CMAC" +#define LN_cmac "cmac" +#define NID_cmac 894 + +#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" +#define LN_rc4_hmac_md5 "rc4-hmac-md5" +#define NID_rc4_hmac_md5 915 + +#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" +#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" +#define NID_aes_128_cbc_hmac_sha1 916 + +#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" +#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" +#define NID_aes_192_cbc_hmac_sha1 917 + +#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" +#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" +#define NID_aes_256_cbc_hmac_sha1 918 + +#define SN_dhpublicnumber "dhpublicnumber" +#define LN_dhpublicnumber "X9.42 DH" +#define NID_dhpublicnumber 920 +#define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L + +#define SN_brainpoolP160r1 "brainpoolP160r1" +#define NID_brainpoolP160r1 921 +#define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L + +#define SN_brainpoolP160t1 "brainpoolP160t1" +#define NID_brainpoolP160t1 922 +#define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L + +#define SN_brainpoolP192r1 "brainpoolP192r1" +#define NID_brainpoolP192r1 923 +#define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L + +#define SN_brainpoolP192t1 "brainpoolP192t1" +#define NID_brainpoolP192t1 924 +#define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L + +#define SN_brainpoolP224r1 "brainpoolP224r1" +#define NID_brainpoolP224r1 925 +#define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L + +#define SN_brainpoolP224t1 "brainpoolP224t1" +#define NID_brainpoolP224t1 926 +#define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L + +#define SN_brainpoolP256r1 "brainpoolP256r1" +#define NID_brainpoolP256r1 927 +#define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L + +#define SN_brainpoolP256t1 "brainpoolP256t1" +#define NID_brainpoolP256t1 928 +#define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L + +#define SN_brainpoolP320r1 "brainpoolP320r1" +#define NID_brainpoolP320r1 929 +#define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L + +#define SN_brainpoolP320t1 "brainpoolP320t1" +#define NID_brainpoolP320t1 930 +#define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L + +#define SN_brainpoolP384r1 "brainpoolP384r1" +#define NID_brainpoolP384r1 931 +#define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L + +#define SN_brainpoolP384t1 "brainpoolP384t1" +#define NID_brainpoolP384t1 932 +#define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L + +#define SN_brainpoolP512r1 "brainpoolP512r1" +#define NID_brainpoolP512r1 933 +#define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L + +#define SN_brainpoolP512t1 "brainpoolP512t1" +#define NID_brainpoolP512t1 934 +#define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L + +#define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L + +#define OBJ_secg_scheme OBJ_certicom_arc,1L + +#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" +#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 +#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L + +#define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" +#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 +#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L + +#define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" +#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 +#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L + +#define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" +#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 +#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L + +#define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" +#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 +#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L + +#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 +#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L + +#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 +#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L + +#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 +#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L + +#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 +#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L + +#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 +#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L + +#define SN_dh_std_kdf "dh-std-kdf" +#define NID_dh_std_kdf 946 + +#define SN_dh_cofactor_kdf "dh-cofactor-kdf" +#define NID_dh_cofactor_kdf 947 + diff --git a/phonelibs/boringssl/include/openssl/objects.h b/phonelibs/boringssl/include/openssl/objects.h new file mode 100644 index 00000000000000..dd6556f26489c5 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/objects.h @@ -0,0 +1,18 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* This header is provided in order to make compiling against code that expects + OpenSSL easier. */ + +#include "obj.h" diff --git a/phonelibs/boringssl/include/openssl/opensslfeatures.h b/phonelibs/boringssl/include/openssl/opensslfeatures.h new file mode 100644 index 00000000000000..c3f97d5a48e620 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/opensslfeatures.h @@ -0,0 +1,60 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* This header is provided in order to make compiling against code that expects + OpenSSL easier. */ + +#ifndef OPENSSL_HEADER_OPENSSLFEATURES_H +#define OPENSSL_HEADER_OPENSSLFEATURES_H + + +#define OPENSSL_NO_BF +#define OPENSSL_NO_BUF_FREELISTS +#define OPENSSL_NO_CAMELLIA +#define OPENSSL_NO_CAPIENG +#define OPENSSL_NO_CAST +#define OPENSSL_NO_CMS +#define OPENSSL_NO_COMP +#define OPENSSL_NO_DANE +#define OPENSSL_NO_DEPRECATED +#define OPENSSL_NO_DYNAMIC_ENGINE +#define OPENSSL_NO_EC_NISTP_64_GCC_128 +#define OPENSSL_NO_EC2M +#define OPENSSL_NO_ENGINE +#define OPENSSL_NO_GMP +#define OPENSSL_NO_GOST +#define OPENSSL_NO_HEARTBEATS +#define OPENSSL_NO_HW +#define OPENSSL_NO_IDEA +#define OPENSSL_NO_JPAKE +#define OPENSSL_NO_KRB5 +#define OPENSSL_NO_MD2 +#define OPENSSL_NO_MDC2 +#define OPENSSL_NO_OCB +#define OPENSSL_NO_OCSP +#define OPENSSL_NO_RC2 +#define OPENSSL_NO_RC5 +#define OPENSSL_NO_RFC3779 +#define OPENSSL_NO_RIPEMD +#define OPENSSL_NO_RMD160 +#define OPENSSL_NO_SCTP +#define OPENSSL_NO_SEED +#define OPENSSL_NO_SRP +#define OPENSSL_NO_SSL2 +#define OPENSSL_NO_STATIC_ENGINE +#define OPENSSL_NO_STORE +#define OPENSSL_NO_WHIRLPOOL + + +#endif /* OPENSSL_HEADER_OPENSSLFEATURES_H */ diff --git a/phonelibs/boringssl/include/openssl/opensslv.h b/phonelibs/boringssl/include/openssl/opensslv.h new file mode 100644 index 00000000000000..a3555d4f8b0027 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/opensslv.h @@ -0,0 +1,18 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* This header is provided in order to make compiling against code that expects + OpenSSL easier. */ + +#include "crypto.h" diff --git a/phonelibs/boringssl/include/openssl/ossl_typ.h b/phonelibs/boringssl/include/openssl/ossl_typ.h new file mode 100644 index 00000000000000..c2b3fe7c500965 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ossl_typ.h @@ -0,0 +1,18 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* This header is provided in order to make compiling against code that expects + OpenSSL easier. */ + +#include "base.h" diff --git a/phonelibs/boringssl/include/openssl/pem.h b/phonelibs/boringssl/include/openssl/pem.h new file mode 100644 index 00000000000000..7756e45ed3e73c --- /dev/null +++ b/phonelibs/boringssl/include/openssl/pem.h @@ -0,0 +1,545 @@ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_PEM_H +#define OPENSSL_HEADER_PEM_H + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#define PEM_BUFSIZE 1024 + +#define PEM_OBJ_UNDEF 0 +#define PEM_OBJ_X509 1 +#define PEM_OBJ_X509_REQ 2 +#define PEM_OBJ_CRL 3 +#define PEM_OBJ_SSL_SESSION 4 +#define PEM_OBJ_PRIV_KEY 10 +#define PEM_OBJ_PRIV_RSA 11 +#define PEM_OBJ_PRIV_DSA 12 +#define PEM_OBJ_PRIV_DH 13 +#define PEM_OBJ_PUB_RSA 14 +#define PEM_OBJ_PUB_DSA 15 +#define PEM_OBJ_PUB_DH 16 +#define PEM_OBJ_DHPARAMS 17 +#define PEM_OBJ_DSAPARAMS 18 +#define PEM_OBJ_PRIV_RSA_PUBLIC 19 +#define PEM_OBJ_PRIV_ECDSA 20 +#define PEM_OBJ_PUB_ECDSA 21 +#define PEM_OBJ_ECPARAMETERS 22 + +#define PEM_ERROR 30 +#define PEM_DEK_DES_CBC 40 +#define PEM_DEK_IDEA_CBC 45 +#define PEM_DEK_DES_EDE 50 +#define PEM_DEK_DES_ECB 60 +#define PEM_DEK_RSA 70 +#define PEM_DEK_RSA_MD2 80 +#define PEM_DEK_RSA_MD5 90 + +#define PEM_MD_MD2 NID_md2 +#define PEM_MD_MD5 NID_md5 +#define PEM_MD_SHA NID_sha +#define PEM_MD_MD2_RSA NID_md2WithRSAEncryption +#define PEM_MD_MD5_RSA NID_md5WithRSAEncryption +#define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption + +#define PEM_STRING_X509_OLD "X509 CERTIFICATE" +#define PEM_STRING_X509 "CERTIFICATE" +#define PEM_STRING_X509_PAIR "CERTIFICATE PAIR" +#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" +#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +#define PEM_STRING_X509_CRL "X509 CRL" +#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" +#define PEM_STRING_PUBLIC "PUBLIC KEY" +#define PEM_STRING_RSA "RSA PRIVATE KEY" +#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +#define PEM_STRING_DSA "DSA PRIVATE KEY" +#define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" +#define PEM_STRING_PKCS7 "PKCS7" +#define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" +#define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" +#define PEM_STRING_PKCS8INF "PRIVATE KEY" +#define PEM_STRING_DHPARAMS "DH PARAMETERS" +#define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" +#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +#define PEM_STRING_DSAPARAMS "DSA PARAMETERS" +#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" +#define PEM_STRING_ECPARAMETERS "EC PARAMETERS" +#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" +#define PEM_STRING_PARAMETERS "PARAMETERS" +#define PEM_STRING_CMS "CMS" + + /* Note that this structure is initialised by PEM_SealInit and cleaned up + by PEM_SealFinal (at least for now) */ +typedef struct PEM_Encode_Seal_st + { + EVP_ENCODE_CTX encode; + EVP_MD_CTX md; + EVP_CIPHER_CTX cipher; + } PEM_ENCODE_SEAL_CTX; + +/* enc_type is one off */ +#define PEM_TYPE_ENCRYPTED 10 +#define PEM_TYPE_MIC_ONLY 20 +#define PEM_TYPE_MIC_CLEAR 30 +#define PEM_TYPE_CLEAR 40 + +typedef struct pem_recip_st + { + char *name; + X509_NAME *dn; + + int cipher; + int key_enc; + /* char iv[8]; unused and wrong size */ + } PEM_USER; + +typedef struct pem_ctx_st + { + int type; /* what type of object */ + + struct { + int version; + int mode; + } proc_type; + + char *domain; + + struct { + int cipher; + /* unused, and wrong size + unsigned char iv[8]; */ + } DEK_info; + + PEM_USER *originator; + + int num_recipient; + PEM_USER **recipient; + + EVP_MD *md; /* signature type */ + + int md_enc; /* is the md encrypted or not? */ + int md_len; /* length of md_data */ + char *md_data; /* message digest, could be pkey encrypted */ + + EVP_CIPHER *dec; /* date encryption cipher */ + int key_len; /* key length */ + unsigned char *key; /* key */ + /* unused, and wrong size + unsigned char iv[8]; */ + + + int data_enc; /* is the data encrypted */ + int data_len; + unsigned char *data; + } PEM_CTX; + +/* These macros make the PEM_read/PEM_write functions easier to maintain and + * write. Now they are all implemented with either: + * IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...) + */ + +#ifdef OPENSSL_NO_FP_API + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ + +#else + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ +OPENSSL_EXPORT type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ +} + +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ +OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x) \ +{ \ +return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ +} + +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ +OPENSSL_EXPORT int PEM_write_##name(FILE *fp, const type *x) \ +{ \ +return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ +} + +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ +OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ + } + +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ +OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ + } + +#endif + +#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ +OPENSSL_EXPORT type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ +} + +#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ +OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x) \ +{ \ +return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ +} + +#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ +OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, const type *x) \ +{ \ +return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ +} + +#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ +OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ + } + +#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ +OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ + } + +#define IMPLEMENT_PEM_write(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_read_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb(name, type, str, asn1) + +/* These are the same except they are for the declarations */ + +#if defined(OPENSSL_NO_FP_API) + +#define DECLARE_PEM_read_fp(name, type) /**/ +#define DECLARE_PEM_write_fp(name, type) /**/ +#define DECLARE_PEM_write_cb_fp(name, type) /**/ + +#else + +#define DECLARE_PEM_read_fp(name, type) \ + OPENSSL_EXPORT type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); + +#define DECLARE_PEM_write_fp(name, type) \ + OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x); + +#define DECLARE_PEM_write_fp_const(name, type) \ + OPENSSL_EXPORT int PEM_write_##name(FILE *fp, const type *x); + +#define DECLARE_PEM_write_cb_fp(name, type) \ + OPENSSL_EXPORT int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +#endif + +#define DECLARE_PEM_read_bio(name, type) \ + OPENSSL_EXPORT type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); + +#define DECLARE_PEM_write_bio(name, type) \ + OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x); + +#define DECLARE_PEM_write_bio_const(name, type) \ + OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, const type *x); + +#define DECLARE_PEM_write_cb_bio(name, type) \ + OPENSSL_EXPORT int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + + +#define DECLARE_PEM_write(name, type) \ + DECLARE_PEM_write_bio(name, type) \ + DECLARE_PEM_write_fp(name, type) + +#define DECLARE_PEM_write_const(name, type) \ + DECLARE_PEM_write_bio_const(name, type) \ + DECLARE_PEM_write_fp_const(name, type) + +#define DECLARE_PEM_write_cb(name, type) \ + DECLARE_PEM_write_cb_bio(name, type) \ + DECLARE_PEM_write_cb_fp(name, type) + +#define DECLARE_PEM_read(name, type) \ + DECLARE_PEM_read_bio(name, type) \ + DECLARE_PEM_read_fp(name, type) + +#define DECLARE_PEM_rw(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write(name, type) + +#define DECLARE_PEM_rw_const(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_const(name, type) + +#define DECLARE_PEM_rw_cb(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_cb(name, type) + +/* "userdata": new with OpenSSL 0.9.4 */ +typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); + +OPENSSL_EXPORT int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); +OPENSSL_EXPORT int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, pem_password_cb *callback,void *u); + +OPENSSL_EXPORT int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data,long *len); +OPENSSL_EXPORT int PEM_write_bio(BIO *bp,const char *name, const char *hdr, const unsigned char *data, long len); +OPENSSL_EXPORT int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp, pem_password_cb *cb, void *u); +OPENSSL_EXPORT void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, pem_password_cb *cb, void *u); +OPENSSL_EXPORT int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp, void *x, const EVP_CIPHER *enc,unsigned char *kstr,int klen, pem_password_cb *cb, void *u); + +OPENSSL_EXPORT STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); +OPENSSL_EXPORT int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cd, void *u); + +OPENSSL_EXPORT int PEM_read(FILE *fp, char **name, char **header, unsigned char **data,long *len); +OPENSSL_EXPORT int PEM_write(FILE *fp, const char *name, const char *hdr, const unsigned char *data, long len); +OPENSSL_EXPORT void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, pem_password_cb *cb, void *u); +OPENSSL_EXPORT int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp, void *x,const EVP_CIPHER *enc,unsigned char *kstr, int klen,pem_password_cb *callback, void *u); +OPENSSL_EXPORT STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); + +OPENSSL_EXPORT int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk); +OPENSSL_EXPORT void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl); +OPENSSL_EXPORT int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl, unsigned char *out, int *outl, EVP_PKEY *priv); + +OPENSSL_EXPORT void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); +OPENSSL_EXPORT void PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt); +OPENSSL_EXPORT int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, EVP_PKEY *pkey); + +/* |PEM_def_callback| treats |userdata| as a string and copies it into |buf|, + * assuming its |size| is sufficient. Returns the length of the string, or 0 + * if there is not enough room. If either |buf| or |userdata| is NULL, 0 is + * returned. Note that this is different from OpenSSL, which prompts for a + * password. */ +OPENSSL_EXPORT int PEM_def_callback(char *buf, int size, int rwflag, void *userdata); +OPENSSL_EXPORT void PEM_proc_type(char *buf, int type); +OPENSSL_EXPORT void PEM_dek_info(char *buf, const char *type, int len, char *str); + + +DECLARE_PEM_rw(X509, X509) + +DECLARE_PEM_rw(X509_AUX, X509) + +DECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR) + +DECLARE_PEM_rw(X509_REQ, X509_REQ) +DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) + +DECLARE_PEM_rw(X509_CRL, X509_CRL) + +/* DECLARE_PEM_rw(PKCS7, PKCS7) */ + +DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) + +DECLARE_PEM_rw(PKCS8, X509_SIG) + +DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) + +DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) + +DECLARE_PEM_rw_const(RSAPublicKey, RSA) +DECLARE_PEM_rw(RSA_PUBKEY, RSA) + +#ifndef OPENSSL_NO_DSA + +DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) + +DECLARE_PEM_rw(DSA_PUBKEY, DSA) + +DECLARE_PEM_rw_const(DSAparams, DSA) + +#endif + +DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) +DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) +DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) + + +DECLARE_PEM_rw_const(DHparams, DH) +DECLARE_PEM_write_const(DHxparams, DH) + + +DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) + +DECLARE_PEM_rw(PUBKEY, EVP_PKEY) + +OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u); +OPENSSL_EXPORT int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, char *, int, pem_password_cb *, void *); +OPENSSL_EXPORT int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); +OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u); +OPENSSL_EXPORT EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u); + +OPENSSL_EXPORT int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, char *kstr, int klen, pem_password_cb *cb, void *u); +OPENSSL_EXPORT int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u); +OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, char *kstr, int klen, pem_password_cb *cb, void *u); + +OPENSSL_EXPORT EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u); + +OPENSSL_EXPORT int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, char *kstr,int klen, pem_password_cb *cd, void *u); + +OPENSSL_EXPORT EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); +OPENSSL_EXPORT int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); + + +OPENSSL_EXPORT EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); +OPENSSL_EXPORT EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); +OPENSSL_EXPORT EVP_PKEY *b2i_PrivateKey_bio(BIO *in); +OPENSSL_EXPORT EVP_PKEY *b2i_PublicKey_bio(BIO *in); +OPENSSL_EXPORT int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); +OPENSSL_EXPORT int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); +OPENSSL_EXPORT EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); +OPENSSL_EXPORT int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, pem_password_cb *cb, void *u); + + +void ERR_load_PEM_strings(void); + + +#ifdef __cplusplus +} +#endif + +#define PEM_F_PEM_ASN1_read 100 +#define PEM_F_PEM_ASN1_read_bio 101 +#define PEM_F_PEM_ASN1_write 102 +#define PEM_F_PEM_ASN1_write_bio 103 +#define PEM_F_PEM_X509_INFO_read 104 +#define PEM_F_PEM_X509_INFO_read_bio 105 +#define PEM_F_PEM_X509_INFO_write_bio 106 +#define PEM_F_PEM_do_header 107 +#define PEM_F_PEM_get_EVP_CIPHER_INFO 108 +#define PEM_F_PEM_read 109 +#define PEM_F_PEM_read_DHparams 110 +#define PEM_F_PEM_read_PrivateKey 111 +#define PEM_F_PEM_read_bio 112 +#define PEM_F_PEM_read_bio_DHparams 113 +#define PEM_F_PEM_read_bio_Parameters 114 +#define PEM_F_PEM_read_bio_PrivateKey 115 +#define PEM_F_PEM_write 116 +#define PEM_F_PEM_write_PrivateKey 117 +#define PEM_F_PEM_write_bio 118 +#define PEM_F_d2i_PKCS8PrivateKey_bio 119 +#define PEM_F_d2i_PKCS8PrivateKey_fp 120 +#define PEM_F_do_pk8pkey 121 +#define PEM_F_do_pk8pkey_fp 122 +#define PEM_F_load_iv 123 +#define PEM_R_BAD_BASE64_DECODE 100 +#define PEM_R_BAD_DECRYPT 101 +#define PEM_R_BAD_END_LINE 102 +#define PEM_R_BAD_IV_CHARS 103 +#define PEM_R_BAD_PASSWORD_READ 104 +#define PEM_R_CIPHER_IS_NULL 105 +#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 106 +#define PEM_R_NOT_DEK_INFO 107 +#define PEM_R_NOT_ENCRYPTED 108 +#define PEM_R_NOT_PROC_TYPE 109 +#define PEM_R_NO_START_LINE 110 +#define PEM_R_READ_KEY 111 +#define PEM_R_SHORT_HEADER 112 +#define PEM_R_UNSUPPORTED_CIPHER 113 +#define PEM_R_UNSUPPORTED_ENCRYPTION 114 + +#endif /* OPENSSL_HEADER_PEM_H */ diff --git a/phonelibs/boringssl/include/openssl/pkcs12.h b/phonelibs/boringssl/include/openssl/pkcs12.h new file mode 100644 index 00000000000000..b5e951638275f8 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/pkcs12.h @@ -0,0 +1,18 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* This header is provided in order to make compiling against code that expects + OpenSSL easier. */ + +#include "pkcs8.h" diff --git a/phonelibs/boringssl/include/openssl/pkcs7.h b/phonelibs/boringssl/include/openssl/pkcs7.h new file mode 100644 index 00000000000000..6e5e433074f867 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/pkcs7.h @@ -0,0 +1,16 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* This header is provided in order to make compiling against code that expects + OpenSSL easier. */ diff --git a/phonelibs/boringssl/include/openssl/pkcs8.h b/phonelibs/boringssl/include/openssl/pkcs8.h new file mode 100644 index 00000000000000..8dc7731bf5f349 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/pkcs8.h @@ -0,0 +1,217 @@ +/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + + +#ifndef OPENSSL_HEADER_PKCS8_H +#define OPENSSL_HEADER_PKCS8_H + +#include +#include + + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* PKCS8_encrypt_pbe serializes and encrypts a PKCS8_PRIV_KEY_INFO with PBES1 as + * defined in PKCS #5. Only pbeWithSHAAnd128BitRC4, + * pbeWithSHAAnd3-KeyTripleDES-CBC and pbeWithSHA1And40BitRC2, defined in PKCS + * #12, are supported. The |pass_raw_len| bytes pointed to by |pass_raw| are + * used as the password. Note that any conversions from the password as + * supplied in a text string (such as those specified in B.1 of PKCS #12) must + * be performed by the caller. + * + * If |salt| is NULL, a random salt of |salt_len| bytes is generated. If + * |salt_len| is zero, a default salt length is used instead. + * + * The resulting structure is stored in an X509_SIG which must be freed by the + * caller. + * + * TODO(davidben): Really? An X509_SIG? OpenSSL probably did that because it has + * the same structure as EncryptedPrivateKeyInfo. */ +OPENSSL_EXPORT X509_SIG *PKCS8_encrypt_pbe(int pbe_nid, + const uint8_t *pass_raw, + size_t pass_raw_len, + uint8_t *salt, size_t salt_len, + int iterations, + PKCS8_PRIV_KEY_INFO *p8inf); + +/* PKCS8_decrypt_pbe decrypts and decodes a PKCS8_PRIV_KEY_INFO with PBES1 as + * defined in PKCS #5. Only pbeWithSHAAnd128BitRC4, + * pbeWithSHAAnd3-KeyTripleDES-CBC and pbeWithSHA1And40BitRC2, defined in PKCS + * #12, are supported. The |pass_raw_len| bytes pointed to by |pass_raw| are + * used as the password. Note that any conversions from the password as + * supplied in a text string (such as those specified in B.1 of PKCS #12) must + * be performed by the caller. + * + * The resulting structure must be freed by the caller. */ +OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *PKCS8_decrypt_pbe(X509_SIG *pkcs8, + const uint8_t *pass_raw, + size_t pass_raw_len); + + +/* Deprecated functions. */ + +/* PKCS8_encrypt calls PKCS8_encrypt_pbe after treating |pass| as an ASCII + * string, appending U+0000, and converting to UCS-2. (So the empty password + * encodes as two NUL bytes.) The |cipher| argument is ignored. */ +OPENSSL_EXPORT X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int pass_len, + uint8_t *salt, size_t salt_len, + int iterations, + PKCS8_PRIV_KEY_INFO *p8inf); + +/* PKCS8_decrypt calls PKCS8_decrypt_pbe after treating |pass| as an ASCII + * string, appending U+0000, and converting to UCS-2. (So the empty password + * encodes as two NUL bytes.) */ +OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *pkcs8, + const char *pass, + int pass_len); + +/* PKCS12_get_key_and_certs parses a PKCS#12 structure from |in|, authenticates + * and decrypts it using |password|, sets |*out_key| to the included private + * key and appends the included certificates to |out_certs|. It returns one on + * success and zero on error. The caller takes ownership of the outputs. */ +OPENSSL_EXPORT int PKCS12_get_key_and_certs(EVP_PKEY **out_key, + STACK_OF(X509) *out_certs, + CBS *in, const char *password); + + +/* Deprecated functions. */ + +/* PKCS12_PBE_add does nothing. It exists for compatibility with OpenSSL. */ +OPENSSL_EXPORT void PKCS12_PBE_add(void); + +/* d2i_PKCS12 is a dummy function that copies |*ber_bytes| into a + * |PKCS12| structure. The |out_p12| argument must be NULL. On exit, + * |*ber_bytes| will be advanced by |ber_len|. It returns a fresh |PKCS12| + * structure or NULL on error. + * + * Note: unlike other d2i functions, |d2i_PKCS12| will always consume |ber_len| + * bytes.*/ +OPENSSL_EXPORT PKCS12 *d2i_PKCS12(PKCS12 **out_p12, const uint8_t **ber_bytes, + size_t ber_len); + +/* d2i_PKCS12_bio acts like |d2i_PKCS12| but reads from a |BIO|. */ +OPENSSL_EXPORT PKCS12* d2i_PKCS12_bio(BIO *bio, PKCS12 **out_p12); + +/* d2i_PKCS12_fp acts like |d2i_PKCS12| but reads from a |FILE|. */ +OPENSSL_EXPORT PKCS12* d2i_PKCS12_fp(FILE *fp, PKCS12 **out_p12); + +/* PKCS12_parse calls |PKCS12_get_key_and_certs| on the ASN.1 data stored in + * |p12|. The |out_pkey| and |out_cert| arguments must not be NULL and, on + * successful exit, the private key and first certificate will be stored in + * them. The |out_ca_certs| argument may be NULL but, if not, then any extra + * certificates will be appended to |*out_ca_certs|. If |*out_ca_certs| is NULL + * then it will be set to a freshly allocated stack containing the extra certs. + * + * It returns one on success and zero on error. */ +OPENSSL_EXPORT int PKCS12_parse(const PKCS12 *p12, const char *password, + EVP_PKEY **out_pkey, X509 **out_cert, + STACK_OF(X509) **out_ca_certs); + +/* PKCS12_free frees |p12| and its contents. */ +OPENSSL_EXPORT void PKCS12_free(PKCS12 *p12); + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define PKCS8_F_EVP_PKCS82PKEY 100 +#define PKCS8_F_EVP_PKEY2PKCS8 101 +#define PKCS8_F_PKCS12_get_key_and_certs 102 +#define PKCS8_F_PKCS12_handle_content_info 103 +#define PKCS8_F_PKCS12_handle_content_infos 104 +#define PKCS8_F_PKCS5_pbe2_set_iv 105 +#define PKCS8_F_PKCS5_pbe_set 106 +#define PKCS8_F_PKCS5_pbe_set0_algor 107 +#define PKCS8_F_PKCS5_pbkdf2_set 108 +#define PKCS8_F_PKCS8_decrypt 109 +#define PKCS8_F_PKCS8_encrypt 110 +#define PKCS8_F_PKCS8_encrypt_pbe 111 +#define PKCS8_F_pbe_cipher_init 112 +#define PKCS8_F_pbe_crypt 113 +#define PKCS8_F_pkcs12_item_decrypt_d2i 114 +#define PKCS8_F_pkcs12_item_i2d_encrypt 115 +#define PKCS8_F_pkcs12_key_gen_raw 116 +#define PKCS8_F_pkcs12_pbe_keyivgen 117 +#define PKCS8_R_BAD_PKCS12_DATA 100 +#define PKCS8_R_BAD_PKCS12_VERSION 101 +#define PKCS8_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 102 +#define PKCS8_R_CRYPT_ERROR 103 +#define PKCS8_R_DECODE_ERROR 104 +#define PKCS8_R_ENCODE_ERROR 105 +#define PKCS8_R_ENCRYPT_ERROR 106 +#define PKCS8_R_ERROR_SETTING_CIPHER_PARAMS 107 +#define PKCS8_R_INCORRECT_PASSWORD 108 +#define PKCS8_R_KEYGEN_FAILURE 109 +#define PKCS8_R_KEY_GEN_ERROR 110 +#define PKCS8_R_METHOD_NOT_SUPPORTED 111 +#define PKCS8_R_MISSING_MAC 112 +#define PKCS8_R_MULTIPLE_PRIVATE_KEYS_IN_PKCS12 113 +#define PKCS8_R_PKCS12_PUBLIC_KEY_INTEGRITY_NOT_SUPPORTED 114 +#define PKCS8_R_PKCS12_TOO_DEEPLY_NESTED 115 +#define PKCS8_R_PRIVATE_KEY_DECODE_ERROR 116 +#define PKCS8_R_PRIVATE_KEY_ENCODE_ERROR 117 +#define PKCS8_R_TOO_LONG 118 +#define PKCS8_R_UNKNOWN_ALGORITHM 119 +#define PKCS8_R_UNKNOWN_CIPHER 120 +#define PKCS8_R_UNKNOWN_CIPHER_ALGORITHM 121 +#define PKCS8_R_UNKNOWN_DIGEST 122 +#define PKCS8_R_UNKNOWN_HASH 123 +#define PKCS8_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 124 + +#endif /* OPENSSL_HEADER_PKCS8_H */ diff --git a/phonelibs/boringssl/include/openssl/poly1305.h b/phonelibs/boringssl/include/openssl/poly1305.h new file mode 100644 index 00000000000000..aa904869ce5f17 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/poly1305.h @@ -0,0 +1,47 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_POLY1305_H +#define OPENSSL_HEADER_POLY1305_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef unsigned char poly1305_state[512]; + +/* poly1305_init sets up |state| so that it can be used to calculate an + * authentication tag with the one-time key |key|. Note that |key| is a + * one-time key and therefore there is no `reset' method because that would + * enable several messages to be authenticated with the same key. */ +extern void CRYPTO_poly1305_init(poly1305_state* state, const uint8_t key[32]); + +/* poly1305_update processes |in_len| bytes from |in|. It can be called zero or + * more times after poly1305_init. */ +extern void CRYPTO_poly1305_update(poly1305_state* state, const uint8_t* in, + size_t in_len); + +/* poly1305_finish completes the poly1305 calculation and writes a 16 byte + * authentication tag to |mac|. The |mac| address must be 16-byte aligned. */ +extern void CRYPTO_poly1305_finish(poly1305_state* state, uint8_t mac[16]); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_POLY1305_H */ diff --git a/phonelibs/boringssl/include/openssl/pqueue.h b/phonelibs/boringssl/include/openssl/pqueue.h new file mode 100644 index 00000000000000..ceb1fa2a749757 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/pqueue.h @@ -0,0 +1,146 @@ +/* + * DTLS implementation written by Nagendra Modadugu + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. + */ +/* ==================================================================== + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + +#ifndef OPENSSL_HEADER_PQUEUE_H +#define OPENSSL_HEADER_PQUEUE_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Priority queue. + * + * The priority queue maintains a linked-list of nodes, each with a unique, + * 64-bit priority, in ascending priority order. */ + +typedef struct _pqueue *pqueue; + +typedef struct _pitem { + uint8_t priority[8]; /* 64-bit value in big-endian encoding */ + void *data; + struct _pitem *next; +} pitem; + +typedef struct _pitem *piterator; + + +/* Creating and freeing queues. */ + +/* pqueue_new allocates a fresh, empty priority queue object and returns it, or + * NULL on error. */ +OPENSSL_EXPORT pqueue pqueue_new(void); + +/* pqueue_free frees |pq| but not any of the items it points to. Thus |pq| must + * be empty or a memory leak will occur. */ +OPENSSL_EXPORT void pqueue_free(pqueue pq); + + +/* Creating and freeing items. */ + +/* pitem_new allocates a fresh priority queue item that points at |data| and + * has a priority given by |prio64be|, which is a 64-bit, unsigned number + * expressed in big-endian form. It returns the fresh item, or NULL on + * error. */ +OPENSSL_EXPORT pitem *pitem_new(uint8_t prio64be[8], void *data); + +/* pitem_free frees |item|, but not any data that it points to. */ +OPENSSL_EXPORT void pitem_free(pitem *item); + + +/* Queue accessor functions */ + +/* pqueue_peek returns the item with the smallest priority from |pq|, or NULL + * if empty. */ +OPENSSL_EXPORT pitem *pqueue_peek(pqueue pq); + +/* pqueue_find returns the item whose priority matches |prio64be| or NULL if no + * such item exists. */ +OPENSSL_EXPORT pitem *pqueue_find(pqueue pq, uint8_t *prio64be); + + +/* Queue mutation functions */ + +/* pqueue_insert inserts |item| into |pq| and returns item. */ +OPENSSL_EXPORT pitem *pqueue_insert(pqueue pq, pitem *item); + +/* pqueue_pop takes the item with the least priority from |pq| and returns it, + * or NULL if |pq| is empty. */ +OPENSSL_EXPORT pitem *pqueue_pop(pqueue pq); + +/* pqueue_size returns the number of items in |pq|. */ +OPENSSL_EXPORT size_t pqueue_size(pqueue pq); + + +/* Iterating */ + +/* pqueue_iterator returns an iterator that can be used to iterate over the + * contents of the queue. */ +OPENSSL_EXPORT piterator pqueue_iterator(pqueue pq); + +/* pqueue_next returns the current value of |iter| and advances it to the next + * position. If the iterator has advanced over all the elements, it returns + * NULL. */ +OPENSSL_EXPORT pitem *pqueue_next(piterator *iter); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_PQUEUE_H */ diff --git a/phonelibs/boringssl/include/openssl/rand.h b/phonelibs/boringssl/include/openssl/rand.h new file mode 100644 index 00000000000000..300bf422877c6a --- /dev/null +++ b/phonelibs/boringssl/include/openssl/rand.h @@ -0,0 +1,61 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_RAND_H +#define OPENSSL_HEADER_RAND_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Random number generation. */ + + +/* RAND_bytes writes |len| bytes of random data to |buf| and returns one. */ +OPENSSL_EXPORT int RAND_bytes(uint8_t *buf, size_t len); + +/* RAND_cleanup frees any resources used by the RNG. This is not safe if other + * threads might still be calling |RAND_bytes|. */ +OPENSSL_EXPORT void RAND_cleanup(void); + + +/* Deprecated functions */ + +/* RAND_pseudo_bytes is a wrapper around |RAND_bytes|. */ +OPENSSL_EXPORT int RAND_pseudo_bytes(uint8_t *buf, size_t len); + +/* RAND_seed does nothing. */ +OPENSSL_EXPORT void RAND_seed(const void *buf, int num); + +/* RAND_load_file returns a nonnegative number. */ +OPENSSL_EXPORT int RAND_load_file(const char *path, long num); + +/* RAND_add does nothing. */ +OPENSSL_EXPORT void RAND_add(const void *buf, int num, double entropy); + +/* RAND_poll returns one. */ +OPENSSL_EXPORT int RAND_poll(void); + +/* RAND_status returns one. */ +OPENSSL_EXPORT int RAND_status(void); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_RAND_H */ diff --git a/phonelibs/boringssl/include/openssl/rc4.h b/phonelibs/boringssl/include/openssl/rc4.h new file mode 100644 index 00000000000000..0619cac35507fc --- /dev/null +++ b/phonelibs/boringssl/include/openssl/rc4.h @@ -0,0 +1,90 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_RC4_H +#define OPENSSL_HEADER_RC4_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* RC4. */ + + +struct rc4_key_st { + uint32_t x, y; + uint32_t data[256]; +} /* RC4_KEY */; + +/* RC4_set_key performs an RC4 key schedule and initialises |rc4key| with |len| + * bytes of key material from |key|. */ +OPENSSL_EXPORT void RC4_set_key(RC4_KEY *rc4key, unsigned len, + const uint8_t *key); + +/* RC4 encrypts (or decrypts, it's the same with RC4) |len| bytes from |in| to + * |out|. */ +OPENSSL_EXPORT void RC4(RC4_KEY *key, size_t len, const uint8_t *in, + uint8_t *out); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_RC4_H */ diff --git a/phonelibs/boringssl/include/openssl/rsa.h b/phonelibs/boringssl/include/openssl/rsa.h new file mode 100644 index 00000000000000..9b415d75e1b141 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/rsa.h @@ -0,0 +1,575 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_RSA_H +#define OPENSSL_HEADER_RSA_H + +#include + +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* rsa.h contains functions for handling encryption and signature using RSA. */ + + +/* Allocation and destruction. */ + +/* RSA_new returns a new, empty RSA object or NULL on error. */ +OPENSSL_EXPORT RSA *RSA_new(void); + +/* RSA_new_method acts the same as |RSA_new| but takes an explicit |ENGINE|. */ +OPENSSL_EXPORT RSA *RSA_new_method(const ENGINE *engine); + +/* RSA_free decrements the reference count of |rsa| and frees it if the + * reference count drops to zero. */ +OPENSSL_EXPORT void RSA_free(RSA *rsa); + +/* RSA_up_ref increments the reference count of |rsa|. */ +OPENSSL_EXPORT int RSA_up_ref(RSA *rsa); + + +/* Key generation. */ + +/* RSA_generate_key_ex generates a new RSA key where the modulus has size + * |bits| and the public exponent is |e|. If unsure, |RSA_F4| is a good value + * for |e|. If |cb| is not NULL then it is called during the key generation + * process. In addition to the calls documented for |BN_generate_prime_ex|, it + * is called with event=2 when the n'th prime is rejected as unsuitable and + * with event=3 when a suitable value for |p| is found. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, + BN_GENCB *cb); + + +/* Encryption / Decryption */ + +/* Padding types for encryption. */ +#define RSA_PKCS1_PADDING 1 +#define RSA_NO_PADDING 3 +#define RSA_PKCS1_OAEP_PADDING 4 +/* RSA_PKCS1_PSS_PADDING can only be used via the EVP interface. */ +#define RSA_PKCS1_PSS_PADDING 6 + +/* RSA_encrypt encrypts |in_len| bytes from |in| to the public key from |rsa| + * and writes, at most, |max_out| bytes of encrypted data to |out|. The + * |max_out| argument must be, at least, |RSA_size| in order to ensure success. + * + * It returns 1 on success or zero on error. + * + * The |padding| argument must be one of the |RSA_*_PADDING| values. If in + * doubt, |RSA_PKCS1_PADDING| is the most common but |RSA_PKCS1_OAEP_PADDING| + * is the most secure. */ +OPENSSL_EXPORT int RSA_encrypt(RSA *rsa, size_t *out_len, uint8_t *out, + size_t max_out, const uint8_t *in, size_t in_len, + int padding); + +/* RSA_decrypt decrypts |in_len| bytes from |in| with the private key from + * |rsa| and writes, at most, |max_out| bytes of plaintext to |out|. The + * |max_out| argument must be, at least, |RSA_size| in order to ensure success. + * + * It returns 1 on success or zero on error. + * + * The |padding| argument must be one of the |RSA_*_PADDING| values. If in + * doubt, |RSA_PKCS1_PADDING| is the most common but |RSA_PKCS1_OAEP_PADDING| + * is the most secure. */ +OPENSSL_EXPORT int RSA_decrypt(RSA *rsa, size_t *out_len, uint8_t *out, + size_t max_out, const uint8_t *in, size_t in_len, + int padding); + +/* RSA_public_encrypt encrypts |flen| bytes from |from| to the public key in + * |rsa| and writes the encrypted data to |to|. The |to| buffer must have at + * least |RSA_size| bytes of space. It returns the number of bytes written, or + * -1 on error. The |padding| argument must be one of the |RSA_*_PADDING| + * values. If in doubt, |RSA_PKCS1_PADDING| is the most common but + * |RSA_PKCS1_OAEP_PADDING| is the most secure. + * + * WARNING: this function is dangerous because it breaks the usual return value + * convention. Use |RSA_encrypt| instead. */ +OPENSSL_EXPORT int RSA_public_encrypt(int flen, const uint8_t *from, + uint8_t *to, RSA *rsa, int padding); + +/* RSA_private_decrypt decrypts |flen| bytes from |from| with the public key in + * |rsa| and writes the plaintext to |to|. The |to| buffer must have at + * least |RSA_size| bytes of space. It returns the number of bytes written, or + * -1 on error. The |padding| argument must be one of the |RSA_*_PADDING| + * values. If in doubt, |RSA_PKCS1_PADDING| is the most common but + * |RSA_PKCS1_OAEP_PADDING| is the most secure. + * + * WARNING: this function is dangerous because it breaks the usual return value + * convention. Use |RSA_decrypt| instead. */ +OPENSSL_EXPORT int RSA_private_decrypt(int flen, const uint8_t *from, + uint8_t *to, RSA *rsa, int padding); + +/* RSA_message_index_PKCS1_type_2 performs the first step of a PKCS #1 padding + * check for decryption. If the |from_len| bytes pointed to at |from| are a + * valid PKCS #1 message, it returns one and sets |*out_index| to the start of + * the unpadded message. The unpadded message is a suffix of the input and has + * length |from_len - *out_index|. Otherwise, it returns zero and sets + * |*out_index| to zero. This function runs in time independent of the input + * data and is intended to be used directly to avoid Bleichenbacher's attack. + * + * WARNING: This function behaves differently from the usual OpenSSL convention + * in that it does NOT put an error on the queue in the error case. */ +OPENSSL_EXPORT int RSA_message_index_PKCS1_type_2(const uint8_t *from, + size_t from_len, + size_t *out_index); + + +/* Signing / Verification */ + +/* RSA_sign signs |in_len| bytes of digest from |in| with |rsa| and writes, at + * most, |RSA_size(rsa)| bytes to |out|. On successful return, the actual + * number of bytes written is written to |*out_len|. + * + * The |hash_nid| argument identifies the hash function used to calculate |in| + * and is embedded in the resulting signature. For example, it might be + * |NID_sha256|. + * + * It returns 1 on success and zero on error. */ +OPENSSL_EXPORT int RSA_sign(int hash_nid, const uint8_t *in, + unsigned int in_len, uint8_t *out, + unsigned int *out_len, RSA *rsa); + +/* RSA_sign_raw signs |in_len| bytes from |in| with the public key from |rsa| + * and writes, at most, |max_out| bytes of signature data to |out|. The + * |max_out| argument must be, at least, |RSA_size| in order to ensure success. + * + * It returns 1 on success or zero on error. + * + * The |padding| argument must be one of the |RSA_*_PADDING| values. If in + * doubt, |RSA_PKCS1_PADDING| is the most common. */ +OPENSSL_EXPORT int RSA_sign_raw(RSA *rsa, size_t *out_len, uint8_t *out, + size_t max_out, const uint8_t *in, + size_t in_len, int padding); + +/* RSA_verify verifies that |sig_len| bytes from |sig| are a valid, PKCS#1 + * signature of |msg_len| bytes at |msg| by |rsa|. + * + * The |hash_nid| argument identifies the hash function used to calculate |in| + * and is embedded in the resulting signature in order to prevent hash + * confusion attacks. For example, it might be |NID_sha256|. + * + * It returns one if the signature is valid and zero otherwise. + * + * WARNING: this differs from the original, OpenSSL function which additionally + * returned -1 on error. */ +OPENSSL_EXPORT int RSA_verify(int hash_nid, const uint8_t *msg, size_t msg_len, + const uint8_t *sig, size_t sig_len, RSA *rsa); + +/* RSA_verify_raw verifies |in_len| bytes of signature from |in| using the + * public key from |rsa| and writes, at most, |max_out| bytes of plaintext to + * |out|. The |max_out| argument must be, at least, |RSA_size| in order to + * ensure success. + * + * It returns 1 on success or zero on error. + * + * The |padding| argument must be one of the |RSA_*_PADDING| values. If in + * doubt, |RSA_PKCS1_PADDING| is the most common. */ +OPENSSL_EXPORT int RSA_verify_raw(RSA *rsa, size_t *out_len, uint8_t *out, + size_t max_out, const uint8_t *in, + size_t in_len, int padding); + +/* RSA_private_encrypt encrypts |flen| bytes from |from| with the private key in + * |rsa| and writes the encrypted data to |to|. The |to| buffer must have at + * least |RSA_size| bytes of space. It returns the number of bytes written, or + * -1 on error. The |padding| argument must be one of the |RSA_*_PADDING| + * values. If in doubt, |RSA_PKCS1_PADDING| is the most common. + * + * WARNING: this function is dangerous because it breaks the usual return value + * convention. Use |RSA_sign_raw| instead. */ +OPENSSL_EXPORT int RSA_private_encrypt(int flen, const uint8_t *from, + uint8_t *to, RSA *rsa, int padding); + +/* RSA_private_encrypt verifies |flen| bytes of signature from |from| using the + * public key in |rsa| and writes the plaintext to |to|. The |to| buffer must + * have at least |RSA_size| bytes of space. It returns the number of bytes + * written, or -1 on error. The |padding| argument must be one of the + * |RSA_*_PADDING| values. If in doubt, |RSA_PKCS1_PADDING| is the most common. + * + * WARNING: this function is dangerous because it breaks the usual return value + * convention. Use |RSA_verify_raw| instead. */ +OPENSSL_EXPORT int RSA_public_decrypt(int flen, const uint8_t *from, + uint8_t *to, RSA *rsa, int padding); + + +/* Utility functions. */ + +/* RSA_size returns the number of bytes in the modulus, which is also the size + * of a signature or encrypted value using |rsa|. */ +OPENSSL_EXPORT unsigned RSA_size(const RSA *rsa); + +/* RSA_is_opaque returns one if |rsa| is opaque and doesn't expose its key + * material. Otherwise it returns zero. */ +OPENSSL_EXPORT int RSA_is_opaque(const RSA *rsa); + +/* RSA_supports_digest returns one if |rsa| supports signing digests + * of type |md|. Otherwise it returns zero. */ +OPENSSL_EXPORT int RSA_supports_digest(const RSA *rsa, const EVP_MD *md); + +/* RSAPublicKey_dup allocates a fresh |RSA| and copies the private key from + * |rsa| into it. It returns the fresh |RSA| object, or NULL on error. */ +OPENSSL_EXPORT RSA *RSAPublicKey_dup(const RSA *rsa); + +/* RSAPrivateKey_dup allocates a fresh |RSA| and copies the private key from + * |rsa| into it. It returns the fresh |RSA| object, or NULL on error. */ +OPENSSL_EXPORT RSA *RSAPrivateKey_dup(const RSA *rsa); + +/* RSA_check_key performs basic validatity tests on |rsa|. It returns one if + * they pass and zero otherwise. Opaque keys and public keys always pass. If it + * returns zero then a more detailed error is available on the error queue. */ +OPENSSL_EXPORT int RSA_check_key(const RSA *rsa); + +/* RSA_recover_crt_params uses |rsa->n|, |rsa->d| and |rsa->e| in order to + * calculate the two primes used and thus the precomputed, CRT values. These + * values are set in the |p|, |q|, |dmp1|, |dmq1| and |iqmp| members of |rsa|, + * which must be |NULL| on entry. It returns one on success and zero + * otherwise. */ +OPENSSL_EXPORT int RSA_recover_crt_params(RSA *rsa); + +/* RSA_verify_PKCS1_PSS_mgf1 verifies that |EM| is a correct PSS padding of + * |mHash|, where |mHash| is a digest produced by |Hash|. |EM| must point to + * exactly |RSA_size(rsa)| bytes of data. The |mgf1Hash| argument specifies the + * hash function for generating the mask. If NULL, |Hash| is used. The |sLen| + * argument specifies the expected salt length in bytes. If |sLen| is -1 then + * the salt length is the same as the hash length. If -2, then the salt length + * is maximal and is taken from the size of |EM|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const uint8_t *mHash, + const EVP_MD *Hash, + const EVP_MD *mgf1Hash, + const uint8_t *EM, int sLen); + +/* RSA_padding_add_PKCS1_PSS_mgf1 writes a PSS padding of |mHash| to |EM|, + * where |mHash| is a digest produced by |Hash|. |RSA_size(rsa)| bytes of + * output will be written to |EM|. The |mgf1Hash| argument specifies the hash + * function for generating the mask. If NULL, |Hash| is used. The |sLen| + * argument specifies the expected salt length in bytes. If |sLen| is -1 then + * the salt length is the same as the hash length. If -2, then the salt length + * is maximal given the space in |EM|. + * + * It returns one on success or zero on error. */ +OPENSSL_EXPORT int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, uint8_t *EM, + const uint8_t *mHash, + const EVP_MD *Hash, + const EVP_MD *mgf1Hash, + int sLen); + + +/* ASN.1 functions. */ + +/* d2i_RSAPublicKey parses an ASN.1, DER-encoded, RSA public key from |len| + * bytes at |*inp|. If |out| is not NULL then, on exit, a pointer to the result + * is in |*out|. If |*out| is already non-NULL on entry then the result is + * written directly into |*out|, otherwise a fresh |RSA| is allocated. On + * successful exit, |*inp| is advanced past the DER structure. It returns the + * result or NULL on error. */ +OPENSSL_EXPORT RSA *d2i_RSAPublicKey(RSA **out, const uint8_t **inp, long len); + +/* i2d_RSAPublicKey marshals |in| to an ASN.1, DER structure. If |outp| is not + * NULL then the result is written to |*outp| and |*outp| is advanced just past + * the output. It returns the number of bytes in the result, whether written or + * not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_RSAPublicKey(const RSA *in, uint8_t **outp); + +/* d2i_RSAPrivateKey parses an ASN.1, DER-encoded, RSA private key from |len| + * bytes at |*inp|. If |out| is not NULL then, on exit, a pointer to the result + * is in |*out|. If |*out| is already non-NULL on entry then the result is + * written directly into |*out|, otherwise a fresh |RSA| is allocated. On + * successful exit, |*inp| is advanced past the DER structure. It returns the + * result or NULL on error. */ +OPENSSL_EXPORT RSA *d2i_RSAPrivateKey(RSA **out, const uint8_t **inp, long len); + +/* i2d_RSAPrivateKey marshals |in| to an ASN.1, DER structure. If |outp| is not + * NULL then the result is written to |*outp| and |*outp| is advanced just past + * the output. It returns the number of bytes in the result, whether written or + * not, or a negative value on error. */ +OPENSSL_EXPORT int i2d_RSAPrivateKey(const RSA *in, uint8_t **outp); + + +/* ex_data functions. + * + * See |ex_data.h| for details. */ + +OPENSSL_EXPORT int RSA_get_ex_new_index(long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +OPENSSL_EXPORT int RSA_set_ex_data(RSA *r, int idx, void *arg); +OPENSSL_EXPORT void *RSA_get_ex_data(const RSA *r, int idx); + +/* RSA_FLAG_OPAQUE specifies that this RSA_METHOD does not expose its key + * material. This may be set if, for instance, it is wrapping some other crypto + * API, like a platform key store. */ +#define RSA_FLAG_OPAQUE 1 + +/* RSA_FLAG_CACHE_PUBLIC causes a precomputed Montgomery context to be created, + * on demand, for the public key operations. */ +#define RSA_FLAG_CACHE_PUBLIC 2 + +/* RSA_FLAG_CACHE_PRIVATE causes a precomputed Montgomery context to be + * created, on demand, for the private key operations. */ +#define RSA_FLAG_CACHE_PRIVATE 4 + +/* RSA_FLAG_NO_BLINDING disables blinding of private operations. */ +#define RSA_FLAG_NO_BLINDING 8 + +/* RSA_FLAG_EXT_PKEY means that private key operations will be handled by + * |mod_exp| and that they do not depend on the private key components being + * present: for example a key stored in external hardware. */ +#define RSA_FLAG_EXT_PKEY 0x20 + +/* RSA_FLAG_SIGN_VER causes the |sign| and |verify| functions of |rsa_meth_st| + * to be called when set. */ +#define RSA_FLAG_SIGN_VER 0x40 + + +/* RSA public exponent values. */ + +#define RSA_3 0x3 +#define RSA_F4 0x10001 + + +/* Deprecated functions. */ + +/* RSA_blinding_on returns one. */ +OPENSSL_EXPORT int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); + + +struct rsa_meth_st { + struct openssl_method_common_st common; + + void *app_data; + + int (*init)(RSA *rsa); + int (*finish)(RSA *rsa); + + /* size returns the size of the RSA modulus in bytes. */ + size_t (*size)(const RSA *rsa); + + int (*sign)(int type, const uint8_t *m, unsigned int m_length, + uint8_t *sigret, unsigned int *siglen, const RSA *rsa); + + int (*verify)(int dtype, const uint8_t *m, unsigned int m_length, + const uint8_t *sigbuf, unsigned int siglen, const RSA *rsa); + + + /* These functions mirror the |RSA_*| functions of the same name. */ + int (*encrypt)(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, + const uint8_t *in, size_t in_len, int padding); + int (*sign_raw)(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, + const uint8_t *in, size_t in_len, int padding); + + int (*decrypt)(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, + const uint8_t *in, size_t in_len, int padding); + int (*verify_raw)(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, + const uint8_t *in, size_t in_len, int padding); + + /* private_transform takes a big-endian integer from |in|, calculates the + * d'th power of it, modulo the RSA modulus and writes the result as a + * big-endian integer to |out|. Both |in| and |out| are |len| bytes long and + * |len| is always equal to |RSA_size(rsa)|. If the result of the transform + * can be represented in fewer than |len| bytes, then |out| must be zero + * padded on the left. + * + * It returns one on success and zero otherwise. + * + * RSA decrypt and sign operations will call this, thus an ENGINE might wish + * to override it in order to avoid having to implement the padding + * functionality demanded by those, higher level, operations. */ + int (*private_transform)(RSA *rsa, uint8_t *out, const uint8_t *in, + size_t len); + + int (*mod_exp)(BIGNUM *r0, const BIGNUM *I, RSA *rsa, + BN_CTX *ctx); /* Can be null */ + int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); + + int flags; + + int (*keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); + + /* supports_digest returns one if |rsa| supports digests of type + * |md|. If null, it is assumed that all digests are supported. */ + int (*supports_digest)(const RSA *rsa, const EVP_MD *md); +}; + + +/* Private functions. */ + +typedef struct bn_blinding_st BN_BLINDING; + +struct rsa_st { + /* version is only used during ASN.1 (de)serialisation. */ + long version; + RSA_METHOD *meth; + + BIGNUM *n; + BIGNUM *e; + BIGNUM *d; + BIGNUM *p; + BIGNUM *q; + BIGNUM *dmp1; + BIGNUM *dmq1; + BIGNUM *iqmp; + /* be careful using this if the RSA structure is shared */ + CRYPTO_EX_DATA ex_data; + CRYPTO_refcount_t references; + int flags; + + CRYPTO_MUTEX lock; + + /* Used to cache montgomery values. The creation of these values is protected + * by |lock|. */ + BN_MONT_CTX *_method_mod_n; + BN_MONT_CTX *_method_mod_p; + BN_MONT_CTX *_method_mod_q; + + /* num_blindings contains the size of the |blindings| and |blindings_inuse| + * arrays. This member and the |blindings_inuse| array are protected by + * |lock|. */ + unsigned num_blindings; + /* blindings is an array of BN_BLINDING structures that can be reserved by a + * thread by locking |lock| and changing the corresponding element in + * |blindings_inuse| from 0 to 1. */ + BN_BLINDING **blindings; + unsigned char *blindings_inuse; +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#define RSA_F_BN_BLINDING_convert_ex 100 +#define RSA_F_BN_BLINDING_create_param 101 +#define RSA_F_BN_BLINDING_invert_ex 102 +#define RSA_F_BN_BLINDING_new 103 +#define RSA_F_BN_BLINDING_update 104 +#define RSA_F_RSA_check_key 105 +#define RSA_F_RSA_new_method 106 +#define RSA_F_RSA_padding_add_PKCS1_OAEP_mgf1 107 +#define RSA_F_RSA_padding_add_PKCS1_PSS_mgf1 108 +#define RSA_F_RSA_padding_add_PKCS1_type_1 109 +#define RSA_F_RSA_padding_add_PKCS1_type_2 110 +#define RSA_F_RSA_padding_add_none 111 +#define RSA_F_RSA_padding_check_PKCS1_OAEP_mgf1 112 +#define RSA_F_RSA_padding_check_PKCS1_type_1 113 +#define RSA_F_RSA_padding_check_PKCS1_type_2 114 +#define RSA_F_RSA_padding_check_none 115 +#define RSA_F_RSA_recover_crt_params 116 +#define RSA_F_RSA_sign 117 +#define RSA_F_RSA_verify 118 +#define RSA_F_RSA_verify_PKCS1_PSS_mgf1 119 +#define RSA_F_decrypt 120 +#define RSA_F_encrypt 121 +#define RSA_F_keygen 122 +#define RSA_F_pkcs1_prefixed_msg 123 +#define RSA_F_private_transform 124 +#define RSA_F_rsa_setup_blinding 125 +#define RSA_F_sign_raw 126 +#define RSA_F_verify_raw 127 +#define RSA_R_BAD_E_VALUE 100 +#define RSA_R_BAD_FIXED_HEADER_DECRYPT 101 +#define RSA_R_BAD_PAD_BYTE_COUNT 102 +#define RSA_R_BAD_RSA_PARAMETERS 103 +#define RSA_R_BAD_SIGNATURE 104 +#define RSA_R_BLOCK_TYPE_IS_NOT_01 105 +#define RSA_R_BN_NOT_INITIALIZED 106 +#define RSA_R_CRT_PARAMS_ALREADY_GIVEN 107 +#define RSA_R_CRT_VALUES_INCORRECT 108 +#define RSA_R_DATA_LEN_NOT_EQUAL_TO_MOD_LEN 109 +#define RSA_R_DATA_TOO_LARGE 110 +#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 111 +#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 112 +#define RSA_R_DATA_TOO_SMALL 113 +#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 114 +#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 115 +#define RSA_R_D_E_NOT_CONGRUENT_TO_1 116 +#define RSA_R_EMPTY_PUBLIC_KEY 117 +#define RSA_R_FIRST_OCTET_INVALID 118 +#define RSA_R_INCONSISTENT_SET_OF_CRT_VALUES 119 +#define RSA_R_INTERNAL_ERROR 120 +#define RSA_R_INVALID_MESSAGE_LENGTH 121 +#define RSA_R_KEY_SIZE_TOO_SMALL 122 +#define RSA_R_LAST_OCTET_INVALID 123 +#define RSA_R_MODULUS_TOO_LARGE 124 +#define RSA_R_NO_PUBLIC_EXPONENT 125 +#define RSA_R_NULL_BEFORE_BLOCK_MISSING 126 +#define RSA_R_N_NOT_EQUAL_P_Q 127 +#define RSA_R_OAEP_DECODING_ERROR 128 +#define RSA_R_ONLY_ONE_OF_P_Q_GIVEN 129 +#define RSA_R_OUTPUT_BUFFER_TOO_SMALL 130 +#define RSA_R_PADDING_CHECK_FAILED 131 +#define RSA_R_PKCS_DECODING_ERROR 132 +#define RSA_R_SLEN_CHECK_FAILED 133 +#define RSA_R_SLEN_RECOVERY_FAILED 134 +#define RSA_R_TOO_LONG 135 +#define RSA_R_TOO_MANY_ITERATIONS 136 +#define RSA_R_UNKNOWN_ALGORITHM_TYPE 137 +#define RSA_R_UNKNOWN_PADDING_TYPE 138 +#define RSA_R_VALUE_MISSING 139 +#define RSA_R_WRONG_SIGNATURE_LENGTH 140 + +#endif /* OPENSSL_HEADER_RSA_H */ diff --git a/phonelibs/boringssl/include/openssl/safestack.h b/phonelibs/boringssl/include/openssl/safestack.h new file mode 100644 index 00000000000000..6e5e433074f867 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/safestack.h @@ -0,0 +1,16 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* This header is provided in order to make compiling against code that expects + OpenSSL easier. */ diff --git a/phonelibs/boringssl/include/openssl/sha.h b/phonelibs/boringssl/include/openssl/sha.h new file mode 100644 index 00000000000000..ac2ab758b41a85 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/sha.h @@ -0,0 +1,241 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_SHA_H +#define OPENSSL_HEADER_SHA_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* The SHA family of hash functions (SHA-1 and SHA-2). */ + + +/* SHA_CBLOCK is the block size of SHA-1. */ +#define SHA_CBLOCK 64 + +/* SHA_DIGEST_LENGTH is the length of a SHA-1 digest. */ +#define SHA_DIGEST_LENGTH 20 + +/* TODO(fork): remove */ +#define SHA_LBLOCK 16 +#define SHA_LONG uint32_t + +/* SHA1_Init initialises |sha| and returns one. */ +OPENSSL_EXPORT int SHA1_Init(SHA_CTX *sha); + +/* SHA1_Update adds |len| bytes from |data| to |sha| and returns one. */ +OPENSSL_EXPORT int SHA1_Update(SHA_CTX *sha, const void *data, size_t len); + +/* SHA1_Final adds the final padding to |sha| and writes the resulting digest + * to |md|, which must have at least |SHA_DIGEST_LENGTH| bytes of space. It + * returns one. */ +OPENSSL_EXPORT int SHA1_Final(uint8_t *md, SHA_CTX *sha); + +/* SHA1 writes the digest of |len| bytes from |data| to |out| and returns + * |out|. There must be at least |SHA_DIGEST_LENGTH| bytes of space in + * |out|. */ +OPENSSL_EXPORT uint8_t *SHA1(const uint8_t *data, size_t len, uint8_t *out); + +/* SHA1_Transform is a low-level function that performs a single, SHA-1 block + * transformation using the state from |sha| and 64 bytes from |block|. */ +OPENSSL_EXPORT void SHA1_Transform(SHA_CTX *sha, const uint8_t *block); + +struct sha_state_st { + uint32_t h0, h1, h2, h3, h4; + uint32_t Nl, Nh; + uint32_t data[16]; + unsigned int num; +}; + + +/* SHA-224. */ + +/* SHA224_CBLOCK is the block size of SHA-224. */ +#define SHA224_CBLOCK 64 + +/* SHA224_DIGEST_LENGTH is the length of a SHA-224 digest. */ +#define SHA224_DIGEST_LENGTH 28 + +/* SHA224_Init initialises |sha| and returns 1. */ +OPENSSL_EXPORT int SHA224_Init(SHA256_CTX *sha); + +/* SHA224_Update adds |len| bytes from |data| to |sha| and returns 1. */ +OPENSSL_EXPORT int SHA224_Update(SHA256_CTX *sha, const void *data, size_t len); + +/* SHA224_Final adds the final padding to |sha| and writes the resulting digest + * to |md|, which must have at least |SHA224_DIGEST_LENGTH| bytes of space. It + * returns one on success and zero on programmer error. */ +OPENSSL_EXPORT int SHA224_Final(uint8_t *md, SHA256_CTX *sha); + +/* SHA224 writes the digest of |len| bytes from |data| to |out| and returns + * |out|. There must be at least |SHA224_DIGEST_LENGTH| bytes of space in + * |out|. */ +OPENSSL_EXPORT uint8_t *SHA224(const uint8_t *data, size_t len, uint8_t *out); + + +/* SHA-256. */ + +/* SHA256_CBLOCK is the block size of SHA-256. */ +#define SHA256_CBLOCK 64 + +/* SHA256_DIGEST_LENGTH is the length of a SHA-256 digest. */ +#define SHA256_DIGEST_LENGTH 32 + +/* SHA256_Init initialises |sha| and returns 1. */ +OPENSSL_EXPORT int SHA256_Init(SHA256_CTX *sha); + +/* SHA256_Update adds |len| bytes from |data| to |sha| and returns 1. */ +OPENSSL_EXPORT int SHA256_Update(SHA256_CTX *sha, const void *data, size_t len); + +/* SHA256_Final adds the final padding to |sha| and writes the resulting digest + * to |md|, which must have at least |SHA256_DIGEST_LENGTH| bytes of space. It + * returns one on success and zero on programmer error. */ +OPENSSL_EXPORT int SHA256_Final(uint8_t *md, SHA256_CTX *sha); + +/* SHA256 writes the digest of |len| bytes from |data| to |out| and returns + * |out|. There must be at least |SHA256_DIGEST_LENGTH| bytes of space in + * |out|. */ +OPENSSL_EXPORT uint8_t *SHA256(const uint8_t *data, size_t len, uint8_t *out); + +/* SHA256_Transform is a low-level function that performs a single, SHA-1 block + * transformation using the state from |sha| and 64 bytes from |block|. */ +OPENSSL_EXPORT void SHA256_Transform(SHA256_CTX *sha, const uint8_t *data); + +struct sha256_state_st { + uint32_t h[8]; + uint32_t Nl, Nh; + uint32_t data[16]; + unsigned int num, md_len; +}; + + +/* SHA-384. */ + +/* SHA384_CBLOCK is the block size of SHA-384. */ +#define SHA384_CBLOCK 128 + +/* SHA384_DIGEST_LENGTH is the length of a SHA-384 digest. */ +#define SHA384_DIGEST_LENGTH 48 + +/* SHA384_Init initialises |sha| and returns 1. */ +OPENSSL_EXPORT int SHA384_Init(SHA512_CTX *sha); + +/* SHA384_Update adds |len| bytes from |data| to |sha| and returns 1. */ +OPENSSL_EXPORT int SHA384_Update(SHA512_CTX *sha, const void *data, size_t len); + +/* SHA384_Final adds the final padding to |sha| and writes the resulting digest + * to |md|, which must have at least |SHA384_DIGEST_LENGTH| bytes of space. It + * returns one on success and zero on programmer error. */ +OPENSSL_EXPORT int SHA384_Final(uint8_t *md, SHA512_CTX *sha); + +/* SHA384 writes the digest of |len| bytes from |data| to |out| and returns + * |out|. There must be at least |SHA384_DIGEST_LENGTH| bytes of space in + * |out|. */ +OPENSSL_EXPORT uint8_t *SHA384(const uint8_t *data, size_t len, uint8_t *out); + +/* SHA384_Transform is a low-level function that performs a single, SHA-1 block + * transformation using the state from |sha| and 64 bytes from |block|. */ +OPENSSL_EXPORT void SHA384_Transform(SHA512_CTX *sha, const uint8_t *data); + + +/* SHA-512. */ + +/* SHA512_CBLOCK is the block size of SHA-512. */ +#define SHA512_CBLOCK 128 + +/* SHA512_DIGEST_LENGTH is the length of a SHA-512 digest. */ +#define SHA512_DIGEST_LENGTH 64 + +/* SHA512_Init initialises |sha| and returns 1. */ +OPENSSL_EXPORT int SHA512_Init(SHA512_CTX *sha); + +/* SHA512_Update adds |len| bytes from |data| to |sha| and returns 1. */ +OPENSSL_EXPORT int SHA512_Update(SHA512_CTX *sha, const void *data, size_t len); + +/* SHA512_Final adds the final padding to |sha| and writes the resulting digest + * to |md|, which must have at least |SHA512_DIGEST_LENGTH| bytes of space. It + * returns one on success and zero on programmer error. */ +OPENSSL_EXPORT int SHA512_Final(uint8_t *md, SHA512_CTX *sha); + +/* SHA512 writes the digest of |len| bytes from |data| to |out| and returns + * |out|. There must be at least |SHA512_DIGEST_LENGTH| bytes of space in + * |out|. */ +OPENSSL_EXPORT uint8_t *SHA512(const uint8_t *data, size_t len, uint8_t *out); + +/* SHA512_Transform is a low-level function that performs a single, SHA-1 block + * transformation using the state from |sha| and 64 bytes from |block|. */ +OPENSSL_EXPORT void SHA512_Transform(SHA512_CTX *sha, const uint8_t *data); + +struct sha512_state_st { + uint64_t h[8]; + uint64_t Nl, Nh; + union { + uint64_t d[16]; + uint8_t p[128]; + } u; + unsigned int num, md_len; +}; + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_SHA_H */ diff --git a/phonelibs/boringssl/include/openssl/srtp.h b/phonelibs/boringssl/include/openssl/srtp.h new file mode 100644 index 00000000000000..3f5a53e2c1e1de --- /dev/null +++ b/phonelibs/boringssl/include/openssl/srtp.h @@ -0,0 +1,178 @@ +/* ssl/tls1.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* + DTLS code by Eric Rescorla + + Copyright (C) 2006, Network Resonance, Inc. + Copyright (C) 2011, RTFM, Inc. +*/ + +#ifndef OPENSSL_HEADER_SRTP_H +#define OPENSSL_HEADER_SRTP_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Constants for SRTP profiles */ +#define SRTP_AES128_CM_SHA1_80 0x0001 +#define SRTP_AES128_CM_SHA1_32 0x0002 +#define SRTP_AES128_F8_SHA1_80 0x0003 +#define SRTP_AES128_F8_SHA1_32 0x0004 +#define SRTP_NULL_SHA1_80 0x0005 +#define SRTP_NULL_SHA1_32 0x0006 + +/* SSL_CTX_set_srtp_profiles enables SRTP for all SSL objects created from + * |ctx|. |profile| contains a colon-separated list of profile names. It returns + * one on success and zero on failure. */ +OPENSSL_EXPORT int SSL_CTX_set_srtp_profiles(SSL_CTX *ctx, + const char *profiles); + +/* SSL_set_srtp_profiles enables SRTP for |ssl|. |profile| contains a + * colon-separated list of profile names. It returns one on success and zero on + * failure. */ +OPENSSL_EXPORT int SSL_set_srtp_profiles(SSL *ctx, const char *profiles); + +/* SSL_get_srtp_profiles returns the SRTP profiles supported by |ssl|. */ +OPENSSL_EXPORT STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles( + SSL *ssl); + +/* SSL_get_selected_srtp_profile returns the selected SRTP profile, or NULL if + * SRTP was not negotiated. */ +OPENSSL_EXPORT const SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile( + SSL *s); + + +/* Deprecated functions */ + +/* SSL_CTX_set_tlsext_use_srtp calls SSL_CTX_set_srtp_profiles. It returns zero + * on success and one on failure. + * + * WARNING: this function is dangerous because it breaks the usual return value + * convention. Use SSL_CTX_set_srtp_profiles instead. */ +OPENSSL_EXPORT int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, + const char *profiles); + +/* SSL_set_tlsext_use_srtp calls SSL_set_srtp_profiles. It returns zero on + * success and one on failure. + * + * WARNING: this function is dangerous because it breaks the usual return value + * convention. Use SSL_set_srtp_profiles instead. */ +OPENSSL_EXPORT int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles); + + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_SRTP_H */ + diff --git a/phonelibs/boringssl/include/openssl/ssl.h b/phonelibs/boringssl/include/openssl/ssl.h new file mode 100644 index 00000000000000..217dbaf2f45173 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ssl.h @@ -0,0 +1,2959 @@ +/* ssl/ssl.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECC cipher suite support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ +/* ==================================================================== + * Copyright 2005 Nokia. All rights reserved. + * + * The portions of the attached software ("Contribution") is developed by + * Nokia Corporation and is licensed pursuant to the OpenSSL open source + * license. + * + * The Contribution, originally written by Mika Kousa and Pasi Eronen of + * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites + * support (see RFC 4279) to OpenSSL. + * + * No patent licenses or other rights except those expressly stated in + * the OpenSSL open source license shall be deemed granted or received + * expressly, by implication, estoppel, or otherwise. + * + * No assurances are provided by Nokia that the Contribution does not + * infringe the patent or other intellectual property rights of any third + * party or that the license provides you with all the necessary rights + * to make use of the Contribution. + * + * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN + * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA + * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY + * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR + * OTHERWISE. + */ + +#ifndef OPENSSL_HEADER_SSL_H +#define OPENSSL_HEADER_SSL_H + +#include + +#include +#include +#include +#include +#include +#include +#include + +#if !defined(OPENSSL_WINDOWS) +#include +#endif + +/* wpa_supplicant expects to get the version functions from ssl.h */ +#include + +/* Forward-declare struct timeval. On Windows, it is defined in winsock2.h and + * Windows headers define too many macros to be included in public headers. + * However, only a forward declaration is needed. */ +struct timeval; + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* SSL implementation. */ + + +/* Initialization. */ + +/* SSL_library_init initializes the crypto and SSL libraries and returns one. */ +OPENSSL_EXPORT int SSL_library_init(void); + + +/* Cipher suites. */ + +/* An SSL_CIPHER represents a cipher suite. */ +typedef struct ssl_cipher_st { + /* name is the OpenSSL name for the cipher. */ + const char *name; + /* id is the cipher suite value bitwise OR-d with 0x03000000. */ + uint32_t id; + + /* The following are internal fields. See ssl/internal.h for their values. */ + + uint32_t algorithm_mkey; + uint32_t algorithm_auth; + uint32_t algorithm_enc; + uint32_t algorithm_mac; + uint32_t algorithm_ssl; + uint32_t algo_strength; + + /* algorithm2 contains extra flags. See ssl/internal.h. */ + uint32_t algorithm2; + + /* strength_bits is the strength of the cipher in bits. */ + int strength_bits; + /* alg_bits is the number of bits of key material used by the algorithm. */ + int alg_bits; +} SSL_CIPHER; + +DECLARE_STACK_OF(SSL_CIPHER) + +/* SSL_get_cipher_by_value returns the structure representing a TLS cipher + * suite based on its assigned number, or NULL if unknown. See + * https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4. */ +OPENSSL_EXPORT const SSL_CIPHER *SSL_get_cipher_by_value(uint16_t value); + +/* SSL_CIPHER_get_id returns |cipher|'s id. It may be cast to a |uint16_t| to + * get the cipher suite value. */ +OPENSSL_EXPORT uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *cipher); + +/* SSL_CIPHER_is_AES returns one if |cipher| uses AES (either GCM or CBC + * mode). */ +OPENSSL_EXPORT int SSL_CIPHER_is_AES(const SSL_CIPHER *cipher); + +/* SSL_CIPHER_has_MD5_HMAC returns one if |cipher| uses HMAC-MD5. */ +OPENSSL_EXPORT int SSL_CIPHER_has_MD5_HMAC(const SSL_CIPHER *cipher); + +/* SSL_CIPHER_is_AESGCM returns one if |cipher| uses AES-GCM. */ +OPENSSL_EXPORT int SSL_CIPHER_is_AESGCM(const SSL_CIPHER *cipher); + +/* SSL_CIPHER_is_CHACHA20POLY1305 returns one if |cipher| uses + * CHACHA20_POLY1305. */ +OPENSSL_EXPORT int SSL_CIPHER_is_CHACHA20POLY1305(const SSL_CIPHER *cipher); + +/* SSL_CIPHER_get_name returns the OpenSSL name of |cipher|. */ +OPENSSL_EXPORT const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher); + +/* SSL_CIPHER_get_kx_name returns a string that describes the key-exchange + * method used by |cipher|. For example, "ECDHE_ECDSA". */ +OPENSSL_EXPORT const char *SSL_CIPHER_get_kx_name(const SSL_CIPHER *cipher); + +/* SSL_CIPHER_get_rfc_name returns a newly-allocated string with the standard + * name for |cipher| or NULL on error. For example, + * "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256". The caller is responsible for + * calling |OPENSSL_free| on the result. */ +OPENSSL_EXPORT char *SSL_CIPHER_get_rfc_name(const SSL_CIPHER *cipher); + +/* SSL_CIPHER_get_bits returns the strength, in bits, of |cipher|. If + * |out_alg_bits| is not NULL, it writes the number of bits consumed by the + * symmetric algorithm to |*out_alg_bits|. */ +OPENSSL_EXPORT int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, + int *out_alg_bits); + + +/* SSL contexts. */ + +/* An SSL_METHOD selects whether to use TLS or DTLS. */ +typedef struct ssl_method_st SSL_METHOD; + +/* TLS_method is the |SSL_METHOD| used for TLS (and SSLv3) connections. */ +OPENSSL_EXPORT const SSL_METHOD *TLS_method(void); + +/* DTLS_method is the |SSL_METHOD| used for DTLS connections. */ +OPENSSL_EXPORT const SSL_METHOD *DTLS_method(void); + +/* SSL_CTX_new returns a newly-allocated |SSL_CTX| with default settings or NULL + * on error. An |SSL_CTX| manages shared state and configuration between + * multiple TLS or DTLS connections. */ +OPENSSL_EXPORT SSL_CTX *SSL_CTX_new(const SSL_METHOD *method); + +/* SSL_CTX_free releases memory associated with |ctx|. */ +OPENSSL_EXPORT void SSL_CTX_free(SSL_CTX *ctx); + + +/* SSL connections. */ + +/* SSL_new returns a newly-allocated |SSL| using |ctx| or NULL on error. An + * |SSL| object represents a single TLS or DTLS connection. It inherits settings + * from |ctx| at the time of creation. Settings may also be individually + * configured on the connection. + * + * On creation, an |SSL| is not configured to be either a client or server. Call + * |SSL_set_connect_state| or |SSL_set_accept_state| to set this. */ +OPENSSL_EXPORT SSL *SSL_new(SSL_CTX *ctx); + +/* SSL_free releases memory associated with |ssl|. */ +OPENSSL_EXPORT void SSL_free(SSL *ssl); + +/* SSL_set_connect_state configures |ssl| to be a client. */ +OPENSSL_EXPORT void SSL_set_connect_state(SSL *ssl); + +/* SSL_set_accept_state configures |ssl| to be a server. */ +OPENSSL_EXPORT void SSL_set_accept_state(SSL *ssl); + + +/* Protocol versions. */ + +#define SSL3_VERSION_MAJOR 0x03 + +#define SSL3_VERSION 0x0300 +#define TLS1_VERSION 0x0301 +#define TLS1_1_VERSION 0x0302 +#define TLS1_2_VERSION 0x0303 + +#define DTLS1_VERSION 0xfeff +#define DTLS1_2_VERSION 0xfefd + +/* SSL_CTX_set_min_version sets the minimum protocol version for |ctx| to + * |version|. */ +OPENSSL_EXPORT void SSL_CTX_set_min_version(SSL_CTX *ctx, uint16_t version); + +/* SSL_CTX_set_max_version sets the maximum protocol version for |ctx| to + * |version|. */ +OPENSSL_EXPORT void SSL_CTX_set_max_version(SSL_CTX *ctx, uint16_t version); + +/* SSL_set_min_version sets the minimum protocol version for |ssl| to + * |version|. */ +OPENSSL_EXPORT void SSL_set_min_version(SSL *ssl, uint16_t version); + +/* SSL_set_max_version sets the maximum protocol version for |ssl| to + * |version|. */ +OPENSSL_EXPORT void SSL_set_max_version(SSL *ssl, uint16_t version); + + +/* Options. + * + * Options configure protocol behavior. */ + +/* SSL_OP_LEGACY_SERVER_CONNECT allows initial connections to servers that don't + * support the renegotiation_info extension (RFC 5746). It is on by default. */ +#define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004L + +/* SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER allows for record sizes |SSL3_RT_MAX_EXTRA| + * bytes above the maximum record size. */ +#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L + +/* SSL_OP_TLS_D5_BUG accepts an RSAClientKeyExchange in TLS encoded as in SSL3 + * (i.e. without a length prefix). */ +#define SSL_OP_TLS_D5_BUG 0x00000100L + +/* SSL_OP_ALL enables the above bug workarounds that are enabled by many + * consumers. + * TODO(davidben): Determine which of the remaining may be removed now. */ +#define SSL_OP_ALL 0x00000BFFL + +/* SSL_OP_NO_QUERY_MTU, in DTLS, disables querying the MTU from the underlying + * |BIO|. Instead, the MTU is configured with |SSL_set_mtu|. */ +#define SSL_OP_NO_QUERY_MTU 0x00001000L + +/* SSL_OP_NO_TICKET disables session ticket support (RFC 4507). */ +#define SSL_OP_NO_TICKET 0x00004000L + +/* SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION permits unsafe legacy renegotiation + * without renegotiation_info (RFC 5746) support. */ +#define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000L + +/* SSL_OP_CIPHER_SERVER_PREFERENCE configures servers to select ciphers and + * ECDHE curves according to the server's preferences instead of the + * client's. */ +#define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L + +/* The following flags toggle individual protocol versions. This is deprecated. + * Use |SSL_CTX_set_min_version| and |SSL_CTX_set_max_version| instead. */ +#define SSL_OP_NO_SSLv3 0x02000000L +#define SSL_OP_NO_TLSv1 0x04000000L +#define SSL_OP_NO_TLSv1_2 0x08000000L +#define SSL_OP_NO_TLSv1_1 0x10000000L +#define SSL_OP_NO_DTLSv1 SSL_OP_NO_TLSv1 +#define SSL_OP_NO_DTLSv1_2 SSL_OP_NO_TLSv1_2 + +/* The following flags do nothing and are included only to make it easier to + * compile code with BoringSSL. */ +#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0 +#define SSL_OP_MICROSOFT_SESS_ID_BUG 0 +#define SSL_OP_NETSCAPE_CHALLENGE_BUG 0 +#define SSL_OP_NO_COMPRESSION 0 +#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0 +#define SSL_OP_NO_SSLv2 0 +#define SSL_OP_SINGLE_DH_USE 0 +#define SSL_OP_SINGLE_ECDH_USE 0 +#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0 +#define SSL_OP_TLS_BLOCK_PADDING_BUG 0 +#define SSL_OP_TLS_ROLLBACK_BUG 0 + +/* SSL_CTX_set_options enables all options set in |options| (which should be one + * or more of the |SSL_OP_*| values, ORed together) in |ctx|. It returns a + * bitmask representing the resulting enabled options. */ +OPENSSL_EXPORT uint32_t SSL_CTX_set_options(SSL_CTX *ctx, uint32_t options); + +/* SSL_CTX_clear_options disables all options set in |options| (which should be + * one or more of the |SSL_OP_*| values, ORed together) in |ctx|. It returns a + * bitmask representing the resulting enabled options. */ +OPENSSL_EXPORT uint32_t SSL_CTX_clear_options(SSL_CTX *ctx, uint32_t options); + +/* SSL_CTX_get_options returns a bitmask of |SSL_OP_*| values that represent all + * the options enabled for |ctx|. */ +OPENSSL_EXPORT uint32_t SSL_CTX_get_options(const SSL_CTX *ctx); + +/* SSL_set_options enables all options set in |options| (which should be one or + * more of the |SSL_OP_*| values, ORed together) in |ssl|. It returns a bitmask + * representing the resulting enabled options. */ +OPENSSL_EXPORT uint32_t SSL_set_options(SSL *ssl, uint32_t options); + +/* SSL_clear_options disables all options set in |options| (which should be one + * or more of the |SSL_OP_*| values, ORed together) in |ssl|. It returns a + * bitmask representing the resulting enabled options. */ +OPENSSL_EXPORT uint32_t SSL_clear_options(SSL *ssl, uint32_t options); + +/* SSL_get_options returns a bitmask of |SSL_OP_*| values that represent all the + * options enabled for |ssl|. */ +OPENSSL_EXPORT uint32_t SSL_get_options(const SSL *ssl); + + +/* Modes. + * + * Modes configure API behavior. */ + +/* SSL_MODE_ENABLE_PARTIAL_WRITE allows |SSL_write| to complete with a partial + * result when the only part of the input was written in a single record. */ +#define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001L + +/* SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER allows retrying an incomplete |SSL_write| + * with a different buffer. However, |SSL_write| still assumes the buffer + * contents are unchanged. This is not the default to avoid the misconception + * that non-blocking |SSL_write| behaves like non-blocking |write|. */ +#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L + +/* SSL_MODE_NO_AUTO_CHAIN disables automatically building a certificate chain + * before sending certificates to the peer. + * TODO(davidben): Remove this behavior. https://crbug.com/486295. */ +#define SSL_MODE_NO_AUTO_CHAIN 0x00000008L + +/* SSL_MODE_ENABLE_FALSE_START allows clients to send application data before + * receipt of CCS and Finished. This mode enables full-handshakes to 'complete' + * in one RTT. See draft-bmoeller-tls-falsestart-01. */ +#define SSL_MODE_ENABLE_FALSE_START 0x00000080L + +/* Deprecated: SSL_MODE_HANDSHAKE_CUTTHROUGH is the same as + * SSL_MODE_ENABLE_FALSE_START. */ +#define SSL_MODE_HANDSHAKE_CUTTHROUGH SSL_MODE_ENABLE_FALSE_START + +/* SSL_MODE_CBC_RECORD_SPLITTING causes multi-byte CBC records in SSL 3.0 and + * TLS 1.0 to be split in two: the first record will contain a single byte and + * the second will contain the remainder. This effectively randomises the IV and + * prevents BEAST attacks. */ +#define SSL_MODE_CBC_RECORD_SPLITTING 0x00000100L + +/* SSL_MODE_NO_SESSION_CREATION will cause any attempts to create a session to + * fail with SSL_R_SESSION_MAY_NOT_BE_CREATED. This can be used to enforce that + * session resumption is used for a given SSL*. */ +#define SSL_MODE_NO_SESSION_CREATION 0x00000200L + +/* SSL_MODE_SEND_FALLBACK_SCSV sends TLS_FALLBACK_SCSV in the ClientHello. + * To be set only by applications that reconnect with a downgraded protocol + * version; see https://tools.ietf.org/html/draft-ietf-tls-downgrade-scsv-05 + * for details. + * + * DO NOT ENABLE THIS if your application attempts a normal handshake. Only use + * this in explicit fallback retries, following the guidance in + * draft-ietf-tls-downgrade-scsv-05. */ +#define SSL_MODE_SEND_FALLBACK_SCSV 0x00000400L + +/* The following flags do nothing and are included only to make it easier to + * compile code with BoringSSL. */ +#define SSL_MODE_AUTO_RETRY 0 +#define SSL_MODE_RELEASE_BUFFERS 0 +#define SSL_MODE_SEND_CLIENTHELLO_TIME 0 +#define SSL_MODE_SEND_SERVERHELLO_TIME 0 + +/* SSL_CTX_set_mode enables all modes set in |mode| (which should be one or more + * of the |SSL_MODE_*| values, ORed together) in |ctx|. It returns a bitmask + * representing the resulting enabled modes. */ +OPENSSL_EXPORT uint32_t SSL_CTX_set_mode(SSL_CTX *ctx, uint32_t mode); + +/* SSL_CTX_clear_mode disables all modes set in |mode| (which should be one or + * more of the |SSL_MODE_*| values, ORed together) in |ctx|. It returns a + * bitmask representing the resulting enabled modes. */ +OPENSSL_EXPORT uint32_t SSL_CTX_clear_mode(SSL_CTX *ctx, uint32_t mode); + +/* SSL_CTX_get_mode returns a bitmask of |SSL_MODE_*| values that represent all + * the modes enabled for |ssl|. */ +OPENSSL_EXPORT uint32_t SSL_CTX_get_mode(const SSL_CTX *ctx); + +/* SSL_set_mode enables all modes set in |mode| (which should be one or more of + * the |SSL_MODE_*| values, ORed together) in |ssl|. It returns a bitmask + * representing the resulting enabled modes. */ +OPENSSL_EXPORT uint32_t SSL_set_mode(SSL *ssl, uint32_t mode); + +/* SSL_clear_mode disables all modes set in |mode| (which should be one or more + * of the |SSL_MODE_*| values, ORed together) in |ssl|. It returns a bitmask + * representing the resulting enabled modes. */ +OPENSSL_EXPORT uint32_t SSL_clear_mode(SSL *ssl, uint32_t mode); + +/* SSL_get_mode returns a bitmask of |SSL_MODE_*| values that represent all the + * modes enabled for |ssl|. */ +OPENSSL_EXPORT uint32_t SSL_get_mode(const SSL *ssl); + + +/* Connection information. */ + +/* SSL_get_tls_unique writes at most |max_out| bytes of the tls-unique value + * for |ssl| to |out| and sets |*out_len| to the number of bytes written. It + * returns one on success or zero on error. In general |max_out| should be at + * least 12. + * + * This function will always fail if the initial handshake has not completed. + * The tls-unique value will change after a renegotiation but, since + * renegotiations can be initiated by the server at any point, the higher-level + * protocol must either leave them disabled or define states in which the + * tls-unique value can be read. + * + * The tls-unique value is defined by + * https://tools.ietf.org/html/rfc5929#section-3.1. Due to a weakness in the + * TLS protocol, tls-unique is broken for resumed connections unless the + * Extended Master Secret extension is negotiated. Thus this function will + * return zero if |ssl| performed session resumption unless EMS was used when + * negotiating the original session. */ +OPENSSL_EXPORT int SSL_get_tls_unique(const SSL *ssl, uint8_t *out, + size_t *out_len, size_t max_out); + + +/* Underdocumented functions. + * + * Functions below here haven't been touched up and may be underdocumented. */ + +/* SSLeay version number for ASN.1 encoding of the session information */ +/* Version 0 - initial version + * Version 1 - added the optional peer certificate. */ +#define SSL_SESSION_ASN1_VERSION 0x0001 + +#define SSL_MAX_SSL_SESSION_ID_LENGTH 32 +#define SSL_MAX_SID_CTX_LENGTH 32 +#define SSL_MAX_MASTER_KEY_LENGTH 48 + +/* These are used to specify which ciphers to use and not to use */ + +#define SSL_TXT_MEDIUM "MEDIUM" +#define SSL_TXT_HIGH "HIGH" +#define SSL_TXT_FIPS "FIPS" + +#define SSL_TXT_kRSA "kRSA" +#define SSL_TXT_kDHE "kDHE" +#define SSL_TXT_kEDH "kEDH" /* same as "kDHE" */ +#define SSL_TXT_kECDHE "kECDHE" +#define SSL_TXT_kEECDH "kEECDH" /* same as "kECDHE" */ +#define SSL_TXT_kPSK "kPSK" + +#define SSL_TXT_aRSA "aRSA" +#define SSL_TXT_aECDSA "aECDSA" +#define SSL_TXT_aPSK "aPSK" + +#define SSL_TXT_DH "DH" +#define SSL_TXT_DHE "DHE" /* same as "kDHE" */ +#define SSL_TXT_EDH "EDH" /* same as "DHE" */ +#define SSL_TXT_RSA "RSA" +#define SSL_TXT_ECDH "ECDH" +#define SSL_TXT_ECDHE "ECDHE" /* same as "kECDHE" */ +#define SSL_TXT_EECDH "EECDH" /* same as "ECDHE" */ +#define SSL_TXT_ECDSA "ECDSA" +#define SSL_TXT_PSK "PSK" + +#define SSL_TXT_3DES "3DES" +#define SSL_TXT_RC4 "RC4" +#define SSL_TXT_AES128 "AES128" +#define SSL_TXT_AES256 "AES256" +#define SSL_TXT_AES "AES" +#define SSL_TXT_AES_GCM "AESGCM" +#define SSL_TXT_CHACHA20 "CHACHA20" + +#define SSL_TXT_MD5 "MD5" +#define SSL_TXT_SHA1 "SHA1" +#define SSL_TXT_SHA "SHA" /* same as "SHA1" */ +#define SSL_TXT_SHA256 "SHA256" +#define SSL_TXT_SHA384 "SHA384" + +#define SSL_TXT_SSLV3 "SSLv3" +#define SSL_TXT_TLSV1 "TLSv1" +#define SSL_TXT_TLSV1_1 "TLSv1.1" +#define SSL_TXT_TLSV1_2 "TLSv1.2" + +#define SSL_TXT_ALL "ALL" + +/* COMPLEMENTOF* definitions. These identifiers are used to (de-select) ciphers + * normally not being used. + * + * Example: "RC4" will activate all ciphers using RC4 including ciphers without + * authentication, which would normally disabled by DEFAULT (due the "!ADH" + * being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" will make sure + * that it is also disabled in the specific selection. COMPLEMENTOF* + * identifiers are portable between version, as adjustments to the default + * cipher setup will also be included here. + * + * COMPLEMENTOFDEFAULT does not experience the same special treatment that + * DEFAULT gets, as only selection is being done and no sorting as needed for + * DEFAULT. */ +#define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" + +/* The following cipher list is used by default. It also is substituted when an + * application-defined cipher list string starts with 'DEFAULT'. */ +#define SSL_DEFAULT_CIPHER_LIST "ALL" + +/* As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always + * starts with a reasonable order, and all we have to do for DEFAULT is + * throwing out anonymous and unencrypted ciphersuites! (The latter are not + * actually enabled by ALL, but "ALL:RSA" would enable some of them.) */ + +/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ +#define SSL_SENT_SHUTDOWN 1 +#define SSL_RECEIVED_SHUTDOWN 2 + +#define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 +#define SSL_FILETYPE_PEM X509_FILETYPE_PEM + +typedef struct ssl_protocol_method_st SSL_PROTOCOL_METHOD; +typedef struct ssl_session_st SSL_SESSION; +typedef struct tls_sigalgs_st TLS_SIGALGS; +typedef struct ssl_conf_ctx_st SSL_CONF_CTX; +typedef struct ssl3_enc_method SSL3_ENC_METHOD; + +/* SRTP protection profiles for use with the use_srtp extension (RFC 5764). */ +typedef struct srtp_protection_profile_st { + const char *name; + unsigned long id; +} SRTP_PROTECTION_PROFILE; + +DECLARE_STACK_OF(SRTP_PROTECTION_PROFILE) + +/* An SSL_SESSION represents an SSL session that may be resumed in an + * abbreviated handshake. */ +struct ssl_session_st { + int ssl_version; /* what ssl version session info is being kept in here? */ + + int master_key_length; + uint8_t master_key[SSL_MAX_MASTER_KEY_LENGTH]; + /* session_id - valid? */ + unsigned int session_id_length; + uint8_t session_id[SSL_MAX_SSL_SESSION_ID_LENGTH]; + /* this is used to determine whether the session is being reused in + * the appropriate context. It is up to the application to set this, + * via SSL_new */ + unsigned int sid_ctx_length; + uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + + char *psk_identity; + /* Used to indicate that session resumption is not allowed. Applications can + * also set this bit for a new session via not_resumable_session_cb to + * disable session caching and tickets. */ + int not_resumable; + + /* The cert is the certificate used to establish this connection */ + struct sess_cert_st /* SESS_CERT */ *sess_cert; + + /* This is the cert for the other end. On clients, it will be the same as + * sess_cert->peer_key->x509 (the latter is not enough as sess_cert is not + * retained in the external representation of sessions, see ssl_asn1.c). */ + X509 *peer; + /* when app_verify_callback accepts a session where the peer's certificate is + * not ok, we must remember the error for session reuse: */ + long verify_result; /* only for servers */ + + CRYPTO_refcount_t references; + long timeout; + long time; + + const SSL_CIPHER *cipher; + + CRYPTO_EX_DATA ex_data; /* application specific data */ + + /* These are used to make removal of session-ids more efficient and to + * implement a maximum cache size. */ + SSL_SESSION *prev, *next; + char *tlsext_hostname; + /* RFC4507 info */ + uint8_t *tlsext_tick; /* Session ticket */ + size_t tlsext_ticklen; /* Session ticket length */ + uint32_t tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */ + + size_t tlsext_signed_cert_timestamp_list_length; + uint8_t *tlsext_signed_cert_timestamp_list; /* Server's list. */ + + /* The OCSP response that came with the session. */ + size_t ocsp_response_length; + uint8_t *ocsp_response; + + char peer_sha256_valid; /* Non-zero if peer_sha256 is valid */ + uint8_t + peer_sha256[SHA256_DIGEST_LENGTH]; /* SHA256 of peer certificate */ + + /* original_handshake_hash contains the handshake hash (either SHA-1+MD5 or + * SHA-2, depending on TLS version) for the original, full handshake that + * created a session. This is used by Channel IDs during resumption. */ + uint8_t original_handshake_hash[EVP_MAX_MD_SIZE]; + unsigned int original_handshake_hash_len; + + /* extended_master_secret is true if the master secret in this session was + * generated using EMS and thus isn't vulnerable to the Triple Handshake + * attack. */ + char extended_master_secret; +}; + + +/* Cert related flags */ +/* Many implementations ignore some aspects of the TLS standards such as + * enforcing certifcate chain algorithms. When this is set we enforce them. */ +#define SSL_CERT_FLAG_TLS_STRICT 0x00000001L + +/* Flags for building certificate chains */ +/* Treat any existing certificates as untrusted CAs */ +#define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 +/* Don't include root CA in chain */ +#define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 +/* Just check certificates already there */ +#define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 +/* Ignore verification errors */ +#define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 +/* Clear verification errors from queue */ +#define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 + +/* SSL_set_mtu sets the |ssl|'s MTU in DTLS to |mtu|. It returns one on success + * and zero on failure. */ +OPENSSL_EXPORT int SSL_set_mtu(SSL *ssl, unsigned mtu); + +/* SSL_get_secure_renegotiation_support returns one if the peer supports secure + * renegotiation (RFC 5746) and zero otherwise. */ +OPENSSL_EXPORT int SSL_get_secure_renegotiation_support(const SSL *ssl); + +/* SSL_CTX_set_msg_callback installs |cb| as the message callback for |ctx|. + * This callback will be called when sending or receiving low-level record + * headers, complete handshake messages, ChangeCipherSpec, and alerts. + * |write_p| is one for outgoing messages and zero for incoming messages. + * + * For each record header, |cb| is called with |version| = 0 and |content_type| + * = |SSL3_RT_HEADER|. The |len| bytes from |buf| contain the header. Note that + * this does not include the record body. If the record is sealed, the length + * in the header is the length of the ciphertext. + * + * For each handshake message, ChangeCipherSpec, and alert, |version| is the + * protocol version and |content_type| is the corresponding record type. The + * |len| bytes from |buf| contain the handshake message, one-byte + * ChangeCipherSpec body, and two-byte alert, respectively. */ +OPENSSL_EXPORT void SSL_CTX_set_msg_callback( + SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, + const void *buf, size_t len, SSL *ssl, void *arg)); + +/* SSL_CTX_set_msg_callback_arg sets the |arg| parameter of the message + * callback. */ +OPENSSL_EXPORT void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg); + +/* SSL_set_msg_callback installs |cb| as the message callback of |ssl|. See + * |SSL_CTX_set_msg_callback| for when this callback is called. */ +OPENSSL_EXPORT void SSL_set_msg_callback( + SSL *ssl, void (*cb)(int write_p, int version, int content_type, + const void *buf, size_t len, SSL *ssl, void *arg)); + +/* SSL_set_msg_callback_arg sets the |arg| parameter of the message callback. */ +OPENSSL_EXPORT void SSL_set_msg_callback_arg(SSL *ssl, void *arg); + +/* SSL_CTX_set_keylog_bio sets configures all SSL objects attached to |ctx| to + * log session material to |keylog_bio|. This is intended for debugging use + * with tools like Wireshark. |ctx| takes ownership of |keylog_bio|. + * + * The format is described in + * https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format. */ +OPENSSL_EXPORT void SSL_CTX_set_keylog_bio(SSL_CTX *ctx, BIO *keylog_bio); + + +struct ssl_aead_ctx_st; +typedef struct ssl_aead_ctx_st SSL_AEAD_CTX; + +#define SSL_MAX_CERT_LIST_DEFAULT 1024 * 100 /* 100k max cert list */ + +#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024 * 20) + +#define SSL_DEFAULT_SESSION_TIMEOUT (2 * 60 * 60) + +/* This callback type is used inside SSL_CTX, SSL, and in the functions that + * set them. It is used to override the generation of SSL/TLS session IDs in a + * server. Return value should be zero on an error, non-zero to proceed. Also, + * callbacks should themselves check if the id they generate is unique + * otherwise the SSL handshake will fail with an error - callbacks can do this + * using the 'ssl' value they're passed by; + * SSL_has_matching_session_id(ssl, id, *id_len) + * The length value passed in is set at the maximum size the session ID can be. + * In SSLv2 this is 16 bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback + * can alter this length to be less if desired, but under SSLv2 session IDs are + * supposed to be fixed at 16 bytes so the id will be padded after the callback + * returns in this case. It is also an error for the callback to set the size + * to zero. */ +typedef int (*GEN_SESSION_CB)(const SSL *ssl, uint8_t *id, + unsigned int *id_len); + +/* ssl_early_callback_ctx is passed to certain callbacks that are called very + * early on during the server handshake. At this point, much of the SSL* hasn't + * been filled out and only the ClientHello can be depended on. */ +struct ssl_early_callback_ctx { + SSL *ssl; + const uint8_t *client_hello; + size_t client_hello_len; + const uint8_t *session_id; + size_t session_id_len; + const uint8_t *cipher_suites; + size_t cipher_suites_len; + const uint8_t *compression_methods; + size_t compression_methods_len; + const uint8_t *extensions; + size_t extensions_len; +}; + +/* SSL_early_callback_ctx_extension_get searches the extensions in |ctx| for an + * extension of the given type. If not found, it returns zero. Otherwise it + * sets |out_data| to point to the extension contents (not including the type + * and length bytes), sets |out_len| to the length of the extension contents + * and returns one. */ +OPENSSL_EXPORT char SSL_early_callback_ctx_extension_get( + const struct ssl_early_callback_ctx *ctx, uint16_t extension_type, + const uint8_t **out_data, size_t *out_len); + +typedef struct ssl_comp_st SSL_COMP; + +struct ssl_comp_st { + int id; + const char *name; + char *method; +}; + +DECLARE_STACK_OF(SSL_COMP) +DECLARE_LHASH_OF(SSL_SESSION) + +/* ssl_cipher_preference_list_st contains a list of SSL_CIPHERs with + * equal-preference groups. For TLS clients, the groups are moot because the + * server picks the cipher and groups cannot be expressed on the wire. However, + * for servers, the equal-preference groups allow the client's preferences to + * be partially respected. (This only has an effect with + * SSL_OP_CIPHER_SERVER_PREFERENCE). + * + * The equal-preference groups are expressed by grouping SSL_CIPHERs together. + * All elements of a group have the same priority: no ordering is expressed + * within a group. + * + * The values in |ciphers| are in one-to-one correspondence with + * |in_group_flags|. (That is, sk_SSL_CIPHER_num(ciphers) is the number of + * bytes in |in_group_flags|.) The bytes in |in_group_flags| are either 1, to + * indicate that the corresponding SSL_CIPHER is not the last element of a + * group, or 0 to indicate that it is. + * + * For example, if |in_group_flags| contains all zeros then that indicates a + * traditional, fully-ordered preference. Every SSL_CIPHER is the last element + * of the group (i.e. they are all in a one-element group). + * + * For a more complex example, consider: + * ciphers: A B C D E F + * in_group_flags: 1 1 0 0 1 0 + * + * That would express the following, order: + * + * A E + * B -> D -> F + * C + */ +struct ssl_cipher_preference_list_st { + STACK_OF(SSL_CIPHER) *ciphers; + uint8_t *in_group_flags; +}; + +struct ssl_ctx_st { + const SSL_PROTOCOL_METHOD *method; + + /* lock is used to protect various operations on this object. */ + CRYPTO_MUTEX lock; + + /* max_version is the maximum acceptable protocol version. If zero, the + * maximum supported version, currently (D)TLS 1.2, is used. */ + uint16_t max_version; + + /* min_version is the minimum acceptable protocl version. If zero, the + * minimum supported version, currently SSL 3.0 and DTLS 1.0, is used */ + uint16_t min_version; + + struct ssl_cipher_preference_list_st *cipher_list; + /* same as above but sorted for lookup */ + STACK_OF(SSL_CIPHER) *cipher_list_by_id; + /* cipher_list_tls11 is the list of ciphers when TLS 1.1 or greater is in + * use. This only applies to server connections as, for clients, the version + * number is known at connect time and so the cipher list can be set then. */ + struct ssl_cipher_preference_list_st *cipher_list_tls11; + + X509_STORE *cert_store; + LHASH_OF(SSL_SESSION) *sessions; + /* Most session-ids that will be cached, default is + * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */ + unsigned long session_cache_size; + SSL_SESSION *session_cache_head; + SSL_SESSION *session_cache_tail; + + /* handshakes_since_cache_flush is the number of successful handshakes since + * the last cache flush. */ + int handshakes_since_cache_flush; + + /* This can have one of 2 values, ored together, + * SSL_SESS_CACHE_CLIENT, + * SSL_SESS_CACHE_SERVER, + * Default is SSL_SESSION_CACHE_SERVER, which means only + * SSL_accept which cache SSL_SESSIONS. */ + int session_cache_mode; + + /* If timeout is not 0, it is the default timeout value set when SSL_new() is + * called. This has been put in to make life easier to set things up */ + long session_timeout; + + /* If this callback is not null, it will be called each time a session id is + * added to the cache. If this function returns 1, it means that the + * callback will do a SSL_SESSION_free() when it has finished using it. + * Otherwise, on 0, it means the callback has finished with it. If + * remove_session_cb is not null, it will be called when a session-id is + * removed from the cache. After the call, OpenSSL will SSL_SESSION_free() + * it. */ + int (*new_session_cb)(SSL *ssl, SSL_SESSION *sess); + void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *sess); + SSL_SESSION *(*get_session_cb)(SSL *ssl, uint8_t *data, int len, + int *copy); + + CRYPTO_refcount_t references; + + /* if defined, these override the X509_verify_cert() calls */ + int (*app_verify_callback)(X509_STORE_CTX *, void *); + void *app_verify_arg; + /* before OpenSSL 0.9.7, 'app_verify_arg' was ignored ('app_verify_callback' + * was called with just one argument) */ + + /* Default password callback. */ + pem_password_cb *default_passwd_callback; + + /* Default password callback user data. */ + void *default_passwd_callback_userdata; + + /* get client cert callback */ + int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey); + + /* get channel id callback */ + void (*channel_id_cb)(SSL *ssl, EVP_PKEY **pkey); + + CRYPTO_EX_DATA ex_data; + + STACK_OF(X509) *extra_certs; + + + /* Default values used when no per-SSL value is defined follow */ + + void (*info_callback)(const SSL *ssl, int type, + int val); /* used if SSL's info_callback is NULL */ + + /* what we put in client cert requests */ + STACK_OF(X509_NAME) *client_CA; + + + /* Default values to use in SSL structures follow (these are copied by + * SSL_new) */ + + uint32_t options; + uint32_t mode; + uint32_t max_cert_list; + + struct cert_st /* CERT */ *cert; + + /* callback that allows applications to peek at protocol messages */ + void (*msg_callback)(int write_p, int version, int content_type, + const void *buf, size_t len, SSL *ssl, void *arg); + void *msg_callback_arg; + + int verify_mode; + unsigned int sid_ctx_length; + uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + int (*default_verify_callback)( + int ok, X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */ + + /* Default generate session ID callback. */ + GEN_SESSION_CB generate_session_id; + + X509_VERIFY_PARAM *param; + + /* select_certificate_cb is called before most ClientHello processing and + * before the decision whether to resume a session is made. It may return one + * to continue the handshake or zero to cause the handshake loop to return + * with an error and cause SSL_get_error to return + * SSL_ERROR_PENDING_CERTIFICATE. Note: when the handshake loop is resumed, it + * will not call the callback a second time. */ + int (*select_certificate_cb)(const struct ssl_early_callback_ctx *); + + /* dos_protection_cb is called once the resumption decision for a ClientHello + * has been made. It returns one to continue the handshake or zero to + * abort. */ + int (*dos_protection_cb) (const struct ssl_early_callback_ctx *); + + /* quiet_shutdown is true if the connection should not send a close_notify on + * shutdown. */ + int quiet_shutdown; + + /* Maximum amount of data to send in one fragment. actual record size can be + * more than this due to padding and MAC overheads. */ + uint16_t max_send_fragment; + + /* TLS extensions servername callback */ + int (*tlsext_servername_callback)(SSL *, int *, void *); + void *tlsext_servername_arg; + /* RFC 4507 session ticket keys */ + uint8_t tlsext_tick_key_name[16]; + uint8_t tlsext_tick_hmac_key[16]; + uint8_t tlsext_tick_aes_key[16]; + /* Callback to support customisation of ticket key setting */ + int (*tlsext_ticket_key_cb)(SSL *ssl, uint8_t *name, uint8_t *iv, + EVP_CIPHER_CTX *ectx, HMAC_CTX *hctx, int enc); + + /* Server-only: psk_identity_hint is the default identity hint to send in + * PSK-based key exchanges. */ + char *psk_identity_hint; + + unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, + char *identity, + unsigned int max_identity_len, + uint8_t *psk, unsigned int max_psk_len); + unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, + uint8_t *psk, unsigned int max_psk_len); + + + /* retain_only_sha256_of_client_certs is true if we should compute the SHA256 + * hash of the peer's certifiate and then discard it to save memory and + * session space. Only effective on the server side. */ + char retain_only_sha256_of_client_certs; + + /* Next protocol negotiation information */ + /* (for experimental NPN extension). */ + + /* For a server, this contains a callback function by which the set of + * advertised protocols can be provided. */ + int (*next_protos_advertised_cb)(SSL *s, const uint8_t **buf, + unsigned int *len, void *arg); + void *next_protos_advertised_cb_arg; + /* For a client, this contains a callback function that selects the + * next protocol from the list provided by the server. */ + int (*next_proto_select_cb)(SSL *s, uint8_t **out, uint8_t *outlen, + const uint8_t *in, unsigned int inlen, void *arg); + void *next_proto_select_cb_arg; + + /* ALPN information + * (we are in the process of transitioning from NPN to ALPN.) */ + + /* For a server, this contains a callback function that allows the + * server to select the protocol for the connection. + * out: on successful return, this must point to the raw protocol + * name (without the length prefix). + * outlen: on successful return, this contains the length of |*out|. + * in: points to the client's list of supported protocols in + * wire-format. + * inlen: the length of |in|. */ + int (*alpn_select_cb)(SSL *s, const uint8_t **out, uint8_t *outlen, + const uint8_t *in, unsigned int inlen, void *arg); + void *alpn_select_cb_arg; + + /* For a client, this contains the list of supported protocols in wire + * format. */ + uint8_t *alpn_client_proto_list; + unsigned alpn_client_proto_list_len; + + /* SRTP profiles we are willing to do from RFC 5764 */ + STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; + + /* EC extension values inherited by SSL structure */ + size_t tlsext_ecpointformatlist_length; + uint8_t *tlsext_ecpointformatlist; + size_t tlsext_ellipticcurvelist_length; + uint16_t *tlsext_ellipticcurvelist; + + /* If true, a client will advertise the Channel ID extension and a server + * will echo it. */ + char tlsext_channel_id_enabled; + /* tlsext_channel_id_enabled_new is a hack to support both old and new + * ChannelID signatures. It indicates that a client should advertise the new + * ChannelID extension number. */ + char tlsext_channel_id_enabled_new; + /* The client's Channel ID private key. */ + EVP_PKEY *tlsext_channel_id_private; + + /* If true, a client will request certificate timestamps. */ + char signed_cert_timestamps_enabled; + + /* If true, a client will request a stapled OCSP response. */ + char ocsp_stapling_enabled; + + /* If not NULL, session key material will be logged to this BIO for debugging + * purposes. The format matches NSS's and is readable by Wireshark. */ + BIO *keylog_bio; + + /* current_time_cb, if not NULL, is the function to use to get the current + * time. It sets |*out_clock| to the current time. */ + void (*current_time_cb)(const SSL *ssl, struct timeval *out_clock); +}; + +OPENSSL_EXPORT LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); + +/* SSL_CTX_sess_number returns the number of sessions in |ctx|'s internal + * session cache. */ +OPENSSL_EXPORT size_t SSL_CTX_sess_number(const SSL_CTX *ctx); + +OPENSSL_EXPORT void SSL_CTX_sess_set_new_cb( + SSL_CTX *ctx, int (*new_session_cb)(SSL *ssl, SSL_SESSION *sess)); +OPENSSL_EXPORT int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(SSL *ssl, + SSL_SESSION *sess); +OPENSSL_EXPORT void SSL_CTX_sess_set_remove_cb( + SSL_CTX *ctx, + void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *sess)); +OPENSSL_EXPORT void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))( + SSL_CTX *ctx, SSL_SESSION *sess); +OPENSSL_EXPORT void SSL_CTX_sess_set_get_cb( + SSL_CTX *ctx, + SSL_SESSION *(*get_session_cb)(SSL *ssl, uint8_t *data, int len, + int *copy)); +OPENSSL_EXPORT SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))( + SSL *ssl, uint8_t *data, int len, int *copy); +/* SSL_magic_pending_session_ptr returns a magic SSL_SESSION* which indicates + * that the session isn't currently unavailable. SSL_get_error will then return + * SSL_ERROR_PENDING_SESSION and the handshake can be retried later when the + * lookup has completed. */ +OPENSSL_EXPORT SSL_SESSION *SSL_magic_pending_session_ptr(void); +OPENSSL_EXPORT void SSL_CTX_set_info_callback(SSL_CTX *ctx, + void (*cb)(const SSL *ssl, + int type, int val)); +OPENSSL_EXPORT void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, + int type, + int val); +OPENSSL_EXPORT void SSL_CTX_set_client_cert_cb( + SSL_CTX *ctx, + int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); +OPENSSL_EXPORT int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, + X509 **x509, + EVP_PKEY **pkey); +OPENSSL_EXPORT void SSL_CTX_set_channel_id_cb( + SSL_CTX *ctx, void (*channel_id_cb)(SSL *ssl, EVP_PKEY **pkey)); +OPENSSL_EXPORT void (*SSL_CTX_get_channel_id_cb(SSL_CTX *ctx))(SSL *ssl, + EVP_PKEY **pkey); + +/* SSL_enable_signed_cert_timestamps causes |ssl| (which must be the client end + * of a connection) to request SCTs from the server. See + * https://tools.ietf.org/html/rfc6962. It returns one. */ +OPENSSL_EXPORT int SSL_enable_signed_cert_timestamps(SSL *ssl); + +/* SSL_CTX_enable_signed_cert_timestamps enables SCT requests on all client SSL + * objects created from |ctx|. */ +OPENSSL_EXPORT void SSL_CTX_enable_signed_cert_timestamps(SSL_CTX *ctx); + +/* SSL_enable_ocsp_stapling causes |ssl| (which must be the client end of a + * connection) to request a stapled OCSP response from the server. It returns + * one. */ +OPENSSL_EXPORT int SSL_enable_ocsp_stapling(SSL *ssl); + +/* SSL_CTX_enable_ocsp_stapling enables OCSP stapling on all client SSL objects + * created from |ctx|. */ +OPENSSL_EXPORT void SSL_CTX_enable_ocsp_stapling(SSL_CTX *ctx); + +/* SSL_get0_signed_cert_timestamp_list sets |*out| and |*out_len| to point to + * |*out_len| bytes of SCT information from the server. This is only valid if + * |ssl| is a client. The SCT information is a SignedCertificateTimestampList + * (including the two leading length bytes). + * See https://tools.ietf.org/html/rfc6962#section-3.3 + * If no SCT was received then |*out_len| will be zero on return. + * + * WARNING: the returned data is not guaranteed to be well formed. */ +OPENSSL_EXPORT void SSL_get0_signed_cert_timestamp_list(const SSL *ssl, + const uint8_t **out, + size_t *out_len); + +/* SSL_get0_ocsp_response sets |*out| and |*out_len| to point to |*out_len| + * bytes of an OCSP response from the server. This is the DER encoding of an + * OCSPResponse type as defined in RFC 2560. + * + * WARNING: the returned data is not guaranteed to be well formed. */ +OPENSSL_EXPORT void SSL_get0_ocsp_response(const SSL *ssl, const uint8_t **out, + size_t *out_len); + +OPENSSL_EXPORT void SSL_CTX_set_next_protos_advertised_cb( + SSL_CTX *s, + int (*cb)(SSL *ssl, const uint8_t **out, unsigned int *outlen, void *arg), + void *arg); +OPENSSL_EXPORT void SSL_CTX_set_next_proto_select_cb( + SSL_CTX *s, int (*cb)(SSL *ssl, uint8_t **out, uint8_t *outlen, + const uint8_t *in, unsigned int inlen, void *arg), + void *arg); +OPENSSL_EXPORT void SSL_get0_next_proto_negotiated(const SSL *s, + const uint8_t **data, + unsigned *len); + +OPENSSL_EXPORT int SSL_select_next_proto(uint8_t **out, uint8_t *outlen, + const uint8_t *in, unsigned int inlen, + const uint8_t *client, + unsigned int client_len); + +#define OPENSSL_NPN_UNSUPPORTED 0 +#define OPENSSL_NPN_NEGOTIATED 1 +#define OPENSSL_NPN_NO_OVERLAP 2 + +/* SSL_CTX_set_alpn_protos sets the ALPN protocol list on |ctx| to |protos|. + * |protos| must be in wire-format (i.e. a series of non-empty, 8-bit + * length-prefixed strings). It returns zero on success and one on failure. + * + * WARNING: this function is dangerous because it breaks the usual return value + * convention. */ +OPENSSL_EXPORT int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const uint8_t *protos, + unsigned protos_len); + +/* SSL_set_alpn_protos sets the ALPN protocol list on |ssl| to |protos|. + * |protos| must be in wire-format (i.e. a series of non-empty, 8-bit + * length-prefixed strings). It returns zero on success and one on failure. + * + * WARNING: this function is dangerous because it breaks the usual return value + * convention. */ +OPENSSL_EXPORT int SSL_set_alpn_protos(SSL *ssl, const uint8_t *protos, + unsigned protos_len); + +OPENSSL_EXPORT void SSL_CTX_set_alpn_select_cb( + SSL_CTX *ctx, int (*cb)(SSL *ssl, const uint8_t **out, uint8_t *outlen, + const uint8_t *in, unsigned int inlen, void *arg), + void *arg); +OPENSSL_EXPORT void SSL_get0_alpn_selected(const SSL *ssl, const uint8_t **data, + unsigned *len); + +/* SSL_enable_fastradio_padding controls whether fastradio padding is enabled + * on |ssl|. If it is, ClientHello messages are padded to 1024 bytes. This + * causes 3G radios to switch to DCH mode (high data rate). */ +OPENSSL_EXPORT void SSL_enable_fastradio_padding(SSL *ssl, char on_off); + +/* SSL_set_reject_peer_renegotiations controls whether renegotiation attempts by + * the peer are rejected. It may be set at any point in a connection's lifetime + * to control future renegotiations programmatically. By default, renegotiations + * are rejected. (Renegotiations requested by a client are always rejected.) */ +OPENSSL_EXPORT void SSL_set_reject_peer_renegotiations(SSL *ssl, int reject); + +/* the maximum length of the buffer given to callbacks containing the resulting + * identity/psk */ +#define PSK_MAX_IDENTITY_LEN 128 +#define PSK_MAX_PSK_LEN 256 +OPENSSL_EXPORT void SSL_CTX_set_psk_client_callback( + SSL_CTX *ctx, + unsigned int (*psk_client_callback)( + SSL *ssl, const char *hint, char *identity, + unsigned int max_identity_len, uint8_t *psk, unsigned int max_psk_len)); +OPENSSL_EXPORT void SSL_set_psk_client_callback( + SSL *ssl, unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, + char *identity, + unsigned int max_identity_len, + uint8_t *psk, + unsigned int max_psk_len)); +OPENSSL_EXPORT void SSL_CTX_set_psk_server_callback( + SSL_CTX *ctx, + unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, + uint8_t *psk, + unsigned int max_psk_len)); +OPENSSL_EXPORT void SSL_set_psk_server_callback( + SSL *ssl, + unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, + uint8_t *psk, + unsigned int max_psk_len)); +OPENSSL_EXPORT int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, + const char *identity_hint); +OPENSSL_EXPORT int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); +OPENSSL_EXPORT const char *SSL_get_psk_identity_hint(const SSL *s); +OPENSSL_EXPORT const char *SSL_get_psk_identity(const SSL *s); + +#define SSL_NOTHING 1 +#define SSL_WRITING 2 +#define SSL_READING 3 +#define SSL_X509_LOOKUP 4 +#define SSL_CHANNEL_ID_LOOKUP 5 +#define SSL_PENDING_SESSION 7 +#define SSL_CERTIFICATE_SELECTION_PENDING 8 + +/* These will only be used when doing non-blocking IO */ +#define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) +#define SSL_want_read(s) (SSL_want(s) == SSL_READING) +#define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) +#define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) +#define SSL_want_channel_id_lookup(s) (SSL_want(s) == SSL_CHANNEL_ID_LOOKUP) +#define SSL_want_session(s) (SSL_want(s) == SSL_PENDING_SESSION) +#define SSL_want_certificate(s) \ + (SSL_want(s) == SSL_CERTIFICATE_SELECTION_PENDING) + +struct ssl_st { + /* version is the protocol version. */ + int version; + + /* method is the method table corresponding to the current protocol (DTLS or + * TLS). */ + const SSL_PROTOCOL_METHOD *method; + + /* enc_method is the method table corresponding to the current protocol + * version. */ + const SSL3_ENC_METHOD *enc_method; + + /* max_version is the maximum acceptable protocol version. If zero, the + * maximum supported version, currently (D)TLS 1.2, is used. */ + uint16_t max_version; + + /* min_version is the minimum acceptable protocl version. If zero, the + * minimum supported version, currently SSL 3.0 and DTLS 1.0, is used */ + uint16_t min_version; + + /* There are 2 BIO's even though they are normally both the same. This is so + * data can be read and written to different handlers */ + + BIO *rbio; /* used by SSL_read */ + BIO *wbio; /* used by SSL_write */ + BIO *bbio; /* used during session-id reuse to concatenate + * messages */ + + /* This holds a variable that indicates what we were doing when a 0 or -1 is + * returned. This is needed for non-blocking IO so we know what request + * needs re-doing when in SSL_accept or SSL_connect */ + int rwstate; + + /* true when we are actually in SSL_accept() or SSL_connect() */ + int in_handshake; + int (*handshake_func)(SSL *); + + /* Imagine that here's a boolean member "init" that is switched as soon as + * SSL_set_{accept/connect}_state is called for the first time, so that + * "state" and "handshake_func" are properly initialized. But as + * handshake_func is == 0 until then, we use this test instead of an "init" + * member. */ + + /* server is true iff the this SSL* is the server half. Note: before the SSL* + * is initialized by either SSL_set_accept_state or SSL_set_connect_state, + * the side is not determined. In this state, server is always false. */ + int server; + + /* quiet_shutdown is true if the connection should not send a close_notify on + * shutdown. */ + int quiet_shutdown; + + int shutdown; /* we have shut things down, 0x01 sent, 0x02 + * for received */ + int state; /* where we are */ + int rstate; /* where we are when reading */ + + BUF_MEM *init_buf; /* buffer used during init */ + uint8_t *init_msg; /* pointer to handshake message body, set by + ssl3_get_message() */ + int init_num; /* amount read/written */ + int init_off; /* amount read/written */ + + /* used internally to point at a raw packet */ + uint8_t *packet; + unsigned int packet_length; + + struct ssl3_state_st *s3; /* SSLv3 variables */ + struct dtls1_state_st *d1; /* DTLSv1 variables */ + + /* callback that allows applications to peek at protocol messages */ + void (*msg_callback)(int write_p, int version, int content_type, + const void *buf, size_t len, SSL *ssl, void *arg); + void *msg_callback_arg; + + int hit; /* reusing a previous session */ + + X509_VERIFY_PARAM *param; + + /* crypto */ + struct ssl_cipher_preference_list_st *cipher_list; + STACK_OF(SSL_CIPHER) *cipher_list_by_id; + + SSL_AEAD_CTX *aead_read_ctx; + SSL_AEAD_CTX *aead_write_ctx; + + /* session info */ + + /* client cert? */ + /* This is used to hold the server certificate used */ + struct cert_st /* CERT */ *cert; + + /* the session_id_context is used to ensure sessions are only reused + * in the appropriate context */ + unsigned int sid_ctx_length; + uint8_t sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + + /* This can also be in the session once a session is established */ + SSL_SESSION *session; + + /* Default generate session ID callback. */ + GEN_SESSION_CB generate_session_id; + + /* Used in SSL2 and SSL3 */ + int verify_mode; /* 0 don't care about verify failure. + * 1 fail if verify fails */ + int (*verify_callback)(int ok, + X509_STORE_CTX *ctx); /* fail if callback returns 0 */ + + void (*info_callback)(const SSL *ssl, int type, + int val); /* optional informational callback */ + + /* Server-only: psk_identity_hint is the identity hint to send in + * PSK-based key exchanges. */ + char *psk_identity_hint; + + unsigned int (*psk_client_callback)(SSL *ssl, const char *hint, + char *identity, + unsigned int max_identity_len, + uint8_t *psk, unsigned int max_psk_len); + unsigned int (*psk_server_callback)(SSL *ssl, const char *identity, + uint8_t *psk, unsigned int max_psk_len); + + SSL_CTX *ctx; + + /* extra application data */ + long verify_result; + CRYPTO_EX_DATA ex_data; + + /* for server side, keep the list of CA_dn we can use */ + STACK_OF(X509_NAME) *client_CA; + + uint32_t options; /* protocol behaviour */ + uint32_t mode; /* API behaviour */ + uint32_t max_cert_list; + int client_version; /* what was passed, used for + * SSLv3/TLS rollback check */ + uint16_t max_send_fragment; + char *tlsext_hostname; + /* should_ack_sni is true if the SNI extension should be acked. This is + * only used by a server. */ + char should_ack_sni; + /* RFC4507 session ticket expected to be received or sent */ + int tlsext_ticket_expected; + size_t tlsext_ecpointformatlist_length; + uint8_t *tlsext_ecpointformatlist; /* our list */ + size_t tlsext_ellipticcurvelist_length; + uint16_t *tlsext_ellipticcurvelist; /* our list */ + + SSL_CTX *initial_ctx; /* initial ctx, used to store sessions */ + + /* Next protocol negotiation. For the client, this is the protocol that we + * sent in NextProtocol and is set when handling ServerHello extensions. + * + * For a server, this is the client's selected_protocol from NextProtocol and + * is set when handling the NextProtocol message, before the Finished + * message. */ + uint8_t *next_proto_negotiated; + size_t next_proto_negotiated_len; + + /* srtp_profiles is the list of configured SRTP protection profiles for + * DTLS-SRTP. */ + STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; + + /* srtp_profile is the selected SRTP protection profile for + * DTLS-SRTP. */ + const SRTP_PROTECTION_PROFILE *srtp_profile; + + /* Copied from the SSL_CTX. For a server, means that we'll accept Channel IDs + * from clients. For a client, means that we'll advertise support. */ + char tlsext_channel_id_enabled; + /* The client's Channel ID private key. */ + EVP_PKEY *tlsext_channel_id_private; + + /* Enable signed certificate time stamps. Currently client only. */ + char signed_cert_timestamps_enabled; + + /* Enable OCSP stapling. Currently client only. + * TODO(davidben): Add a server-side implementation when it becomes + * necesary. */ + char ocsp_stapling_enabled; + + /* For a client, this contains the list of supported protocols in wire + * format. */ + uint8_t *alpn_client_proto_list; + unsigned alpn_client_proto_list_len; + + /* fastradio_padding, if true, causes ClientHellos to be padded to 1024 + * bytes. This ensures that the cellular radio is fast forwarded to DCH (high + * data rate) state in 3G networks. */ + char fastradio_padding; + + /* accept_peer_renegotiations, if one, accepts renegotiation attempts from the + * peer. Otherwise, they will be rejected with a fatal error. */ + char accept_peer_renegotiations; + + /* These fields are always NULL and exist only to keep wpa_supplicant happy + * about the change to EVP_AEAD. They are only needed for EAP-FAST, which we + * don't support. */ + EVP_CIPHER_CTX *enc_read_ctx; + EVP_MD_CTX *read_hash; +}; + +/* compatibility */ +#define SSL_set_app_data(s, arg) (SSL_set_ex_data(s, 0, (char *)arg)) +#define SSL_get_app_data(s) (SSL_get_ex_data(s, 0)) +#define SSL_SESSION_set_app_data(s, a) \ + (SSL_SESSION_set_ex_data(s, 0, (char *)a)) +#define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s, 0)) +#define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx, 0)) +#define SSL_CTX_set_app_data(ctx, arg) \ + (SSL_CTX_set_ex_data(ctx, 0, (char *)arg)) + +/* The following are the possible values for ssl->state are are used to + * indicate where we are up to in the SSL connection establishment. The macros + * that follow are about the only things you should need to use and even then, + * only when using non-blocking IO. It can also be useful to work out where you + * were when the connection failed */ + +#define SSL_ST_CONNECT 0x1000 +#define SSL_ST_ACCEPT 0x2000 +#define SSL_ST_MASK 0x0FFF +#define SSL_ST_INIT (SSL_ST_CONNECT | SSL_ST_ACCEPT) +#define SSL_ST_OK 0x03 +#define SSL_ST_RENEGOTIATE (0x04 | SSL_ST_INIT) + +#define SSL_CB_LOOP 0x01 +#define SSL_CB_EXIT 0x02 +#define SSL_CB_READ 0x04 +#define SSL_CB_WRITE 0x08 +#define SSL_CB_ALERT 0x4000 /* used in callback */ +#define SSL_CB_READ_ALERT (SSL_CB_ALERT | SSL_CB_READ) +#define SSL_CB_WRITE_ALERT (SSL_CB_ALERT | SSL_CB_WRITE) +#define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT | SSL_CB_LOOP) +#define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT | SSL_CB_EXIT) +#define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT | SSL_CB_LOOP) +#define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT | SSL_CB_EXIT) +#define SSL_CB_HANDSHAKE_START 0x10 +#define SSL_CB_HANDSHAKE_DONE 0x20 + +/* Is the SSL_connection established? */ +#define SSL_get_state(a) SSL_state(a) +#define SSL_is_init_finished(a) (SSL_state(a) == SSL_ST_OK) +#define SSL_in_init(a) (SSL_state(a) & SSL_ST_INIT) +#define SSL_in_connect_init(a) (SSL_state(a) & SSL_ST_CONNECT) +#define SSL_in_accept_init(a) (SSL_state(a) & SSL_ST_ACCEPT) + +/* SSL_in_false_start returns one if |s| has a pending unfinished handshake that + * is in False Start. |SSL_write| may be called at this point without waiting + * for the peer, but |SSL_read| will require the handshake to be completed. */ +OPENSSL_EXPORT int SSL_in_false_start(const SSL *s); + +/* The following 2 states are kept in ssl->rstate when reads fail, + * you should not need these */ +#define SSL_ST_READ_HEADER 0xF0 +#define SSL_ST_READ_BODY 0xF1 +#define SSL_ST_READ_DONE 0xF2 + +/* Obtain latest Finished message + * -- that we sent (SSL_get_finished) + * -- that we expected from peer (SSL_get_peer_finished). + * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ +OPENSSL_EXPORT size_t SSL_get_finished(const SSL *s, void *buf, size_t count); +OPENSSL_EXPORT size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); + +/* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options + * are 'ored' with SSL_VERIFY_PEER if they are desired */ +#define SSL_VERIFY_NONE 0x00 +#define SSL_VERIFY_PEER 0x01 +#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 +/* SSL_VERIFY_CLIENT_ONCE does nothing. */ +#define SSL_VERIFY_CLIENT_ONCE 0x04 +#define SSL_VERIFY_PEER_IF_NO_OBC 0x08 + +#define OpenSSL_add_ssl_algorithms() SSL_library_init() +#define SSLeay_add_ssl_algorithms() SSL_library_init() + +/* For backward compatibility */ +#define SSL_get_cipher(s) SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_cipher_bits(s, np) \ + SSL_CIPHER_get_bits(SSL_get_current_cipher(s), np) +#define SSL_get_cipher_version(s) \ + SSL_CIPHER_get_version(SSL_get_current_cipher(s)) +#define SSL_get_cipher_name(s) SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_time(a) SSL_SESSION_get_time(a) +#define SSL_set_time(a, b) SSL_SESSION_set_time((a), (b)) +#define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) +#define SSL_set_timeout(a, b) SSL_SESSION_set_timeout((a), (b)) + +#define d2i_SSL_SESSION_bio(bp, s_id) \ + ASN1_d2i_bio_of(SSL_SESSION, SSL_SESSION_new, d2i_SSL_SESSION, bp, s_id) +#define i2d_SSL_SESSION_bio(bp, s_id) \ + ASN1_i2d_bio_of(SSL_SESSION, i2d_SSL_SESSION, bp, s_id) + +DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) + +/* make_errors.go reserves error codes above 1000 for manually-assigned errors. + * This value must be kept in sync with reservedReasonCode in make_errors.h */ +#define SSL_AD_REASON_OFFSET \ + 1000 /* offset to get SSL_R_... value from SSL_AD_... */ + +/* These alert types are for SSLv3 and TLSv1 */ +#define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY +#define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE /* fatal */ +#define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC /* fatal */ +#define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED +#define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW +#define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE /* fatal */ +#define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE /* fatal */ +#define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE /* Not for TLS */ +#define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE +#define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE +#define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED +#define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED +#define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN +#define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER /* fatal */ +#define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA /* fatal */ +#define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED /* fatal */ +#define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR /* fatal */ +#define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR +#define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION /* fatal */ +#define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION /* fatal */ +#define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY /* fatal */ +#define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR /* fatal */ +#define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED +#define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION +#define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION +#define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE +#define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME +#define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE \ + TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE +#define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE +#define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY /* fatal */ +#define SSL_AD_INAPPROPRIATE_FALLBACK SSL3_AD_INAPPROPRIATE_FALLBACK /* fatal */ + +#define SSL_ERROR_NONE 0 +#define SSL_ERROR_SSL 1 +#define SSL_ERROR_WANT_READ 2 +#define SSL_ERROR_WANT_WRITE 3 +#define SSL_ERROR_WANT_X509_LOOKUP 4 +#define SSL_ERROR_SYSCALL 5 /* look at error stack/return value/errno */ +#define SSL_ERROR_ZERO_RETURN 6 +#define SSL_ERROR_WANT_CONNECT 7 +#define SSL_ERROR_WANT_ACCEPT 8 +#define SSL_ERROR_WANT_CHANNEL_ID_LOOKUP 9 +#define SSL_ERROR_PENDING_SESSION 11 +#define SSL_ERROR_PENDING_CERTIFICATE 12 + +#define SSL_CTRL_EXTRA_CHAIN_CERT 14 + +/* see tls1.h for macros based on these */ +#define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 +#define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 + +#define SSL_CTRL_SET_SRP_ARG 78 +#define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 +#define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 +#define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 + +#define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 +#define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 + +#define SSL_CTRL_CHAIN 88 +#define SSL_CTRL_CHAIN_CERT 89 + +#define SSL_CTRL_GET_CURVES 90 +#define SSL_CTRL_SET_CURVES 91 +#define SSL_CTRL_SET_CURVES_LIST 92 +#define SSL_CTRL_SET_SIGALGS 97 +#define SSL_CTRL_SET_SIGALGS_LIST 98 +#define SSL_CTRL_SET_CLIENT_SIGALGS 101 +#define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 +#define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 +#define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 +#define SSL_CTRL_BUILD_CERT_CHAIN 105 +#define SSL_CTRL_SET_VERIFY_CERT_STORE 106 +#define SSL_CTRL_SET_CHAIN_CERT_STORE 107 +#define SSL_CTRL_GET_SERVER_TMP_KEY 109 +#define SSL_CTRL_GET_EC_POINT_FORMATS 111 + +#define SSL_CTRL_GET_CHAIN_CERTS 115 +#define SSL_CTRL_SELECT_CURRENT_CERT 116 + +/* DTLSv1_get_timeout queries the next DTLS handshake timeout. If there is a + * timeout in progress, it sets |*out| to the time remaining and returns one. + * Otherwise, it returns zero. + * + * When the timeout expires, call |DTLSv1_handle_timeout| to handle the + * retransmit behavior. + * + * NOTE: This function must be queried again whenever the handshake state + * machine changes, including when |DTLSv1_handle_timeout| is called. */ +OPENSSL_EXPORT int DTLSv1_get_timeout(const SSL *ssl, struct timeval *out); + +/* DTLSv1_handle_timeout is called when a DTLS handshake timeout expires. If no + * timeout had expired, it returns 0. Otherwise, it retransmits the previous + * flight of handshake messages and returns 1. If too many timeouts had expired + * without progress or an error occurs, it returns -1. + * + * NOTE: The caller's external timer should be compatible with the one |ssl| + * queries within some fudge factor. Otherwise, the call will be a no-op, but + * |DTLSv1_get_timeout| will return an updated timeout. + * + * WARNING: This function breaks the usual return value convention. */ +OPENSSL_EXPORT int DTLSv1_handle_timeout(SSL *ssl); + +/* SSL_session_reused returns one if |ssl| performed an abbreviated handshake + * and zero otherwise. + * + * TODO(davidben): Hammer down the semantics of this API while a handshake, + * initial or renego, is in progress. */ +OPENSSL_EXPORT int SSL_session_reused(const SSL *ssl); + +/* SSL_total_renegotiations returns the total number of renegotiation handshakes + * peformed by |ssl|. This includes the pending renegotiation, if any. */ +OPENSSL_EXPORT int SSL_total_renegotiations(const SSL *ssl); + +/* SSL_CTX_set_tmp_dh configures |ctx| to use the group from |dh| as the group + * for DHE. Only the group is used, so |dh| needn't have a keypair. It returns + * one on success and zero on error. */ +OPENSSL_EXPORT int SSL_CTX_set_tmp_dh(SSL_CTX *ctx, const DH *dh); + +/* SSL_set_tmp_dh configures |ssl| to use the group from |dh| as the group for + * DHE. Only the group is used, so |dh| needn't have a keypair. It returns one + * on success and zero on error. */ +OPENSSL_EXPORT int SSL_set_tmp_dh(SSL *ssl, const DH *dh); + +/* SSL_CTX_set_tmp_ecdh configures |ctx| to use the curve from |ecdh| as the + * curve for ephemeral ECDH keys. For historical reasons, this API expects an + * |EC_KEY|, but only the curve is used. It returns one on success and zero on + * error. If unset, an appropriate curve will be chosen automatically. (This is + * recommended.) */ +OPENSSL_EXPORT int SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ec_key); + +/* SSL_set_tmp_ecdh configures |ssl| to use the curve from |ecdh| as the curve + * for ephemeral ECDH keys. For historical reasons, this API expects an + * |EC_KEY|, but only the curve is used. It returns one on success and zero on + * error. If unset, an appropriate curve will be chosen automatically. (This is + * recommended.) */ +OPENSSL_EXPORT int SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ec_key); + +/* SSL_CTX_enable_tls_channel_id either configures a TLS server to accept TLS + * client IDs from clients, or configures a client to send TLS client IDs to + * a server. It returns one. */ +OPENSSL_EXPORT int SSL_CTX_enable_tls_channel_id(SSL_CTX *ctx); + +/* SSL_enable_tls_channel_id either configures a TLS server to accept TLS + * client IDs from clients, or configure a client to send TLS client IDs to + * server. It returns one. */ +OPENSSL_EXPORT int SSL_enable_tls_channel_id(SSL *ssl); + +/* SSL_CTX_set1_tls_channel_id configures a TLS client to send a TLS Channel ID + * to compatible servers. |private_key| must be a P-256 EC key. It returns one + * on success and zero on error. */ +OPENSSL_EXPORT int SSL_CTX_set1_tls_channel_id(SSL_CTX *ctx, + EVP_PKEY *private_key); + +/* SSL_set1_tls_channel_id configures a TLS client to send a TLS Channel ID to + * compatible servers. |private_key| must be a P-256 EC key. It returns one on + * success and zero on error. */ +OPENSSL_EXPORT int SSL_set1_tls_channel_id(SSL *ssl, EVP_PKEY *private_key); + +/* SSL_get_tls_channel_id gets the client's TLS Channel ID from a server SSL* + * and copies up to the first |max_out| bytes into |out|. The Channel ID + * consists of the client's P-256 public key as an (x,y) pair where each is a + * 32-byte, big-endian field element. It returns 0 if the client didn't offer a + * Channel ID and the length of the complete Channel ID otherwise. */ +OPENSSL_EXPORT size_t SSL_get_tls_channel_id(SSL *ssl, uint8_t *out, + size_t max_out); + +#define SSL_CTX_add_extra_chain_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_EXTRA_CHAIN_CERT, 0, (char *)x509) +#define SSL_CTX_get_extra_chain_certs(ctx, px509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 0, px509) +#define SSL_CTX_get_extra_chain_certs_only(ctx, px509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_EXTRA_CHAIN_CERTS, 1, px509) +#define SSL_CTX_clear_extra_chain_certs(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS, 0, NULL) + +#define SSL_CTX_set0_chain(ctx, sk) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN, 0, (char *)sk) +#define SSL_CTX_set1_chain(ctx, sk) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN, 1, (char *)sk) +#define SSL_CTX_add0_chain_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 0, (char *)x509) +#define SSL_CTX_add1_chain_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 1, (char *)x509) +#define SSL_CTX_get0_chain_certs(ctx, px509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_CHAIN_CERTS, 0, px509) +#define SSL_CTX_clear_chain_certs(ctx) SSL_CTX_set0_chain(ctx, NULL) +#define SSL_CTX_build_cert_chain(ctx, flags) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +#define SSL_CTX_select_current_cert(ctx, x509) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SELECT_CURRENT_CERT, 0, (char *)x509) + +#define SSL_CTX_set0_verify_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_VERIFY_CERT_STORE, 0, (char *)st) +#define SSL_CTX_set1_verify_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_VERIFY_CERT_STORE, 1, (char *)st) +#define SSL_CTX_set0_chain_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CHAIN_CERT_STORE, 0, (char *)st) +#define SSL_CTX_set1_chain_cert_store(ctx, st) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CHAIN_CERT_STORE, 1, (char *)st) + +#define SSL_set0_chain(ctx, sk) SSL_ctrl(ctx, SSL_CTRL_CHAIN, 0, (char *)sk) +#define SSL_set1_chain(ctx, sk) SSL_ctrl(ctx, SSL_CTRL_CHAIN, 1, (char *)sk) +#define SSL_add0_chain_cert(ctx, x509) \ + SSL_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 0, (char *)x509) +#define SSL_add1_chain_cert(ctx, x509) \ + SSL_ctrl(ctx, SSL_CTRL_CHAIN_CERT, 1, (char *)x509) +#define SSL_get0_chain_certs(ctx, px509) \ + SSL_ctrl(ctx, SSL_CTRL_GET_CHAIN_CERTS, 0, px509) +#define SSL_clear_chain_certs(ctx) SSL_set0_chain(ctx, NULL) +#define SSL_build_cert_chain(s, flags) \ + SSL_ctrl(s, SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +#define SSL_select_current_cert(ctx, x509) \ + SSL_ctrl(ctx, SSL_CTRL_SELECT_CURRENT_CERT, 0, (char *)x509) + +#define SSL_set0_verify_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_VERIFY_CERT_STORE, 0, (char *)st) +#define SSL_set1_verify_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_VERIFY_CERT_STORE, 1, (char *)st) +#define SSL_set0_chain_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_CHAIN_CERT_STORE, 0, (char *)st) +#define SSL_set1_chain_cert_store(s, st) \ + SSL_ctrl(s, SSL_CTRL_SET_CHAIN_CERT_STORE, 1, (char *)st) + +#define SSL_get1_curves(ctx, s) SSL_ctrl(ctx, SSL_CTRL_GET_CURVES, 0, (char *)s) +#define SSL_CTX_set1_curves(ctx, clist, clistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CURVES, clistlen, (char *)clist) +#define SSL_CTX_set1_curves_list(ctx, s) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CURVES_LIST, 0, (char *)s) +#define SSL_set1_curves(ctx, clist, clistlen) \ + SSL_ctrl(ctx, SSL_CTRL_SET_CURVES, clistlen, (char *)clist) +#define SSL_set1_curves_list(ctx, s) \ + SSL_ctrl(ctx, SSL_CTRL_SET_CURVES_LIST, 0, (char *)s) + +#define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SIGALGS, slistlen, (int *)slist) +#define SSL_CTX_set1_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SIGALGS_LIST, 0, (char *)s) +#define SSL_set1_sigalgs(ctx, slist, slistlen) \ + SSL_ctrl(ctx, SSL_CTRL_SET_SIGALGS, clistlen, (int *)slist) +#define SSL_set1_sigalgs_list(ctx, s) \ + SSL_ctrl(ctx, SSL_CTRL_SET_SIGALGS_LIST, 0, (char *)s) + +#define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS, slistlen, (int *)slist) +#define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS_LIST, 0, (char *)s) +#define SSL_set1_client_sigalgs(ctx, slist, slistlen) \ + SSL_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS, clistlen, (int *)slist) +#define SSL_set1_client_sigalgs_list(ctx, s) \ + SSL_ctrl(ctx, SSL_CTRL_SET_CLIENT_SIGALGS_LIST, 0, (char *)s) + +#define SSL_get0_certificate_types(s, clist) \ + SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)clist) + +#define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_CLIENT_CERT_TYPES, clistlen, (char *)clist) +#define SSL_set1_client_certificate_types(s, clist, clistlen) \ + SSL_ctrl(s, SSL_CTRL_SET_CLIENT_CERT_TYPES, clistlen, (char *)clist) + +#define SSL_get_server_tmp_key(s, pk) \ + SSL_ctrl(s, SSL_CTRL_GET_SERVER_TMP_KEY, 0, pk) + +#define SSL_get0_ec_point_formats(s, plst) \ + SSL_ctrl(s, SSL_CTRL_GET_EC_POINT_FORMATS, 0, (char *)plst) + +OPENSSL_EXPORT int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); +OPENSSL_EXPORT int SSL_CTX_set_cipher_list_tls11(SSL_CTX *, const char *str); +OPENSSL_EXPORT long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); +OPENSSL_EXPORT long SSL_CTX_get_timeout(const SSL_CTX *ctx); +OPENSSL_EXPORT X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); +OPENSSL_EXPORT void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); +OPENSSL_EXPORT int SSL_want(const SSL *s); + +OPENSSL_EXPORT void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); + +/* SSL_get_current_cipher returns the cipher used in the current outgoing + * connection state, or NULL if the null cipher is active. */ +OPENSSL_EXPORT const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); + +OPENSSL_EXPORT int SSL_get_fd(const SSL *s); +OPENSSL_EXPORT int SSL_get_rfd(const SSL *s); +OPENSSL_EXPORT int SSL_get_wfd(const SSL *s); +OPENSSL_EXPORT const char *SSL_get_cipher_list(const SSL *s, int n); +OPENSSL_EXPORT int SSL_pending(const SSL *s); +OPENSSL_EXPORT int SSL_set_fd(SSL *s, int fd); +OPENSSL_EXPORT int SSL_set_rfd(SSL *s, int fd); +OPENSSL_EXPORT int SSL_set_wfd(SSL *s, int fd); +OPENSSL_EXPORT void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); +OPENSSL_EXPORT BIO *SSL_get_rbio(const SSL *s); +OPENSSL_EXPORT BIO *SSL_get_wbio(const SSL *s); +OPENSSL_EXPORT int SSL_set_cipher_list(SSL *s, const char *str); +OPENSSL_EXPORT int SSL_get_verify_mode(const SSL *s); +OPENSSL_EXPORT int SSL_get_verify_depth(const SSL *s); +OPENSSL_EXPORT int (*SSL_get_verify_callback(const SSL *s))(int, + X509_STORE_CTX *); +OPENSSL_EXPORT void SSL_set_verify(SSL *s, int mode, + int (*callback)(int ok, + X509_STORE_CTX *ctx)); +OPENSSL_EXPORT void SSL_set_verify_depth(SSL *s, int depth); +OPENSSL_EXPORT void SSL_set_cert_cb(SSL *s, int (*cb)(SSL *ssl, void *arg), + void *arg); +OPENSSL_EXPORT int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); +OPENSSL_EXPORT int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, uint8_t *d, long len); +OPENSSL_EXPORT int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); +OPENSSL_EXPORT int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const uint8_t *d, + long len); +OPENSSL_EXPORT int SSL_use_certificate(SSL *ssl, X509 *x); +OPENSSL_EXPORT int SSL_use_certificate_ASN1(SSL *ssl, const uint8_t *d, + int len); + +OPENSSL_EXPORT int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, + int type); +OPENSSL_EXPORT int SSL_use_PrivateKey_file(SSL *ssl, const char *file, + int type); +OPENSSL_EXPORT int SSL_use_certificate_file(SSL *ssl, const char *file, + int type); +OPENSSL_EXPORT int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, + const char *file, int type); +OPENSSL_EXPORT int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, + int type); +OPENSSL_EXPORT int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, + int type); +OPENSSL_EXPORT int SSL_CTX_use_certificate_chain_file( + SSL_CTX *ctx, const char *file); /* PEM type */ +OPENSSL_EXPORT STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); +OPENSSL_EXPORT int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) * + stackCAs, + const char *file); +OPENSSL_EXPORT int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) * + stackCAs, + const char *dir); + +/* SSL_load_error_strings does nothing. */ +OPENSSL_EXPORT void SSL_load_error_strings(void); + +OPENSSL_EXPORT const char *SSL_state_string(const SSL *s); +OPENSSL_EXPORT const char *SSL_rstate_string(const SSL *s); +OPENSSL_EXPORT const char *SSL_state_string_long(const SSL *s); +OPENSSL_EXPORT const char *SSL_rstate_string_long(const SSL *s); +OPENSSL_EXPORT long SSL_SESSION_get_time(const SSL_SESSION *s); +OPENSSL_EXPORT long SSL_SESSION_set_time(SSL_SESSION *s, long t); +OPENSSL_EXPORT long SSL_SESSION_get_timeout(const SSL_SESSION *s); +OPENSSL_EXPORT long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); +OPENSSL_EXPORT X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); +OPENSSL_EXPORT int SSL_SESSION_set1_id_context(SSL_SESSION *s, + const uint8_t *sid_ctx, + unsigned int sid_ctx_len); + +OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_new(void); +OPENSSL_EXPORT const uint8_t *SSL_SESSION_get_id(const SSL_SESSION *s, + unsigned int *len); +OPENSSL_EXPORT int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); +OPENSSL_EXPORT int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); + +/* SSL_SESSION_up_ref, if |session| is not NULL, increments the reference count + * of |session|. It then returns |session|. */ +OPENSSL_EXPORT SSL_SESSION *SSL_SESSION_up_ref(SSL_SESSION *session); + +/* SSL_SESSION_free decrements the reference count of |session|. If it reaches + * zero, all data referenced by |session| and |session| itself are released. */ +OPENSSL_EXPORT void SSL_SESSION_free(SSL_SESSION *session); + +OPENSSL_EXPORT int SSL_set_session(SSL *to, SSL_SESSION *session); +OPENSSL_EXPORT int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); +OPENSSL_EXPORT int SSL_CTX_remove_session(SSL_CTX *, SSL_SESSION *c); +OPENSSL_EXPORT int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); +OPENSSL_EXPORT int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); +OPENSSL_EXPORT int SSL_has_matching_session_id(const SSL *ssl, + const uint8_t *id, + unsigned int id_len); + +/* SSL_SESSION_to_bytes serializes |in| into a newly allocated buffer and sets + * |*out_data| to that buffer and |*out_len| to its length. The caller takes + * ownership of the buffer and must call |OPENSSL_free| when done. It returns + * one on success and zero on error. */ +OPENSSL_EXPORT int SSL_SESSION_to_bytes(SSL_SESSION *in, uint8_t **out_data, + size_t *out_len); + +/* SSL_SESSION_to_bytes_for_ticket serializes |in|, but excludes the session ID + * which is not necessary in a session ticket. */ +OPENSSL_EXPORT int SSL_SESSION_to_bytes_for_ticket(SSL_SESSION *in, + uint8_t **out_data, + size_t *out_len); + +/* Deprecated: i2d_SSL_SESSION serializes |in| to the bytes pointed to by + * |*pp|. On success, it returns the number of bytes written and advances |*pp| + * by that many bytes. On failure, it returns -1. If |pp| is NULL, no bytes are + * written and only the length is returned. + * + * Use SSL_SESSION_to_bytes instead. */ +OPENSSL_EXPORT int i2d_SSL_SESSION(SSL_SESSION *in, uint8_t **pp); + +/* d2i_SSL_SESSION deserializes a serialized buffer contained in the |length| + * bytes pointed to by |*pp|. It returns the new SSL_SESSION and advances |*pp| + * by the number of bytes consumed on success and NULL on failure. If |a| is + * NULL, the caller takes ownership of the new session and must call + * |SSL_SESSION_free| when done. + * + * If |a| and |*a| are not NULL, the SSL_SESSION at |*a| is overridden with the + * deserialized session rather than allocating a new one. In addition, |a| is + * not NULL, but |*a| is, |*a| is set to the new SSL_SESSION. + * + * Passing a value other than NULL to |a| is deprecated. */ +OPENSSL_EXPORT SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const uint8_t **pp, + long length); + +OPENSSL_EXPORT X509 *SSL_get_peer_certificate(const SSL *s); + +OPENSSL_EXPORT STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); + +OPENSSL_EXPORT int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); +OPENSSL_EXPORT int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); +OPENSSL_EXPORT int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))( + int, X509_STORE_CTX *); +OPENSSL_EXPORT void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, + int (*callback)(int, X509_STORE_CTX *)); +OPENSSL_EXPORT void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); +OPENSSL_EXPORT void SSL_CTX_set_cert_verify_callback( + SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *, void *), void *arg); +OPENSSL_EXPORT void SSL_CTX_set_cert_cb(SSL_CTX *c, + int (*cb)(SSL *ssl, void *arg), + void *arg); +OPENSSL_EXPORT int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); +OPENSSL_EXPORT int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, + const uint8_t *d, long len); +OPENSSL_EXPORT int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); +OPENSSL_EXPORT int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, + const uint8_t *d, long len); +OPENSSL_EXPORT int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); +OPENSSL_EXPORT int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, + const uint8_t *d); + +OPENSSL_EXPORT void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, + pem_password_cb *cb); +OPENSSL_EXPORT void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, + void *u); + +OPENSSL_EXPORT int SSL_CTX_check_private_key(const SSL_CTX *ctx); +OPENSSL_EXPORT int SSL_check_private_key(const SSL *ctx); + +OPENSSL_EXPORT int SSL_CTX_set_session_id_context(SSL_CTX *ctx, + const uint8_t *sid_ctx, + unsigned int sid_ctx_len); + +OPENSSL_EXPORT int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx, + unsigned int sid_ctx_len); + +OPENSSL_EXPORT int SSL_CTX_set_purpose(SSL_CTX *s, int purpose); +OPENSSL_EXPORT int SSL_set_purpose(SSL *s, int purpose); +OPENSSL_EXPORT int SSL_CTX_set_trust(SSL_CTX *s, int trust); +OPENSSL_EXPORT int SSL_set_trust(SSL *s, int trust); + +OPENSSL_EXPORT int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); +OPENSSL_EXPORT int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); + +OPENSSL_EXPORT X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); +OPENSSL_EXPORT X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); + +OPENSSL_EXPORT void SSL_certs_clear(SSL *s); +OPENSSL_EXPORT int SSL_accept(SSL *ssl); +OPENSSL_EXPORT int SSL_connect(SSL *ssl); +OPENSSL_EXPORT int SSL_read(SSL *ssl, void *buf, int num); +OPENSSL_EXPORT int SSL_peek(SSL *ssl, void *buf, int num); +OPENSSL_EXPORT int SSL_write(SSL *ssl, const void *buf, int num); +OPENSSL_EXPORT long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); +OPENSSL_EXPORT long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); + +OPENSSL_EXPORT int SSL_get_error(const SSL *s, int ret_code); +/* SSL_get_version returns a string describing the TLS version used by |s|. For + * example, "TLSv1.2" or "SSLv3". */ +OPENSSL_EXPORT const char *SSL_get_version(const SSL *s); +/* SSL_SESSION_get_version returns a string describing the TLS version used by + * |sess|. For example, "TLSv1.2" or "SSLv3". */ +OPENSSL_EXPORT const char *SSL_SESSION_get_version(const SSL_SESSION *sess); + +OPENSSL_EXPORT STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); + +OPENSSL_EXPORT int SSL_do_handshake(SSL *s); + +/* SSL_renegotiate_pending returns one if |ssl| is in the middle of a + * renegotiation. */ +OPENSSL_EXPORT int SSL_renegotiate_pending(SSL *ssl); + +OPENSSL_EXPORT int SSL_shutdown(SSL *s); + +OPENSSL_EXPORT const char *SSL_alert_type_string_long(int value); +OPENSSL_EXPORT const char *SSL_alert_type_string(int value); +OPENSSL_EXPORT const char *SSL_alert_desc_string_long(int value); +OPENSSL_EXPORT const char *SSL_alert_desc_string(int value); + +OPENSSL_EXPORT void SSL_set_client_CA_list(SSL *s, + STACK_OF(X509_NAME) *name_list); +OPENSSL_EXPORT void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, + STACK_OF(X509_NAME) *name_list); +OPENSSL_EXPORT STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); +OPENSSL_EXPORT STACK_OF(X509_NAME) * + SSL_CTX_get_client_CA_list(const SSL_CTX *s); +OPENSSL_EXPORT int SSL_add_client_CA(SSL *ssl, X509 *x); +OPENSSL_EXPORT int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); + +OPENSSL_EXPORT long SSL_get_default_timeout(const SSL *s); + +OPENSSL_EXPORT STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); + +OPENSSL_EXPORT X509 *SSL_get_certificate(const SSL *ssl); +OPENSSL_EXPORT EVP_PKEY *SSL_get_privatekey(const SSL *ssl); + +OPENSSL_EXPORT X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); +OPENSSL_EXPORT EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); + +OPENSSL_EXPORT void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); +OPENSSL_EXPORT int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); +OPENSSL_EXPORT void SSL_set_quiet_shutdown(SSL *ssl, int mode); +OPENSSL_EXPORT int SSL_get_quiet_shutdown(const SSL *ssl); +OPENSSL_EXPORT void SSL_set_shutdown(SSL *ssl, int mode); +OPENSSL_EXPORT int SSL_get_shutdown(const SSL *ssl); +OPENSSL_EXPORT int SSL_version(const SSL *ssl); +OPENSSL_EXPORT int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); +OPENSSL_EXPORT int SSL_CTX_load_verify_locations(SSL_CTX *ctx, + const char *CAfile, + const char *CApath); +#define SSL_get0_session SSL_get_session /* just peek at pointer */ +OPENSSL_EXPORT SSL_SESSION *SSL_get_session(const SSL *ssl); +OPENSSL_EXPORT SSL_SESSION *SSL_get1_session( + SSL *ssl); /* obtain a reference count */ +OPENSSL_EXPORT SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); +OPENSSL_EXPORT SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); +OPENSSL_EXPORT void SSL_set_info_callback(SSL *ssl, + void (*cb)(const SSL *ssl, int type, + int val)); +OPENSSL_EXPORT void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl, + int type, int val); +OPENSSL_EXPORT int SSL_state(const SSL *ssl); + +OPENSSL_EXPORT void SSL_set_verify_result(SSL *ssl, long v); +OPENSSL_EXPORT long SSL_get_verify_result(const SSL *ssl); + +OPENSSL_EXPORT int SSL_set_ex_data(SSL *ssl, int idx, void *data); +OPENSSL_EXPORT void *SSL_get_ex_data(const SSL *ssl, int idx); +OPENSSL_EXPORT int SSL_get_ex_new_index(long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); + +OPENSSL_EXPORT int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, + void *data); +OPENSSL_EXPORT void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); +OPENSSL_EXPORT int SSL_SESSION_get_ex_new_index(long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); + +OPENSSL_EXPORT int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); +OPENSSL_EXPORT void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); +OPENSSL_EXPORT int SSL_CTX_get_ex_new_index(long argl, void *argp, + CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); + +OPENSSL_EXPORT int SSL_get_ex_data_X509_STORE_CTX_idx(void); + +/* SSL_CTX_sess_set_cache_size sets the maximum size of |ctx|'s session cache to + * |size|. It returns the previous value. */ +OPENSSL_EXPORT unsigned long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, + unsigned long size); + +/* SSL_CTX_sess_get_cache_size returns the maximum size of |ctx|'s session + * cache. */ +OPENSSL_EXPORT unsigned long SSL_CTX_sess_get_cache_size(const SSL_CTX *ctx); + +/* SSL_SESS_CACHE_* are the possible session cache mode bits. + * TODO(davidben): Document. */ +#define SSL_SESS_CACHE_OFF 0x0000 +#define SSL_SESS_CACHE_CLIENT 0x0001 +#define SSL_SESS_CACHE_SERVER 0x0002 +#define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT | SSL_SESS_CACHE_SERVER) +#define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 +#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 +#define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 +#define SSL_SESS_CACHE_NO_INTERNAL \ + (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | SSL_SESS_CACHE_NO_INTERNAL_STORE) + +/* SSL_CTX_set_session_cache_mode sets the session cache mode bits for |ctx| to + * |mode|. It returns the previous value. */ +OPENSSL_EXPORT int SSL_CTX_set_session_cache_mode(SSL_CTX *ctx, int mode); + +/* SSL_CTX_get_session_cache_mode returns the session cache mode bits for + * |ctx| */ +OPENSSL_EXPORT int SSL_CTX_get_session_cache_mode(const SSL_CTX *ctx); + +/* SSL_CTX_get_max_cert_list returns the maximum length, in bytes, of a peer + * certificate chain accepted by |ctx|. */ +OPENSSL_EXPORT size_t SSL_CTX_get_max_cert_list(const SSL_CTX *ctx); + +/* SSL_CTX_set_max_cert_list sets the maximum length, in bytes, of a peer + * certificate chain to |max_cert_list|. This affects how much memory may be + * consumed during the handshake. */ +OPENSSL_EXPORT void SSL_CTX_set_max_cert_list(SSL_CTX *ctx, + size_t max_cert_list); + +/* SSL_get_max_cert_list returns the maximum length, in bytes, of a peer + * certificate chain accepted by |ssl|. */ +OPENSSL_EXPORT size_t SSL_get_max_cert_list(const SSL *ssl); + +/* SSL_set_max_cert_list sets the maximum length, in bytes, of a peer + * certificate chain to |max_cert_list|. This affects how much memory may be + * consumed during the handshake. */ +OPENSSL_EXPORT void SSL_set_max_cert_list(SSL *ssl, size_t max_cert_list); + +/* SSL_CTX_set_max_send_fragment sets the maximum length, in bytes, of records + * sent by |ctx|. Beyond this length, handshake messages and application data + * will be split into multiple records. */ +OPENSSL_EXPORT void SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, + size_t max_send_fragment); + +/* SSL_set_max_send_fragment sets the maximum length, in bytes, of records + * sent by |ssl|. Beyond this length, handshake messages and application data + * will be split into multiple records. */ +OPENSSL_EXPORT void SSL_set_max_send_fragment(SSL *ssl, + size_t max_send_fragment); + +/* SSL_CTX_set_tmp_dh_callback configures |ctx| to use |callback| to determine + * the group for DHE ciphers. |callback| should ignore |is_export| and + * |keylength| and return a |DH| of the selected group or NULL on error. Only + * the parameters are used, so the |DH| needn't have a generated keypair. + * + * WARNING: The caller does not take ownership of the resulting |DH|, so + * |callback| must save and release the object elsewhere. */ +OPENSSL_EXPORT void SSL_CTX_set_tmp_dh_callback( + SSL_CTX *ctx, DH *(*callback)(SSL *ssl, int is_export, int keylength)); + +/* SSL_set_tmp_dh_callback configures |ssl| to use |callback| to determine the + * group for DHE ciphers. |callback| should ignore |is_export| and |keylength| + * and return a |DH| of the selected group or NULL on error. Only the + * parameters are used, so the |DH| needn't have a generated keypair. + * + * WARNING: The caller does not take ownership of the resulting |DH|, so + * |callback| must save and release the object elsewhere. */ +OPENSSL_EXPORT void SSL_set_tmp_dh_callback(SSL *ssl, + DH *(*dh)(SSL *ssl, int is_export, + int keylength)); + +/* SSL_CTX_set_tmp_ecdh_callback configures |ctx| to use |callback| to determine + * the curve for ephemeral ECDH keys. |callback| should ignore |is_export| and + * |keylength| and return an |EC_KEY| of the selected curve or NULL on + * error. Only the curve is used, so the |EC_KEY| needn't have a generated + * keypair. + * + * If the callback is unset, an appropriate curve will be chosen automatically. + * (This is recommended.) + * + * WARNING: The caller does not take ownership of the resulting |EC_KEY|, so + * |callback| must save and release the object elsewhere. */ +OPENSSL_EXPORT void SSL_CTX_set_tmp_ecdh_callback( + SSL_CTX *ctx, EC_KEY *(*callback)(SSL *ssl, int is_export, int keylength)); + +/* SSL_set_tmp_ecdh_callback configures |ssl| to use |callback| to determine the + * curve for ephemeral ECDH keys. |callback| should ignore |is_export| and + * |keylength| and return an |EC_KEY| of the selected curve or NULL on + * error. Only the curve is used, so the |EC_KEY| needn't have a generated + * keypair. + * + * If the callback is unset, an appropriate curve will be chosen automatically. + * (This is recommended.) + * + * WARNING: The caller does not take ownership of the resulting |EC_KEY|, so + * |callback| must save and release the object elsewhere. */ +OPENSSL_EXPORT void SSL_set_tmp_ecdh_callback( + SSL *ssl, EC_KEY *(*callback)(SSL *ssl, int is_export, int keylength)); + +OPENSSL_EXPORT const void *SSL_get_current_compression(SSL *s); +OPENSSL_EXPORT const void *SSL_get_current_expansion(SSL *s); + +OPENSSL_EXPORT int SSL_cache_hit(SSL *s); +OPENSSL_EXPORT int SSL_is_server(SSL *s); + +/* SSL_CTX_set_dos_protection_cb sets a callback that is called once the + * resumption decision for a ClientHello has been made. It can return 1 to + * allow the handshake to continue or zero to cause the handshake to abort. */ +OPENSSL_EXPORT void SSL_CTX_set_dos_protection_cb( + SSL_CTX *ctx, int (*cb)(const struct ssl_early_callback_ctx *)); + +/* SSL_get_structure_sizes returns the sizes of the SSL, SSL_CTX and + * SSL_SESSION structures so that a test can ensure that outside code agrees on + * these values. */ +OPENSSL_EXPORT void SSL_get_structure_sizes(size_t *ssl_size, + size_t *ssl_ctx_size, + size_t *ssl_session_size); + +OPENSSL_EXPORT void ERR_load_SSL_strings(void); + +/* SSL_get_rc4_state sets |*read_key| and |*write_key| to the RC4 states for + * the read and write directions. It returns one on success or zero if |ssl| + * isn't using an RC4-based cipher suite. */ +OPENSSL_EXPORT int SSL_get_rc4_state(const SSL *ssl, const RC4_KEY **read_key, + const RC4_KEY **write_key); + + +/* Deprecated functions. */ + +/* SSL_CIPHER_description writes a description of |cipher| into |buf| and + * returns |buf|. If |buf| is NULL, it returns a newly allocated string, to be + * freed with |OPENSSL_free|, or NULL on error. + * + * The description includes a trailing newline and has the form: + * AES128-SHA SSLv3 Kx=RSA Au=RSA Enc=AES(128) Mac=SHA1 + * + * Consider |SSL_CIPHER_get_name| or |SSL_CIPHER_get_rfc_name| instead. */ +OPENSSL_EXPORT const char *SSL_CIPHER_description(const SSL_CIPHER *cipher, + char *buf, int len); + +/* SSL_CIPHER_get_version returns the string "TLSv1/SSLv3". */ +OPENSSL_EXPORT const char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher); + +/* SSL_COMP_get_compression_methods returns NULL. */ +OPENSSL_EXPORT void *SSL_COMP_get_compression_methods(void); + +/* SSL_COMP_add_compression_method returns one. */ +OPENSSL_EXPORT int SSL_COMP_add_compression_method(int id, void *cm); + +/* SSL_COMP_get_name returns NULL. */ +OPENSSL_EXPORT const char *SSL_COMP_get_name(const void *comp); + +/* SSLv23_method calls |TLS_method|. */ +OPENSSL_EXPORT const SSL_METHOD *SSLv23_method(void); + +/* Version-specific methods behave exactly like |TLS_method| and |DTLS_method| + * except they also call |SSL_CTX_set_min_version| and |SSL_CTX_set_max_version| + * to lock connections to that protocol version. */ +OPENSSL_EXPORT const SSL_METHOD *SSLv3_method(void); +OPENSSL_EXPORT const SSL_METHOD *TLSv1_method(void); +OPENSSL_EXPORT const SSL_METHOD *TLSv1_1_method(void); +OPENSSL_EXPORT const SSL_METHOD *TLSv1_2_method(void); +OPENSSL_EXPORT const SSL_METHOD *DTLSv1_method(void); +OPENSSL_EXPORT const SSL_METHOD *DTLSv1_2_method(void); + +/* Client- and server-specific methods call their corresponding generic + * methods. */ +OPENSSL_EXPORT const SSL_METHOD *SSLv23_server_method(void); +OPENSSL_EXPORT const SSL_METHOD *SSLv23_client_method(void); +OPENSSL_EXPORT const SSL_METHOD *SSLv3_server_method(void); +OPENSSL_EXPORT const SSL_METHOD *SSLv3_client_method(void); +OPENSSL_EXPORT const SSL_METHOD *TLSv1_server_method(void); +OPENSSL_EXPORT const SSL_METHOD *TLSv1_client_method(void); +OPENSSL_EXPORT const SSL_METHOD *TLSv1_1_server_method(void); +OPENSSL_EXPORT const SSL_METHOD *TLSv1_1_client_method(void); +OPENSSL_EXPORT const SSL_METHOD *TLSv1_2_server_method(void); +OPENSSL_EXPORT const SSL_METHOD *TLSv1_2_client_method(void); +OPENSSL_EXPORT const SSL_METHOD *DTLS_server_method(void); +OPENSSL_EXPORT const SSL_METHOD *DTLS_client_method(void); +OPENSSL_EXPORT const SSL_METHOD *DTLSv1_server_method(void); +OPENSSL_EXPORT const SSL_METHOD *DTLSv1_client_method(void); +OPENSSL_EXPORT const SSL_METHOD *DTLSv1_2_server_method(void); +OPENSSL_EXPORT const SSL_METHOD *DTLSv1_2_client_method(void); + +/* SSL_clear resets |ssl| to allow another connection and returns one on success + * or zero on failure. It returns most configuration state but releases memory + * associated with the current connection. + * + * Free |ssl| and create a new one instead. */ +OPENSSL_EXPORT int SSL_clear(SSL *ssl); + +/* SSL_CTX_set_tmp_rsa_callback does nothing. */ +OPENSSL_EXPORT void SSL_CTX_set_tmp_rsa_callback( + SSL_CTX *ctx, RSA *(*cb)(SSL *ssl, int is_export, int keylength)); + +/* SSL_set_tmp_rsa_callback does nothing. */ +OPENSSL_EXPORT void SSL_set_tmp_rsa_callback(SSL *ssl, + RSA *(*cb)(SSL *ssl, int is_export, + int keylength)); + +/* SSL_CTX_sess_connect returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_connect(const SSL_CTX *ctx); + +/* SSL_CTX_sess_connect_good returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_connect_good(const SSL_CTX *ctx); + +/* SSL_CTX_sess_connect_renegotiate returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_connect_renegotiate(const SSL_CTX *ctx); + +/* SSL_CTX_sess_accept returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_accept(const SSL_CTX *ctx); + +/* SSL_CTX_sess_accept_renegotiate returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_accept_renegotiate(const SSL_CTX *ctx); + +/* SSL_CTX_sess_accept_good returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_accept_good(const SSL_CTX *ctx); + +/* SSL_CTX_sess_hits returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_hits(const SSL_CTX *ctx); + +/* SSL_CTX_sess_cb_hits returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_cb_hits(const SSL_CTX *ctx); + +/* SSL_CTX_sess_misses returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_misses(const SSL_CTX *ctx); + +/* SSL_CTX_sess_timeouts returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_timeouts(const SSL_CTX *ctx); + +/* SSL_CTX_sess_cache_full returns zero. */ +OPENSSL_EXPORT int SSL_CTX_sess_cache_full(const SSL_CTX *ctx); + +/* SSL_cutthrough_complete calls |SSL_in_false_start|. */ +OPENSSL_EXPORT int SSL_cutthrough_complete(const SSL *s); + +/* SSL_num_renegotiations calls |SSL_total_renegotiations|. */ +OPENSSL_EXPORT int SSL_num_renegotiations(const SSL *ssl); + +/* SSL_CTX_need_tmp_RSA returns zero. */ +OPENSSL_EXPORT int SSL_CTX_need_tmp_RSA(const SSL_CTX *ctx); + +/* SSL_need_tmp_RSA returns zero. */ +OPENSSL_EXPORT int SSL_need_tmp_RSA(const SSL *ssl); + +/* SSL_CTX_set_tmp_rsa returns one. */ +OPENSSL_EXPORT int SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, const RSA *rsa); + +/* SSL_set_tmp_rsa returns one. */ +OPENSSL_EXPORT int SSL_set_tmp_rsa(SSL *ssl, const RSA *rsa); + +/* SSL_CTX_get_read_head returns zero. */ +OPENSSL_EXPORT int SSL_CTX_get_read_ahead(const SSL_CTX *ctx); + +/* SSL_CTX_set_read_ahead does nothing. */ +OPENSSL_EXPORT void SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes); + +/* SSL_get_read_head returns zero. */ +OPENSSL_EXPORT int SSL_get_read_ahead(const SSL *s); + +/* SSL_set_read_ahead does nothing. */ +OPENSSL_EXPORT void SSL_set_read_ahead(SSL *s, int yes); + +/* SSL_renegotiate put an error on the error queue and returns zero. */ +OPENSSL_EXPORT int SSL_renegotiate(SSL *ssl); + +/* SSL_set_state does nothing. */ +OPENSSL_EXPORT void SSL_set_state(SSL *ssl, int state); + + +/* Android compatibility section. + * + * These functions are declared, temporarily, for Android because + * wpa_supplicant will take a little time to sync with upstream. Outside of + * Android they'll have no definition. */ + +#define SSL_F_SSL_SET_SESSION_TICKET_EXT doesnt_exist + +OPENSSL_EXPORT int SSL_set_session_ticket_ext(SSL *s, void *ext_data, + int ext_len); +OPENSSL_EXPORT int SSL_set_session_secret_cb(SSL *s, void *cb, void *arg); +OPENSSL_EXPORT int SSL_set_session_ticket_ext_cb(SSL *s, void *cb, void *arg); +OPENSSL_EXPORT int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); + +#define OPENSSL_VERSION_TEXT "BoringSSL" + +#define SSLEAY_VERSION 0 + +/* SSLeay_version is a compatibility function that returns the string + * "BoringSSL". */ +OPENSSL_EXPORT const char *SSLeay_version(int unused); + + +/* Preprocessor compatibility section. + * + * Historically, a number of APIs were implemented in OpenSSL as macros and + * constants to 'ctrl' functions. To avoid breaking #ifdefs in consumers, this + * section defines a number of legacy macros. */ + +#define SSL_CTRL_NEED_TMP_RSA doesnt_exist +#define SSL_CTRL_SET_TMP_RSA doesnt_exist +#define SSL_CTRL_SET_TMP_DH doesnt_exist +#define SSL_CTRL_SET_TMP_ECDH doesnt_exist +#define SSL_CTRL_SET_TMP_RSA_CB doesnt_exist +#define SSL_CTRL_SET_TMP_DH_CB doesnt_exist +#define SSL_CTRL_SET_TMP_ECDH_CB doesnt_exist +#define SSL_CTRL_GET_SESSION_REUSED doesnt_exist +#define SSL_CTRL_GET_NUM_RENEGOTIATIONS doesnt_exist +#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS doesnt_exist +#define SSL_CTRL_SET_MSG_CALLBACK doesnt_exist +#define SSL_CTRL_SET_MSG_CALLBACK_ARG doesnt_exist +#define SSL_CTRL_SET_MTU doesnt_exist +#define SSL_CTRL_SESS_NUMBER doesnt_exist +#define SSL_CTRL_OPTIONS doesnt_exist +#define SSL_CTRL_MODE doesnt_exist +#define SSL_CTRL_GET_READ_AHEAD doesnt_exist +#define SSL_CTRL_SET_READ_AHEAD doesnt_exist +#define SSL_CTRL_SET_SESS_CACHE_SIZE doesnt_exist +#define SSL_CTRL_GET_SESS_CACHE_SIZE doesnt_exist +#define SSL_CTRL_SET_SESS_CACHE_MODE doesnt_exist +#define SSL_CTRL_GET_SESS_CACHE_MODE doesnt_exist +#define SSL_CTRL_GET_MAX_CERT_LIST doesnt_exist +#define SSL_CTRL_SET_MAX_CERT_LIST doesnt_exist +#define SSL_CTRL_SET_MAX_SEND_FRAGMENT doesnt_exist +#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB doesnt_exist +#define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG doesnt_exist +#define SSL_CTRL_SET_TLSEXT_HOSTNAME doesnt_exist +#define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB doesnt_exist +#define DTLS_CTRL_GET_TIMEOUT doesnt_exist +#define DTLS_CTRL_HANDLE_TIMEOUT doesnt_exist +#define SSL_CTRL_GET_RI_SUPPORT doesnt_exist +#define SSL_CTRL_CLEAR_OPTIONS doesnt_exist +#define SSL_CTRL_CLEAR_MODE doesnt_exist +#define SSL_CTRL_CHANNEL_ID doesnt_exist +#define SSL_CTRL_GET_CHANNEL_ID doesnt_exist +#define SSL_CTRL_SET_CHANNEL_ID doesnt_exist + +#define SSL_CTX_need_tmp_RSA SSL_CTX_need_tmp_RSA +#define SSL_need_tmp_RSA SSL_need_tmp_RSA +#define SSL_CTX_set_tmp_rsa SSL_CTX_set_tmp_rsa +#define SSL_set_tmp_rsa SSL_set_tmp_rsa +#define SSL_CTX_set_tmp_dh SSL_CTX_set_tmp_dh +#define SSL_set_tmp_dh SSL_set_tmp_dh +#define SSL_CTX_set_tmp_ecdh SSL_CTX_set_tmp_ecdh +#define SSL_set_tmp_ecdh SSL_set_tmp_ecdh +#define SSL_session_reused SSL_session_reused +#define SSL_num_renegotiations SSL_num_renegotiations +#define SSL_total_renegotiations SSL_total_renegotiations +#define SSL_CTX_set_msg_callback_arg SSL_CTX_set_msg_callback_arg +#define SSL_set_msg_callback_arg SSL_set_msg_callback_arg +#define SSL_set_mtu SSL_set_mtu +#define SSL_CTX_sess_number SSL_CTX_sess_number +#define SSL_CTX_get_options SSL_CTX_get_options +#define SSL_CTX_set_options SSL_CTX_set_options +#define SSL_get_options SSL_get_options +#define SSL_set_options SSL_set_options +#define SSL_CTX_get_mode SSL_CTX_get_mode +#define SSL_CTX_set_mode SSL_CTX_set_mode +#define SSL_get_mode SSL_get_mode +#define SSL_set_mode SSL_set_mode +#define SSL_CTX_get_read_ahead SSL_CTX_get_read_ahead +#define SSL_CTX_set_read_ahead SSL_CTX_set_read_ahead +#define SSL_CTX_sess_set_cache_size SSL_CTX_sess_set_cache_size +#define SSL_CTX_sess_get_cache_size SSL_CTX_sess_get_cache_size +#define SSL_CTX_set_session_cache_mode SSL_CTX_set_session_cache_mode +#define SSL_CTX_get_session_cache_mode SSL_CTX_get_session_cache_mode +#define SSL_CTX_get_max_cert_list SSL_CTX_get_max_cert_list +#define SSL_get_max_cert_list SSL_get_max_cert_list +#define SSL_CTX_set_max_cert_list SSL_CTX_set_max_cert_list +#define SSL_set_max_cert_list SSL_set_max_cert_list +#define SSL_CTX_set_max_send_fragment SSL_CTX_set_max_send_fragment +#define SSL_set_max_send_fragment SSL_set_max_send_fragment +#define SSL_CTX_set_tlsext_servername_callback \ + SSL_CTX_set_tlsext_servername_callback +#define SSL_CTX_set_tlsext_servername_arg SSL_CTX_set_tlsext_servername_arg +#define SSL_set_tlsext_host_name SSL_set_tlsext_host_name +#define SSL_CTX_set_tlsext_ticket_key_cb SSL_CTX_set_tlsext_ticket_key_cb +#define DTLSv1_get_timeout DTLSv1_get_timeout +#define DTLSv1_handle_timeout DTLSv1_handle_timeout +#define SSL_get_secure_renegotiation_support \ + SSL_get_secure_renegotiation_support +#define SSL_CTX_clear_options SSL_CTX_clear_options +#define SSL_clear_options SSL_clear_options +#define SSL_CTX_clear_mode SSL_CTX_clear_mode +#define SSL_clear_mode SSL_clear_mode +#define SSL_CTX_enable_tls_channel_id SSL_CTX_enable_tls_channel_id +#define SSL_enable_tls_channel_id SSL_enable_tls_channel_id +#define SSL_set1_tls_channel_id SSL_set1_tls_channel_id +#define SSL_CTX_set1_tls_channel_id SSL_CTX_set1_tls_channel_id +#define SSL_get_tls_channel_id SSL_get_tls_channel_id + + +#if defined(__cplusplus) +} /* extern C */ +#endif + + +/* Library consumers assume these headers are included by ssl.h, but they depend + * on ssl.h, so include them after all declarations. + * + * TODO(davidben): The separation between ssl.h and these version-specific + * headers introduces circular dependencies and is inconsistent. The function + * declarations should move to ssl.h. Many of the constants can probably be + * pruned or unexported. */ +#include +#include +#include /* This is mostly sslv3 with a few tweaks */ +#include +#include /* Support for the use_srtp extension */ + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script make_errors.go. Any + * changes made after this point may be overwritten when the script is next run. + */ +#define SSL_F_SSL_CTX_check_private_key 100 +#define SSL_F_SSL_CTX_new 101 +#define SSL_F_SSL_CTX_set_cipher_list 102 +#define SSL_F_SSL_CTX_set_cipher_list_tls11 103 +#define SSL_F_SSL_CTX_set_session_id_context 104 +#define SSL_F_SSL_CTX_use_PrivateKey 105 +#define SSL_F_SSL_CTX_use_PrivateKey_ASN1 106 +#define SSL_F_SSL_CTX_use_PrivateKey_file 107 +#define SSL_F_SSL_CTX_use_RSAPrivateKey 108 +#define SSL_F_SSL_CTX_use_RSAPrivateKey_ASN1 109 +#define SSL_F_SSL_CTX_use_RSAPrivateKey_file 110 +#define SSL_F_SSL_CTX_use_certificate 111 +#define SSL_F_SSL_CTX_use_certificate_ASN1 112 +#define SSL_F_SSL_CTX_use_certificate_chain_file 113 +#define SSL_F_SSL_CTX_use_certificate_file 114 +#define SSL_F_SSL_CTX_use_psk_identity_hint 115 +#define SSL_F_SSL_SESSION_new 116 +#define SSL_F_SSL_SESSION_print_fp 117 +#define SSL_F_SSL_SESSION_set1_id_context 118 +#define SSL_F_SSL_SESSION_to_bytes_full 119 +#define SSL_F_SSL_accept 120 +#define SSL_F_SSL_add_dir_cert_subjects_to_stack 121 +#define SSL_F_SSL_add_file_cert_subjects_to_stack 122 +#define SSL_F_SSL_check_private_key 123 +#define SSL_F_SSL_clear 124 +#define SSL_F_SSL_connect 125 +#define SSL_F_SSL_do_handshake 126 +#define SSL_F_SSL_load_client_CA_file 127 +#define SSL_F_SSL_new 128 +#define SSL_F_SSL_peek 129 +#define SSL_F_SSL_read 130 +#define SSL_F_SSL_renegotiate 131 +#define SSL_F_SSL_set_cipher_list 132 +#define SSL_F_SSL_set_fd 133 +#define SSL_F_SSL_set_rfd 134 +#define SSL_F_SSL_set_session_id_context 135 +#define SSL_F_SSL_set_wfd 136 +#define SSL_F_SSL_shutdown 137 +#define SSL_F_SSL_use_PrivateKey 138 +#define SSL_F_SSL_use_PrivateKey_ASN1 139 +#define SSL_F_SSL_use_PrivateKey_file 140 +#define SSL_F_SSL_use_RSAPrivateKey 141 +#define SSL_F_SSL_use_RSAPrivateKey_ASN1 142 +#define SSL_F_SSL_use_RSAPrivateKey_file 143 +#define SSL_F_SSL_use_certificate 144 +#define SSL_F_SSL_use_certificate_ASN1 145 +#define SSL_F_SSL_use_certificate_file 146 +#define SSL_F_SSL_use_psk_identity_hint 147 +#define SSL_F_SSL_write 148 +#define SSL_F_d2i_SSL_SESSION 149 +#define SSL_F_d2i_SSL_SESSION_get_octet_string 150 +#define SSL_F_d2i_SSL_SESSION_get_string 151 +#define SSL_F_do_ssl3_write 152 +#define SSL_F_dtls1_accept 153 +#define SSL_F_dtls1_buffer_record 154 +#define SSL_F_dtls1_check_timeout_num 155 +#define SSL_F_dtls1_connect 156 +#define SSL_F_dtls1_do_write 157 +#define SSL_F_dtls1_get_hello_verify 158 +#define SSL_F_dtls1_get_message 159 +#define SSL_F_dtls1_get_message_fragment 160 +#define SSL_F_dtls1_preprocess_fragment 161 +#define SSL_F_dtls1_process_record 162 +#define SSL_F_dtls1_read_bytes 163 +#define SSL_F_dtls1_send_hello_verify_request 164 +#define SSL_F_dtls1_write_app_data 165 +#define SSL_F_i2d_SSL_SESSION 166 +#define SSL_F_ssl3_accept 167 +#define SSL_F_ssl3_cert_verify_hash 169 +#define SSL_F_ssl3_check_cert_and_algorithm 170 +#define SSL_F_ssl3_connect 171 +#define SSL_F_ssl3_ctrl 172 +#define SSL_F_ssl3_ctx_ctrl 173 +#define SSL_F_ssl3_digest_cached_records 174 +#define SSL_F_ssl3_do_change_cipher_spec 175 +#define SSL_F_ssl3_expect_change_cipher_spec 176 +#define SSL_F_ssl3_get_cert_status 177 +#define SSL_F_ssl3_get_cert_verify 178 +#define SSL_F_ssl3_get_certificate_request 179 +#define SSL_F_ssl3_get_channel_id 180 +#define SSL_F_ssl3_get_client_certificate 181 +#define SSL_F_ssl3_get_client_hello 182 +#define SSL_F_ssl3_get_client_key_exchange 183 +#define SSL_F_ssl3_get_finished 184 +#define SSL_F_ssl3_get_initial_bytes 185 +#define SSL_F_ssl3_get_message 186 +#define SSL_F_ssl3_get_new_session_ticket 187 +#define SSL_F_ssl3_get_next_proto 188 +#define SSL_F_ssl3_get_record 189 +#define SSL_F_ssl3_get_server_certificate 190 +#define SSL_F_ssl3_get_server_done 191 +#define SSL_F_ssl3_get_server_hello 192 +#define SSL_F_ssl3_get_server_key_exchange 193 +#define SSL_F_ssl3_get_v2_client_hello 194 +#define SSL_F_ssl3_handshake_mac 195 +#define SSL_F_ssl3_prf 196 +#define SSL_F_ssl3_read_bytes 197 +#define SSL_F_ssl3_read_n 198 +#define SSL_F_ssl3_send_cert_verify 199 +#define SSL_F_ssl3_send_certificate_request 200 +#define SSL_F_ssl3_send_channel_id 201 +#define SSL_F_ssl3_send_client_certificate 202 +#define SSL_F_ssl3_send_client_hello 203 +#define SSL_F_ssl3_send_client_key_exchange 204 +#define SSL_F_ssl3_send_server_certificate 205 +#define SSL_F_ssl3_send_server_hello 206 +#define SSL_F_ssl3_send_server_key_exchange 207 +#define SSL_F_ssl3_setup_read_buffer 208 +#define SSL_F_ssl3_setup_write_buffer 209 +#define SSL_F_ssl3_write_bytes 210 +#define SSL_F_ssl3_write_pending 211 +#define SSL_F_ssl_add_cert_chain 212 +#define SSL_F_ssl_add_cert_to_buf 213 +#define SSL_F_ssl_add_clienthello_renegotiate_ext 214 +#define SSL_F_ssl_add_clienthello_tlsext 215 +#define SSL_F_ssl_add_clienthello_use_srtp_ext 216 +#define SSL_F_ssl_add_serverhello_renegotiate_ext 217 +#define SSL_F_ssl_add_serverhello_tlsext 218 +#define SSL_F_ssl_add_serverhello_use_srtp_ext 219 +#define SSL_F_ssl_build_cert_chain 220 +#define SSL_F_ssl_bytes_to_cipher_list 221 +#define SSL_F_ssl_cert_dup 222 +#define SSL_F_ssl_cert_inst 223 +#define SSL_F_ssl_cert_new 224 +#define SSL_F_ssl_check_serverhello_tlsext 225 +#define SSL_F_ssl_check_srvr_ecc_cert_and_alg 226 +#define SSL_F_ssl_cipher_process_rulestr 227 +#define SSL_F_ssl_cipher_strength_sort 228 +#define SSL_F_ssl_create_cipher_list 229 +#define SSL_F_ssl_ctx_log_master_secret 230 +#define SSL_F_ssl_ctx_log_rsa_client_key_exchange 231 +#define SSL_F_ssl_ctx_make_profiles 232 +#define SSL_F_ssl_get_new_session 233 +#define SSL_F_ssl_get_prev_session 234 +#define SSL_F_ssl_get_server_cert_index 235 +#define SSL_F_ssl_get_sign_pkey 236 +#define SSL_F_ssl_init_wbio_buffer 237 +#define SSL_F_ssl_parse_clienthello_renegotiate_ext 238 +#define SSL_F_ssl_parse_clienthello_tlsext 239 +#define SSL_F_ssl_parse_clienthello_use_srtp_ext 240 +#define SSL_F_ssl_parse_serverhello_renegotiate_ext 241 +#define SSL_F_ssl_parse_serverhello_tlsext 242 +#define SSL_F_ssl_parse_serverhello_use_srtp_ext 243 +#define SSL_F_ssl_scan_clienthello_tlsext 244 +#define SSL_F_ssl_scan_serverhello_tlsext 245 +#define SSL_F_ssl_sess_cert_new 246 +#define SSL_F_ssl_set_cert 247 +#define SSL_F_ssl_set_pkey 248 +#define SSL_F_ssl_verify_cert_chain 252 +#define SSL_F_tls12_check_peer_sigalg 253 +#define SSL_F_tls1_aead_ctx_init 254 +#define SSL_F_tls1_cert_verify_mac 255 +#define SSL_F_tls1_change_cipher_state 256 +#define SSL_F_tls1_change_cipher_state_aead 257 +#define SSL_F_tls1_check_duplicate_extensions 258 +#define SSL_F_tls1_enc 259 +#define SSL_F_tls1_export_keying_material 260 +#define SSL_F_tls1_prf 261 +#define SSL_F_tls1_setup_key_block 262 +#define SSL_F_dtls1_get_buffered_message 263 +#define SSL_F_dtls1_process_fragment 264 +#define SSL_F_dtls1_hm_fragment_new 265 +#define SSL_F_ssl3_seal_record 266 +#define SSL_F_ssl3_record_sequence_update 267 +#define SSL_F_SSL_CTX_set_tmp_dh 268 +#define SSL_F_SSL_CTX_set_tmp_ecdh 269 +#define SSL_F_SSL_set_tmp_dh 270 +#define SSL_F_SSL_set_tmp_ecdh 271 +#define SSL_F_SSL_CTX_set1_tls_channel_id 272 +#define SSL_F_SSL_set1_tls_channel_id 273 +#define SSL_F_SSL_set_tlsext_host_name 274 +#define SSL_F_ssl3_output_cert_chain 275 +#define SSL_F_SSL_AEAD_CTX_new 276 +#define SSL_F_SSL_AEAD_CTX_open 277 +#define SSL_F_SSL_AEAD_CTX_seal 278 +#define SSL_F_dtls1_seal_record 279 +#define SSL_R_APP_DATA_IN_HANDSHAKE 100 +#define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 101 +#define SSL_R_BAD_ALERT 102 +#define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 +#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 104 +#define SSL_R_BAD_DH_P_LENGTH 105 +#define SSL_R_BAD_DIGEST_LENGTH 106 +#define SSL_R_BAD_ECC_CERT 107 +#define SSL_R_BAD_ECPOINT 108 +#define SSL_R_BAD_HANDSHAKE_LENGTH 109 +#define SSL_R_BAD_HANDSHAKE_RECORD 110 +#define SSL_R_BAD_HELLO_REQUEST 111 +#define SSL_R_BAD_LENGTH 112 +#define SSL_R_BAD_PACKET_LENGTH 113 +#define SSL_R_BAD_RSA_ENCRYPT 114 +#define SSL_R_BAD_SIGNATURE 115 +#define SSL_R_BAD_SRTP_MKI_VALUE 116 +#define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 117 +#define SSL_R_BAD_SSL_FILETYPE 118 +#define SSL_R_BAD_WRITE_RETRY 119 +#define SSL_R_BIO_NOT_SET 120 +#define SSL_R_BN_LIB 121 +#define SSL_R_CANNOT_SERIALIZE_PUBLIC_KEY 122 +#define SSL_R_CA_DN_LENGTH_MISMATCH 123 +#define SSL_R_CA_DN_TOO_LONG 124 +#define SSL_R_CCS_RECEIVED_EARLY 125 +#define SSL_R_CERTIFICATE_VERIFY_FAILED 126 +#define SSL_R_CERT_CB_ERROR 127 +#define SSL_R_CERT_LENGTH_MISMATCH 128 +#define SSL_R_CHANNEL_ID_NOT_P256 129 +#define SSL_R_CHANNEL_ID_SIGNATURE_INVALID 130 +#define SSL_R_CIPHER_CODE_WRONG_LENGTH 131 +#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 132 +#define SSL_R_CLIENTHELLO_PARSE_FAILED 133 +#define SSL_R_CLIENTHELLO_TLSEXT 134 +#define SSL_R_CONNECTION_REJECTED 135 +#define SSL_R_CONNECTION_TYPE_NOT_SET 136 +#define SSL_R_COOKIE_MISMATCH 137 +#define SSL_R_D2I_ECDSA_SIG 138 +#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 139 +#define SSL_R_DATA_LENGTH_TOO_LONG 140 +#define SSL_R_DECODE_ERROR 141 +#define SSL_R_DECRYPTION_FAILED 142 +#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 143 +#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 144 +#define SSL_R_DIGEST_CHECK_FAILED 145 +#define SSL_R_DTLS_MESSAGE_TOO_BIG 146 +#define SSL_R_ECC_CERT_NOT_FOR_SIGNING 147 +#define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 148 +#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 149 +#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 150 +#define SSL_R_EVP_DIGESTSIGNFINAL_FAILED 151 +#define SSL_R_EVP_DIGESTSIGNINIT_FAILED 152 +#define SSL_R_EXCESSIVE_MESSAGE_SIZE 153 +#define SSL_R_EXTRA_DATA_IN_MESSAGE 154 +#define SSL_R_GOT_A_FIN_BEFORE_A_CCS 155 +#define SSL_R_GOT_CHANNEL_ID_BEFORE_A_CCS 156 +#define SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS 157 +#define SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION 158 +#define SSL_R_HANDSHAKE_FAILURE_ON_CLIENT_HELLO 159 +#define SSL_R_HANDSHAKE_RECORD_BEFORE_CCS 160 +#define SSL_R_HTTPS_PROXY_REQUEST 161 +#define SSL_R_HTTP_REQUEST 162 +#define SSL_R_INAPPROPRIATE_FALLBACK 163 +#define SSL_R_INVALID_COMMAND 164 +#define SSL_R_INVALID_MESSAGE 165 +#define SSL_R_INVALID_SSL_SESSION 166 +#define SSL_R_INVALID_TICKET_KEYS_LENGTH 167 +#define SSL_R_LENGTH_MISMATCH 168 +#define SSL_R_LIBRARY_HAS_NO_CIPHERS 169 +#define SSL_R_MISSING_DH_KEY 170 +#define SSL_R_MISSING_ECDSA_SIGNING_CERT 171 +#define SSL_R_MISSING_RSA_CERTIFICATE 172 +#define SSL_R_MISSING_RSA_ENCRYPTING_CERT 173 +#define SSL_R_MISSING_RSA_SIGNING_CERT 174 +#define SSL_R_MISSING_TMP_DH_KEY 175 +#define SSL_R_MISSING_TMP_ECDH_KEY 176 +#define SSL_R_MIXED_SPECIAL_OPERATOR_WITH_GROUPS 177 +#define SSL_R_MTU_TOO_SMALL 178 +#define SSL_R_NESTED_GROUP 179 +#define SSL_R_NO_CERTIFICATES_RETURNED 180 +#define SSL_R_NO_CERTIFICATE_ASSIGNED 181 +#define SSL_R_NO_CERTIFICATE_SET 182 +#define SSL_R_NO_CIPHERS_AVAILABLE 183 +#define SSL_R_NO_CIPHERS_PASSED 184 +#define SSL_R_NO_CIPHERS_SPECIFIED 185 +#define SSL_R_NO_CIPHER_MATCH 186 +#define SSL_R_NO_COMPRESSION_SPECIFIED 187 +#define SSL_R_NO_METHOD_SPECIFIED 188 +#define SSL_R_NO_P256_SUPPORT 189 +#define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 +#define SSL_R_NO_RENEGOTIATION 191 +#define SSL_R_NO_REQUIRED_DIGEST 192 +#define SSL_R_NO_SHARED_CIPHER 193 +#define SSL_R_NO_SHARED_SIGATURE_ALGORITHMS 194 +#define SSL_R_NO_SRTP_PROFILES 195 +#define SSL_R_NULL_SSL_CTX 196 +#define SSL_R_NULL_SSL_METHOD_PASSED 197 +#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 198 +#define SSL_R_PACKET_LENGTH_TOO_LONG 199 +#define SSL_R_PARSE_TLSEXT 200 +#define SSL_R_PATH_TOO_LONG 201 +#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 202 +#define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 203 +#define SSL_R_PROTOCOL_IS_SHUTDOWN 204 +#define SSL_R_PSK_IDENTITY_NOT_FOUND 205 +#define SSL_R_PSK_NO_CLIENT_CB 206 +#define SSL_R_PSK_NO_SERVER_CB 207 +#define SSL_R_READ_BIO_NOT_SET 208 +#define SSL_R_READ_TIMEOUT_EXPIRED 209 +#define SSL_R_RECORD_LENGTH_MISMATCH 210 +#define SSL_R_RECORD_TOO_LARGE 211 +#define SSL_R_RENEGOTIATE_EXT_TOO_LONG 212 +#define SSL_R_RENEGOTIATION_ENCODING_ERR 213 +#define SSL_R_RENEGOTIATION_MISMATCH 214 +#define SSL_R_REQUIRED_CIPHER_MISSING 215 +#define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 216 +#define SSL_R_SERVERHELLO_TLSEXT 217 +#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 218 +#define SSL_R_SESSION_MAY_NOT_BE_CREATED 219 +#define SSL_R_SIGNATURE_ALGORITHMS_ERROR 220 +#define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 221 +#define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 222 +#define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 223 +#define SSL_R_SSL3_EXT_INVALID_SERVERNAME 224 +#define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 225 +#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 226 +#define SSL_R_SSL_HANDSHAKE_FAILURE 227 +#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 228 +#define SSL_R_SSL_SESSION_ID_CONFLICT 229 +#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 230 +#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 231 +#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER 232 +#define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 233 +#define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 234 +#define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 235 +#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 236 +#define SSL_R_TOO_MANY_EMPTY_FRAGMENTS 237 +#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 238 +#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 +#define SSL_R_UNEXPECTED_GROUP_CLOSE 240 +#define SSL_R_UNEXPECTED_MESSAGE 241 +#define SSL_R_UNEXPECTED_OPERATOR_IN_GROUP 242 +#define SSL_R_UNEXPECTED_RECORD 243 +#define SSL_R_UNINITIALIZED 244 +#define SSL_R_UNKNOWN_ALERT_TYPE 245 +#define SSL_R_UNKNOWN_CERTIFICATE_TYPE 246 +#define SSL_R_UNKNOWN_CIPHER_RETURNED 247 +#define SSL_R_UNKNOWN_CIPHER_TYPE 248 +#define SSL_R_UNKNOWN_DIGEST 249 +#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 +#define SSL_R_UNKNOWN_PROTOCOL 251 +#define SSL_R_UNKNOWN_SSL_VERSION 252 +#define SSL_R_UNKNOWN_STATE 253 +#define SSL_R_UNPROCESSED_HANDSHAKE_DATA 254 +#define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 255 +#define SSL_R_UNSUPPORTED_CIPHER 256 +#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 +#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 258 +#define SSL_R_UNSUPPORTED_PROTOCOL 259 +#define SSL_R_UNSUPPORTED_SSL_VERSION 260 +#define SSL_R_USE_SRTP_NOT_NEGOTIATED 261 +#define SSL_R_WRONG_CERTIFICATE_TYPE 262 +#define SSL_R_WRONG_CIPHER_RETURNED 263 +#define SSL_R_WRONG_CURVE 264 +#define SSL_R_WRONG_MESSAGE_TYPE 265 +#define SSL_R_WRONG_SIGNATURE_TYPE 266 +#define SSL_R_WRONG_SSL_VERSION 267 +#define SSL_R_WRONG_VERSION_NUMBER 268 +#define SSL_R_X509_LIB 269 +#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 270 +#define SSL_R_FRAGMENT_MISMATCH 271 +#define SSL_R_BUFFER_TOO_SMALL 272 +#define SSL_R_OLD_SESSION_VERSION_NOT_RETURNED 273 +#define SSL_R_OUTPUT_ALIASES_INPUT 274 +#define SSL_R_RESUMED_EMS_SESSION_WITHOUT_EMS_EXTENSION 275 +#define SSL_R_EMS_STATE_INCONSISTENT 276 +#define SSL_R_RESUMED_NON_EMS_SESSION_WITH_EMS_EXTENSION 277 +#define SSL_R_SSLV3_ALERT_CLOSE_NOTIFY 1000 +#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 +#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 +#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 +#define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 +#define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 +#define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 +#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 +#define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 +#define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 +#define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +#define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 +#define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 +#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +#define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 +#define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 +#define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 +#define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 +#define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 + +#endif /* OPENSSL_HEADER_SSL_H */ diff --git a/phonelibs/boringssl/include/openssl/ssl2.h b/phonelibs/boringssl/include/openssl/ssl2.h new file mode 100644 index 00000000000000..b8401faaf6684a --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ssl2.h @@ -0,0 +1,268 @@ +/* ssl/ssl2.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SSL2_H +#define HEADER_SSL2_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Protocol Version Codes */ +#define SSL2_VERSION 0x0002 +#define SSL2_VERSION_MAJOR 0x00 +#define SSL2_VERSION_MINOR 0x02 +/* #define SSL2_CLIENT_VERSION 0x0002 */ +/* #define SSL2_SERVER_VERSION 0x0002 */ + +/* Protocol Message Codes */ +#define SSL2_MT_ERROR 0 +#define SSL2_MT_CLIENT_HELLO 1 +#define SSL2_MT_CLIENT_MASTER_KEY 2 +#define SSL2_MT_CLIENT_FINISHED 3 +#define SSL2_MT_SERVER_HELLO 4 +#define SSL2_MT_SERVER_VERIFY 5 +#define SSL2_MT_SERVER_FINISHED 6 +#define SSL2_MT_REQUEST_CERTIFICATE 7 +#define SSL2_MT_CLIENT_CERTIFICATE 8 + +/* Error Message Codes */ +#define SSL2_PE_UNDEFINED_ERROR 0x0000 +#define SSL2_PE_NO_CIPHER 0x0001 +#define SSL2_PE_NO_CERTIFICATE 0x0002 +#define SSL2_PE_BAD_CERTIFICATE 0x0004 +#define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006 + +/* Cipher Kind Values */ +#define SSL2_CK_NULL_WITH_MD5 0x02000000 /* v3 */ +#define SSL2_CK_RC4_128_WITH_MD5 0x02010080 +#define SSL2_CK_RC4_128_EXPORT40_WITH_MD5 0x02020080 +#define SSL2_CK_RC2_128_CBC_WITH_MD5 0x02030080 +#define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5 0x02040080 +#define SSL2_CK_IDEA_128_CBC_WITH_MD5 0x02050080 +#define SSL2_CK_DES_64_CBC_WITH_MD5 0x02060040 +#define SSL2_CK_DES_64_CBC_WITH_SHA 0x02060140 /* v3 */ +#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0 +#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */ +#define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */ + +#define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */ +#define SSL2_CK_NULL 0x02ff0810 /* SSLeay */ + +#define SSL2_TXT_DES_64_CFB64_WITH_MD5_1 "DES-CFB-M1" +#define SSL2_TXT_NULL_WITH_MD5 "NULL-MD5" +#define SSL2_TXT_RC4_128_WITH_MD5 "RC4-MD5" +#define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 "EXP-RC4-MD5" +#define SSL2_TXT_RC2_128_CBC_WITH_MD5 "RC2-CBC-MD5" +#define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 "EXP-RC2-CBC-MD5" +#define SSL2_TXT_IDEA_128_CBC_WITH_MD5 "IDEA-CBC-MD5" +#define SSL2_TXT_DES_64_CBC_WITH_MD5 "DES-CBC-MD5" +#define SSL2_TXT_DES_64_CBC_WITH_SHA "DES-CBC-SHA" +#define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 "DES-CBC3-MD5" +#define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA "DES-CBC3-SHA" +#define SSL2_TXT_RC4_64_WITH_MD5 "RC4-64-MD5" + +#define SSL2_TXT_NULL "NULL" + +/* Flags for the SSL_CIPHER.algorithm2 field */ +#define SSL2_CF_5_BYTE_ENC 0x01 +#define SSL2_CF_8_BYTE_ENC 0x02 + +/* Certificate Type Codes */ +#define SSL2_CT_X509_CERTIFICATE 0x01 + +/* Authentication Type Code */ +#define SSL2_AT_MD5_WITH_RSA_ENCRYPTION 0x01 + +#define SSL2_MAX_SSL_SESSION_ID_LENGTH 32 + +/* Upper/Lower Bounds */ +#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256 +#ifdef OPENSSL_SYS_MPE +#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 29998u +#else +#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */ +#endif +#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */ + +#define SSL2_CHALLENGE_LENGTH 16 +/*#define SSL2_CHALLENGE_LENGTH 32 */ +#define SSL2_MIN_CHALLENGE_LENGTH 16 +#define SSL2_MAX_CHALLENGE_LENGTH 32 +#define SSL2_CONNECTION_ID_LENGTH 16 +#define SSL2_MAX_CONNECTION_ID_LENGTH 16 +#define SSL2_SSL_SESSION_ID_LENGTH 16 +#define SSL2_MAX_CERT_CHALLENGE_LENGTH 32 +#define SSL2_MIN_CERT_CHALLENGE_LENGTH 16 +#define SSL2_MAX_KEY_MATERIAL_LENGTH 24 + +#ifndef OPENSSL_NO_SSL_INTERN + +typedef struct ssl2_state_st + { + int three_byte_header; + int clear_text; /* clear text */ + int escape; /* not used in SSLv2 */ + int ssl2_rollback; /* used if SSLv23 rolled back to SSLv2 */ + + /* non-blocking io info, used to make sure the same + * args were passwd */ + unsigned int wnum; /* number of bytes sent so far */ + int wpend_tot; + const unsigned char *wpend_buf; + + int wpend_off; /* offset to data to write */ + int wpend_len; /* number of bytes passwd to write */ + int wpend_ret; /* number of bytes to return to caller */ + + /* buffer raw data */ + int rbuf_left; + int rbuf_offs; + unsigned char *rbuf; + unsigned char *wbuf; + + unsigned char *write_ptr;/* used to point to the start due to + * 2/3 byte header. */ + + unsigned int padding; + unsigned int rlength; /* passed to ssl2_enc */ + int ract_data_length; /* Set when things are encrypted. */ + unsigned int wlength; /* passed to ssl2_enc */ + int wact_data_length; /* Set when things are decrypted. */ + unsigned char *ract_data; + unsigned char *wact_data; + unsigned char *mac_data; + + unsigned char *read_key; + unsigned char *write_key; + + /* Stuff specifically to do with this SSL session */ + unsigned int challenge_length; + unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH]; + unsigned int conn_id_length; + unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH]; + unsigned int key_material_length; + unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2]; + + unsigned long read_sequence; + unsigned long write_sequence; + + struct { + unsigned int conn_id_length; + unsigned int cert_type; + unsigned int cert_length; + unsigned int csl; + unsigned int clear; + unsigned int enc; + unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH]; + unsigned int cipher_spec_length; + unsigned int session_id_length; + unsigned int clen; + unsigned int rlen; + } tmp; + } SSL2_STATE; + +#endif + +/* SSLv2 */ +/* client */ +#define SSL2_ST_SEND_CLIENT_HELLO_A (0x10|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_HELLO_B (0x11|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_HELLO_A (0x20|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_HELLO_B (0x21|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_MASTER_KEY_A (0x30|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_MASTER_KEY_B (0x31|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_FINISHED_A (0x40|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_FINISHED_B (0x41|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_A (0x50|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_B (0x51|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_C (0x52|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_D (0x53|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_VERIFY_A (0x60|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_VERIFY_B (0x61|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_FINISHED_A (0x70|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_FINISHED_B (0x71|SSL_ST_CONNECT) +#define SSL2_ST_CLIENT_START_ENCRYPTION (0x80|SSL_ST_CONNECT) +#define SSL2_ST_X509_GET_CLIENT_CERTIFICATE (0x90|SSL_ST_CONNECT) +/* server */ +#define SSL2_ST_GET_CLIENT_HELLO_A (0x10|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_HELLO_B (0x11|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_HELLO_C (0x12|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_HELLO_A (0x20|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_HELLO_B (0x21|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_MASTER_KEY_A (0x30|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_MASTER_KEY_B (0x31|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_A (0x40|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_B (0x41|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_C (0x42|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_FINISHED_A (0x50|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_FINISHED_B (0x51|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_FINISHED_A (0x60|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_FINISHED_B (0x61|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_A (0x70|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_B (0x71|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_C (0x72|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_D (0x73|SSL_ST_ACCEPT) +#define SSL2_ST_SERVER_START_ENCRYPTION (0x80|SSL_ST_ACCEPT) +#define SSL2_ST_X509_GET_SERVER_CERTIFICATE (0x90|SSL_ST_ACCEPT) + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/phonelibs/boringssl/include/openssl/ssl23.h b/phonelibs/boringssl/include/openssl/ssl23.h new file mode 100644 index 00000000000000..df395a8e978df7 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ssl23.h @@ -0,0 +1,85 @@ +/* ssl/ssl23.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SSL23_H +#define HEADER_SSL23_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/*client */ +/* write to server */ +#define SSL23_ST_CW_CLNT_HELLO_A (0x210 | SSL_ST_CONNECT) +#define SSL23_ST_CW_CLNT_HELLO_B (0x211 | SSL_ST_CONNECT) +/* read from server */ +#define SSL23_ST_CR_SRVR_HELLO_A (0x220 | SSL_ST_CONNECT) +#define SSL23_ST_CR_SRVR_HELLO_B (0x221 | SSL_ST_CONNECT) + +/* server */ +/* read from client */ +#define SSL23_ST_SR_CLNT_HELLO (0x210 | SSL_ST_ACCEPT) +#define SSL23_ST_SR_V2_CLNT_HELLO (0x220 | SSL_ST_ACCEPT) +#define SSL23_ST_SR_SWITCH_VERSION (0x230 | SSL_ST_ACCEPT) + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/phonelibs/boringssl/include/openssl/ssl3.h b/phonelibs/boringssl/include/openssl/ssl3.h new file mode 100644 index 00000000000000..640a22826ec1c1 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/ssl3.h @@ -0,0 +1,681 @@ +/* ssl/ssl3.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECC cipher suite support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_SSL3_H +#define HEADER_SSL3_H + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Signalling cipher suite value: from RFC5746 */ +#define SSL3_CK_SCSV 0x030000FF +/* Fallback signalling cipher suite value: not IANA assigned. + * See https://tools.ietf.org/html/draft-bmoeller-tls-downgrade-scsv-01 */ +#define SSL3_CK_FALLBACK_SCSV 0x03005600 + +#define SSL3_CK_RSA_NULL_MD5 0x03000001 +#define SSL3_CK_RSA_NULL_SHA 0x03000002 +#define SSL3_CK_RSA_RC4_40_MD5 0x03000003 +#define SSL3_CK_RSA_RC4_128_MD5 0x03000004 +#define SSL3_CK_RSA_RC4_128_SHA 0x03000005 +#define SSL3_CK_RSA_RC2_40_MD5 0x03000006 +#define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 +#define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 +#define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 +#define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A + +#define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B +#define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C +#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D +#define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E +#define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F +#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 + +#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011 +#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012 +#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA 0x03000013 +#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA 0x03000014 +#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA 0x03000015 +#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA 0x03000016 + +#define SSL3_CK_ADH_RC4_40_MD5 0x03000017 +#define SSL3_CK_ADH_RC4_128_MD5 0x03000018 +#define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 +#define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A +#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B + +#define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" +#define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" +#define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" +#define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" +#define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" +#define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" + +#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" +#define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" +#define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" + +#define SSL3_SSL_SESSION_ID_LENGTH 32 +#define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 + +#define SSL3_MASTER_SECRET_SIZE 48 +#define SSL3_RANDOM_SIZE 32 +#define SSL3_SESSION_ID_SIZE 32 +#define SSL3_RT_HEADER_LENGTH 5 + +#define SSL3_HM_HEADER_LENGTH 4 + +#ifndef SSL3_ALIGN_PAYLOAD +/* Some will argue that this increases memory footprint, but it's not actually + * true. Point is that malloc has to return at least 64-bit aligned pointers, + * meaning that allocating 5 bytes wastes 3 bytes in either case. Suggested + * pre-gaping simply moves these wasted bytes from the end of allocated region + * to its front, but makes data payload aligned, which improves performance. */ +#define SSL3_ALIGN_PAYLOAD 8 +#else +#if (SSL3_ALIGN_PAYLOAD & (SSL3_ALIGN_PAYLOAD - 1)) != 0 +#error "insane SSL3_ALIGN_PAYLOAD" +#undef SSL3_ALIGN_PAYLOAD +#endif +#endif + +/* This is the maximum MAC (digest) size used by the SSL library. Currently + * maximum of 20 is used by SHA1, but we reserve for future extension for + * 512-bit hashes. */ + +#define SSL3_RT_MAX_MD_SIZE 64 + +/* Maximum block size used in all ciphersuites. Currently 16 for AES. */ + +#define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 + +#define SSL3_RT_MAX_EXTRA (16384) + +/* Maximum plaintext length: defined by SSL/TLS standards */ +#define SSL3_RT_MAX_PLAIN_LENGTH 16384 +/* Maximum compression overhead: defined by SSL/TLS standards */ +#define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 + +/* The standards give a maximum encryption overhead of 1024 bytes. In practice + * the value is lower than this. The overhead is the maximum number of padding + * bytes (256) plus the mac size. + * + * TODO(davidben): This derivation doesn't take AEADs into account, or TLS 1.1 + * explicit nonces. It happens to work because |SSL3_RT_MAX_MD_SIZE| is larger + * than necessary and no true AEAD has variable overhead in TLS 1.2. */ +#define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) + +/* SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD is the maximum overhead in encrypting a + * record. This does not include the record header. Some ciphers use explicit + * nonces, so it includes both the AEAD overhead as well as the nonce. */ +#define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ + (EVP_AEAD_MAX_OVERHEAD + EVP_AEAD_MAX_NONCE_LENGTH) + +OPENSSL_COMPILE_ASSERT( + SSL3_RT_MAX_ENCRYPTED_OVERHEAD >= SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD, + max_overheads_are_consistent); + +/* SSL3_RT_MAX_COMPRESSED_LENGTH is an alias for + * |SSL3_RT_MAX_PLAIN_LENGTH|. Compression is gone, so don't include the + * compression overhead. */ +#define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH + +#define SSL3_RT_MAX_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_ENCRYPTED_OVERHEAD + SSL3_RT_MAX_COMPRESSED_LENGTH) +#define SSL3_RT_MAX_PACKET_SIZE \ + (SSL3_RT_MAX_ENCRYPTED_LENGTH + SSL3_RT_HEADER_LENGTH) + +#define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" +#define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" + +#define SSL3_VERSION 0x0300 +#define SSL3_VERSION_MAJOR 0x03 +#define SSL3_VERSION_MINOR 0x00 + +#define SSL3_RT_CHANGE_CIPHER_SPEC 20 +#define SSL3_RT_ALERT 21 +#define SSL3_RT_HANDSHAKE 22 +#define SSL3_RT_APPLICATION_DATA 23 + +/* Pseudo content types to indicate additional parameters */ +#define TLS1_RT_CRYPTO 0x1000 +#define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) +#define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) +#define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) +#define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) + +#define TLS1_RT_CRYPTO_READ 0x0000 +#define TLS1_RT_CRYPTO_WRITE 0x0100 +#define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) +#define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) +#define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) +#define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) + +/* Pseudo content type for SSL/TLS header info */ +#define SSL3_RT_HEADER 0x100 + +#define SSL3_AL_WARNING 1 +#define SSL3_AL_FATAL 2 + +#define SSL3_AD_CLOSE_NOTIFY 0 +#define SSL3_AD_UNEXPECTED_MESSAGE 10 /* fatal */ +#define SSL3_AD_BAD_RECORD_MAC 20 /* fatal */ +#define SSL3_AD_DECOMPRESSION_FAILURE 30 /* fatal */ +#define SSL3_AD_HANDSHAKE_FAILURE 40 /* fatal */ +#define SSL3_AD_NO_CERTIFICATE 41 +#define SSL3_AD_BAD_CERTIFICATE 42 +#define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 +#define SSL3_AD_CERTIFICATE_REVOKED 44 +#define SSL3_AD_CERTIFICATE_EXPIRED 45 +#define SSL3_AD_CERTIFICATE_UNKNOWN 46 +#define SSL3_AD_ILLEGAL_PARAMETER 47 /* fatal */ +#define SSL3_AD_INAPPROPRIATE_FALLBACK 86 /* fatal */ + +typedef struct ssl3_record_st { + /* type is the record type. */ + uint8_t type; + /* length is the number of unconsumed bytes of |data|. */ + uint16_t length; + /* off is the number of consumed bytes of |data|. */ + uint16_t off; + /* data is a non-owning pointer to the record contents. The total length of + * the buffer is |off| + |length|. */ + uint8_t *data; + /* epoch, in DTLS, is the epoch number of the record. */ + uint16_t epoch; + /* seq_num, in DTLS, is the sequence number of the record. The top two bytes + * are always zero. + * + * TODO(davidben): This is confusing. They should include the epoch or the + * field should be six bytes. */ + uint8_t seq_num[8]; +} SSL3_RECORD; + +typedef struct ssl3_buffer_st { + uint8_t *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes, see + ssl3_setup_buffers() */ + size_t len; /* buffer size */ + int offset; /* where to 'copy from' */ + int left; /* how many bytes left */ +} SSL3_BUFFER; + +#define SSL3_CT_RSA_SIGN 1 +#define SSL3_CT_DSS_SIGN 2 +#define SSL3_CT_RSA_FIXED_DH 3 +#define SSL3_CT_DSS_FIXED_DH 4 +#define SSL3_CT_RSA_EPHEMERAL_DH 5 +#define SSL3_CT_DSS_EPHEMERAL_DH 6 +#define SSL3_CT_FORTEZZA_DMS 20 + + +/* TODO(davidben): This flag can probably be merged into s3->change_cipher_spec + * to something tri-state. (Normal / Expect CCS / Between CCS and Finished). */ +#define SSL3_FLAGS_EXPECT_CCS 0x0080 + +typedef struct ssl3_state_st { + long flags; + + uint8_t read_sequence[8]; + int read_mac_secret_size; + uint8_t read_mac_secret[EVP_MAX_MD_SIZE]; + uint8_t write_sequence[8]; + int write_mac_secret_size; + uint8_t write_mac_secret[EVP_MAX_MD_SIZE]; + + uint8_t server_random[SSL3_RANDOM_SIZE]; + uint8_t client_random[SSL3_RANDOM_SIZE]; + + /* flags for countermeasure against known-IV weakness */ + int need_record_splitting; + + /* The value of 'extra' when the buffers were initialized */ + int init_extra; + + /* have_version is true if the connection's final version is known. Otherwise + * the version has not been negotiated yet. */ + char have_version; + + /* initial_handshake_complete is true if the initial handshake has + * completed. */ + char initial_handshake_complete; + + /* sniff_buffer is used by the server in the initial handshake to read a + * V2ClientHello before the record layer is initialized. */ + BUF_MEM *sniff_buffer; + size_t sniff_buffer_len; + + SSL3_BUFFER rbuf; /* read IO goes into here */ + SSL3_BUFFER wbuf; /* write IO goes into here */ + + SSL3_RECORD rrec; /* each decoded record goes in here */ + + /* storage for Handshake protocol data received but not yet processed by + * ssl3_read_bytes: */ + uint8_t handshake_fragment[4]; + unsigned int handshake_fragment_len; + + /* partial write - check the numbers match */ + unsigned int wnum; /* number of bytes sent so far */ + int wpend_tot; /* number bytes written */ + int wpend_type; + int wpend_ret; /* number of bytes submitted */ + const uint8_t *wpend_buf; + + /* used during startup, digest all incoming/outgoing packets */ + BIO *handshake_buffer; + /* When set of handshake digests is determined, buffer is hashed and freed + * and MD_CTX-es for all required digests are stored in this array */ + EVP_MD_CTX **handshake_dgst; + /* this is set whenerver we see a change_cipher_spec message come in when we + * are not looking for one */ + int change_cipher_spec; + + int warn_alert; + int fatal_alert; + /* we allow one fatal and one warning alert to be outstanding, send close + * alert via the warning alert */ + int alert_dispatch; + uint8_t send_alert[2]; + + int total_renegotiations; + + /* State pertaining to the pending handshake. + * + * TODO(davidben): State is current spread all over the place. Move + * pending handshake state here so it can be managed separately from + * established connection state in case of renegotiations. */ + struct { + /* actually only need to be 16+20 for SSLv3 and 12 for TLS */ + uint8_t finish_md[EVP_MAX_MD_SIZE * 2]; + int finish_md_len; + uint8_t peer_finish_md[EVP_MAX_MD_SIZE * 2]; + int peer_finish_md_len; + + unsigned long message_size; + int message_type; + + /* used to hold the new cipher we are going to use */ + const SSL_CIPHER *new_cipher; + DH *dh; + + EC_KEY *ecdh; /* holds short lived ECDH key */ + + /* used when SSL_ST_FLUSH_DATA is entered */ + int next_state; + + int reuse_message; + + /* Client-only: cert_req determines if a client certificate is to be sent. + * This is 0 if no client Certificate message is to be sent, 1 if there is + * a client certificate, and 2 to send an empty client Certificate + * message. */ + int cert_req; + + /* Client-only: ca_names contains the list of CAs received in a + * CertificateRequest message. */ + STACK_OF(X509_NAME) *ca_names; + + /* Client-only: certificate_types contains the set of certificate types + * received in a CertificateRequest message. */ + uint8_t *certificate_types; + size_t num_certificate_types; + + int key_block_length; + uint8_t *key_block; + + const EVP_AEAD *new_aead; + uint8_t new_mac_secret_len; + uint8_t new_fixed_iv_len; + uint8_t new_variable_iv_len; + + /* Server-only: cert_request is true if a client certificate was + * requested. */ + int cert_request; + + /* certificate_status_expected is true if OCSP stapling was negotiated and + * the server is expected to send a CertificateStatus message. */ + char certificate_status_expected; + + /* peer_ecpointformatlist contains the EC point formats advertised by the + * peer. */ + uint8_t *peer_ecpointformatlist; + size_t peer_ecpointformatlist_length; + + /* Server-only: peer_ellipticcurvelist contains the EC curve IDs advertised + * by the peer. This is only set on the server's end. The server does not + * advertise this extension to the client. */ + uint16_t *peer_ellipticcurvelist; + size_t peer_ellipticcurvelist_length; + + /* extended_master_secret indicates whether the extended master secret + * computation is used in this handshake. Note that this is different from + * whether it was used for the current session. If this is a resumption + * handshake then EMS might be negotiated in the client and server hello + * messages, but it doesn't matter if the session that's being resumed + * didn't use it to create the master secret initially. */ + char extended_master_secret; + + /* Client-only: peer_psk_identity_hint is the psk_identity_hint sent by the + * server when using a PSK key exchange. */ + char *peer_psk_identity_hint; + + /* new_mac_secret_size is unused and exists only until wpa_supplicant can + * be updated. It is only needed for EAP-FAST, which we don't support. */ + uint8_t new_mac_secret_size; + + /* Client-only: in_false_start is one if there is a pending handshake in + * False Start. The client may write data at this point. */ + char in_false_start; + } tmp; + + /* Connection binding to prevent renegotiation attacks */ + uint8_t previous_client_finished[EVP_MAX_MD_SIZE]; + uint8_t previous_client_finished_len; + uint8_t previous_server_finished[EVP_MAX_MD_SIZE]; + uint8_t previous_server_finished_len; + int send_connection_binding; /* TODOEKR */ + + /* Set if we saw the Next Protocol Negotiation extension from our peer. */ + int next_proto_neg_seen; + + /* ALPN information + * (we are in the process of transitioning from NPN to ALPN.) */ + + /* In a server these point to the selected ALPN protocol after the + * ClientHello has been processed. In a client these contain the protocol + * that the server selected once the ServerHello has been processed. */ + uint8_t *alpn_selected; + size_t alpn_selected_len; + + /* In a client, this means that the server supported Channel ID and that a + * Channel ID was sent. In a server it means that we echoed support for + * Channel IDs and that tlsext_channel_id will be valid after the + * handshake. */ + char tlsext_channel_id_valid; + /* tlsext_channel_id_new means that the updated Channel ID extension was + * negotiated. This is a temporary hack in the code to support both forms of + * Channel ID extension while we transition to the new format, which fixed a + * security issue. */ + char tlsext_channel_id_new; + /* For a server: + * If |tlsext_channel_id_valid| is true, then this contains the + * verified Channel ID from the client: a P256 point, (x,y), where + * each are big-endian values. */ + uint8_t tlsext_channel_id[64]; +} SSL3_STATE; + +/* SSLv3 */ +/* client */ +/* extra state */ +#define SSL3_ST_CW_FLUSH (0x100 | SSL_ST_CONNECT) +#define SSL3_ST_FALSE_START (0x101 | SSL_ST_CONNECT) +/* write to server */ +#define SSL3_ST_CW_CLNT_HELLO_A (0x110 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CLNT_HELLO_B (0x111 | SSL_ST_CONNECT) +/* read from server */ +#define SSL3_ST_CR_SRVR_HELLO_A (0x120 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_HELLO_B (0x121 | SSL_ST_CONNECT) +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126 | SSL_ST_CONNECT) +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_A (0x130 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_B (0x131 | SSL_ST_CONNECT) +#define SSL3_ST_CR_KEY_EXCH_A (0x140 | SSL_ST_CONNECT) +#define SSL3_ST_CR_KEY_EXCH_B (0x141 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_REQ_A (0x150 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_REQ_B (0x151 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_DONE_A (0x160 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_DONE_B (0x161 | SSL_ST_CONNECT) +/* write to server */ +#define SSL3_ST_CW_CERT_A (0x170 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_B (0x171 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_C (0x172 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_D (0x173 | SSL_ST_CONNECT) +#define SSL3_ST_CW_KEY_EXCH_A (0x180 | SSL_ST_CONNECT) +#define SSL3_ST_CW_KEY_EXCH_B (0x181 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_VRFY_A (0x190 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_VRFY_B (0x191 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANGE_A (0x1A0 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANGE_B (0x1A1 | SSL_ST_CONNECT) +#define SSL3_ST_CW_NEXT_PROTO_A (0x200 | SSL_ST_CONNECT) +#define SSL3_ST_CW_NEXT_PROTO_B (0x201 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANNEL_ID_A (0x220 | SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANNEL_ID_B (0x221 | SSL_ST_CONNECT) +#define SSL3_ST_CW_FINISHED_A (0x1B0 | SSL_ST_CONNECT) +#define SSL3_ST_CW_FINISHED_B (0x1B1 | SSL_ST_CONNECT) +/* read from server */ +#define SSL3_ST_CR_CHANGE (0x1C0 | SSL_ST_CONNECT) +#define SSL3_ST_CR_FINISHED_A (0x1D0 | SSL_ST_CONNECT) +#define SSL3_ST_CR_FINISHED_B (0x1D1 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SESSION_TICKET_A (0x1E0 | SSL_ST_CONNECT) +#define SSL3_ST_CR_SESSION_TICKET_B (0x1E1 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_STATUS_A (0x1F0 | SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_STATUS_B (0x1F1 | SSL_ST_CONNECT) + +/* server */ +/* extra state */ +#define SSL3_ST_SW_FLUSH (0x100 | SSL_ST_ACCEPT) +/* read from client */ +#define SSL3_ST_SR_INITIAL_BYTES (0x240 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_V2_CLIENT_HELLO (0x241 | SSL_ST_ACCEPT) +/* Do not change the number values, they do matter */ +#define SSL3_ST_SR_CLNT_HELLO_A (0x110 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_B (0x111 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_C (0x112 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_D (0x115 | SSL_ST_ACCEPT) +/* write to client */ +#define SSL3_ST_SW_HELLO_REQ_A (0x120 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_B (0x121 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_C (0x122 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_HELLO_A (0x130 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_HELLO_B (0x131 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_A (0x140 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_B (0x141 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_KEY_EXCH_A (0x150 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_KEY_EXCH_B (0x151 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_REQ_A (0x160 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_REQ_B (0x161 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_DONE_A (0x170 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_DONE_B (0x171 | SSL_ST_ACCEPT) +/* read from client */ +#define SSL3_ST_SR_CERT_A (0x180 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_B (0x181 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_KEY_EXCH_A (0x190 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_KEY_EXCH_B (0x191 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_VRFY_A (0x1A0 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_VRFY_B (0x1A1 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CHANGE (0x1B0 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_NEXT_PROTO_A (0x210 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_NEXT_PROTO_B (0x211 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CHANNEL_ID_A (0x230 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_CHANNEL_ID_B (0x231 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_FINISHED_A (0x1C0 | SSL_ST_ACCEPT) +#define SSL3_ST_SR_FINISHED_B (0x1C1 | SSL_ST_ACCEPT) + +/* write to client */ +#define SSL3_ST_SW_CHANGE_A (0x1D0 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CHANGE_B (0x1D1 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_FINISHED_A (0x1E0 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_FINISHED_B (0x1E1 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SESSION_TICKET_A (0x1F0 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SESSION_TICKET_B (0x1F1 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_STATUS_A (0x200 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_STATUS_B (0x201 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SUPPLEMENTAL_DATA_A (0x220 | SSL_ST_ACCEPT) +#define SSL3_ST_SW_SUPPLEMENTAL_DATA_B (0x221 | SSL_ST_ACCEPT) + +#define SSL3_MT_HELLO_REQUEST 0 +#define SSL3_MT_CLIENT_HELLO 1 +#define SSL3_MT_SERVER_HELLO 2 +#define SSL3_MT_NEWSESSION_TICKET 4 +#define SSL3_MT_CERTIFICATE 11 +#define SSL3_MT_SERVER_KEY_EXCHANGE 12 +#define SSL3_MT_CERTIFICATE_REQUEST 13 +#define SSL3_MT_SERVER_DONE 14 +#define SSL3_MT_CERTIFICATE_VERIFY 15 +#define SSL3_MT_CLIENT_KEY_EXCHANGE 16 +#define SSL3_MT_FINISHED 20 +#define SSL3_MT_CERTIFICATE_STATUS 22 +#define SSL3_MT_SUPPLEMENTAL_DATA 23 +#define SSL3_MT_NEXT_PROTO 67 +#define SSL3_MT_ENCRYPTED_EXTENSIONS 203 +#define DTLS1_MT_HELLO_VERIFY_REQUEST 3 + + +#define SSL3_MT_CCS 1 + +/* These are used when changing over to a new cipher */ +#define SSL3_CC_READ 0x01 +#define SSL3_CC_WRITE 0x02 +#define SSL3_CC_CLIENT 0x10 +#define SSL3_CC_SERVER 0x20 +#define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT | SSL3_CC_WRITE) +#define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER | SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT | SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER | SSL3_CC_WRITE) + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/phonelibs/boringssl/include/openssl/stack.h b/phonelibs/boringssl/include/openssl/stack.h new file mode 100644 index 00000000000000..350fa145781ea4 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/stack.h @@ -0,0 +1,301 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_STACK_H +#define OPENSSL_HEADER_STACK_H + +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* A stack, in OpenSSL, is an array of pointers. They are the most commonly + * used collection object. + * + * This file defines macros for type safe use of the stack functions. A stack + * of a specific type of object has type |STACK_OF(type)|. This can be defined + * (once) with |DEFINE_STACK_OF(type)| and declared where needed with + * |DECLARE_STACK_OF(type)|. For example: + * + * struct foo { + * int bar; + * }; + * + * DEFINE_STACK_OF(struct foo); + * + * Although note that the stack will contain /pointers/ to |foo|. + * + * A macro will be defined for each of the sk_* functions below. For + * STACK_OF(foo), the macros would be sk_foo_new, sk_foo_pop etc. */ + + +/* stack_cmp_func is a comparison function that returns a value < 0, 0 or > 0 + * if |*a| is less than, equal to or greater than |*b|, respectively. Note the + * extra indirection - the function is given a pointer to a pointer to the + * element. This differs from the usual qsort/bsearch comparison function. */ +typedef int (*stack_cmp_func)(const void **a, const void **b); + +/* stack_st contains an array of pointers. It is not designed to be used + * directly, rather the wrapper macros should be used. */ +typedef struct stack_st { + /* num contains the number of valid pointers in |data|. */ + size_t num; + void **data; + /* sorted is non-zero if the values pointed to by |data| are in ascending + * order, based on |comp|. */ + size_t sorted; + /* num_alloc contains the number of pointers allocated in the buffer pointed + * to by |data|, which may be larger than |num|. */ + size_t num_alloc; + /* comp is an optional comparison function. */ + stack_cmp_func comp; +} _STACK; + + +#define STACK_OF(type) struct stack_st_##type + +#define DEFINE_STACK_OF(type) \ +STACK_OF(type) {\ + _STACK stack; \ +} + +#define DECLARE_STACK_OF(type) STACK_OF(type); + +/* The make_macros.sh script in this directory parses the following lines and + * generates the stack_macros.h file that contains macros for the following + * types of stacks: + * + * STACK_OF:ACCESS_DESCRIPTION + * STACK_OF:ASN1_ADB_TABLE + * STACK_OF:ASN1_GENERALSTRING + * STACK_OF:ASN1_INTEGER + * STACK_OF:ASN1_OBJECT + * STACK_OF:ASN1_STRING_TABLE + * STACK_OF:ASN1_TYPE + * STACK_OF:ASN1_VALUE + * STACK_OF:BIO + * STACK_OF:BY_DIR_ENTRY + * STACK_OF:BY_DIR_HASH + * STACK_OF:CONF_VALUE + * STACK_OF:CRYPTO_EX_DATA_FUNCS + * STACK_OF:DIST_POINT + * STACK_OF:GENERAL_NAME + * STACK_OF:GENERAL_NAMES + * STACK_OF:GENERAL_SUBTREE + * STACK_OF:MIME_HEADER + * STACK_OF:PKCS7_SIGNER_INFO + * STACK_OF:PKCS7_RECIP_INFO + * STACK_OF:POLICYINFO + * STACK_OF:POLICYQUALINFO + * STACK_OF:POLICY_MAPPING + * STACK_OF:SSL_COMP + * STACK_OF:STACK_OF_X509_NAME_ENTRY + * STACK_OF:SXNETID + * STACK_OF:X509 + * STACK_OF:X509V3_EXT_METHOD + * STACK_OF:X509_ALGOR + * STACK_OF:X509_ATTRIBUTE + * STACK_OF:X509_CRL + * STACK_OF:X509_EXTENSION + * STACK_OF:X509_INFO + * STACK_OF:X509_LOOKUP + * STACK_OF:X509_NAME + * STACK_OF:X509_NAME_ENTRY + * STACK_OF:X509_OBJECT + * STACK_OF:X509_POLICY_DATA + * STACK_OF:X509_POLICY_NODE + * STACK_OF:X509_PURPOSE + * STACK_OF:X509_REVOKED + * STACK_OF:X509_TRUST + * STACK_OF:X509_VERIFY_PARAM + * STACK_OF:void + * + * Some stacks contain only const structures, so the stack should return const + * pointers to retain type-checking. + * + * CONST_STACK_OF:SRTP_PROTECTION_PROFILE + * CONST_STACK_OF:SSL_CIPHER */ + + +/* Some stacks are special because, although we would like STACK_OF(char *), + * that would actually be a stack of pointers to char*, but we just want to + * point to the string directly. In this case we call them "special" and use + * |DEFINE_SPECIAL_STACK_OF(type)| */ +#define DEFINE_SPECIAL_STACK_OF(type, inner) \ + STACK_OF(type) { _STACK special_stack; }; \ + OPENSSL_COMPILE_ASSERT(sizeof(type) == sizeof(void *), \ + special_stack_of_non_pointer_##type); + +typedef char *OPENSSL_STRING; + +DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char) +DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, uint8_t) + +/* The make_macros.sh script in this directory parses the following lines and + * generates the stack_macros.h file that contains macros for the following + * types of stacks: + * + * SPECIAL_STACK_OF:OPENSSL_STRING + * SPECIAL_STACK_OF:OPENSSL_BLOCK */ + +#define IN_STACK_H +#include +#undef IN_STACK_H + + +/* These are the raw stack functions, you shouldn't be using them. Rather you + * should be using the type stack macros implemented above. */ + +/* sk_new creates a new, empty stack with the given comparison function, which + * may be zero. It returns the new stack or NULL on allocation failure. */ +OPENSSL_EXPORT _STACK *sk_new(stack_cmp_func comp); + +/* sk_new_null creates a new, empty stack. It returns the new stack or NULL on + * allocation failure. */ +OPENSSL_EXPORT _STACK *sk_new_null(void); + +/* sk_num returns the number of elements in |s|. */ +OPENSSL_EXPORT size_t sk_num(const _STACK *sk); + +/* sk_zero resets |sk| to the empty state but does nothing to free the + * individual elements themselves. */ +OPENSSL_EXPORT void sk_zero(_STACK *sk); + +/* sk_value returns the |i|th pointer in |sk|, or NULL if |i| is out of + * range. */ +OPENSSL_EXPORT void *sk_value(const _STACK *sk, size_t i); + +/* sk_set sets the |i|th pointer in |sk| to |p| and returns |p|. If |i| is out + * of range, it returns NULL. */ +OPENSSL_EXPORT void *sk_set(_STACK *sk, size_t i, void *p); + +/* sk_free frees the given stack and array of pointers, but does nothing to + * free the individual elements. Also see |sk_pop_free|. */ +OPENSSL_EXPORT void sk_free(_STACK *sk); + +/* sk_pop_free calls |free_func| on each element in the stack and then frees + * the stack itself. */ +OPENSSL_EXPORT void sk_pop_free(_STACK *sk, void (*free_func)(void *)); + +/* sk_insert inserts |p| into the stack at index |where|, moving existing + * elements if needed. It returns the length of the new stack, or zero on + * error. */ +OPENSSL_EXPORT size_t sk_insert(_STACK *sk, void *p, size_t where); + +/* sk_delete removes the pointer at index |where|, moving other elements down + * if needed. It returns the removed pointer, or NULL if |where| is out of + * range. */ +OPENSSL_EXPORT void *sk_delete(_STACK *sk, size_t where); + +/* sk_delete_ptr removes, at most, one instance of |p| from the stack based on + * pointer equality. If an instance of |p| is found then |p| is returned, + * otherwise it returns NULL. */ +OPENSSL_EXPORT void *sk_delete_ptr(_STACK *sk, void *p); + +/* sk_find returns the first value in the stack equal to |p|. If a comparison + * function has been set on the stack, then equality is defined by it and the + * stack will be sorted if need be so that a binary search can be used. + * Otherwise pointer equality is used. If a matching element is found, its + * index is written to |*out_index| (if |out_index| is not NULL) and one is + * returned. Otherwise zero is returned. */ +OPENSSL_EXPORT int sk_find(_STACK *sk, size_t *out_index, void *p); + +/* sk_shift removes and returns the first element in the stack, or returns NULL + * if the stack is empty. */ +OPENSSL_EXPORT void *sk_shift(_STACK *sk); + +/* sk_push appends |p| to the stack and returns the length of the new stack, or + * 0 on allocation failure. */ +OPENSSL_EXPORT size_t sk_push(_STACK *sk, void *p); + +/* sk_pop returns and removes the last element on the stack, or NULL if the + * stack is empty. */ +OPENSSL_EXPORT void *sk_pop(_STACK *sk); + +/* sk_dup performs a shallow copy of a stack and returns the new stack, or NULL + * on error. */ +OPENSSL_EXPORT _STACK *sk_dup(const _STACK *sk); + +/* sk_sort sorts the elements of |sk| into ascending order based on the + * comparison function. The stack maintains a |sorted| flag and sorting an + * already sorted stack is a no-op. */ +OPENSSL_EXPORT void sk_sort(_STACK *sk); + +/* sk_is_sorted returns one if |sk| is known to be sorted and zero + * otherwise. */ +OPENSSL_EXPORT int sk_is_sorted(const _STACK *sk); + +/* sk_set_cmp_func sets the comparison function to be used by |sk| and returns + * the previous one. */ +OPENSSL_EXPORT stack_cmp_func sk_set_cmp_func(_STACK *sk, stack_cmp_func comp); + +/* sk_deep_copy performs a copy of |sk| and of each of the non-NULL elements in + * |sk| by using |copy_func|. If an error occurs, |free_func| is used to free + * any copies already made and NULL is returned. */ +OPENSSL_EXPORT _STACK *sk_deep_copy(const _STACK *sk, + void *(*copy_func)(void *), + void (*free_func)(void *)); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_STACK_H */ diff --git a/phonelibs/boringssl/include/openssl/stack_macros.h b/phonelibs/boringssl/include/openssl/stack_macros.h new file mode 100644 index 00000000000000..dadcf6bec5d818 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/stack_macros.h @@ -0,0 +1,4004 @@ +/* Copyright (c) 2014, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#if !defined(IN_STACK_H) +#error "Don't include this file directly. Include stack.h." +#endif + +/* ACCESS_DESCRIPTION */ +#define sk_ACCESS_DESCRIPTION_new(comp) \ + ((STACK_OF(ACCESS_DESCRIPTION) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const ACCESS_DESCRIPTION **a, const ACCESS_DESCRIPTION **b), \ + comp))) + +#define sk_ACCESS_DESCRIPTION_new_null() \ + ((STACK_OF(ACCESS_DESCRIPTION) *)sk_new_null()) + +#define sk_ACCESS_DESCRIPTION_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk)) + +#define sk_ACCESS_DESCRIPTION_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk)); + +#define sk_ACCESS_DESCRIPTION_value(sk, i) \ + ((ACCESS_DESCRIPTION *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk), (i))) + +#define sk_ACCESS_DESCRIPTION_set(sk, i, p) \ + ((ACCESS_DESCRIPTION *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), (i), \ + CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p))) + +#define sk_ACCESS_DESCRIPTION_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk)) + +#define sk_ACCESS_DESCRIPTION_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(ACCESS_DESCRIPTION *), \ + free_func)) + +#define sk_ACCESS_DESCRIPTION_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \ + CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p), (where)) + +#define sk_ACCESS_DESCRIPTION_delete(sk, where) \ + ((ACCESS_DESCRIPTION *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), (where))) + +#define sk_ACCESS_DESCRIPTION_delete_ptr(sk, p) \ + ((ACCESS_DESCRIPTION *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \ + CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p))) + +#define sk_ACCESS_DESCRIPTION_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \ + (out_index), CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p)) + +#define sk_ACCESS_DESCRIPTION_shift(sk) \ + ((ACCESS_DESCRIPTION *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk))) + +#define sk_ACCESS_DESCRIPTION_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \ + CHECKED_CAST(void *, ACCESS_DESCRIPTION *, p)) + +#define sk_ACCESS_DESCRIPTION_pop(sk) \ + ((ACCESS_DESCRIPTION *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk))) + +#define sk_ACCESS_DESCRIPTION_dup(sk) \ + ((STACK_OF(ACCESS_DESCRIPTION) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk))) + +#define sk_ACCESS_DESCRIPTION_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk)) + +#define sk_ACCESS_DESCRIPTION_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk)) + +#define sk_ACCESS_DESCRIPTION_set_cmp_func(sk, comp) \ + ((int (*)(const ACCESS_DESCRIPTION **a, const ACCESS_DESCRIPTION **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(ACCESS_DESCRIPTION) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const ACCESS_DESCRIPTION **a, \ + const ACCESS_DESCRIPTION **b), \ + comp))) + +#define sk_ACCESS_DESCRIPTION_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(ACCESS_DESCRIPTION) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(ACCESS_DESCRIPTION) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + ACCESS_DESCRIPTION *(*)(ACCESS_DESCRIPTION *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(ACCESS_DESCRIPTION *), \ + free_func))) + +/* ASN1_ADB_TABLE */ +#define sk_ASN1_ADB_TABLE_new(comp) \ + ((STACK_OF(ASN1_ADB_TABLE) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const ASN1_ADB_TABLE **a, const ASN1_ADB_TABLE **b), comp))) + +#define sk_ASN1_ADB_TABLE_new_null() ((STACK_OF(ASN1_ADB_TABLE) *)sk_new_null()) + +#define sk_ASN1_ADB_TABLE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk)) + +#define sk_ASN1_ADB_TABLE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk)); + +#define sk_ASN1_ADB_TABLE_value(sk, i) \ + ((ASN1_ADB_TABLE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk), (i))) + +#define sk_ASN1_ADB_TABLE_set(sk, i, p) \ + ((ASN1_ADB_TABLE *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), (i), \ + CHECKED_CAST(void *, ASN1_ADB_TABLE *, p))) + +#define sk_ASN1_ADB_TABLE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk)) + +#define sk_ASN1_ADB_TABLE_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_ADB_TABLE *), free_func)) + +#define sk_ASN1_ADB_TABLE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \ + CHECKED_CAST(void *, ASN1_ADB_TABLE *, p), (where)) + +#define sk_ASN1_ADB_TABLE_delete(sk, where) \ + ((ASN1_ADB_TABLE *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), (where))) + +#define sk_ASN1_ADB_TABLE_delete_ptr(sk, p) \ + ((ASN1_ADB_TABLE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \ + CHECKED_CAST(void *, ASN1_ADB_TABLE *, p))) + +#define sk_ASN1_ADB_TABLE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), (out_index), \ + CHECKED_CAST(void *, ASN1_ADB_TABLE *, p)) + +#define sk_ASN1_ADB_TABLE_shift(sk) \ + ((ASN1_ADB_TABLE *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk))) + +#define sk_ASN1_ADB_TABLE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \ + CHECKED_CAST(void *, ASN1_ADB_TABLE *, p)) + +#define sk_ASN1_ADB_TABLE_pop(sk) \ + ((ASN1_ADB_TABLE *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk))) + +#define sk_ASN1_ADB_TABLE_dup(sk) \ + ((STACK_OF(ASN1_ADB_TABLE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk))) + +#define sk_ASN1_ADB_TABLE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk)) + +#define sk_ASN1_ADB_TABLE_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk)) + +#define sk_ASN1_ADB_TABLE_set_cmp_func(sk, comp) \ + ((int (*)(const ASN1_ADB_TABLE **a, const ASN1_ADB_TABLE **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_ADB_TABLE) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const ASN1_ADB_TABLE **a, \ + const ASN1_ADB_TABLE **b), \ + comp))) + +#define sk_ASN1_ADB_TABLE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(ASN1_ADB_TABLE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_ADB_TABLE) *, sk), \ + CHECKED_CAST(void *(*)(void *), ASN1_ADB_TABLE *(*)(ASN1_ADB_TABLE *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_ADB_TABLE *), free_func))) + +/* ASN1_GENERALSTRING */ +#define sk_ASN1_GENERALSTRING_new(comp) \ + ((STACK_OF(ASN1_GENERALSTRING) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const ASN1_GENERALSTRING **a, const ASN1_GENERALSTRING **b), \ + comp))) + +#define sk_ASN1_GENERALSTRING_new_null() \ + ((STACK_OF(ASN1_GENERALSTRING) *)sk_new_null()) + +#define sk_ASN1_GENERALSTRING_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk)) + +#define sk_ASN1_GENERALSTRING_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk)); + +#define sk_ASN1_GENERALSTRING_value(sk, i) \ + ((ASN1_GENERALSTRING *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk), (i))) + +#define sk_ASN1_GENERALSTRING_set(sk, i, p) \ + ((ASN1_GENERALSTRING *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), (i), \ + CHECKED_CAST(void *, ASN1_GENERALSTRING *, p))) + +#define sk_ASN1_GENERALSTRING_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk)) + +#define sk_ASN1_GENERALSTRING_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_GENERALSTRING *), \ + free_func)) + +#define sk_ASN1_GENERALSTRING_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \ + CHECKED_CAST(void *, ASN1_GENERALSTRING *, p), (where)) + +#define sk_ASN1_GENERALSTRING_delete(sk, where) \ + ((ASN1_GENERALSTRING *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), (where))) + +#define sk_ASN1_GENERALSTRING_delete_ptr(sk, p) \ + ((ASN1_GENERALSTRING *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \ + CHECKED_CAST(void *, ASN1_GENERALSTRING *, p))) + +#define sk_ASN1_GENERALSTRING_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \ + (out_index), CHECKED_CAST(void *, ASN1_GENERALSTRING *, p)) + +#define sk_ASN1_GENERALSTRING_shift(sk) \ + ((ASN1_GENERALSTRING *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk))) + +#define sk_ASN1_GENERALSTRING_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \ + CHECKED_CAST(void *, ASN1_GENERALSTRING *, p)) + +#define sk_ASN1_GENERALSTRING_pop(sk) \ + ((ASN1_GENERALSTRING *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk))) + +#define sk_ASN1_GENERALSTRING_dup(sk) \ + ((STACK_OF(ASN1_GENERALSTRING) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk))) + +#define sk_ASN1_GENERALSTRING_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk)) + +#define sk_ASN1_GENERALSTRING_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk)) + +#define sk_ASN1_GENERALSTRING_set_cmp_func(sk, comp) \ + ((int (*)(const ASN1_GENERALSTRING **a, const ASN1_GENERALSTRING **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_GENERALSTRING) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const ASN1_GENERALSTRING **a, \ + const ASN1_GENERALSTRING **b), \ + comp))) + +#define sk_ASN1_GENERALSTRING_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(ASN1_GENERALSTRING) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_GENERALSTRING) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + ASN1_GENERALSTRING *(*)(ASN1_GENERALSTRING *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_GENERALSTRING *), \ + free_func))) + +/* ASN1_INTEGER */ +#define sk_ASN1_INTEGER_new(comp) \ + ((STACK_OF(ASN1_INTEGER) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const ASN1_INTEGER **a, const ASN1_INTEGER **b), \ + comp))) + +#define sk_ASN1_INTEGER_new_null() ((STACK_OF(ASN1_INTEGER) *)sk_new_null()) + +#define sk_ASN1_INTEGER_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk)) + +#define sk_ASN1_INTEGER_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk)); + +#define sk_ASN1_INTEGER_value(sk, i) \ + ((ASN1_INTEGER *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_INTEGER) *, sk), (i))) + +#define sk_ASN1_INTEGER_set(sk, i, p) \ + ((ASN1_INTEGER *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), (i), \ + CHECKED_CAST(void *, ASN1_INTEGER *, p))) + +#define sk_ASN1_INTEGER_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk)) + +#define sk_ASN1_INTEGER_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_INTEGER *), free_func)) + +#define sk_ASN1_INTEGER_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \ + CHECKED_CAST(void *, ASN1_INTEGER *, p), (where)) + +#define sk_ASN1_INTEGER_delete(sk, where) \ + ((ASN1_INTEGER *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), (where))) + +#define sk_ASN1_INTEGER_delete_ptr(sk, p) \ + ((ASN1_INTEGER *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \ + CHECKED_CAST(void *, ASN1_INTEGER *, p))) + +#define sk_ASN1_INTEGER_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), (out_index), \ + CHECKED_CAST(void *, ASN1_INTEGER *, p)) + +#define sk_ASN1_INTEGER_shift(sk) \ + ((ASN1_INTEGER *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk))) + +#define sk_ASN1_INTEGER_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \ + CHECKED_CAST(void *, ASN1_INTEGER *, p)) + +#define sk_ASN1_INTEGER_pop(sk) \ + ((ASN1_INTEGER *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk))) + +#define sk_ASN1_INTEGER_dup(sk) \ + ((STACK_OF(ASN1_INTEGER) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_INTEGER) *, sk))) + +#define sk_ASN1_INTEGER_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk)) + +#define sk_ASN1_INTEGER_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_INTEGER) *, sk)) + +#define sk_ASN1_INTEGER_set_cmp_func(sk, comp) \ + ((int (*)(const ASN1_INTEGER **a, const ASN1_INTEGER **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_INTEGER) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const ASN1_INTEGER **a, const ASN1_INTEGER **b), \ + comp))) + +#define sk_ASN1_INTEGER_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(ASN1_INTEGER) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_INTEGER) *, sk), \ + CHECKED_CAST(void *(*)(void *), ASN1_INTEGER *(*)(ASN1_INTEGER *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_INTEGER *), free_func))) + +/* ASN1_OBJECT */ +#define sk_ASN1_OBJECT_new(comp) \ + ((STACK_OF(ASN1_OBJECT) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const ASN1_OBJECT **a, const ASN1_OBJECT **b), \ + comp))) + +#define sk_ASN1_OBJECT_new_null() ((STACK_OF(ASN1_OBJECT) *)sk_new_null()) + +#define sk_ASN1_OBJECT_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk)) + +#define sk_ASN1_OBJECT_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk)); + +#define sk_ASN1_OBJECT_value(sk, i) \ + ((ASN1_OBJECT *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_OBJECT) *, sk), (i))) + +#define sk_ASN1_OBJECT_set(sk, i, p) \ + ((ASN1_OBJECT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \ + (i), CHECKED_CAST(void *, ASN1_OBJECT *, p))) + +#define sk_ASN1_OBJECT_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk)) + +#define sk_ASN1_OBJECT_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_OBJECT *), free_func)) + +#define sk_ASN1_OBJECT_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \ + CHECKED_CAST(void *, ASN1_OBJECT *, p), (where)) + +#define sk_ASN1_OBJECT_delete(sk, where) \ + ((ASN1_OBJECT *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), (where))) + +#define sk_ASN1_OBJECT_delete_ptr(sk, p) \ + ((ASN1_OBJECT *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \ + CHECKED_CAST(void *, ASN1_OBJECT *, p))) + +#define sk_ASN1_OBJECT_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), (out_index), \ + CHECKED_CAST(void *, ASN1_OBJECT *, p)) + +#define sk_ASN1_OBJECT_shift(sk) \ + ((ASN1_OBJECT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk))) + +#define sk_ASN1_OBJECT_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \ + CHECKED_CAST(void *, ASN1_OBJECT *, p)) + +#define sk_ASN1_OBJECT_pop(sk) \ + ((ASN1_OBJECT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk))) + +#define sk_ASN1_OBJECT_dup(sk) \ + ((STACK_OF(ASN1_OBJECT) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_OBJECT) *, sk))) + +#define sk_ASN1_OBJECT_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk)) + +#define sk_ASN1_OBJECT_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_OBJECT) *, sk)) + +#define sk_ASN1_OBJECT_set_cmp_func(sk, comp) \ + ((int (*)(const ASN1_OBJECT **a, const ASN1_OBJECT **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_OBJECT) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const ASN1_OBJECT **a, const ASN1_OBJECT **b), \ + comp))) + +#define sk_ASN1_OBJECT_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(ASN1_OBJECT) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_OBJECT) *, sk), \ + CHECKED_CAST(void *(*)(void *), ASN1_OBJECT *(*)(ASN1_OBJECT *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_OBJECT *), free_func))) + +/* ASN1_STRING_TABLE */ +#define sk_ASN1_STRING_TABLE_new(comp) \ + ((STACK_OF(ASN1_STRING_TABLE) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const ASN1_STRING_TABLE **a, const ASN1_STRING_TABLE **b), \ + comp))) + +#define sk_ASN1_STRING_TABLE_new_null() \ + ((STACK_OF(ASN1_STRING_TABLE) *)sk_new_null()) + +#define sk_ASN1_STRING_TABLE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk)) + +#define sk_ASN1_STRING_TABLE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk)); + +#define sk_ASN1_STRING_TABLE_value(sk, i) \ + ((ASN1_STRING_TABLE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk), (i))) + +#define sk_ASN1_STRING_TABLE_set(sk, i, p) \ + ((ASN1_STRING_TABLE *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), (i), \ + CHECKED_CAST(void *, ASN1_STRING_TABLE *, p))) + +#define sk_ASN1_STRING_TABLE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk)) + +#define sk_ASN1_STRING_TABLE_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_STRING_TABLE *), \ + free_func)) + +#define sk_ASN1_STRING_TABLE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \ + CHECKED_CAST(void *, ASN1_STRING_TABLE *, p), (where)) + +#define sk_ASN1_STRING_TABLE_delete(sk, where) \ + ((ASN1_STRING_TABLE *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), (where))) + +#define sk_ASN1_STRING_TABLE_delete_ptr(sk, p) \ + ((ASN1_STRING_TABLE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \ + CHECKED_CAST(void *, ASN1_STRING_TABLE *, p))) + +#define sk_ASN1_STRING_TABLE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \ + (out_index), CHECKED_CAST(void *, ASN1_STRING_TABLE *, p)) + +#define sk_ASN1_STRING_TABLE_shift(sk) \ + ((ASN1_STRING_TABLE *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk))) + +#define sk_ASN1_STRING_TABLE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \ + CHECKED_CAST(void *, ASN1_STRING_TABLE *, p)) + +#define sk_ASN1_STRING_TABLE_pop(sk) \ + ((ASN1_STRING_TABLE *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk))) + +#define sk_ASN1_STRING_TABLE_dup(sk) \ + ((STACK_OF(ASN1_STRING_TABLE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk))) + +#define sk_ASN1_STRING_TABLE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk)) + +#define sk_ASN1_STRING_TABLE_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk)) + +#define sk_ASN1_STRING_TABLE_set_cmp_func(sk, comp) \ + ((int (*)(const ASN1_STRING_TABLE **a, const ASN1_STRING_TABLE **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_STRING_TABLE) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const ASN1_STRING_TABLE **a, \ + const ASN1_STRING_TABLE **b), \ + comp))) + +#define sk_ASN1_STRING_TABLE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(ASN1_STRING_TABLE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_STRING_TABLE) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + ASN1_STRING_TABLE *(*)(ASN1_STRING_TABLE *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_STRING_TABLE *), \ + free_func))) + +/* ASN1_TYPE */ +#define sk_ASN1_TYPE_new(comp) \ + ((STACK_OF(ASN1_TYPE) *)sk_new( \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const ASN1_TYPE **a, const ASN1_TYPE **b), comp))) + +#define sk_ASN1_TYPE_new_null() ((STACK_OF(ASN1_TYPE) *)sk_new_null()) + +#define sk_ASN1_TYPE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk)) + +#define sk_ASN1_TYPE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk)); + +#define sk_ASN1_TYPE_value(sk, i) \ + ((ASN1_TYPE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_TYPE) *, sk), (i))) + +#define sk_ASN1_TYPE_set(sk, i, p) \ + ((ASN1_TYPE *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), (i), \ + CHECKED_CAST(void *, ASN1_TYPE *, p))) + +#define sk_ASN1_TYPE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk)) + +#define sk_ASN1_TYPE_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_TYPE *), free_func)) + +#define sk_ASN1_TYPE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \ + CHECKED_CAST(void *, ASN1_TYPE *, p), (where)) + +#define sk_ASN1_TYPE_delete(sk, where) \ + ((ASN1_TYPE *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \ + (where))) + +#define sk_ASN1_TYPE_delete_ptr(sk, p) \ + ((ASN1_TYPE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \ + CHECKED_CAST(void *, ASN1_TYPE *, p))) + +#define sk_ASN1_TYPE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), (out_index), \ + CHECKED_CAST(void *, ASN1_TYPE *, p)) + +#define sk_ASN1_TYPE_shift(sk) \ + ((ASN1_TYPE *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk))) + +#define sk_ASN1_TYPE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \ + CHECKED_CAST(void *, ASN1_TYPE *, p)) + +#define sk_ASN1_TYPE_pop(sk) \ + ((ASN1_TYPE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk))) + +#define sk_ASN1_TYPE_dup(sk) \ + ((STACK_OF(ASN1_TYPE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_TYPE) *, sk))) + +#define sk_ASN1_TYPE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk)) + +#define sk_ASN1_TYPE_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_TYPE) *, sk)) + +#define sk_ASN1_TYPE_set_cmp_func(sk, comp) \ + ((int (*)(const ASN1_TYPE **a, const ASN1_TYPE **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_TYPE) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const ASN1_TYPE **a, const ASN1_TYPE **b), comp))) + +#define sk_ASN1_TYPE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(ASN1_TYPE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_TYPE) *, sk), \ + CHECKED_CAST(void *(*)(void *), ASN1_TYPE *(*)(ASN1_TYPE *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_TYPE *), free_func))) + +/* ASN1_VALUE */ +#define sk_ASN1_VALUE_new(comp) \ + ((STACK_OF(ASN1_VALUE) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const ASN1_VALUE **a, const ASN1_VALUE **b), \ + comp))) + +#define sk_ASN1_VALUE_new_null() ((STACK_OF(ASN1_VALUE) *)sk_new_null()) + +#define sk_ASN1_VALUE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk)) + +#define sk_ASN1_VALUE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk)); + +#define sk_ASN1_VALUE_value(sk, i) \ + ((ASN1_VALUE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_VALUE) *, sk), (i))) + +#define sk_ASN1_VALUE_set(sk, i, p) \ + ((ASN1_VALUE *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \ + (i), CHECKED_CAST(void *, ASN1_VALUE *, p))) + +#define sk_ASN1_VALUE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk)) + +#define sk_ASN1_VALUE_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_VALUE *), free_func)) + +#define sk_ASN1_VALUE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \ + CHECKED_CAST(void *, ASN1_VALUE *, p), (where)) + +#define sk_ASN1_VALUE_delete(sk, where) \ + ((ASN1_VALUE *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \ + (where))) + +#define sk_ASN1_VALUE_delete_ptr(sk, p) \ + ((ASN1_VALUE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \ + CHECKED_CAST(void *, ASN1_VALUE *, p))) + +#define sk_ASN1_VALUE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), (out_index), \ + CHECKED_CAST(void *, ASN1_VALUE *, p)) + +#define sk_ASN1_VALUE_shift(sk) \ + ((ASN1_VALUE *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk))) + +#define sk_ASN1_VALUE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \ + CHECKED_CAST(void *, ASN1_VALUE *, p)) + +#define sk_ASN1_VALUE_pop(sk) \ + ((ASN1_VALUE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk))) + +#define sk_ASN1_VALUE_dup(sk) \ + ((STACK_OF(ASN1_VALUE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(ASN1_VALUE) *, sk))) + +#define sk_ASN1_VALUE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk)) + +#define sk_ASN1_VALUE_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(ASN1_VALUE) *, sk)) + +#define sk_ASN1_VALUE_set_cmp_func(sk, comp) \ + ((int (*)(const ASN1_VALUE **a, const ASN1_VALUE **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(ASN1_VALUE) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const ASN1_VALUE **a, const ASN1_VALUE **b), \ + comp))) + +#define sk_ASN1_VALUE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(ASN1_VALUE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(ASN1_VALUE) *, sk), \ + CHECKED_CAST(void *(*)(void *), ASN1_VALUE *(*)(ASN1_VALUE *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(ASN1_VALUE *), free_func))) + +/* BIO */ +#define sk_BIO_new(comp) \ + ((STACK_OF(BIO) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const BIO **a, const BIO **b), comp))) + +#define sk_BIO_new_null() ((STACK_OF(BIO) *)sk_new_null()) + +#define sk_BIO_num(sk) sk_num(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk)) + +#define sk_BIO_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk)); + +#define sk_BIO_value(sk, i) \ + ((BIO *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(BIO) *, sk), (i))) + +#define sk_BIO_set(sk, i, p) \ + ((BIO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), (i), \ + CHECKED_CAST(void *, BIO *, p))) + +#define sk_BIO_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk)) + +#define sk_BIO_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(BIO *), free_func)) + +#define sk_BIO_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \ + CHECKED_CAST(void *, BIO *, p), (where)) + +#define sk_BIO_delete(sk, where) \ + ((BIO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), (where))) + +#define sk_BIO_delete_ptr(sk, p) \ + ((BIO *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \ + CHECKED_CAST(void *, BIO *, p))) + +#define sk_BIO_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), (out_index), \ + CHECKED_CAST(void *, BIO *, p)) + +#define sk_BIO_shift(sk) \ + ((BIO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk))) + +#define sk_BIO_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \ + CHECKED_CAST(void *, BIO *, p)) + +#define sk_BIO_pop(sk) \ + ((BIO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk))) + +#define sk_BIO_dup(sk) \ + ((STACK_OF(BIO) *)sk_dup(CHECKED_CAST(_STACK *, const STACK_OF(BIO) *, sk))) + +#define sk_BIO_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk)) + +#define sk_BIO_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(BIO) *, sk)) + +#define sk_BIO_set_cmp_func(sk, comp) \ + ((int (*)(const BIO **a, const BIO **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(BIO) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const BIO **a, const BIO **b), \ + comp))) + +#define sk_BIO_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(BIO) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(BIO) *, sk), \ + CHECKED_CAST(void *(*)(void *), BIO *(*)(BIO *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(BIO *), free_func))) + +/* BY_DIR_ENTRY */ +#define sk_BY_DIR_ENTRY_new(comp) \ + ((STACK_OF(BY_DIR_ENTRY) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const BY_DIR_ENTRY **a, const BY_DIR_ENTRY **b), \ + comp))) + +#define sk_BY_DIR_ENTRY_new_null() ((STACK_OF(BY_DIR_ENTRY) *)sk_new_null()) + +#define sk_BY_DIR_ENTRY_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk)) + +#define sk_BY_DIR_ENTRY_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk)); + +#define sk_BY_DIR_ENTRY_value(sk, i) \ + ((BY_DIR_ENTRY *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk), (i))) + +#define sk_BY_DIR_ENTRY_set(sk, i, p) \ + ((BY_DIR_ENTRY *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), (i), \ + CHECKED_CAST(void *, BY_DIR_ENTRY *, p))) + +#define sk_BY_DIR_ENTRY_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk)) + +#define sk_BY_DIR_ENTRY_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_ENTRY *), free_func)) + +#define sk_BY_DIR_ENTRY_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \ + CHECKED_CAST(void *, BY_DIR_ENTRY *, p), (where)) + +#define sk_BY_DIR_ENTRY_delete(sk, where) \ + ((BY_DIR_ENTRY *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), (where))) + +#define sk_BY_DIR_ENTRY_delete_ptr(sk, p) \ + ((BY_DIR_ENTRY *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \ + CHECKED_CAST(void *, BY_DIR_ENTRY *, p))) + +#define sk_BY_DIR_ENTRY_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), (out_index), \ + CHECKED_CAST(void *, BY_DIR_ENTRY *, p)) + +#define sk_BY_DIR_ENTRY_shift(sk) \ + ((BY_DIR_ENTRY *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk))) + +#define sk_BY_DIR_ENTRY_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \ + CHECKED_CAST(void *, BY_DIR_ENTRY *, p)) + +#define sk_BY_DIR_ENTRY_pop(sk) \ + ((BY_DIR_ENTRY *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk))) + +#define sk_BY_DIR_ENTRY_dup(sk) \ + ((STACK_OF(BY_DIR_ENTRY) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk))) + +#define sk_BY_DIR_ENTRY_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk)) + +#define sk_BY_DIR_ENTRY_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk)) + +#define sk_BY_DIR_ENTRY_set_cmp_func(sk, comp) \ + ((int (*)(const BY_DIR_ENTRY **a, const BY_DIR_ENTRY **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_ENTRY) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const BY_DIR_ENTRY **a, const BY_DIR_ENTRY **b), \ + comp))) + +#define sk_BY_DIR_ENTRY_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(BY_DIR_ENTRY) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_ENTRY) *, sk), \ + CHECKED_CAST(void *(*)(void *), BY_DIR_ENTRY *(*)(BY_DIR_ENTRY *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_ENTRY *), free_func))) + +/* BY_DIR_HASH */ +#define sk_BY_DIR_HASH_new(comp) \ + ((STACK_OF(BY_DIR_HASH) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const BY_DIR_HASH **a, const BY_DIR_HASH **b), \ + comp))) + +#define sk_BY_DIR_HASH_new_null() ((STACK_OF(BY_DIR_HASH) *)sk_new_null()) + +#define sk_BY_DIR_HASH_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk)) + +#define sk_BY_DIR_HASH_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk)); + +#define sk_BY_DIR_HASH_value(sk, i) \ + ((BY_DIR_HASH *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_HASH) *, sk), (i))) + +#define sk_BY_DIR_HASH_set(sk, i, p) \ + ((BY_DIR_HASH *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \ + (i), CHECKED_CAST(void *, BY_DIR_HASH *, p))) + +#define sk_BY_DIR_HASH_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk)) + +#define sk_BY_DIR_HASH_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_HASH *), free_func)) + +#define sk_BY_DIR_HASH_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \ + CHECKED_CAST(void *, BY_DIR_HASH *, p), (where)) + +#define sk_BY_DIR_HASH_delete(sk, where) \ + ((BY_DIR_HASH *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), (where))) + +#define sk_BY_DIR_HASH_delete_ptr(sk, p) \ + ((BY_DIR_HASH *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \ + CHECKED_CAST(void *, BY_DIR_HASH *, p))) + +#define sk_BY_DIR_HASH_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), (out_index), \ + CHECKED_CAST(void *, BY_DIR_HASH *, p)) + +#define sk_BY_DIR_HASH_shift(sk) \ + ((BY_DIR_HASH *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk))) + +#define sk_BY_DIR_HASH_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \ + CHECKED_CAST(void *, BY_DIR_HASH *, p)) + +#define sk_BY_DIR_HASH_pop(sk) \ + ((BY_DIR_HASH *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk))) + +#define sk_BY_DIR_HASH_dup(sk) \ + ((STACK_OF(BY_DIR_HASH) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_HASH) *, sk))) + +#define sk_BY_DIR_HASH_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk)) + +#define sk_BY_DIR_HASH_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(BY_DIR_HASH) *, sk)) + +#define sk_BY_DIR_HASH_set_cmp_func(sk, comp) \ + ((int (*)(const BY_DIR_HASH **a, const BY_DIR_HASH **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(BY_DIR_HASH) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const BY_DIR_HASH **a, const BY_DIR_HASH **b), \ + comp))) + +#define sk_BY_DIR_HASH_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(BY_DIR_HASH) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(BY_DIR_HASH) *, sk), \ + CHECKED_CAST(void *(*)(void *), BY_DIR_HASH *(*)(BY_DIR_HASH *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(BY_DIR_HASH *), free_func))) + +/* CONF_VALUE */ +#define sk_CONF_VALUE_new(comp) \ + ((STACK_OF(CONF_VALUE) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const CONF_VALUE **a, const CONF_VALUE **b), \ + comp))) + +#define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)sk_new_null()) + +#define sk_CONF_VALUE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk)) + +#define sk_CONF_VALUE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk)); + +#define sk_CONF_VALUE_value(sk, i) \ + ((CONF_VALUE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(CONF_VALUE) *, sk), (i))) + +#define sk_CONF_VALUE_set(sk, i, p) \ + ((CONF_VALUE *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \ + (i), CHECKED_CAST(void *, CONF_VALUE *, p))) + +#define sk_CONF_VALUE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk)) + +#define sk_CONF_VALUE_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(CONF_VALUE *), free_func)) + +#define sk_CONF_VALUE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \ + CHECKED_CAST(void *, CONF_VALUE *, p), (where)) + +#define sk_CONF_VALUE_delete(sk, where) \ + ((CONF_VALUE *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \ + (where))) + +#define sk_CONF_VALUE_delete_ptr(sk, p) \ + ((CONF_VALUE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \ + CHECKED_CAST(void *, CONF_VALUE *, p))) + +#define sk_CONF_VALUE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), (out_index), \ + CHECKED_CAST(void *, CONF_VALUE *, p)) + +#define sk_CONF_VALUE_shift(sk) \ + ((CONF_VALUE *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk))) + +#define sk_CONF_VALUE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \ + CHECKED_CAST(void *, CONF_VALUE *, p)) + +#define sk_CONF_VALUE_pop(sk) \ + ((CONF_VALUE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk))) + +#define sk_CONF_VALUE_dup(sk) \ + ((STACK_OF(CONF_VALUE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(CONF_VALUE) *, sk))) + +#define sk_CONF_VALUE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk)) + +#define sk_CONF_VALUE_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(CONF_VALUE) *, sk)) + +#define sk_CONF_VALUE_set_cmp_func(sk, comp) \ + ((int (*)(const CONF_VALUE **a, const CONF_VALUE **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(CONF_VALUE) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const CONF_VALUE **a, const CONF_VALUE **b), \ + comp))) + +#define sk_CONF_VALUE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(CONF_VALUE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(CONF_VALUE) *, sk), \ + CHECKED_CAST(void *(*)(void *), CONF_VALUE *(*)(CONF_VALUE *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(CONF_VALUE *), free_func))) + +/* CRYPTO_EX_DATA_FUNCS */ +#define sk_CRYPTO_EX_DATA_FUNCS_new(comp) \ + ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const CRYPTO_EX_DATA_FUNCS **a, const CRYPTO_EX_DATA_FUNCS **b), \ + comp))) + +#define sk_CRYPTO_EX_DATA_FUNCS_new_null() \ + ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_new_null()) + +#define sk_CRYPTO_EX_DATA_FUNCS_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)) + +#define sk_CRYPTO_EX_DATA_FUNCS_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)); + +#define sk_CRYPTO_EX_DATA_FUNCS_value(sk, i) \ + ((CRYPTO_EX_DATA_FUNCS *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \ + (i))) + +#define sk_CRYPTO_EX_DATA_FUNCS_set(sk, i, p) \ + ((CRYPTO_EX_DATA_FUNCS *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), (i), \ + CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p))) + +#define sk_CRYPTO_EX_DATA_FUNCS_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)) + +#define sk_CRYPTO_EX_DATA_FUNCS_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(CRYPTO_EX_DATA_FUNCS *), \ + free_func)) + +#define sk_CRYPTO_EX_DATA_FUNCS_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \ + CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p), (where)) + +#define sk_CRYPTO_EX_DATA_FUNCS_delete(sk, where) \ + ((CRYPTO_EX_DATA_FUNCS *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), (where))) + +#define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(sk, p) \ + ((CRYPTO_EX_DATA_FUNCS *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \ + CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p))) + +#define sk_CRYPTO_EX_DATA_FUNCS_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \ + (out_index), CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p)) + +#define sk_CRYPTO_EX_DATA_FUNCS_shift(sk) \ + ((CRYPTO_EX_DATA_FUNCS *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))) + +#define sk_CRYPTO_EX_DATA_FUNCS_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \ + CHECKED_CAST(void *, CRYPTO_EX_DATA_FUNCS *, p)) + +#define sk_CRYPTO_EX_DATA_FUNCS_pop(sk) \ + ((CRYPTO_EX_DATA_FUNCS *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))) + +#define sk_CRYPTO_EX_DATA_FUNCS_dup(sk) \ + ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk))) + +#define sk_CRYPTO_EX_DATA_FUNCS_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)) + +#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(sk) \ + sk_is_sorted( \ + CHECKED_CAST(_STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk)) + +#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(sk, comp) \ + ((int (*)(const CRYPTO_EX_DATA_FUNCS **a, const CRYPTO_EX_DATA_FUNCS **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(CRYPTO_EX_DATA_FUNCS) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const CRYPTO_EX_DATA_FUNCS **a, \ + const CRYPTO_EX_DATA_FUNCS **b), \ + comp))) + +#define sk_CRYPTO_EX_DATA_FUNCS_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(CRYPTO_EX_DATA_FUNCS) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(CRYPTO_EX_DATA_FUNCS) *, \ + sk), \ + CHECKED_CAST(void *(*)(void *), \ + CRYPTO_EX_DATA_FUNCS *(*)(CRYPTO_EX_DATA_FUNCS *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(CRYPTO_EX_DATA_FUNCS *), \ + free_func))) + +/* DIST_POINT */ +#define sk_DIST_POINT_new(comp) \ + ((STACK_OF(DIST_POINT) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const DIST_POINT **a, const DIST_POINT **b), \ + comp))) + +#define sk_DIST_POINT_new_null() ((STACK_OF(DIST_POINT) *)sk_new_null()) + +#define sk_DIST_POINT_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk)) + +#define sk_DIST_POINT_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk)); + +#define sk_DIST_POINT_value(sk, i) \ + ((DIST_POINT *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(DIST_POINT) *, sk), (i))) + +#define sk_DIST_POINT_set(sk, i, p) \ + ((DIST_POINT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \ + (i), CHECKED_CAST(void *, DIST_POINT *, p))) + +#define sk_DIST_POINT_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk)) + +#define sk_DIST_POINT_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(DIST_POINT *), free_func)) + +#define sk_DIST_POINT_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \ + CHECKED_CAST(void *, DIST_POINT *, p), (where)) + +#define sk_DIST_POINT_delete(sk, where) \ + ((DIST_POINT *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \ + (where))) + +#define sk_DIST_POINT_delete_ptr(sk, p) \ + ((DIST_POINT *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \ + CHECKED_CAST(void *, DIST_POINT *, p))) + +#define sk_DIST_POINT_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), (out_index), \ + CHECKED_CAST(void *, DIST_POINT *, p)) + +#define sk_DIST_POINT_shift(sk) \ + ((DIST_POINT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk))) + +#define sk_DIST_POINT_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \ + CHECKED_CAST(void *, DIST_POINT *, p)) + +#define sk_DIST_POINT_pop(sk) \ + ((DIST_POINT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk))) + +#define sk_DIST_POINT_dup(sk) \ + ((STACK_OF(DIST_POINT) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(DIST_POINT) *, sk))) + +#define sk_DIST_POINT_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk)) + +#define sk_DIST_POINT_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(DIST_POINT) *, sk)) + +#define sk_DIST_POINT_set_cmp_func(sk, comp) \ + ((int (*)(const DIST_POINT **a, const DIST_POINT **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(DIST_POINT) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const DIST_POINT **a, const DIST_POINT **b), \ + comp))) + +#define sk_DIST_POINT_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(DIST_POINT) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(DIST_POINT) *, sk), \ + CHECKED_CAST(void *(*)(void *), DIST_POINT *(*)(DIST_POINT *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(DIST_POINT *), free_func))) + +/* GENERAL_NAME */ +#define sk_GENERAL_NAME_new(comp) \ + ((STACK_OF(GENERAL_NAME) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const GENERAL_NAME **a, const GENERAL_NAME **b), \ + comp))) + +#define sk_GENERAL_NAME_new_null() ((STACK_OF(GENERAL_NAME) *)sk_new_null()) + +#define sk_GENERAL_NAME_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk)) + +#define sk_GENERAL_NAME_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk)); + +#define sk_GENERAL_NAME_value(sk, i) \ + ((GENERAL_NAME *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAME) *, sk), (i))) + +#define sk_GENERAL_NAME_set(sk, i, p) \ + ((GENERAL_NAME *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), (i), \ + CHECKED_CAST(void *, GENERAL_NAME *, p))) + +#define sk_GENERAL_NAME_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk)) + +#define sk_GENERAL_NAME_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAME *), free_func)) + +#define sk_GENERAL_NAME_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \ + CHECKED_CAST(void *, GENERAL_NAME *, p), (where)) + +#define sk_GENERAL_NAME_delete(sk, where) \ + ((GENERAL_NAME *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), (where))) + +#define sk_GENERAL_NAME_delete_ptr(sk, p) \ + ((GENERAL_NAME *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \ + CHECKED_CAST(void *, GENERAL_NAME *, p))) + +#define sk_GENERAL_NAME_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), (out_index), \ + CHECKED_CAST(void *, GENERAL_NAME *, p)) + +#define sk_GENERAL_NAME_shift(sk) \ + ((GENERAL_NAME *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk))) + +#define sk_GENERAL_NAME_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \ + CHECKED_CAST(void *, GENERAL_NAME *, p)) + +#define sk_GENERAL_NAME_pop(sk) \ + ((GENERAL_NAME *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk))) + +#define sk_GENERAL_NAME_dup(sk) \ + ((STACK_OF(GENERAL_NAME) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAME) *, sk))) + +#define sk_GENERAL_NAME_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk)) + +#define sk_GENERAL_NAME_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAME) *, sk)) + +#define sk_GENERAL_NAME_set_cmp_func(sk, comp) \ + ((int (*)(const GENERAL_NAME **a, const GENERAL_NAME **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAME) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const GENERAL_NAME **a, const GENERAL_NAME **b), \ + comp))) + +#define sk_GENERAL_NAME_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(GENERAL_NAME) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAME) *, sk), \ + CHECKED_CAST(void *(*)(void *), GENERAL_NAME *(*)(GENERAL_NAME *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAME *), free_func))) + +/* GENERAL_NAMES */ +#define sk_GENERAL_NAMES_new(comp) \ + ((STACK_OF(GENERAL_NAMES) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const GENERAL_NAMES **a, const GENERAL_NAMES **b), comp))) + +#define sk_GENERAL_NAMES_new_null() ((STACK_OF(GENERAL_NAMES) *)sk_new_null()) + +#define sk_GENERAL_NAMES_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk)) + +#define sk_GENERAL_NAMES_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk)); + +#define sk_GENERAL_NAMES_value(sk, i) \ + ((GENERAL_NAMES *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAMES) *, sk), (i))) + +#define sk_GENERAL_NAMES_set(sk, i, p) \ + ((GENERAL_NAMES *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), (i), \ + CHECKED_CAST(void *, GENERAL_NAMES *, p))) + +#define sk_GENERAL_NAMES_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk)) + +#define sk_GENERAL_NAMES_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAMES *), free_func)) + +#define sk_GENERAL_NAMES_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \ + CHECKED_CAST(void *, GENERAL_NAMES *, p), (where)) + +#define sk_GENERAL_NAMES_delete(sk, where) \ + ((GENERAL_NAMES *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), (where))) + +#define sk_GENERAL_NAMES_delete_ptr(sk, p) \ + ((GENERAL_NAMES *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \ + CHECKED_CAST(void *, GENERAL_NAMES *, p))) + +#define sk_GENERAL_NAMES_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), (out_index), \ + CHECKED_CAST(void *, GENERAL_NAMES *, p)) + +#define sk_GENERAL_NAMES_shift(sk) \ + ((GENERAL_NAMES *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk))) + +#define sk_GENERAL_NAMES_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \ + CHECKED_CAST(void *, GENERAL_NAMES *, p)) + +#define sk_GENERAL_NAMES_pop(sk) \ + ((GENERAL_NAMES *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk))) + +#define sk_GENERAL_NAMES_dup(sk) \ + ((STACK_OF(GENERAL_NAMES) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAMES) *, sk))) + +#define sk_GENERAL_NAMES_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk)) + +#define sk_GENERAL_NAMES_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_NAMES) *, sk)) + +#define sk_GENERAL_NAMES_set_cmp_func(sk, comp) \ + ((int (*)(const GENERAL_NAMES **a, const GENERAL_NAMES **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_NAMES) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const GENERAL_NAMES **a, const GENERAL_NAMES **b), \ + comp))) + +#define sk_GENERAL_NAMES_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(GENERAL_NAMES) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_NAMES) *, sk), \ + CHECKED_CAST(void *(*)(void *), GENERAL_NAMES *(*)(GENERAL_NAMES *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(GENERAL_NAMES *), free_func))) + +/* GENERAL_SUBTREE */ +#define sk_GENERAL_SUBTREE_new(comp) \ + ((STACK_OF(GENERAL_SUBTREE) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const GENERAL_SUBTREE **a, const GENERAL_SUBTREE **b), comp))) + +#define sk_GENERAL_SUBTREE_new_null() \ + ((STACK_OF(GENERAL_SUBTREE) *)sk_new_null()) + +#define sk_GENERAL_SUBTREE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk)) + +#define sk_GENERAL_SUBTREE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk)); + +#define sk_GENERAL_SUBTREE_value(sk, i) \ + ((GENERAL_SUBTREE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk), (i))) + +#define sk_GENERAL_SUBTREE_set(sk, i, p) \ + ((GENERAL_SUBTREE *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), (i), \ + CHECKED_CAST(void *, GENERAL_SUBTREE *, p))) + +#define sk_GENERAL_SUBTREE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk)) + +#define sk_GENERAL_SUBTREE_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(GENERAL_SUBTREE *), free_func)) + +#define sk_GENERAL_SUBTREE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \ + CHECKED_CAST(void *, GENERAL_SUBTREE *, p), (where)) + +#define sk_GENERAL_SUBTREE_delete(sk, where) \ + ((GENERAL_SUBTREE *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), (where))) + +#define sk_GENERAL_SUBTREE_delete_ptr(sk, p) \ + ((GENERAL_SUBTREE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \ + CHECKED_CAST(void *, GENERAL_SUBTREE *, p))) + +#define sk_GENERAL_SUBTREE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \ + (out_index), CHECKED_CAST(void *, GENERAL_SUBTREE *, p)) + +#define sk_GENERAL_SUBTREE_shift(sk) \ + ((GENERAL_SUBTREE *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk))) + +#define sk_GENERAL_SUBTREE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \ + CHECKED_CAST(void *, GENERAL_SUBTREE *, p)) + +#define sk_GENERAL_SUBTREE_pop(sk) \ + ((GENERAL_SUBTREE *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk))) + +#define sk_GENERAL_SUBTREE_dup(sk) \ + ((STACK_OF(GENERAL_SUBTREE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk))) + +#define sk_GENERAL_SUBTREE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk)) + +#define sk_GENERAL_SUBTREE_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk)) + +#define sk_GENERAL_SUBTREE_set_cmp_func(sk, comp) \ + ((int (*)(const GENERAL_SUBTREE **a, const GENERAL_SUBTREE **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(GENERAL_SUBTREE) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const GENERAL_SUBTREE **a, \ + const GENERAL_SUBTREE **b), \ + comp))) + +#define sk_GENERAL_SUBTREE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(GENERAL_SUBTREE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(GENERAL_SUBTREE) *, sk), \ + CHECKED_CAST(void *(*)(void *), GENERAL_SUBTREE *(*)(GENERAL_SUBTREE *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(GENERAL_SUBTREE *), free_func))) + +/* MIME_HEADER */ +#define sk_MIME_HEADER_new(comp) \ + ((STACK_OF(MIME_HEADER) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const MIME_HEADER **a, const MIME_HEADER **b), \ + comp))) + +#define sk_MIME_HEADER_new_null() ((STACK_OF(MIME_HEADER) *)sk_new_null()) + +#define sk_MIME_HEADER_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk)) + +#define sk_MIME_HEADER_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk)); + +#define sk_MIME_HEADER_value(sk, i) \ + ((MIME_HEADER *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(MIME_HEADER) *, sk), (i))) + +#define sk_MIME_HEADER_set(sk, i, p) \ + ((MIME_HEADER *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \ + (i), CHECKED_CAST(void *, MIME_HEADER *, p))) + +#define sk_MIME_HEADER_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk)) + +#define sk_MIME_HEADER_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(MIME_HEADER *), free_func)) + +#define sk_MIME_HEADER_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \ + CHECKED_CAST(void *, MIME_HEADER *, p), (where)) + +#define sk_MIME_HEADER_delete(sk, where) \ + ((MIME_HEADER *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), (where))) + +#define sk_MIME_HEADER_delete_ptr(sk, p) \ + ((MIME_HEADER *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \ + CHECKED_CAST(void *, MIME_HEADER *, p))) + +#define sk_MIME_HEADER_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), (out_index), \ + CHECKED_CAST(void *, MIME_HEADER *, p)) + +#define sk_MIME_HEADER_shift(sk) \ + ((MIME_HEADER *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk))) + +#define sk_MIME_HEADER_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \ + CHECKED_CAST(void *, MIME_HEADER *, p)) + +#define sk_MIME_HEADER_pop(sk) \ + ((MIME_HEADER *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk))) + +#define sk_MIME_HEADER_dup(sk) \ + ((STACK_OF(MIME_HEADER) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(MIME_HEADER) *, sk))) + +#define sk_MIME_HEADER_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk)) + +#define sk_MIME_HEADER_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(MIME_HEADER) *, sk)) + +#define sk_MIME_HEADER_set_cmp_func(sk, comp) \ + ((int (*)(const MIME_HEADER **a, const MIME_HEADER **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(MIME_HEADER) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const MIME_HEADER **a, const MIME_HEADER **b), \ + comp))) + +#define sk_MIME_HEADER_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(MIME_HEADER) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(MIME_HEADER) *, sk), \ + CHECKED_CAST(void *(*)(void *), MIME_HEADER *(*)(MIME_HEADER *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(MIME_HEADER *), free_func))) + +/* PKCS7_SIGNER_INFO */ +#define sk_PKCS7_SIGNER_INFO_new(comp) \ + ((STACK_OF(PKCS7_SIGNER_INFO) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const PKCS7_SIGNER_INFO **a, const PKCS7_SIGNER_INFO **b), \ + comp))) + +#define sk_PKCS7_SIGNER_INFO_new_null() \ + ((STACK_OF(PKCS7_SIGNER_INFO) *)sk_new_null()) + +#define sk_PKCS7_SIGNER_INFO_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk)) + +#define sk_PKCS7_SIGNER_INFO_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk)); + +#define sk_PKCS7_SIGNER_INFO_value(sk, i) \ + ((PKCS7_SIGNER_INFO *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_SIGNER_INFO) *, sk), (i))) + +#define sk_PKCS7_SIGNER_INFO_set(sk, i, p) \ + ((PKCS7_SIGNER_INFO *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), (i), \ + CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p))) + +#define sk_PKCS7_SIGNER_INFO_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk)) + +#define sk_PKCS7_SIGNER_INFO_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(PKCS7_SIGNER_INFO *), \ + free_func)) + +#define sk_PKCS7_SIGNER_INFO_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \ + CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p), (where)) + +#define sk_PKCS7_SIGNER_INFO_delete(sk, where) \ + ((PKCS7_SIGNER_INFO *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), (where))) + +#define sk_PKCS7_SIGNER_INFO_delete_ptr(sk, p) \ + ((PKCS7_SIGNER_INFO *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \ + CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p))) + +#define sk_PKCS7_SIGNER_INFO_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \ + (out_index), CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p)) + +#define sk_PKCS7_SIGNER_INFO_shift(sk) \ + ((PKCS7_SIGNER_INFO *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk))) + +#define sk_PKCS7_SIGNER_INFO_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \ + CHECKED_CAST(void *, PKCS7_SIGNER_INFO *, p)) + +#define sk_PKCS7_SIGNER_INFO_pop(sk) \ + ((PKCS7_SIGNER_INFO *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk))) + +#define sk_PKCS7_SIGNER_INFO_dup(sk) \ + ((STACK_OF(PKCS7_SIGNER_INFO) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_SIGNER_INFO) *, sk))) + +#define sk_PKCS7_SIGNER_INFO_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk)) + +#define sk_PKCS7_SIGNER_INFO_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_SIGNER_INFO) *, sk)) + +#define sk_PKCS7_SIGNER_INFO_set_cmp_func(sk, comp) \ + ((int (*)(const PKCS7_SIGNER_INFO **a, const PKCS7_SIGNER_INFO **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_SIGNER_INFO) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const PKCS7_SIGNER_INFO **a, \ + const PKCS7_SIGNER_INFO **b), \ + comp))) + +#define sk_PKCS7_SIGNER_INFO_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(PKCS7_SIGNER_INFO) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(PKCS7_SIGNER_INFO) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + PKCS7_SIGNER_INFO *(*)(PKCS7_SIGNER_INFO *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(PKCS7_SIGNER_INFO *), \ + free_func))) + +/* PKCS7_RECIP_INFO */ +#define sk_PKCS7_RECIP_INFO_new(comp) \ + ((STACK_OF(PKCS7_RECIP_INFO) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const PKCS7_RECIP_INFO **a, const PKCS7_RECIP_INFO **b), comp))) + +#define sk_PKCS7_RECIP_INFO_new_null() \ + ((STACK_OF(PKCS7_RECIP_INFO) *)sk_new_null()) + +#define sk_PKCS7_RECIP_INFO_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk)) + +#define sk_PKCS7_RECIP_INFO_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk)); + +#define sk_PKCS7_RECIP_INFO_value(sk, i) \ + ((PKCS7_RECIP_INFO *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_RECIP_INFO) *, sk), (i))) + +#define sk_PKCS7_RECIP_INFO_set(sk, i, p) \ + ((PKCS7_RECIP_INFO *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), (i), \ + CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p))) + +#define sk_PKCS7_RECIP_INFO_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk)) + +#define sk_PKCS7_RECIP_INFO_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(PKCS7_RECIP_INFO *), free_func)) + +#define sk_PKCS7_RECIP_INFO_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \ + CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p), (where)) + +#define sk_PKCS7_RECIP_INFO_delete(sk, where) \ + ((PKCS7_RECIP_INFO *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), (where))) + +#define sk_PKCS7_RECIP_INFO_delete_ptr(sk, p) \ + ((PKCS7_RECIP_INFO *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \ + CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p))) + +#define sk_PKCS7_RECIP_INFO_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \ + (out_index), CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p)) + +#define sk_PKCS7_RECIP_INFO_shift(sk) \ + ((PKCS7_RECIP_INFO *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk))) + +#define sk_PKCS7_RECIP_INFO_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \ + CHECKED_CAST(void *, PKCS7_RECIP_INFO *, p)) + +#define sk_PKCS7_RECIP_INFO_pop(sk) \ + ((PKCS7_RECIP_INFO *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk))) + +#define sk_PKCS7_RECIP_INFO_dup(sk) \ + ((STACK_OF(PKCS7_RECIP_INFO) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_RECIP_INFO) *, sk))) + +#define sk_PKCS7_RECIP_INFO_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk)) + +#define sk_PKCS7_RECIP_INFO_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(PKCS7_RECIP_INFO) *, sk)) + +#define sk_PKCS7_RECIP_INFO_set_cmp_func(sk, comp) \ + ((int (*)(const PKCS7_RECIP_INFO **a, const PKCS7_RECIP_INFO **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(PKCS7_RECIP_INFO) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const PKCS7_RECIP_INFO **a, \ + const PKCS7_RECIP_INFO **b), \ + comp))) + +#define sk_PKCS7_RECIP_INFO_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(PKCS7_RECIP_INFO) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(PKCS7_RECIP_INFO) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + PKCS7_RECIP_INFO *(*)(PKCS7_RECIP_INFO *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(PKCS7_RECIP_INFO *), \ + free_func))) + +/* POLICYINFO */ +#define sk_POLICYINFO_new(comp) \ + ((STACK_OF(POLICYINFO) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const POLICYINFO **a, const POLICYINFO **b), \ + comp))) + +#define sk_POLICYINFO_new_null() ((STACK_OF(POLICYINFO) *)sk_new_null()) + +#define sk_POLICYINFO_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)) + +#define sk_POLICYINFO_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)); + +#define sk_POLICYINFO_value(sk, i) \ + ((POLICYINFO *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(POLICYINFO) *, sk), (i))) + +#define sk_POLICYINFO_set(sk, i, p) \ + ((POLICYINFO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \ + (i), CHECKED_CAST(void *, POLICYINFO *, p))) + +#define sk_POLICYINFO_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)) + +#define sk_POLICYINFO_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(POLICYINFO *), free_func)) + +#define sk_POLICYINFO_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \ + CHECKED_CAST(void *, POLICYINFO *, p), (where)) + +#define sk_POLICYINFO_delete(sk, where) \ + ((POLICYINFO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \ + (where))) + +#define sk_POLICYINFO_delete_ptr(sk, p) \ + ((POLICYINFO *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \ + CHECKED_CAST(void *, POLICYINFO *, p))) + +#define sk_POLICYINFO_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), (out_index), \ + CHECKED_CAST(void *, POLICYINFO *, p)) + +#define sk_POLICYINFO_shift(sk) \ + ((POLICYINFO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))) + +#define sk_POLICYINFO_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \ + CHECKED_CAST(void *, POLICYINFO *, p)) + +#define sk_POLICYINFO_pop(sk) \ + ((POLICYINFO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk))) + +#define sk_POLICYINFO_dup(sk) \ + ((STACK_OF(POLICYINFO) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(POLICYINFO) *, sk))) + +#define sk_POLICYINFO_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk)) + +#define sk_POLICYINFO_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(POLICYINFO) *, sk)) + +#define sk_POLICYINFO_set_cmp_func(sk, comp) \ + ((int (*)(const POLICYINFO **a, const POLICYINFO **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYINFO) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const POLICYINFO **a, const POLICYINFO **b), \ + comp))) + +#define sk_POLICYINFO_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(POLICYINFO) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(POLICYINFO) *, sk), \ + CHECKED_CAST(void *(*)(void *), POLICYINFO *(*)(POLICYINFO *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(POLICYINFO *), free_func))) + +/* POLICYQUALINFO */ +#define sk_POLICYQUALINFO_new(comp) \ + ((STACK_OF(POLICYQUALINFO) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const POLICYQUALINFO **a, const POLICYQUALINFO **b), comp))) + +#define sk_POLICYQUALINFO_new_null() ((STACK_OF(POLICYQUALINFO) *)sk_new_null()) + +#define sk_POLICYQUALINFO_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)) + +#define sk_POLICYQUALINFO_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)); + +#define sk_POLICYQUALINFO_value(sk, i) \ + ((POLICYQUALINFO *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(POLICYQUALINFO) *, sk), (i))) + +#define sk_POLICYQUALINFO_set(sk, i, p) \ + ((POLICYQUALINFO *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (i), \ + CHECKED_CAST(void *, POLICYQUALINFO *, p))) + +#define sk_POLICYQUALINFO_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)) + +#define sk_POLICYQUALINFO_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(POLICYQUALINFO *), free_func)) + +#define sk_POLICYQUALINFO_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \ + CHECKED_CAST(void *, POLICYQUALINFO *, p), (where)) + +#define sk_POLICYQUALINFO_delete(sk, where) \ + ((POLICYQUALINFO *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (where))) + +#define sk_POLICYQUALINFO_delete_ptr(sk, p) \ + ((POLICYQUALINFO *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \ + CHECKED_CAST(void *, POLICYQUALINFO *, p))) + +#define sk_POLICYQUALINFO_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), (out_index), \ + CHECKED_CAST(void *, POLICYQUALINFO *, p)) + +#define sk_POLICYQUALINFO_shift(sk) \ + ((POLICYQUALINFO *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))) + +#define sk_POLICYQUALINFO_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \ + CHECKED_CAST(void *, POLICYQUALINFO *, p)) + +#define sk_POLICYQUALINFO_pop(sk) \ + ((POLICYQUALINFO *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk))) + +#define sk_POLICYQUALINFO_dup(sk) \ + ((STACK_OF(POLICYQUALINFO) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(POLICYQUALINFO) *, sk))) + +#define sk_POLICYQUALINFO_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk)) + +#define sk_POLICYQUALINFO_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(POLICYQUALINFO) *, sk)) + +#define sk_POLICYQUALINFO_set_cmp_func(sk, comp) \ + ((int (*)(const POLICYQUALINFO **a, const POLICYQUALINFO **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICYQUALINFO) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const POLICYQUALINFO **a, \ + const POLICYQUALINFO **b), \ + comp))) + +#define sk_POLICYQUALINFO_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(POLICYQUALINFO) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(POLICYQUALINFO) *, sk), \ + CHECKED_CAST(void *(*)(void *), POLICYQUALINFO *(*)(POLICYQUALINFO *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(POLICYQUALINFO *), free_func))) + +/* POLICY_MAPPING */ +#define sk_POLICY_MAPPING_new(comp) \ + ((STACK_OF(POLICY_MAPPING) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const POLICY_MAPPING **a, const POLICY_MAPPING **b), comp))) + +#define sk_POLICY_MAPPING_new_null() ((STACK_OF(POLICY_MAPPING) *)sk_new_null()) + +#define sk_POLICY_MAPPING_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)) + +#define sk_POLICY_MAPPING_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)); + +#define sk_POLICY_MAPPING_value(sk, i) \ + ((POLICY_MAPPING *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(POLICY_MAPPING) *, sk), (i))) + +#define sk_POLICY_MAPPING_set(sk, i, p) \ + ((POLICY_MAPPING *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (i), \ + CHECKED_CAST(void *, POLICY_MAPPING *, p))) + +#define sk_POLICY_MAPPING_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)) + +#define sk_POLICY_MAPPING_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(POLICY_MAPPING *), free_func)) + +#define sk_POLICY_MAPPING_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \ + CHECKED_CAST(void *, POLICY_MAPPING *, p), (where)) + +#define sk_POLICY_MAPPING_delete(sk, where) \ + ((POLICY_MAPPING *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (where))) + +#define sk_POLICY_MAPPING_delete_ptr(sk, p) \ + ((POLICY_MAPPING *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \ + CHECKED_CAST(void *, POLICY_MAPPING *, p))) + +#define sk_POLICY_MAPPING_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), (out_index), \ + CHECKED_CAST(void *, POLICY_MAPPING *, p)) + +#define sk_POLICY_MAPPING_shift(sk) \ + ((POLICY_MAPPING *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))) + +#define sk_POLICY_MAPPING_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \ + CHECKED_CAST(void *, POLICY_MAPPING *, p)) + +#define sk_POLICY_MAPPING_pop(sk) \ + ((POLICY_MAPPING *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk))) + +#define sk_POLICY_MAPPING_dup(sk) \ + ((STACK_OF(POLICY_MAPPING) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(POLICY_MAPPING) *, sk))) + +#define sk_POLICY_MAPPING_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk)) + +#define sk_POLICY_MAPPING_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(POLICY_MAPPING) *, sk)) + +#define sk_POLICY_MAPPING_set_cmp_func(sk, comp) \ + ((int (*)(const POLICY_MAPPING **a, const POLICY_MAPPING **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(POLICY_MAPPING) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const POLICY_MAPPING **a, \ + const POLICY_MAPPING **b), \ + comp))) + +#define sk_POLICY_MAPPING_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(POLICY_MAPPING) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(POLICY_MAPPING) *, sk), \ + CHECKED_CAST(void *(*)(void *), POLICY_MAPPING *(*)(POLICY_MAPPING *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(POLICY_MAPPING *), free_func))) + +/* SSL_COMP */ +#define sk_SSL_COMP_new(comp) \ + ((STACK_OF(SSL_COMP) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const SSL_COMP **a, const SSL_COMP **b), comp))) + +#define sk_SSL_COMP_new_null() ((STACK_OF(SSL_COMP) *)sk_new_null()) + +#define sk_SSL_COMP_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)) + +#define sk_SSL_COMP_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)); + +#define sk_SSL_COMP_value(sk, i) \ + ((SSL_COMP *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(SSL_COMP) *, sk), (i))) + +#define sk_SSL_COMP_set(sk, i, p) \ + ((SSL_COMP *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), (i), \ + CHECKED_CAST(void *, SSL_COMP *, p))) + +#define sk_SSL_COMP_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)) + +#define sk_SSL_COMP_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(SSL_COMP *), free_func)) + +#define sk_SSL_COMP_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \ + CHECKED_CAST(void *, SSL_COMP *, p), (where)) + +#define sk_SSL_COMP_delete(sk, where) \ + ((SSL_COMP *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \ + (where))) + +#define sk_SSL_COMP_delete_ptr(sk, p) \ + ((SSL_COMP *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \ + CHECKED_CAST(void *, SSL_COMP *, p))) + +#define sk_SSL_COMP_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), (out_index), \ + CHECKED_CAST(void *, SSL_COMP *, p)) + +#define sk_SSL_COMP_shift(sk) \ + ((SSL_COMP *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))) + +#define sk_SSL_COMP_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \ + CHECKED_CAST(void *, SSL_COMP *, p)) + +#define sk_SSL_COMP_pop(sk) \ + ((SSL_COMP *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk))) + +#define sk_SSL_COMP_dup(sk) \ + ((STACK_OF(SSL_COMP) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(SSL_COMP) *, sk))) + +#define sk_SSL_COMP_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk)) + +#define sk_SSL_COMP_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(SSL_COMP) *, sk)) + +#define sk_SSL_COMP_set_cmp_func(sk, comp) \ + ((int (*)(const SSL_COMP **a, const SSL_COMP **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(SSL_COMP) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const SSL_COMP **a, const SSL_COMP **b), comp))) + +#define sk_SSL_COMP_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(SSL_COMP) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(SSL_COMP) *, sk), \ + CHECKED_CAST(void *(*)(void *), SSL_COMP *(*)(SSL_COMP *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(SSL_COMP *), free_func))) + +/* STACK_OF_X509_NAME_ENTRY */ +#define sk_STACK_OF_X509_NAME_ENTRY_new(comp) \ + ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const STACK_OF_X509_NAME_ENTRY **a, \ + const STACK_OF_X509_NAME_ENTRY **b), \ + comp))) + +#define sk_STACK_OF_X509_NAME_ENTRY_new_null() \ + ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_new_null()) + +#define sk_STACK_OF_X509_NAME_ENTRY_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)) + +#define sk_STACK_OF_X509_NAME_ENTRY_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)); + +#define sk_STACK_OF_X509_NAME_ENTRY_value(sk, i) \ + ((STACK_OF_X509_NAME_ENTRY *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \ + (i))) + +#define sk_STACK_OF_X509_NAME_ENTRY_set(sk, i, p) \ + ((STACK_OF_X509_NAME_ENTRY *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), (i), \ + CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p))) + +#define sk_STACK_OF_X509_NAME_ENTRY_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)) + +#define sk_STACK_OF_X509_NAME_ENTRY_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(STACK_OF_X509_NAME_ENTRY *), \ + free_func)) + +#define sk_STACK_OF_X509_NAME_ENTRY_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p), (where)) + +#define sk_STACK_OF_X509_NAME_ENTRY_delete(sk, where) \ + ((STACK_OF_X509_NAME_ENTRY *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \ + (where))) + +#define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(sk, p) \ + ((STACK_OF_X509_NAME_ENTRY *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p))) + +#define sk_STACK_OF_X509_NAME_ENTRY_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \ + (out_index), CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p)) + +#define sk_STACK_OF_X509_NAME_ENTRY_shift(sk) \ + ((STACK_OF_X509_NAME_ENTRY *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))) + +#define sk_STACK_OF_X509_NAME_ENTRY_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(void *, STACK_OF_X509_NAME_ENTRY *, p)) + +#define sk_STACK_OF_X509_NAME_ENTRY_pop(sk) \ + ((STACK_OF_X509_NAME_ENTRY *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))) + +#define sk_STACK_OF_X509_NAME_ENTRY_dup(sk) \ + ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk))) + +#define sk_STACK_OF_X509_NAME_ENTRY_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)) + +#define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(sk) \ + sk_is_sorted( \ + CHECKED_CAST(_STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk)) + +#define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(sk, comp) \ + ((int (*)(const STACK_OF_X509_NAME_ENTRY **a, \ + const STACK_OF_X509_NAME_ENTRY **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(STACK_OF_X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const STACK_OF_X509_NAME_ENTRY **a, \ + const STACK_OF_X509_NAME_ENTRY **b), \ + comp))) + +#define sk_STACK_OF_X509_NAME_ENTRY_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(STACK_OF_X509_NAME_ENTRY) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(STACK_OF_X509_NAME_ENTRY) *, \ + sk), \ + CHECKED_CAST(void *(*)(void *), \ + STACK_OF_X509_NAME_ENTRY *(*)(STACK_OF_X509_NAME_ENTRY *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(STACK_OF_X509_NAME_ENTRY *), \ + free_func))) + +/* SXNETID */ +#define sk_SXNETID_new(comp) \ + ((STACK_OF(SXNETID) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const SXNETID **a, const SXNETID **b), comp))) + +#define sk_SXNETID_new_null() ((STACK_OF(SXNETID) *)sk_new_null()) + +#define sk_SXNETID_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)) + +#define sk_SXNETID_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)); + +#define sk_SXNETID_value(sk, i) \ + ((SXNETID *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(SXNETID) *, sk), \ + (i))) + +#define sk_SXNETID_set(sk, i, p) \ + ((SXNETID *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), (i), \ + CHECKED_CAST(void *, SXNETID *, p))) + +#define sk_SXNETID_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)) + +#define sk_SXNETID_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(SXNETID *), free_func)) + +#define sk_SXNETID_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \ + CHECKED_CAST(void *, SXNETID *, p), (where)) + +#define sk_SXNETID_delete(sk, where) \ + ((SXNETID *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \ + (where))) + +#define sk_SXNETID_delete_ptr(sk, p) \ + ((SXNETID *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \ + CHECKED_CAST(void *, SXNETID *, p))) + +#define sk_SXNETID_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), (out_index), \ + CHECKED_CAST(void *, SXNETID *, p)) + +#define sk_SXNETID_shift(sk) \ + ((SXNETID *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))) + +#define sk_SXNETID_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \ + CHECKED_CAST(void *, SXNETID *, p)) + +#define sk_SXNETID_pop(sk) \ + ((SXNETID *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk))) + +#define sk_SXNETID_dup(sk) \ + ((STACK_OF(SXNETID) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(SXNETID) *, sk))) + +#define sk_SXNETID_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk)) + +#define sk_SXNETID_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(SXNETID) *, sk)) + +#define sk_SXNETID_set_cmp_func(sk, comp) \ + ((int (*)(const SXNETID **a, const SXNETID **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(SXNETID) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const SXNETID **a, const SXNETID **b), comp))) + +#define sk_SXNETID_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(SXNETID) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(SXNETID) *, sk), \ + CHECKED_CAST(void *(*)(void *), SXNETID *(*)(SXNETID *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(SXNETID *), free_func))) + +/* X509 */ +#define sk_X509_new(comp) \ + ((STACK_OF(X509) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const X509 **a, const X509 **b), comp))) + +#define sk_X509_new_null() ((STACK_OF(X509) *)sk_new_null()) + +#define sk_X509_num(sk) sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)) + +#define sk_X509_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)); + +#define sk_X509_value(sk, i) \ + ((X509 *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(X509) *, sk), (i))) + +#define sk_X509_set(sk, i, p) \ + ((X509 *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (i), \ + CHECKED_CAST(void *, X509 *, p))) + +#define sk_X509_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)) + +#define sk_X509_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509 *), free_func)) + +#define sk_X509_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \ + CHECKED_CAST(void *, X509 *, p), (where)) + +#define sk_X509_delete(sk, where) \ + ((X509 *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (where))) + +#define sk_X509_delete_ptr(sk, p) \ + ((X509 *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \ + CHECKED_CAST(void *, X509 *, p))) + +#define sk_X509_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), (out_index), \ + CHECKED_CAST(void *, X509 *, p)) + +#define sk_X509_shift(sk) \ + ((X509 *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))) + +#define sk_X509_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \ + CHECKED_CAST(void *, X509 *, p)) + +#define sk_X509_pop(sk) \ + ((X509 *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk))) + +#define sk_X509_dup(sk) \ + ((STACK_OF(X509) *)sk_dup(CHECKED_CAST(_STACK *, const STACK_OF(X509) *, sk))) + +#define sk_X509_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk)) + +#define sk_X509_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509) *, sk)) + +#define sk_X509_set_cmp_func(sk, comp) \ + ((int (*)(const X509 **a, const X509 **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const X509 **a, const X509 **b), \ + comp))) + +#define sk_X509_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509 *(*)(X509 *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509 *), free_func))) + +/* X509V3_EXT_METHOD */ +#define sk_X509V3_EXT_METHOD_new(comp) \ + ((STACK_OF(X509V3_EXT_METHOD) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const X509V3_EXT_METHOD **a, const X509V3_EXT_METHOD **b), \ + comp))) + +#define sk_X509V3_EXT_METHOD_new_null() \ + ((STACK_OF(X509V3_EXT_METHOD) *)sk_new_null()) + +#define sk_X509V3_EXT_METHOD_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)) + +#define sk_X509V3_EXT_METHOD_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)); + +#define sk_X509V3_EXT_METHOD_value(sk, i) \ + ((X509V3_EXT_METHOD *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk), (i))) + +#define sk_X509V3_EXT_METHOD_set(sk, i, p) \ + ((X509V3_EXT_METHOD *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), (i), \ + CHECKED_CAST(void *, X509V3_EXT_METHOD *, p))) + +#define sk_X509V3_EXT_METHOD_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)) + +#define sk_X509V3_EXT_METHOD_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509V3_EXT_METHOD *), \ + free_func)) + +#define sk_X509V3_EXT_METHOD_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \ + CHECKED_CAST(void *, X509V3_EXT_METHOD *, p), (where)) + +#define sk_X509V3_EXT_METHOD_delete(sk, where) \ + ((X509V3_EXT_METHOD *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), (where))) + +#define sk_X509V3_EXT_METHOD_delete_ptr(sk, p) \ + ((X509V3_EXT_METHOD *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \ + CHECKED_CAST(void *, X509V3_EXT_METHOD *, p))) + +#define sk_X509V3_EXT_METHOD_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \ + (out_index), CHECKED_CAST(void *, X509V3_EXT_METHOD *, p)) + +#define sk_X509V3_EXT_METHOD_shift(sk) \ + ((X509V3_EXT_METHOD *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))) + +#define sk_X509V3_EXT_METHOD_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \ + CHECKED_CAST(void *, X509V3_EXT_METHOD *, p)) + +#define sk_X509V3_EXT_METHOD_pop(sk) \ + ((X509V3_EXT_METHOD *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk))) + +#define sk_X509V3_EXT_METHOD_dup(sk) \ + ((STACK_OF(X509V3_EXT_METHOD) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk))) + +#define sk_X509V3_EXT_METHOD_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk)) + +#define sk_X509V3_EXT_METHOD_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk)) + +#define sk_X509V3_EXT_METHOD_set_cmp_func(sk, comp) \ + ((int (*)(const X509V3_EXT_METHOD **a, const X509V3_EXT_METHOD **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509V3_EXT_METHOD) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const X509V3_EXT_METHOD **a, \ + const X509V3_EXT_METHOD **b), \ + comp))) + +#define sk_X509V3_EXT_METHOD_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509V3_EXT_METHOD) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509V3_EXT_METHOD) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + X509V3_EXT_METHOD *(*)(X509V3_EXT_METHOD *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509V3_EXT_METHOD *), \ + free_func))) + +/* X509_ALGOR */ +#define sk_X509_ALGOR_new(comp) \ + ((STACK_OF(X509_ALGOR) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const X509_ALGOR **a, const X509_ALGOR **b), \ + comp))) + +#define sk_X509_ALGOR_new_null() ((STACK_OF(X509_ALGOR) *)sk_new_null()) + +#define sk_X509_ALGOR_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)) + +#define sk_X509_ALGOR_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)); + +#define sk_X509_ALGOR_value(sk, i) \ + ((X509_ALGOR *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_ALGOR) *, sk), (i))) + +#define sk_X509_ALGOR_set(sk, i, p) \ + ((X509_ALGOR *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \ + (i), CHECKED_CAST(void *, X509_ALGOR *, p))) + +#define sk_X509_ALGOR_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)) + +#define sk_X509_ALGOR_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_ALGOR *), free_func)) + +#define sk_X509_ALGOR_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \ + CHECKED_CAST(void *, X509_ALGOR *, p), (where)) + +#define sk_X509_ALGOR_delete(sk, where) \ + ((X509_ALGOR *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \ + (where))) + +#define sk_X509_ALGOR_delete_ptr(sk, p) \ + ((X509_ALGOR *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \ + CHECKED_CAST(void *, X509_ALGOR *, p))) + +#define sk_X509_ALGOR_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_ALGOR *, p)) + +#define sk_X509_ALGOR_shift(sk) \ + ((X509_ALGOR *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))) + +#define sk_X509_ALGOR_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \ + CHECKED_CAST(void *, X509_ALGOR *, p)) + +#define sk_X509_ALGOR_pop(sk) \ + ((X509_ALGOR *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk))) + +#define sk_X509_ALGOR_dup(sk) \ + ((STACK_OF(X509_ALGOR) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_ALGOR) *, sk))) + +#define sk_X509_ALGOR_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk)) + +#define sk_X509_ALGOR_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_ALGOR) *, sk)) + +#define sk_X509_ALGOR_set_cmp_func(sk, comp) \ + ((int (*)(const X509_ALGOR **a, const X509_ALGOR **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ALGOR) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_ALGOR **a, const X509_ALGOR **b), \ + comp))) + +#define sk_X509_ALGOR_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_ALGOR) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_ALGOR) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_ALGOR *(*)(X509_ALGOR *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_ALGOR *), free_func))) + +/* X509_ATTRIBUTE */ +#define sk_X509_ATTRIBUTE_new(comp) \ + ((STACK_OF(X509_ATTRIBUTE) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const X509_ATTRIBUTE **a, const X509_ATTRIBUTE **b), comp))) + +#define sk_X509_ATTRIBUTE_new_null() ((STACK_OF(X509_ATTRIBUTE) *)sk_new_null()) + +#define sk_X509_ATTRIBUTE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)) + +#define sk_X509_ATTRIBUTE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)); + +#define sk_X509_ATTRIBUTE_value(sk, i) \ + ((X509_ATTRIBUTE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk), (i))) + +#define sk_X509_ATTRIBUTE_set(sk, i, p) \ + ((X509_ATTRIBUTE *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (i), \ + CHECKED_CAST(void *, X509_ATTRIBUTE *, p))) + +#define sk_X509_ATTRIBUTE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)) + +#define sk_X509_ATTRIBUTE_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_ATTRIBUTE *), free_func)) + +#define sk_X509_ATTRIBUTE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \ + CHECKED_CAST(void *, X509_ATTRIBUTE *, p), (where)) + +#define sk_X509_ATTRIBUTE_delete(sk, where) \ + ((X509_ATTRIBUTE *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (where))) + +#define sk_X509_ATTRIBUTE_delete_ptr(sk, p) \ + ((X509_ATTRIBUTE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \ + CHECKED_CAST(void *, X509_ATTRIBUTE *, p))) + +#define sk_X509_ATTRIBUTE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_ATTRIBUTE *, p)) + +#define sk_X509_ATTRIBUTE_shift(sk) \ + ((X509_ATTRIBUTE *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))) + +#define sk_X509_ATTRIBUTE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \ + CHECKED_CAST(void *, X509_ATTRIBUTE *, p)) + +#define sk_X509_ATTRIBUTE_pop(sk) \ + ((X509_ATTRIBUTE *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk))) + +#define sk_X509_ATTRIBUTE_dup(sk) \ + ((STACK_OF(X509_ATTRIBUTE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk))) + +#define sk_X509_ATTRIBUTE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk)) + +#define sk_X509_ATTRIBUTE_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk)) + +#define sk_X509_ATTRIBUTE_set_cmp_func(sk, comp) \ + ((int (*)(const X509_ATTRIBUTE **a, const X509_ATTRIBUTE **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_ATTRIBUTE) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const X509_ATTRIBUTE **a, \ + const X509_ATTRIBUTE **b), \ + comp))) + +#define sk_X509_ATTRIBUTE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_ATTRIBUTE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_ATTRIBUTE) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_ATTRIBUTE *(*)(X509_ATTRIBUTE *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_ATTRIBUTE *), free_func))) + +/* X509_CRL */ +#define sk_X509_CRL_new(comp) \ + ((STACK_OF(X509_CRL) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const X509_CRL **a, const X509_CRL **b), comp))) + +#define sk_X509_CRL_new_null() ((STACK_OF(X509_CRL) *)sk_new_null()) + +#define sk_X509_CRL_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)) + +#define sk_X509_CRL_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)); + +#define sk_X509_CRL_value(sk, i) \ + ((X509_CRL *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_CRL) *, sk), (i))) + +#define sk_X509_CRL_set(sk, i, p) \ + ((X509_CRL *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), (i), \ + CHECKED_CAST(void *, X509_CRL *, p))) + +#define sk_X509_CRL_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)) + +#define sk_X509_CRL_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_CRL *), free_func)) + +#define sk_X509_CRL_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \ + CHECKED_CAST(void *, X509_CRL *, p), (where)) + +#define sk_X509_CRL_delete(sk, where) \ + ((X509_CRL *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \ + (where))) + +#define sk_X509_CRL_delete_ptr(sk, p) \ + ((X509_CRL *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \ + CHECKED_CAST(void *, X509_CRL *, p))) + +#define sk_X509_CRL_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_CRL *, p)) + +#define sk_X509_CRL_shift(sk) \ + ((X509_CRL *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))) + +#define sk_X509_CRL_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \ + CHECKED_CAST(void *, X509_CRL *, p)) + +#define sk_X509_CRL_pop(sk) \ + ((X509_CRL *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk))) + +#define sk_X509_CRL_dup(sk) \ + ((STACK_OF(X509_CRL) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_CRL) *, sk))) + +#define sk_X509_CRL_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk)) + +#define sk_X509_CRL_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_CRL) *, sk)) + +#define sk_X509_CRL_set_cmp_func(sk, comp) \ + ((int (*)(const X509_CRL **a, const X509_CRL **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_CRL) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_CRL **a, const X509_CRL **b), comp))) + +#define sk_X509_CRL_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_CRL) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_CRL) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_CRL *(*)(X509_CRL *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_CRL *), free_func))) + +/* X509_EXTENSION */ +#define sk_X509_EXTENSION_new(comp) \ + ((STACK_OF(X509_EXTENSION) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const X509_EXTENSION **a, const X509_EXTENSION **b), comp))) + +#define sk_X509_EXTENSION_new_null() ((STACK_OF(X509_EXTENSION) *)sk_new_null()) + +#define sk_X509_EXTENSION_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)) + +#define sk_X509_EXTENSION_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)); + +#define sk_X509_EXTENSION_value(sk, i) \ + ((X509_EXTENSION *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_EXTENSION) *, sk), (i))) + +#define sk_X509_EXTENSION_set(sk, i, p) \ + ((X509_EXTENSION *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (i), \ + CHECKED_CAST(void *, X509_EXTENSION *, p))) + +#define sk_X509_EXTENSION_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)) + +#define sk_X509_EXTENSION_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_EXTENSION *), free_func)) + +#define sk_X509_EXTENSION_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \ + CHECKED_CAST(void *, X509_EXTENSION *, p), (where)) + +#define sk_X509_EXTENSION_delete(sk, where) \ + ((X509_EXTENSION *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (where))) + +#define sk_X509_EXTENSION_delete_ptr(sk, p) \ + ((X509_EXTENSION *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \ + CHECKED_CAST(void *, X509_EXTENSION *, p))) + +#define sk_X509_EXTENSION_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_EXTENSION *, p)) + +#define sk_X509_EXTENSION_shift(sk) \ + ((X509_EXTENSION *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))) + +#define sk_X509_EXTENSION_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \ + CHECKED_CAST(void *, X509_EXTENSION *, p)) + +#define sk_X509_EXTENSION_pop(sk) \ + ((X509_EXTENSION *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk))) + +#define sk_X509_EXTENSION_dup(sk) \ + ((STACK_OF(X509_EXTENSION) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_EXTENSION) *, sk))) + +#define sk_X509_EXTENSION_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk)) + +#define sk_X509_EXTENSION_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_EXTENSION) *, sk)) + +#define sk_X509_EXTENSION_set_cmp_func(sk, comp) \ + ((int (*)(const X509_EXTENSION **a, const X509_EXTENSION **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_EXTENSION) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const X509_EXTENSION **a, \ + const X509_EXTENSION **b), \ + comp))) + +#define sk_X509_EXTENSION_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_EXTENSION) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_EXTENSION) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_EXTENSION *(*)(X509_EXTENSION *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_EXTENSION *), free_func))) + +/* X509_INFO */ +#define sk_X509_INFO_new(comp) \ + ((STACK_OF(X509_INFO) *)sk_new( \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_INFO **a, const X509_INFO **b), comp))) + +#define sk_X509_INFO_new_null() ((STACK_OF(X509_INFO) *)sk_new_null()) + +#define sk_X509_INFO_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)) + +#define sk_X509_INFO_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)); + +#define sk_X509_INFO_value(sk, i) \ + ((X509_INFO *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_INFO) *, sk), (i))) + +#define sk_X509_INFO_set(sk, i, p) \ + ((X509_INFO *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), (i), \ + CHECKED_CAST(void *, X509_INFO *, p))) + +#define sk_X509_INFO_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)) + +#define sk_X509_INFO_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_INFO *), free_func)) + +#define sk_X509_INFO_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \ + CHECKED_CAST(void *, X509_INFO *, p), (where)) + +#define sk_X509_INFO_delete(sk, where) \ + ((X509_INFO *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \ + (where))) + +#define sk_X509_INFO_delete_ptr(sk, p) \ + ((X509_INFO *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \ + CHECKED_CAST(void *, X509_INFO *, p))) + +#define sk_X509_INFO_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_INFO *, p)) + +#define sk_X509_INFO_shift(sk) \ + ((X509_INFO *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))) + +#define sk_X509_INFO_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \ + CHECKED_CAST(void *, X509_INFO *, p)) + +#define sk_X509_INFO_pop(sk) \ + ((X509_INFO *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk))) + +#define sk_X509_INFO_dup(sk) \ + ((STACK_OF(X509_INFO) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_INFO) *, sk))) + +#define sk_X509_INFO_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk)) + +#define sk_X509_INFO_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_INFO) *, sk)) + +#define sk_X509_INFO_set_cmp_func(sk, comp) \ + ((int (*)(const X509_INFO **a, const X509_INFO **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_INFO) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_INFO **a, const X509_INFO **b), comp))) + +#define sk_X509_INFO_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_INFO) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_INFO) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_INFO *(*)(X509_INFO *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_INFO *), free_func))) + +/* X509_LOOKUP */ +#define sk_X509_LOOKUP_new(comp) \ + ((STACK_OF(X509_LOOKUP) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b), \ + comp))) + +#define sk_X509_LOOKUP_new_null() ((STACK_OF(X509_LOOKUP) *)sk_new_null()) + +#define sk_X509_LOOKUP_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)) + +#define sk_X509_LOOKUP_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)); + +#define sk_X509_LOOKUP_value(sk, i) \ + ((X509_LOOKUP *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_LOOKUP) *, sk), (i))) + +#define sk_X509_LOOKUP_set(sk, i, p) \ + ((X509_LOOKUP *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \ + (i), CHECKED_CAST(void *, X509_LOOKUP *, p))) + +#define sk_X509_LOOKUP_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)) + +#define sk_X509_LOOKUP_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_LOOKUP *), free_func)) + +#define sk_X509_LOOKUP_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \ + CHECKED_CAST(void *, X509_LOOKUP *, p), (where)) + +#define sk_X509_LOOKUP_delete(sk, where) \ + ((X509_LOOKUP *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), (where))) + +#define sk_X509_LOOKUP_delete_ptr(sk, p) \ + ((X509_LOOKUP *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \ + CHECKED_CAST(void *, X509_LOOKUP *, p))) + +#define sk_X509_LOOKUP_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_LOOKUP *, p)) + +#define sk_X509_LOOKUP_shift(sk) \ + ((X509_LOOKUP *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))) + +#define sk_X509_LOOKUP_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \ + CHECKED_CAST(void *, X509_LOOKUP *, p)) + +#define sk_X509_LOOKUP_pop(sk) \ + ((X509_LOOKUP *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk))) + +#define sk_X509_LOOKUP_dup(sk) \ + ((STACK_OF(X509_LOOKUP) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_LOOKUP) *, sk))) + +#define sk_X509_LOOKUP_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk)) + +#define sk_X509_LOOKUP_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_LOOKUP) *, sk)) + +#define sk_X509_LOOKUP_set_cmp_func(sk, comp) \ + ((int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_LOOKUP) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_LOOKUP **a, const X509_LOOKUP **b), \ + comp))) + +#define sk_X509_LOOKUP_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_LOOKUP) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_LOOKUP) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_LOOKUP *(*)(X509_LOOKUP *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_LOOKUP *), free_func))) + +/* X509_NAME */ +#define sk_X509_NAME_new(comp) \ + ((STACK_OF(X509_NAME) *)sk_new( \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_NAME **a, const X509_NAME **b), comp))) + +#define sk_X509_NAME_new_null() ((STACK_OF(X509_NAME) *)sk_new_null()) + +#define sk_X509_NAME_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)) + +#define sk_X509_NAME_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)); + +#define sk_X509_NAME_value(sk, i) \ + ((X509_NAME *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME) *, sk), (i))) + +#define sk_X509_NAME_set(sk, i, p) \ + ((X509_NAME *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), (i), \ + CHECKED_CAST(void *, X509_NAME *, p))) + +#define sk_X509_NAME_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)) + +#define sk_X509_NAME_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_NAME *), free_func)) + +#define sk_X509_NAME_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \ + CHECKED_CAST(void *, X509_NAME *, p), (where)) + +#define sk_X509_NAME_delete(sk, where) \ + ((X509_NAME *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \ + (where))) + +#define sk_X509_NAME_delete_ptr(sk, p) \ + ((X509_NAME *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \ + CHECKED_CAST(void *, X509_NAME *, p))) + +#define sk_X509_NAME_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_NAME *, p)) + +#define sk_X509_NAME_shift(sk) \ + ((X509_NAME *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))) + +#define sk_X509_NAME_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \ + CHECKED_CAST(void *, X509_NAME *, p)) + +#define sk_X509_NAME_pop(sk) \ + ((X509_NAME *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk))) + +#define sk_X509_NAME_dup(sk) \ + ((STACK_OF(X509_NAME) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME) *, sk))) + +#define sk_X509_NAME_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk)) + +#define sk_X509_NAME_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME) *, sk)) + +#define sk_X509_NAME_set_cmp_func(sk, comp) \ + ((int (*)(const X509_NAME **a, const X509_NAME **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_NAME **a, const X509_NAME **b), comp))) + +#define sk_X509_NAME_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_NAME) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_NAME *(*)(X509_NAME *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_NAME *), free_func))) + +/* X509_NAME_ENTRY */ +#define sk_X509_NAME_ENTRY_new(comp) \ + ((STACK_OF(X509_NAME_ENTRY) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const X509_NAME_ENTRY **a, const X509_NAME_ENTRY **b), comp))) + +#define sk_X509_NAME_ENTRY_new_null() \ + ((STACK_OF(X509_NAME_ENTRY) *)sk_new_null()) + +#define sk_X509_NAME_ENTRY_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)) + +#define sk_X509_NAME_ENTRY_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)); + +#define sk_X509_NAME_ENTRY_value(sk, i) \ + ((X509_NAME_ENTRY *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk), (i))) + +#define sk_X509_NAME_ENTRY_set(sk, i, p) \ + ((X509_NAME_ENTRY *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), (i), \ + CHECKED_CAST(void *, X509_NAME_ENTRY *, p))) + +#define sk_X509_NAME_ENTRY_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)) + +#define sk_X509_NAME_ENTRY_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_NAME_ENTRY *), free_func)) + +#define sk_X509_NAME_ENTRY_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(void *, X509_NAME_ENTRY *, p), (where)) + +#define sk_X509_NAME_ENTRY_delete(sk, where) \ + ((X509_NAME_ENTRY *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), (where))) + +#define sk_X509_NAME_ENTRY_delete_ptr(sk, p) \ + ((X509_NAME_ENTRY *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(void *, X509_NAME_ENTRY *, p))) + +#define sk_X509_NAME_ENTRY_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \ + (out_index), CHECKED_CAST(void *, X509_NAME_ENTRY *, p)) + +#define sk_X509_NAME_ENTRY_shift(sk) \ + ((X509_NAME_ENTRY *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))) + +#define sk_X509_NAME_ENTRY_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(void *, X509_NAME_ENTRY *, p)) + +#define sk_X509_NAME_ENTRY_pop(sk) \ + ((X509_NAME_ENTRY *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk))) + +#define sk_X509_NAME_ENTRY_dup(sk) \ + ((STACK_OF(X509_NAME_ENTRY) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk))) + +#define sk_X509_NAME_ENTRY_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk)) + +#define sk_X509_NAME_ENTRY_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk)) + +#define sk_X509_NAME_ENTRY_set_cmp_func(sk, comp) \ + ((int (*)(const X509_NAME_ENTRY **a, const X509_NAME_ENTRY **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const X509_NAME_ENTRY **a, \ + const X509_NAME_ENTRY **b), \ + comp))) + +#define sk_X509_NAME_ENTRY_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_NAME_ENTRY) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_NAME_ENTRY) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_NAME_ENTRY *(*)(X509_NAME_ENTRY *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_NAME_ENTRY *), free_func))) + +/* X509_OBJECT */ +#define sk_X509_OBJECT_new(comp) \ + ((STACK_OF(X509_OBJECT) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const X509_OBJECT **a, const X509_OBJECT **b), \ + comp))) + +#define sk_X509_OBJECT_new_null() ((STACK_OF(X509_OBJECT) *)sk_new_null()) + +#define sk_X509_OBJECT_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)) + +#define sk_X509_OBJECT_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)); + +#define sk_X509_OBJECT_value(sk, i) \ + ((X509_OBJECT *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_OBJECT) *, sk), (i))) + +#define sk_X509_OBJECT_set(sk, i, p) \ + ((X509_OBJECT *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \ + (i), CHECKED_CAST(void *, X509_OBJECT *, p))) + +#define sk_X509_OBJECT_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)) + +#define sk_X509_OBJECT_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_OBJECT *), free_func)) + +#define sk_X509_OBJECT_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \ + CHECKED_CAST(void *, X509_OBJECT *, p), (where)) + +#define sk_X509_OBJECT_delete(sk, where) \ + ((X509_OBJECT *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), (where))) + +#define sk_X509_OBJECT_delete_ptr(sk, p) \ + ((X509_OBJECT *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \ + CHECKED_CAST(void *, X509_OBJECT *, p))) + +#define sk_X509_OBJECT_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_OBJECT *, p)) + +#define sk_X509_OBJECT_shift(sk) \ + ((X509_OBJECT *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))) + +#define sk_X509_OBJECT_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \ + CHECKED_CAST(void *, X509_OBJECT *, p)) + +#define sk_X509_OBJECT_pop(sk) \ + ((X509_OBJECT *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk))) + +#define sk_X509_OBJECT_dup(sk) \ + ((STACK_OF(X509_OBJECT) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_OBJECT) *, sk))) + +#define sk_X509_OBJECT_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk)) + +#define sk_X509_OBJECT_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_OBJECT) *, sk)) + +#define sk_X509_OBJECT_set_cmp_func(sk, comp) \ + ((int (*)(const X509_OBJECT **a, const X509_OBJECT **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_OBJECT) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_OBJECT **a, const X509_OBJECT **b), \ + comp))) + +#define sk_X509_OBJECT_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_OBJECT) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_OBJECT) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_OBJECT *(*)(X509_OBJECT *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_OBJECT *), free_func))) + +/* X509_POLICY_DATA */ +#define sk_X509_POLICY_DATA_new(comp) \ + ((STACK_OF(X509_POLICY_DATA) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const X509_POLICY_DATA **a, const X509_POLICY_DATA **b), comp))) + +#define sk_X509_POLICY_DATA_new_null() \ + ((STACK_OF(X509_POLICY_DATA) *)sk_new_null()) + +#define sk_X509_POLICY_DATA_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)) + +#define sk_X509_POLICY_DATA_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)); + +#define sk_X509_POLICY_DATA_value(sk, i) \ + ((X509_POLICY_DATA *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_DATA) *, sk), (i))) + +#define sk_X509_POLICY_DATA_set(sk, i, p) \ + ((X509_POLICY_DATA *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), (i), \ + CHECKED_CAST(void *, X509_POLICY_DATA *, p))) + +#define sk_X509_POLICY_DATA_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)) + +#define sk_X509_POLICY_DATA_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_DATA *), free_func)) + +#define sk_X509_POLICY_DATA_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \ + CHECKED_CAST(void *, X509_POLICY_DATA *, p), (where)) + +#define sk_X509_POLICY_DATA_delete(sk, where) \ + ((X509_POLICY_DATA *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), (where))) + +#define sk_X509_POLICY_DATA_delete_ptr(sk, p) \ + ((X509_POLICY_DATA *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \ + CHECKED_CAST(void *, X509_POLICY_DATA *, p))) + +#define sk_X509_POLICY_DATA_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \ + (out_index), CHECKED_CAST(void *, X509_POLICY_DATA *, p)) + +#define sk_X509_POLICY_DATA_shift(sk) \ + ((X509_POLICY_DATA *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))) + +#define sk_X509_POLICY_DATA_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \ + CHECKED_CAST(void *, X509_POLICY_DATA *, p)) + +#define sk_X509_POLICY_DATA_pop(sk) \ + ((X509_POLICY_DATA *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk))) + +#define sk_X509_POLICY_DATA_dup(sk) \ + ((STACK_OF(X509_POLICY_DATA) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_DATA) *, sk))) + +#define sk_X509_POLICY_DATA_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk)) + +#define sk_X509_POLICY_DATA_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_DATA) *, sk)) + +#define sk_X509_POLICY_DATA_set_cmp_func(sk, comp) \ + ((int (*)(const X509_POLICY_DATA **a, const X509_POLICY_DATA **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_DATA) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const X509_POLICY_DATA **a, \ + const X509_POLICY_DATA **b), \ + comp))) + +#define sk_X509_POLICY_DATA_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_POLICY_DATA) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_DATA) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + X509_POLICY_DATA *(*)(X509_POLICY_DATA *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_DATA *), \ + free_func))) + +/* X509_POLICY_NODE */ +#define sk_X509_POLICY_NODE_new(comp) \ + ((STACK_OF(X509_POLICY_NODE) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const X509_POLICY_NODE **a, const X509_POLICY_NODE **b), comp))) + +#define sk_X509_POLICY_NODE_new_null() \ + ((STACK_OF(X509_POLICY_NODE) *)sk_new_null()) + +#define sk_X509_POLICY_NODE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)) + +#define sk_X509_POLICY_NODE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)); + +#define sk_X509_POLICY_NODE_value(sk, i) \ + ((X509_POLICY_NODE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_NODE) *, sk), (i))) + +#define sk_X509_POLICY_NODE_set(sk, i, p) \ + ((X509_POLICY_NODE *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), (i), \ + CHECKED_CAST(void *, X509_POLICY_NODE *, p))) + +#define sk_X509_POLICY_NODE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)) + +#define sk_X509_POLICY_NODE_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_NODE *), free_func)) + +#define sk_X509_POLICY_NODE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \ + CHECKED_CAST(void *, X509_POLICY_NODE *, p), (where)) + +#define sk_X509_POLICY_NODE_delete(sk, where) \ + ((X509_POLICY_NODE *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), (where))) + +#define sk_X509_POLICY_NODE_delete_ptr(sk, p) \ + ((X509_POLICY_NODE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \ + CHECKED_CAST(void *, X509_POLICY_NODE *, p))) + +#define sk_X509_POLICY_NODE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \ + (out_index), CHECKED_CAST(void *, X509_POLICY_NODE *, p)) + +#define sk_X509_POLICY_NODE_shift(sk) \ + ((X509_POLICY_NODE *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))) + +#define sk_X509_POLICY_NODE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \ + CHECKED_CAST(void *, X509_POLICY_NODE *, p)) + +#define sk_X509_POLICY_NODE_pop(sk) \ + ((X509_POLICY_NODE *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk))) + +#define sk_X509_POLICY_NODE_dup(sk) \ + ((STACK_OF(X509_POLICY_NODE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_NODE) *, sk))) + +#define sk_X509_POLICY_NODE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk)) + +#define sk_X509_POLICY_NODE_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_POLICY_NODE) *, sk)) + +#define sk_X509_POLICY_NODE_set_cmp_func(sk, comp) \ + ((int (*)(const X509_POLICY_NODE **a, const X509_POLICY_NODE **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_POLICY_NODE) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const X509_POLICY_NODE **a, \ + const X509_POLICY_NODE **b), \ + comp))) + +#define sk_X509_POLICY_NODE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_POLICY_NODE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_POLICY_NODE) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + X509_POLICY_NODE *(*)(X509_POLICY_NODE *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_POLICY_NODE *), \ + free_func))) + +/* X509_PURPOSE */ +#define sk_X509_PURPOSE_new(comp) \ + ((STACK_OF(X509_PURPOSE) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b), \ + comp))) + +#define sk_X509_PURPOSE_new_null() ((STACK_OF(X509_PURPOSE) *)sk_new_null()) + +#define sk_X509_PURPOSE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)) + +#define sk_X509_PURPOSE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)); + +#define sk_X509_PURPOSE_value(sk, i) \ + ((X509_PURPOSE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_PURPOSE) *, sk), (i))) + +#define sk_X509_PURPOSE_set(sk, i, p) \ + ((X509_PURPOSE *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (i), \ + CHECKED_CAST(void *, X509_PURPOSE *, p))) + +#define sk_X509_PURPOSE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)) + +#define sk_X509_PURPOSE_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_PURPOSE *), free_func)) + +#define sk_X509_PURPOSE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \ + CHECKED_CAST(void *, X509_PURPOSE *, p), (where)) + +#define sk_X509_PURPOSE_delete(sk, where) \ + ((X509_PURPOSE *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (where))) + +#define sk_X509_PURPOSE_delete_ptr(sk, p) \ + ((X509_PURPOSE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \ + CHECKED_CAST(void *, X509_PURPOSE *, p))) + +#define sk_X509_PURPOSE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_PURPOSE *, p)) + +#define sk_X509_PURPOSE_shift(sk) \ + ((X509_PURPOSE *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))) + +#define sk_X509_PURPOSE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \ + CHECKED_CAST(void *, X509_PURPOSE *, p)) + +#define sk_X509_PURPOSE_pop(sk) \ + ((X509_PURPOSE *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk))) + +#define sk_X509_PURPOSE_dup(sk) \ + ((STACK_OF(X509_PURPOSE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_PURPOSE) *, sk))) + +#define sk_X509_PURPOSE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk)) + +#define sk_X509_PURPOSE_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_PURPOSE) *, sk)) + +#define sk_X509_PURPOSE_set_cmp_func(sk, comp) \ + ((int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_PURPOSE) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_PURPOSE **a, const X509_PURPOSE **b), \ + comp))) + +#define sk_X509_PURPOSE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_PURPOSE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_PURPOSE) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_PURPOSE *(*)(X509_PURPOSE *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_PURPOSE *), free_func))) + +/* X509_REVOKED */ +#define sk_X509_REVOKED_new(comp) \ + ((STACK_OF(X509_REVOKED) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const X509_REVOKED **a, const X509_REVOKED **b), \ + comp))) + +#define sk_X509_REVOKED_new_null() ((STACK_OF(X509_REVOKED) *)sk_new_null()) + +#define sk_X509_REVOKED_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)) + +#define sk_X509_REVOKED_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)); + +#define sk_X509_REVOKED_value(sk, i) \ + ((X509_REVOKED *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_REVOKED) *, sk), (i))) + +#define sk_X509_REVOKED_set(sk, i, p) \ + ((X509_REVOKED *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (i), \ + CHECKED_CAST(void *, X509_REVOKED *, p))) + +#define sk_X509_REVOKED_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)) + +#define sk_X509_REVOKED_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_REVOKED *), free_func)) + +#define sk_X509_REVOKED_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \ + CHECKED_CAST(void *, X509_REVOKED *, p), (where)) + +#define sk_X509_REVOKED_delete(sk, where) \ + ((X509_REVOKED *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (where))) + +#define sk_X509_REVOKED_delete_ptr(sk, p) \ + ((X509_REVOKED *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \ + CHECKED_CAST(void *, X509_REVOKED *, p))) + +#define sk_X509_REVOKED_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_REVOKED *, p)) + +#define sk_X509_REVOKED_shift(sk) \ + ((X509_REVOKED *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))) + +#define sk_X509_REVOKED_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \ + CHECKED_CAST(void *, X509_REVOKED *, p)) + +#define sk_X509_REVOKED_pop(sk) \ + ((X509_REVOKED *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk))) + +#define sk_X509_REVOKED_dup(sk) \ + ((STACK_OF(X509_REVOKED) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_REVOKED) *, sk))) + +#define sk_X509_REVOKED_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk)) + +#define sk_X509_REVOKED_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_REVOKED) *, sk)) + +#define sk_X509_REVOKED_set_cmp_func(sk, comp) \ + ((int (*)(const X509_REVOKED **a, const X509_REVOKED **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_REVOKED) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_REVOKED **a, const X509_REVOKED **b), \ + comp))) + +#define sk_X509_REVOKED_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_REVOKED) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_REVOKED) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_REVOKED *(*)(X509_REVOKED *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_REVOKED *), free_func))) + +/* X509_TRUST */ +#define sk_X509_TRUST_new(comp) \ + ((STACK_OF(X509_TRUST) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const X509_TRUST **a, const X509_TRUST **b), \ + comp))) + +#define sk_X509_TRUST_new_null() ((STACK_OF(X509_TRUST) *)sk_new_null()) + +#define sk_X509_TRUST_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)) + +#define sk_X509_TRUST_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)); + +#define sk_X509_TRUST_value(sk, i) \ + ((X509_TRUST *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_TRUST) *, sk), (i))) + +#define sk_X509_TRUST_set(sk, i, p) \ + ((X509_TRUST *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \ + (i), CHECKED_CAST(void *, X509_TRUST *, p))) + +#define sk_X509_TRUST_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)) + +#define sk_X509_TRUST_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_TRUST *), free_func)) + +#define sk_X509_TRUST_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \ + CHECKED_CAST(void *, X509_TRUST *, p), (where)) + +#define sk_X509_TRUST_delete(sk, where) \ + ((X509_TRUST *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \ + (where))) + +#define sk_X509_TRUST_delete_ptr(sk, p) \ + ((X509_TRUST *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \ + CHECKED_CAST(void *, X509_TRUST *, p))) + +#define sk_X509_TRUST_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), (out_index), \ + CHECKED_CAST(void *, X509_TRUST *, p)) + +#define sk_X509_TRUST_shift(sk) \ + ((X509_TRUST *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))) + +#define sk_X509_TRUST_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \ + CHECKED_CAST(void *, X509_TRUST *, p)) + +#define sk_X509_TRUST_pop(sk) \ + ((X509_TRUST *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk))) + +#define sk_X509_TRUST_dup(sk) \ + ((STACK_OF(X509_TRUST) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_TRUST) *, sk))) + +#define sk_X509_TRUST_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk)) + +#define sk_X509_TRUST_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_TRUST) *, sk)) + +#define sk_X509_TRUST_set_cmp_func(sk, comp) \ + ((int (*)(const X509_TRUST **a, const X509_TRUST **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_TRUST) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const X509_TRUST **a, const X509_TRUST **b), \ + comp))) + +#define sk_X509_TRUST_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_TRUST) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_TRUST) *, sk), \ + CHECKED_CAST(void *(*)(void *), X509_TRUST *(*)(X509_TRUST *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_TRUST *), free_func))) + +/* X509_VERIFY_PARAM */ +#define sk_X509_VERIFY_PARAM_new(comp) \ + ((STACK_OF(X509_VERIFY_PARAM) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b), \ + comp))) + +#define sk_X509_VERIFY_PARAM_new_null() \ + ((STACK_OF(X509_VERIFY_PARAM) *)sk_new_null()) + +#define sk_X509_VERIFY_PARAM_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)) + +#define sk_X509_VERIFY_PARAM_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)); + +#define sk_X509_VERIFY_PARAM_value(sk, i) \ + ((X509_VERIFY_PARAM *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk), (i))) + +#define sk_X509_VERIFY_PARAM_set(sk, i, p) \ + ((X509_VERIFY_PARAM *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), (i), \ + CHECKED_CAST(void *, X509_VERIFY_PARAM *, p))) + +#define sk_X509_VERIFY_PARAM_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)) + +#define sk_X509_VERIFY_PARAM_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_VERIFY_PARAM *), \ + free_func)) + +#define sk_X509_VERIFY_PARAM_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \ + CHECKED_CAST(void *, X509_VERIFY_PARAM *, p), (where)) + +#define sk_X509_VERIFY_PARAM_delete(sk, where) \ + ((X509_VERIFY_PARAM *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), (where))) + +#define sk_X509_VERIFY_PARAM_delete_ptr(sk, p) \ + ((X509_VERIFY_PARAM *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \ + CHECKED_CAST(void *, X509_VERIFY_PARAM *, p))) + +#define sk_X509_VERIFY_PARAM_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \ + (out_index), CHECKED_CAST(void *, X509_VERIFY_PARAM *, p)) + +#define sk_X509_VERIFY_PARAM_shift(sk) \ + ((X509_VERIFY_PARAM *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))) + +#define sk_X509_VERIFY_PARAM_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \ + CHECKED_CAST(void *, X509_VERIFY_PARAM *, p)) + +#define sk_X509_VERIFY_PARAM_pop(sk) \ + ((X509_VERIFY_PARAM *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk))) + +#define sk_X509_VERIFY_PARAM_dup(sk) \ + ((STACK_OF(X509_VERIFY_PARAM) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk))) + +#define sk_X509_VERIFY_PARAM_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk)) + +#define sk_X509_VERIFY_PARAM_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk)) + +#define sk_X509_VERIFY_PARAM_set_cmp_func(sk, comp) \ + ((int (*)(const X509_VERIFY_PARAM **a, const X509_VERIFY_PARAM **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(X509_VERIFY_PARAM) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const X509_VERIFY_PARAM **a, \ + const X509_VERIFY_PARAM **b), \ + comp))) + +#define sk_X509_VERIFY_PARAM_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(X509_VERIFY_PARAM) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(X509_VERIFY_PARAM) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + X509_VERIFY_PARAM *(*)(X509_VERIFY_PARAM *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(X509_VERIFY_PARAM *), \ + free_func))) + +/* void */ +#define sk_void_new(comp) \ + ((STACK_OF(void)*)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const void **a, const void **b), comp))) + +#define sk_void_new_null() ((STACK_OF(void)*)sk_new_null()) + +#define sk_void_num(sk) sk_num(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk)) + +#define sk_void_zero(sk) sk_zero(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk)); + +#define sk_void_value(sk, i) \ + ((void *)sk_value(CHECKED_CAST(_STACK *, const STACK_OF(void)*, sk), (i))) + +#define sk_void_set(sk, i, p) \ + ((void *)sk_set(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), (i), \ + CHECKED_CAST(void *, void *, p))) + +#define sk_void_free(sk) sk_free(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk)) + +#define sk_void_pop_free(sk, free_func) \ + sk_pop_free(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(void *), free_func)) + +#define sk_void_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \ + CHECKED_CAST(void *, void *, p), (where)) + +#define sk_void_delete(sk, where) \ + ((void *)sk_delete(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), (where))) + +#define sk_void_delete_ptr(sk, p) \ + ((void *)sk_delete_ptr(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \ + CHECKED_CAST(void *, void *, p))) + +#define sk_void_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), (out_index), \ + CHECKED_CAST(void *, void *, p)) + +#define sk_void_shift(sk) \ + ((void *)sk_shift(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk))) + +#define sk_void_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \ + CHECKED_CAST(void *, void *, p)) + +#define sk_void_pop(sk) \ + ((void *)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk))) + +#define sk_void_dup(sk) \ + ((STACK_OF(void)*)sk_dup(CHECKED_CAST(_STACK *, const STACK_OF(void)*, sk))) + +#define sk_void_sort(sk) sk_sort(CHECKED_CAST(_STACK *, STACK_OF(void)*, sk)) + +#define sk_void_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(void)*, sk)) + +#define sk_void_set_cmp_func(sk, comp) \ + ((int (*)(const void **a, const void **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(void)*, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const void **a, const void **b), \ + comp))) + +#define sk_void_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(void)*)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(void)*, sk), \ + CHECKED_CAST(void *(*)(void *), void *(*)(void *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(void *), free_func))) + +/* SRTP_PROTECTION_PROFILE */ +#define sk_SRTP_PROTECTION_PROFILE_new(comp) \ + ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const const SRTP_PROTECTION_PROFILE **a, \ + const const SRTP_PROTECTION_PROFILE **b), \ + comp))) + +#define sk_SRTP_PROTECTION_PROFILE_new_null() \ + ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_new_null()) + +#define sk_SRTP_PROTECTION_PROFILE_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)) + +#define sk_SRTP_PROTECTION_PROFILE_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)); + +#define sk_SRTP_PROTECTION_PROFILE_value(sk, i) \ + ((const SRTP_PROTECTION_PROFILE *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \ + (i))) + +#define sk_SRTP_PROTECTION_PROFILE_set(sk, i, p) \ + ((const SRTP_PROTECTION_PROFILE *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), (i), \ + CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p))) + +#define sk_SRTP_PROTECTION_PROFILE_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)) + +#define sk_SRTP_PROTECTION_PROFILE_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \ + CHECKED_CAST(void (*)(void *), \ + void (*)(const SRTP_PROTECTION_PROFILE *), free_func)) + +#define sk_SRTP_PROTECTION_PROFILE_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \ + CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p), (where)) + +#define sk_SRTP_PROTECTION_PROFILE_delete(sk, where) \ + ((const SRTP_PROTECTION_PROFILE *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \ + (where))) + +#define sk_SRTP_PROTECTION_PROFILE_delete_ptr(sk, p) \ + ((const SRTP_PROTECTION_PROFILE *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \ + CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p))) + +#define sk_SRTP_PROTECTION_PROFILE_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \ + (out_index), \ + CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p)) + +#define sk_SRTP_PROTECTION_PROFILE_shift(sk) \ + ((const SRTP_PROTECTION_PROFILE *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))) + +#define sk_SRTP_PROTECTION_PROFILE_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \ + CHECKED_CAST(void *, const SRTP_PROTECTION_PROFILE *, p)) + +#define sk_SRTP_PROTECTION_PROFILE_pop(sk) \ + ((const SRTP_PROTECTION_PROFILE *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))) + +#define sk_SRTP_PROTECTION_PROFILE_dup(sk) \ + ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk))) + +#define sk_SRTP_PROTECTION_PROFILE_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)) + +#define sk_SRTP_PROTECTION_PROFILE_is_sorted(sk) \ + sk_is_sorted( \ + CHECKED_CAST(_STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, sk)) + +#define sk_SRTP_PROTECTION_PROFILE_set_cmp_func(sk, comp) \ + ((int (*)(const SRTP_PROTECTION_PROFILE **a, \ + const SRTP_PROTECTION_PROFILE **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(SRTP_PROTECTION_PROFILE) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const SRTP_PROTECTION_PROFILE **a, \ + const SRTP_PROTECTION_PROFILE **b), \ + comp))) + +#define sk_SRTP_PROTECTION_PROFILE_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(SRTP_PROTECTION_PROFILE) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(SRTP_PROTECTION_PROFILE) *, \ + sk), \ + CHECKED_CAST(void *(*)(void *), const SRTP_PROTECTION_PROFILE *(*)( \ + const SRTP_PROTECTION_PROFILE *), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), \ + void (*)(const SRTP_PROTECTION_PROFILE *), free_func))) + +/* SSL_CIPHER */ +#define sk_SSL_CIPHER_new(comp) \ + ((STACK_OF(SSL_CIPHER) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const const SSL_CIPHER **a, const const SSL_CIPHER **b), comp))) + +#define sk_SSL_CIPHER_new_null() ((STACK_OF(SSL_CIPHER) *)sk_new_null()) + +#define sk_SSL_CIPHER_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)) + +#define sk_SSL_CIPHER_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)); + +#define sk_SSL_CIPHER_value(sk, i) \ + ((const SSL_CIPHER *)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(SSL_CIPHER) *, sk), (i))) + +#define sk_SSL_CIPHER_set(sk, i, p) \ + ((const SSL_CIPHER *)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (i), \ + CHECKED_CAST(void *, const SSL_CIPHER *, p))) + +#define sk_SSL_CIPHER_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)) + +#define sk_SSL_CIPHER_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(const SSL_CIPHER *), free_func)) + +#define sk_SSL_CIPHER_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \ + CHECKED_CAST(void *, const SSL_CIPHER *, p), (where)) + +#define sk_SSL_CIPHER_delete(sk, where) \ + ((const SSL_CIPHER *)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (where))) + +#define sk_SSL_CIPHER_delete_ptr(sk, p) \ + ((const SSL_CIPHER *)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \ + CHECKED_CAST(void *, const SSL_CIPHER *, p))) + +#define sk_SSL_CIPHER_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), (out_index), \ + CHECKED_CAST(void *, const SSL_CIPHER *, p)) + +#define sk_SSL_CIPHER_shift(sk) \ + ((const SSL_CIPHER *)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))) + +#define sk_SSL_CIPHER_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \ + CHECKED_CAST(void *, const SSL_CIPHER *, p)) + +#define sk_SSL_CIPHER_pop(sk) \ + ((const SSL_CIPHER *)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk))) + +#define sk_SSL_CIPHER_dup(sk) \ + ((STACK_OF(SSL_CIPHER) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(SSL_CIPHER) *, sk))) + +#define sk_SSL_CIPHER_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk)) + +#define sk_SSL_CIPHER_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(SSL_CIPHER) *, sk)) + +#define sk_SSL_CIPHER_set_cmp_func(sk, comp) \ + ((int (*)(const SSL_CIPHER **a, const SSL_CIPHER **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(SSL_CIPHER) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const SSL_CIPHER **a, const SSL_CIPHER **b), \ + comp))) + +#define sk_SSL_CIPHER_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(SSL_CIPHER) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(SSL_CIPHER) *, sk), \ + CHECKED_CAST(void *(*)(void *), \ + const SSL_CIPHER *(*)(const SSL_CIPHER *), copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(const SSL_CIPHER *), \ + free_func))) + +/* OPENSSL_STRING */ +#define sk_OPENSSL_STRING_new(comp) \ + ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, \ + int (*)(const OPENSSL_STRING *a, const OPENSSL_STRING *b), comp))) + +#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null()) + +#define sk_OPENSSL_STRING_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)) + +#define sk_OPENSSL_STRING_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)); + +#define sk_OPENSSL_STRING_value(sk, i) \ + ((OPENSSL_STRING)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_STRING) *, sk), (i))) + +#define sk_OPENSSL_STRING_set(sk, i, p) \ + ((OPENSSL_STRING)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (i), \ + CHECKED_CAST(void *, OPENSSL_STRING, p))) + +#define sk_OPENSSL_STRING_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)) + +#define sk_OPENSSL_STRING_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_STRING), free_func)) + +#define sk_OPENSSL_STRING_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \ + CHECKED_CAST(void *, OPENSSL_STRING, p), (where)) + +#define sk_OPENSSL_STRING_delete(sk, where) \ + ((OPENSSL_STRING)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (where))) + +#define sk_OPENSSL_STRING_delete_ptr(sk, p) \ + ((OPENSSL_STRING)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \ + CHECKED_CAST(void *, OPENSSL_STRING, p))) + +#define sk_OPENSSL_STRING_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), (out_index), \ + CHECKED_CAST(void *, OPENSSL_STRING, p)) + +#define sk_OPENSSL_STRING_shift(sk) \ + ((OPENSSL_STRING)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))) + +#define sk_OPENSSL_STRING_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \ + CHECKED_CAST(void *, OPENSSL_STRING, p)) + +#define sk_OPENSSL_STRING_pop(sk) \ + ((OPENSSL_STRING)sk_pop( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk))) + +#define sk_OPENSSL_STRING_dup(sk) \ + ((STACK_OF(OPENSSL_STRING) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_STRING) *, sk))) + +#define sk_OPENSSL_STRING_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk)) + +#define sk_OPENSSL_STRING_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_STRING) *, sk)) + +#define sk_OPENSSL_STRING_set_cmp_func(sk, comp) \ + ((int (*)(const OPENSSL_STRING **a, const OPENSSL_STRING **b)) \ + sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_STRING) *, sk), \ + CHECKED_CAST(stack_cmp_func, int (*)(const OPENSSL_STRING **a, \ + const OPENSSL_STRING **b), \ + comp))) + +#define sk_OPENSSL_STRING_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(OPENSSL_STRING) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_STRING) *, sk), \ + CHECKED_CAST(void *(*)(void *), OPENSSL_STRING (*)(OPENSSL_STRING), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_STRING), free_func))) + +/* OPENSSL_BLOCK */ +#define sk_OPENSSL_BLOCK_new(comp) \ + ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_CAST( \ + stack_cmp_func, int (*)(const OPENSSL_BLOCK *a, const OPENSSL_BLOCK *b), \ + comp))) + +#define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null()) + +#define sk_OPENSSL_BLOCK_num(sk) \ + sk_num(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)) + +#define sk_OPENSSL_BLOCK_zero(sk) \ + sk_zero(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)); + +#define sk_OPENSSL_BLOCK_value(sk, i) \ + ((OPENSSL_BLOCK)sk_value( \ + CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk), (i))) + +#define sk_OPENSSL_BLOCK_set(sk, i, p) \ + ((OPENSSL_BLOCK)sk_set( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (i), \ + CHECKED_CAST(void *, OPENSSL_BLOCK, p))) + +#define sk_OPENSSL_BLOCK_free(sk) \ + sk_free(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)) + +#define sk_OPENSSL_BLOCK_pop_free(sk, free_func) \ + sk_pop_free( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \ + CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_BLOCK), free_func)) + +#define sk_OPENSSL_BLOCK_insert(sk, p, where) \ + sk_insert(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \ + CHECKED_CAST(void *, OPENSSL_BLOCK, p), (where)) + +#define sk_OPENSSL_BLOCK_delete(sk, where) \ + ((OPENSSL_BLOCK)sk_delete( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (where))) + +#define sk_OPENSSL_BLOCK_delete_ptr(sk, p) \ + ((OPENSSL_BLOCK)sk_delete_ptr( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \ + CHECKED_CAST(void *, OPENSSL_BLOCK, p))) + +#define sk_OPENSSL_BLOCK_find(sk, out_index, p) \ + sk_find(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), (out_index), \ + CHECKED_CAST(void *, OPENSSL_BLOCK, p)) + +#define sk_OPENSSL_BLOCK_shift(sk) \ + ((OPENSSL_BLOCK)sk_shift( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))) + +#define sk_OPENSSL_BLOCK_push(sk, p) \ + sk_push(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \ + CHECKED_CAST(void *, OPENSSL_BLOCK, p)) + +#define sk_OPENSSL_BLOCK_pop(sk) \ + ((OPENSSL_BLOCK)sk_pop(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk))) + +#define sk_OPENSSL_BLOCK_dup(sk) \ + ((STACK_OF(OPENSSL_BLOCK) *)sk_dup( \ + CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk))) + +#define sk_OPENSSL_BLOCK_sort(sk) \ + sk_sort(CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk)) + +#define sk_OPENSSL_BLOCK_is_sorted(sk) \ + sk_is_sorted(CHECKED_CAST(_STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk)) + +#define sk_OPENSSL_BLOCK_set_cmp_func(sk, comp) \ + ((int (*)(const OPENSSL_BLOCK **a, const OPENSSL_BLOCK **b))sk_set_cmp_func( \ + CHECKED_CAST(_STACK *, STACK_OF(OPENSSL_BLOCK) *, sk), \ + CHECKED_CAST(stack_cmp_func, \ + int (*)(const OPENSSL_BLOCK **a, const OPENSSL_BLOCK **b), \ + comp))) + +#define sk_OPENSSL_BLOCK_deep_copy(sk, copy_func, free_func) \ + ((STACK_OF(OPENSSL_BLOCK) *)sk_deep_copy( \ + CHECKED_CAST(const _STACK *, const STACK_OF(OPENSSL_BLOCK) *, sk), \ + CHECKED_CAST(void *(*)(void *), OPENSSL_BLOCK (*)(OPENSSL_BLOCK), \ + copy_func), \ + CHECKED_CAST(void (*)(void *), void (*)(OPENSSL_BLOCK), free_func))) diff --git a/phonelibs/boringssl/include/openssl/thread.h b/phonelibs/boringssl/include/openssl/thread.h new file mode 100644 index 00000000000000..568a858332ac8c --- /dev/null +++ b/phonelibs/boringssl/include/openssl/thread.h @@ -0,0 +1,173 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_THREAD_H +#define OPENSSL_HEADER_THREAD_H + +#include + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +#if defined(OPENSSL_NO_THREADS) +typedef struct crypto_mutex_st {} CRYPTO_MUTEX; +#elif defined(OPENSSL_WINDOWS) +/* CRYPTO_MUTEX can appear in public header files so we really don't want to + * pull in windows.h. It's statically asserted that this structure is large + * enough to contain a Windows CRITICAL_SECTION by thread_win.c. */ +typedef union crypto_mutex_st { + double alignment; + uint8_t padding[4*sizeof(void*) + 2*sizeof(int)]; +} CRYPTO_MUTEX; +#elif defined(__MACH__) && defined(__APPLE__) +typedef pthread_rwlock_t CRYPTO_MUTEX; +#else +/* It is reasonable to include pthread.h on non-Windows systems, however the + * |pthread_rwlock_t| that we need is hidden under feature flags, and we can't + * ensure that we'll be able to get it. It's statically asserted that this + * structure is large enough to contain a |pthread_rwlock_t| by + * thread_pthread.c. */ +typedef union crypto_mutex_st { + double alignment; + uint8_t padding[3*sizeof(int) + 5*sizeof(unsigned) + 16 + 8]; +} CRYPTO_MUTEX; +#endif + +/* CRYPTO_refcount_t is the type of a reference count. + * + * Since some platforms use C11 atomics to access this, it should have the + * _Atomic qualifier. However, this header is included by C++ programs as well + * as C code that might not set -std=c11. So, in practice, it's not possible to + * do that. Instead we statically assert that the size and native alignment of + * a plain uint32_t and an _Atomic uint32_t are equal in refcount_c11.c. */ +typedef uint32_t CRYPTO_refcount_t; + + +/* Deprecated functions */ + +/* These defines do nothing but are provided to make old code easier to + * compile. */ +#define CRYPTO_LOCK 1 +#define CRYPTO_UNLOCK 2 +#define CRYPTO_READ 4 +#define CRYPTO_WRITE 8 + +/* CRYPTO_num_locks returns one. (This is non-zero that callers who allocate + * sizeof(lock) times this value don't get zero and then fail because malloc(0) + * returned NULL.) */ +OPENSSL_EXPORT int CRYPTO_num_locks(void); + +/* CRYPTO_set_locking_callback does nothing. */ +OPENSSL_EXPORT void CRYPTO_set_locking_callback( + void (*func)(int mode, int lock_num, const char *file, int line)); + +/* CRYPTO_set_add_lock_callback does nothing. */ +OPENSSL_EXPORT void CRYPTO_set_add_lock_callback(int (*func)( + int *num, int amount, int lock_num, const char *file, int line)); + +/* CRYPTO_get_lock_name returns a fixed, dummy string. */ +OPENSSL_EXPORT const char *CRYPTO_get_lock_name(int lock_num); + +/* CRYPTO_THREADID_set_callback returns one. */ +OPENSSL_EXPORT int CRYPTO_THREADID_set_callback( + void (*threadid_func)(CRYPTO_THREADID *threadid)); + +/* CRYPTO_THREADID_set_numeric does nothing. */ +OPENSSL_EXPORT void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, + unsigned long val); + +/* CRYPTO_THREADID_set_pointer does nothing. */ +OPENSSL_EXPORT void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr); + +/* CRYPTO_THREADID_current does nothing. */ +OPENSSL_EXPORT void CRYPTO_THREADID_current(CRYPTO_THREADID *id); + + +/* Private functions. + * + * Some old code calls these functions and so no-op implementations are + * provided. + * + * TODO(fork): cleanup callers and remove. */ + +OPENSSL_EXPORT void CRYPTO_set_id_callback(unsigned long (*func)(void)); + +typedef struct { + int references; + struct CRYPTO_dynlock_value *data; +} CRYPTO_dynlock; + +OPENSSL_EXPORT void CRYPTO_set_dynlock_create_callback( + struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, + int line)); + +OPENSSL_EXPORT void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)( + int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)); + +OPENSSL_EXPORT void CRYPTO_set_dynlock_destroy_callback( + void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, + const char *file, int line)); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_THREAD_H */ diff --git a/phonelibs/boringssl/include/openssl/time_support.h b/phonelibs/boringssl/include/openssl/time_support.h new file mode 100644 index 00000000000000..912e6724152f7a --- /dev/null +++ b/phonelibs/boringssl/include/openssl/time_support.h @@ -0,0 +1,90 @@ +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL + * project 2001. + * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project 2008. + */ +/* ==================================================================== + * Copyright (c) 2001 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + +#ifndef OPENSSL_HEADER_TIME_H +#define OPENSSL_HEADER_TIME_H + +#include + + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* Wrapper functions for time functions. */ + + +/* OPENSSL_gmtime wraps |gmtime_r|. See the manual page for that function. */ +struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); + +/* OPENSSL_gmtime_adj updates |tm| by adding |offset_day| days and |offset_sec| + * seconds. */ +int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); + +/* OPENSSL_gmtime_diff calculates the difference between |from| and |to| and + * outputs the difference as a number of days and seconds in |*out_days| and + * |*out_secs|. */ +int OPENSSL_gmtime_diff(int *out_days, int *out_secs, const struct tm *from, + const struct tm *to); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_TIME_H */ diff --git a/phonelibs/boringssl/include/openssl/tls1.h b/phonelibs/boringssl/include/openssl/tls1.h new file mode 100644 index 00000000000000..f2bee2738f956e --- /dev/null +++ b/phonelibs/boringssl/include/openssl/tls1.h @@ -0,0 +1,714 @@ +/* ssl/tls1.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the OpenSSL open source + * license provided above. + * + * ECC cipher suite support in OpenSSL originally written by + * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories. + * + */ +/* ==================================================================== + * Copyright 2005 Nokia. All rights reserved. + * + * The portions of the attached software ("Contribution") is developed by + * Nokia Corporation and is licensed pursuant to the OpenSSL open source + * license. + * + * The Contribution, originally written by Mika Kousa and Pasi Eronen of + * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites + * support (see RFC 4279) to OpenSSL. + * + * No patent licenses or other rights except those expressly stated in + * the OpenSSL open source license shall be deemed granted or received + * expressly, by implication, estoppel, or otherwise. + * + * No assurances are provided by Nokia that the Contribution does not + * infringe the patent or other intellectual property rights of any third + * party or that the license provides you with all the necessary rights + * to make use of the Contribution. + * + * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN + * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA + * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY + * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR + * OTHERWISE. + */ + +#ifndef HEADER_TLS1_H +#define HEADER_TLS1_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES 0 + +#define TLS1_AD_DECRYPTION_FAILED 21 +#define TLS1_AD_RECORD_OVERFLOW 22 +#define TLS1_AD_UNKNOWN_CA 48 /* fatal */ +#define TLS1_AD_ACCESS_DENIED 49 /* fatal */ +#define TLS1_AD_DECODE_ERROR 50 /* fatal */ +#define TLS1_AD_DECRYPT_ERROR 51 +#define TLS1_AD_EXPORT_RESTRICTION 60 /* fatal */ +#define TLS1_AD_PROTOCOL_VERSION 70 /* fatal */ +#define TLS1_AD_INSUFFICIENT_SECURITY 71 /* fatal */ +#define TLS1_AD_INTERNAL_ERROR 80 /* fatal */ +#define TLS1_AD_USER_CANCELLED 90 +#define TLS1_AD_NO_RENEGOTIATION 100 +/* codes 110-114 are from RFC3546 */ +#define TLS1_AD_UNSUPPORTED_EXTENSION 110 +#define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 +#define TLS1_AD_UNRECOGNIZED_NAME 112 +#define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 +#define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 +#define TLS1_AD_UNKNOWN_PSK_IDENTITY 115 /* fatal */ + +/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ +#define TLSEXT_TYPE_server_name 0 +#define TLSEXT_TYPE_max_fragment_length 1 +#define TLSEXT_TYPE_client_certificate_url 2 +#define TLSEXT_TYPE_trusted_ca_keys 3 +#define TLSEXT_TYPE_truncated_hmac 4 +#define TLSEXT_TYPE_status_request 5 +/* ExtensionType values from RFC4681 */ +#define TLSEXT_TYPE_user_mapping 6 + +/* ExtensionType values from RFC5878 */ +#define TLSEXT_TYPE_client_authz 7 +#define TLSEXT_TYPE_server_authz 8 + +/* ExtensionType values from RFC6091 */ +#define TLSEXT_TYPE_cert_type 9 + +/* ExtensionType values from RFC4492 */ +#define TLSEXT_TYPE_elliptic_curves 10 +#define TLSEXT_TYPE_ec_point_formats 11 + +/* ExtensionType value from RFC5054 */ +#define TLSEXT_TYPE_srp 12 + +/* ExtensionType values from RFC5246 */ +#define TLSEXT_TYPE_signature_algorithms 13 + +/* ExtensionType value from RFC5764 */ +#define TLSEXT_TYPE_use_srtp 14 + +/* ExtensionType value from RFC5620 */ +#define TLSEXT_TYPE_heartbeat 15 + +/* ExtensionType value from RFC7301 */ +#define TLSEXT_TYPE_application_layer_protocol_negotiation 16 + +/* ExtensionType value for TLS padding extension. + * http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml + * http://tools.ietf.org/html/draft-agl-tls-padding-03 + */ +#define TLSEXT_TYPE_padding 21 + +/* https://tools.ietf.org/html/draft-ietf-tls-session-hash-01 */ +#define TLSEXT_TYPE_extended_master_secret 23 + +/* ExtensionType value from RFC4507 */ +#define TLSEXT_TYPE_session_ticket 35 + +/* ExtensionType value from RFC5746 */ +#define TLSEXT_TYPE_renegotiate 0xff01 + +/* ExtensionType value from RFC6962 */ +#define TLSEXT_TYPE_certificate_timestamp 18 + +/* This is not an IANA defined extension number */ +#define TLSEXT_TYPE_next_proto_neg 13172 + +/* This is not an IANA defined extension number */ +#define TLSEXT_TYPE_channel_id 30031 +#define TLSEXT_TYPE_channel_id_new 30032 + +/* NameType value from RFC 3546 */ +#define TLSEXT_NAMETYPE_host_name 0 +/* status request value from RFC 3546 */ +#define TLSEXT_STATUSTYPE_ocsp 1 + +/* ECPointFormat values from RFC 4492 */ +#define TLSEXT_ECPOINTFORMAT_uncompressed 0 +#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 +#define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 + +/* Signature and hash algorithms from RFC 5246 */ + +#define TLSEXT_signature_anonymous 0 +#define TLSEXT_signature_rsa 1 +#define TLSEXT_signature_dsa 2 +#define TLSEXT_signature_ecdsa 3 + +#define TLSEXT_hash_none 0 +#define TLSEXT_hash_md5 1 +#define TLSEXT_hash_sha1 2 +#define TLSEXT_hash_sha224 3 +#define TLSEXT_hash_sha256 4 +#define TLSEXT_hash_sha384 5 +#define TLSEXT_hash_sha512 6 + +/* Flag set for unrecognised algorithms */ +#define TLSEXT_nid_unknown 0x1000000 + +/* ECC curves */ + +#define TLSEXT_curve_P_256 23 +#define TLSEXT_curve_P_384 24 + + +#define TLSEXT_MAXLEN_host_name 255 + +OPENSSL_EXPORT const char *SSL_get_servername(const SSL *s, const int type); +OPENSSL_EXPORT int SSL_get_servername_type(const SSL *s); + +/* SSL_export_keying_material exports a value derived from the master secret, as + * specified in RFC 5705. It writes |out_len| bytes to |out| given a label and + * optional context. (Since a zero length context is allowed, the |use_context| + * flag controls whether a context is included.) + * + * It returns one on success and zero otherwise. */ +OPENSSL_EXPORT int SSL_export_keying_material( + SSL *s, uint8_t *out, size_t out_len, const char *label, size_t label_len, + const uint8_t *context, size_t context_len, int use_context); + +OPENSSL_EXPORT int SSL_get_sigalgs(SSL *s, int idx, int *psign, int *phash, + int *psignandhash, uint8_t *rsig, + uint8_t *rhash); + +OPENSSL_EXPORT int SSL_get_shared_sigalgs(SSL *s, int idx, int *psign, + int *phash, int *psignandhash, + uint8_t *rsig, uint8_t *rhash); + +/* SSL_set_tlsext_host_name, for a client, configures |ssl| to advertise |name| + * in the server_name extension. It returns one on success and zero on error. */ +OPENSSL_EXPORT int SSL_set_tlsext_host_name(SSL *ssl, const char *name); + +/* SSL_CTX_set_tlsext_servername_callback configures |callback| to be called on + * the server after ClientHello extensions have been parsed and returns one. + * |callback| may use |SSL_get_servername| to examine the server_name extension + * and return a |SSL_TLSEXT_ERR_*| value. If it returns |SSL_TLSEXT_ERR_NOACK|, + * the server_name extension is not acknowledged in the ServerHello. If the + * return value signals an alert, |callback| should set |*out_alert| to the + * alert to send. */ +OPENSSL_EXPORT int SSL_CTX_set_tlsext_servername_callback( + SSL_CTX *ctx, int (*callback)(SSL *ssl, int *out_alert, void *arg)); + +#define SSL_TLSEXT_ERR_OK 0 +#define SSL_TLSEXT_ERR_ALERT_WARNING 1 +#define SSL_TLSEXT_ERR_ALERT_FATAL 2 +#define SSL_TLSEXT_ERR_NOACK 3 + +/* SSL_CTX_set_tlsext_servername_arg sets the argument to the servername + * callback and returns one. See |SSL_CTX_set_tlsext_servername_callback|. */ +OPENSSL_EXPORT int SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg); + +#define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_GET_TLSEXT_TICKET_KEYS, (keylen), (keys)) +#define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TLSEXT_TICKET_KEYS, (keylen), (keys)) + +/* SSL_CTX_set_tlsext_ticket_key_cb sets the ticket callback to |callback| and + * returns one. |callback| will be called when encrypting a new ticket and when + * decrypting a ticket from the client. + * + * In both modes, |ctx| and |hmac_ctx| will already have been initialized with + * |EVP_CIPHER_CTX_init| and |HMAC_CTX_init|, respectively. |callback| + * configures |hmac_ctx| with an HMAC digest and key, and configures |ctx| + * for encryption or decryption, based on the mode. + * + * When encrypting a new ticket, |encrypt| will be one. It writes a public + * 16-byte key name to |key_name| and a fresh IV to |iv|. The output IV length + * must match |EVP_CIPHER_CTX_iv_length| of the cipher selected. In this mode, + * |callback| returns 1 on success and -1 on error. + * + * When decrypting a ticket, |encrypt| will be zero. |key_name| will point to a + * 16-byte key name and |iv| points to an IV. The length of the IV consumed must + * match |EVP_CIPHER_CTX_iv_length| of the cipher selected. In this mode, + * |callback| returns -1 to abort the handshake, 0 if decrypting the ticket + * failed, and 1 or 2 on success. If it returns 2, the ticket will be renewed. + * This may be used to re-key the ticket. + * + * WARNING: |callback| wildly breaks the usual return value convention and is + * called in two different modes. */ +OPENSSL_EXPORT int SSL_CTX_set_tlsext_ticket_key_cb( + SSL_CTX *ctx, int (*callback)(SSL *ssl, uint8_t *key_name, uint8_t *iv, + EVP_CIPHER_CTX *ctx, HMAC_CTX *hmac_ctx, + int encrypt)); + +/* PSK ciphersuites from 4279 */ +#define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A +#define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B +#define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C +#define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D + +/* PSK ciphersuites from RFC 5489 */ +#define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035 +#define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036 + +/* Additional TLS ciphersuites from expired Internet Draft + * draft-ietf-tls-56-bit-ciphersuites-01.txt + * (available if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see + * s3_lib.c). We actually treat them like SSL 3.0 ciphers, which we probably + * shouldn't. Note that the first two are actually not in the IDs. */ +#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5 0x03000060 /* not in ID */ +#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 0x03000061 /* not in ID */ +#define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA 0x03000062 +#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA 0x03000063 +#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA 0x03000064 +#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA 0x03000065 +#define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA 0x03000066 + +/* AES ciphersuites from RFC3268 */ + +#define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F +#define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 +#define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 +#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 +#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 +#define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 + +#define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 +#define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 +#define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 +#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 +#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 +#define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A + +/* TLS v1.2 ciphersuites */ +#define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B +#define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C +#define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D +#define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E +#define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F +#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 +#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 + +/* TLS v1.2 ciphersuites */ +#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 +#define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 +#define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 +#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A +#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B +#define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C +#define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 +#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 + +/* SEED ciphersuites from RFC4162 */ +#define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 +#define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 +#define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 +#define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 +#define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A +#define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +#define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C +#define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D +#define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E +#define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F +#define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 +#define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 +#define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 +#define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 +#define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 +#define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 +#define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 +#define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 + +/* ECC ciphersuites from RFC4492 */ +#define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 +#define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 +#define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 + +#define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 +#define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 +#define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A + +#define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B +#define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C +#define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D +#define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E +#define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F + +#define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 +#define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 +#define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 + +#define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 +#define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 +#define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 +#define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 +#define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 + +/* SRP ciphersuites from RFC 5054 */ +#define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A +#define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B +#define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C +#define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D +#define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E +#define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F +#define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 +#define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 +#define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 + +/* ECDH HMAC based ciphersuites from RFC5289 */ + +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 +#define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 +#define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A + +/* ECDH GCM based ciphersuites from RFC5289 */ +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 +#define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 +#define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 + +#define TLS1_CK_ECDHE_RSA_CHACHA20_POLY1305 0x0300CC13 +#define TLS1_CK_ECDHE_ECDSA_CHACHA20_POLY1305 0x0300CC14 +#define TLS1_CK_DHE_RSA_CHACHA20_POLY1305 0x0300CC15 + +/* XXX + * Inconsistency alert: + * The OpenSSL names of ciphers with ephemeral DH here include the string + * "DHE", while elsewhere it has always been "EDH". + * (The alias for the list of all such ciphers also is "EDH".) + * The specifications speak of "EDH"; maybe we should allow both forms + * for everything. */ +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5 "EXP1024-RC4-MD5" +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 "EXP1024-RC2-CBC-MD5" +#define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA "EXP1024-DES-CBC-SHA" +#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA \ + "EXP1024-DHE-DSS-DES-CBC-SHA" +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA "EXP1024-RC4-SHA" +#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA "EXP1024-DHE-DSS-RC4-SHA" +#define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" + +/* AES ciphersuites from RFC3268 */ +#define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" +#define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" + +#define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" +#define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" + +/* ECC ciphersuites from RFC4492 */ +#define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" + +#define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" + +#define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" + +#define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" + +#define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" +#define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" +#define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" +#define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" + +/* PSK ciphersuites from RFC 4279 */ +#define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" +#define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" +#define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" +#define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" + +/* PSK ciphersuites from RFC 5489 */ +#define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA" +#define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA "ECDHE-PSK-AES256-CBC-SHA" + +/* SRP ciphersuite from RFC 5054 */ +#define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" +#define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" +#define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" +#define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" +#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" +#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" +#define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" +#define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" +#define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" +#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" + +#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" +#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" + +/* SEED ciphersuites from RFC4162 */ +#define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" +#define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" +#define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" +#define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" +#define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" +#define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" + +/* TLS v1.2 ciphersuites */ +#define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" +#define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" +#define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" +#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" +#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" +#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" +#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" +#define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" +#define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +#define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" +#define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" +#define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" +#define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" +#define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" +#define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" +#define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" + +/* ECDH HMAC based ciphersuites from RFC5289 */ + +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" + +/* ECDH GCM based ciphersuites from RFC5289 */ +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 \ + "ECDHE-ECDSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 \ + "ECDHE-ECDSA-AES256-GCM-SHA384" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 \ + "ECDH-ECDSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 \ + "ECDH-ECDSA-AES256-GCM-SHA384" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" + +#define TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305 "ECDHE-RSA-CHACHA20-POLY1305" +#define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 \ + "ECDHE-ECDSA-CHACHA20-POLY1305" +#define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" + +#define TLS_CT_RSA_SIGN 1 +#define TLS_CT_DSS_SIGN 2 +#define TLS_CT_RSA_FIXED_DH 3 +#define TLS_CT_DSS_FIXED_DH 4 +#define TLS_CT_ECDSA_SIGN 64 +#define TLS_CT_RSA_FIXED_ECDH 65 +#define TLS_CT_ECDSA_FIXED_ECDH 66 + +#define TLS_MD_MAX_CONST_SIZE 20 +#define TLS_MD_CLIENT_FINISH_CONST "client finished" +#define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 +#define TLS_MD_SERVER_FINISH_CONST "server finished" +#define TLS_MD_SERVER_FINISH_CONST_SIZE 15 +#define TLS_MD_KEY_EXPANSION_CONST "key expansion" +#define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 +#define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" +#define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_IV_BLOCK_CONST "IV block" +#define TLS_MD_IV_BLOCK_CONST_SIZE 8 +#define TLS_MD_MASTER_SECRET_CONST "master secret" +#define TLS_MD_MASTER_SECRET_CONST_SIZE 13 +#define TLS_MD_EXTENDED_MASTER_SECRET_CONST "extended master secret" +#define TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE 22 + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/phonelibs/boringssl/include/openssl/type_check.h b/phonelibs/boringssl/include/openssl/type_check.h new file mode 100644 index 00000000000000..674913a354a04c --- /dev/null +++ b/phonelibs/boringssl/include/openssl/type_check.h @@ -0,0 +1,91 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] */ + +#ifndef OPENSSL_HEADER_TYPE_CHECK_H +#define OPENSSL_HEADER_TYPE_CHECK_H + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + + +/* This header file contains some common macros for enforcing type checking. + * Several, common OpenSSL structures (i.e. stack and lhash) operate on void + * pointers, but we wish to have type checking when they are used with a + * specific type. */ + +/* CHECKED_CAST casts |p| from type |from| to type |to|. */ +#define CHECKED_CAST(to, from, p) ((to) (1 ? (p) : (from)0)) + +/* CHECKED_PTR_OF casts a given pointer to void* and statically checks that it + * was a pointer to |type|. */ +#define CHECKED_PTR_OF(type, p) CHECKED_CAST(void*, type*, (p)) + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#define OPENSSL_COMPILE_ASSERT(cond, msg) _Static_assert(cond, #msg) +#else +#define OPENSSL_COMPILE_ASSERT(cond, msg) \ + typedef char OPENSSL_COMPILE_ASSERT_##msg[((cond) ? 1 : -1)] +#endif + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_TYPE_CHECK_H */ diff --git a/phonelibs/boringssl/include/openssl/x509.h b/phonelibs/boringssl/include/openssl/x509.h new file mode 100644 index 00000000000000..69c7da64e840d7 --- /dev/null +++ b/phonelibs/boringssl/include/openssl/x509.h @@ -0,0 +1,1317 @@ +/* crypto/x509/x509.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECDH support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_X509_H +#define HEADER_X509_H + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#define X509_FILETYPE_PEM 1 +#define X509_FILETYPE_ASN1 2 +#define X509_FILETYPE_DEFAULT 3 + +#define X509v3_KU_DIGITAL_SIGNATURE 0x0080 +#define X509v3_KU_NON_REPUDIATION 0x0040 +#define X509v3_KU_KEY_ENCIPHERMENT 0x0020 +#define X509v3_KU_DATA_ENCIPHERMENT 0x0010 +#define X509v3_KU_KEY_AGREEMENT 0x0008 +#define X509v3_KU_KEY_CERT_SIGN 0x0004 +#define X509v3_KU_CRL_SIGN 0x0002 +#define X509v3_KU_ENCIPHER_ONLY 0x0001 +#define X509v3_KU_DECIPHER_ONLY 0x8000 +#define X509v3_KU_UNDEF 0xffff + +typedef struct X509_objects_st + { + int nid; + int (*a2i)(void); + int (*i2a)(void); + } X509_OBJECTS; + +DECLARE_ASN1_SET_OF(X509_ALGOR) + +typedef STACK_OF(X509_ALGOR) X509_ALGORS; + +typedef struct X509_val_st + { + ASN1_TIME *notBefore; + ASN1_TIME *notAfter; + } X509_VAL; + +struct X509_pubkey_st + { + X509_ALGOR *algor; + ASN1_BIT_STRING *public_key; + EVP_PKEY *pkey; + }; + +typedef struct X509_sig_st + { + X509_ALGOR *algor; + ASN1_OCTET_STRING *digest; + } X509_SIG; + +typedef struct X509_name_entry_st + { + ASN1_OBJECT *object; + ASN1_STRING *value; + int set; + int size; /* temp variable */ + } X509_NAME_ENTRY; + +DECLARE_STACK_OF(X509_NAME_ENTRY) +DECLARE_ASN1_SET_OF(X509_NAME_ENTRY) + +/* we always keep X509_NAMEs in 2 forms. */ +typedef struct X509_name_st + { + STACK_OF(X509_NAME_ENTRY) *entries; + int modified; /* true if 'bytes' needs to be built */ +#ifndef OPENSSL_NO_BUFFER + BUF_MEM *bytes; +#else + char *bytes; +#endif +/* unsigned long hash; Keep the hash around for lookups */ + unsigned char *canon_enc; + int canon_enclen; + } X509_NAME; + +DECLARE_STACK_OF(X509_NAME) + +#define X509_EX_V_NETSCAPE_HACK 0x8000 +#define X509_EX_V_INIT 0x0001 +typedef struct X509_extension_st + { + ASN1_OBJECT *object; + ASN1_BOOLEAN critical; + ASN1_OCTET_STRING *value; + } X509_EXTENSION; + +typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; + +DECLARE_STACK_OF(X509_EXTENSION) +DECLARE_ASN1_SET_OF(X509_EXTENSION) + +/* a sequence of these are used */ +typedef struct x509_attributes_st + { + ASN1_OBJECT *object; + int single; /* 0 for a set, 1 for a single item (which is wrong) */ + union { + char *ptr; +/* 0 */ STACK_OF(ASN1_TYPE) *set; +/* 1 */ ASN1_TYPE *single; + } value; + } X509_ATTRIBUTE; + +DECLARE_STACK_OF(X509_ATTRIBUTE) +DECLARE_ASN1_SET_OF(X509_ATTRIBUTE) + + +typedef struct X509_req_info_st + { + ASN1_ENCODING enc; + ASN1_INTEGER *version; + X509_NAME *subject; + X509_PUBKEY *pubkey; + /* d=2 hl=2 l= 0 cons: cont: 00 */ + STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ + } X509_REQ_INFO; + +typedef struct X509_req_st + { + X509_REQ_INFO *req_info; + X509_ALGOR *sig_alg; + ASN1_BIT_STRING *signature; + CRYPTO_refcount_t references; + } X509_REQ; + +typedef struct x509_cinf_st + { + ASN1_INTEGER *version; /* [ 0 ] default of v1 */ + ASN1_INTEGER *serialNumber; + X509_ALGOR *signature; + X509_NAME *issuer; + X509_VAL *validity; + X509_NAME *subject; + X509_PUBKEY *key; + ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ + ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ + STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ + ASN1_ENCODING enc; + } X509_CINF; + +/* This stuff is certificate "auxiliary info" + * it contains details which are useful in certificate + * stores and databases. When used this is tagged onto + * the end of the certificate itself + */ + +typedef struct x509_cert_aux_st + { + STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */ + STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */ + ASN1_UTF8STRING *alias; /* "friendly name" */ + ASN1_OCTET_STRING *keyid; /* key id of private key */ + STACK_OF(X509_ALGOR) *other; /* other unspecified info */ + } X509_CERT_AUX; + +struct x509_st + { + X509_CINF *cert_info; + X509_ALGOR *sig_alg; + ASN1_BIT_STRING *signature; + int valid; + CRYPTO_refcount_t references; + char *name; + CRYPTO_EX_DATA ex_data; + /* These contain copies of various extension values */ + long ex_pathlen; + long ex_pcpathlen; + unsigned long ex_flags; + unsigned long ex_kusage; + unsigned long ex_xkusage; + unsigned long ex_nscert; + ASN1_OCTET_STRING *skid; + AUTHORITY_KEYID *akid; + X509_POLICY_CACHE *policy_cache; + STACK_OF(DIST_POINT) *crldp; + STACK_OF(GENERAL_NAME) *altname; + NAME_CONSTRAINTS *nc; + unsigned char sha1_hash[SHA_DIGEST_LENGTH]; + X509_CERT_AUX *aux; + } /* X509 */; + +DECLARE_STACK_OF(X509) +DECLARE_ASN1_SET_OF(X509) + +/* This is used for a table of trust checking functions */ + +typedef struct x509_trust_st { + int trust; + int flags; + int (*check_trust)(struct x509_trust_st *, X509 *, int); + char *name; + int arg1; + void *arg2; +} X509_TRUST; + +DECLARE_STACK_OF(X509_TRUST) + +typedef struct x509_cert_pair_st { + X509 *forward; + X509 *reverse; +} X509_CERT_PAIR; + +/* standard trust ids */ + +#define X509_TRUST_DEFAULT -1 /* Only valid in purpose settings */ + +#define X509_TRUST_COMPAT 1 +#define X509_TRUST_SSL_CLIENT 2 +#define X509_TRUST_SSL_SERVER 3 +#define X509_TRUST_EMAIL 4 +#define X509_TRUST_OBJECT_SIGN 5 +#define X509_TRUST_OCSP_SIGN 6 +#define X509_TRUST_OCSP_REQUEST 7 +#define X509_TRUST_TSA 8 + +/* Keep these up to date! */ +#define X509_TRUST_MIN 1 +#define X509_TRUST_MAX 8 + + +/* trust_flags values */ +#define X509_TRUST_DYNAMIC 1 +#define X509_TRUST_DYNAMIC_NAME 2 + +/* check_trust return codes */ + +#define X509_TRUST_TRUSTED 1 +#define X509_TRUST_REJECTED 2 +#define X509_TRUST_UNTRUSTED 3 + +/* Flags for X509_print_ex() */ + +#define X509_FLAG_COMPAT 0 +#define X509_FLAG_NO_HEADER 1L +#define X509_FLAG_NO_VERSION (1L << 1) +#define X509_FLAG_NO_SERIAL (1L << 2) +#define X509_FLAG_NO_SIGNAME (1L << 3) +#define X509_FLAG_NO_ISSUER (1L << 4) +#define X509_FLAG_NO_VALIDITY (1L << 5) +#define X509_FLAG_NO_SUBJECT (1L << 6) +#define X509_FLAG_NO_PUBKEY (1L << 7) +#define X509_FLAG_NO_EXTENSIONS (1L << 8) +#define X509_FLAG_NO_SIGDUMP (1L << 9) +#define X509_FLAG_NO_AUX (1L << 10) +#define X509_FLAG_NO_ATTRIBUTES (1L << 11) +#define X509_FLAG_NO_IDS (1L << 12) + +/* Flags specific to X509_NAME_print_ex() */ + +/* The field separator information */ + +#define XN_FLAG_SEP_MASK (0xf << 16) + +#define XN_FLAG_COMPAT 0 /* Traditional SSLeay: use old X509_NAME_print */ +#define XN_FLAG_SEP_COMMA_PLUS (1 << 16) /* RFC2253 ,+ */ +#define XN_FLAG_SEP_CPLUS_SPC (2 << 16) /* ,+ spaced: more readable */ +#define XN_FLAG_SEP_SPLUS_SPC (3 << 16) /* ;+ spaced */ +#define XN_FLAG_SEP_MULTILINE (4 << 16) /* One line per field */ + +#define XN_FLAG_DN_REV (1 << 20) /* Reverse DN order */ + +/* How the field name is shown */ + +#define XN_FLAG_FN_MASK (0x3 << 21) + +#define XN_FLAG_FN_SN 0 /* Object short name */ +#define XN_FLAG_FN_LN (1 << 21) /* Object long name */ +#define XN_FLAG_FN_OID (2 << 21) /* Always use OIDs */ +#define XN_FLAG_FN_NONE (3 << 21) /* No field names */ + +#define XN_FLAG_SPC_EQ (1 << 23) /* Put spaces round '=' */ + +/* This determines if we dump fields we don't recognise: + * RFC2253 requires this. + */ + +#define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) + +#define XN_FLAG_FN_ALIGN (1 << 25) /* Align field names to 20 characters */ + +/* Complete set of RFC2253 flags */ + +#define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ + XN_FLAG_SEP_COMMA_PLUS | \ + XN_FLAG_DN_REV | \ + XN_FLAG_FN_SN | \ + XN_FLAG_DUMP_UNKNOWN_FIELDS) + +/* readable oneline form */ + +#define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ + ASN1_STRFLGS_ESC_QUOTE | \ + XN_FLAG_SEP_CPLUS_SPC | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_SN) + +/* readable multiline form */ + +#define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + XN_FLAG_SEP_MULTILINE | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_LN | \ + XN_FLAG_FN_ALIGN) + +struct x509_revoked_st + { + ASN1_INTEGER *serialNumber; + ASN1_TIME *revocationDate; + STACK_OF(X509_EXTENSION) /* optional */ *extensions; + /* Set up if indirect CRL */ + STACK_OF(GENERAL_NAME) *issuer; + /* Revocation reason */ + int reason; + int sequence; /* load sequence */ + }; + +DECLARE_STACK_OF(X509_REVOKED) +DECLARE_ASN1_SET_OF(X509_REVOKED) + +typedef struct X509_crl_info_st + { + ASN1_INTEGER *version; + X509_ALGOR *sig_alg; + X509_NAME *issuer; + ASN1_TIME *lastUpdate; + ASN1_TIME *nextUpdate; + STACK_OF(X509_REVOKED) *revoked; + STACK_OF(X509_EXTENSION) /* [0] */ *extensions; + ASN1_ENCODING enc; + } X509_CRL_INFO; + +struct X509_crl_st + { + /* actual signature */ + X509_CRL_INFO *crl; + X509_ALGOR *sig_alg; + ASN1_BIT_STRING *signature; + CRYPTO_refcount_t references; + int flags; + /* Copies of various extensions */ + AUTHORITY_KEYID *akid; + ISSUING_DIST_POINT *idp; + /* Convenient breakdown of IDP */ + int idp_flags; + int idp_reasons; + /* CRL and base CRL numbers for delta processing */ + ASN1_INTEGER *crl_number; + ASN1_INTEGER *base_crl_number; + unsigned char sha1_hash[SHA_DIGEST_LENGTH]; + STACK_OF(GENERAL_NAMES) *issuers; + const X509_CRL_METHOD *meth; + void *meth_data; + } /* X509_CRL */; + +DECLARE_STACK_OF(X509_CRL) +DECLARE_ASN1_SET_OF(X509_CRL) + +typedef struct private_key_st + { + int version; + /* The PKCS#8 data types */ + X509_ALGOR *enc_algor; + ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ + + /* When decrypted, the following will not be NULL */ + EVP_PKEY *dec_pkey; + + /* used to encrypt and decrypt */ + int key_length; + char *key_data; + int key_free; /* true if we should auto free key_data */ + + /* expanded version of 'enc_algor' */ + EVP_CIPHER_INFO cipher; + } X509_PKEY; + +#ifndef OPENSSL_NO_EVP +typedef struct X509_info_st + { + X509 *x509; + X509_CRL *crl; + X509_PKEY *x_pkey; + + EVP_CIPHER_INFO enc_cipher; + int enc_len; + char *enc_data; + + } X509_INFO; + +DECLARE_STACK_OF(X509_INFO) +#endif + +/* The next 2 structures and their 8 routines were sent to me by + * Pat Richard and are used to manipulate + * Netscapes spki structures - useful if you are writing a CA web page + */ +typedef struct Netscape_spkac_st + { + X509_PUBKEY *pubkey; + ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ + } NETSCAPE_SPKAC; + +typedef struct Netscape_spki_st + { + NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ + X509_ALGOR *sig_algor; + ASN1_BIT_STRING *signature; + } NETSCAPE_SPKI; + +/* Netscape certificate sequence structure */ +typedef struct Netscape_certificate_sequence + { + ASN1_OBJECT *type; + STACK_OF(X509) *certs; + } NETSCAPE_CERT_SEQUENCE; + +/* Unused (and iv length is wrong) +typedef struct CBCParameter_st + { + unsigned char iv[8]; + } CBC_PARAM; +*/ + +/* Password based encryption structure */ + +typedef struct PBEPARAM_st { +ASN1_OCTET_STRING *salt; +ASN1_INTEGER *iter; +} PBEPARAM; + +/* Password based encryption V2 structures */ + +typedef struct PBE2PARAM_st { +X509_ALGOR *keyfunc; +X509_ALGOR *encryption; +} PBE2PARAM; + +typedef struct PBKDF2PARAM_st { +ASN1_TYPE *salt; /* Usually OCTET STRING but could be anything */ +ASN1_INTEGER *iter; +ASN1_INTEGER *keylength; +X509_ALGOR *prf; +} PBKDF2PARAM; + + +/* PKCS#8 private key info structure */ + +struct pkcs8_priv_key_info_st + { + int broken; /* Flag for various broken formats */ +#define PKCS8_OK 0 +#define PKCS8_NO_OCTET 1 +#define PKCS8_EMBEDDED_PARAM 2 +#define PKCS8_NS_DB 3 +#define PKCS8_NEG_PRIVKEY 4 + ASN1_INTEGER *version; + X509_ALGOR *pkeyalg; + ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */ + STACK_OF(X509_ATTRIBUTE) *attributes; + }; + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define X509_EXT_PACK_UNKNOWN 1 +#define X509_EXT_PACK_STRING 2 + +#define X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version) +/* #define X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */ +#define X509_get_notBefore(x) ((x)->cert_info->validity->notBefore) +#define X509_get_notAfter(x) ((x)->cert_info->validity->notAfter) +#define X509_get_cert_info(x) ((x)->cert_info) +#define X509_extract_key(x) X509_get_pubkey(x) /*****/ +#define X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version) +#define X509_REQ_get_subject_name(x) ((x)->req_info->subject) +#define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) +#define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) +#define X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm)) + +#define X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version) +#define X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate) +#define X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate) +#define X509_CRL_get_issuer(x) ((x)->crl->issuer) +#define X509_CRL_get_REVOKED(x) ((x)->crl->revoked) + +#define X509_CINF_set_modified(c) ((c)->enc.modified = 1) +#define X509_CINF_get_issuer(c) (&(c)->issuer) +#define X509_CINF_get_extensions(c) ((c)->extensions) +#define X509_CINF_get_signature(c) ((c)->signature) + +OPENSSL_EXPORT void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); +OPENSSL_EXPORT X509_CRL_METHOD *X509_CRL_METHOD_new( + int (*crl_init)(X509_CRL *crl), + int (*crl_free)(X509_CRL *crl), + int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret, + ASN1_INTEGER *ser, X509_NAME *issuer), + int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk)); +OPENSSL_EXPORT void X509_CRL_METHOD_free(X509_CRL_METHOD *m); + +OPENSSL_EXPORT void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); +OPENSSL_EXPORT void *X509_CRL_get_meth_data(X509_CRL *crl); + +/* This one is only used so that a binary form can output, as in + * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */ +#define X509_get_X509_PUBKEY(x) ((x)->cert_info->key) + + +OPENSSL_EXPORT const char *X509_verify_cert_error_string(long n); + +#ifndef OPENSSL_NO_EVP +OPENSSL_EXPORT int X509_verify(X509 *a, EVP_PKEY *r); + +OPENSSL_EXPORT int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); +OPENSSL_EXPORT int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); +OPENSSL_EXPORT int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); + +OPENSSL_EXPORT NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len); +OPENSSL_EXPORT char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); +OPENSSL_EXPORT EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); +OPENSSL_EXPORT int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); + +OPENSSL_EXPORT int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); + +OPENSSL_EXPORT int X509_signature_dump(BIO *bp,const ASN1_STRING *sig, int indent); +OPENSSL_EXPORT int X509_signature_print(BIO *bp,X509_ALGOR *alg, ASN1_STRING *sig); + +OPENSSL_EXPORT int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +OPENSSL_EXPORT int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); +/* int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert); */ +OPENSSL_EXPORT int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); +OPENSSL_EXPORT int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); +OPENSSL_EXPORT int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); +OPENSSL_EXPORT int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); +/* int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl); */ +OPENSSL_EXPORT int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); + +OPENSSL_EXPORT int X509_pubkey_digest(const X509 *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +OPENSSL_EXPORT int X509_digest(const X509 *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +OPENSSL_EXPORT int X509_CRL_digest(const X509_CRL *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +OPENSSL_EXPORT int X509_REQ_digest(const X509_REQ *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +OPENSSL_EXPORT int X509_NAME_digest(const X509_NAME *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +#endif + +#ifndef OPENSSL_NO_FP_API +OPENSSL_EXPORT X509 *d2i_X509_fp(FILE *fp, X509 **x509); +OPENSSL_EXPORT int i2d_X509_fp(FILE *fp,X509 *x509); +OPENSSL_EXPORT X509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL **crl); +OPENSSL_EXPORT int i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl); +OPENSSL_EXPORT X509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ **req); +OPENSSL_EXPORT int i2d_X509_REQ_fp(FILE *fp,X509_REQ *req); +OPENSSL_EXPORT RSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa); +OPENSSL_EXPORT int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa); +OPENSSL_EXPORT RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa); +OPENSSL_EXPORT int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa); +OPENSSL_EXPORT RSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa); +OPENSSL_EXPORT int i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa); +#ifndef OPENSSL_NO_DSA +OPENSSL_EXPORT DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); +OPENSSL_EXPORT int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); +OPENSSL_EXPORT DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); +OPENSSL_EXPORT int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); +#endif +OPENSSL_EXPORT EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); +OPENSSL_EXPORT int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); +OPENSSL_EXPORT EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); +OPENSSL_EXPORT int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); +OPENSSL_EXPORT X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); +OPENSSL_EXPORT int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); +OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, + PKCS8_PRIV_KEY_INFO **p8inf); +OPENSSL_EXPORT int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); +OPENSSL_EXPORT int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); +OPENSSL_EXPORT int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); +OPENSSL_EXPORT EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); +OPENSSL_EXPORT int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); +OPENSSL_EXPORT EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); +#endif + +OPENSSL_EXPORT X509 *d2i_X509_bio(BIO *bp,X509 **x509); +OPENSSL_EXPORT int i2d_X509_bio(BIO *bp,X509 *x509); +OPENSSL_EXPORT X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl); +OPENSSL_EXPORT int i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl); +OPENSSL_EXPORT X509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ **req); +OPENSSL_EXPORT int i2d_X509_REQ_bio(BIO *bp,X509_REQ *req); +OPENSSL_EXPORT RSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa); +OPENSSL_EXPORT int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa); +OPENSSL_EXPORT RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa); +OPENSSL_EXPORT int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa); +OPENSSL_EXPORT RSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa); +OPENSSL_EXPORT int i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa); +#ifndef OPENSSL_NO_DSA +OPENSSL_EXPORT DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); +OPENSSL_EXPORT int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); +OPENSSL_EXPORT DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); +OPENSSL_EXPORT int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); +#endif +OPENSSL_EXPORT EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); +OPENSSL_EXPORT int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); +OPENSSL_EXPORT EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); +OPENSSL_EXPORT int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); +OPENSSL_EXPORT X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8); +OPENSSL_EXPORT int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8); +OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, + PKCS8_PRIV_KEY_INFO **p8inf); +OPENSSL_EXPORT int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); +OPENSSL_EXPORT int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); +OPENSSL_EXPORT int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); +OPENSSL_EXPORT EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); +OPENSSL_EXPORT int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); +OPENSSL_EXPORT EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); + +OPENSSL_EXPORT X509 *X509_dup(X509 *x509); +OPENSSL_EXPORT X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); +OPENSSL_EXPORT X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); +OPENSSL_EXPORT X509_CRL *X509_CRL_dup(X509_CRL *crl); +OPENSSL_EXPORT X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev); +OPENSSL_EXPORT X509_REQ *X509_REQ_dup(X509_REQ *req); +OPENSSL_EXPORT X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); +OPENSSL_EXPORT int X509_ALGOR_set0(X509_ALGOR *alg, const ASN1_OBJECT *aobj, int ptype, void *pval); +OPENSSL_EXPORT void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval, + X509_ALGOR *algor); +OPENSSL_EXPORT void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); +OPENSSL_EXPORT int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); + +OPENSSL_EXPORT X509_NAME *X509_NAME_dup(X509_NAME *xn); +OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); + +OPENSSL_EXPORT int X509_cmp_time(const ASN1_TIME *s, time_t *t); +OPENSSL_EXPORT int X509_cmp_current_time(const ASN1_TIME *s); +OPENSSL_EXPORT ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t); +OPENSSL_EXPORT ASN1_TIME * X509_time_adj_ex(ASN1_TIME *s, int offset_day, long offset_sec, time_t *t); +OPENSSL_EXPORT ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj); + +OPENSSL_EXPORT const char * X509_get_default_cert_area(void ); +OPENSSL_EXPORT const char * X509_get_default_cert_dir(void ); +OPENSSL_EXPORT const char * X509_get_default_cert_file(void ); +OPENSSL_EXPORT const char * X509_get_default_cert_dir_env(void ); +OPENSSL_EXPORT const char * X509_get_default_cert_file_env(void ); +OPENSSL_EXPORT const char * X509_get_default_private_dir(void ); + +OPENSSL_EXPORT X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +OPENSSL_EXPORT X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey); + +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) +DECLARE_ASN1_FUNCTIONS(X509_VAL) + +DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) + +OPENSSL_EXPORT int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); +OPENSSL_EXPORT EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key); +OPENSSL_EXPORT int i2d_PUBKEY(const EVP_PKEY *a,unsigned char **pp); +OPENSSL_EXPORT EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp, + long length); +OPENSSL_EXPORT int i2d_RSA_PUBKEY(const RSA *a,unsigned char **pp); +OPENSSL_EXPORT RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp, + long length); +#ifndef OPENSSL_NO_DSA +OPENSSL_EXPORT int i2d_DSA_PUBKEY(const DSA *a,unsigned char **pp); +OPENSSL_EXPORT DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp, + long length); +#endif +OPENSSL_EXPORT int i2d_EC_PUBKEY(const EC_KEY *a, unsigned char **pp); +OPENSSL_EXPORT EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, + long length); + +DECLARE_ASN1_FUNCTIONS(X509_SIG) +DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) +DECLARE_ASN1_FUNCTIONS(X509_REQ) + +DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) +OPENSSL_EXPORT X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); + +DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) + +DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) + +DECLARE_ASN1_FUNCTIONS(X509_NAME) + +OPENSSL_EXPORT int X509_NAME_set(X509_NAME **xn, X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(X509_CINF) + +DECLARE_ASN1_FUNCTIONS(X509) +DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) + +DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR) + +/* X509_up_ref adds one to the reference count of |x| and returns + * |x|. */ +OPENSSL_EXPORT X509 *X509_up_ref(X509 *x); + +OPENSSL_EXPORT int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +OPENSSL_EXPORT int X509_set_ex_data(X509 *r, int idx, void *arg); +OPENSSL_EXPORT void *X509_get_ex_data(X509 *r, int idx); +OPENSSL_EXPORT int i2d_X509_AUX(X509 *a,unsigned char **pp); +OPENSSL_EXPORT X509 * d2i_X509_AUX(X509 **a,const unsigned char **pp,long length); + +OPENSSL_EXPORT void X509_get0_signature(ASN1_BIT_STRING **psig, X509_ALGOR **palg, + const X509 *x); +OPENSSL_EXPORT int X509_get_signature_nid(const X509 *x); + +OPENSSL_EXPORT int X509_alias_set1(X509 *x, unsigned char *name, int len); +OPENSSL_EXPORT int X509_keyid_set1(X509 *x, unsigned char *id, int len); +OPENSSL_EXPORT unsigned char * X509_alias_get0(X509 *x, int *len); +OPENSSL_EXPORT unsigned char * X509_keyid_get0(X509 *x, int *len); +OPENSSL_EXPORT int (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int); +OPENSSL_EXPORT int X509_TRUST_set(int *t, int trust); +OPENSSL_EXPORT int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj); +OPENSSL_EXPORT int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj); +OPENSSL_EXPORT void X509_trust_clear(X509 *x); +OPENSSL_EXPORT void X509_reject_clear(X509 *x); + +DECLARE_ASN1_FUNCTIONS(X509_REVOKED) +DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) +DECLARE_ASN1_FUNCTIONS(X509_CRL) + +OPENSSL_EXPORT int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); +OPENSSL_EXPORT int X509_CRL_get0_by_serial(X509_CRL *crl, + X509_REVOKED **ret, ASN1_INTEGER *serial); +OPENSSL_EXPORT int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); + +OPENSSL_EXPORT X509_PKEY * X509_PKEY_new(void ); +OPENSSL_EXPORT void X509_PKEY_free(X509_PKEY *a); + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) + +#ifndef OPENSSL_NO_EVP +OPENSSL_EXPORT X509_INFO * X509_INFO_new(void); +OPENSSL_EXPORT void X509_INFO_free(X509_INFO *a); +OPENSSL_EXPORT char * X509_NAME_oneline(X509_NAME *a,char *buf,int size); + +OPENSSL_EXPORT int ASN1_digest(i2d_of_void *i2d,const EVP_MD *type,char *data, + unsigned char *md,unsigned int *len); + +OPENSSL_EXPORT int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data, + unsigned char *md,unsigned int *len); + +OPENSSL_EXPORT int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey); + +OPENSSL_EXPORT int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, + ASN1_BIT_STRING *signature, + void *data, EVP_PKEY *pkey, const EVP_MD *type); +OPENSSL_EXPORT int ASN1_item_sign_ctx(const ASN1_ITEM *it, + X509_ALGOR *algor1, X509_ALGOR *algor2, + ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx); +#endif + +OPENSSL_EXPORT int X509_set_version(X509 *x,long version); +OPENSSL_EXPORT int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); +OPENSSL_EXPORT ASN1_INTEGER * X509_get_serialNumber(X509 *x); +OPENSSL_EXPORT int X509_set_issuer_name(X509 *x, X509_NAME *name); +OPENSSL_EXPORT X509_NAME * X509_get_issuer_name(X509 *a); +OPENSSL_EXPORT int X509_set_subject_name(X509 *x, X509_NAME *name); +OPENSSL_EXPORT X509_NAME * X509_get_subject_name(X509 *a); +OPENSSL_EXPORT int X509_set_notBefore(X509 *x, const ASN1_TIME *tm); +OPENSSL_EXPORT int X509_set_notAfter(X509 *x, const ASN1_TIME *tm); +OPENSSL_EXPORT int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); +OPENSSL_EXPORT EVP_PKEY * X509_get_pubkey(X509 *x); +OPENSSL_EXPORT ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x); +OPENSSL_EXPORT int X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */); + +OPENSSL_EXPORT int X509_REQ_set_version(X509_REQ *x,long version); +OPENSSL_EXPORT int X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name); +OPENSSL_EXPORT int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); +OPENSSL_EXPORT EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req); +OPENSSL_EXPORT int X509_REQ_extension_nid(int nid); +OPENSSL_EXPORT const int * X509_REQ_get_extension_nids(void); +OPENSSL_EXPORT void X509_REQ_set_extension_nids(const int *nids); +OPENSSL_EXPORT STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); +OPENSSL_EXPORT int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, + int nid); +OPENSSL_EXPORT int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); +OPENSSL_EXPORT int X509_REQ_get_attr_count(const X509_REQ *req); +OPENSSL_EXPORT int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, + int lastpos); +OPENSSL_EXPORT int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj, + int lastpos); +OPENSSL_EXPORT X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); +OPENSSL_EXPORT X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); +OPENSSL_EXPORT int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); +OPENSSL_EXPORT int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +OPENSSL_EXPORT int X509_REQ_add1_attr_by_NID(X509_REQ *req, + int nid, int type, + const unsigned char *bytes, int len); +OPENSSL_EXPORT int X509_REQ_add1_attr_by_txt(X509_REQ *req, + const char *attrname, int type, + const unsigned char *bytes, int len); + +OPENSSL_EXPORT int X509_CRL_set_version(X509_CRL *x, long version); +OPENSSL_EXPORT int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); +OPENSSL_EXPORT int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); +OPENSSL_EXPORT int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); +OPENSSL_EXPORT int X509_CRL_sort(X509_CRL *crl); + +OPENSSL_EXPORT int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); +OPENSSL_EXPORT int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); + +OPENSSL_EXPORT X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, + EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); + +OPENSSL_EXPORT int X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey); + +OPENSSL_EXPORT int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); +OPENSSL_EXPORT int X509_chain_check_suiteb(int *perror_depth, + X509 *x, STACK_OF(X509) *chain, + unsigned long flags); +OPENSSL_EXPORT int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, + unsigned long flags); +OPENSSL_EXPORT STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); + +OPENSSL_EXPORT int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); +OPENSSL_EXPORT unsigned long X509_issuer_and_serial_hash(X509 *a); + +OPENSSL_EXPORT int X509_issuer_name_cmp(const X509 *a, const X509 *b); +OPENSSL_EXPORT unsigned long X509_issuer_name_hash(X509 *a); + +OPENSSL_EXPORT int X509_subject_name_cmp(const X509 *a, const X509 *b); +OPENSSL_EXPORT unsigned long X509_subject_name_hash(X509 *x); + +OPENSSL_EXPORT unsigned long X509_issuer_name_hash_old(X509 *a); +OPENSSL_EXPORT unsigned long X509_subject_name_hash_old(X509 *x); + +OPENSSL_EXPORT int X509_cmp(const X509 *a, const X509 *b); +OPENSSL_EXPORT int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); +OPENSSL_EXPORT unsigned long X509_NAME_hash(X509_NAME *x); +OPENSSL_EXPORT unsigned long X509_NAME_hash_old(X509_NAME *x); + +OPENSSL_EXPORT int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); +OPENSSL_EXPORT int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); +#ifndef OPENSSL_NO_FP_API +OPENSSL_EXPORT int X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag); +OPENSSL_EXPORT int X509_print_fp(FILE *bp,X509 *x); +OPENSSL_EXPORT int X509_CRL_print_fp(FILE *bp,X509_CRL *x); +OPENSSL_EXPORT int X509_REQ_print_fp(FILE *bp,X509_REQ *req); +OPENSSL_EXPORT int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags); +#endif + +OPENSSL_EXPORT int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); +OPENSSL_EXPORT int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags); +OPENSSL_EXPORT int X509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag); +OPENSSL_EXPORT int X509_print(BIO *bp,X509 *x); +OPENSSL_EXPORT int X509_ocspid_print(BIO *bp,X509 *x); +OPENSSL_EXPORT int X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent); +OPENSSL_EXPORT int X509_CRL_print(BIO *bp,X509_CRL *x); +OPENSSL_EXPORT int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag); +OPENSSL_EXPORT int X509_REQ_print(BIO *bp,X509_REQ *req); + +OPENSSL_EXPORT int X509_NAME_entry_count(X509_NAME *name); +OPENSSL_EXPORT int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, + char *buf,int len); +OPENSSL_EXPORT int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, + char *buf,int len); + +/* NOTE: you should be passsing -1, not 0 as lastpos. The functions that use + * lastpos, search after that position on. */ +OPENSSL_EXPORT int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); +OPENSSL_EXPORT int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, + int lastpos); +OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); +OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); +OPENSSL_EXPORT int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, + int loc, int set); +OPENSSL_EXPORT int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, + unsigned char *bytes, int len, int loc, int set); +OPENSSL_EXPORT int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, + unsigned char *bytes, int len, int loc, int set); +OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, + const char *field, int type, const unsigned char *bytes, int len); +OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, + int type,unsigned char *bytes, int len); +OPENSSL_EXPORT int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, + const unsigned char *bytes, int len, int loc, int set); +OPENSSL_EXPORT X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, + const ASN1_OBJECT *obj, int type,const unsigned char *bytes, + int len); +OPENSSL_EXPORT int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, + const ASN1_OBJECT *obj); +OPENSSL_EXPORT int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, + const unsigned char *bytes, int len); +OPENSSL_EXPORT ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); +OPENSSL_EXPORT ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); + +OPENSSL_EXPORT int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); +OPENSSL_EXPORT int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, + int nid, int lastpos); +OPENSSL_EXPORT int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, + const ASN1_OBJECT *obj,int lastpos); +OPENSSL_EXPORT int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, + int crit, int lastpos); +OPENSSL_EXPORT X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); +OPENSSL_EXPORT X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); +OPENSSL_EXPORT STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, + X509_EXTENSION *ex, int loc); + +OPENSSL_EXPORT int X509_get_ext_count(X509 *x); +OPENSSL_EXPORT int X509_get_ext_by_NID(X509 *x, int nid, int lastpos); +OPENSSL_EXPORT int X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos); +OPENSSL_EXPORT int X509_get_ext_by_critical(X509 *x, int crit, int lastpos); +OPENSSL_EXPORT X509_EXTENSION *X509_get_ext(X509 *x, int loc); +OPENSSL_EXPORT X509_EXTENSION *X509_delete_ext(X509 *x, int loc); +OPENSSL_EXPORT int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); +OPENSSL_EXPORT void * X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx); +OPENSSL_EXPORT int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, + unsigned long flags); + +OPENSSL_EXPORT int X509_CRL_get_ext_count(X509_CRL *x); +OPENSSL_EXPORT int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos); +OPENSSL_EXPORT int X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos); +OPENSSL_EXPORT int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos); +OPENSSL_EXPORT X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc); +OPENSSL_EXPORT X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); +OPENSSL_EXPORT int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); +OPENSSL_EXPORT void * X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx); +OPENSSL_EXPORT int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, + unsigned long flags); + +OPENSSL_EXPORT int X509_REVOKED_get_ext_count(X509_REVOKED *x); +OPENSSL_EXPORT int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos); +OPENSSL_EXPORT int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos); +OPENSSL_EXPORT int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos); +OPENSSL_EXPORT X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc); +OPENSSL_EXPORT X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); +OPENSSL_EXPORT int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); +OPENSSL_EXPORT void * X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx); +OPENSSL_EXPORT int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, + unsigned long flags); + +OPENSSL_EXPORT X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, + int nid, int crit, ASN1_OCTET_STRING *data); +OPENSSL_EXPORT X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, + const ASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data); +OPENSSL_EXPORT int X509_EXTENSION_set_object(X509_EXTENSION *ex,const ASN1_OBJECT *obj); +OPENSSL_EXPORT int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); +OPENSSL_EXPORT int X509_EXTENSION_set_data(X509_EXTENSION *ex, + ASN1_OCTET_STRING *data); +OPENSSL_EXPORT ASN1_OBJECT * X509_EXTENSION_get_object(X509_EXTENSION *ex); +OPENSSL_EXPORT ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); +OPENSSL_EXPORT int X509_EXTENSION_get_critical(X509_EXTENSION *ex); + +OPENSSL_EXPORT int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); +OPENSSL_EXPORT int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, + int lastpos); +OPENSSL_EXPORT int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, const ASN1_OBJECT *obj, + int lastpos); +OPENSSL_EXPORT X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); +OPENSSL_EXPORT X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); +OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, + X509_ATTRIBUTE *attr); +OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, + int nid, int type, + const unsigned char *bytes, int len); +OPENSSL_EXPORT STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, + const char *attrname, int type, + const unsigned char *bytes, int len); +OPENSSL_EXPORT void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, + ASN1_OBJECT *obj, int lastpos, int type); +OPENSSL_EXPORT X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, + int atrtype, const void *data, int len); +OPENSSL_EXPORT X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, + const ASN1_OBJECT *obj, int atrtype, const void *data, int len); +OPENSSL_EXPORT X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, + const char *atrname, int type, const unsigned char *bytes, int len); +OPENSSL_EXPORT int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); +OPENSSL_EXPORT int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len); +OPENSSL_EXPORT void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, + int atrtype, void *data); +OPENSSL_EXPORT int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr); +OPENSSL_EXPORT ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); +OPENSSL_EXPORT ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); + +OPENSSL_EXPORT int EVP_PKEY_get_attr_count(const EVP_PKEY *key); +OPENSSL_EXPORT int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, + int lastpos); +OPENSSL_EXPORT int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj, + int lastpos); +OPENSSL_EXPORT X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); +OPENSSL_EXPORT X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); +OPENSSL_EXPORT int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); +OPENSSL_EXPORT int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +OPENSSL_EXPORT int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, + int nid, int type, + const unsigned char *bytes, int len); +OPENSSL_EXPORT int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, + const char *attrname, int type, + const unsigned char *bytes, int len); + +OPENSSL_EXPORT int X509_verify_cert(X509_STORE_CTX *ctx); + +/* lookup a cert from a X509 STACK */ +OPENSSL_EXPORT X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name, + ASN1_INTEGER *serial); +OPENSSL_EXPORT X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(PBEPARAM) +DECLARE_ASN1_FUNCTIONS(PBE2PARAM) +DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) + +OPENSSL_EXPORT int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, + const unsigned char *salt, int saltlen); + +OPENSSL_EXPORT X509_ALGOR *PKCS5_pbe_set(int alg, int iter, + const unsigned char *salt, int saltlen); +OPENSSL_EXPORT X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen); +OPENSSL_EXPORT X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen, + unsigned char *aiv, int prf_nid); + +OPENSSL_EXPORT X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, + int prf_nid, int keylen); + +/* PKCS#8 utilities */ + +DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) + +OPENSSL_EXPORT EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8); +OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); +OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken); +OPENSSL_EXPORT PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); + +OPENSSL_EXPORT int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, + int version, int ptype, void *pval, + unsigned char *penc, int penclen); +OPENSSL_EXPORT int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + X509_ALGOR **pa, + PKCS8_PRIV_KEY_INFO *p8); + +OPENSSL_EXPORT int X509_PUBKEY_set0_param(X509_PUBKEY *pub, const ASN1_OBJECT *aobj, + int ptype, void *pval, + unsigned char *penc, int penclen); +OPENSSL_EXPORT int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + X509_ALGOR **pa, + X509_PUBKEY *pub); + +OPENSSL_EXPORT int X509_check_trust(X509 *x, int id, int flags); +OPENSSL_EXPORT int X509_TRUST_get_count(void); +OPENSSL_EXPORT X509_TRUST * X509_TRUST_get0(int idx); +OPENSSL_EXPORT int X509_TRUST_get_by_id(int id); +OPENSSL_EXPORT int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int), + char *name, int arg1, void *arg2); +OPENSSL_EXPORT void X509_TRUST_cleanup(void); +OPENSSL_EXPORT int X509_TRUST_get_flags(X509_TRUST *xp); +OPENSSL_EXPORT char *X509_TRUST_get0_name(X509_TRUST *xp); +OPENSSL_EXPORT int X509_TRUST_get_trust(X509_TRUST *xp); + +/* PKCS7_get_certificates parses a PKCS#7, SignedData structure from |cbs| and + * appends the included certificates to |out_certs|. It returns one on success + * and zero on error. */ +OPENSSL_EXPORT int PKCS7_get_certificates(STACK_OF(X509) *out_certs, CBS *cbs); + +/* PKCS7_bundle_certificates appends a PKCS#7, SignedData structure containing + * |certs| to |out|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int PKCS7_bundle_certificates( + CBB *out, const STACK_OF(X509) *certs); + +/* PKCS7_get_CRLs parses a PKCS#7, SignedData structure from |cbs| and appends + * the included CRLs to |out_crls|. It returns one on success and zero on + * error. */ +OPENSSL_EXPORT int PKCS7_get_CRLs(STACK_OF(X509_CRL) *out_crls, CBS *cbs); + +/* PKCS7_bundle_CRLs appends a PKCS#7, SignedData structure containing + * |crls| to |out|. It returns one on success and zero on error. */ +OPENSSL_EXPORT int PKCS7_bundle_CRLs(CBB *out, const STACK_OF(X509_CRL) *crls); + +/* PKCS7_get_PEM_certificates reads a PEM-encoded, PKCS#7, SignedData structure + * from |pem_bio| and appends the included certificates to |out_certs|. It + * returns one on success and zero on error. */ +OPENSSL_EXPORT int PKCS7_get_PEM_certificates(STACK_OF(X509) *out_certs, + BIO *pem_bio); + +/* PKCS7_get_PEM_CRLs reads a PEM-encoded, PKCS#7, SignedData structure from + * |pem_bio| and appends the included CRLs to |out_crls|. It returns one on + * success and zero on error. */ +OPENSSL_EXPORT int PKCS7_get_PEM_CRLs(STACK_OF(X509_CRL) *out_crls, + BIO *pem_bio); + +/* EVP_PK values indicate the algorithm of the public key in a certificate. */ + +#define EVP_PK_RSA 0x0001 +#define EVP_PK_DSA 0x0002 +#define EVP_PK_DH 0x0004 +#define EVP_PK_EC 0x0008 + +/* EVP_PKS values indicate the algorithm used to sign a certificate. */ + +#define EVP_PKS_RSA 0x0100 +#define EVP_PKS_DSA 0x0200 +#define EVP_PKS_EC 0x0400 + +/* EVP_PKT values are flags that define what public-key operations can be + * performed with the public key from a certificate. */ + +/* EVP_PKT_SIGN indicates that the public key can be used for signing. */ +#define EVP_PKT_SIGN 0x0010 +/* EVP_PKT_ENC indicates that a session key can be encrypted to the public + * key. */ +#define EVP_PKT_ENC 0x0020 +/* EVP_PKT_EXCH indicates that key-agreement can be performed. */ +#define EVP_PKT_EXCH 0x0040 +/* EVP_PKT_EXP indicates that key is weak (i.e. "export"). */ +#define EVP_PKT_EXP 0x1000 + + +#ifdef __cplusplus +} +#endif + +#define X509_F_ASN1_digest 100 +#define X509_F_ASN1_item_sign_ctx 101 +#define X509_F_ASN1_item_verify 102 +#define X509_F_NETSCAPE_SPKI_b64_decode 103 +#define X509_F_NETSCAPE_SPKI_b64_encode 104 +#define X509_F_PKCS7_get_certificates 105 +#define X509_F_X509_ATTRIBUTE_create_by_NID 106 +#define X509_F_X509_ATTRIBUTE_create_by_OBJ 107 +#define X509_F_X509_ATTRIBUTE_create_by_txt 108 +#define X509_F_X509_ATTRIBUTE_get0_data 109 +#define X509_F_X509_ATTRIBUTE_set1_data 110 +#define X509_F_X509_CRL_add0_revoked 111 +#define X509_F_X509_CRL_diff 112 +#define X509_F_X509_CRL_print_fp 113 +#define X509_F_X509_EXTENSION_create_by_NID 114 +#define X509_F_X509_EXTENSION_create_by_OBJ 115 +#define X509_F_X509_INFO_new 116 +#define X509_F_X509_NAME_ENTRY_create_by_NID 117 +#define X509_F_X509_NAME_ENTRY_create_by_txt 118 +#define X509_F_X509_NAME_ENTRY_set_object 119 +#define X509_F_X509_NAME_add_entry 120 +#define X509_F_X509_NAME_oneline 121 +#define X509_F_X509_NAME_print 122 +#define X509_F_X509_PKEY_new 123 +#define X509_F_X509_PUBKEY_get 124 +#define X509_F_X509_PUBKEY_set 125 +#define X509_F_X509_REQ_check_private_key 126 +#define X509_F_X509_REQ_to_X509 127 +#define X509_F_X509_STORE_CTX_get1_issuer 128 +#define X509_F_X509_STORE_CTX_init 129 +#define X509_F_X509_STORE_CTX_new 130 +#define X509_F_X509_STORE_CTX_purpose_inherit 131 +#define X509_F_X509_STORE_add_cert 132 +#define X509_F_X509_STORE_add_crl 133 +#define X509_F_X509_TRUST_add 134 +#define X509_F_X509_TRUST_set 135 +#define X509_F_X509_check_private_key 136 +#define X509_F_X509_get_pubkey_parameters 137 +#define X509_F_X509_load_cert_crl_file 138 +#define X509_F_X509_load_cert_file 139 +#define X509_F_X509_load_crl_file 140 +#define X509_F_X509_print_ex_fp 141 +#define X509_F_X509_to_X509_REQ 142 +#define X509_F_X509_verify_cert 143 +#define X509_F_X509at_add1_attr 144 +#define X509_F_X509v3_add_ext 145 +#define X509_F_add_cert_dir 146 +#define X509_F_by_file_ctrl 147 +#define X509_F_check_policy 148 +#define X509_F_dir_ctrl 149 +#define X509_F_get_cert_by_subject 150 +#define X509_F_i2d_DSA_PUBKEY 151 +#define X509_F_i2d_EC_PUBKEY 152 +#define X509_F_i2d_RSA_PUBKEY 153 +#define X509_F_x509_name_encode 154 +#define X509_F_x509_name_ex_d2i 155 +#define X509_F_x509_name_ex_new 156 +#define X509_F_pkcs7_parse_header 157 +#define X509_F_PKCS7_get_CRLs 158 +#define X509_R_AKID_MISMATCH 100 +#define X509_R_BAD_PKCS7_VERSION 101 +#define X509_R_BAD_X509_FILETYPE 102 +#define X509_R_BASE64_DECODE_ERROR 103 +#define X509_R_CANT_CHECK_DH_KEY 104 +#define X509_R_CERT_ALREADY_IN_HASH_TABLE 105 +#define X509_R_CRL_ALREADY_DELTA 106 +#define X509_R_CRL_VERIFY_FAILURE 107 +#define X509_R_IDP_MISMATCH 108 +#define X509_R_INVALID_BIT_STRING_BITS_LEFT 109 +#define X509_R_INVALID_DIRECTORY 110 +#define X509_R_INVALID_FIELD_NAME 111 +#define X509_R_INVALID_TRUST 112 +#define X509_R_ISSUER_MISMATCH 113 +#define X509_R_KEY_TYPE_MISMATCH 114 +#define X509_R_KEY_VALUES_MISMATCH 115 +#define X509_R_LOADING_CERT_DIR 116 +#define X509_R_LOADING_DEFAULTS 117 +#define X509_R_METHOD_NOT_SUPPORTED 118 +#define X509_R_NEWER_CRL_NOT_NEWER 119 +#define X509_R_NOT_PKCS7_SIGNED_DATA 120 +#define X509_R_NO_CERTIFICATES_INCLUDED 121 +#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 122 +#define X509_R_NO_CRL_NUMBER 123 +#define X509_R_PUBLIC_KEY_DECODE_ERROR 124 +#define X509_R_PUBLIC_KEY_ENCODE_ERROR 125 +#define X509_R_SHOULD_RETRY 126 +#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 127 +#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 128 +#define X509_R_UNKNOWN_KEY_TYPE 129 +#define X509_R_UNKNOWN_NID 130 +#define X509_R_UNKNOWN_PURPOSE_ID 131 +#define X509_R_UNKNOWN_TRUST_ID 132 +#define X509_R_UNSUPPORTED_ALGORITHM 133 +#define X509_R_WRONG_LOOKUP_TYPE 134 +#define X509_R_WRONG_TYPE 135 +#define X509_R_NO_CRLS_INCLUDED 136 + +#endif diff --git a/phonelibs/boringssl/include/openssl/x509_vfy.h b/phonelibs/boringssl/include/openssl/x509_vfy.h new file mode 100644 index 00000000000000..146e047a6d7d4d --- /dev/null +++ b/phonelibs/boringssl/include/openssl/x509_vfy.h @@ -0,0 +1,612 @@ +/* crypto/x509/x509_vfy.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 THE AUTHOR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_X509_H +#include +/* openssl/x509.h ends up #include-ing this file at about the only + * appropriate moment. */ +#endif + +#ifndef HEADER_X509_VFY_H +#define HEADER_X509_VFY_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if 0 +/* Outer object */ +typedef struct x509_hash_dir_st + { + int num_dirs; + char **dirs; + int *dirs_type; + int num_dirs_alloced; + } X509_HASH_DIR_CTX; +#endif + +typedef struct x509_file_st + { + int num_paths; /* number of paths to files or directories */ + int num_alloced; + char **paths; /* the list of paths or directories */ + int *path_type; + } X509_CERT_FILE_CTX; + +/*******************************/ +/* +SSL_CTX -> X509_STORE + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + +SSL -> X509_STORE_CTX + ->X509_STORE + +The X509_STORE holds the tables etc for verification stuff. +A X509_STORE_CTX is used while validating a single certificate. +The X509_STORE has X509_LOOKUPs for looking up certs. +The X509_STORE then calls a function to actually verify the +certificate chain. +*/ + +#define X509_LU_RETRY -1 +#define X509_LU_FAIL 0 +#define X509_LU_X509 1 +#define X509_LU_CRL 2 +#define X509_LU_PKEY 3 + +typedef struct x509_object_st + { + /* one of the above types */ + int type; + union { + char *ptr; + X509 *x509; + X509_CRL *crl; + EVP_PKEY *pkey; + } data; + } X509_OBJECT; + +typedef struct x509_lookup_st X509_LOOKUP; + +DECLARE_STACK_OF(X509_LOOKUP) +DECLARE_STACK_OF(X509_OBJECT) + +/* This is a static that defines the function interface */ +typedef struct x509_lookup_method_st + { + const char *name; + int (*new_item)(X509_LOOKUP *ctx); + void (*free)(X509_LOOKUP *ctx); + int (*init)(X509_LOOKUP *ctx); + int (*shutdown)(X509_LOOKUP *ctx); + int (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl, + char **ret); + int (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name, + X509_OBJECT *ret); + int (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name, + ASN1_INTEGER *serial,X509_OBJECT *ret); + int (*get_by_fingerprint)(X509_LOOKUP *ctx,int type, + unsigned char *bytes,int len, + X509_OBJECT *ret); + int (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len, + X509_OBJECT *ret); + } X509_LOOKUP_METHOD; + +typedef struct X509_VERIFY_PARAM_ID_st X509_VERIFY_PARAM_ID; + +/* This structure hold all parameters associated with a verify operation + * by including an X509_VERIFY_PARAM structure in related structures the + * parameters used can be customized + */ + +typedef struct X509_VERIFY_PARAM_st + { + char *name; + time_t check_time; /* Time to use */ + unsigned long inh_flags; /* Inheritance flags */ + unsigned long flags; /* Various verify flags */ + int purpose; /* purpose to check untrusted certificates */ + int trust; /* trust setting to check */ + int depth; /* Verify depth */ + STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */ + X509_VERIFY_PARAM_ID *id; /* opaque ID data */ + } X509_VERIFY_PARAM; + +DECLARE_STACK_OF(X509_VERIFY_PARAM) + +/* This is used to hold everything. It is used for all certificate + * validation. Once we have a certificate chain, the 'verify' + * function is then called to actually check the cert chain. */ +struct x509_store_st + { + /* The following is a cache of trusted certs */ + int cache; /* if true, stash any hits */ + STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */ + CRYPTO_MUTEX objs_lock; + + /* These are external lookup methods */ + STACK_OF(X509_LOOKUP) *get_cert_methods; + + X509_VERIFY_PARAM *param; + + /* Callbacks for various operations */ + int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ + int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ + int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */ + int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ + int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */ + int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ + int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ + int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ + STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm); + STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm); + int (*cleanup)(X509_STORE_CTX *ctx); + + CRYPTO_refcount_t references; + } /* X509_STORE */; + +OPENSSL_EXPORT int X509_STORE_set_depth(X509_STORE *store, int depth); + +#define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func)) +#define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func)) + +/* This is the functions plus an instance of the local variables. */ +struct x509_lookup_st + { + int init; /* have we been started */ + int skip; /* don't use us. */ + X509_LOOKUP_METHOD *method; /* the functions */ + char *method_data; /* method data */ + + X509_STORE *store_ctx; /* who owns us */ + } /* X509_LOOKUP */; + +/* This is a used when verifying cert chains. Since the + * gathering of the cert chain can take some time (and have to be + * 'retried', this needs to be kept and passed around. */ +struct x509_store_ctx_st /* X509_STORE_CTX */ + { + X509_STORE *ctx; + int current_method; /* used when looking up certs */ + + /* The following are set by the caller */ + X509 *cert; /* The cert to check */ + STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */ + STACK_OF(X509_CRL) *crls; /* set of CRLs passed in */ + + X509_VERIFY_PARAM *param; + void *other_ctx; /* Other info for use with get_issuer() */ + + /* Callbacks for various operations */ + int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ + int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ + int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */ + int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ + int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */ + int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ + int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ + int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ + int (*check_policy)(X509_STORE_CTX *ctx); + STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm); + STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm); + int (*cleanup)(X509_STORE_CTX *ctx); + + /* The following is built up */ + int valid; /* if 0, rebuild chain */ + int last_untrusted; /* index of last untrusted cert */ + STACK_OF(X509) *chain; /* chain of X509s - built up and trusted */ + X509_POLICY_TREE *tree; /* Valid policy tree */ + + int explicit_policy; /* Require explicit policy value */ + + /* When something goes wrong, this is why */ + int error_depth; + int error; + X509 *current_cert; + X509 *current_issuer; /* cert currently being tested as valid issuer */ + X509_CRL *current_crl; /* current CRL */ + + int current_crl_score; /* score of current CRL */ + unsigned int current_reasons; /* Reason mask */ + + X509_STORE_CTX *parent; /* For CRL path validation: parent context */ + + CRYPTO_EX_DATA ex_data; + } /* X509_STORE_CTX */; + +OPENSSL_EXPORT void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); + +#define X509_STORE_CTX_set_app_data(ctx,data) \ + X509_STORE_CTX_set_ex_data(ctx,0,data) +#define X509_STORE_CTX_get_app_data(ctx) \ + X509_STORE_CTX_get_ex_data(ctx,0) + +#define X509_L_FILE_LOAD 1 +#define X509_L_ADD_DIR 2 + +#define X509_LOOKUP_load_file(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) + +#define X509_LOOKUP_add_dir(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) + +#define X509_V_OK 0 +/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */ + +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 +#define X509_V_ERR_UNABLE_TO_GET_CRL 3 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +#define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +#define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 +#define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 +#define X509_V_ERR_CERT_NOT_YET_VALID 9 +#define X509_V_ERR_CERT_HAS_EXPIRED 10 +#define X509_V_ERR_CRL_NOT_YET_VALID 11 +#define X509_V_ERR_CRL_HAS_EXPIRED 12 +#define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +#define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +#define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +#define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +#define X509_V_ERR_OUT_OF_MEM 17 +#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +#define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +#define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +#define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 +#define X509_V_ERR_CERT_REVOKED 23 +#define X509_V_ERR_INVALID_CA 24 +#define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 +#define X509_V_ERR_INVALID_PURPOSE 26 +#define X509_V_ERR_CERT_UNTRUSTED 27 +#define X509_V_ERR_CERT_REJECTED 28 +/* These are 'informational' when looking for issuer cert */ +#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 +#define X509_V_ERR_AKID_SKID_MISMATCH 30 +#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 + +#define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 +#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 +#define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 +#define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +#define X509_V_ERR_INVALID_NON_CA 37 +#define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +#define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 + +#define X509_V_ERR_INVALID_EXTENSION 41 +#define X509_V_ERR_INVALID_POLICY_EXTENSION 42 +#define X509_V_ERR_NO_EXPLICIT_POLICY 43 +#define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 +#define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 + +#define X509_V_ERR_UNNESTED_RESOURCE 46 + +#define X509_V_ERR_PERMITTED_VIOLATION 47 +#define X509_V_ERR_EXCLUDED_VIOLATION 48 +#define X509_V_ERR_SUBTREE_MINMAX 49 +#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 +#define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 +#define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 +#define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 + +/* Suite B mode algorithm violation */ +#define X509_V_ERR_SUITE_B_INVALID_VERSION 56 +#define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 +#define X509_V_ERR_SUITE_B_INVALID_CURVE 58 +#define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 +#define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 +#define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 + +/* Host, email and IP check errors */ +#define X509_V_ERR_HOSTNAME_MISMATCH 62 +#define X509_V_ERR_EMAIL_MISMATCH 63 +#define X509_V_ERR_IP_ADDRESS_MISMATCH 64 + +/* The application is not happy */ +#define X509_V_ERR_APPLICATION_VERIFICATION 50 + +/* Certificate verify flags */ + +/* Send issuer+subject checks to verify_cb */ +#define X509_V_FLAG_CB_ISSUER_CHECK 0x1 +/* Use check time instead of current time */ +#define X509_V_FLAG_USE_CHECK_TIME 0x2 +/* Lookup CRLs */ +#define X509_V_FLAG_CRL_CHECK 0x4 +/* Lookup CRLs for whole chain */ +#define X509_V_FLAG_CRL_CHECK_ALL 0x8 +/* Ignore unhandled critical extensions */ +#define X509_V_FLAG_IGNORE_CRITICAL 0x10 +/* Disable workarounds for broken certificates */ +#define X509_V_FLAG_X509_STRICT 0x20 +/* Enable proxy certificate validation */ +#define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 +/* Enable policy checking */ +#define X509_V_FLAG_POLICY_CHECK 0x80 +/* Policy variable require-explicit-policy */ +#define X509_V_FLAG_EXPLICIT_POLICY 0x100 +/* Policy variable inhibit-any-policy */ +#define X509_V_FLAG_INHIBIT_ANY 0x200 +/* Policy variable inhibit-policy-mapping */ +#define X509_V_FLAG_INHIBIT_MAP 0x400 +/* Notify callback that policy is OK */ +#define X509_V_FLAG_NOTIFY_POLICY 0x800 +/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ +#define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 +/* Delta CRL support */ +#define X509_V_FLAG_USE_DELTAS 0x2000 +/* Check selfsigned CA signature */ +#define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 +/* Use trusted store first */ +#define X509_V_FLAG_TRUSTED_FIRST 0x8000 +/* Suite B 128 bit only mode: not normally used */ +#define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +#define X509_V_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +#define X509_V_FLAG_SUITEB_128_LOS 0x30000 + +/* Allow partial chains if at least one certificate is in trusted store */ +#define X509_V_FLAG_PARTIAL_CHAIN 0x80000 + +#define X509_VP_FLAG_DEFAULT 0x1 +#define X509_VP_FLAG_OVERWRITE 0x2 +#define X509_VP_FLAG_RESET_FLAGS 0x4 +#define X509_VP_FLAG_LOCKED 0x8 +#define X509_VP_FLAG_ONCE 0x10 + +/* Internal use: mask of policy related options */ +#define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ + | X509_V_FLAG_EXPLICIT_POLICY \ + | X509_V_FLAG_INHIBIT_ANY \ + | X509_V_FLAG_INHIBIT_MAP) + +OPENSSL_EXPORT int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, + X509_NAME *name); +OPENSSL_EXPORT X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name); +OPENSSL_EXPORT X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); +OPENSSL_EXPORT void X509_OBJECT_up_ref_count(X509_OBJECT *a); +OPENSSL_EXPORT void X509_OBJECT_free_contents(X509_OBJECT *a); +OPENSSL_EXPORT X509_STORE *X509_STORE_new(void ); +OPENSSL_EXPORT void X509_STORE_free(X509_STORE *v); + +OPENSSL_EXPORT STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); +OPENSSL_EXPORT STACK_OF(X509_CRL)* X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); +OPENSSL_EXPORT int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); +OPENSSL_EXPORT int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); +OPENSSL_EXPORT int X509_STORE_set_trust(X509_STORE *ctx, int trust); +OPENSSL_EXPORT int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); + +OPENSSL_EXPORT void X509_STORE_set_verify_cb(X509_STORE *ctx, + int (*verify_cb)(int, X509_STORE_CTX *)); + +OPENSSL_EXPORT void X509_STORE_set_lookup_crls_cb(X509_STORE *ctx, + STACK_OF(X509_CRL)* (*cb)(X509_STORE_CTX *ctx, X509_NAME *nm)); + +OPENSSL_EXPORT X509_STORE_CTX *X509_STORE_CTX_new(void); + +OPENSSL_EXPORT int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); + +OPENSSL_EXPORT void X509_STORE_CTX_free(X509_STORE_CTX *ctx); +OPENSSL_EXPORT int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, + X509 *x509, STACK_OF(X509) *chain); +OPENSSL_EXPORT void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +OPENSSL_EXPORT void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); + +OPENSSL_EXPORT X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); + +OPENSSL_EXPORT X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); + +OPENSSL_EXPORT X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); +OPENSSL_EXPORT X509_LOOKUP_METHOD *X509_LOOKUP_file(void); + +OPENSSL_EXPORT int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); +OPENSSL_EXPORT int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); + +OPENSSL_EXPORT int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name, + X509_OBJECT *ret); + +OPENSSL_EXPORT int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); + +#ifndef OPENSSL_NO_STDIO +OPENSSL_EXPORT int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); +OPENSSL_EXPORT int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); +OPENSSL_EXPORT int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); +#endif + + +OPENSSL_EXPORT X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); +OPENSSL_EXPORT void X509_LOOKUP_free(X509_LOOKUP *ctx); +OPENSSL_EXPORT int X509_LOOKUP_init(X509_LOOKUP *ctx); +OPENSSL_EXPORT int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, + X509_OBJECT *ret); +OPENSSL_EXPORT int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, + ASN1_INTEGER *serial, X509_OBJECT *ret); +OPENSSL_EXPORT int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, + unsigned char *bytes, int len, X509_OBJECT *ret); +OPENSSL_EXPORT int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, + int len, X509_OBJECT *ret); +OPENSSL_EXPORT int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); + +#ifndef OPENSSL_NO_STDIO +OPENSSL_EXPORT int X509_STORE_load_locations (X509_STORE *ctx, + const char *file, const char *dir); +OPENSSL_EXPORT int X509_STORE_set_default_paths(X509_STORE *ctx); +#endif + +OPENSSL_EXPORT int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +OPENSSL_EXPORT int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data); +OPENSSL_EXPORT void * X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx); +OPENSSL_EXPORT int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); +OPENSSL_EXPORT void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); +OPENSSL_EXPORT int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); +OPENSSL_EXPORT X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); +OPENSSL_EXPORT X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); +OPENSSL_EXPORT X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); +OPENSSL_EXPORT X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); +OPENSSL_EXPORT STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); +OPENSSL_EXPORT STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); +OPENSSL_EXPORT void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x); +OPENSSL_EXPORT void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk); +OPENSSL_EXPORT void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk); +OPENSSL_EXPORT int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); +OPENSSL_EXPORT int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); +OPENSSL_EXPORT int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, + int purpose, int trust); +OPENSSL_EXPORT void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); +OPENSSL_EXPORT void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, + time_t t); +OPENSSL_EXPORT void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, + int (*verify_cb)(int, X509_STORE_CTX *)); + +OPENSSL_EXPORT X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); +OPENSSL_EXPORT int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); + +OPENSSL_EXPORT X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); +OPENSSL_EXPORT void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); +OPENSSL_EXPORT int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); + +/* X509_VERIFY_PARAM functions */ + +OPENSSL_EXPORT X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); +OPENSSL_EXPORT void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); +OPENSSL_EXPORT int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +OPENSSL_EXPORT int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +OPENSSL_EXPORT int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); +OPENSSL_EXPORT int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags); +OPENSSL_EXPORT int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +OPENSSL_EXPORT unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); +OPENSSL_EXPORT int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); +OPENSSL_EXPORT int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); +OPENSSL_EXPORT void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); +OPENSSL_EXPORT void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); +OPENSSL_EXPORT int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, + ASN1_OBJECT *policy); +OPENSSL_EXPORT int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, + STACK_OF(ASN1_OBJECT) *policies); + +OPENSSL_EXPORT int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, + const char *name, size_t namelen); +OPENSSL_EXPORT int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, + const char *name, + size_t namelen); +OPENSSL_EXPORT void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, + unsigned int flags); +OPENSSL_EXPORT char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *); +OPENSSL_EXPORT int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, + const char *email, size_t emaillen); +OPENSSL_EXPORT int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, + const unsigned char *ip, size_t iplen); +OPENSSL_EXPORT int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc); + +OPENSSL_EXPORT int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); +OPENSSL_EXPORT const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); + +OPENSSL_EXPORT int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); +OPENSSL_EXPORT int X509_VERIFY_PARAM_get_count(void); +OPENSSL_EXPORT const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); +OPENSSL_EXPORT const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); +OPENSSL_EXPORT void X509_VERIFY_PARAM_table_cleanup(void); + +OPENSSL_EXPORT int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, + STACK_OF(X509) *certs, + STACK_OF(ASN1_OBJECT) *policy_oids, + unsigned int flags); + +OPENSSL_EXPORT void X509_policy_tree_free(X509_POLICY_TREE *tree); + +OPENSSL_EXPORT int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); +OPENSSL_EXPORT X509_POLICY_LEVEL * + X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i); + +OPENSSL_EXPORT STACK_OF(X509_POLICY_NODE) * + X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree); + +OPENSSL_EXPORT STACK_OF(X509_POLICY_NODE) * + X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree); + +OPENSSL_EXPORT int X509_policy_level_node_count(X509_POLICY_LEVEL *level); + +OPENSSL_EXPORT X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i); + +OPENSSL_EXPORT const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); + +OPENSSL_EXPORT STACK_OF(POLICYQUALINFO) * + X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node); +OPENSSL_EXPORT const X509_POLICY_NODE * + X509_policy_node_get0_parent(const X509_POLICY_NODE *node); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/phonelibs/boringssl/include/openssl/x509v3.h b/phonelibs/boringssl/include/openssl/x509v3.h new file mode 100644 index 00000000000000..5caa5c1f4e348b --- /dev/null +++ b/phonelibs/boringssl/include/openssl/x509v3.h @@ -0,0 +1,855 @@ +/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project 1999. */ +/* ==================================================================== + * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. + * + * 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 THE OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). */ + +#ifndef HEADER_X509V3_H +#define HEADER_X509V3_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward reference */ +struct v3_ext_method; +struct v3_ext_ctx; + +/* Useful typedefs */ + +typedef void * (*X509V3_EXT_NEW)(void); +typedef void (*X509V3_EXT_FREE)(void *); +typedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long); +typedef int (*X509V3_EXT_I2D)(void *, unsigned char **); +typedef STACK_OF(CONF_VALUE) * + (*X509V3_EXT_I2V)(const struct v3_ext_method *method, void *ext, + STACK_OF(CONF_VALUE) *extlist); +typedef void * (*X509V3_EXT_V2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, + STACK_OF(CONF_VALUE) *values); +typedef char * (*X509V3_EXT_I2S)(const struct v3_ext_method *method, void *ext); +typedef void * (*X509V3_EXT_S2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); +typedef int (*X509V3_EXT_I2R)(const struct v3_ext_method *method, void *ext, + BIO *out, int indent); +typedef void * (*X509V3_EXT_R2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); + +/* V3 extension structure */ + +struct v3_ext_method { +int ext_nid; +int ext_flags; +/* If this is set the following four fields are ignored */ +ASN1_ITEM_EXP *it; +/* Old style ASN1 calls */ +X509V3_EXT_NEW ext_new; +X509V3_EXT_FREE ext_free; +X509V3_EXT_D2I d2i; +X509V3_EXT_I2D i2d; + +/* The following pair is used for string extensions */ +X509V3_EXT_I2S i2s; +X509V3_EXT_S2I s2i; + +/* The following pair is used for multi-valued extensions */ +X509V3_EXT_I2V i2v; +X509V3_EXT_V2I v2i; + +/* The following are used for raw extensions */ +X509V3_EXT_I2R i2r; +X509V3_EXT_R2I r2i; + +void *usr_data; /* Any extension specific data */ +}; + +typedef struct X509V3_CONF_METHOD_st { +char * (*get_string)(void *db, char *section, char *value); +STACK_OF(CONF_VALUE) * (*get_section)(void *db, char *section); +void (*free_string)(void *db, char * string); +void (*free_section)(void *db, STACK_OF(CONF_VALUE) *section); +} X509V3_CONF_METHOD; + +/* Context specific info */ +struct v3_ext_ctx { +#define CTX_TEST 0x1 +int flags; +X509 *issuer_cert; +X509 *subject_cert; +X509_REQ *subject_req; +X509_CRL *crl; +const X509V3_CONF_METHOD *db_meth; +void *db; +/* Maybe more here */ +}; + +typedef struct v3_ext_method X509V3_EXT_METHOD; + +DECLARE_STACK_OF(X509V3_EXT_METHOD) + +/* ext_flags values */ +#define X509V3_EXT_DYNAMIC 0x1 +#define X509V3_EXT_CTX_DEP 0x2 +#define X509V3_EXT_MULTILINE 0x4 + +typedef BIT_STRING_BITNAME ENUMERATED_NAMES; + +typedef struct BASIC_CONSTRAINTS_st { +int ca; +ASN1_INTEGER *pathlen; +} BASIC_CONSTRAINTS; + + +typedef struct PKEY_USAGE_PERIOD_st { +ASN1_GENERALIZEDTIME *notBefore; +ASN1_GENERALIZEDTIME *notAfter; +} PKEY_USAGE_PERIOD; + +typedef struct otherName_st { +ASN1_OBJECT *type_id; +ASN1_TYPE *value; +} OTHERNAME; + +typedef struct EDIPartyName_st { + ASN1_STRING *nameAssigner; + ASN1_STRING *partyName; +} EDIPARTYNAME; + +typedef struct GENERAL_NAME_st { + +#define GEN_OTHERNAME 0 +#define GEN_EMAIL 1 +#define GEN_DNS 2 +#define GEN_X400 3 +#define GEN_DIRNAME 4 +#define GEN_EDIPARTY 5 +#define GEN_URI 6 +#define GEN_IPADD 7 +#define GEN_RID 8 + +int type; +union { + char *ptr; + OTHERNAME *otherName; /* otherName */ + ASN1_IA5STRING *rfc822Name; + ASN1_IA5STRING *dNSName; + ASN1_TYPE *x400Address; + X509_NAME *directoryName; + EDIPARTYNAME *ediPartyName; + ASN1_IA5STRING *uniformResourceIdentifier; + ASN1_OCTET_STRING *iPAddress; + ASN1_OBJECT *registeredID; + + /* Old names */ + ASN1_OCTET_STRING *ip; /* iPAddress */ + X509_NAME *dirn; /* dirn */ + ASN1_IA5STRING *ia5;/* rfc822Name, dNSName, uniformResourceIdentifier */ + ASN1_OBJECT *rid; /* registeredID */ + ASN1_TYPE *other; /* x400Address */ +} d; +} GENERAL_NAME; + +typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; + +typedef struct ACCESS_DESCRIPTION_st { + ASN1_OBJECT *method; + GENERAL_NAME *location; +} ACCESS_DESCRIPTION; + +typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; + +typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; + +DECLARE_STACK_OF(GENERAL_NAME) +DECLARE_ASN1_SET_OF(GENERAL_NAME) + +DECLARE_STACK_OF(ACCESS_DESCRIPTION) +DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) + +typedef struct DIST_POINT_NAME_st { +int type; +union { + GENERAL_NAMES *fullname; + STACK_OF(X509_NAME_ENTRY) *relativename; +} name; +/* If relativename then this contains the full distribution point name */ +X509_NAME *dpname; +} DIST_POINT_NAME; +/* All existing reasons */ +#define CRLDP_ALL_REASONS 0x807f + +#define CRL_REASON_NONE -1 +#define CRL_REASON_UNSPECIFIED 0 +#define CRL_REASON_KEY_COMPROMISE 1 +#define CRL_REASON_CA_COMPROMISE 2 +#define CRL_REASON_AFFILIATION_CHANGED 3 +#define CRL_REASON_SUPERSEDED 4 +#define CRL_REASON_CESSATION_OF_OPERATION 5 +#define CRL_REASON_CERTIFICATE_HOLD 6 +#define CRL_REASON_REMOVE_FROM_CRL 8 +#define CRL_REASON_PRIVILEGE_WITHDRAWN 9 +#define CRL_REASON_AA_COMPROMISE 10 + +struct DIST_POINT_st { +DIST_POINT_NAME *distpoint; +ASN1_BIT_STRING *reasons; +GENERAL_NAMES *CRLissuer; +int dp_reasons; +}; + +typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; + +DECLARE_STACK_OF(DIST_POINT) +DECLARE_ASN1_SET_OF(DIST_POINT) + +struct AUTHORITY_KEYID_st { +ASN1_OCTET_STRING *keyid; +GENERAL_NAMES *issuer; +ASN1_INTEGER *serial; +}; + +/* Strong extranet structures */ + +typedef struct SXNET_ID_st { + ASN1_INTEGER *zone; + ASN1_OCTET_STRING *user; +} SXNETID; + +DECLARE_STACK_OF(SXNETID) +DECLARE_ASN1_SET_OF(SXNETID) + +typedef struct SXNET_st { + ASN1_INTEGER *version; + STACK_OF(SXNETID) *ids; +} SXNET; + +typedef struct NOTICEREF_st { + ASN1_STRING *organization; + STACK_OF(ASN1_INTEGER) *noticenos; +} NOTICEREF; + +typedef struct USERNOTICE_st { + NOTICEREF *noticeref; + ASN1_STRING *exptext; +} USERNOTICE; + +typedef struct POLICYQUALINFO_st { + ASN1_OBJECT *pqualid; + union { + ASN1_IA5STRING *cpsuri; + USERNOTICE *usernotice; + ASN1_TYPE *other; + } d; +} POLICYQUALINFO; + +DECLARE_STACK_OF(POLICYQUALINFO) +DECLARE_ASN1_SET_OF(POLICYQUALINFO) + +typedef struct POLICYINFO_st { + ASN1_OBJECT *policyid; + STACK_OF(POLICYQUALINFO) *qualifiers; +} POLICYINFO; + +typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; + +DECLARE_STACK_OF(POLICYINFO) +DECLARE_ASN1_SET_OF(POLICYINFO) + +typedef struct POLICY_MAPPING_st { + ASN1_OBJECT *issuerDomainPolicy; + ASN1_OBJECT *subjectDomainPolicy; +} POLICY_MAPPING; + +DECLARE_STACK_OF(POLICY_MAPPING) + +typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; + +typedef struct GENERAL_SUBTREE_st { + GENERAL_NAME *base; + ASN1_INTEGER *minimum; + ASN1_INTEGER *maximum; +} GENERAL_SUBTREE; + +DECLARE_STACK_OF(GENERAL_SUBTREE) + +struct NAME_CONSTRAINTS_st { + STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; + STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; +}; + +typedef struct POLICY_CONSTRAINTS_st { + ASN1_INTEGER *requireExplicitPolicy; + ASN1_INTEGER *inhibitPolicyMapping; +} POLICY_CONSTRAINTS; + +/* Proxy certificate structures, see RFC 3820 */ +typedef struct PROXY_POLICY_st + { + ASN1_OBJECT *policyLanguage; + ASN1_OCTET_STRING *policy; + } PROXY_POLICY; + +typedef struct PROXY_CERT_INFO_EXTENSION_st + { + ASN1_INTEGER *pcPathLengthConstraint; + PROXY_POLICY *proxyPolicy; + } PROXY_CERT_INFO_EXTENSION; + +DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) +DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) + +struct ISSUING_DIST_POINT_st + { + DIST_POINT_NAME *distpoint; + int onlyuser; + int onlyCA; + ASN1_BIT_STRING *onlysomereasons; + int indirectCRL; + int onlyattr; + }; + +/* Values in idp_flags field */ +/* IDP present */ +#define IDP_PRESENT 0x1 +/* IDP values inconsistent */ +#define IDP_INVALID 0x2 +/* onlyuser true */ +#define IDP_ONLYUSER 0x4 +/* onlyCA true */ +#define IDP_ONLYCA 0x8 +/* onlyattr true */ +#define IDP_ONLYATTR 0x10 +/* indirectCRL true */ +#define IDP_INDIRECT 0x20 +/* onlysomereasons present */ +#define IDP_REASONS 0x40 + +#define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ +",name:", val->name, ",value:", val->value); + +#define X509V3_set_ctx_test(ctx) \ + X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) +#define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; + +#define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ + 0,0,0,0, \ + 0,0, \ + (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ + (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ + NULL, NULL, \ + (void *)table} + +#define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ + 0,0,0,0, \ + (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ + (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ + 0,0,0,0, \ + NULL} + +#define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + + +/* X509_PURPOSE stuff */ + +#define EXFLAG_BCONS 0x1 +#define EXFLAG_KUSAGE 0x2 +#define EXFLAG_XKUSAGE 0x4 +#define EXFLAG_NSCERT 0x8 + +#define EXFLAG_CA 0x10 +/* Really self issued not necessarily self signed */ +#define EXFLAG_SI 0x20 +#define EXFLAG_V1 0x40 +#define EXFLAG_INVALID 0x80 +#define EXFLAG_SET 0x100 +#define EXFLAG_CRITICAL 0x200 +#define EXFLAG_PROXY 0x400 + +#define EXFLAG_INVALID_POLICY 0x800 +#define EXFLAG_FRESHEST 0x1000 +/* Self signed */ +#define EXFLAG_SS 0x2000 + +#define KU_DIGITAL_SIGNATURE 0x0080 +#define KU_NON_REPUDIATION 0x0040 +#define KU_KEY_ENCIPHERMENT 0x0020 +#define KU_DATA_ENCIPHERMENT 0x0010 +#define KU_KEY_AGREEMENT 0x0008 +#define KU_KEY_CERT_SIGN 0x0004 +#define KU_CRL_SIGN 0x0002 +#define KU_ENCIPHER_ONLY 0x0001 +#define KU_DECIPHER_ONLY 0x8000 + +#define NS_SSL_CLIENT 0x80 +#define NS_SSL_SERVER 0x40 +#define NS_SMIME 0x20 +#define NS_OBJSIGN 0x10 +#define NS_SSL_CA 0x04 +#define NS_SMIME_CA 0x02 +#define NS_OBJSIGN_CA 0x01 +#define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) + +#define XKU_SSL_SERVER 0x1 +#define XKU_SSL_CLIENT 0x2 +#define XKU_SMIME 0x4 +#define XKU_CODE_SIGN 0x8 +#define XKU_SGC 0x10 +#define XKU_OCSP_SIGN 0x20 +#define XKU_TIMESTAMP 0x40 +#define XKU_DVCS 0x80 +#define XKU_ANYEKU 0x100 + +#define X509_PURPOSE_DYNAMIC 0x1 +#define X509_PURPOSE_DYNAMIC_NAME 0x2 + +typedef struct x509_purpose_st { + int purpose; + int trust; /* Default trust ID */ + int flags; + int (*check_purpose)(const struct x509_purpose_st *, + const X509 *, int); + char *name; + char *sname; + void *usr_data; +} X509_PURPOSE; + +#define X509_PURPOSE_SSL_CLIENT 1 +#define X509_PURPOSE_SSL_SERVER 2 +#define X509_PURPOSE_NS_SSL_SERVER 3 +#define X509_PURPOSE_SMIME_SIGN 4 +#define X509_PURPOSE_SMIME_ENCRYPT 5 +#define X509_PURPOSE_CRL_SIGN 6 +#define X509_PURPOSE_ANY 7 +#define X509_PURPOSE_OCSP_HELPER 8 +#define X509_PURPOSE_TIMESTAMP_SIGN 9 + +#define X509_PURPOSE_MIN 1 +#define X509_PURPOSE_MAX 9 + +/* Flags for X509V3_EXT_print() */ + +#define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) +/* Return error for unknown extensions */ +#define X509V3_EXT_DEFAULT 0 +/* Print error for unknown extensions */ +#define X509V3_EXT_ERROR_UNKNOWN (1L << 16) +/* ASN1 parse unknown extensions */ +#define X509V3_EXT_PARSE_UNKNOWN (2L << 16) +/* BIO_dump unknown extensions */ +#define X509V3_EXT_DUMP_UNKNOWN (3L << 16) + +/* Flags for X509V3_add1_i2d */ + +#define X509V3_ADD_OP_MASK 0xfL +#define X509V3_ADD_DEFAULT 0L +#define X509V3_ADD_APPEND 1L +#define X509V3_ADD_REPLACE 2L +#define X509V3_ADD_REPLACE_EXISTING 3L +#define X509V3_ADD_KEEP_EXISTING 4L +#define X509V3_ADD_DELETE 5L +#define X509V3_ADD_SILENT 0x10 + +DECLARE_STACK_OF(X509_PURPOSE) + +DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) + +DECLARE_ASN1_FUNCTIONS(SXNET) +DECLARE_ASN1_FUNCTIONS(SXNETID) + +int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen); +int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen); +int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen); + +ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone); +ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); +ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); + +DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) + +DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) +OPENSSL_EXPORT GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); +OPENSSL_EXPORT int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); + + + +OPENSSL_EXPORT ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); +OPENSSL_EXPORT STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + ASN1_BIT_STRING *bits, + STACK_OF(CONF_VALUE) *extlist); + +OPENSSL_EXPORT STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret); +OPENSSL_EXPORT int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) + +OPENSSL_EXPORT STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, + GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist); +OPENSSL_EXPORT GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); + +DECLARE_ASN1_FUNCTIONS(OTHERNAME) +DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) +OPENSSL_EXPORT int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); +OPENSSL_EXPORT void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); +OPENSSL_EXPORT void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype); +OPENSSL_EXPORT int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, + ASN1_OBJECT *oid, ASN1_TYPE *value); +OPENSSL_EXPORT int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen, + ASN1_OBJECT **poid, ASN1_TYPE **pvalue); + +OPENSSL_EXPORT char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5); +OPENSSL_EXPORT ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str); + +DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) +OPENSSL_EXPORT int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION* a); + +DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) +DECLARE_ASN1_FUNCTIONS(POLICYINFO) +DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) +DECLARE_ASN1_FUNCTIONS(USERNOTICE) +DECLARE_ASN1_FUNCTIONS(NOTICEREF) + +DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) +DECLARE_ASN1_FUNCTIONS(DIST_POINT) +DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) +DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) + +OPENSSL_EXPORT int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); + +OPENSSL_EXPORT int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); + +DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) +DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) + +DECLARE_ASN1_ITEM(POLICY_MAPPING) +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) +DECLARE_ASN1_ITEM(POLICY_MAPPINGS) + +DECLARE_ASN1_ITEM(GENERAL_SUBTREE) +DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) + +DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) +DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) + +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) +DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) + +OPENSSL_EXPORT GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, + int gen_type, char *value, int is_nc); + +OPENSSL_EXPORT GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, + CONF_VALUE *cnf); +OPENSSL_EXPORT GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc); +OPENSSL_EXPORT void X509V3_conf_free(CONF_VALUE *val); + +OPENSSL_EXPORT X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value); +OPENSSL_EXPORT X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, char *value); +OPENSSL_EXPORT int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, STACK_OF(X509_EXTENSION) **sk); +OPENSSL_EXPORT int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert); +OPENSSL_EXPORT int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); +OPENSSL_EXPORT int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); + +OPENSSL_EXPORT int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + char *section, X509_CRL *crl); + +OPENSSL_EXPORT int X509V3_add_value_bool_nf(char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +OPENSSL_EXPORT int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool); +OPENSSL_EXPORT int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint); +OPENSSL_EXPORT void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); + +OPENSSL_EXPORT char * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section); +OPENSSL_EXPORT STACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX *ctx, char *section); +OPENSSL_EXPORT void X509V3_string_free(X509V3_CTX *ctx, char *str); +OPENSSL_EXPORT void X509V3_section_free( X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); +OPENSSL_EXPORT void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, + X509_REQ *req, X509_CRL *crl, int flags); + +OPENSSL_EXPORT int X509V3_add_value(const char *name, const char *value, + STACK_OF(CONF_VALUE) **extlist); +OPENSSL_EXPORT int X509V3_add_value_uchar(const char *name, const unsigned char *value, + STACK_OF(CONF_VALUE) **extlist); +OPENSSL_EXPORT int X509V3_add_value_bool(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +OPENSSL_EXPORT int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint, + STACK_OF(CONF_VALUE) **extlist); +OPENSSL_EXPORT char * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint); +OPENSSL_EXPORT ASN1_INTEGER * s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value); +OPENSSL_EXPORT char * i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint); +OPENSSL_EXPORT char * i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint); +OPENSSL_EXPORT int X509V3_EXT_add(X509V3_EXT_METHOD *ext); +OPENSSL_EXPORT int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); +OPENSSL_EXPORT int X509V3_EXT_add_alias(int nid_to, int nid_from); +OPENSSL_EXPORT void X509V3_EXT_cleanup(void); + +OPENSSL_EXPORT const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); +OPENSSL_EXPORT const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); +OPENSSL_EXPORT int X509V3_add_standard_extensions(void); +OPENSSL_EXPORT STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); +OPENSSL_EXPORT void *X509V3_EXT_d2i(X509_EXTENSION *ext); +OPENSSL_EXPORT void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx); + + +OPENSSL_EXPORT X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); +OPENSSL_EXPORT int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags); + +char *hex_to_string(const unsigned char *buffer, long len); +unsigned char *string_to_hex(const char *str, long *len); +int name_cmp(const char *name, const char *cmp); + +OPENSSL_EXPORT void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, + int ml); +OPENSSL_EXPORT int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent); +OPENSSL_EXPORT int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); + +OPENSSL_EXPORT int X509V3_extensions_print(BIO *out, const char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent); + +OPENSSL_EXPORT int X509_check_ca(X509 *x); +OPENSSL_EXPORT int X509_check_purpose(X509 *x, int id, int ca); +OPENSSL_EXPORT int X509_supported_extension(X509_EXTENSION *ex); +OPENSSL_EXPORT int X509_PURPOSE_set(int *p, int purpose); +OPENSSL_EXPORT int X509_check_issued(X509 *issuer, X509 *subject); +OPENSSL_EXPORT int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); +OPENSSL_EXPORT int X509_PURPOSE_get_count(void); +OPENSSL_EXPORT X509_PURPOSE * X509_PURPOSE_get0(int idx); +OPENSSL_EXPORT int X509_PURPOSE_get_by_sname(char *sname); +OPENSSL_EXPORT int X509_PURPOSE_get_by_id(int id); +OPENSSL_EXPORT int X509_PURPOSE_add(int id, int trust, int flags, + int (*ck)(const X509_PURPOSE *, const X509 *, int), + char *name, char *sname, void *arg); +OPENSSL_EXPORT char *X509_PURPOSE_get0_name(X509_PURPOSE *xp); +OPENSSL_EXPORT char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp); +OPENSSL_EXPORT int X509_PURPOSE_get_trust(X509_PURPOSE *xp); +OPENSSL_EXPORT void X509_PURPOSE_cleanup(void); +OPENSSL_EXPORT int X509_PURPOSE_get_id(X509_PURPOSE *); + +OPENSSL_EXPORT STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); +OPENSSL_EXPORT STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); +OPENSSL_EXPORT void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); +OPENSSL_EXPORT STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); +/* Flags for X509_check_* functions */ + +/* Always check subject name for host match even if subject alt names present */ +#define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 +/* Disable wildcard matching for dnsName fields and common name. */ +#define X509_CHECK_FLAG_NO_WILDCARDS 0x2 +/* Wildcards must not match a partial label. */ +#define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 +/* Allow (non-partial) wildcards to match multiple labels. */ +#define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 +/* Constraint verifier subdomain patterns to match a single labels. */ +#define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 +/* + * Match reference identifiers starting with "." to any sub-domain. + * This is a non-public flag, turned on implicitly when the subject + * reference identity is a DNS name. + */ +#define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 + +OPENSSL_EXPORT int X509_check_host(X509 *x, const char *chk, size_t chklen, + unsigned int flags, char **peername); +OPENSSL_EXPORT int X509_check_email(X509 *x, const char *chk, size_t chklen, + unsigned int flags); +OPENSSL_EXPORT int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, + unsigned int flags); +OPENSSL_EXPORT int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); + +OPENSSL_EXPORT ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); +OPENSSL_EXPORT ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); +OPENSSL_EXPORT int a2i_ipadd(unsigned char *ipout, const char *ipasc); +OPENSSL_EXPORT int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk, + unsigned long chtype); + +OPENSSL_EXPORT void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); +DECLARE_STACK_OF(X509_POLICY_NODE) + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_X509V3_strings(void); + + +#ifdef __cplusplus +} +#endif +#define X509V3_F_SXNET_add_id_INTEGER 100 +#define X509V3_F_SXNET_add_id_asc 101 +#define X509V3_F_SXNET_add_id_ulong 102 +#define X509V3_F_SXNET_get_id_asc 103 +#define X509V3_F_SXNET_get_id_ulong 104 +#define X509V3_F_X509V3_EXT_add 105 +#define X509V3_F_X509V3_EXT_add_alias 106 +#define X509V3_F_X509V3_EXT_free 107 +#define X509V3_F_X509V3_EXT_i2d 108 +#define X509V3_F_X509V3_EXT_nconf 109 +#define X509V3_F_X509V3_add1_i2d 110 +#define X509V3_F_X509V3_add_value 111 +#define X509V3_F_X509V3_get_section 112 +#define X509V3_F_X509V3_get_string 113 +#define X509V3_F_X509V3_get_value_bool 114 +#define X509V3_F_X509V3_parse_list 115 +#define X509V3_F_X509_PURPOSE_add 116 +#define X509V3_F_X509_PURPOSE_set 117 +#define X509V3_F_a2i_GENERAL_NAME 118 +#define X509V3_F_copy_email 119 +#define X509V3_F_copy_issuer 120 +#define X509V3_F_do_dirname 121 +#define X509V3_F_do_ext_i2d 122 +#define X509V3_F_do_ext_nconf 123 +#define X509V3_F_gnames_from_sectname 124 +#define X509V3_F_hex_to_string 125 +#define X509V3_F_i2s_ASN1_ENUMERATED 126 +#define X509V3_F_i2s_ASN1_IA5STRING 127 +#define X509V3_F_i2s_ASN1_INTEGER 128 +#define X509V3_F_i2v_AUTHORITY_INFO_ACCESS 129 +#define X509V3_F_notice_section 130 +#define X509V3_F_nref_nos 131 +#define X509V3_F_policy_section 132 +#define X509V3_F_process_pci_value 133 +#define X509V3_F_r2i_certpol 134 +#define X509V3_F_r2i_pci 135 +#define X509V3_F_s2i_ASN1_IA5STRING 136 +#define X509V3_F_s2i_ASN1_INTEGER 137 +#define X509V3_F_s2i_ASN1_OCTET_STRING 138 +#define X509V3_F_s2i_skey_id 139 +#define X509V3_F_set_dist_point_name 140 +#define X509V3_F_string_to_hex 141 +#define X509V3_F_v2i_ASN1_BIT_STRING 142 +#define X509V3_F_v2i_AUTHORITY_INFO_ACCESS 143 +#define X509V3_F_v2i_AUTHORITY_KEYID 144 +#define X509V3_F_v2i_BASIC_CONSTRAINTS 145 +#define X509V3_F_v2i_EXTENDED_KEY_USAGE 146 +#define X509V3_F_v2i_GENERAL_NAMES 147 +#define X509V3_F_v2i_GENERAL_NAME_ex 148 +#define X509V3_F_v2i_NAME_CONSTRAINTS 149 +#define X509V3_F_v2i_POLICY_CONSTRAINTS 150 +#define X509V3_F_v2i_POLICY_MAPPINGS 151 +#define X509V3_F_v2i_crld 152 +#define X509V3_F_v2i_idp 153 +#define X509V3_F_v2i_issuer_alt 154 +#define X509V3_F_v2i_subject_alt 155 +#define X509V3_F_v3_generic_extension 156 +#define X509V3_R_BAD_IP_ADDRESS 100 +#define X509V3_R_BAD_OBJECT 101 +#define X509V3_R_BN_DEC2BN_ERROR 102 +#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 103 +#define X509V3_R_CANNOT_FIND_FREE_FUNCTION 104 +#define X509V3_R_DIRNAME_ERROR 105 +#define X509V3_R_DISTPOINT_ALREADY_SET 106 +#define X509V3_R_DUPLICATE_ZONE_ID 107 +#define X509V3_R_ERROR_CONVERTING_ZONE 108 +#define X509V3_R_ERROR_CREATING_EXTENSION 109 +#define X509V3_R_ERROR_IN_EXTENSION 110 +#define X509V3_R_EXPECTED_A_SECTION_NAME 111 +#define X509V3_R_EXTENSION_EXISTS 112 +#define X509V3_R_EXTENSION_NAME_ERROR 113 +#define X509V3_R_EXTENSION_NOT_FOUND 114 +#define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 115 +#define X509V3_R_EXTENSION_VALUE_ERROR 116 +#define X509V3_R_ILLEGAL_EMPTY_EXTENSION 117 +#define X509V3_R_ILLEGAL_HEX_DIGIT 118 +#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 119 +#define X509V3_R_INVALID_BOOLEAN_STRING 120 +#define X509V3_R_INVALID_EXTENSION_STRING 121 +#define X509V3_R_INVALID_MULTIPLE_RDNS 122 +#define X509V3_R_INVALID_NAME 123 +#define X509V3_R_INVALID_NULL_ARGUMENT 124 +#define X509V3_R_INVALID_NULL_NAME 125 +#define X509V3_R_INVALID_NULL_VALUE 126 +#define X509V3_R_INVALID_NUMBER 127 +#define X509V3_R_INVALID_NUMBERS 128 +#define X509V3_R_INVALID_OBJECT_IDENTIFIER 129 +#define X509V3_R_INVALID_OPTION 130 +#define X509V3_R_INVALID_POLICY_IDENTIFIER 131 +#define X509V3_R_INVALID_PROXY_POLICY_SETTING 132 +#define X509V3_R_INVALID_PURPOSE 133 +#define X509V3_R_INVALID_SECTION 134 +#define X509V3_R_INVALID_SYNTAX 135 +#define X509V3_R_ISSUER_DECODE_ERROR 136 +#define X509V3_R_MISSING_VALUE 137 +#define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 138 +#define X509V3_R_NO_CONFIG_DATABASE 139 +#define X509V3_R_NO_ISSUER_CERTIFICATE 140 +#define X509V3_R_NO_ISSUER_DETAILS 141 +#define X509V3_R_NO_POLICY_IDENTIFIER 142 +#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 143 +#define X509V3_R_NO_PUBLIC_KEY 144 +#define X509V3_R_NO_SUBJECT_DETAILS 145 +#define X509V3_R_ODD_NUMBER_OF_DIGITS 146 +#define X509V3_R_OPERATION_NOT_DEFINED 147 +#define X509V3_R_OTHERNAME_ERROR 148 +#define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 149 +#define X509V3_R_POLICY_PATH_LENGTH 150 +#define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 151 +#define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 152 +#define X509V3_R_SECTION_NOT_FOUND 153 +#define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 154 +#define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 155 +#define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 156 +#define X509V3_R_UNKNOWN_EXTENSION 157 +#define X509V3_R_UNKNOWN_EXTENSION_NAME 158 +#define X509V3_R_UNKNOWN_OPTION 159 +#define X509V3_R_UNSUPPORTED_OPTION 160 +#define X509V3_R_UNSUPPORTED_TYPE 161 +#define X509V3_R_USER_TOO_LONG 162 + +#endif diff --git a/selfdrive/visiond/visiond b/phonelibs/boringssl/lib/libcrypto_static.a old mode 100755 new mode 100644 similarity index 56% rename from selfdrive/visiond/visiond rename to phonelibs/boringssl/lib/libcrypto_static.a index 1a4867061edaad..f683cb11d42ead Binary files a/selfdrive/visiond/visiond and b/phonelibs/boringssl/lib/libcrypto_static.a differ diff --git a/phonelibs/boringssl/lib/libssl_static.a b/phonelibs/boringssl/lib/libssl_static.a new file mode 100644 index 00000000000000..b6c52d03a04e8c Binary files /dev/null and b/phonelibs/boringssl/lib/libssl_static.a differ diff --git a/phonelibs/curl/build.txt b/phonelibs/curl/build.txt new file mode 100644 index 00000000000000..def0763b46f828 --- /dev/null +++ b/phonelibs/curl/build.txt @@ -0,0 +1,5 @@ +# with neos tree +cd ~/android/system +mka libcurl + +cp ~/android/system/out/target/product/oneplus3/obj/STATIC_LIBRARIES/libcurl_intermediates/libcurl.a lib/ diff --git a/phonelibs/curl/include/Makefile.am b/phonelibs/curl/include/Makefile.am new file mode 100644 index 00000000000000..3b24860299525e --- /dev/null +++ b/phonelibs/curl/include/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = curl + +EXTRA_DIST = README + +AUTOMAKE_OPTIONS = foreign no-dependencies diff --git a/phonelibs/curl/include/README b/phonelibs/curl/include/README new file mode 100644 index 00000000000000..3e52a1d0a6cb13 --- /dev/null +++ b/phonelibs/curl/include/README @@ -0,0 +1,55 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + +Include files for libcurl, external users. + +They're all placed in the curl subdirectory here for better fit in any kind +of environment. You must include files from here using... + + #include + +... style and point the compiler's include path to the directory holding the +curl subdirectory. It makes it more likely to survive future modifications. + +NOTE FOR LIBCURL HACKERS + +The following notes apply to libcurl version 7.19.0 and later. + +* The distributed curl/curlbuild.h file is only intended to be used on systems + which can not run the also distributed configure script. + +* The distributed curlbuild.h file is generated as a copy of curlbuild.h.dist + when the libcurl source code distribution archive file is originally created. + +* If you check out from git on a non-configure platform, you must run the + appropriate buildconf* script to set up curlbuild.h and other local files + before being able of compiling the library. + +* On systems capable of running the configure script, the configure process + will overwrite the distributed include/curl/curlbuild.h file with one that + is suitable and specific to the library being configured and built, which + is generated from the include/curl/curlbuild.h.in template file. + +* If you intend to distribute an already compiled libcurl library you _MUST_ + also distribute along with it the generated curl/curlbuild.h which has been + used to compile it. Otherwise the library will be of no use for the users of + the library that you have built. It is _your_ responsibility to provide this + file. No one at the cURL project can know how you have built the library. + +* File curl/curlbuild.h includes platform and configuration dependent info, + and must not be modified by anyone. Configure script generates it for you. + +* We cannot assume anything else but very basic compiler features being + present. While libcurl requires an ANSI C compiler to build, some of the + earlier ANSI compilers clearly can't deal with some preprocessor operators. + +* Newlines must remain unix-style for older compilers' sake. + +* Comments must be written in the old-style /* unnested C-fashion */ + +To figure out how to do good and portable checks for features, operating +systems or specific hardwarare, a very good resource is Bjorn Reese's +collection at http://predef.sf.net/ diff --git a/phonelibs/curl/include/curl/.gitignore b/phonelibs/curl/include/curl/.gitignore new file mode 100644 index 00000000000000..5f3bc3ce01b9a6 --- /dev/null +++ b/phonelibs/curl/include/curl/.gitignore @@ -0,0 +1,3 @@ +stamp-h2 +stamp-h3 +curlver.h.dist diff --git a/phonelibs/curl/include/curl/Makefile.am b/phonelibs/curl/include/curl/Makefile.am new file mode 100644 index 00000000000000..86e8b78344de31 --- /dev/null +++ b/phonelibs/curl/include/curl/Makefile.am @@ -0,0 +1,53 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +pkginclude_HEADERS = \ + curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \ + typecheck-gcc.h curlbuild.h curlrules.h + +pkgincludedir= $(includedir)/curl + +# curlbuild.h does not exist in the git tree. When the original libcurl +# source code distribution archive file is created, curlbuild.h.dist is +# renamed to curlbuild.h and included in the tarball so that it can be +# used directly on non-configure systems. +# +# The distributed curlbuild.h will be overwritten on configure systems +# when the configure script runs, with one that is suitable and specific +# to the library being configured and built. +# +# curlbuild.h.in is the distributed template file from which the configure +# script creates curlbuild.h at library configuration time, overwiting the +# one included in the distribution archive. +# +# curlbuild.h.dist is not included in the source code distribution archive. + +EXTRA_DIST = curlbuild.h.in + +DISTCLEANFILES = curlbuild.h + +checksrc: + @@PERL@ $(top_srcdir)/lib/checksrc.pl -Wcurlbuild.h -D$(top_srcdir)/include/curl $(pkginclude_HEADERS) $(EXTRA_DIST) + +if CURLDEBUG +# for debug builds, we scan the sources on all regular make invokes +all-local: checksrc +endif diff --git a/phonelibs/curl/include/curl/curl.h b/phonelibs/curl/include/curl/curl.h new file mode 100644 index 00000000000000..eab2f6e99a541c --- /dev/null +++ b/phonelibs/curl/include/curl/curl.h @@ -0,0 +1,2376 @@ +#ifndef __CURL_CURL_H +#define __CURL_CURL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * If you have libcurl problems, all docs and details are found here: + * http://curl.haxx.se/libcurl/ + * + * curl-library mailing list subscription and unsubscription web interface: + * http://cool.haxx.se/mailman/listinfo/curl-library/ + */ + +#include "curlver.h" /* libcurl version defines */ +#include "curlbuild.h" /* libcurl build definitions */ +#include "curlrules.h" /* libcurl rules enforcement */ + +/* + * Define WIN32 when build target is Win32 API + */ + +#if (defined(_WIN32) || defined(__WIN32__)) && \ + !defined(WIN32) && !defined(__SYMBIAN32__) +#define WIN32 +#endif + +#include +#include + +#if defined(__FreeBSD__) && (__FreeBSD__ >= 2) +/* Needed for __FreeBSD_version symbol definition */ +#include +#endif + +/* The include stuff here below is mainly for time_t! */ +#include +#include + +#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) +#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__)) +/* The check above prevents the winsock2 inclusion if winsock.h already was + included, since they can't co-exist without problems */ +#include +#include +#endif +#endif + +/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish + libc5-based Linux systems. Only include it on systems that are known to + require it! */ +#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ + defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ + defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ + (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) +#include +#endif + +#if !defined(WIN32) && !defined(_WIN32_WCE) +#include +#endif + +#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) +#include +#endif + +#ifdef __BEOS__ +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void CURL; + +/* + * libcurl external API function linkage decorations. + */ + +#ifdef CURL_STATICLIB +# define CURL_EXTERN +#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) +# if defined(BUILDING_LIBCURL) +# define CURL_EXTERN __declspec(dllexport) +# else +# define CURL_EXTERN __declspec(dllimport) +# endif +#elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS) +# define CURL_EXTERN CURL_EXTERN_SYMBOL +#else +# define CURL_EXTERN +#endif + +#ifndef curl_socket_typedef +/* socket typedef */ +#if defined(WIN32) && !defined(__LWIP_OPT_H__) +typedef SOCKET curl_socket_t; +#define CURL_SOCKET_BAD INVALID_SOCKET +#else +typedef int curl_socket_t; +#define CURL_SOCKET_BAD -1 +#endif +#define curl_socket_typedef +#endif /* curl_socket_typedef */ + +struct curl_httppost { + struct curl_httppost *next; /* next entry in the list */ + char *name; /* pointer to allocated name */ + long namelength; /* length of name length */ + char *contents; /* pointer to allocated data contents */ + long contentslength; /* length of contents field */ + char *buffer; /* pointer to allocated buffer contents */ + long bufferlength; /* length of buffer field */ + char *contenttype; /* Content-Type */ + struct curl_slist* contentheader; /* list of extra headers for this form */ + struct curl_httppost *more; /* if one field name has more than one + file, this link should link to following + files */ + long flags; /* as defined below */ +#define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */ +#define HTTPPOST_READFILE (1<<1) /* specified content is a file name */ +#define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer + do not free in formfree */ +#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer + do not free in formfree */ +#define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */ +#define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */ +#define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the + regular read callback to get the data + and pass the given pointer as custom + pointer */ + + char *showfilename; /* The file name to show. If not set, the + actual file name will be used (if this + is a file part) */ + void *userp; /* custom pointer used for + HTTPPOST_CALLBACK posts */ +}; + +/* This is the CURLOPT_PROGRESSFUNCTION callback proto. It is now considered + deprecated but was the only choice up until 7.31.0 */ +typedef int (*curl_progress_callback)(void *clientp, + double dltotal, + double dlnow, + double ultotal, + double ulnow); + +/* This is the CURLOPT_XFERINFOFUNCTION callback proto. It was introduced in + 7.32.0, it avoids floating point and provides more detailed information. */ +typedef int (*curl_xferinfo_callback)(void *clientp, + curl_off_t dltotal, + curl_off_t dlnow, + curl_off_t ultotal, + curl_off_t ulnow); + +#ifndef CURL_MAX_WRITE_SIZE + /* Tests have proven that 20K is a very bad buffer size for uploads on + Windows, while 16K for some odd reason performed a lot better. + We do the ifndef check to allow this value to easier be changed at build + time for those who feel adventurous. The practical minimum is about + 400 bytes since libcurl uses a buffer of this size as a scratch area + (unrelated to network send operations). */ +#define CURL_MAX_WRITE_SIZE 16384 +#endif + +#ifndef CURL_MAX_HTTP_HEADER +/* The only reason to have a max limit for this is to avoid the risk of a bad + server feeding libcurl with a never-ending header that will cause reallocs + infinitely */ +#define CURL_MAX_HTTP_HEADER (100*1024) +#endif + +/* This is a magic return code for the write callback that, when returned, + will signal libcurl to pause receiving on the current transfer. */ +#define CURL_WRITEFUNC_PAUSE 0x10000001 + +typedef size_t (*curl_write_callback)(char *buffer, + size_t size, + size_t nitems, + void *outstream); + + + +/* enumeration of file types */ +typedef enum { + CURLFILETYPE_FILE = 0, + CURLFILETYPE_DIRECTORY, + CURLFILETYPE_SYMLINK, + CURLFILETYPE_DEVICE_BLOCK, + CURLFILETYPE_DEVICE_CHAR, + CURLFILETYPE_NAMEDPIPE, + CURLFILETYPE_SOCKET, + CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */ + + CURLFILETYPE_UNKNOWN /* should never occur */ +} curlfiletype; + +#define CURLFINFOFLAG_KNOWN_FILENAME (1<<0) +#define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1) +#define CURLFINFOFLAG_KNOWN_TIME (1<<2) +#define CURLFINFOFLAG_KNOWN_PERM (1<<3) +#define CURLFINFOFLAG_KNOWN_UID (1<<4) +#define CURLFINFOFLAG_KNOWN_GID (1<<5) +#define CURLFINFOFLAG_KNOWN_SIZE (1<<6) +#define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7) + +/* Content of this structure depends on information which is known and is + achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man + page for callbacks returning this structure -- some fields are mandatory, + some others are optional. The FLAG field has special meaning. */ +struct curl_fileinfo { + char *filename; + curlfiletype filetype; + time_t time; + unsigned int perm; + int uid; + int gid; + curl_off_t size; + long int hardlinks; + + struct { + /* If some of these fields is not NULL, it is a pointer to b_data. */ + char *time; + char *perm; + char *user; + char *group; + char *target; /* pointer to the target filename of a symlink */ + } strings; + + unsigned int flags; + + /* used internally */ + char * b_data; + size_t b_size; + size_t b_used; +}; + +/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */ +#define CURL_CHUNK_BGN_FUNC_OK 0 +#define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */ +#define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */ + +/* if splitting of data transfer is enabled, this callback is called before + download of an individual chunk started. Note that parameter "remains" works + only for FTP wildcard downloading (for now), otherwise is not used */ +typedef long (*curl_chunk_bgn_callback)(const void *transfer_info, + void *ptr, + int remains); + +/* return codes for CURLOPT_CHUNK_END_FUNCTION */ +#define CURL_CHUNK_END_FUNC_OK 0 +#define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */ + +/* If splitting of data transfer is enabled this callback is called after + download of an individual chunk finished. + Note! After this callback was set then it have to be called FOR ALL chunks. + Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. + This is the reason why we don't need "transfer_info" parameter in this + callback and we are not interested in "remains" parameter too. */ +typedef long (*curl_chunk_end_callback)(void *ptr); + +/* return codes for FNMATCHFUNCTION */ +#define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */ +#define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */ +#define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */ + +/* callback type for wildcard downloading pattern matching. If the + string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */ +typedef int (*curl_fnmatch_callback)(void *ptr, + const char *pattern, + const char *string); + +/* These are the return codes for the seek callbacks */ +#define CURL_SEEKFUNC_OK 0 +#define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */ +#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so + libcurl might try other means instead */ +typedef int (*curl_seek_callback)(void *instream, + curl_off_t offset, + int origin); /* 'whence' */ + +/* This is a return code for the read callback that, when returned, will + signal libcurl to immediately abort the current transfer. */ +#define CURL_READFUNC_ABORT 0x10000000 +/* This is a return code for the read callback that, when returned, will + signal libcurl to pause sending data on the current transfer. */ +#define CURL_READFUNC_PAUSE 0x10000001 + +typedef size_t (*curl_read_callback)(char *buffer, + size_t size, + size_t nitems, + void *instream); + +typedef enum { + CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */ + CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */ + CURLSOCKTYPE_LAST /* never use */ +} curlsocktype; + +/* The return code from the sockopt_callback can signal information back + to libcurl: */ +#define CURL_SOCKOPT_OK 0 +#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return + CURLE_ABORTED_BY_CALLBACK */ +#define CURL_SOCKOPT_ALREADY_CONNECTED 2 + +typedef int (*curl_sockopt_callback)(void *clientp, + curl_socket_t curlfd, + curlsocktype purpose); + +struct curl_sockaddr { + int family; + int socktype; + int protocol; + unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it + turned really ugly and painful on the systems that + lack this type */ + struct sockaddr addr; +}; + +typedef curl_socket_t +(*curl_opensocket_callback)(void *clientp, + curlsocktype purpose, + struct curl_sockaddr *address); + +typedef int +(*curl_closesocket_callback)(void *clientp, curl_socket_t item); + +typedef enum { + CURLIOE_OK, /* I/O operation successful */ + CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ + CURLIOE_FAILRESTART, /* failed to restart the read */ + CURLIOE_LAST /* never use */ +} curlioerr; + +typedef enum { + CURLIOCMD_NOP, /* no operation */ + CURLIOCMD_RESTARTREAD, /* restart the read stream from start */ + CURLIOCMD_LAST /* never use */ +} curliocmd; + +typedef curlioerr (*curl_ioctl_callback)(CURL *handle, + int cmd, + void *clientp); + +/* + * The following typedef's are signatures of malloc, free, realloc, strdup and + * calloc respectively. Function pointers of these types can be passed to the + * curl_global_init_mem() function to set user defined memory management + * callback routines. + */ +typedef void *(*curl_malloc_callback)(size_t size); +typedef void (*curl_free_callback)(void *ptr); +typedef void *(*curl_realloc_callback)(void *ptr, size_t size); +typedef char *(*curl_strdup_callback)(const char *str); +typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size); + +/* the kind of data that is passed to information_callback*/ +typedef enum { + CURLINFO_TEXT = 0, + CURLINFO_HEADER_IN, /* 1 */ + CURLINFO_HEADER_OUT, /* 2 */ + CURLINFO_DATA_IN, /* 3 */ + CURLINFO_DATA_OUT, /* 4 */ + CURLINFO_SSL_DATA_IN, /* 5 */ + CURLINFO_SSL_DATA_OUT, /* 6 */ + CURLINFO_END +} curl_infotype; + +typedef int (*curl_debug_callback) + (CURL *handle, /* the handle/transfer this concerns */ + curl_infotype type, /* what kind of data */ + char *data, /* points to the data */ + size_t size, /* size of the data pointed to */ + void *userptr); /* whatever the user please */ + +/* All possible error codes from all sorts of curl functions. Future versions + may return other values, stay prepared. + + Always add new return codes last. Never *EVER* remove any. The return + codes must remain the same! + */ + +typedef enum { + CURLE_OK = 0, + CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ + CURLE_FAILED_INIT, /* 2 */ + CURLE_URL_MALFORMAT, /* 3 */ + CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for + 7.17.0, reused in April 2011 for 7.21.5] */ + CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ + CURLE_COULDNT_RESOLVE_HOST, /* 6 */ + CURLE_COULDNT_CONNECT, /* 7 */ + CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */ + CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server + due to lack of access - when login fails + this is not returned. */ + CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for + 7.15.4, reused in Dec 2011 for 7.24.0]*/ + CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ + CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server + [was obsoleted in August 2007 for 7.17.0, + reused in Dec 2011 for 7.24.0]*/ + CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ + CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ + CURLE_FTP_CANT_GET_HOST, /* 15 */ + CURLE_HTTP2, /* 16 - A problem in the http2 framing layer. + [was obsoleted in August 2007 for 7.17.0, + reused in July 2014 for 7.38.0] */ + CURLE_FTP_COULDNT_SET_TYPE, /* 17 */ + CURLE_PARTIAL_FILE, /* 18 */ + CURLE_FTP_COULDNT_RETR_FILE, /* 19 */ + CURLE_OBSOLETE20, /* 20 - NOT USED */ + CURLE_QUOTE_ERROR, /* 21 - quote command failure */ + CURLE_HTTP_RETURNED_ERROR, /* 22 */ + CURLE_WRITE_ERROR, /* 23 */ + CURLE_OBSOLETE24, /* 24 - NOT USED */ + CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ + CURLE_READ_ERROR, /* 26 - couldn't open/read from file */ + CURLE_OUT_OF_MEMORY, /* 27 */ + /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error + instead of a memory allocation error if CURL_DOES_CONVERSIONS + is defined + */ + CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */ + CURLE_OBSOLETE29, /* 29 - NOT USED */ + CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ + CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */ + CURLE_OBSOLETE32, /* 32 - NOT USED */ + CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ + CURLE_HTTP_POST_ERROR, /* 34 */ + CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ + CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ + CURLE_FILE_COULDNT_READ_FILE, /* 37 */ + CURLE_LDAP_CANNOT_BIND, /* 38 */ + CURLE_LDAP_SEARCH_FAILED, /* 39 */ + CURLE_OBSOLETE40, /* 40 - NOT USED */ + CURLE_FUNCTION_NOT_FOUND, /* 41 */ + CURLE_ABORTED_BY_CALLBACK, /* 42 */ + CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */ + CURLE_OBSOLETE44, /* 44 - NOT USED */ + CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ + CURLE_OBSOLETE46, /* 46 - NOT USED */ + CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ + CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */ + CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ + CURLE_OBSOLETE50, /* 50 - NOT USED */ + CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint + wasn't verified fine */ + CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ + CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ + CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as + default */ + CURLE_SEND_ERROR, /* 55 - failed sending network data */ + CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ + CURLE_OBSOLETE57, /* 57 - NOT IN USE */ + CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ + CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ + CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ + CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */ + CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ + CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ + CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ + CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind + that failed */ + CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ + CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not + accepted and we failed to login */ + CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */ + CURLE_TFTP_PERM, /* 69 - permission problem on server */ + CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */ + CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */ + CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ + CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */ + CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ + CURLE_CONV_FAILED, /* 75 - conversion failed */ + CURLE_CONV_REQD, /* 76 - caller must register conversion + callbacks using curl_easy_setopt options + CURLOPT_CONV_FROM_NETWORK_FUNCTION, + CURLOPT_CONV_TO_NETWORK_FUNCTION, and + CURLOPT_CONV_FROM_UTF8_FUNCTION */ + CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing + or wrong format */ + CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */ + CURLE_SSH, /* 79 - error from the SSH layer, somewhat + generic so the error message will be of + interest when this has happened */ + + CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL + connection */ + CURLE_AGAIN, /* 81 - socket is not ready for send/recv, + wait till it's ready and try again (Added + in 7.18.2) */ + CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or + wrong format (Added in 7.19.0) */ + CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in + 7.19.0) */ + CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */ + CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */ + CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */ + CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ + CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ + CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the + session will be queued */ + CURLE_SSL_PINNEDPUBKEYNOTMATCH, /* 90 - specified pinned public key did not + match */ + CURLE_SSL_INVALIDCERTSTATUS, /* 91 - invalid certificate status */ + CURL_LAST /* never use! */ +} CURLcode; + +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all + the obsolete stuff removed! */ + +/* Previously obsolete error code re-used in 7.38.0 */ +#define CURLE_OBSOLETE16 CURLE_HTTP2 + +/* Previously obsolete error codes re-used in 7.24.0 */ +#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED +#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT + +/* compatibility with older names */ +#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING + +/* The following were added in 7.21.5, April 2011 */ +#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION + +/* The following were added in 7.17.1 */ +/* These are scheduled to disappear by 2009 */ +#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION + +/* The following were added in 7.17.0 */ +/* These are scheduled to disappear by 2009 */ +#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */ +#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 +#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 +#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 +#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16 +#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32 +#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29 +#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12 +#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20 +#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40 +#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24 +#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57 +#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN + +#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED +#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE +#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR +#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL +#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS +#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR +#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED + +/* The following were added earlier */ + +#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT + +#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR +#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED +#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED + +#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE +#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME + +/* This was the error code 50 in 7.7.3 and a few earlier versions, this + is no longer used by libcurl but is instead #defined here only to not + make programs break */ +#define CURLE_ALREADY_COMPLETE 99999 + +/* Provide defines for really old option names */ +#define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */ +#define CURLOPT_INFILE CURLOPT_READDATA /* name changed in 7.9.7 */ +#define CURLOPT_WRITEHEADER CURLOPT_HEADERDATA + +/* Since long deprecated options with no code in the lib that does anything + with them. */ +#define CURLOPT_WRITEINFO CURLOPT_OBSOLETE40 +#define CURLOPT_CLOSEPOLICY CURLOPT_OBSOLETE72 + +#endif /*!CURL_NO_OLDIES*/ + +/* This prototype applies to all conversion callbacks */ +typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length); + +typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */ + void *ssl_ctx, /* actually an + OpenSSL SSL_CTX */ + void *userptr); + +typedef enum { + CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use + CONNECT HTTP/1.1 */ + CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT + HTTP/1.0 */ + CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already + in 7.10 */ + CURLPROXY_SOCKS5 = 5, /* added in 7.10 */ + CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */ + CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the + host name rather than the IP address. added + in 7.18.0 */ +} curl_proxytype; /* this enum was added in 7.10 */ + +/* + * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options: + * + * CURLAUTH_NONE - No HTTP authentication + * CURLAUTH_BASIC - HTTP Basic authentication (default) + * CURLAUTH_DIGEST - HTTP Digest authentication + * CURLAUTH_NEGOTIATE - HTTP Negotiate (SPNEGO) authentication + * CURLAUTH_GSSNEGOTIATE - Alias for CURLAUTH_NEGOTIATE (deprecated) + * CURLAUTH_NTLM - HTTP NTLM authentication + * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour + * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper + * CURLAUTH_ONLY - Use together with a single other type to force no + * authentication or just that single type + * CURLAUTH_ANY - All fine types set + * CURLAUTH_ANYSAFE - All fine types except Basic + */ + +#define CURLAUTH_NONE ((unsigned long)0) +#define CURLAUTH_BASIC (((unsigned long)1)<<0) +#define CURLAUTH_DIGEST (((unsigned long)1)<<1) +#define CURLAUTH_NEGOTIATE (((unsigned long)1)<<2) +/* Deprecated since the advent of CURLAUTH_NEGOTIATE */ +#define CURLAUTH_GSSNEGOTIATE CURLAUTH_NEGOTIATE +#define CURLAUTH_NTLM (((unsigned long)1)<<3) +#define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) +#define CURLAUTH_NTLM_WB (((unsigned long)1)<<5) +#define CURLAUTH_ONLY (((unsigned long)1)<<31) +#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) +#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) + +#define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ +#define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ +#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */ +#define CURLSSH_AUTH_PASSWORD (1<<1) /* password */ +#define CURLSSH_AUTH_HOST (1<<2) /* host key files */ +#define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ +#define CURLSSH_AUTH_AGENT (1<<4) /* agent (ssh-agent, pageant...) */ +#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY + +#define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */ +#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */ +#define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */ + +#define CURL_ERROR_SIZE 256 + +enum curl_khtype { + CURLKHTYPE_UNKNOWN, + CURLKHTYPE_RSA1, + CURLKHTYPE_RSA, + CURLKHTYPE_DSS +}; + +struct curl_khkey { + const char *key; /* points to a zero-terminated string encoded with base64 + if len is zero, otherwise to the "raw" data */ + size_t len; + enum curl_khtype keytype; +}; + +/* this is the set of return values expected from the curl_sshkeycallback + callback */ +enum curl_khstat { + CURLKHSTAT_FINE_ADD_TO_FILE, + CURLKHSTAT_FINE, + CURLKHSTAT_REJECT, /* reject the connection, return an error */ + CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so + this causes a CURLE_DEFER error but otherwise the + connection will be left intact etc */ + CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */ +}; + +/* this is the set of status codes pass in to the callback */ +enum curl_khmatch { + CURLKHMATCH_OK, /* match */ + CURLKHMATCH_MISMATCH, /* host found, key mismatch! */ + CURLKHMATCH_MISSING, /* no matching host/key found */ + CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */ +}; + +typedef int + (*curl_sshkeycallback) (CURL *easy, /* easy handle */ + const struct curl_khkey *knownkey, /* known */ + const struct curl_khkey *foundkey, /* found */ + enum curl_khmatch, /* libcurl's view on the keys */ + void *clientp); /* custom pointer passed from app */ + +/* parameter for the CURLOPT_USE_SSL option */ +typedef enum { + CURLUSESSL_NONE, /* do not attempt to use SSL */ + CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */ + CURLUSESSL_CONTROL, /* SSL for the control connection or fail */ + CURLUSESSL_ALL, /* SSL for all communication or fail */ + CURLUSESSL_LAST /* not an option, never use */ +} curl_usessl; + +/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */ + +/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the + name of improving interoperability with older servers. Some SSL libraries + have introduced work-arounds for this flaw but those work-arounds sometimes + make the SSL communication fail. To regain functionality with those broken + servers, a user can this way allow the vulnerability back. */ +#define CURLSSLOPT_ALLOW_BEAST (1<<0) + +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all + the obsolete stuff removed! */ + +/* Backwards compatibility with older names */ +/* These are scheduled to disappear by 2009 */ + +#define CURLFTPSSL_NONE CURLUSESSL_NONE +#define CURLFTPSSL_TRY CURLUSESSL_TRY +#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL +#define CURLFTPSSL_ALL CURLUSESSL_ALL +#define CURLFTPSSL_LAST CURLUSESSL_LAST +#define curl_ftpssl curl_usessl +#endif /*!CURL_NO_OLDIES*/ + +/* parameter for the CURLOPT_FTP_SSL_CCC option */ +typedef enum { + CURLFTPSSL_CCC_NONE, /* do not send CCC */ + CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */ + CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */ + CURLFTPSSL_CCC_LAST /* not an option, never use */ +} curl_ftpccc; + +/* parameter for the CURLOPT_FTPSSLAUTH option */ +typedef enum { + CURLFTPAUTH_DEFAULT, /* let libcurl decide */ + CURLFTPAUTH_SSL, /* use "AUTH SSL" */ + CURLFTPAUTH_TLS, /* use "AUTH TLS" */ + CURLFTPAUTH_LAST /* not an option, never use */ +} curl_ftpauth; + +/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ +typedef enum { + CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */ + CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD + again if MKD succeeded, for SFTP this does + similar magic */ + CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD + again even if MKD failed! */ + CURLFTP_CREATE_DIR_LAST /* not an option, never use */ +} curl_ftpcreatedir; + +/* parameter for the CURLOPT_FTP_FILEMETHOD option */ +typedef enum { + CURLFTPMETHOD_DEFAULT, /* let libcurl pick */ + CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */ + CURLFTPMETHOD_NOCWD, /* no CWD at all */ + CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */ + CURLFTPMETHOD_LAST /* not an option, never use */ +} curl_ftpmethod; + +/* bitmask defines for CURLOPT_HEADEROPT */ +#define CURLHEADER_UNIFIED 0 +#define CURLHEADER_SEPARATE (1<<0) + +/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ +#define CURLPROTO_HTTP (1<<0) +#define CURLPROTO_HTTPS (1<<1) +#define CURLPROTO_FTP (1<<2) +#define CURLPROTO_FTPS (1<<3) +#define CURLPROTO_SCP (1<<4) +#define CURLPROTO_SFTP (1<<5) +#define CURLPROTO_TELNET (1<<6) +#define CURLPROTO_LDAP (1<<7) +#define CURLPROTO_LDAPS (1<<8) +#define CURLPROTO_DICT (1<<9) +#define CURLPROTO_FILE (1<<10) +#define CURLPROTO_TFTP (1<<11) +#define CURLPROTO_IMAP (1<<12) +#define CURLPROTO_IMAPS (1<<13) +#define CURLPROTO_POP3 (1<<14) +#define CURLPROTO_POP3S (1<<15) +#define CURLPROTO_SMTP (1<<16) +#define CURLPROTO_SMTPS (1<<17) +#define CURLPROTO_RTSP (1<<18) +#define CURLPROTO_RTMP (1<<19) +#define CURLPROTO_RTMPT (1<<20) +#define CURLPROTO_RTMPE (1<<21) +#define CURLPROTO_RTMPTE (1<<22) +#define CURLPROTO_RTMPS (1<<23) +#define CURLPROTO_RTMPTS (1<<24) +#define CURLPROTO_GOPHER (1<<25) +#define CURLPROTO_SMB (1<<26) +#define CURLPROTO_SMBS (1<<27) +#define CURLPROTO_ALL (~0) /* enable everything */ + +/* long may be 32 or 64 bits, but we should never depend on anything else + but 32 */ +#define CURLOPTTYPE_LONG 0 +#define CURLOPTTYPE_OBJECTPOINT 10000 +#define CURLOPTTYPE_FUNCTIONPOINT 20000 +#define CURLOPTTYPE_OFF_T 30000 + +/* name is uppercase CURLOPT_, + type is one of the defined CURLOPTTYPE_ + number is unique identifier */ +#ifdef CINIT +#undef CINIT +#endif + +#ifdef CURL_ISOCPP +#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define LONG CURLOPTTYPE_LONG +#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT +#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT +#define OFF_T CURLOPTTYPE_OFF_T +#define CINIT(name,type,number) CURLOPT_/**/name = type + number +#endif + +/* + * This macro-mania below setups the CURLOPT_[what] enum, to be used with + * curl_easy_setopt(). The first argument in the CINIT() macro is the [what] + * word. + */ + +typedef enum { + /* This is the FILE * or void * the regular output should be written to. */ + CINIT(WRITEDATA, OBJECTPOINT, 1), + + /* The full URL to get/put */ + CINIT(URL, OBJECTPOINT, 2), + + /* Port number to connect to, if other than default. */ + CINIT(PORT, LONG, 3), + + /* Name of proxy to use. */ + CINIT(PROXY, OBJECTPOINT, 4), + + /* "user:password;options" to use when fetching. */ + CINIT(USERPWD, OBJECTPOINT, 5), + + /* "user:password" to use with proxy. */ + CINIT(PROXYUSERPWD, OBJECTPOINT, 6), + + /* Range to get, specified as an ASCII string. */ + CINIT(RANGE, OBJECTPOINT, 7), + + /* not used */ + + /* Specified file stream to upload from (use as input): */ + CINIT(READDATA, OBJECTPOINT, 9), + + /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE + * bytes big. If this is not used, error messages go to stderr instead: */ + CINIT(ERRORBUFFER, OBJECTPOINT, 10), + + /* Function that will be called to store the output (instead of fwrite). The + * parameters will use fwrite() syntax, make sure to follow them. */ + CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11), + + /* Function that will be called to read the input (instead of fread). The + * parameters will use fread() syntax, make sure to follow them. */ + CINIT(READFUNCTION, FUNCTIONPOINT, 12), + + /* Time-out the read operation after this amount of seconds */ + CINIT(TIMEOUT, LONG, 13), + + /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about + * how large the file being sent really is. That allows better error + * checking and better verifies that the upload was successful. -1 means + * unknown size. + * + * For large file support, there is also a _LARGE version of the key + * which takes an off_t type, allowing platforms with larger off_t + * sizes to handle larger files. See below for INFILESIZE_LARGE. + */ + CINIT(INFILESIZE, LONG, 14), + + /* POST static input fields. */ + CINIT(POSTFIELDS, OBJECTPOINT, 15), + + /* Set the referrer page (needed by some CGIs) */ + CINIT(REFERER, OBJECTPOINT, 16), + + /* Set the FTP PORT string (interface name, named or numerical IP address) + Use i.e '-' to use default address. */ + CINIT(FTPPORT, OBJECTPOINT, 17), + + /* Set the User-Agent string (examined by some CGIs) */ + CINIT(USERAGENT, OBJECTPOINT, 18), + + /* If the download receives less than "low speed limit" bytes/second + * during "low speed time" seconds, the operations is aborted. + * You could i.e if you have a pretty high speed connection, abort if + * it is less than 2000 bytes/sec during 20 seconds. + */ + + /* Set the "low speed limit" */ + CINIT(LOW_SPEED_LIMIT, LONG, 19), + + /* Set the "low speed time" */ + CINIT(LOW_SPEED_TIME, LONG, 20), + + /* Set the continuation offset. + * + * Note there is also a _LARGE version of this key which uses + * off_t types, allowing for large file offsets on platforms which + * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. + */ + CINIT(RESUME_FROM, LONG, 21), + + /* Set cookie in request: */ + CINIT(COOKIE, OBJECTPOINT, 22), + + /* This points to a linked list of headers, struct curl_slist kind. This + list is also used for RTSP (in spite of its name) */ + CINIT(HTTPHEADER, OBJECTPOINT, 23), + + /* This points to a linked list of post entries, struct curl_httppost */ + CINIT(HTTPPOST, OBJECTPOINT, 24), + + /* name of the file keeping your private SSL-certificate */ + CINIT(SSLCERT, OBJECTPOINT, 25), + + /* password for the SSL or SSH private key */ + CINIT(KEYPASSWD, OBJECTPOINT, 26), + + /* send TYPE parameter? */ + CINIT(CRLF, LONG, 27), + + /* send linked-list of QUOTE commands */ + CINIT(QUOTE, OBJECTPOINT, 28), + + /* send FILE * or void * to store headers to, if you use a callback it + is simply passed to the callback unmodified */ + CINIT(HEADERDATA, OBJECTPOINT, 29), + + /* point to a file to read the initial cookies from, also enables + "cookie awareness" */ + CINIT(COOKIEFILE, OBJECTPOINT, 31), + + /* What version to specifically try to use. + See CURL_SSLVERSION defines below. */ + CINIT(SSLVERSION, LONG, 32), + + /* What kind of HTTP time condition to use, see defines */ + CINIT(TIMECONDITION, LONG, 33), + + /* Time to use with the above condition. Specified in number of seconds + since 1 Jan 1970 */ + CINIT(TIMEVALUE, LONG, 34), + + /* 35 = OBSOLETE */ + + /* Custom request, for customizing the get command like + HTTP: DELETE, TRACE and others + FTP: to use a different list command + */ + CINIT(CUSTOMREQUEST, OBJECTPOINT, 36), + + /* HTTP request, for odd commands like DELETE, TRACE and others */ + CINIT(STDERR, OBJECTPOINT, 37), + + /* 38 is not used */ + + /* send linked-list of post-transfer QUOTE commands */ + CINIT(POSTQUOTE, OBJECTPOINT, 39), + + CINIT(OBSOLETE40, OBJECTPOINT, 40), /* OBSOLETE, do not use! */ + + CINIT(VERBOSE, LONG, 41), /* talk a lot */ + CINIT(HEADER, LONG, 42), /* throw the header out too */ + CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */ + CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */ + CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 400 */ + CINIT(UPLOAD, LONG, 46), /* this is an upload */ + CINIT(POST, LONG, 47), /* HTTP POST method */ + CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */ + + CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */ + + /* Specify whether to read the user+password from the .netrc or the URL. + * This must be one of the CURL_NETRC_* enums below. */ + CINIT(NETRC, LONG, 51), + + CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */ + + CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */ + CINIT(PUT, LONG, 54), /* HTTP PUT */ + + /* 55 = OBSOLETE */ + + /* DEPRECATED + * Function that will be called instead of the internal progress display + * function. This function should be defined as the curl_progress_callback + * prototype defines. */ + CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56), + + /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION + callbacks */ + CINIT(PROGRESSDATA, OBJECTPOINT, 57), +#define CURLOPT_XFERINFODATA CURLOPT_PROGRESSDATA + + /* We want the referrer field set automatically when following locations */ + CINIT(AUTOREFERER, LONG, 58), + + /* Port of the proxy, can be set in the proxy string as well with: + "[host]:[port]" */ + CINIT(PROXYPORT, LONG, 59), + + /* size of the POST input data, if strlen() is not good to use */ + CINIT(POSTFIELDSIZE, LONG, 60), + + /* tunnel non-http operations through a HTTP proxy */ + CINIT(HTTPPROXYTUNNEL, LONG, 61), + + /* Set the interface string to use as outgoing network interface */ + CINIT(INTERFACE, OBJECTPOINT, 62), + + /* Set the krb4/5 security level, this also enables krb4/5 awareness. This + * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string + * is set but doesn't match one of these, 'private' will be used. */ + CINIT(KRBLEVEL, OBJECTPOINT, 63), + + /* Set if we should verify the peer in ssl handshake, set 1 to verify. */ + CINIT(SSL_VERIFYPEER, LONG, 64), + + /* The CApath or CAfile used to validate the peer certificate + this option is used only if SSL_VERIFYPEER is true */ + CINIT(CAINFO, OBJECTPOINT, 65), + + /* 66 = OBSOLETE */ + /* 67 = OBSOLETE */ + + /* Maximum number of http redirects to follow */ + CINIT(MAXREDIRS, LONG, 68), + + /* Pass a long set to 1 to get the date of the requested document (if + possible)! Pass a zero to shut it off. */ + CINIT(FILETIME, LONG, 69), + + /* This points to a linked list of telnet options */ + CINIT(TELNETOPTIONS, OBJECTPOINT, 70), + + /* Max amount of cached alive connections */ + CINIT(MAXCONNECTS, LONG, 71), + + CINIT(OBSOLETE72, LONG, 72), /* OBSOLETE, do not use! */ + + /* 73 = OBSOLETE */ + + /* Set to explicitly use a new connection for the upcoming transfer. + Do not use this unless you're absolutely sure of this, as it makes the + operation slower and is less friendly for the network. */ + CINIT(FRESH_CONNECT, LONG, 74), + + /* Set to explicitly forbid the upcoming transfer's connection to be re-used + when done. Do not use this unless you're absolutely sure of this, as it + makes the operation slower and is less friendly for the network. */ + CINIT(FORBID_REUSE, LONG, 75), + + /* Set to a file name that contains random data for libcurl to use to + seed the random engine when doing SSL connects. */ + CINIT(RANDOM_FILE, OBJECTPOINT, 76), + + /* Set to the Entropy Gathering Daemon socket pathname */ + CINIT(EGDSOCKET, OBJECTPOINT, 77), + + /* Time-out connect operations after this amount of seconds, if connects are + OK within this time, then fine... This only aborts the connect phase. */ + CINIT(CONNECTTIMEOUT, LONG, 78), + + /* Function that will be called to store headers (instead of fwrite). The + * parameters will use fwrite() syntax, make sure to follow them. */ + CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79), + + /* Set this to force the HTTP request to get back to GET. Only really usable + if POST, PUT or a custom request have been used first. + */ + CINIT(HTTPGET, LONG, 80), + + /* Set if we should verify the Common name from the peer certificate in ssl + * handshake, set 1 to check existence, 2 to ensure that it matches the + * provided hostname. */ + CINIT(SSL_VERIFYHOST, LONG, 81), + + /* Specify which file name to write all known cookies in after completed + operation. Set file name to "-" (dash) to make it go to stdout. */ + CINIT(COOKIEJAR, OBJECTPOINT, 82), + + /* Specify which SSL ciphers to use */ + CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83), + + /* Specify which HTTP version to use! This must be set to one of the + CURL_HTTP_VERSION* enums set below. */ + CINIT(HTTP_VERSION, LONG, 84), + + /* Specifically switch on or off the FTP engine's use of the EPSV command. By + default, that one will always be attempted before the more traditional + PASV command. */ + CINIT(FTP_USE_EPSV, LONG, 85), + + /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ + CINIT(SSLCERTTYPE, OBJECTPOINT, 86), + + /* name of the file keeping your private SSL-key */ + CINIT(SSLKEY, OBJECTPOINT, 87), + + /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ + CINIT(SSLKEYTYPE, OBJECTPOINT, 88), + + /* crypto engine for the SSL-sub system */ + CINIT(SSLENGINE, OBJECTPOINT, 89), + + /* set the crypto engine for the SSL-sub system as default + the param has no meaning... + */ + CINIT(SSLENGINE_DEFAULT, LONG, 90), + + /* Non-zero value means to use the global dns cache */ + CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */ + + /* DNS cache timeout */ + CINIT(DNS_CACHE_TIMEOUT, LONG, 92), + + /* send linked-list of pre-transfer QUOTE commands */ + CINIT(PREQUOTE, OBJECTPOINT, 93), + + /* set the debug function */ + CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94), + + /* set the data for the debug function */ + CINIT(DEBUGDATA, OBJECTPOINT, 95), + + /* mark this as start of a cookie session */ + CINIT(COOKIESESSION, LONG, 96), + + /* The CApath directory used to validate the peer certificate + this option is used only if SSL_VERIFYPEER is true */ + CINIT(CAPATH, OBJECTPOINT, 97), + + /* Instruct libcurl to use a smaller receive buffer */ + CINIT(BUFFERSIZE, LONG, 98), + + /* Instruct libcurl to not use any signal/alarm handlers, even when using + timeouts. This option is useful for multi-threaded applications. + See libcurl-the-guide for more background information. */ + CINIT(NOSIGNAL, LONG, 99), + + /* Provide a CURLShare for mutexing non-ts data */ + CINIT(SHARE, OBJECTPOINT, 100), + + /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), + CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ + CINIT(PROXYTYPE, LONG, 101), + + /* Set the Accept-Encoding string. Use this to tell a server you would like + the response to be compressed. Before 7.21.6, this was known as + CURLOPT_ENCODING */ + CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102), + + /* Set pointer to private data */ + CINIT(PRIVATE, OBJECTPOINT, 103), + + /* Set aliases for HTTP 200 in the HTTP Response header */ + CINIT(HTTP200ALIASES, OBJECTPOINT, 104), + + /* Continue to send authentication (user+password) when following locations, + even when hostname changed. This can potentially send off the name + and password to whatever host the server decides. */ + CINIT(UNRESTRICTED_AUTH, LONG, 105), + + /* Specifically switch on or off the FTP engine's use of the EPRT command ( + it also disables the LPRT attempt). By default, those ones will always be + attempted before the good old traditional PORT command. */ + CINIT(FTP_USE_EPRT, LONG, 106), + + /* Set this to a bitmask value to enable the particular authentications + methods you like. Use this in combination with CURLOPT_USERPWD. + Note that setting multiple bits may cause extra network round-trips. */ + CINIT(HTTPAUTH, LONG, 107), + + /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx + in second argument. The function must be matching the + curl_ssl_ctx_callback proto. */ + CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108), + + /* Set the userdata for the ssl context callback function's third + argument */ + CINIT(SSL_CTX_DATA, OBJECTPOINT, 109), + + /* FTP Option that causes missing dirs to be created on the remote server. + In 7.19.4 we introduced the convenience enums for this option using the + CURLFTP_CREATE_DIR prefix. + */ + CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110), + + /* Set this to a bitmask value to enable the particular authentications + methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. + Note that setting multiple bits may cause extra network round-trips. */ + CINIT(PROXYAUTH, LONG, 111), + + /* FTP option that changes the timeout, in seconds, associated with + getting a response. This is different from transfer timeout time and + essentially places a demand on the FTP server to acknowledge commands + in a timely manner. */ + CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112), +#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT + + /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to + tell libcurl to resolve names to those IP versions only. This only has + affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ + CINIT(IPRESOLVE, LONG, 113), + + /* Set this option to limit the size of a file that will be downloaded from + an HTTP or FTP server. + + Note there is also _LARGE version which adds large file support for + platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ + CINIT(MAXFILESIZE, LONG, 114), + + /* See the comment for INFILESIZE above, but in short, specifies + * the size of the file being uploaded. -1 means unknown. + */ + CINIT(INFILESIZE_LARGE, OFF_T, 115), + + /* Sets the continuation offset. There is also a LONG version of this; + * look above for RESUME_FROM. + */ + CINIT(RESUME_FROM_LARGE, OFF_T, 116), + + /* Sets the maximum size of data that will be downloaded from + * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. + */ + CINIT(MAXFILESIZE_LARGE, OFF_T, 117), + + /* Set this option to the file name of your .netrc file you want libcurl + to parse (using the CURLOPT_NETRC option). If not set, libcurl will do + a poor attempt to find the user's home directory and check for a .netrc + file in there. */ + CINIT(NETRC_FILE, OBJECTPOINT, 118), + + /* Enable SSL/TLS for FTP, pick one of: + CURLUSESSL_TRY - try using SSL, proceed anyway otherwise + CURLUSESSL_CONTROL - SSL for the control connection or fail + CURLUSESSL_ALL - SSL for all communication or fail + */ + CINIT(USE_SSL, LONG, 119), + + /* The _LARGE version of the standard POSTFIELDSIZE option */ + CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120), + + /* Enable/disable the TCP Nagle algorithm */ + CINIT(TCP_NODELAY, LONG, 121), + + /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 123 OBSOLETE. Gone in 7.16.0 */ + /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 127 OBSOLETE. Gone in 7.16.0 */ + /* 128 OBSOLETE. Gone in 7.16.0 */ + + /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option + can be used to change libcurl's default action which is to first try + "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK + response has been received. + + Available parameters are: + CURLFTPAUTH_DEFAULT - let libcurl decide + CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS + CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL + */ + CINIT(FTPSSLAUTH, LONG, 129), + + CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130), + CINIT(IOCTLDATA, OBJECTPOINT, 131), + + /* 132 OBSOLETE. Gone in 7.16.0 */ + /* 133 OBSOLETE. Gone in 7.16.0 */ + + /* zero terminated string for pass on to the FTP server when asked for + "account" info */ + CINIT(FTP_ACCOUNT, OBJECTPOINT, 134), + + /* feed cookies into cookie engine */ + CINIT(COOKIELIST, OBJECTPOINT, 135), + + /* ignore Content-Length */ + CINIT(IGNORE_CONTENT_LENGTH, LONG, 136), + + /* Set to non-zero to skip the IP address received in a 227 PASV FTP server + response. Typically used for FTP-SSL purposes but is not restricted to + that. libcurl will then instead use the same IP address it used for the + control connection. */ + CINIT(FTP_SKIP_PASV_IP, LONG, 137), + + /* Select "file method" to use when doing FTP, see the curl_ftpmethod + above. */ + CINIT(FTP_FILEMETHOD, LONG, 138), + + /* Local port number to bind the socket to */ + CINIT(LOCALPORT, LONG, 139), + + /* Number of ports to try, including the first one set with LOCALPORT. + Thus, setting it to 1 will make no additional attempts but the first. + */ + CINIT(LOCALPORTRANGE, LONG, 140), + + /* no transfer, set up connection and let application use the socket by + extracting it with CURLINFO_LASTSOCKET */ + CINIT(CONNECT_ONLY, LONG, 141), + + /* Function that will be called to convert from the + network encoding (instead of using the iconv calls in libcurl) */ + CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142), + + /* Function that will be called to convert to the + network encoding (instead of using the iconv calls in libcurl) */ + CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143), + + /* Function that will be called to convert from UTF8 + (instead of using the iconv calls in libcurl) + Note that this is used only for SSL certificate processing */ + CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144), + + /* if the connection proceeds too quickly then need to slow it down */ + /* limit-rate: maximum number of bytes per second to send or receive */ + CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145), + CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146), + + /* Pointer to command string to send if USER/PASS fails. */ + CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147), + + /* callback function for setting socket options */ + CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148), + CINIT(SOCKOPTDATA, OBJECTPOINT, 149), + + /* set to 0 to disable session ID re-use for this transfer, default is + enabled (== 1) */ + CINIT(SSL_SESSIONID_CACHE, LONG, 150), + + /* allowed SSH authentication methods */ + CINIT(SSH_AUTH_TYPES, LONG, 151), + + /* Used by scp/sftp to do public/private key authentication */ + CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152), + CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153), + + /* Send CCC (Clear Command Channel) after authentication */ + CINIT(FTP_SSL_CCC, LONG, 154), + + /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ + CINIT(TIMEOUT_MS, LONG, 155), + CINIT(CONNECTTIMEOUT_MS, LONG, 156), + + /* set to zero to disable the libcurl's decoding and thus pass the raw body + data to the application even when it is encoded/compressed */ + CINIT(HTTP_TRANSFER_DECODING, LONG, 157), + CINIT(HTTP_CONTENT_DECODING, LONG, 158), + + /* Permission used when creating new files and directories on the remote + server for protocols that support it, SFTP/SCP/FILE */ + CINIT(NEW_FILE_PERMS, LONG, 159), + CINIT(NEW_DIRECTORY_PERMS, LONG, 160), + + /* Set the behaviour of POST when redirecting. Values must be set to one + of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ + CINIT(POSTREDIR, LONG, 161), + + /* used by scp/sftp to verify the host's public key */ + CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162), + + /* Callback function for opening socket (instead of socket(2)). Optionally, + callback is able change the address or refuse to connect returning + CURL_SOCKET_BAD. The callback should have type + curl_opensocket_callback */ + CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163), + CINIT(OPENSOCKETDATA, OBJECTPOINT, 164), + + /* POST volatile input fields. */ + CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165), + + /* set transfer mode (;type=) when doing FTP via an HTTP proxy */ + CINIT(PROXY_TRANSFER_MODE, LONG, 166), + + /* Callback function for seeking in the input stream */ + CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167), + CINIT(SEEKDATA, OBJECTPOINT, 168), + + /* CRL file */ + CINIT(CRLFILE, OBJECTPOINT, 169), + + /* Issuer certificate */ + CINIT(ISSUERCERT, OBJECTPOINT, 170), + + /* (IPv6) Address scope */ + CINIT(ADDRESS_SCOPE, LONG, 171), + + /* Collect certificate chain info and allow it to get retrievable with + CURLINFO_CERTINFO after the transfer is complete. */ + CINIT(CERTINFO, LONG, 172), + + /* "name" and "pwd" to use when fetching. */ + CINIT(USERNAME, OBJECTPOINT, 173), + CINIT(PASSWORD, OBJECTPOINT, 174), + + /* "name" and "pwd" to use with Proxy when fetching. */ + CINIT(PROXYUSERNAME, OBJECTPOINT, 175), + CINIT(PROXYPASSWORD, OBJECTPOINT, 176), + + /* Comma separated list of hostnames defining no-proxy zones. These should + match both hostnames directly, and hostnames within a domain. For + example, local.com will match local.com and www.local.com, but NOT + notlocal.com or www.notlocal.com. For compatibility with other + implementations of this, .local.com will be considered to be the same as + local.com. A single * is the only valid wildcard, and effectively + disables the use of proxy. */ + CINIT(NOPROXY, OBJECTPOINT, 177), + + /* block size for TFTP transfers */ + CINIT(TFTP_BLKSIZE, LONG, 178), + + /* Socks Service */ + CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179), + + /* Socks Service */ + CINIT(SOCKS5_GSSAPI_NEC, LONG, 180), + + /* set the bitmask for the protocols that are allowed to be used for the + transfer, which thus helps the app which takes URLs from users or other + external inputs and want to restrict what protocol(s) to deal + with. Defaults to CURLPROTO_ALL. */ + CINIT(PROTOCOLS, LONG, 181), + + /* set the bitmask for the protocols that libcurl is allowed to follow to, + as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs + to be set in both bitmasks to be allowed to get redirected to. Defaults + to all protocols except FILE and SCP. */ + CINIT(REDIR_PROTOCOLS, LONG, 182), + + /* set the SSH knownhost file name to use */ + CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183), + + /* set the SSH host key callback, must point to a curl_sshkeycallback + function */ + CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184), + + /* set the SSH host key callback custom pointer */ + CINIT(SSH_KEYDATA, OBJECTPOINT, 185), + + /* set the SMTP mail originator */ + CINIT(MAIL_FROM, OBJECTPOINT, 186), + + /* set the SMTP mail receiver(s) */ + CINIT(MAIL_RCPT, OBJECTPOINT, 187), + + /* FTP: send PRET before PASV */ + CINIT(FTP_USE_PRET, LONG, 188), + + /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ + CINIT(RTSP_REQUEST, LONG, 189), + + /* The RTSP session identifier */ + CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190), + + /* The RTSP stream URI */ + CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191), + + /* The Transport: header to use in RTSP requests */ + CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192), + + /* Manually initialize the client RTSP CSeq for this handle */ + CINIT(RTSP_CLIENT_CSEQ, LONG, 193), + + /* Manually initialize the server RTSP CSeq for this handle */ + CINIT(RTSP_SERVER_CSEQ, LONG, 194), + + /* The stream to pass to INTERLEAVEFUNCTION. */ + CINIT(INTERLEAVEDATA, OBJECTPOINT, 195), + + /* Let the application define a custom write method for RTP data */ + CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196), + + /* Turn on wildcard matching */ + CINIT(WILDCARDMATCH, LONG, 197), + + /* Directory matching callback called before downloading of an + individual file (chunk) started */ + CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198), + + /* Directory matching callback called after the file (chunk) + was downloaded, or skipped */ + CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199), + + /* Change match (fnmatch-like) callback for wildcard matching */ + CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200), + + /* Let the application define custom chunk data pointer */ + CINIT(CHUNK_DATA, OBJECTPOINT, 201), + + /* FNMATCH_FUNCTION user pointer */ + CINIT(FNMATCH_DATA, OBJECTPOINT, 202), + + /* send linked-list of name:port:address sets */ + CINIT(RESOLVE, OBJECTPOINT, 203), + + /* Set a username for authenticated TLS */ + CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204), + + /* Set a password for authenticated TLS */ + CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205), + + /* Set authentication type for authenticated TLS */ + CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206), + + /* Set to 1 to enable the "TE:" header in HTTP requests to ask for + compressed transfer-encoded responses. Set to 0 to disable the use of TE: + in outgoing requests. The current default is 0, but it might change in a + future libcurl release. + + libcurl will ask for the compressed methods it knows of, and if that + isn't any, it will not ask for transfer-encoding at all even if this + option is set to 1. + + */ + CINIT(TRANSFER_ENCODING, LONG, 207), + + /* Callback function for closing socket (instead of close(2)). The callback + should have type curl_closesocket_callback */ + CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208), + CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209), + + /* allow GSSAPI credential delegation */ + CINIT(GSSAPI_DELEGATION, LONG, 210), + + /* Set the name servers to use for DNS resolution */ + CINIT(DNS_SERVERS, OBJECTPOINT, 211), + + /* Time-out accept operations (currently for FTP only) after this amount + of miliseconds. */ + CINIT(ACCEPTTIMEOUT_MS, LONG, 212), + + /* Set TCP keepalive */ + CINIT(TCP_KEEPALIVE, LONG, 213), + + /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */ + CINIT(TCP_KEEPIDLE, LONG, 214), + CINIT(TCP_KEEPINTVL, LONG, 215), + + /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */ + CINIT(SSL_OPTIONS, LONG, 216), + + /* Set the SMTP auth originator */ + CINIT(MAIL_AUTH, OBJECTPOINT, 217), + + /* Enable/disable SASL initial response */ + CINIT(SASL_IR, LONG, 218), + + /* Function that will be called instead of the internal progress display + * function. This function should be defined as the curl_xferinfo_callback + * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */ + CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219), + + /* The XOAUTH2 bearer token */ + CINIT(XOAUTH2_BEARER, OBJECTPOINT, 220), + + /* Set the interface string to use as outgoing network + * interface for DNS requests. + * Only supported by the c-ares DNS backend */ + CINIT(DNS_INTERFACE, OBJECTPOINT, 221), + + /* Set the local IPv4 address to use for outgoing DNS requests. + * Only supported by the c-ares DNS backend */ + CINIT(DNS_LOCAL_IP4, OBJECTPOINT, 222), + + /* Set the local IPv4 address to use for outgoing DNS requests. + * Only supported by the c-ares DNS backend */ + CINIT(DNS_LOCAL_IP6, OBJECTPOINT, 223), + + /* Set authentication options directly */ + CINIT(LOGIN_OPTIONS, OBJECTPOINT, 224), + + /* Enable/disable TLS NPN extension (http2 over ssl might fail without) */ + CINIT(SSL_ENABLE_NPN, LONG, 225), + + /* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */ + CINIT(SSL_ENABLE_ALPN, LONG, 226), + + /* Time to wait for a response to a HTTP request containing an + * Expect: 100-continue header before sending the data anyway. */ + CINIT(EXPECT_100_TIMEOUT_MS, LONG, 227), + + /* This points to a linked list of headers used for proxy requests only, + struct curl_slist kind */ + CINIT(PROXYHEADER, OBJECTPOINT, 228), + + /* Pass in a bitmask of "header options" */ + CINIT(HEADEROPT, LONG, 229), + + /* The public key in DER form used to validate the peer public key + this option is used only if SSL_VERIFYPEER is true */ + CINIT(PINNEDPUBLICKEY, OBJECTPOINT, 230), + + /* Path to Unix domain socket */ + CINIT(UNIX_SOCKET_PATH, OBJECTPOINT, 231), + + /* Set if we should verify the certificate status. */ + CINIT(SSL_VERIFYSTATUS, LONG, 232), + + /* Set if we should enable TLS false start. */ + CINIT(SSL_FALSESTART, LONG, 233), + + /* Do not squash dot-dot sequences */ + CINIT(PATH_AS_IS, LONG, 234), + + /* Proxy Service Name */ + CINIT(PROXY_SERVICE_NAME, OBJECTPOINT, 235), + + /* Service Name */ + CINIT(SERVICE_NAME, OBJECTPOINT, 236), + + /* Wait/don't wait for pipe/mutex to clarify */ + CINIT(PIPEWAIT, LONG, 237), + + CURLOPT_LASTENTRY /* the last unused */ +} CURLoption; + +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all + the obsolete stuff removed! */ + +/* Backwards compatibility with older names */ +/* These are scheduled to disappear by 2011 */ + +/* This was added in version 7.19.1 */ +#define CURLOPT_POST301 CURLOPT_POSTREDIR + +/* These are scheduled to disappear by 2009 */ + +/* The following were added in 7.17.0 */ +#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD +#define CURLOPT_FTPAPPEND CURLOPT_APPEND +#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY +#define CURLOPT_FTP_SSL CURLOPT_USE_SSL + +/* The following were added earlier */ + +#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD +#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL + +#else +/* This is set if CURL_NO_OLDIES is defined at compile-time */ +#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */ +#endif + + + /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host + name resolves addresses using more than one IP protocol version, this + option might be handy to force libcurl to use a specific IP version. */ +#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP + versions that your system allows */ +#define CURL_IPRESOLVE_V4 1 /* resolve to IPv4 addresses */ +#define CURL_IPRESOLVE_V6 2 /* resolve to IPv6 addresses */ + + /* three convenient "aliases" that follow the name scheme better */ +#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER + + /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ +enum { + CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd + like the library to choose the best possible + for us! */ + CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */ + CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */ + CURL_HTTP_VERSION_2_0, /* please use HTTP 2.0 in the request */ + + CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ +}; + +/* Convenience definition simple because the name of the version is HTTP/2 and + not 2.0. The 2_0 version of the enum name was set while the version was + still planned to be 2.0 and we stick to it for compatibility. */ +#define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0 + +/* + * Public API enums for RTSP requests + */ +enum { + CURL_RTSPREQ_NONE, /* first in list */ + CURL_RTSPREQ_OPTIONS, + CURL_RTSPREQ_DESCRIBE, + CURL_RTSPREQ_ANNOUNCE, + CURL_RTSPREQ_SETUP, + CURL_RTSPREQ_PLAY, + CURL_RTSPREQ_PAUSE, + CURL_RTSPREQ_TEARDOWN, + CURL_RTSPREQ_GET_PARAMETER, + CURL_RTSPREQ_SET_PARAMETER, + CURL_RTSPREQ_RECORD, + CURL_RTSPREQ_RECEIVE, + CURL_RTSPREQ_LAST /* last in list */ +}; + + /* These enums are for use with the CURLOPT_NETRC option. */ +enum CURL_NETRC_OPTION { + CURL_NETRC_IGNORED, /* The .netrc will never be read. + * This is the default. */ + CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred + * to one in the .netrc. */ + CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored. + * Unless one is set programmatically, the .netrc + * will be queried. */ + CURL_NETRC_LAST +}; + +enum { + CURL_SSLVERSION_DEFAULT, + CURL_SSLVERSION_TLSv1, /* TLS 1.x */ + CURL_SSLVERSION_SSLv2, + CURL_SSLVERSION_SSLv3, + CURL_SSLVERSION_TLSv1_0, + CURL_SSLVERSION_TLSv1_1, + CURL_SSLVERSION_TLSv1_2, + + CURL_SSLVERSION_LAST /* never use, keep last */ +}; + +enum CURL_TLSAUTH { + CURL_TLSAUTH_NONE, + CURL_TLSAUTH_SRP, + CURL_TLSAUTH_LAST /* never use, keep last */ +}; + +/* symbols to use with CURLOPT_POSTREDIR. + CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303 + can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 + | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */ + +#define CURL_REDIR_GET_ALL 0 +#define CURL_REDIR_POST_301 1 +#define CURL_REDIR_POST_302 2 +#define CURL_REDIR_POST_303 4 +#define CURL_REDIR_POST_ALL \ + (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303) + +typedef enum { + CURL_TIMECOND_NONE, + + CURL_TIMECOND_IFMODSINCE, + CURL_TIMECOND_IFUNMODSINCE, + CURL_TIMECOND_LASTMOD, + + CURL_TIMECOND_LAST +} curl_TimeCond; + + +/* curl_strequal() and curl_strnequal() are subject for removal in a future + libcurl, see lib/README.curlx for details */ +CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2); +CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n); + +/* name is uppercase CURLFORM_ */ +#ifdef CFINIT +#undef CFINIT +#endif + +#ifdef CURL_ISOCPP +#define CFINIT(name) CURLFORM_ ## name +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define CFINIT(name) CURLFORM_/**/name +#endif + +typedef enum { + CFINIT(NOTHING), /********* the first one is unused ************/ + + /* */ + CFINIT(COPYNAME), + CFINIT(PTRNAME), + CFINIT(NAMELENGTH), + CFINIT(COPYCONTENTS), + CFINIT(PTRCONTENTS), + CFINIT(CONTENTSLENGTH), + CFINIT(FILECONTENT), + CFINIT(ARRAY), + CFINIT(OBSOLETE), + CFINIT(FILE), + + CFINIT(BUFFER), + CFINIT(BUFFERPTR), + CFINIT(BUFFERLENGTH), + + CFINIT(CONTENTTYPE), + CFINIT(CONTENTHEADER), + CFINIT(FILENAME), + CFINIT(END), + CFINIT(OBSOLETE2), + + CFINIT(STREAM), + + CURLFORM_LASTENTRY /* the last unused */ +} CURLformoption; + +#undef CFINIT /* done */ + +/* structure to be used as parameter for CURLFORM_ARRAY */ +struct curl_forms { + CURLformoption option; + const char *value; +}; + +/* use this for multipart formpost building */ +/* Returns code for curl_formadd() + * + * Returns: + * CURL_FORMADD_OK on success + * CURL_FORMADD_MEMORY if the FormInfo allocation fails + * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form + * CURL_FORMADD_NULL if a null pointer was given for a char + * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed + * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used + * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) + * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated + * CURL_FORMADD_MEMORY if some allocation for string copying failed. + * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array + * + ***************************************************************************/ +typedef enum { + CURL_FORMADD_OK, /* first, no error */ + + CURL_FORMADD_MEMORY, + CURL_FORMADD_OPTION_TWICE, + CURL_FORMADD_NULL, + CURL_FORMADD_UNKNOWN_OPTION, + CURL_FORMADD_INCOMPLETE, + CURL_FORMADD_ILLEGAL_ARRAY, + CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */ + + CURL_FORMADD_LAST /* last */ +} CURLFORMcode; + +/* + * NAME curl_formadd() + * + * DESCRIPTION + * + * Pretty advanced function for building multi-part formposts. Each invoke + * adds one part that together construct a full post. Then use + * CURLOPT_HTTPPOST to send it off to libcurl. + */ +CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, + struct curl_httppost **last_post, + ...); + +/* + * callback function for curl_formget() + * The void *arg pointer will be the one passed as second argument to + * curl_formget(). + * The character buffer passed to it must not be freed. + * Should return the buffer length passed to it as the argument "len" on + * success. + */ +typedef size_t (*curl_formget_callback)(void *arg, const char *buf, + size_t len); + +/* + * NAME curl_formget() + * + * DESCRIPTION + * + * Serialize a curl_httppost struct built with curl_formadd(). + * Accepts a void pointer as second argument which will be passed to + * the curl_formget_callback function. + * Returns 0 on success. + */ +CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg, + curl_formget_callback append); +/* + * NAME curl_formfree() + * + * DESCRIPTION + * + * Free a multipart formpost previously built with curl_formadd(). + */ +CURL_EXTERN void curl_formfree(struct curl_httppost *form); + +/* + * NAME curl_getenv() + * + * DESCRIPTION + * + * Returns a malloc()'ed string that MUST be curl_free()ed after usage is + * complete. DEPRECATED - see lib/README.curlx + */ +CURL_EXTERN char *curl_getenv(const char *variable); + +/* + * NAME curl_version() + * + * DESCRIPTION + * + * Returns a static ascii string of the libcurl version. + */ +CURL_EXTERN char *curl_version(void); + +/* + * NAME curl_easy_escape() + * + * DESCRIPTION + * + * Escapes URL strings (converts all letters consider illegal in URLs to their + * %XX versions). This function returns a new allocated string or NULL if an + * error occurred. + */ +CURL_EXTERN char *curl_easy_escape(CURL *handle, + const char *string, + int length); + +/* the previous version: */ +CURL_EXTERN char *curl_escape(const char *string, + int length); + + +/* + * NAME curl_easy_unescape() + * + * DESCRIPTION + * + * Unescapes URL encoding in strings (converts all %XX codes to their 8bit + * versions). This function returns a new allocated string or NULL if an error + * occurred. + * Conversion Note: On non-ASCII platforms the ASCII %XX codes are + * converted into the host encoding. + */ +CURL_EXTERN char *curl_easy_unescape(CURL *handle, + const char *string, + int length, + int *outlength); + +/* the previous version */ +CURL_EXTERN char *curl_unescape(const char *string, + int length); + +/* + * NAME curl_free() + * + * DESCRIPTION + * + * Provided for de-allocation in the same translation unit that did the + * allocation. Added in libcurl 7.10 + */ +CURL_EXTERN void curl_free(void *p); + +/* + * NAME curl_global_init() + * + * DESCRIPTION + * + * curl_global_init() should be invoked exactly once for each application that + * uses libcurl and before any call of other libcurl functions. + * + * This function is not thread-safe! + */ +CURL_EXTERN CURLcode curl_global_init(long flags); + +/* + * NAME curl_global_init_mem() + * + * DESCRIPTION + * + * curl_global_init() or curl_global_init_mem() should be invoked exactly once + * for each application that uses libcurl. This function can be used to + * initialize libcurl and set user defined memory management callback + * functions. Users can implement memory management routines to check for + * memory leaks, check for mis-use of the curl library etc. User registered + * callback routines with be invoked by this library instead of the system + * memory management routines like malloc, free etc. + */ +CURL_EXTERN CURLcode curl_global_init_mem(long flags, + curl_malloc_callback m, + curl_free_callback f, + curl_realloc_callback r, + curl_strdup_callback s, + curl_calloc_callback c); + +/* + * NAME curl_global_cleanup() + * + * DESCRIPTION + * + * curl_global_cleanup() should be invoked exactly once for each application + * that uses libcurl + */ +CURL_EXTERN void curl_global_cleanup(void); + +/* linked-list structure for the CURLOPT_QUOTE option (and other) */ +struct curl_slist { + char *data; + struct curl_slist *next; +}; + +/* + * NAME curl_slist_append() + * + * DESCRIPTION + * + * Appends a string to a linked list. If no list exists, it will be created + * first. Returns the new list, after appending. + */ +CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *, + const char *); + +/* + * NAME curl_slist_free_all() + * + * DESCRIPTION + * + * free a previously built curl_slist. + */ +CURL_EXTERN void curl_slist_free_all(struct curl_slist *); + +/* + * NAME curl_getdate() + * + * DESCRIPTION + * + * Returns the time, in seconds since 1 Jan 1970 of the time string given in + * the first argument. The time argument in the second parameter is unused + * and should be set to NULL. + */ +CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused); + +/* info about the certificate chain, only for OpenSSL builds. Asked + for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ +struct curl_certinfo { + int num_of_certs; /* number of certificates with information */ + struct curl_slist **certinfo; /* for each index in this array, there's a + linked list with textual information in the + format "name: value" */ +}; + +/* enum for the different supported SSL backends */ +typedef enum { + CURLSSLBACKEND_NONE = 0, + CURLSSLBACKEND_OPENSSL = 1, + CURLSSLBACKEND_GNUTLS = 2, + CURLSSLBACKEND_NSS = 3, + CURLSSLBACKEND_OBSOLETE4 = 4, /* Was QSOSSL. */ + CURLSSLBACKEND_GSKIT = 5, + CURLSSLBACKEND_POLARSSL = 6, + CURLSSLBACKEND_CYASSL = 7, + CURLSSLBACKEND_SCHANNEL = 8, + CURLSSLBACKEND_DARWINSSL = 9, + CURLSSLBACKEND_AXTLS = 10 +} curl_sslbackend; + +/* Information about the SSL library used and the respective internal SSL + handle, which can be used to obtain further information regarding the + connection. Asked for with CURLINFO_TLS_SESSION. */ +struct curl_tlssessioninfo { + curl_sslbackend backend; + void *internals; +}; + +#define CURLINFO_STRING 0x100000 +#define CURLINFO_LONG 0x200000 +#define CURLINFO_DOUBLE 0x300000 +#define CURLINFO_SLIST 0x400000 +#define CURLINFO_MASK 0x0fffff +#define CURLINFO_TYPEMASK 0xf00000 + +typedef enum { + CURLINFO_NONE, /* first, never use this */ + CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1, + CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2, + CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3, + CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4, + CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5, + CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6, + CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7, + CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8, + CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9, + CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10, + CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11, + CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12, + CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13, + CURLINFO_FILETIME = CURLINFO_LONG + 14, + CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15, + CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16, + CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, + CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, + CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19, + CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20, + CURLINFO_PRIVATE = CURLINFO_STRING + 21, + CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22, + CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23, + CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24, + CURLINFO_OS_ERRNO = CURLINFO_LONG + 25, + CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26, + CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, + CURLINFO_COOKIELIST = CURLINFO_SLIST + 28, + CURLINFO_LASTSOCKET = CURLINFO_LONG + 29, + CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, + CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31, + CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32, + CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33, + CURLINFO_CERTINFO = CURLINFO_SLIST + 34, + CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35, + CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36, + CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37, + CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38, + CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39, + CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40, + CURLINFO_LOCAL_IP = CURLINFO_STRING + 41, + CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42, + CURLINFO_TLS_SESSION = CURLINFO_SLIST + 43, + /* Fill in new entries below here! */ + + CURLINFO_LASTONE = 43 +} CURLINFO; + +/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as + CURLINFO_HTTP_CODE */ +#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE + +typedef enum { + CURLCLOSEPOLICY_NONE, /* first, never use this */ + + CURLCLOSEPOLICY_OLDEST, + CURLCLOSEPOLICY_LEAST_RECENTLY_USED, + CURLCLOSEPOLICY_LEAST_TRAFFIC, + CURLCLOSEPOLICY_SLOWEST, + CURLCLOSEPOLICY_CALLBACK, + + CURLCLOSEPOLICY_LAST /* last, never use this */ +} curl_closepolicy; + +#define CURL_GLOBAL_SSL (1<<0) +#define CURL_GLOBAL_WIN32 (1<<1) +#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32) +#define CURL_GLOBAL_NOTHING 0 +#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL +#define CURL_GLOBAL_ACK_EINTR (1<<2) + + +/***************************************************************************** + * Setup defines, protos etc for the sharing stuff. + */ + +/* Different data locks for a single share */ +typedef enum { + CURL_LOCK_DATA_NONE = 0, + /* CURL_LOCK_DATA_SHARE is used internally to say that + * the locking is just made to change the internal state of the share + * itself. + */ + CURL_LOCK_DATA_SHARE, + CURL_LOCK_DATA_COOKIE, + CURL_LOCK_DATA_DNS, + CURL_LOCK_DATA_SSL_SESSION, + CURL_LOCK_DATA_CONNECT, + CURL_LOCK_DATA_LAST +} curl_lock_data; + +/* Different lock access types */ +typedef enum { + CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */ + CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */ + CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */ + CURL_LOCK_ACCESS_LAST /* never use */ +} curl_lock_access; + +typedef void (*curl_lock_function)(CURL *handle, + curl_lock_data data, + curl_lock_access locktype, + void *userptr); +typedef void (*curl_unlock_function)(CURL *handle, + curl_lock_data data, + void *userptr); + +typedef void CURLSH; + +typedef enum { + CURLSHE_OK, /* all is fine */ + CURLSHE_BAD_OPTION, /* 1 */ + CURLSHE_IN_USE, /* 2 */ + CURLSHE_INVALID, /* 3 */ + CURLSHE_NOMEM, /* 4 out of memory */ + CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */ + CURLSHE_LAST /* never use */ +} CURLSHcode; + +typedef enum { + CURLSHOPT_NONE, /* don't use */ + CURLSHOPT_SHARE, /* specify a data type to share */ + CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */ + CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */ + CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */ + CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock + callback functions */ + CURLSHOPT_LAST /* never use */ +} CURLSHoption; + +CURL_EXTERN CURLSH *curl_share_init(void); +CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...); +CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *); + +/**************************************************************************** + * Structures for querying information about the curl library at runtime. + */ + +typedef enum { + CURLVERSION_FIRST, + CURLVERSION_SECOND, + CURLVERSION_THIRD, + CURLVERSION_FOURTH, + CURLVERSION_LAST /* never actually use this */ +} CURLversion; + +/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by + basically all programs ever that want to get version information. It is + meant to be a built-in version number for what kind of struct the caller + expects. If the struct ever changes, we redefine the NOW to another enum + from above. */ +#define CURLVERSION_NOW CURLVERSION_FOURTH + +typedef struct { + CURLversion age; /* age of the returned struct */ + const char *version; /* LIBCURL_VERSION */ + unsigned int version_num; /* LIBCURL_VERSION_NUM */ + const char *host; /* OS/host/cpu/machine when configured */ + int features; /* bitmask, see defines below */ + const char *ssl_version; /* human readable string */ + long ssl_version_num; /* not used anymore, always 0 */ + const char *libz_version; /* human readable string */ + /* protocols is terminated by an entry with a NULL protoname */ + const char * const *protocols; + + /* The fields below this were added in CURLVERSION_SECOND */ + const char *ares; + int ares_num; + + /* This field was added in CURLVERSION_THIRD */ + const char *libidn; + + /* These field were added in CURLVERSION_FOURTH */ + + /* Same as '_libiconv_version' if built with HAVE_ICONV */ + int iconv_ver_num; + + const char *libssh_version; /* human readable string */ + +} curl_version_info_data; + +#define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */ +#define CURL_VERSION_KERBEROS4 (1<<1) /* Kerberos V4 auth is supported + (deprecated) */ +#define CURL_VERSION_SSL (1<<2) /* SSL options are present */ +#define CURL_VERSION_LIBZ (1<<3) /* libz features are present */ +#define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */ +#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth is supported + (deprecated) */ +#define CURL_VERSION_DEBUG (1<<6) /* Built with debug capabilities */ +#define CURL_VERSION_ASYNCHDNS (1<<7) /* Asynchronous DNS resolves */ +#define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth is supported */ +#define CURL_VERSION_LARGEFILE (1<<9) /* Supports files larger than 2GB */ +#define CURL_VERSION_IDN (1<<10) /* Internationized Domain Names are + supported */ +#define CURL_VERSION_SSPI (1<<11) /* Built against Windows SSPI */ +#define CURL_VERSION_CONV (1<<12) /* Character conversions supported */ +#define CURL_VERSION_CURLDEBUG (1<<13) /* Debug memory tracking supported */ +#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */ +#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegation to winbind helper + is suported */ +#define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */ +#define CURL_VERSION_GSSAPI (1<<17) /* Built against a GSS-API library */ +#define CURL_VERSION_KERBEROS5 (1<<18) /* Kerberos V5 auth is supported */ +#define CURL_VERSION_UNIX_SOCKETS (1<<19) /* Unix domain sockets support */ + + /* + * NAME curl_version_info() + * + * DESCRIPTION + * + * This function returns a pointer to a static copy of the version info + * struct. See above. + */ +CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion); + +/* + * NAME curl_easy_strerror() + * + * DESCRIPTION + * + * The curl_easy_strerror function may be used to turn a CURLcode value + * into the equivalent human readable error string. This is useful + * for printing meaningful error messages. + */ +CURL_EXTERN const char *curl_easy_strerror(CURLcode); + +/* + * NAME curl_share_strerror() + * + * DESCRIPTION + * + * The curl_share_strerror function may be used to turn a CURLSHcode value + * into the equivalent human readable error string. This is useful + * for printing meaningful error messages. + */ +CURL_EXTERN const char *curl_share_strerror(CURLSHcode); + +/* + * NAME curl_easy_pause() + * + * DESCRIPTION + * + * The curl_easy_pause function pauses or unpauses transfers. Select the new + * state by setting the bitmask, use the convenience defines below. + * + */ +CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask); + +#define CURLPAUSE_RECV (1<<0) +#define CURLPAUSE_RECV_CONT (0) + +#define CURLPAUSE_SEND (1<<2) +#define CURLPAUSE_SEND_CONT (0) + +#define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND) +#define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT) + +#ifdef __cplusplus +} +#endif + +/* unfortunately, the easy.h and multi.h include files need options and info + stuff before they can be included! */ +#include "easy.h" /* nothing in curl is fun without the easy stuff */ +#include "multi.h" + +/* the typechecker doesn't work in C++ (yet) */ +#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \ + ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \ + !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK) +#include "typecheck-gcc.h" +#else +#if defined(__STDC__) && (__STDC__ >= 1) +/* This preprocessor magic that replaces a call with the exact same call is + only done to make sure application authors pass exactly three arguments + to these functions. */ +#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param) +#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg) +#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) +#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) +#endif /* __STDC__ >= 1 */ +#endif /* gcc >= 4.3 && !__cplusplus */ + +#endif /* __CURL_CURL_H */ diff --git a/phonelibs/curl/include/curl/curlbuild.h b/phonelibs/curl/include/curl/curlbuild.h new file mode 100644 index 00000000000000..2bf01cf37c520d --- /dev/null +++ b/phonelibs/curl/include/curl/curlbuild.h @@ -0,0 +1,195 @@ +/* include/curl/curlbuild.h. Generated from curlbuild.h.in by configure. */ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.in or + * at file include/curl/curlbuild.h, this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_SIZEOF_LONG +#error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T +#error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_SOCKLEN_T +#error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_OFF_T +#error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_T +#error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_TU +#error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +#error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +#error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_T +#error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_TU +#error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file ws2tcpip.h must be included by the external interface. */ +/* #undef CURL_PULL_WS2TCPIP_H */ +#ifdef CURL_PULL_WS2TCPIP_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#define CURL_PULL_SYS_TYPES_H 1 +#ifdef CURL_PULL_SYS_TYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file stdint.h must be included by the external interface. */ +#define CURL_PULL_STDINT_H 1 +#ifdef CURL_PULL_STDINT_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file inttypes.h must be included by the external interface. */ +#define CURL_PULL_INTTYPES_H 1 +#ifdef CURL_PULL_INTTYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/socket.h must be included by the external interface. */ +#define CURL_PULL_SYS_SOCKET_H 1 +#ifdef CURL_PULL_SYS_SOCKET_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/poll.h must be included by the external interface. */ +/* #undef CURL_PULL_SYS_POLL_H */ +#ifdef CURL_PULL_SYS_POLL_H +# include +#endif + +/* Integral data type used for curl_socklen_t. */ +#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t + +/* The size of `curl_socklen_t', as computed by sizeof. */ +#define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +/* Data type definition of curl_socklen_t. */ +typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; + +/* Signed integral data type used for curl_off_t. */ +#define CURL_TYPEOF_CURL_OFF_T int64_t + +/* Data type definition of curl_off_t. */ +typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; + +/* curl_off_t formatting string directive without "%" conversion specifier. */ +#define CURL_FORMAT_CURL_OFF_T "lld" + +/* unsigned curl_off_t formatting string without "%" conversion specifier. */ +#define CURL_FORMAT_CURL_OFF_TU "llu" + +/* curl_off_t formatting string directive with "%" conversion specifier. */ +#define CURL_FORMAT_OFF_T "%lld" + +/* The size of `curl_off_t', as computed by sizeof. */ +#define CURL_SIZEOF_CURL_OFF_T 8 + +/* curl_off_t constant suffix. */ +#define CURL_SUFFIX_CURL_OFF_T LL + +/* unsigned curl_off_t constant suffix. */ +#define CURL_SUFFIX_CURL_OFF_TU ULL + +#endif /* __CURL_CURLBUILD_H */ diff --git a/phonelibs/curl/include/curl/curlbuild.h.cmake b/phonelibs/curl/include/curl/curlbuild.h.cmake new file mode 100644 index 00000000000000..60bc7a70ec547e --- /dev/null +++ b/phonelibs/curl/include/curl/curlbuild.h.cmake @@ -0,0 +1,197 @@ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.in or + * at file include/curl/curlbuild.h, this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_SIZEOF_LONG +#error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T +#error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_SOCKLEN_T +#error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_OFF_T +#error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_T +#error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_TU +#error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +#error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +#error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_T +#error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_TU +#error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file ws2tcpip.h must be included by the external interface. */ +#cmakedefine CURL_PULL_WS2TCPIP_H +#ifdef CURL_PULL_WS2TCPIP_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#cmakedefine CURL_PULL_SYS_TYPES_H +#ifdef CURL_PULL_SYS_TYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file stdint.h must be included by the external interface. */ +#cmakedefine CURL_PULL_STDINT_H +#ifdef CURL_PULL_STDINT_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file inttypes.h must be included by the external interface. */ +#cmakedefine CURL_PULL_INTTYPES_H +#ifdef CURL_PULL_INTTYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/socket.h must be included by the external interface. */ +#cmakedefine CURL_PULL_SYS_SOCKET_H +#ifdef CURL_PULL_SYS_SOCKET_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/poll.h must be included by the external interface. */ +#cmakedefine CURL_PULL_SYS_POLL_H +#ifdef CURL_PULL_SYS_POLL_H +# include +#endif + +/* The size of `long', as computed by sizeof. */ +#define CURL_SIZEOF_LONG ${CURL_SIZEOF_LONG} + +/* Integral data type used for curl_socklen_t. */ +#define CURL_TYPEOF_CURL_SOCKLEN_T ${CURL_TYPEOF_CURL_SOCKLEN_T} + +/* The size of `curl_socklen_t', as computed by sizeof. */ +#define CURL_SIZEOF_CURL_SOCKLEN_T ${CURL_SIZEOF_CURL_SOCKLEN_T} + +/* Data type definition of curl_socklen_t. */ +typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; + +/* Signed integral data type used for curl_off_t. */ +#define CURL_TYPEOF_CURL_OFF_T ${CURL_TYPEOF_CURL_OFF_T} + +/* Data type definition of curl_off_t. */ +typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; + +/* curl_off_t formatting string directive without "%" conversion specifier. */ +#define CURL_FORMAT_CURL_OFF_T "${CURL_FORMAT_CURL_OFF_T}" + +/* unsigned curl_off_t formatting string without "%" conversion specifier. */ +#define CURL_FORMAT_CURL_OFF_TU "${CURL_FORMAT_CURL_OFF_TU}" + +/* curl_off_t formatting string directive with "%" conversion specifier. */ +#define CURL_FORMAT_OFF_T "${CURL_FORMAT_OFF_T}" + +/* The size of `curl_off_t', as computed by sizeof. */ +#define CURL_SIZEOF_CURL_OFF_T ${CURL_SIZEOF_CURL_OFF_T} + +/* curl_off_t constant suffix. */ +#define CURL_SUFFIX_CURL_OFF_T ${CURL_SUFFIX_CURL_OFF_T} + +/* unsigned curl_off_t constant suffix. */ +#define CURL_SUFFIX_CURL_OFF_TU ${CURL_SUFFIX_CURL_OFF_TU} + +#endif /* __CURL_CURLBUILD_H */ diff --git a/phonelibs/curl/include/curl/curlbuild.h.dist b/phonelibs/curl/include/curl/curlbuild.h.dist new file mode 100644 index 00000000000000..f09419a8439151 --- /dev/null +++ b/phonelibs/curl/include/curl/curlbuild.h.dist @@ -0,0 +1,585 @@ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * See file include/curl/curlbuild.h.in, run configure, and forget + * that this file exists it is only used for non-configure systems. + * But you can keep reading if you want ;-) + * + */ + +/* ================================================================ */ +/* NOTES FOR NON-CONFIGURE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * Try to keep one section per platform, compiler and architecture, + * otherwise, if an existing section is reused for a different one and + * later on the original is adjusted, probably the piggybacking one can + * be adversely changed. + * + * In order to differentiate between platforms/compilers/architectures + * use only compiler built in predefined preprocessor symbols. + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * For any given platform/compiler curl_off_t must be typedef'ed to a + * 64-bit wide signed integral data type. The width of this data type + * must remain constant and independent of any possible large file + * support settings. + * + * As an exception to the above, curl_off_t shall be typedef'ed to a + * 32-bit wide signed integral data type if there is no 64-bit type. + * + * As a general rule, curl_off_t shall not be mapped to off_t. This + * rule shall only be violated if off_t is the only 64-bit data type + * available and the size of off_t is independent of large file support + * settings. Keep your build on the safe side avoiding an off_t gating. + * If you have a 64-bit off_t then take for sure that another 64-bit + * data type exists, dig deeper and you will find it. + * + * NOTE 3: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.dist or + * at file include/curl/curlbuild.h, this is due to the following reason: + * file include/curl/curlbuild.h.dist is renamed to include/curl/curlbuild.h + * when the libcurl source code distribution archive file is created. + * + * File include/curl/curlbuild.h.dist is not included in the distribution + * archive. File include/curl/curlbuild.h is not present in the git tree. + * + * The distributed include/curl/curlbuild.h file is only intended to be used + * on systems which can not run the also distributed configure script. + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + * If you check out from git on a non-configure platform, you must run the + * appropriate buildconf* script to set up curlbuild.h and other local files. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_SIZEOF_LONG +# error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T +# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_SOCKLEN_T +# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_OFF_T +# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_T +# error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_TU +# error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_T +# error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_TU +# error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */ +/* ================================================================ */ + +#if defined(__DJGPP__) || defined(__GO32__) +# if defined(__DJGPP__) && (__DJGPP__ > 1) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# else +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__SALFORDC__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__BORLANDC__) +# if (__BORLANDC__ < 0x520) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# else +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T __int64 +# define CURL_FORMAT_CURL_OFF_T "I64d" +# define CURL_FORMAT_CURL_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T i64 +# define CURL_SUFFIX_CURL_OFF_TU ui64 +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__TURBOC__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__WATCOMC__) +# if defined(__386__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T __int64 +# define CURL_FORMAT_CURL_OFF_T "I64d" +# define CURL_FORMAT_CURL_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T i64 +# define CURL_SUFFIX_CURL_OFF_TU ui64 +# else +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__POCC__) +# if (__POCC__ < 280) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# elif defined(_MSC_VER) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T __int64 +# define CURL_FORMAT_CURL_OFF_T "I64d" +# define CURL_FORMAT_CURL_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T i64 +# define CURL_SUFFIX_CURL_OFF_TU ui64 +# else +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__LCC__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__SYMBIAN32__) +# if defined(__EABI__) /* Treat all ARM compilers equally */ +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# elif defined(__CW32__) +# pragma longlong on +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# elif defined(__VC32__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T __int64 +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__MWERKS__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(_WIN32_WCE) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T __int64 +# define CURL_FORMAT_CURL_OFF_T "I64d" +# define CURL_FORMAT_CURL_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T i64 +# define CURL_SUFFIX_CURL_OFF_TU ui64 +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__MINGW32__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "I64d" +# define CURL_FORMAT_CURL_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__VMS) +# if defined(__VAX) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# else +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +#elif defined(__OS400__) +# if defined(__ILEC400__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 +# define CURL_PULL_SYS_TYPES_H 1 +# define CURL_PULL_SYS_SOCKET_H 1 +# endif + +#elif defined(__MVS__) +# if defined(__IBMC__) || defined(__IBMCPP__) +# if defined(_ILP32) +# define CURL_SIZEOF_LONG 4 +# elif defined(_LP64) +# define CURL_SIZEOF_LONG 8 +# endif +# if defined(_LONG_LONG) +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# elif defined(_LP64) +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# else +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 +# define CURL_PULL_SYS_TYPES_H 1 +# define CURL_PULL_SYS_SOCKET_H 1 +# endif + +#elif defined(__370__) +# if defined(__IBMC__) || defined(__IBMCPP__) +# if defined(_ILP32) +# define CURL_SIZEOF_LONG 4 +# elif defined(_LP64) +# define CURL_SIZEOF_LONG 8 +# endif +# if defined(_LONG_LONG) +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# elif defined(_LP64) +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# else +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 +# define CURL_PULL_SYS_TYPES_H 1 +# define CURL_PULL_SYS_SOCKET_H 1 +# endif + +#elif defined(TPF) +# define CURL_SIZEOF_LONG 8 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +/* ===================================== */ +/* KEEP MSVC THE PENULTIMATE ENTRY */ +/* ===================================== */ + +#elif defined(_MSC_VER) +# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T __int64 +# define CURL_FORMAT_CURL_OFF_T "I64d" +# define CURL_FORMAT_CURL_OFF_TU "I64u" +# define CURL_FORMAT_OFF_T "%I64d" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T i64 +# define CURL_SUFFIX_CURL_OFF_TU ui64 +# else +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 4 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T int +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +/* ===================================== */ +/* KEEP GENERIC GCC THE LAST ENTRY */ +/* ===================================== */ + +#elif defined(__GNUC__) +# if defined(__ILP32__) || \ + defined(__i386__) || defined(__ppc__) || defined(__arm__) || defined(__sparc__) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# elif defined(__LP64__) || \ + defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) +# define CURL_SIZEOF_LONG 8 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_FORMAT_OFF_T "%ld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 +# define CURL_PULL_SYS_TYPES_H 1 +# define CURL_PULL_SYS_SOCKET_H 1 + +#else +# error "Unknown non-configure build target!" + Error Compilation_aborted_Unknown_non_configure_build_target +#endif + +/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */ +/* sys/types.h is required here to properly make type definitions below. */ +#ifdef CURL_PULL_SYS_TYPES_H +# include +#endif + +/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ +/* sys/socket.h is required here to properly make type definitions below. */ +#ifdef CURL_PULL_SYS_SOCKET_H +# include +#endif + +/* Data type definition of curl_socklen_t. */ + +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T + typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; +#endif + +/* Data type definition of curl_off_t. */ + +#ifdef CURL_TYPEOF_CURL_OFF_T + typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; +#endif + +#endif /* __CURL_CURLBUILD_H */ diff --git a/phonelibs/curl/include/curl/curlbuild.h.in b/phonelibs/curl/include/curl/curlbuild.h.in new file mode 100644 index 00000000000000..7cb2b6ef7eb1c7 --- /dev/null +++ b/phonelibs/curl/include/curl/curlbuild.h.in @@ -0,0 +1,194 @@ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.in or + * at file include/curl/curlbuild.h, this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_SIZEOF_LONG +#error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T +#error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_SOCKLEN_T +#error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_OFF_T +#error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_T +#error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_TU +#error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +#error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +#error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_T +#error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_TU +#error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file ws2tcpip.h must be included by the external interface. */ +#undef CURL_PULL_WS2TCPIP_H +#ifdef CURL_PULL_WS2TCPIP_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#undef CURL_PULL_SYS_TYPES_H +#ifdef CURL_PULL_SYS_TYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file stdint.h must be included by the external interface. */ +#undef CURL_PULL_STDINT_H +#ifdef CURL_PULL_STDINT_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file inttypes.h must be included by the external interface. */ +#undef CURL_PULL_INTTYPES_H +#ifdef CURL_PULL_INTTYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/socket.h must be included by the external interface. */ +#undef CURL_PULL_SYS_SOCKET_H +#ifdef CURL_PULL_SYS_SOCKET_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/poll.h must be included by the external interface. */ +#undef CURL_PULL_SYS_POLL_H +#ifdef CURL_PULL_SYS_POLL_H +# include +#endif + +/* Integral data type used for curl_socklen_t. */ +#undef CURL_TYPEOF_CURL_SOCKLEN_T + +/* The size of `curl_socklen_t', as computed by sizeof. */ +#undef CURL_SIZEOF_CURL_SOCKLEN_T + +/* Data type definition of curl_socklen_t. */ +typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; + +/* Signed integral data type used for curl_off_t. */ +#undef CURL_TYPEOF_CURL_OFF_T + +/* Data type definition of curl_off_t. */ +typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; + +/* curl_off_t formatting string directive without "%" conversion specifier. */ +#undef CURL_FORMAT_CURL_OFF_T + +/* unsigned curl_off_t formatting string without "%" conversion specifier. */ +#undef CURL_FORMAT_CURL_OFF_TU + +/* curl_off_t formatting string directive with "%" conversion specifier. */ +#undef CURL_FORMAT_OFF_T + +/* The size of `curl_off_t', as computed by sizeof. */ +#undef CURL_SIZEOF_CURL_OFF_T + +/* curl_off_t constant suffix. */ +#undef CURL_SUFFIX_CURL_OFF_T + +/* unsigned curl_off_t constant suffix. */ +#undef CURL_SUFFIX_CURL_OFF_TU + +#endif /* __CURL_CURLBUILD_H */ diff --git a/phonelibs/curl/include/curl/curlrules.h b/phonelibs/curl/include/curl/curlrules.h new file mode 100644 index 00000000000000..1163e95f48ac87 --- /dev/null +++ b/phonelibs/curl/include/curl/curlrules.h @@ -0,0 +1,248 @@ +#ifndef __CURL_CURLRULES_H +#define __CURL_CURLRULES_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* COMPILE TIME SANITY CHECKS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * All checks done in this file are intentionally placed in a public + * header file which is pulled by curl/curl.h when an application is + * being built using an already built libcurl library. Additionally + * this file is also included and used when building the library. + * + * If compilation fails on this file it is certainly sure that the + * problem is elsewhere. It could be a problem in the curlbuild.h + * header file, or simply that you are using different compilation + * settings than those used to build the library. + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * Do not deactivate any check, these are done to make sure that the + * library is properly built and used. + * + * You can find further help on the libcurl development mailing list: + * http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * NOTE 2 + * ------ + * + * Some of the following compile time checks are based on the fact + * that the dimension of a constant array can not be a negative one. + * In this way if the compile time verification fails, the compilation + * will fail issuing an error. The error description wording is compiler + * dependent but it will be quite similar to one of the following: + * + * "negative subscript or subscript is too large" + * "array must have at least one element" + * "-1 is an illegal array size" + * "size of array is negative" + * + * If you are building an application which tries to use an already + * built libcurl library and you are getting this kind of errors on + * this file, it is a clear indication that there is a mismatch between + * how the library was built and how you are trying to use it for your + * application. Your already compiled or binary library provider is the + * only one who can give you the details you need to properly use it. + */ + +/* + * Verify that some macros are actually defined. + */ + +#ifndef CURL_TYPEOF_CURL_SOCKLEN_T +# error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing +#endif + +#ifndef CURL_SIZEOF_CURL_SOCKLEN_T +# error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing +#endif + +#ifndef CURL_TYPEOF_CURL_OFF_T +# error "CURL_TYPEOF_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_FORMAT_CURL_OFF_T +# error "CURL_FORMAT_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_FORMAT_CURL_OFF_TU +# error "CURL_FORMAT_CURL_OFF_TU definition is missing!" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing +#endif + +#ifndef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T definition is missing!" + Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing +#endif + +#ifndef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_SUFFIX_CURL_OFF_T +# error "CURL_SUFFIX_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_SUFFIX_CURL_OFF_TU +# error "CURL_SUFFIX_CURL_OFF_TU definition is missing!" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing +#endif + +/* + * Macros private to this header file. + */ + +#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 + +#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 + +/* + * Verify that the size previously defined and expected for + * curl_off_t is actually the the same as the one reported + * by sizeof() at compile time. + */ + +typedef char + __curl_rule_02__ + [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; + +/* + * Verify at compile time that the size of curl_off_t as reported + * by sizeof() is greater or equal than the one reported for long + * for the current compilation. + */ + +typedef char + __curl_rule_03__ + [CurlchkszGE(curl_off_t, long)]; + +/* + * Verify that the size previously defined and expected for + * curl_socklen_t is actually the the same as the one reported + * by sizeof() at compile time. + */ + +typedef char + __curl_rule_04__ + [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)]; + +/* + * Verify at compile time that the size of curl_socklen_t as reported + * by sizeof() is greater or equal than the one reported for int for + * the current compilation. + */ + +typedef char + __curl_rule_05__ + [CurlchkszGE(curl_socklen_t, int)]; + +/* ================================================================ */ +/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ +/* ================================================================ */ + +/* + * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow + * these to be visible and exported by the external libcurl interface API, + * while also making them visible to the library internals, simply including + * curl_setup.h, without actually needing to include curl.h internally. + * If some day this section would grow big enough, all this should be moved + * to its own header file. + */ + +/* + * Figure out if we can use the ## preprocessor operator, which is supported + * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ + * or __cplusplus so we need to carefully check for them too. + */ + +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ + defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ + defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ + defined(__ILEC400__) + /* This compiler is believed to have an ISO compatible preprocessor */ +#define CURL_ISOCPP +#else + /* This compiler is believed NOT to have an ISO compatible preprocessor */ +#undef CURL_ISOCPP +#endif + +/* + * Macros for minimum-width signed and unsigned curl_off_t integer constants. + */ + +#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) +# define __CURL_OFF_T_C_HLPR2(x) x +# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x) +# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ + __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) +# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ + __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) +#else +# ifdef CURL_ISOCPP +# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix +# else +# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix +# endif +# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix) +# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) +# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) +#endif + +/* + * Get rid of macros private to this header file. + */ + +#undef CurlchkszEQ +#undef CurlchkszGE + +/* + * Get rid of macros not intended to exist beyond this point. + */ + +#undef CURL_PULL_WS2TCPIP_H +#undef CURL_PULL_SYS_TYPES_H +#undef CURL_PULL_SYS_SOCKET_H +#undef CURL_PULL_SYS_POLL_H +#undef CURL_PULL_STDINT_H +#undef CURL_PULL_INTTYPES_H + +#undef CURL_TYPEOF_CURL_SOCKLEN_T +#undef CURL_TYPEOF_CURL_OFF_T + +#ifdef CURL_NO_OLDIES +#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */ +#endif + +#endif /* __CURL_CURLRULES_H */ diff --git a/phonelibs/curl/include/curl/curlver.h b/phonelibs/curl/include/curl/curlver.h new file mode 100644 index 00000000000000..be442eff8f6441 --- /dev/null +++ b/phonelibs/curl/include/curl/curlver.h @@ -0,0 +1,77 @@ +#ifndef __CURL_CURLVER_H +#define __CURL_CURLVER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* This header file contains nothing but libcurl version info, generated by + a script at release-time. This was made its own header file in 7.11.2 */ + +/* This is the global package copyright */ +#define LIBCURL_COPYRIGHT "1996 - 2015 Daniel Stenberg, ." + +/* This is the version number of the libcurl package from which this header + file origins: */ +#define LIBCURL_VERSION "7.43.0-DEV" + +/* The numeric version number is also available "in parts" by using these + defines: */ +#define LIBCURL_VERSION_MAJOR 7 +#define LIBCURL_VERSION_MINOR 43 +#define LIBCURL_VERSION_PATCH 0 + +/* This is the numeric version of the libcurl version number, meant for easier + parsing and comparions by programs. The LIBCURL_VERSION_NUM define will + always follow this syntax: + + 0xXXYYZZ + + Where XX, YY and ZZ are the main version, release and patch numbers in + hexadecimal (using 8 bits each). All three numbers are always represented + using two digits. 1.2 would appear as "0x010200" while version 9.11.7 + appears as "0x090b07". + + This 6-digit (24 bits) hexadecimal number does not show pre-release number, + and it is always a greater number in a more recent release. It makes + comparisons with greater than and less than work. + + Note: This define is the full hex number and _does not_ use the + CURL_VERSION_BITS() macro since curl's own configure script greps for it + and needs it to contain the full number. +*/ +#define LIBCURL_VERSION_NUM 0x072B00 + +/* + * This is the date and time when the full source package was created. The + * timestamp is not stored in git, as the timestamp is properly set in the + * tarballs by the maketgz script. + * + * The format of the date should follow this template: + * + * "Mon Feb 12 11:35:33 UTC 2007" + */ +#define LIBCURL_TIMESTAMP "DEV" + +#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z) +#define CURL_AT_LEAST_VERSION(x,y,z) \ + (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) + +#endif /* __CURL_CURLVER_H */ diff --git a/phonelibs/curl/include/curl/easy.h b/phonelibs/curl/include/curl/easy.h new file mode 100644 index 00000000000000..c1e3e76096e392 --- /dev/null +++ b/phonelibs/curl/include/curl/easy.h @@ -0,0 +1,102 @@ +#ifndef __CURL_EASY_H +#define __CURL_EASY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +CURL_EXTERN CURL *curl_easy_init(void); +CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); +CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); +CURL_EXTERN void curl_easy_cleanup(CURL *curl); + +/* + * NAME curl_easy_getinfo() + * + * DESCRIPTION + * + * Request internal information from the curl session with this function. The + * third argument MUST be a pointer to a long, a pointer to a char * or a + * pointer to a double (as the documentation describes elsewhere). The data + * pointed to will be filled in accordingly and can be relied upon only if the + * function returns CURLE_OK. This function is intended to get used *AFTER* a + * performed transfer, all results from this function are undefined until the + * transfer is completed. + */ +CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); + + +/* + * NAME curl_easy_duphandle() + * + * DESCRIPTION + * + * Creates a new curl session handle with the same options set for the handle + * passed in. Duplicating a handle could only be a matter of cloning data and + * options, internal state info and things like persistent connections cannot + * be transferred. It is useful in multithreaded applications when you can run + * curl_easy_duphandle() for each new thread to avoid a series of identical + * curl_easy_setopt() invokes in every thread. + */ +CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl); + +/* + * NAME curl_easy_reset() + * + * DESCRIPTION + * + * Re-initializes a CURL handle to the default values. This puts back the + * handle to the same state as it was in when it was just created. + * + * It does keep: live connections, the Session ID cache, the DNS cache and the + * cookies. + */ +CURL_EXTERN void curl_easy_reset(CURL *curl); + +/* + * NAME curl_easy_recv() + * + * DESCRIPTION + * + * Receives data from the connected socket. Use after successful + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. + */ +CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, + size_t *n); + +/* + * NAME curl_easy_send() + * + * DESCRIPTION + * + * Sends data over the connected socket. Use after successful + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. + */ +CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, + size_t buflen, size_t *n); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/curl/include/curl/mprintf.h b/phonelibs/curl/include/curl/mprintf.h new file mode 100644 index 00000000000000..c6b0d7679a6cf9 --- /dev/null +++ b/phonelibs/curl/include/curl/mprintf.h @@ -0,0 +1,74 @@ +#ifndef __CURL_MPRINTF_H +#define __CURL_MPRINTF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include +#include /* needed for FILE */ + +#include "curl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +CURL_EXTERN int curl_mprintf(const char *format, ...); +CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); +CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); +CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, + const char *format, ...); +CURL_EXTERN int curl_mvprintf(const char *format, va_list args); +CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); +CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); +CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, + const char *format, va_list args); +CURL_EXTERN char *curl_maprintf(const char *format, ...); +CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); + +#ifdef _MPRINTF_REPLACE +# undef printf +# undef fprintf +# undef sprintf +# undef vsprintf +# undef snprintf +# undef vprintf +# undef vfprintf +# undef vsnprintf +# undef aprintf +# undef vaprintf +# define printf curl_mprintf +# define fprintf curl_mfprintf +# define sprintf curl_msprintf +# define vsprintf curl_mvsprintf +# define snprintf curl_msnprintf +# define vprintf curl_mvprintf +# define vfprintf curl_mvfprintf +# define vsnprintf curl_mvsnprintf +# define aprintf curl_maprintf +# define vaprintf curl_mvaprintf +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __CURL_MPRINTF_H */ diff --git a/phonelibs/curl/include/curl/multi.h b/phonelibs/curl/include/curl/multi.h new file mode 100644 index 00000000000000..0d859f8fd98c50 --- /dev/null +++ b/phonelibs/curl/include/curl/multi.h @@ -0,0 +1,404 @@ +#ifndef __CURL_MULTI_H +#define __CURL_MULTI_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* + This is an "external" header file. Don't give away any internals here! + + GOALS + + o Enable a "pull" interface. The application that uses libcurl decides where + and when to ask libcurl to get/send data. + + o Enable multiple simultaneous transfers in the same thread without making it + complicated for the application. + + o Enable the application to select() on its own file descriptors and curl's + file descriptors simultaneous easily. + +*/ + +/* + * This header file should not really need to include "curl.h" since curl.h + * itself includes this file and we expect user applications to do #include + * without the need for especially including multi.h. + * + * For some reason we added this include here at one point, and rather than to + * break existing (wrongly written) libcurl applications, we leave it as-is + * but with this warning attached. + */ +#include "curl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void CURLM; + +typedef enum { + CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or + curl_multi_socket*() soon */ + CURLM_OK, + CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ + CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ + CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ + CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ + CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ + CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ + CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was + attempted to get added - again */ + CURLM_LAST +} CURLMcode; + +/* just to make code nicer when using curl_multi_socket() you can now check + for CURLM_CALL_MULTI_SOCKET too in the same style it works for + curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ +#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM + +/* bitmask bits for CURLMOPT_PIPELINING */ +#define CURLPIPE_NOTHING 0L +#define CURLPIPE_HTTP1 1L +#define CURLPIPE_MULTIPLEX 2L + +typedef enum { + CURLMSG_NONE, /* first, not used */ + CURLMSG_DONE, /* This easy handle has completed. 'result' contains + the CURLcode of the transfer */ + CURLMSG_LAST /* last, not used */ +} CURLMSG; + +struct CURLMsg { + CURLMSG msg; /* what this message means */ + CURL *easy_handle; /* the handle it concerns */ + union { + void *whatever; /* message-specific data */ + CURLcode result; /* return code for transfer */ + } data; +}; +typedef struct CURLMsg CURLMsg; + +/* Based on poll(2) structure and values. + * We don't use pollfd and POLL* constants explicitly + * to cover platforms without poll(). */ +#define CURL_WAIT_POLLIN 0x0001 +#define CURL_WAIT_POLLPRI 0x0002 +#define CURL_WAIT_POLLOUT 0x0004 + +struct curl_waitfd { + curl_socket_t fd; + short events; + short revents; /* not supported yet */ +}; + +/* + * Name: curl_multi_init() + * + * Desc: inititalize multi-style curl usage + * + * Returns: a new CURLM handle to use in all 'curl_multi' functions. + */ +CURL_EXTERN CURLM *curl_multi_init(void); + +/* + * Name: curl_multi_add_handle() + * + * Desc: add a standard curl handle to the multi stack + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, + CURL *curl_handle); + + /* + * Name: curl_multi_remove_handle() + * + * Desc: removes a curl handle from the multi stack again + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, + CURL *curl_handle); + + /* + * Name: curl_multi_fdset() + * + * Desc: Ask curl for its fd_set sets. The app can use these to select() or + * poll() on. We want curl_multi_perform() called as soon as one of + * them are ready. + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *exc_fd_set, + int *max_fd); + +/* + * Name: curl_multi_wait() + * + * Desc: Poll on all fds within a CURLM set as well as any + * additional fds passed to the function. + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, + struct curl_waitfd extra_fds[], + unsigned int extra_nfds, + int timeout_ms, + int *ret); + + /* + * Name: curl_multi_perform() + * + * Desc: When the app thinks there's data available for curl it calls this + * function to read/write whatever there is right now. This returns + * as soon as the reads and writes are done. This function does not + * require that there actually is data available for reading or that + * data can be written, it can be called just in case. It returns + * the number of handles that still transfer data in the second + * argument's integer-pointer. + * + * Returns: CURLMcode type, general multi error code. *NOTE* that this only + * returns errors etc regarding the whole multi stack. There might + * still have occurred problems on invidual transfers even when this + * returns OK. + */ +CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, + int *running_handles); + + /* + * Name: curl_multi_cleanup() + * + * Desc: Cleans up and removes a whole multi stack. It does not free or + * touch any individual easy handles in any way. We need to define + * in what state those handles will be if this function is called + * in the middle of a transfer. + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); + +/* + * Name: curl_multi_info_read() + * + * Desc: Ask the multi handle if there's any messages/informationals from + * the individual transfers. Messages include informationals such as + * error code from the transfer or just the fact that a transfer is + * completed. More details on these should be written down as well. + * + * Repeated calls to this function will return a new struct each + * time, until a special "end of msgs" struct is returned as a signal + * that there is no more to get at this point. + * + * The data the returned pointer points to will not survive calling + * curl_multi_cleanup(). + * + * The 'CURLMsg' struct is meant to be very simple and only contain + * very basic informations. If more involved information is wanted, + * we will provide the particular "transfer handle" in that struct + * and that should/could/would be used in subsequent + * curl_easy_getinfo() calls (or similar). The point being that we + * must never expose complex structs to applications, as then we'll + * undoubtably get backwards compatibility problems in the future. + * + * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out + * of structs. It also writes the number of messages left in the + * queue (after this read) in the integer the second argument points + * to. + */ +CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, + int *msgs_in_queue); + +/* + * Name: curl_multi_strerror() + * + * Desc: The curl_multi_strerror function may be used to turn a CURLMcode + * value into the equivalent human readable error string. This is + * useful for printing meaningful error messages. + * + * Returns: A pointer to a zero-terminated error message. + */ +CURL_EXTERN const char *curl_multi_strerror(CURLMcode); + +/* + * Name: curl_multi_socket() and + * curl_multi_socket_all() + * + * Desc: An alternative version of curl_multi_perform() that allows the + * application to pass in one of the file descriptors that have been + * detected to have "action" on them and let libcurl perform. + * See man page for details. + */ +#define CURL_POLL_NONE 0 +#define CURL_POLL_IN 1 +#define CURL_POLL_OUT 2 +#define CURL_POLL_INOUT 3 +#define CURL_POLL_REMOVE 4 + +#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD + +#define CURL_CSELECT_IN 0x01 +#define CURL_CSELECT_OUT 0x02 +#define CURL_CSELECT_ERR 0x04 + +typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ + curl_socket_t s, /* socket */ + int what, /* see above */ + void *userp, /* private callback + pointer */ + void *socketp); /* private socket + pointer */ +/* + * Name: curl_multi_timer_callback + * + * Desc: Called by libcurl whenever the library detects a change in the + * maximum number of milliseconds the app is allowed to wait before + * curl_multi_socket() or curl_multi_perform() must be called + * (to allow libcurl's timed events to take place). + * + * Returns: The callback should return zero. + */ +typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ + long timeout_ms, /* see above */ + void *userp); /* private callback + pointer */ + +CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, + int *running_handles); + +CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, + curl_socket_t s, + int ev_bitmask, + int *running_handles); + +CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, + int *running_handles); + +#ifndef CURL_ALLOW_OLD_MULTI_SOCKET +/* This macro below was added in 7.16.3 to push users who recompile to use + the new curl_multi_socket_action() instead of the old curl_multi_socket() +*/ +#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) +#endif + +/* + * Name: curl_multi_timeout() + * + * Desc: Returns the maximum number of milliseconds the app is allowed to + * wait before curl_multi_socket() or curl_multi_perform() must be + * called (to allow libcurl's timed events to take place). + * + * Returns: CURLM error code. + */ +CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, + long *milliseconds); + +#undef CINIT /* re-using the same name as in curl.h */ + +#ifdef CURL_ISOCPP +#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define LONG CURLOPTTYPE_LONG +#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT +#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT +#define OFF_T CURLOPTTYPE_OFF_T +#define CINIT(name,type,number) CURLMOPT_/**/name = type + number +#endif + +typedef enum { + /* This is the socket callback function pointer */ + CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1), + + /* This is the argument passed to the socket callback */ + CINIT(SOCKETDATA, OBJECTPOINT, 2), + + /* set to 1 to enable pipelining for this multi handle */ + CINIT(PIPELINING, LONG, 3), + + /* This is the timer callback function pointer */ + CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4), + + /* This is the argument passed to the timer callback */ + CINIT(TIMERDATA, OBJECTPOINT, 5), + + /* maximum number of entries in the connection cache */ + CINIT(MAXCONNECTS, LONG, 6), + + /* maximum number of (pipelining) connections to one host */ + CINIT(MAX_HOST_CONNECTIONS, LONG, 7), + + /* maximum number of requests in a pipeline */ + CINIT(MAX_PIPELINE_LENGTH, LONG, 8), + + /* a connection with a content-length longer than this + will not be considered for pipelining */ + CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9), + + /* a connection with a chunk length longer than this + will not be considered for pipelining */ + CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10), + + /* a list of site names(+port) that are blacklisted from + pipelining */ + CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11), + + /* a list of server types that are blacklisted from + pipelining */ + CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12), + + /* maximum number of open connections in total */ + CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13), + + CURLMOPT_LASTENTRY /* the last unused */ +} CURLMoption; + + +/* + * Name: curl_multi_setopt() + * + * Desc: Sets options for the multi handle. + * + * Returns: CURLM error code. + */ +CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, + CURLMoption option, ...); + + +/* + * Name: curl_multi_assign() + * + * Desc: This function sets an association in the multi handle between the + * given socket and a private pointer of the application. This is + * (only) useful for curl_multi_socket uses. + * + * Returns: CURLM error code. + */ +CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, + curl_socket_t sockfd, void *sockp); + +#ifdef __cplusplus +} /* end of extern "C" */ +#endif + +#endif diff --git a/phonelibs/curl/include/curl/stdcheaders.h b/phonelibs/curl/include/curl/stdcheaders.h new file mode 100644 index 00000000000000..ad82ef6335d616 --- /dev/null +++ b/phonelibs/curl/include/curl/stdcheaders.h @@ -0,0 +1,33 @@ +#ifndef __STDC_HEADERS_H +#define __STDC_HEADERS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include + +size_t fread (void *, size_t, size_t, FILE *); +size_t fwrite (const void *, size_t, size_t, FILE *); + +int strcasecmp(const char *, const char *); +int strncasecmp(const char *, const char *, size_t); + +#endif /* __STDC_HEADERS_H */ diff --git a/phonelibs/curl/include/curl/typecheck-gcc.h b/phonelibs/curl/include/curl/typecheck-gcc.h new file mode 100644 index 00000000000000..13fb0fa9ee3d21 --- /dev/null +++ b/phonelibs/curl/include/curl/typecheck-gcc.h @@ -0,0 +1,612 @@ +#ifndef __CURL_TYPECHECK_GCC_H +#define __CURL_TYPECHECK_GCC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* wraps curl_easy_setopt() with typechecking */ + +/* To add a new kind of warning, add an + * if(_curl_is_sometype_option(_curl_opt)) + * if(!_curl_is_sometype(value)) + * _curl_easy_setopt_err_sometype(); + * block and define _curl_is_sometype_option, _curl_is_sometype and + * _curl_easy_setopt_err_sometype below + * + * NOTE: We use two nested 'if' statements here instead of the && operator, in + * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x + * when compiling with -Wlogical-op. + * + * To add an option that uses the same type as an existing option, you'll just + * need to extend the appropriate _curl_*_option macro + */ +#define curl_easy_setopt(handle, option, value) \ +__extension__ ({ \ + __typeof__ (option) _curl_opt = option; \ + if(__builtin_constant_p(_curl_opt)) { \ + if(_curl_is_long_option(_curl_opt)) \ + if(!_curl_is_long(value)) \ + _curl_easy_setopt_err_long(); \ + if(_curl_is_off_t_option(_curl_opt)) \ + if(!_curl_is_off_t(value)) \ + _curl_easy_setopt_err_curl_off_t(); \ + if(_curl_is_string_option(_curl_opt)) \ + if(!_curl_is_string(value)) \ + _curl_easy_setopt_err_string(); \ + if(_curl_is_write_cb_option(_curl_opt)) \ + if(!_curl_is_write_cb(value)) \ + _curl_easy_setopt_err_write_callback(); \ + if((_curl_opt) == CURLOPT_READFUNCTION) \ + if(!_curl_is_read_cb(value)) \ + _curl_easy_setopt_err_read_cb(); \ + if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ + if(!_curl_is_ioctl_cb(value)) \ + _curl_easy_setopt_err_ioctl_cb(); \ + if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ + if(!_curl_is_sockopt_cb(value)) \ + _curl_easy_setopt_err_sockopt_cb(); \ + if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ + if(!_curl_is_opensocket_cb(value)) \ + _curl_easy_setopt_err_opensocket_cb(); \ + if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ + if(!_curl_is_progress_cb(value)) \ + _curl_easy_setopt_err_progress_cb(); \ + if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ + if(!_curl_is_debug_cb(value)) \ + _curl_easy_setopt_err_debug_cb(); \ + if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ + if(!_curl_is_ssl_ctx_cb(value)) \ + _curl_easy_setopt_err_ssl_ctx_cb(); \ + if(_curl_is_conv_cb_option(_curl_opt)) \ + if(!_curl_is_conv_cb(value)) \ + _curl_easy_setopt_err_conv_cb(); \ + if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ + if(!_curl_is_seek_cb(value)) \ + _curl_easy_setopt_err_seek_cb(); \ + if(_curl_is_cb_data_option(_curl_opt)) \ + if(!_curl_is_cb_data(value)) \ + _curl_easy_setopt_err_cb_data(); \ + if((_curl_opt) == CURLOPT_ERRORBUFFER) \ + if(!_curl_is_error_buffer(value)) \ + _curl_easy_setopt_err_error_buffer(); \ + if((_curl_opt) == CURLOPT_STDERR) \ + if(!_curl_is_FILE(value)) \ + _curl_easy_setopt_err_FILE(); \ + if(_curl_is_postfields_option(_curl_opt)) \ + if(!_curl_is_postfields(value)) \ + _curl_easy_setopt_err_postfields(); \ + if((_curl_opt) == CURLOPT_HTTPPOST) \ + if(!_curl_is_arr((value), struct curl_httppost)) \ + _curl_easy_setopt_err_curl_httpost(); \ + if(_curl_is_slist_option(_curl_opt)) \ + if(!_curl_is_arr((value), struct curl_slist)) \ + _curl_easy_setopt_err_curl_slist(); \ + if((_curl_opt) == CURLOPT_SHARE) \ + if(!_curl_is_ptr((value), CURLSH)) \ + _curl_easy_setopt_err_CURLSH(); \ + } \ + curl_easy_setopt(handle, _curl_opt, value); \ +}) + +/* wraps curl_easy_getinfo() with typechecking */ +/* FIXME: don't allow const pointers */ +#define curl_easy_getinfo(handle, info, arg) \ +__extension__ ({ \ + __typeof__ (info) _curl_info = info; \ + if(__builtin_constant_p(_curl_info)) { \ + if(_curl_is_string_info(_curl_info)) \ + if(!_curl_is_arr((arg), char *)) \ + _curl_easy_getinfo_err_string(); \ + if(_curl_is_long_info(_curl_info)) \ + if(!_curl_is_arr((arg), long)) \ + _curl_easy_getinfo_err_long(); \ + if(_curl_is_double_info(_curl_info)) \ + if(!_curl_is_arr((arg), double)) \ + _curl_easy_getinfo_err_double(); \ + if(_curl_is_slist_info(_curl_info)) \ + if(!_curl_is_arr((arg), struct curl_slist *)) \ + _curl_easy_getinfo_err_curl_slist(); \ + } \ + curl_easy_getinfo(handle, _curl_info, arg); \ +}) + +/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(), + * for now just make sure that the functions are called with three + * arguments + */ +#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) +#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) + + +/* the actual warnings, triggered by calling the _curl_easy_setopt_err* + * functions */ + +/* To define a new warning, use _CURL_WARNING(identifier, "message") */ +#define _CURL_WARNING(id, message) \ + static void __attribute__((__warning__(message))) \ + __attribute__((__unused__)) __attribute__((__noinline__)) \ + id(void) { __asm__(""); } + +_CURL_WARNING(_curl_easy_setopt_err_long, + "curl_easy_setopt expects a long argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_curl_off_t, + "curl_easy_setopt expects a curl_off_t argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_string, + "curl_easy_setopt expects a " + "string (char* or char[]) argument for this option" + ) +_CURL_WARNING(_curl_easy_setopt_err_write_callback, + "curl_easy_setopt expects a curl_write_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_read_cb, + "curl_easy_setopt expects a curl_read_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb, + "curl_easy_setopt expects a curl_ioctl_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb, + "curl_easy_setopt expects a curl_sockopt_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb, + "curl_easy_setopt expects a " + "curl_opensocket_callback argument for this option" + ) +_CURL_WARNING(_curl_easy_setopt_err_progress_cb, + "curl_easy_setopt expects a curl_progress_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_debug_cb, + "curl_easy_setopt expects a curl_debug_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb, + "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_conv_cb, + "curl_easy_setopt expects a curl_conv_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_seek_cb, + "curl_easy_setopt expects a curl_seek_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_cb_data, + "curl_easy_setopt expects a " + "private data pointer as argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_error_buffer, + "curl_easy_setopt expects a " + "char buffer of CURL_ERROR_SIZE as argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_FILE, + "curl_easy_setopt expects a FILE* argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_postfields, + "curl_easy_setopt expects a void* or char* argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_curl_httpost, + "curl_easy_setopt expects a struct curl_httppost* argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_curl_slist, + "curl_easy_setopt expects a struct curl_slist* argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_CURLSH, + "curl_easy_setopt expects a CURLSH* argument for this option") + +_CURL_WARNING(_curl_easy_getinfo_err_string, + "curl_easy_getinfo expects a pointer to char * for this info") +_CURL_WARNING(_curl_easy_getinfo_err_long, + "curl_easy_getinfo expects a pointer to long for this info") +_CURL_WARNING(_curl_easy_getinfo_err_double, + "curl_easy_getinfo expects a pointer to double for this info") +_CURL_WARNING(_curl_easy_getinfo_err_curl_slist, + "curl_easy_getinfo expects a pointer to struct curl_slist * for this info") + +/* groups of curl_easy_setops options that take the same type of argument */ + +/* To add a new option to one of the groups, just add + * (option) == CURLOPT_SOMETHING + * to the or-expression. If the option takes a long or curl_off_t, you don't + * have to do anything + */ + +/* evaluates to true if option takes a long argument */ +#define _curl_is_long_option(option) \ + (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT) + +#define _curl_is_off_t_option(option) \ + ((option) > CURLOPTTYPE_OFF_T) + +/* evaluates to true if option takes a char* argument */ +#define _curl_is_string_option(option) \ + ((option) == CURLOPT_URL || \ + (option) == CURLOPT_PROXY || \ + (option) == CURLOPT_INTERFACE || \ + (option) == CURLOPT_NETRC_FILE || \ + (option) == CURLOPT_USERPWD || \ + (option) == CURLOPT_USERNAME || \ + (option) == CURLOPT_PASSWORD || \ + (option) == CURLOPT_PROXYUSERPWD || \ + (option) == CURLOPT_PROXYUSERNAME || \ + (option) == CURLOPT_PROXYPASSWORD || \ + (option) == CURLOPT_NOPROXY || \ + (option) == CURLOPT_ACCEPT_ENCODING || \ + (option) == CURLOPT_REFERER || \ + (option) == CURLOPT_USERAGENT || \ + (option) == CURLOPT_COOKIE || \ + (option) == CURLOPT_COOKIEFILE || \ + (option) == CURLOPT_COOKIEJAR || \ + (option) == CURLOPT_COOKIELIST || \ + (option) == CURLOPT_FTPPORT || \ + (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \ + (option) == CURLOPT_FTP_ACCOUNT || \ + (option) == CURLOPT_RANGE || \ + (option) == CURLOPT_CUSTOMREQUEST || \ + (option) == CURLOPT_SSLCERT || \ + (option) == CURLOPT_SSLCERTTYPE || \ + (option) == CURLOPT_SSLKEY || \ + (option) == CURLOPT_SSLKEYTYPE || \ + (option) == CURLOPT_KEYPASSWD || \ + (option) == CURLOPT_SSLENGINE || \ + (option) == CURLOPT_CAINFO || \ + (option) == CURLOPT_CAPATH || \ + (option) == CURLOPT_RANDOM_FILE || \ + (option) == CURLOPT_EGDSOCKET || \ + (option) == CURLOPT_SSL_CIPHER_LIST || \ + (option) == CURLOPT_KRBLEVEL || \ + (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \ + (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \ + (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \ + (option) == CURLOPT_CRLFILE || \ + (option) == CURLOPT_ISSUERCERT || \ + (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \ + (option) == CURLOPT_SSH_KNOWNHOSTS || \ + (option) == CURLOPT_MAIL_FROM || \ + (option) == CURLOPT_RTSP_SESSION_ID || \ + (option) == CURLOPT_RTSP_STREAM_URI || \ + (option) == CURLOPT_RTSP_TRANSPORT || \ + (option) == CURLOPT_XOAUTH2_BEARER || \ + (option) == CURLOPT_DNS_SERVERS || \ + (option) == CURLOPT_DNS_INTERFACE || \ + (option) == CURLOPT_DNS_LOCAL_IP4 || \ + (option) == CURLOPT_DNS_LOCAL_IP6 || \ + (option) == CURLOPT_LOGIN_OPTIONS || \ + (option) == CURLOPT_PROXY_SERVICE_NAME || \ + (option) == CURLOPT_SERVICE_NAME || \ + 0) + +/* evaluates to true if option takes a curl_write_callback argument */ +#define _curl_is_write_cb_option(option) \ + ((option) == CURLOPT_HEADERFUNCTION || \ + (option) == CURLOPT_WRITEFUNCTION) + +/* evaluates to true if option takes a curl_conv_callback argument */ +#define _curl_is_conv_cb_option(option) \ + ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \ + (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \ + (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION) + +/* evaluates to true if option takes a data argument to pass to a callback */ +#define _curl_is_cb_data_option(option) \ + ((option) == CURLOPT_WRITEDATA || \ + (option) == CURLOPT_READDATA || \ + (option) == CURLOPT_IOCTLDATA || \ + (option) == CURLOPT_SOCKOPTDATA || \ + (option) == CURLOPT_OPENSOCKETDATA || \ + (option) == CURLOPT_PROGRESSDATA || \ + (option) == CURLOPT_HEADERDATA || \ + (option) == CURLOPT_DEBUGDATA || \ + (option) == CURLOPT_SSL_CTX_DATA || \ + (option) == CURLOPT_SEEKDATA || \ + (option) == CURLOPT_PRIVATE || \ + (option) == CURLOPT_SSH_KEYDATA || \ + (option) == CURLOPT_INTERLEAVEDATA || \ + (option) == CURLOPT_CHUNK_DATA || \ + (option) == CURLOPT_FNMATCH_DATA || \ + 0) + +/* evaluates to true if option takes a POST data argument (void* or char*) */ +#define _curl_is_postfields_option(option) \ + ((option) == CURLOPT_POSTFIELDS || \ + (option) == CURLOPT_COPYPOSTFIELDS || \ + 0) + +/* evaluates to true if option takes a struct curl_slist * argument */ +#define _curl_is_slist_option(option) \ + ((option) == CURLOPT_HTTPHEADER || \ + (option) == CURLOPT_HTTP200ALIASES || \ + (option) == CURLOPT_QUOTE || \ + (option) == CURLOPT_POSTQUOTE || \ + (option) == CURLOPT_PREQUOTE || \ + (option) == CURLOPT_TELNETOPTIONS || \ + (option) == CURLOPT_MAIL_RCPT || \ + 0) + +/* groups of curl_easy_getinfo infos that take the same type of argument */ + +/* evaluates to true if info expects a pointer to char * argument */ +#define _curl_is_string_info(info) \ + (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG) + +/* evaluates to true if info expects a pointer to long argument */ +#define _curl_is_long_info(info) \ + (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE) + +/* evaluates to true if info expects a pointer to double argument */ +#define _curl_is_double_info(info) \ + (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST) + +/* true if info expects a pointer to struct curl_slist * argument */ +#define _curl_is_slist_info(info) \ + (CURLINFO_SLIST < (info)) + + +/* typecheck helpers -- check whether given expression has requested type*/ + +/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros, + * otherwise define a new macro. Search for __builtin_types_compatible_p + * in the GCC manual. + * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is + * the actual expression passed to the curl_easy_setopt macro. This + * means that you can only apply the sizeof and __typeof__ operators, no + * == or whatsoever. + */ + +/* XXX: should evaluate to true iff expr is a pointer */ +#define _curl_is_any_ptr(expr) \ + (sizeof(expr) == sizeof(void*)) + +/* evaluates to true if expr is NULL */ +/* XXX: must not evaluate expr, so this check is not accurate */ +#define _curl_is_NULL(expr) \ + (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL))) + +/* evaluates to true if expr is type*, const type* or NULL */ +#define _curl_is_ptr(expr, type) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), type *) || \ + __builtin_types_compatible_p(__typeof__(expr), const type *)) + +/* evaluates to true if expr is one of type[], type*, NULL or const type* */ +#define _curl_is_arr(expr, type) \ + (_curl_is_ptr((expr), type) || \ + __builtin_types_compatible_p(__typeof__(expr), type [])) + +/* evaluates to true if expr is a string */ +#define _curl_is_string(expr) \ + (_curl_is_arr((expr), char) || \ + _curl_is_arr((expr), signed char) || \ + _curl_is_arr((expr), unsigned char)) + +/* evaluates to true if expr is a long (no matter the signedness) + * XXX: for now, int is also accepted (and therefore short and char, which + * are promoted to int when passed to a variadic function) */ +#define _curl_is_long(expr) \ + (__builtin_types_compatible_p(__typeof__(expr), long) || \ + __builtin_types_compatible_p(__typeof__(expr), signed long) || \ + __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \ + __builtin_types_compatible_p(__typeof__(expr), int) || \ + __builtin_types_compatible_p(__typeof__(expr), signed int) || \ + __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \ + __builtin_types_compatible_p(__typeof__(expr), short) || \ + __builtin_types_compatible_p(__typeof__(expr), signed short) || \ + __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \ + __builtin_types_compatible_p(__typeof__(expr), char) || \ + __builtin_types_compatible_p(__typeof__(expr), signed char) || \ + __builtin_types_compatible_p(__typeof__(expr), unsigned char)) + +/* evaluates to true if expr is of type curl_off_t */ +#define _curl_is_off_t(expr) \ + (__builtin_types_compatible_p(__typeof__(expr), curl_off_t)) + +/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ +/* XXX: also check size of an char[] array? */ +#define _curl_is_error_buffer(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), char *) || \ + __builtin_types_compatible_p(__typeof__(expr), char[])) + +/* evaluates to true if expr is of type (const) void* or (const) FILE* */ +#if 0 +#define _curl_is_cb_data(expr) \ + (_curl_is_ptr((expr), void) || \ + _curl_is_ptr((expr), FILE)) +#else /* be less strict */ +#define _curl_is_cb_data(expr) \ + _curl_is_any_ptr(expr) +#endif + +/* evaluates to true if expr is of type FILE* */ +#define _curl_is_FILE(expr) \ + (__builtin_types_compatible_p(__typeof__(expr), FILE *)) + +/* evaluates to true if expr can be passed as POST data (void* or char*) */ +#define _curl_is_postfields(expr) \ + (_curl_is_ptr((expr), void) || \ + _curl_is_arr((expr), char)) + +/* FIXME: the whole callback checking is messy... + * The idea is to tolerate char vs. void and const vs. not const + * pointers in arguments at least + */ +/* helper: __builtin_types_compatible_p distinguishes between functions and + * function pointers, hide it */ +#define _curl_callback_compatible(func, type) \ + (__builtin_types_compatible_p(__typeof__(func), type) || \ + __builtin_types_compatible_p(__typeof__(func), type*)) + +/* evaluates to true if expr is of type curl_read_callback or "similar" */ +#define _curl_is_read_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) || \ + _curl_callback_compatible((expr), _curl_read_callback1) || \ + _curl_callback_compatible((expr), _curl_read_callback2) || \ + _curl_callback_compatible((expr), _curl_read_callback3) || \ + _curl_callback_compatible((expr), _curl_read_callback4) || \ + _curl_callback_compatible((expr), _curl_read_callback5) || \ + _curl_callback_compatible((expr), _curl_read_callback6)) +typedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*); +typedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*); +typedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*); +typedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*); +typedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*); +typedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*); + +/* evaluates to true if expr is of type curl_write_callback or "similar" */ +#define _curl_is_write_cb(expr) \ + (_curl_is_read_cb(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) || \ + _curl_callback_compatible((expr), _curl_write_callback1) || \ + _curl_callback_compatible((expr), _curl_write_callback2) || \ + _curl_callback_compatible((expr), _curl_write_callback3) || \ + _curl_callback_compatible((expr), _curl_write_callback4) || \ + _curl_callback_compatible((expr), _curl_write_callback5) || \ + _curl_callback_compatible((expr), _curl_write_callback6)) +typedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*); +typedef size_t (_curl_write_callback2)(const char *, size_t, size_t, + const void*); +typedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*); +typedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*); +typedef size_t (_curl_write_callback5)(const void *, size_t, size_t, + const void*); +typedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*); + +/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */ +#define _curl_is_ioctl_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) || \ + _curl_callback_compatible((expr), _curl_ioctl_callback1) || \ + _curl_callback_compatible((expr), _curl_ioctl_callback2) || \ + _curl_callback_compatible((expr), _curl_ioctl_callback3) || \ + _curl_callback_compatible((expr), _curl_ioctl_callback4)) +typedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*); +typedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*); +typedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*); +typedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*); + +/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */ +#define _curl_is_sockopt_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) || \ + _curl_callback_compatible((expr), _curl_sockopt_callback1) || \ + _curl_callback_compatible((expr), _curl_sockopt_callback2)) +typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); +typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t, + curlsocktype); + +/* evaluates to true if expr is of type curl_opensocket_callback or + "similar" */ +#define _curl_is_opensocket_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\ + _curl_callback_compatible((expr), _curl_opensocket_callback1) || \ + _curl_callback_compatible((expr), _curl_opensocket_callback2) || \ + _curl_callback_compatible((expr), _curl_opensocket_callback3) || \ + _curl_callback_compatible((expr), _curl_opensocket_callback4)) +typedef curl_socket_t (_curl_opensocket_callback1) + (void *, curlsocktype, struct curl_sockaddr *); +typedef curl_socket_t (_curl_opensocket_callback2) + (void *, curlsocktype, const struct curl_sockaddr *); +typedef curl_socket_t (_curl_opensocket_callback3) + (const void *, curlsocktype, struct curl_sockaddr *); +typedef curl_socket_t (_curl_opensocket_callback4) + (const void *, curlsocktype, const struct curl_sockaddr *); + +/* evaluates to true if expr is of type curl_progress_callback or "similar" */ +#define _curl_is_progress_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) || \ + _curl_callback_compatible((expr), _curl_progress_callback1) || \ + _curl_callback_compatible((expr), _curl_progress_callback2)) +typedef int (_curl_progress_callback1)(void *, + double, double, double, double); +typedef int (_curl_progress_callback2)(const void *, + double, double, double, double); + +/* evaluates to true if expr is of type curl_debug_callback or "similar" */ +#define _curl_is_debug_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) || \ + _curl_callback_compatible((expr), _curl_debug_callback1) || \ + _curl_callback_compatible((expr), _curl_debug_callback2) || \ + _curl_callback_compatible((expr), _curl_debug_callback3) || \ + _curl_callback_compatible((expr), _curl_debug_callback4) || \ + _curl_callback_compatible((expr), _curl_debug_callback5) || \ + _curl_callback_compatible((expr), _curl_debug_callback6) || \ + _curl_callback_compatible((expr), _curl_debug_callback7) || \ + _curl_callback_compatible((expr), _curl_debug_callback8)) +typedef int (_curl_debug_callback1) (CURL *, + curl_infotype, char *, size_t, void *); +typedef int (_curl_debug_callback2) (CURL *, + curl_infotype, char *, size_t, const void *); +typedef int (_curl_debug_callback3) (CURL *, + curl_infotype, const char *, size_t, void *); +typedef int (_curl_debug_callback4) (CURL *, + curl_infotype, const char *, size_t, const void *); +typedef int (_curl_debug_callback5) (CURL *, + curl_infotype, unsigned char *, size_t, void *); +typedef int (_curl_debug_callback6) (CURL *, + curl_infotype, unsigned char *, size_t, const void *); +typedef int (_curl_debug_callback7) (CURL *, + curl_infotype, const unsigned char *, size_t, void *); +typedef int (_curl_debug_callback8) (CURL *, + curl_infotype, const unsigned char *, size_t, const void *); + +/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ +/* this is getting even messier... */ +#define _curl_is_ssl_ctx_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback8)) +typedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *); +typedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *); +typedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *); +typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *); +#ifdef HEADER_SSL_H +/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX + * this will of course break if we're included before OpenSSL headers... + */ +typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *); +typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *); +typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *); +typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, + const void *); +#else +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7; +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8; +#endif + +/* evaluates to true if expr is of type curl_conv_callback or "similar" */ +#define _curl_is_conv_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) || \ + _curl_callback_compatible((expr), _curl_conv_callback1) || \ + _curl_callback_compatible((expr), _curl_conv_callback2) || \ + _curl_callback_compatible((expr), _curl_conv_callback3) || \ + _curl_callback_compatible((expr), _curl_conv_callback4)) +typedef CURLcode (*_curl_conv_callback1)(char *, size_t length); +typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length); +typedef CURLcode (*_curl_conv_callback3)(void *, size_t length); +typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length); + +/* evaluates to true if expr is of type curl_seek_callback or "similar" */ +#define _curl_is_seek_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) || \ + _curl_callback_compatible((expr), _curl_seek_callback1) || \ + _curl_callback_compatible((expr), _curl_seek_callback2)) +typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int); +typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int); + + +#endif /* __CURL_TYPECHECK_GCC_H */ diff --git a/phonelibs/curl/lib/libcurl.a b/phonelibs/curl/lib/libcurl.a new file mode 100644 index 00000000000000..494ac6c043c192 Binary files /dev/null and b/phonelibs/curl/lib/libcurl.a differ diff --git a/phonelibs/json11/json11.cpp b/phonelibs/json11/json11.cpp new file mode 100644 index 00000000000000..bc4045f07d1954 --- /dev/null +++ b/phonelibs/json11/json11.cpp @@ -0,0 +1,784 @@ +/* Copyright (c) 2013 Dropbox, Inc. + * + * 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 "json11.hpp" +#include +#include +#include +#include +#include + +namespace json11 { + +static const int max_depth = 200; + +using std::string; +using std::vector; +using std::map; +using std::make_shared; +using std::initializer_list; +using std::move; + +/* Helper for representing null - just a do-nothing struct, plus comparison + * operators so the helpers in JsonValue work. We can't use nullptr_t because + * it may not be orderable. + */ +struct NullStruct { + bool operator==(NullStruct) const { return true; } + bool operator<(NullStruct) const { return false; } +}; + +/* * * * * * * * * * * * * * * * * * * * + * Serialization + */ + +static void dump(NullStruct, string &out) { + out += "null"; +} + +static void dump(double value, string &out) { + if (std::isfinite(value)) { + char buf[32]; + snprintf(buf, sizeof buf, "%.17g", value); + out += buf; + } else { + out += "null"; + } +} + +static void dump(int value, string &out) { + char buf[32]; + snprintf(buf, sizeof buf, "%d", value); + out += buf; +} + +static void dump(bool value, string &out) { + out += value ? "true" : "false"; +} + +static void dump(const string &value, string &out) { + out += '"'; + for (size_t i = 0; i < value.length(); i++) { + const char ch = value[i]; + if (ch == '\\') { + out += "\\\\"; + } else if (ch == '"') { + out += "\\\""; + } else if (ch == '\b') { + out += "\\b"; + } else if (ch == '\f') { + out += "\\f"; + } else if (ch == '\n') { + out += "\\n"; + } else if (ch == '\r') { + out += "\\r"; + } else if (ch == '\t') { + out += "\\t"; + } else if (static_cast(ch) <= 0x1f) { + char buf[8]; + snprintf(buf, sizeof buf, "\\u%04x", ch); + out += buf; + } else if (static_cast(ch) == 0xe2 && static_cast(value[i+1]) == 0x80 + && static_cast(value[i+2]) == 0xa8) { + out += "\\u2028"; + i += 2; + } else if (static_cast(ch) == 0xe2 && static_cast(value[i+1]) == 0x80 + && static_cast(value[i+2]) == 0xa9) { + out += "\\u2029"; + i += 2; + } else { + out += ch; + } + } + out += '"'; +} + +static void dump(const Json::array &values, string &out) { + bool first = true; + out += "["; + for (const auto &value : values) { + if (!first) + out += ", "; + value.dump(out); + first = false; + } + out += "]"; +} + +static void dump(const Json::object &values, string &out) { + bool first = true; + out += "{"; + for (const auto &kv : values) { + if (!first) + out += ", "; + dump(kv.first, out); + out += ": "; + kv.second.dump(out); + first = false; + } + out += "}"; +} + +void Json::dump(string &out) const { + m_ptr->dump(out); +} + +/* * * * * * * * * * * * * * * * * * * * + * Value wrappers + */ + +template +class Value : public JsonValue { +protected: + + // Constructors + explicit Value(const T &value) : m_value(value) {} + explicit Value(T &&value) : m_value(move(value)) {} + + // Get type tag + Json::Type type() const override { + return tag; + } + + // Comparisons + bool equals(const JsonValue * other) const override { + return m_value == static_cast *>(other)->m_value; + } + bool less(const JsonValue * other) const override { + return m_value < static_cast *>(other)->m_value; + } + + const T m_value; + void dump(string &out) const override { json11::dump(m_value, out); } +}; + +class JsonDouble final : public Value { + double number_value() const override { return m_value; } + int int_value() const override { return static_cast(m_value); } + bool equals(const JsonValue * other) const override { return m_value == other->number_value(); } + bool less(const JsonValue * other) const override { return m_value < other->number_value(); } +public: + explicit JsonDouble(double value) : Value(value) {} +}; + +class JsonInt final : public Value { + double number_value() const override { return m_value; } + int int_value() const override { return m_value; } + bool equals(const JsonValue * other) const override { return m_value == other->number_value(); } + bool less(const JsonValue * other) const override { return m_value < other->number_value(); } +public: + explicit JsonInt(int value) : Value(value) {} +}; + +class JsonBoolean final : public Value { + bool bool_value() const override { return m_value; } +public: + explicit JsonBoolean(bool value) : Value(value) {} +}; + +class JsonString final : public Value { + const string &string_value() const override { return m_value; } +public: + explicit JsonString(const string &value) : Value(value) {} + explicit JsonString(string &&value) : Value(move(value)) {} +}; + +class JsonArray final : public Value { + const Json::array &array_items() const override { return m_value; } + const Json & operator[](size_t i) const override; +public: + explicit JsonArray(const Json::array &value) : Value(value) {} + explicit JsonArray(Json::array &&value) : Value(move(value)) {} +}; + +class JsonObject final : public Value { + const Json::object &object_items() const override { return m_value; } + const Json & operator[](const string &key) const override; +public: + explicit JsonObject(const Json::object &value) : Value(value) {} + explicit JsonObject(Json::object &&value) : Value(move(value)) {} +}; + +class JsonNull final : public Value { +public: + JsonNull() : Value({}) {} +}; + +/* * * * * * * * * * * * * * * * * * * * + * Static globals - static-init-safe + */ +struct Statics { + const std::shared_ptr null = make_shared(); + const std::shared_ptr t = make_shared(true); + const std::shared_ptr f = make_shared(false); + const string empty_string; + const vector empty_vector; + const map empty_map; + Statics() {} +}; + +static const Statics & statics() { + static const Statics s {}; + return s; +} + +static const Json & static_null() { + // This has to be separate, not in Statics, because Json() accesses statics().null. + static const Json json_null; + return json_null; +} + +/* * * * * * * * * * * * * * * * * * * * + * Constructors + */ + +Json::Json() noexcept : m_ptr(statics().null) {} +Json::Json(std::nullptr_t) noexcept : m_ptr(statics().null) {} +Json::Json(double value) : m_ptr(make_shared(value)) {} +Json::Json(int value) : m_ptr(make_shared(value)) {} +Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {} +Json::Json(const string &value) : m_ptr(make_shared(value)) {} +Json::Json(string &&value) : m_ptr(make_shared(move(value))) {} +Json::Json(const char * value) : m_ptr(make_shared(value)) {} +Json::Json(const Json::array &values) : m_ptr(make_shared(values)) {} +Json::Json(Json::array &&values) : m_ptr(make_shared(move(values))) {} +Json::Json(const Json::object &values) : m_ptr(make_shared(values)) {} +Json::Json(Json::object &&values) : m_ptr(make_shared(move(values))) {} + +/* * * * * * * * * * * * * * * * * * * * + * Accessors + */ + +Json::Type Json::type() const { return m_ptr->type(); } +double Json::number_value() const { return m_ptr->number_value(); } +int Json::int_value() const { return m_ptr->int_value(); } +bool Json::bool_value() const { return m_ptr->bool_value(); } +const string & Json::string_value() const { return m_ptr->string_value(); } +const vector & Json::array_items() const { return m_ptr->array_items(); } +const map & Json::object_items() const { return m_ptr->object_items(); } +const Json & Json::operator[] (size_t i) const { return (*m_ptr)[i]; } +const Json & Json::operator[] (const string &key) const { return (*m_ptr)[key]; } + +double JsonValue::number_value() const { return 0; } +int JsonValue::int_value() const { return 0; } +bool JsonValue::bool_value() const { return false; } +const string & JsonValue::string_value() const { return statics().empty_string; } +const vector & JsonValue::array_items() const { return statics().empty_vector; } +const map & JsonValue::object_items() const { return statics().empty_map; } +const Json & JsonValue::operator[] (size_t) const { return static_null(); } +const Json & JsonValue::operator[] (const string &) const { return static_null(); } + +const Json & JsonObject::operator[] (const string &key) const { + auto iter = m_value.find(key); + return (iter == m_value.end()) ? static_null() : iter->second; +} +const Json & JsonArray::operator[] (size_t i) const { + if (i >= m_value.size()) return static_null(); + else return m_value[i]; +} + +/* * * * * * * * * * * * * * * * * * * * + * Comparison + */ + +bool Json::operator== (const Json &other) const { + if (m_ptr->type() != other.m_ptr->type()) + return false; + + return m_ptr->equals(other.m_ptr.get()); +} + +bool Json::operator< (const Json &other) const { + if (m_ptr->type() != other.m_ptr->type()) + return m_ptr->type() < other.m_ptr->type(); + + return m_ptr->less(other.m_ptr.get()); +} + +/* * * * * * * * * * * * * * * * * * * * + * Parsing + */ + +/* esc(c) + * + * Format char c suitable for printing in an error message. + */ +static inline string esc(char c) { + char buf[12]; + if (static_cast(c) >= 0x20 && static_cast(c) <= 0x7f) { + snprintf(buf, sizeof buf, "'%c' (%d)", c, c); + } else { + snprintf(buf, sizeof buf, "(%d)", c); + } + return string(buf); +} + +static inline bool in_range(long x, long lower, long upper) { + return (x >= lower && x <= upper); +} + +namespace { +/* JsonParser + * + * Object that tracks all state of an in-progress parse. + */ +struct JsonParser final { + + /* State + */ + const string &str; + size_t i; + string &err; + bool failed; + const JsonParse strategy; + + /* fail(msg, err_ret = Json()) + * + * Mark this parse as failed. + */ + Json fail(string &&msg) { + return fail(move(msg), Json()); + } + + template + T fail(string &&msg, const T err_ret) { + if (!failed) + err = std::move(msg); + failed = true; + return err_ret; + } + + /* consume_whitespace() + * + * Advance until the current character is non-whitespace. + */ + void consume_whitespace() { + while (str[i] == ' ' || str[i] == '\r' || str[i] == '\n' || str[i] == '\t') + i++; + } + + /* consume_comment() + * + * Advance comments (c-style inline and multiline). + */ + bool consume_comment() { + bool comment_found = false; + if (str[i] == '/') { + i++; + if (i == str.size()) + return fail("unexpected end of input after start of comment", false); + if (str[i] == '/') { // inline comment + i++; + // advance until next line, or end of input + while (i < str.size() && str[i] != '\n') { + i++; + } + comment_found = true; + } + else if (str[i] == '*') { // multiline comment + i++; + if (i > str.size()-2) + return fail("unexpected end of input inside multi-line comment", false); + // advance until closing tokens + while (!(str[i] == '*' && str[i+1] == '/')) { + i++; + if (i > str.size()-2) + return fail( + "unexpected end of input inside multi-line comment", false); + } + i += 2; + comment_found = true; + } + else + return fail("malformed comment", false); + } + return comment_found; + } + + /* consume_garbage() + * + * Advance until the current character is non-whitespace and non-comment. + */ + void consume_garbage() { + consume_whitespace(); + if(strategy == JsonParse::COMMENTS) { + bool comment_found = false; + do { + comment_found = consume_comment(); + if (failed) return; + consume_whitespace(); + } + while(comment_found); + } + } + + /* get_next_token() + * + * Return the next non-whitespace character. If the end of the input is reached, + * flag an error and return 0. + */ + char get_next_token() { + consume_garbage(); + if (failed) return (char)0; + if (i == str.size()) + return fail("unexpected end of input", (char)0); + + return str[i++]; + } + + /* encode_utf8(pt, out) + * + * Encode pt as UTF-8 and add it to out. + */ + void encode_utf8(long pt, string & out) { + if (pt < 0) + return; + + if (pt < 0x80) { + out += static_cast(pt); + } else if (pt < 0x800) { + out += static_cast((pt >> 6) | 0xC0); + out += static_cast((pt & 0x3F) | 0x80); + } else if (pt < 0x10000) { + out += static_cast((pt >> 12) | 0xE0); + out += static_cast(((pt >> 6) & 0x3F) | 0x80); + out += static_cast((pt & 0x3F) | 0x80); + } else { + out += static_cast((pt >> 18) | 0xF0); + out += static_cast(((pt >> 12) & 0x3F) | 0x80); + out += static_cast(((pt >> 6) & 0x3F) | 0x80); + out += static_cast((pt & 0x3F) | 0x80); + } + } + + /* parse_string() + * + * Parse a string, starting at the current position. + */ + string parse_string() { + string out; + long last_escaped_codepoint = -1; + while (true) { + if (i == str.size()) + return fail("unexpected end of input in string", ""); + + char ch = str[i++]; + + if (ch == '"') { + encode_utf8(last_escaped_codepoint, out); + return out; + } + + if (in_range(ch, 0, 0x1f)) + return fail("unescaped " + esc(ch) + " in string", ""); + + // The usual case: non-escaped characters + if (ch != '\\') { + encode_utf8(last_escaped_codepoint, out); + last_escaped_codepoint = -1; + out += ch; + continue; + } + + // Handle escapes + if (i == str.size()) + return fail("unexpected end of input in string", ""); + + ch = str[i++]; + + if (ch == 'u') { + // Extract 4-byte escape sequence + string esc = str.substr(i, 4); + // Explicitly check length of the substring. The following loop + // relies on std::string returning the terminating NUL when + // accessing str[length]. Checking here reduces brittleness. + if (esc.length() < 4) { + return fail("bad \\u escape: " + esc, ""); + } + for (size_t j = 0; j < 4; j++) { + if (!in_range(esc[j], 'a', 'f') && !in_range(esc[j], 'A', 'F') + && !in_range(esc[j], '0', '9')) + return fail("bad \\u escape: " + esc, ""); + } + + long codepoint = strtol(esc.data(), nullptr, 16); + + // JSON specifies that characters outside the BMP shall be encoded as a pair + // of 4-hex-digit \u escapes encoding their surrogate pair components. Check + // whether we're in the middle of such a beast: the previous codepoint was an + // escaped lead (high) surrogate, and this is a trail (low) surrogate. + if (in_range(last_escaped_codepoint, 0xD800, 0xDBFF) + && in_range(codepoint, 0xDC00, 0xDFFF)) { + // Reassemble the two surrogate pairs into one astral-plane character, per + // the UTF-16 algorithm. + encode_utf8((((last_escaped_codepoint - 0xD800) << 10) + | (codepoint - 0xDC00)) + 0x10000, out); + last_escaped_codepoint = -1; + } else { + encode_utf8(last_escaped_codepoint, out); + last_escaped_codepoint = codepoint; + } + + i += 4; + continue; + } + + encode_utf8(last_escaped_codepoint, out); + last_escaped_codepoint = -1; + + if (ch == 'b') { + out += '\b'; + } else if (ch == 'f') { + out += '\f'; + } else if (ch == 'n') { + out += '\n'; + } else if (ch == 'r') { + out += '\r'; + } else if (ch == 't') { + out += '\t'; + } else if (ch == '"' || ch == '\\' || ch == '/') { + out += ch; + } else { + return fail("invalid escape character " + esc(ch), ""); + } + } + } + + /* parse_number() + * + * Parse a double. + */ + Json parse_number() { + size_t start_pos = i; + + if (str[i] == '-') + i++; + + // Integer part + if (str[i] == '0') { + i++; + if (in_range(str[i], '0', '9')) + return fail("leading 0s not permitted in numbers"); + } else if (in_range(str[i], '1', '9')) { + i++; + while (in_range(str[i], '0', '9')) + i++; + } else { + return fail("invalid " + esc(str[i]) + " in number"); + } + + if (str[i] != '.' && str[i] != 'e' && str[i] != 'E' + && (i - start_pos) <= static_cast(std::numeric_limits::digits10)) { + return std::atoi(str.c_str() + start_pos); + } + + // Decimal part + if (str[i] == '.') { + i++; + if (!in_range(str[i], '0', '9')) + return fail("at least one digit required in fractional part"); + + while (in_range(str[i], '0', '9')) + i++; + } + + // Exponent part + if (str[i] == 'e' || str[i] == 'E') { + i++; + + if (str[i] == '+' || str[i] == '-') + i++; + + if (!in_range(str[i], '0', '9')) + return fail("at least one digit required in exponent"); + + while (in_range(str[i], '0', '9')) + i++; + } + + return std::strtod(str.c_str() + start_pos, nullptr); + } + + /* expect(str, res) + * + * Expect that 'str' starts at the character that was just read. If it does, advance + * the input and return res. If not, flag an error. + */ + Json expect(const string &expected, Json res) { + assert(i != 0); + i--; + if (str.compare(i, expected.length(), expected) == 0) { + i += expected.length(); + return res; + } else { + return fail("parse error: expected " + expected + ", got " + str.substr(i, expected.length())); + } + } + + /* parse_json() + * + * Parse a JSON object. + */ + Json parse_json(int depth) { + if (depth > max_depth) { + return fail("exceeded maximum nesting depth"); + } + + char ch = get_next_token(); + if (failed) + return Json(); + + if (ch == '-' || (ch >= '0' && ch <= '9')) { + i--; + return parse_number(); + } + + if (ch == 't') + return expect("true", true); + + if (ch == 'f') + return expect("false", false); + + if (ch == 'n') + return expect("null", Json()); + + if (ch == '"') + return parse_string(); + + if (ch == '{') { + map data; + ch = get_next_token(); + if (ch == '}') + return data; + + while (1) { + if (ch != '"') + return fail("expected '\"' in object, got " + esc(ch)); + + string key = parse_string(); + if (failed) + return Json(); + + ch = get_next_token(); + if (ch != ':') + return fail("expected ':' in object, got " + esc(ch)); + + data[std::move(key)] = parse_json(depth + 1); + if (failed) + return Json(); + + ch = get_next_token(); + if (ch == '}') + break; + if (ch != ',') + return fail("expected ',' in object, got " + esc(ch)); + + ch = get_next_token(); + } + return data; + } + + if (ch == '[') { + vector data; + ch = get_next_token(); + if (ch == ']') + return data; + + while (1) { + i--; + data.push_back(parse_json(depth + 1)); + if (failed) + return Json(); + + ch = get_next_token(); + if (ch == ']') + break; + if (ch != ',') + return fail("expected ',' in list, got " + esc(ch)); + + ch = get_next_token(); + (void)ch; + } + return data; + } + + return fail("expected value, got " + esc(ch)); + } +}; +}//namespace { + +Json Json::parse(const string &in, string &err, JsonParse strategy) { + JsonParser parser { in, 0, err, false, strategy }; + Json result = parser.parse_json(0); + + // Check for any trailing garbage + parser.consume_garbage(); + if (parser.failed) + return Json(); + if (parser.i != in.size()) + return parser.fail("unexpected trailing " + esc(in[parser.i])); + + return result; +} + +// Documented in json11.hpp +vector Json::parse_multi(const string &in, + std::string::size_type &parser_stop_pos, + string &err, + JsonParse strategy) { + JsonParser parser { in, 0, err, false, strategy }; + parser_stop_pos = 0; + vector json_vec; + while (parser.i != in.size() && !parser.failed) { + json_vec.push_back(parser.parse_json(0)); + if (parser.failed) + break; + + // Check for another object + parser.consume_garbage(); + if (parser.failed) + break; + parser_stop_pos = parser.i; + } + return json_vec; +} + +/* * * * * * * * * * * * * * * * * * * * + * Shape-checking + */ + +bool Json::has_shape(const shape & types, string & err) const { + if (!is_object()) { + err = "expected JSON object, got " + dump(); + return false; + } + + for (auto & item : types) { + if ((*this)[item.first].type() != item.second) { + err = "bad type for " + item.first + " in " + dump(); + return false; + } + } + + return true; +} + +} // namespace json11 diff --git a/phonelibs/json11/json11.hpp b/phonelibs/json11/json11.hpp new file mode 100644 index 00000000000000..5202ef9323bb79 --- /dev/null +++ b/phonelibs/json11/json11.hpp @@ -0,0 +1,232 @@ +/* json11 + * + * json11 is a tiny JSON library for C++11, providing JSON parsing and serialization. + * + * The core object provided by the library is json11::Json. A Json object represents any JSON + * value: null, bool, number (int or double), string (std::string), array (std::vector), or + * object (std::map). + * + * Json objects act like values: they can be assigned, copied, moved, compared for equality or + * order, etc. There are also helper methods Json::dump, to serialize a Json to a string, and + * Json::parse (static) to parse a std::string as a Json object. + * + * Internally, the various types of Json object are represented by the JsonValue class + * hierarchy. + * + * A note on numbers - JSON specifies the syntax of number formatting but not its semantics, + * so some JSON implementations distinguish between integers and floating-point numbers, while + * some don't. In json11, we choose the latter. Because some JSON implementations (namely + * Javascript itself) treat all numbers as the same type, distinguishing the two leads + * to JSON that will be *silently* changed by a round-trip through those implementations. + * Dangerous! To avoid that risk, json11 stores all numbers as double internally, but also + * provides integer helpers. + * + * Fortunately, double-precision IEEE754 ('double') can precisely store any integer in the + * range +/-2^53, which includes every 'int' on most systems. (Timestamps often use int64 + * or long long to avoid the Y2038K problem; a double storing microseconds since some epoch + * will be exact for +/- 275 years.) + */ + +/* Copyright (c) 2013 Dropbox, Inc. + * + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include + +#ifdef _MSC_VER + #if _MSC_VER <= 1800 // VS 2013 + #ifndef noexcept + #define noexcept throw() + #endif + + #ifndef snprintf + #define snprintf _snprintf_s + #endif + #endif +#endif + +namespace json11 { + +enum JsonParse { + STANDARD, COMMENTS +}; + +class JsonValue; + +class Json final { +public: + // Types + enum Type { + NUL, NUMBER, BOOL, STRING, ARRAY, OBJECT + }; + + // Array and object typedefs + typedef std::vector array; + typedef std::map object; + + // Constructors for the various types of JSON value. + Json() noexcept; // NUL + Json(std::nullptr_t) noexcept; // NUL + Json(double value); // NUMBER + Json(int value); // NUMBER + Json(bool value); // BOOL + Json(const std::string &value); // STRING + Json(std::string &&value); // STRING + Json(const char * value); // STRING + Json(const array &values); // ARRAY + Json(array &&values); // ARRAY + Json(const object &values); // OBJECT + Json(object &&values); // OBJECT + + // Implicit constructor: anything with a to_json() function. + template + Json(const T & t) : Json(t.to_json()) {} + + // Implicit constructor: map-like objects (std::map, std::unordered_map, etc) + template ::value + && std::is_constructible::value, + int>::type = 0> + Json(const M & m) : Json(object(m.begin(), m.end())) {} + + // Implicit constructor: vector-like objects (std::list, std::vector, std::set, etc) + template ::value, + int>::type = 0> + Json(const V & v) : Json(array(v.begin(), v.end())) {} + + // This prevents Json(some_pointer) from accidentally producing a bool. Use + // Json(bool(some_pointer)) if that behavior is desired. + Json(void *) = delete; + + // Accessors + Type type() const; + + bool is_null() const { return type() == NUL; } + bool is_number() const { return type() == NUMBER; } + bool is_bool() const { return type() == BOOL; } + bool is_string() const { return type() == STRING; } + bool is_array() const { return type() == ARRAY; } + bool is_object() const { return type() == OBJECT; } + + // Return the enclosed value if this is a number, 0 otherwise. Note that json11 does not + // distinguish between integer and non-integer numbers - number_value() and int_value() + // can both be applied to a NUMBER-typed object. + double number_value() const; + int int_value() const; + + // Return the enclosed value if this is a boolean, false otherwise. + bool bool_value() const; + // Return the enclosed string if this is a string, "" otherwise. + const std::string &string_value() const; + // Return the enclosed std::vector if this is an array, or an empty vector otherwise. + const array &array_items() const; + // Return the enclosed std::map if this is an object, or an empty map otherwise. + const object &object_items() const; + + // Return a reference to arr[i] if this is an array, Json() otherwise. + const Json & operator[](size_t i) const; + // Return a reference to obj[key] if this is an object, Json() otherwise. + const Json & operator[](const std::string &key) const; + + // Serialize. + void dump(std::string &out) const; + std::string dump() const { + std::string out; + dump(out); + return out; + } + + // Parse. If parse fails, return Json() and assign an error message to err. + static Json parse(const std::string & in, + std::string & err, + JsonParse strategy = JsonParse::STANDARD); + static Json parse(const char * in, + std::string & err, + JsonParse strategy = JsonParse::STANDARD) { + if (in) { + return parse(std::string(in), err, strategy); + } else { + err = "null input"; + return nullptr; + } + } + // Parse multiple objects, concatenated or separated by whitespace + static std::vector parse_multi( + const std::string & in, + std::string::size_type & parser_stop_pos, + std::string & err, + JsonParse strategy = JsonParse::STANDARD); + + static inline std::vector parse_multi( + const std::string & in, + std::string & err, + JsonParse strategy = JsonParse::STANDARD) { + std::string::size_type parser_stop_pos; + return parse_multi(in, parser_stop_pos, err, strategy); + } + + bool operator== (const Json &rhs) const; + bool operator< (const Json &rhs) const; + bool operator!= (const Json &rhs) const { return !(*this == rhs); } + bool operator<= (const Json &rhs) const { return !(rhs < *this); } + bool operator> (const Json &rhs) const { return (rhs < *this); } + bool operator>= (const Json &rhs) const { return !(*this < rhs); } + + /* has_shape(types, err) + * + * Return true if this is a JSON object and, for each item in types, has a field of + * the given type. If not, return false and set err to a descriptive message. + */ + typedef std::initializer_list> shape; + bool has_shape(const shape & types, std::string & err) const; + +private: + std::shared_ptr m_ptr; +}; + +// Internal class hierarchy - JsonValue objects are not exposed to users of this API. +class JsonValue { +protected: + friend class Json; + friend class JsonInt; + friend class JsonDouble; + virtual Json::Type type() const = 0; + virtual bool equals(const JsonValue * other) const = 0; + virtual bool less(const JsonValue * other) const = 0; + virtual void dump(std::string &out) const = 0; + virtual double number_value() const; + virtual int int_value() const; + virtual bool bool_value() const; + virtual const std::string &string_value() const; + virtual const Json::array &array_items() const; + virtual const Json &operator[](size_t i) const; + virtual const Json::object &object_items() const; + virtual const Json &operator[](const std::string &key) const; + virtual ~JsonValue() {} +}; + +} // namespace json11 diff --git a/phonelibs/json11/json11.o b/phonelibs/json11/json11.o new file mode 100644 index 00000000000000..1e32cca71ffc3b Binary files /dev/null and b/phonelibs/json11/json11.o differ diff --git a/phonelibs/libyuv/build.txt b/phonelibs/libyuv/build.txt new file mode 100644 index 00000000000000..376e981ec723c5 --- /dev/null +++ b/phonelibs/libyuv/build.txt @@ -0,0 +1,4 @@ +git clone https://chromium.googlesource.com/libyuv/libyuv +cd libyuv +git reset --hard 4a14cb2e81235ecd656e799aecaaf139db8ce4a2 +cmake . diff --git a/phonelibs/libyuv/include/libyuv.h b/phonelibs/libyuv/include/libyuv.h new file mode 100644 index 00000000000000..aeffd5ef7a4ca2 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv.h @@ -0,0 +1,32 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_H_ +#define INCLUDE_LIBYUV_H_ + +#include "libyuv/basic_types.h" +#include "libyuv/compare.h" +#include "libyuv/convert.h" +#include "libyuv/convert_argb.h" +#include "libyuv/convert_from.h" +#include "libyuv/convert_from_argb.h" +#include "libyuv/cpu_id.h" +#include "libyuv/mjpeg_decoder.h" +#include "libyuv/planar_functions.h" +#include "libyuv/rotate.h" +#include "libyuv/rotate_argb.h" +#include "libyuv/row.h" +#include "libyuv/scale.h" +#include "libyuv/scale_argb.h" +#include "libyuv/scale_row.h" +#include "libyuv/version.h" +#include "libyuv/video_common.h" + +#endif // INCLUDE_LIBYUV_H_ diff --git a/phonelibs/libyuv/include/libyuv/basic_types.h b/phonelibs/libyuv/include/libyuv/basic_types.h new file mode 100644 index 00000000000000..5b760ee0d4d4a2 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/basic_types.h @@ -0,0 +1,118 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_BASIC_TYPES_H_ +#define INCLUDE_LIBYUV_BASIC_TYPES_H_ + +#include // for NULL, size_t + +#if defined(_MSC_VER) && (_MSC_VER < 1600) +#include // for uintptr_t on x86 +#else +#include // for uintptr_t +#endif + +#ifndef GG_LONGLONG +#ifndef INT_TYPES_DEFINED +#define INT_TYPES_DEFINED +#ifdef COMPILER_MSVC +typedef unsigned __int64 uint64; +typedef __int64 int64; +#ifndef INT64_C +#define INT64_C(x) x ## I64 +#endif +#ifndef UINT64_C +#define UINT64_C(x) x ## UI64 +#endif +#define INT64_F "I64" +#else // COMPILER_MSVC +#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__) +typedef unsigned long uint64; // NOLINT +typedef long int64; // NOLINT +#ifndef INT64_C +#define INT64_C(x) x ## L +#endif +#ifndef UINT64_C +#define UINT64_C(x) x ## UL +#endif +#define INT64_F "l" +#else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__) +typedef unsigned long long uint64; // NOLINT +typedef long long int64; // NOLINT +#ifndef INT64_C +#define INT64_C(x) x ## LL +#endif +#ifndef UINT64_C +#define UINT64_C(x) x ## ULL +#endif +#define INT64_F "ll" +#endif // __LP64__ +#endif // COMPILER_MSVC +typedef unsigned int uint32; +typedef int int32; +typedef unsigned short uint16; // NOLINT +typedef short int16; // NOLINT +typedef unsigned char uint8; +typedef signed char int8; +#endif // INT_TYPES_DEFINED +#endif // GG_LONGLONG + +// Detect compiler is for x86 or x64. +#if defined(__x86_64__) || defined(_M_X64) || \ + defined(__i386__) || defined(_M_IX86) +#define CPU_X86 1 +#endif +// Detect compiler is for ARM. +#if defined(__arm__) || defined(_M_ARM) +#define CPU_ARM 1 +#endif + +#ifndef ALIGNP +#ifdef __cplusplus +#define ALIGNP(p, t) \ + (reinterpret_cast(((reinterpret_cast(p) + \ + ((t) - 1)) & ~((t) - 1)))) +#else +#define ALIGNP(p, t) \ + ((uint8*)((((uintptr_t)(p) + ((t) - 1)) & ~((t) - 1)))) /* NOLINT */ +#endif +#endif + +#if !defined(LIBYUV_API) +#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(LIBYUV_BUILDING_SHARED_LIBRARY) +#define LIBYUV_API __declspec(dllexport) +#elif defined(LIBYUV_USING_SHARED_LIBRARY) +#define LIBYUV_API __declspec(dllimport) +#else +#define LIBYUV_API +#endif // LIBYUV_BUILDING_SHARED_LIBRARY +#elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__APPLE__) && \ + (defined(LIBYUV_BUILDING_SHARED_LIBRARY) || \ + defined(LIBYUV_USING_SHARED_LIBRARY)) +#define LIBYUV_API __attribute__ ((visibility ("default"))) +#else +#define LIBYUV_API +#endif // __GNUC__ +#endif // LIBYUV_API + +#define LIBYUV_BOOL int +#define LIBYUV_FALSE 0 +#define LIBYUV_TRUE 1 + +// Visual C x86 or GCC little endian. +#if defined(__x86_64__) || defined(_M_X64) || \ + defined(__i386__) || defined(_M_IX86) || \ + defined(__arm__) || defined(_M_ARM) || \ + (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +#define LIBYUV_LITTLE_ENDIAN +#endif + +#endif // INCLUDE_LIBYUV_BASIC_TYPES_H_ diff --git a/phonelibs/libyuv/include/libyuv/compare.h b/phonelibs/libyuv/include/libyuv/compare.h new file mode 100644 index 00000000000000..550712de6e589b --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/compare.h @@ -0,0 +1,78 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_COMPARE_H_ +#define INCLUDE_LIBYUV_COMPARE_H_ + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Compute a hash for specified memory. Seed of 5381 recommended. +LIBYUV_API +uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed); + +// Scan an opaque argb image and return fourcc based on alpha offset. +// Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown. +LIBYUV_API +uint32 ARGBDetect(const uint8* argb, int stride_argb, int width, int height); + +// Sum Square Error - used to compute Mean Square Error or PSNR. +LIBYUV_API +uint64 ComputeSumSquareError(const uint8* src_a, + const uint8* src_b, int count); + +LIBYUV_API +uint64 ComputeSumSquareErrorPlane(const uint8* src_a, int stride_a, + const uint8* src_b, int stride_b, + int width, int height); + +static const int kMaxPsnr = 128; + +LIBYUV_API +double SumSquareErrorToPsnr(uint64 sse, uint64 count); + +LIBYUV_API +double CalcFramePsnr(const uint8* src_a, int stride_a, + const uint8* src_b, int stride_b, + int width, int height); + +LIBYUV_API +double I420Psnr(const uint8* src_y_a, int stride_y_a, + const uint8* src_u_a, int stride_u_a, + const uint8* src_v_a, int stride_v_a, + const uint8* src_y_b, int stride_y_b, + const uint8* src_u_b, int stride_u_b, + const uint8* src_v_b, int stride_v_b, + int width, int height); + +LIBYUV_API +double CalcFrameSsim(const uint8* src_a, int stride_a, + const uint8* src_b, int stride_b, + int width, int height); + +LIBYUV_API +double I420Ssim(const uint8* src_y_a, int stride_y_a, + const uint8* src_u_a, int stride_u_a, + const uint8* src_v_a, int stride_v_a, + const uint8* src_y_b, int stride_y_b, + const uint8* src_u_b, int stride_u_b, + const uint8* src_v_b, int stride_v_b, + int width, int height); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_COMPARE_H_ diff --git a/phonelibs/libyuv/include/libyuv/compare_row.h b/phonelibs/libyuv/include/libyuv/compare_row.h new file mode 100644 index 00000000000000..781cad3e65aba0 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/compare_row.h @@ -0,0 +1,84 @@ +/* + * Copyright 2013 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_COMPARE_ROW_H_ +#define INCLUDE_LIBYUV_COMPARE_ROW_H_ + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +#if defined(__pnacl__) || defined(__CLR_VER) || \ + (defined(__i386__) && !defined(__SSE2__)) +#define LIBYUV_DISABLE_X86 +#endif +// MemorySanitizer does not support assembly code yet. http://crbug.com/344505 +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#define LIBYUV_DISABLE_X86 +#endif +#endif + +// Visual C 2012 required for AVX2. +#if defined(_M_IX86) && !defined(__clang__) && \ + defined(_MSC_VER) && _MSC_VER >= 1700 +#define VISUALC_HAS_AVX2 1 +#endif // VisualStudio >= 2012 + +// clang >= 3.4.0 required for AVX2. +#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) +#if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4)) +#define CLANG_HAS_AVX2 1 +#endif // clang >= 3.4 +#endif // __clang__ + +#if !defined(LIBYUV_DISABLE_X86) && \ + defined(_M_IX86) && (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2)) +#define HAS_HASHDJB2_AVX2 +#endif + +// The following are available for Visual C and GCC: +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(__x86_64__) || (defined(__i386__) || defined(_M_IX86))) +#define HAS_HASHDJB2_SSE41 +#define HAS_SUMSQUAREERROR_SSE2 +#endif + +// The following are available for Visual C and clangcl 32 bit: +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && \ + (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2)) +#define HAS_HASHDJB2_AVX2 +#define HAS_SUMSQUAREERROR_AVX2 +#endif + +// The following are available for Neon: +#if !defined(LIBYUV_DISABLE_NEON) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__)) +#define HAS_SUMSQUAREERROR_NEON +#endif + +uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count); +uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count); +uint32 SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count); +uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count); + +uint32 HashDjb2_C(const uint8* src, int count, uint32 seed); +uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed); +uint32 HashDjb2_AVX2(const uint8* src, int count, uint32 seed); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_COMPARE_ROW_H_ diff --git a/phonelibs/libyuv/include/libyuv/convert.h b/phonelibs/libyuv/include/libyuv/convert.h new file mode 100644 index 00000000000000..d44485847be1d6 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/convert.h @@ -0,0 +1,259 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CONVERT_H_ +#define INCLUDE_LIBYUV_CONVERT_H_ + +#include "libyuv/basic_types.h" + +#include "libyuv/rotate.h" // For enum RotationMode. + +// TODO(fbarchard): fix WebRTC source to include following libyuv headers: +#include "libyuv/convert_argb.h" // For WebRTC I420ToARGB. b/620 +#include "libyuv/convert_from.h" // For WebRTC ConvertFromI420. b/620 +#include "libyuv/planar_functions.h" // For WebRTC I420Rect, CopyPlane. b/618 + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Convert I444 to I420. +LIBYUV_API +int I444ToI420(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert I422 to I420. +LIBYUV_API +int I422ToI420(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert I411 to I420. +LIBYUV_API +int I411ToI420(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Copy I420 to I420. +#define I420ToI420 I420Copy +LIBYUV_API +int I420Copy(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert I400 (grey) to I420. +LIBYUV_API +int I400ToI420(const uint8* src_y, int src_stride_y, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +#define J400ToJ420 I400ToI420 + +// Convert NV12 to I420. +LIBYUV_API +int NV12ToI420(const uint8* src_y, int src_stride_y, + const uint8* src_uv, int src_stride_uv, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert NV21 to I420. +LIBYUV_API +int NV21ToI420(const uint8* src_y, int src_stride_y, + const uint8* src_vu, int src_stride_vu, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert YUY2 to I420. +LIBYUV_API +int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert UYVY to I420. +LIBYUV_API +int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert M420 to I420. +LIBYUV_API +int M420ToI420(const uint8* src_m420, int src_stride_m420, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert Android420 to I420. +LIBYUV_API +int Android420ToI420(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + int pixel_stride_uv, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// ARGB little endian (bgra in memory) to I420. +LIBYUV_API +int ARGBToI420(const uint8* src_frame, int src_stride_frame, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// BGRA little endian (argb in memory) to I420. +LIBYUV_API +int BGRAToI420(const uint8* src_frame, int src_stride_frame, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// ABGR little endian (rgba in memory) to I420. +LIBYUV_API +int ABGRToI420(const uint8* src_frame, int src_stride_frame, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// RGBA little endian (abgr in memory) to I420. +LIBYUV_API +int RGBAToI420(const uint8* src_frame, int src_stride_frame, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// RGB little endian (bgr in memory) to I420. +LIBYUV_API +int RGB24ToI420(const uint8* src_frame, int src_stride_frame, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// RGB big endian (rgb in memory) to I420. +LIBYUV_API +int RAWToI420(const uint8* src_frame, int src_stride_frame, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// RGB16 (RGBP fourcc) little endian to I420. +LIBYUV_API +int RGB565ToI420(const uint8* src_frame, int src_stride_frame, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// RGB15 (RGBO fourcc) little endian to I420. +LIBYUV_API +int ARGB1555ToI420(const uint8* src_frame, int src_stride_frame, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// RGB12 (R444 fourcc) little endian to I420. +LIBYUV_API +int ARGB4444ToI420(const uint8* src_frame, int src_stride_frame, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +#ifdef HAVE_JPEG +// src_width/height provided by capture. +// dst_width/height for clipping determine final size. +LIBYUV_API +int MJPGToI420(const uint8* sample, size_t sample_size, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int src_width, int src_height, + int dst_width, int dst_height); + +// Query size of MJPG in pixels. +LIBYUV_API +int MJPGSize(const uint8* sample, size_t sample_size, + int* width, int* height); +#endif + +// Convert camera sample to I420 with cropping, rotation and vertical flip. +// "src_size" is needed to parse MJPG. +// "dst_stride_y" number of bytes in a row of the dst_y plane. +// Normally this would be the same as dst_width, with recommended alignment +// to 16 bytes for better efficiency. +// If rotation of 90 or 270 is used, stride is affected. The caller should +// allocate the I420 buffer according to rotation. +// "dst_stride_u" number of bytes in a row of the dst_u plane. +// Normally this would be the same as (dst_width + 1) / 2, with +// recommended alignment to 16 bytes for better efficiency. +// If rotation of 90 or 270 is used, stride is affected. +// "crop_x" and "crop_y" are starting position for cropping. +// To center, crop_x = (src_width - dst_width) / 2 +// crop_y = (src_height - dst_height) / 2 +// "src_width" / "src_height" is size of src_frame in pixels. +// "src_height" can be negative indicating a vertically flipped image source. +// "crop_width" / "crop_height" is the size to crop the src to. +// Must be less than or equal to src_width/src_height +// Cropping parameters are pre-rotation. +// "rotation" can be 0, 90, 180 or 270. +// "format" is a fourcc. ie 'I420', 'YUY2' +// Returns 0 for successful; -1 for invalid parameter. Non-zero for failure. +LIBYUV_API +int ConvertToI420(const uint8* src_frame, size_t src_size, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int crop_x, int crop_y, + int src_width, int src_height, + int crop_width, int crop_height, + enum RotationMode rotation, + uint32 format); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CONVERT_H_ diff --git a/phonelibs/libyuv/include/libyuv/convert_argb.h b/phonelibs/libyuv/include/libyuv/convert_argb.h new file mode 100644 index 00000000000000..dc03ac8d5dc4e1 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/convert_argb.h @@ -0,0 +1,319 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CONVERT_ARGB_H_ +#define INCLUDE_LIBYUV_CONVERT_ARGB_H_ + +#include "libyuv/basic_types.h" + +#include "libyuv/rotate.h" // For enum RotationMode. + +// TODO(fbarchard): This set of functions should exactly match convert.h +// TODO(fbarchard): Add tests. Create random content of right size and convert +// with C vs Opt and or to I420 and compare. +// TODO(fbarchard): Some of these functions lack parameter setting. + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Alias. +#define ARGBToARGB ARGBCopy + +// Copy ARGB to ARGB. +LIBYUV_API +int ARGBCopy(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I420 to ARGB. +LIBYUV_API +int I420ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Duplicate prototype for function in convert_from.h for remoting. +LIBYUV_API +int I420ToABGR(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I422 to ARGB. +LIBYUV_API +int I422ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I444 to ARGB. +LIBYUV_API +int I444ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert J444 to ARGB. +LIBYUV_API +int J444ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I444 to ABGR. +LIBYUV_API +int I444ToABGR(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_abgr, int dst_stride_abgr, + int width, int height); + +// Convert I411 to ARGB. +LIBYUV_API +int I411ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I420 with Alpha to preattenuated ARGB. +LIBYUV_API +int I420AlphaToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + const uint8* src_a, int src_stride_a, + uint8* dst_argb, int dst_stride_argb, + int width, int height, int attenuate); + +// Convert I420 with Alpha to preattenuated ABGR. +LIBYUV_API +int I420AlphaToABGR(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + const uint8* src_a, int src_stride_a, + uint8* dst_abgr, int dst_stride_abgr, + int width, int height, int attenuate); + +// Convert I400 (grey) to ARGB. Reverse of ARGBToI400. +LIBYUV_API +int I400ToARGB(const uint8* src_y, int src_stride_y, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert J400 (jpeg grey) to ARGB. +LIBYUV_API +int J400ToARGB(const uint8* src_y, int src_stride_y, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Alias. +#define YToARGB I400ToARGB + +// Convert NV12 to ARGB. +LIBYUV_API +int NV12ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_uv, int src_stride_uv, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert NV21 to ARGB. +LIBYUV_API +int NV21ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_vu, int src_stride_vu, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert M420 to ARGB. +LIBYUV_API +int M420ToARGB(const uint8* src_m420, int src_stride_m420, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert YUY2 to ARGB. +LIBYUV_API +int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert UYVY to ARGB. +LIBYUV_API +int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert J420 to ARGB. +LIBYUV_API +int J420ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert J422 to ARGB. +LIBYUV_API +int J422ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert J420 to ABGR. +LIBYUV_API +int J420ToABGR(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_abgr, int dst_stride_abgr, + int width, int height); + +// Convert J422 to ABGR. +LIBYUV_API +int J422ToABGR(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_abgr, int dst_stride_abgr, + int width, int height); + +// Convert H420 to ARGB. +LIBYUV_API +int H420ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert H422 to ARGB. +LIBYUV_API +int H422ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert H420 to ABGR. +LIBYUV_API +int H420ToABGR(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_abgr, int dst_stride_abgr, + int width, int height); + +// Convert H422 to ABGR. +LIBYUV_API +int H422ToABGR(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_abgr, int dst_stride_abgr, + int width, int height); + +// BGRA little endian (argb in memory) to ARGB. +LIBYUV_API +int BGRAToARGB(const uint8* src_frame, int src_stride_frame, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// ABGR little endian (rgba in memory) to ARGB. +LIBYUV_API +int ABGRToARGB(const uint8* src_frame, int src_stride_frame, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// RGBA little endian (abgr in memory) to ARGB. +LIBYUV_API +int RGBAToARGB(const uint8* src_frame, int src_stride_frame, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Deprecated function name. +#define BG24ToARGB RGB24ToARGB + +// RGB little endian (bgr in memory) to ARGB. +LIBYUV_API +int RGB24ToARGB(const uint8* src_frame, int src_stride_frame, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// RGB big endian (rgb in memory) to ARGB. +LIBYUV_API +int RAWToARGB(const uint8* src_frame, int src_stride_frame, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// RGB16 (RGBP fourcc) little endian to ARGB. +LIBYUV_API +int RGB565ToARGB(const uint8* src_frame, int src_stride_frame, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// RGB15 (RGBO fourcc) little endian to ARGB. +LIBYUV_API +int ARGB1555ToARGB(const uint8* src_frame, int src_stride_frame, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// RGB12 (R444 fourcc) little endian to ARGB. +LIBYUV_API +int ARGB4444ToARGB(const uint8* src_frame, int src_stride_frame, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +#ifdef HAVE_JPEG +// src_width/height provided by capture +// dst_width/height for clipping determine final size. +LIBYUV_API +int MJPGToARGB(const uint8* sample, size_t sample_size, + uint8* dst_argb, int dst_stride_argb, + int src_width, int src_height, + int dst_width, int dst_height); +#endif + +// Convert camera sample to ARGB with cropping, rotation and vertical flip. +// "src_size" is needed to parse MJPG. +// "dst_stride_argb" number of bytes in a row of the dst_argb plane. +// Normally this would be the same as dst_width, with recommended alignment +// to 16 bytes for better efficiency. +// If rotation of 90 or 270 is used, stride is affected. The caller should +// allocate the I420 buffer according to rotation. +// "dst_stride_u" number of bytes in a row of the dst_u plane. +// Normally this would be the same as (dst_width + 1) / 2, with +// recommended alignment to 16 bytes for better efficiency. +// If rotation of 90 or 270 is used, stride is affected. +// "crop_x" and "crop_y" are starting position for cropping. +// To center, crop_x = (src_width - dst_width) / 2 +// crop_y = (src_height - dst_height) / 2 +// "src_width" / "src_height" is size of src_frame in pixels. +// "src_height" can be negative indicating a vertically flipped image source. +// "crop_width" / "crop_height" is the size to crop the src to. +// Must be less than or equal to src_width/src_height +// Cropping parameters are pre-rotation. +// "rotation" can be 0, 90, 180 or 270. +// "format" is a fourcc. ie 'I420', 'YUY2' +// Returns 0 for successful; -1 for invalid parameter. Non-zero for failure. +LIBYUV_API +int ConvertToARGB(const uint8* src_frame, size_t src_size, + uint8* dst_argb, int dst_stride_argb, + int crop_x, int crop_y, + int src_width, int src_height, + int crop_width, int crop_height, + enum RotationMode rotation, + uint32 format); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CONVERT_ARGB_H_ diff --git a/phonelibs/libyuv/include/libyuv/convert_from.h b/phonelibs/libyuv/include/libyuv/convert_from.h new file mode 100644 index 00000000000000..59c40474f1ef24 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/convert_from.h @@ -0,0 +1,179 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CONVERT_FROM_H_ +#define INCLUDE_LIBYUV_CONVERT_FROM_H_ + +#include "libyuv/basic_types.h" +#include "libyuv/rotate.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// See Also convert.h for conversions from formats to I420. + +// I420Copy in convert to I420ToI420. + +LIBYUV_API +int I420ToI422(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +LIBYUV_API +int I420ToI444(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +LIBYUV_API +int I420ToI411(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Copy to I400. Source can be I420, I422, I444, I400, NV12 or NV21. +LIBYUV_API +int I400Copy(const uint8* src_y, int src_stride_y, + uint8* dst_y, int dst_stride_y, + int width, int height); + +LIBYUV_API +int I420ToNV12(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_uv, int dst_stride_uv, + int width, int height); + +LIBYUV_API +int I420ToNV21(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_vu, int dst_stride_vu, + int width, int height); + +LIBYUV_API +int I420ToYUY2(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToUYVY(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToARGB(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +LIBYUV_API +int I420ToBGRA(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +LIBYUV_API +int I420ToABGR(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +LIBYUV_API +int I420ToRGBA(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_rgba, int dst_stride_rgba, + int width, int height); + +LIBYUV_API +int I420ToRGB24(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToRAW(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToRGB565(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + int width, int height); + +// Convert I420 To RGB565 with 4x4 dither matrix (16 bytes). +// Values in dither matrix from 0 to 7 recommended. +// The order of the dither matrix is first byte is upper left. + +LIBYUV_API +int I420ToRGB565Dither(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + const uint8* dither4x4, int width, int height); + +LIBYUV_API +int I420ToARGB1555(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToARGB4444(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + int width, int height); + +// Convert I420 to specified format. +// "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the +// buffer has contiguous rows. Can be negative. A multiple of 16 is optimal. +LIBYUV_API +int ConvertFromI420(const uint8* y, int y_stride, + const uint8* u, int u_stride, + const uint8* v, int v_stride, + uint8* dst_sample, int dst_sample_stride, + int width, int height, + uint32 format); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CONVERT_FROM_H_ diff --git a/phonelibs/libyuv/include/libyuv/convert_from_argb.h b/phonelibs/libyuv/include/libyuv/convert_from_argb.h new file mode 100644 index 00000000000000..8d7f02f8c4dde6 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/convert_from_argb.h @@ -0,0 +1,190 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_ +#define INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_ + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Copy ARGB to ARGB. +#define ARGBToARGB ARGBCopy +LIBYUV_API +int ARGBCopy(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert ARGB To BGRA. +LIBYUV_API +int ARGBToBGRA(const uint8* src_argb, int src_stride_argb, + uint8* dst_bgra, int dst_stride_bgra, + int width, int height); + +// Convert ARGB To ABGR. +LIBYUV_API +int ARGBToABGR(const uint8* src_argb, int src_stride_argb, + uint8* dst_abgr, int dst_stride_abgr, + int width, int height); + +// Convert ARGB To RGBA. +LIBYUV_API +int ARGBToRGBA(const uint8* src_argb, int src_stride_argb, + uint8* dst_rgba, int dst_stride_rgba, + int width, int height); + +// Convert ARGB To RGB24. +LIBYUV_API +int ARGBToRGB24(const uint8* src_argb, int src_stride_argb, + uint8* dst_rgb24, int dst_stride_rgb24, + int width, int height); + +// Convert ARGB To RAW. +LIBYUV_API +int ARGBToRAW(const uint8* src_argb, int src_stride_argb, + uint8* dst_rgb, int dst_stride_rgb, + int width, int height); + +// Convert ARGB To RGB565. +LIBYUV_API +int ARGBToRGB565(const uint8* src_argb, int src_stride_argb, + uint8* dst_rgb565, int dst_stride_rgb565, + int width, int height); + +// Convert ARGB To RGB565 with 4x4 dither matrix (16 bytes). +// Values in dither matrix from 0 to 7 recommended. +// The order of the dither matrix is first byte is upper left. +// TODO(fbarchard): Consider pointer to 2d array for dither4x4. +// const uint8(*dither)[4][4]; +LIBYUV_API +int ARGBToRGB565Dither(const uint8* src_argb, int src_stride_argb, + uint8* dst_rgb565, int dst_stride_rgb565, + const uint8* dither4x4, int width, int height); + +// Convert ARGB To ARGB1555. +LIBYUV_API +int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb1555, int dst_stride_argb1555, + int width, int height); + +// Convert ARGB To ARGB4444. +LIBYUV_API +int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb4444, int dst_stride_argb4444, + int width, int height); + +// Convert ARGB To I444. +LIBYUV_API +int ARGBToI444(const uint8* src_argb, int src_stride_argb, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB To I422. +LIBYUV_API +int ARGBToI422(const uint8* src_argb, int src_stride_argb, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB To I420. (also in convert.h) +LIBYUV_API +int ARGBToI420(const uint8* src_argb, int src_stride_argb, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB to J420. (JPeg full range I420). +LIBYUV_API +int ARGBToJ420(const uint8* src_argb, int src_stride_argb, + uint8* dst_yj, int dst_stride_yj, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB to J422. +LIBYUV_API +int ARGBToJ422(const uint8* src_argb, int src_stride_argb, + uint8* dst_yj, int dst_stride_yj, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB To I411. +LIBYUV_API +int ARGBToI411(const uint8* src_argb, int src_stride_argb, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB to J400. (JPeg full range). +LIBYUV_API +int ARGBToJ400(const uint8* src_argb, int src_stride_argb, + uint8* dst_yj, int dst_stride_yj, + int width, int height); + +// Convert ARGB to I400. +LIBYUV_API +int ARGBToI400(const uint8* src_argb, int src_stride_argb, + uint8* dst_y, int dst_stride_y, + int width, int height); + +// Convert ARGB to G. (Reverse of J400toARGB, which replicates G back to ARGB) +LIBYUV_API +int ARGBToG(const uint8* src_argb, int src_stride_argb, + uint8* dst_g, int dst_stride_g, + int width, int height); + +// Convert ARGB To NV12. +LIBYUV_API +int ARGBToNV12(const uint8* src_argb, int src_stride_argb, + uint8* dst_y, int dst_stride_y, + uint8* dst_uv, int dst_stride_uv, + int width, int height); + +// Convert ARGB To NV21. +LIBYUV_API +int ARGBToNV21(const uint8* src_argb, int src_stride_argb, + uint8* dst_y, int dst_stride_y, + uint8* dst_vu, int dst_stride_vu, + int width, int height); + +// Convert ARGB To NV21. +LIBYUV_API +int ARGBToNV21(const uint8* src_argb, int src_stride_argb, + uint8* dst_y, int dst_stride_y, + uint8* dst_vu, int dst_stride_vu, + int width, int height); + +// Convert ARGB To YUY2. +LIBYUV_API +int ARGBToYUY2(const uint8* src_argb, int src_stride_argb, + uint8* dst_yuy2, int dst_stride_yuy2, + int width, int height); + +// Convert ARGB To UYVY. +LIBYUV_API +int ARGBToUYVY(const uint8* src_argb, int src_stride_argb, + uint8* dst_uyvy, int dst_stride_uyvy, + int width, int height); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_ diff --git a/phonelibs/libyuv/include/libyuv/cpu_id.h b/phonelibs/libyuv/include/libyuv/cpu_id.h new file mode 100644 index 00000000000000..7c6c9aeb00515d --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/cpu_id.h @@ -0,0 +1,81 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CPU_ID_H_ +#define INCLUDE_LIBYUV_CPU_ID_H_ + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Internal flag to indicate cpuid requires initialization. +static const int kCpuInitialized = 0x1; + +// These flags are only valid on ARM processors. +static const int kCpuHasARM = 0x2; +static const int kCpuHasNEON = 0x4; +// 0x8 reserved for future ARM flag. + +// These flags are only valid on x86 processors. +static const int kCpuHasX86 = 0x10; +static const int kCpuHasSSE2 = 0x20; +static const int kCpuHasSSSE3 = 0x40; +static const int kCpuHasSSE41 = 0x80; +static const int kCpuHasSSE42 = 0x100; +static const int kCpuHasAVX = 0x200; +static const int kCpuHasAVX2 = 0x400; +static const int kCpuHasERMS = 0x800; +static const int kCpuHasFMA3 = 0x1000; +static const int kCpuHasAVX3 = 0x2000; +// 0x2000, 0x4000, 0x8000 reserved for future X86 flags. + +// These flags are only valid on MIPS processors. +static const int kCpuHasMIPS = 0x10000; +static const int kCpuHasDSPR2 = 0x20000; +static const int kCpuHasMSA = 0x40000; + +// Internal function used to auto-init. +LIBYUV_API +int InitCpuFlags(void); + +// Internal function for parsing /proc/cpuinfo. +LIBYUV_API +int ArmCpuCaps(const char* cpuinfo_name); + +// Detect CPU has SSE2 etc. +// Test_flag parameter should be one of kCpuHas constants above. +// returns non-zero if instruction set is detected +static __inline int TestCpuFlag(int test_flag) { + LIBYUV_API extern int cpu_info_; + return (!cpu_info_ ? InitCpuFlags() : cpu_info_) & test_flag; +} + +// For testing, allow CPU flags to be disabled. +// ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3. +// MaskCpuFlags(-1) to enable all cpu specific optimizations. +// MaskCpuFlags(1) to disable all cpu specific optimizations. +LIBYUV_API +void MaskCpuFlags(int enable_flags); + +// Low level cpuid for X86. Returns zeros on other CPUs. +// eax is the info type that you want. +// ecx is typically the cpu number, and should normally be zero. +LIBYUV_API +void CpuId(uint32 eax, uint32 ecx, uint32* cpu_info); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CPU_ID_H_ diff --git a/phonelibs/libyuv/include/libyuv/macros_msa.h b/phonelibs/libyuv/include/libyuv/macros_msa.h new file mode 100644 index 00000000000000..92ed21c38532d4 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/macros_msa.h @@ -0,0 +1,76 @@ +/* + * Copyright 2016 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_MACROS_MSA_H_ +#define INCLUDE_LIBYUV_MACROS_MSA_H_ + +#if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) +#include +#include + +#define LD_B(RTYPE, psrc) *((RTYPE*)(psrc)) /* NOLINT */ +#define LD_UB(...) LD_B(v16u8, __VA_ARGS__) + +#define ST_B(RTYPE, in, pdst) *((RTYPE*)(pdst)) = (in) /* NOLINT */ +#define ST_UB(...) ST_B(v16u8, __VA_ARGS__) + +/* Description : Load two vectors with 16 'byte' sized elements + Arguments : Inputs - psrc, stride + Outputs - out0, out1 + Return Type - as per RTYPE + Details : Load 16 byte elements in 'out0' from (psrc) + Load 16 byte elements in 'out1' from (psrc + stride) +*/ +#define LD_B2(RTYPE, psrc, stride, out0, out1) { \ + out0 = LD_B(RTYPE, (psrc)); \ + out1 = LD_B(RTYPE, (psrc) + stride); \ +} +#define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__) + +#define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) { \ + LD_B2(RTYPE, (psrc), stride, out0, out1); \ + LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3); \ +} +#define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__) + +/* Description : Store two vectors with stride each having 16 'byte' sized + elements + Arguments : Inputs - in0, in1, pdst, stride + Details : Store 16 byte elements from 'in0' to (pdst) + Store 16 byte elements from 'in1' to (pdst + stride) +*/ +#define ST_B2(RTYPE, in0, in1, pdst, stride) { \ + ST_B(RTYPE, in0, (pdst)); \ + ST_B(RTYPE, in1, (pdst) + stride); \ +} +#define ST_UB2(...) ST_B2(v16u8, __VA_ARGS__) +# +#define ST_B4(RTYPE, in0, in1, in2, in3, pdst, stride) { \ + ST_B2(RTYPE, in0, in1, (pdst), stride); \ + ST_B2(RTYPE, in2, in3, (pdst) + 2 * stride, stride); \ +} +#define ST_UB4(...) ST_B4(v16u8, __VA_ARGS__) +# +/* Description : Shuffle byte vector elements as per mask vector + Arguments : Inputs - in0, in1, in2, in3, mask0, mask1 + Outputs - out0, out1 + Return Type - as per RTYPE + Details : Byte elements from 'in0' & 'in1' are copied selectively to + 'out0' as per control vector 'mask0' +*/ +#define VSHF_B2(RTYPE, in0, in1, in2, in3, mask0, mask1, out0, out1) { \ + out0 = (RTYPE) __msa_vshf_b((v16i8) mask0, (v16i8) in1, (v16i8) in0); \ + out1 = (RTYPE) __msa_vshf_b((v16i8) mask1, (v16i8) in3, (v16i8) in2); \ +} +#define VSHF_B2_UB(...) VSHF_B2(v16u8, __VA_ARGS__) + +#endif /* !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) */ + +#endif // INCLUDE_LIBYUV_MACROS_MSA_H_ diff --git a/phonelibs/libyuv/include/libyuv/mjpeg_decoder.h b/phonelibs/libyuv/include/libyuv/mjpeg_decoder.h new file mode 100644 index 00000000000000..4975bae5b76ef1 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/mjpeg_decoder.h @@ -0,0 +1,192 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_MJPEG_DECODER_H_ +#define INCLUDE_LIBYUV_MJPEG_DECODER_H_ + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +// NOTE: For a simplified public API use convert.h MJPGToI420(). + +struct jpeg_common_struct; +struct jpeg_decompress_struct; +struct jpeg_source_mgr; + +namespace libyuv { + +#ifdef __cplusplus +extern "C" { +#endif + +LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size); + +#ifdef __cplusplus +} // extern "C" +#endif + +static const uint32 kUnknownDataSize = 0xFFFFFFFF; + +enum JpegSubsamplingType { + kJpegYuv420, + kJpegYuv422, + kJpegYuv411, + kJpegYuv444, + kJpegYuv400, + kJpegUnknown +}; + +struct Buffer { + const uint8* data; + int len; +}; + +struct BufferVector { + Buffer* buffers; + int len; + int pos; +}; + +struct SetJmpErrorMgr; + +// MJPEG ("Motion JPEG") is a pseudo-standard video codec where the frames are +// simply independent JPEG images with a fixed huffman table (which is omitted). +// It is rarely used in video transmission, but is common as a camera capture +// format, especially in Logitech devices. This class implements a decoder for +// MJPEG frames. +// +// See http://tools.ietf.org/html/rfc2435 +class LIBYUV_API MJpegDecoder { + public: + typedef void (*CallbackFunction)(void* opaque, + const uint8* const* data, + const int* strides, + int rows); + + static const int kColorSpaceUnknown; + static const int kColorSpaceGrayscale; + static const int kColorSpaceRgb; + static const int kColorSpaceYCbCr; + static const int kColorSpaceCMYK; + static const int kColorSpaceYCCK; + + MJpegDecoder(); + ~MJpegDecoder(); + + // Loads a new frame, reads its headers, and determines the uncompressed + // image format. + // Returns LIBYUV_TRUE if image looks valid and format is supported. + // If return value is LIBYUV_TRUE, then the values for all the following + // getters are populated. + // src_len is the size of the compressed mjpeg frame in bytes. + LIBYUV_BOOL LoadFrame(const uint8* src, size_t src_len); + + // Returns width of the last loaded frame in pixels. + int GetWidth(); + + // Returns height of the last loaded frame in pixels. + int GetHeight(); + + // Returns format of the last loaded frame. The return value is one of the + // kColorSpace* constants. + int GetColorSpace(); + + // Number of color components in the color space. + int GetNumComponents(); + + // Sample factors of the n-th component. + int GetHorizSampFactor(int component); + + int GetVertSampFactor(int component); + + int GetHorizSubSampFactor(int component); + + int GetVertSubSampFactor(int component); + + // Public for testability. + int GetImageScanlinesPerImcuRow(); + + // Public for testability. + int GetComponentScanlinesPerImcuRow(int component); + + // Width of a component in bytes. + int GetComponentWidth(int component); + + // Height of a component. + int GetComponentHeight(int component); + + // Width of a component in bytes with padding for DCTSIZE. Public for testing. + int GetComponentStride(int component); + + // Size of a component in bytes. + int GetComponentSize(int component); + + // Call this after LoadFrame() if you decide you don't want to decode it + // after all. + LIBYUV_BOOL UnloadFrame(); + + // Decodes the entire image into a one-buffer-per-color-component format. + // dst_width must match exactly. dst_height must be <= to image height; if + // less, the image is cropped. "planes" must have size equal to at least + // GetNumComponents() and they must point to non-overlapping buffers of size + // at least GetComponentSize(i). The pointers in planes are incremented + // to point to after the end of the written data. + // TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded. + LIBYUV_BOOL DecodeToBuffers(uint8** planes, int dst_width, int dst_height); + + // Decodes the entire image and passes the data via repeated calls to a + // callback function. Each call will get the data for a whole number of + // image scanlines. + // TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded. + LIBYUV_BOOL DecodeToCallback(CallbackFunction fn, void* opaque, + int dst_width, int dst_height); + + // The helper function which recognizes the jpeg sub-sampling type. + static JpegSubsamplingType JpegSubsamplingTypeHelper( + int* subsample_x, int* subsample_y, int number_of_components); + + private: + void AllocOutputBuffers(int num_outbufs); + void DestroyOutputBuffers(); + + LIBYUV_BOOL StartDecode(); + LIBYUV_BOOL FinishDecode(); + + void SetScanlinePointers(uint8** data); + LIBYUV_BOOL DecodeImcuRow(); + + int GetComponentScanlinePadding(int component); + + // A buffer holding the input data for a frame. + Buffer buf_; + BufferVector buf_vec_; + + jpeg_decompress_struct* decompress_struct_; + jpeg_source_mgr* source_mgr_; + SetJmpErrorMgr* error_mgr_; + + // LIBYUV_TRUE iff at least one component has scanline padding. (i.e., + // GetComponentScanlinePadding() != 0.) + LIBYUV_BOOL has_scanline_padding_; + + // Temporaries used to point to scanline outputs. + int num_outbufs_; // Outermost size of all arrays below. + uint8*** scanlines_; + int* scanlines_sizes_; + // Temporary buffer used for decoding when we can't decode directly to the + // output buffers. Large enough for just one iMCU row. + uint8** databuf_; + int* databuf_strides_; +}; + +} // namespace libyuv + +#endif // __cplusplus +#endif // INCLUDE_LIBYUV_MJPEG_DECODER_H_ diff --git a/phonelibs/libyuv/include/libyuv/planar_functions.h b/phonelibs/libyuv/include/libyuv/planar_functions.h new file mode 100644 index 00000000000000..1b57b29261eeb3 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/planar_functions.h @@ -0,0 +1,529 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_ +#define INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_ + +#include "libyuv/basic_types.h" + +// TODO(fbarchard): Remove the following headers includes. +#include "libyuv/convert.h" +#include "libyuv/convert_argb.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Copy a plane of data. +LIBYUV_API +void CopyPlane(const uint8* src_y, int src_stride_y, + uint8* dst_y, int dst_stride_y, + int width, int height); + +LIBYUV_API +void CopyPlane_16(const uint16* src_y, int src_stride_y, + uint16* dst_y, int dst_stride_y, + int width, int height); + +// Set a plane of data to a 32 bit value. +LIBYUV_API +void SetPlane(uint8* dst_y, int dst_stride_y, + int width, int height, + uint32 value); + +// Split interleaved UV plane into separate U and V planes. +LIBYUV_API +void SplitUVPlane(const uint8* src_uv, int src_stride_uv, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Merge separate U and V planes into one interleaved UV plane. +LIBYUV_API +void MergeUVPlane(const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_uv, int dst_stride_uv, + int width, int height); + +// Copy I400. Supports inverting. +LIBYUV_API +int I400ToI400(const uint8* src_y, int src_stride_y, + uint8* dst_y, int dst_stride_y, + int width, int height); + +#define J400ToJ400 I400ToI400 + +// Copy I422 to I422. +#define I422ToI422 I422Copy +LIBYUV_API +int I422Copy(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Copy I444 to I444. +#define I444ToI444 I444Copy +LIBYUV_API +int I444Copy(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert YUY2 to I422. +LIBYUV_API +int YUY2ToI422(const uint8* src_yuy2, int src_stride_yuy2, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Convert UYVY to I422. +LIBYUV_API +int UYVYToI422(const uint8* src_uyvy, int src_stride_uyvy, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +LIBYUV_API +int YUY2ToNV12(const uint8* src_yuy2, int src_stride_yuy2, + uint8* dst_y, int dst_stride_y, + uint8* dst_uv, int dst_stride_uv, + int width, int height); + +LIBYUV_API +int UYVYToNV12(const uint8* src_uyvy, int src_stride_uyvy, + uint8* dst_y, int dst_stride_y, + uint8* dst_uv, int dst_stride_uv, + int width, int height); + +// Convert I420 to I400. (calls CopyPlane ignoring u/v). +LIBYUV_API +int I420ToI400(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + int width, int height); + +// Alias +#define J420ToJ400 I420ToI400 +#define I420ToI420Mirror I420Mirror + +// I420 mirror. +LIBYUV_API +int I420Mirror(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Alias +#define I400ToI400Mirror I400Mirror + +// I400 mirror. A single plane is mirrored horizontally. +// Pass negative height to achieve 180 degree rotation. +LIBYUV_API +int I400Mirror(const uint8* src_y, int src_stride_y, + uint8* dst_y, int dst_stride_y, + int width, int height); + +// Alias +#define ARGBToARGBMirror ARGBMirror + +// ARGB mirror. +LIBYUV_API +int ARGBMirror(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert NV12 to RGB565. +LIBYUV_API +int NV12ToRGB565(const uint8* src_y, int src_stride_y, + const uint8* src_uv, int src_stride_uv, + uint8* dst_rgb565, int dst_stride_rgb565, + int width, int height); + +// I422ToARGB is in convert_argb.h +// Convert I422 to BGRA. +LIBYUV_API +int I422ToBGRA(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_bgra, int dst_stride_bgra, + int width, int height); + +// Convert I422 to ABGR. +LIBYUV_API +int I422ToABGR(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_abgr, int dst_stride_abgr, + int width, int height); + +// Convert I422 to RGBA. +LIBYUV_API +int I422ToRGBA(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_rgba, int dst_stride_rgba, + int width, int height); + +// Alias +#define RGB24ToRAW RAWToRGB24 + +LIBYUV_API +int RAWToRGB24(const uint8* src_raw, int src_stride_raw, + uint8* dst_rgb24, int dst_stride_rgb24, + int width, int height); + +// Draw a rectangle into I420. +LIBYUV_API +int I420Rect(uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int x, int y, int width, int height, + int value_y, int value_u, int value_v); + +// Draw a rectangle into ARGB. +LIBYUV_API +int ARGBRect(uint8* dst_argb, int dst_stride_argb, + int x, int y, int width, int height, uint32 value); + +// Convert ARGB to gray scale ARGB. +LIBYUV_API +int ARGBGrayTo(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Make a rectangle of ARGB gray scale. +LIBYUV_API +int ARGBGray(uint8* dst_argb, int dst_stride_argb, + int x, int y, int width, int height); + +// Make a rectangle of ARGB Sepia tone. +LIBYUV_API +int ARGBSepia(uint8* dst_argb, int dst_stride_argb, + int x, int y, int width, int height); + +// Apply a matrix rotation to each ARGB pixel. +// matrix_argb is 4 signed ARGB values. -128 to 127 representing -2 to 2. +// The first 4 coefficients apply to B, G, R, A and produce B of the output. +// The next 4 coefficients apply to B, G, R, A and produce G of the output. +// The next 4 coefficients apply to B, G, R, A and produce R of the output. +// The last 4 coefficients apply to B, G, R, A and produce A of the output. +LIBYUV_API +int ARGBColorMatrix(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + const int8* matrix_argb, + int width, int height); + +// Deprecated. Use ARGBColorMatrix instead. +// Apply a matrix rotation to each ARGB pixel. +// matrix_argb is 3 signed ARGB values. -128 to 127 representing -1 to 1. +// The first 4 coefficients apply to B, G, R, A and produce B of the output. +// The next 4 coefficients apply to B, G, R, A and produce G of the output. +// The last 4 coefficients apply to B, G, R, A and produce R of the output. +LIBYUV_API +int RGBColorMatrix(uint8* dst_argb, int dst_stride_argb, + const int8* matrix_rgb, + int x, int y, int width, int height); + +// Apply a color table each ARGB pixel. +// Table contains 256 ARGB values. +LIBYUV_API +int ARGBColorTable(uint8* dst_argb, int dst_stride_argb, + const uint8* table_argb, + int x, int y, int width, int height); + +// Apply a color table each ARGB pixel but preserve destination alpha. +// Table contains 256 ARGB values. +LIBYUV_API +int RGBColorTable(uint8* dst_argb, int dst_stride_argb, + const uint8* table_argb, + int x, int y, int width, int height); + +// Apply a luma/color table each ARGB pixel but preserve destination alpha. +// Table contains 32768 values indexed by [Y][C] where 7 it 7 bit luma from +// RGB (YJ style) and C is an 8 bit color component (R, G or B). +LIBYUV_API +int ARGBLumaColorTable(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + const uint8* luma_rgb_table, + int width, int height); + +// Apply a 3 term polynomial to ARGB values. +// poly points to a 4x4 matrix. The first row is constants. The 2nd row is +// coefficients for b, g, r and a. The 3rd row is coefficients for b squared, +// g squared, r squared and a squared. The 4rd row is coefficients for b to +// the 3, g to the 3, r to the 3 and a to the 3. The values are summed and +// result clamped to 0 to 255. +// A polynomial approximation can be dirived using software such as 'R'. + +LIBYUV_API +int ARGBPolynomial(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + const float* poly, + int width, int height); + +// Convert plane of 16 bit shorts to half floats. +// Source values are multiplied by scale before storing as half float. +LIBYUV_API +int HalfFloatPlane(const uint16* src_y, int src_stride_y, + uint16* dst_y, int dst_stride_y, + float scale, + int width, int height); + +// Quantize a rectangle of ARGB. Alpha unaffected. +// scale is a 16 bit fractional fixed point scaler between 0 and 65535. +// interval_size should be a value between 1 and 255. +// interval_offset should be a value between 0 and 255. +LIBYUV_API +int ARGBQuantize(uint8* dst_argb, int dst_stride_argb, + int scale, int interval_size, int interval_offset, + int x, int y, int width, int height); + +// Copy ARGB to ARGB. +LIBYUV_API +int ARGBCopy(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Copy Alpha channel of ARGB to alpha of ARGB. +LIBYUV_API +int ARGBCopyAlpha(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Extract the alpha channel from ARGB. +LIBYUV_API +int ARGBExtractAlpha(const uint8* src_argb, int src_stride_argb, + uint8* dst_a, int dst_stride_a, + int width, int height); + +// Copy Y channel to Alpha of ARGB. +LIBYUV_API +int ARGBCopyYToAlpha(const uint8* src_y, int src_stride_y, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +typedef void (*ARGBBlendRow)(const uint8* src_argb0, const uint8* src_argb1, + uint8* dst_argb, int width); + +// Get function to Alpha Blend ARGB pixels and store to destination. +LIBYUV_API +ARGBBlendRow GetARGBBlend(); + +// Alpha Blend ARGB images and store to destination. +// Source is pre-multiplied by alpha using ARGBAttenuate. +// Alpha of destination is set to 255. +LIBYUV_API +int ARGBBlend(const uint8* src_argb0, int src_stride_argb0, + const uint8* src_argb1, int src_stride_argb1, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Alpha Blend plane and store to destination. +// Source is not pre-multiplied by alpha. +LIBYUV_API +int BlendPlane(const uint8* src_y0, int src_stride_y0, + const uint8* src_y1, int src_stride_y1, + const uint8* alpha, int alpha_stride, + uint8* dst_y, int dst_stride_y, + int width, int height); + +// Alpha Blend YUV images and store to destination. +// Source is not pre-multiplied by alpha. +// Alpha is full width x height and subsampled to half size to apply to UV. +LIBYUV_API +int I420Blend(const uint8* src_y0, int src_stride_y0, + const uint8* src_u0, int src_stride_u0, + const uint8* src_v0, int src_stride_v0, + const uint8* src_y1, int src_stride_y1, + const uint8* src_u1, int src_stride_u1, + const uint8* src_v1, int src_stride_v1, + const uint8* alpha, int alpha_stride, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height); + +// Multiply ARGB image by ARGB image. Shifted down by 8. Saturates to 255. +LIBYUV_API +int ARGBMultiply(const uint8* src_argb0, int src_stride_argb0, + const uint8* src_argb1, int src_stride_argb1, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Add ARGB image with ARGB image. Saturates to 255. +LIBYUV_API +int ARGBAdd(const uint8* src_argb0, int src_stride_argb0, + const uint8* src_argb1, int src_stride_argb1, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Subtract ARGB image (argb1) from ARGB image (argb0). Saturates to 0. +LIBYUV_API +int ARGBSubtract(const uint8* src_argb0, int src_stride_argb0, + const uint8* src_argb1, int src_stride_argb1, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I422 to YUY2. +LIBYUV_API +int I422ToYUY2(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + int width, int height); + +// Convert I422 to UYVY. +LIBYUV_API +int I422ToUYVY(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_frame, int dst_stride_frame, + int width, int height); + +// Convert unattentuated ARGB to preattenuated ARGB. +LIBYUV_API +int ARGBAttenuate(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Convert preattentuated ARGB to unattenuated ARGB. +LIBYUV_API +int ARGBUnattenuate(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Internal function - do not call directly. +// Computes table of cumulative sum for image where the value is the sum +// of all values above and to the left of the entry. Used by ARGBBlur. +LIBYUV_API +int ARGBComputeCumulativeSum(const uint8* src_argb, int src_stride_argb, + int32* dst_cumsum, int dst_stride32_cumsum, + int width, int height); + +// Blur ARGB image. +// dst_cumsum table of width * (height + 1) * 16 bytes aligned to +// 16 byte boundary. +// dst_stride32_cumsum is number of ints in a row (width * 4). +// radius is number of pixels around the center. e.g. 1 = 3x3. 2=5x5. +// Blur is optimized for radius of 5 (11x11) or less. +LIBYUV_API +int ARGBBlur(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int32* dst_cumsum, int dst_stride32_cumsum, + int width, int height, int radius); + +// Multiply ARGB image by ARGB value. +LIBYUV_API +int ARGBShade(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height, uint32 value); + +// Interpolate between two images using specified amount of interpolation +// (0 to 255) and store to destination. +// 'interpolation' is specified as 8 bit fraction where 0 means 100% src0 +// and 255 means 1% src0 and 99% src1. +LIBYUV_API +int InterpolatePlane(const uint8* src0, int src_stride0, + const uint8* src1, int src_stride1, + uint8* dst, int dst_stride, + int width, int height, int interpolation); + +// Interpolate between two ARGB images using specified amount of interpolation +// Internally calls InterpolatePlane with width * 4 (bpp). +LIBYUV_API +int ARGBInterpolate(const uint8* src_argb0, int src_stride_argb0, + const uint8* src_argb1, int src_stride_argb1, + uint8* dst_argb, int dst_stride_argb, + int width, int height, int interpolation); + +// Interpolate between two YUV images using specified amount of interpolation +// Internally calls InterpolatePlane on each plane where the U and V planes +// are half width and half height. +LIBYUV_API +int I420Interpolate(const uint8* src0_y, int src0_stride_y, + const uint8* src0_u, int src0_stride_u, + const uint8* src0_v, int src0_stride_v, + const uint8* src1_y, int src1_stride_y, + const uint8* src1_u, int src1_stride_u, + const uint8* src1_v, int src1_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int width, int height, int interpolation); + +#if defined(__pnacl__) || defined(__CLR_VER) || \ + (defined(__i386__) && !defined(__SSE2__)) +#define LIBYUV_DISABLE_X86 +#endif +// MemorySanitizer does not support assembly code yet. http://crbug.com/344505 +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#define LIBYUV_DISABLE_X86 +#endif +#endif +// The following are available on all x86 platforms: +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) +#define HAS_ARGBAFFINEROW_SSE2 +#endif + +// Row function for copying pixels from a source with a slope to a row +// of destination. Useful for scaling, rotation, mirror, texture mapping. +LIBYUV_API +void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride, + uint8* dst_argb, const float* uv_dudv, int width); +LIBYUV_API +void ARGBAffineRow_SSE2(const uint8* src_argb, int src_argb_stride, + uint8* dst_argb, const float* uv_dudv, int width); + +// Shuffle ARGB channel order. e.g. BGRA to ARGB. +// shuffler is 16 bytes and must be aligned. +LIBYUV_API +int ARGBShuffle(const uint8* src_bgra, int src_stride_bgra, + uint8* dst_argb, int dst_stride_argb, + const uint8* shuffler, int width, int height); + +// Sobel ARGB effect with planar output. +LIBYUV_API +int ARGBSobelToPlane(const uint8* src_argb, int src_stride_argb, + uint8* dst_y, int dst_stride_y, + int width, int height); + +// Sobel ARGB effect. +LIBYUV_API +int ARGBSobel(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +// Sobel ARGB effect w/ Sobel X, Sobel, Sobel Y in ARGB. +LIBYUV_API +int ARGBSobelXY(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int width, int height); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_ diff --git a/phonelibs/libyuv/include/libyuv/rotate.h b/phonelibs/libyuv/include/libyuv/rotate.h new file mode 100644 index 00000000000000..8a2da9a5aad5c5 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/rotate.h @@ -0,0 +1,117 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_ROTATE_H_ +#define INCLUDE_LIBYUV_ROTATE_H_ + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Supported rotation. +typedef enum RotationMode { + kRotate0 = 0, // No rotation. + kRotate90 = 90, // Rotate 90 degrees clockwise. + kRotate180 = 180, // Rotate 180 degrees. + kRotate270 = 270, // Rotate 270 degrees clockwise. + + // Deprecated. + kRotateNone = 0, + kRotateClockwise = 90, + kRotateCounterClockwise = 270, +} RotationModeEnum; + +// Rotate I420 frame. +LIBYUV_API +int I420Rotate(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int src_width, int src_height, enum RotationMode mode); + +// Rotate NV12 input and store in I420. +LIBYUV_API +int NV12ToI420Rotate(const uint8* src_y, int src_stride_y, + const uint8* src_uv, int src_stride_uv, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int src_width, int src_height, enum RotationMode mode); + +// Rotate a plane by 0, 90, 180, or 270. +LIBYUV_API +int RotatePlane(const uint8* src, int src_stride, + uint8* dst, int dst_stride, + int src_width, int src_height, enum RotationMode mode); + +// Rotate planes by 90, 180, 270. Deprecated. +LIBYUV_API +void RotatePlane90(const uint8* src, int src_stride, + uint8* dst, int dst_stride, + int width, int height); + +LIBYUV_API +void RotatePlane180(const uint8* src, int src_stride, + uint8* dst, int dst_stride, + int width, int height); + +LIBYUV_API +void RotatePlane270(const uint8* src, int src_stride, + uint8* dst, int dst_stride, + int width, int height); + +LIBYUV_API +void RotateUV90(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, + int width, int height); + +// Rotations for when U and V are interleaved. +// These functions take one input pointer and +// split the data into two buffers while +// rotating them. Deprecated. +LIBYUV_API +void RotateUV180(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, + int width, int height); + +LIBYUV_API +void RotateUV270(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, + int width, int height); + +// The 90 and 270 functions are based on transposes. +// Doing a transpose with reversing the read/write +// order will result in a rotation by +- 90 degrees. +// Deprecated. +LIBYUV_API +void TransposePlane(const uint8* src, int src_stride, + uint8* dst, int dst_stride, + int width, int height); + +LIBYUV_API +void TransposeUV(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, + int width, int height); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_ROTATE_H_ diff --git a/phonelibs/libyuv/include/libyuv/rotate_argb.h b/phonelibs/libyuv/include/libyuv/rotate_argb.h new file mode 100644 index 00000000000000..21fe7e1807c334 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/rotate_argb.h @@ -0,0 +1,33 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_ROTATE_ARGB_H_ +#define INCLUDE_LIBYUV_ROTATE_ARGB_H_ + +#include "libyuv/basic_types.h" +#include "libyuv/rotate.h" // For RotationMode. + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Rotate ARGB frame +LIBYUV_API +int ARGBRotate(const uint8* src_argb, int src_stride_argb, + uint8* dst_argb, int dst_stride_argb, + int src_width, int src_height, enum RotationMode mode); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_ROTATE_ARGB_H_ diff --git a/phonelibs/libyuv/include/libyuv/rotate_row.h b/phonelibs/libyuv/include/libyuv/rotate_row.h new file mode 100644 index 00000000000000..6abd201677460b --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/rotate_row.h @@ -0,0 +1,121 @@ +/* + * Copyright 2013 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_ROTATE_ROW_H_ +#define INCLUDE_LIBYUV_ROTATE_ROW_H_ + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +#if defined(__pnacl__) || defined(__CLR_VER) || \ + (defined(__i386__) && !defined(__SSE2__)) +#define LIBYUV_DISABLE_X86 +#endif +// MemorySanitizer does not support assembly code yet. http://crbug.com/344505 +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#define LIBYUV_DISABLE_X86 +#endif +#endif +// The following are available for Visual C and clangcl 32 bit: +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) +#define HAS_TRANSPOSEWX8_SSSE3 +#define HAS_TRANSPOSEUVWX8_SSE2 +#endif + +// The following are available for GCC 32 or 64 bit but not NaCL for 64 bit: +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(__i386__) || (defined(__x86_64__) && !defined(__native_client__))) +#define HAS_TRANSPOSEWX8_SSSE3 +#endif + +// The following are available for 64 bit GCC but not NaCL: +#if !defined(LIBYUV_DISABLE_X86) && !defined(__native_client__) && \ + defined(__x86_64__) +#define HAS_TRANSPOSEWX8_FAST_SSSE3 +#define HAS_TRANSPOSEUVWX8_SSE2 +#endif + +#if !defined(LIBYUV_DISABLE_NEON) && !defined(__native_client__) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__)) +#define HAS_TRANSPOSEWX8_NEON +#define HAS_TRANSPOSEUVWX8_NEON +#endif + +#if !defined(LIBYUV_DISABLE_MIPS) && !defined(__native_client__) && \ + defined(__mips__) && \ + defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#define HAS_TRANSPOSEWX8_DSPR2 +#define HAS_TRANSPOSEUVWX8_DSPR2 +#endif // defined(__mips__) + +void TransposeWxH_C(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width, int height); + +void TransposeWx8_C(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); +void TransposeWx8_NEON(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); +void TransposeWx8_SSSE3(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); +void TransposeWx8_Fast_SSSE3(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); +void TransposeWx8_DSPR2(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); +void TransposeWx8_Fast_DSPR2(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); + +void TransposeWx8_Any_NEON(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); +void TransposeWx8_Any_SSSE3(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); +void TransposeWx8_Fast_Any_SSSE3(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); +void TransposeWx8_Any_DSPR2(const uint8* src, int src_stride, + uint8* dst, int dst_stride, int width); + +void TransposeUVWxH_C(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, + int width, int height); + +void TransposeUVWx8_C(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, int width); +void TransposeUVWx8_SSE2(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, int width); +void TransposeUVWx8_NEON(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, int width); +void TransposeUVWx8_DSPR2(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, int width); + +void TransposeUVWx8_Any_SSE2(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, int width); +void TransposeUVWx8_Any_NEON(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, int width); +void TransposeUVWx8_Any_DSPR2(const uint8* src, int src_stride, + uint8* dst_a, int dst_stride_a, + uint8* dst_b, int dst_stride_b, int width); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_ROTATE_ROW_H_ diff --git a/phonelibs/libyuv/include/libyuv/row.h b/phonelibs/libyuv/include/libyuv/row.h new file mode 100644 index 00000000000000..b810221ec7a787 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/row.h @@ -0,0 +1,1963 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_ROW_H_ +#define INCLUDE_LIBYUV_ROW_H_ + +#include // For malloc. + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +#define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1))) + +#define align_buffer_64(var, size) \ + uint8* var##_mem = (uint8*)(malloc((size) + 63)); /* NOLINT */ \ + uint8* var = (uint8*)(((intptr_t)(var##_mem) + 63) & ~63) /* NOLINT */ + +#define free_aligned_buffer_64(var) \ + free(var##_mem); \ + var = 0 + +#if defined(__pnacl__) || defined(__CLR_VER) || \ + (defined(__i386__) && !defined(__SSE2__)) +#define LIBYUV_DISABLE_X86 +#endif +// MemorySanitizer does not support assembly code yet. http://crbug.com/344505 +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#define LIBYUV_DISABLE_X86 +#endif +#endif +// True if compiling for SSSE3 as a requirement. +#if defined(__SSSE3__) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 3)) +#define LIBYUV_SSSE3_ONLY +#endif + +#if defined(__native_client__) +#define LIBYUV_DISABLE_NEON +#endif +// clang >= 3.5.0 required for Arm64. +#if defined(__clang__) && defined(__aarch64__) && !defined(LIBYUV_DISABLE_NEON) +#if (__clang_major__ < 3) || (__clang_major__ == 3 && (__clang_minor__ < 5)) +#define LIBYUV_DISABLE_NEON +#endif // clang >= 3.5 +#endif // __clang__ + +// GCC >= 4.7.0 required for AVX2. +#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) +#if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7)) +#define GCC_HAS_AVX2 1 +#endif // GNUC >= 4.7 +#endif // __GNUC__ + +// clang >= 3.4.0 required for AVX2. +#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) +#if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4)) +#define CLANG_HAS_AVX2 1 +#endif // clang >= 3.4 +#endif // __clang__ + +// Visual C 2012 required for AVX2. +#if defined(_M_IX86) && !defined(__clang__) && \ + defined(_MSC_VER) && _MSC_VER >= 1700 +#define VISUALC_HAS_AVX2 1 +#endif // VisualStudio >= 2012 + +// The following are available on all x86 platforms: +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) +// Conversions: +#define HAS_ABGRTOUVROW_SSSE3 +#define HAS_ABGRTOYROW_SSSE3 +#define HAS_ARGB1555TOARGBROW_SSE2 +#define HAS_ARGB4444TOARGBROW_SSE2 +#define HAS_ARGBSETROW_X86 +#define HAS_ARGBSHUFFLEROW_SSE2 +#define HAS_ARGBSHUFFLEROW_SSSE3 +#define HAS_ARGBTOARGB1555ROW_SSE2 +#define HAS_ARGBTOARGB4444ROW_SSE2 +#define HAS_ARGBTORAWROW_SSSE3 +#define HAS_ARGBTORGB24ROW_SSSE3 +#define HAS_ARGBTORGB565DITHERROW_SSE2 +#define HAS_ARGBTORGB565ROW_SSE2 +#define HAS_ARGBTOUV444ROW_SSSE3 +#define HAS_ARGBTOUVJROW_SSSE3 +#define HAS_ARGBTOUVROW_SSSE3 +#define HAS_ARGBTOYJROW_SSSE3 +#define HAS_ARGBTOYROW_SSSE3 +#define HAS_ARGBEXTRACTALPHAROW_SSE2 +#define HAS_BGRATOUVROW_SSSE3 +#define HAS_BGRATOYROW_SSSE3 +#define HAS_COPYROW_ERMS +#define HAS_COPYROW_SSE2 +#define HAS_H422TOARGBROW_SSSE3 +#define HAS_I400TOARGBROW_SSE2 +#define HAS_I422TOARGB1555ROW_SSSE3 +#define HAS_I422TOARGB4444ROW_SSSE3 +#define HAS_I422TOARGBROW_SSSE3 +#define HAS_I422TORGB24ROW_SSSE3 +#define HAS_I422TORGB565ROW_SSSE3 +#define HAS_I422TORGBAROW_SSSE3 +#define HAS_I422TOUYVYROW_SSE2 +#define HAS_I422TOYUY2ROW_SSE2 +#define HAS_I444TOARGBROW_SSSE3 +#define HAS_J400TOARGBROW_SSE2 +#define HAS_J422TOARGBROW_SSSE3 +#define HAS_MERGEUVROW_SSE2 +#define HAS_MIRRORROW_SSSE3 +#define HAS_MIRRORUVROW_SSSE3 +#define HAS_NV12TOARGBROW_SSSE3 +#define HAS_NV12TORGB565ROW_SSSE3 +#define HAS_NV21TOARGBROW_SSSE3 +#define HAS_RAWTOARGBROW_SSSE3 +#define HAS_RAWTORGB24ROW_SSSE3 +#define HAS_RAWTOYROW_SSSE3 +#define HAS_RGB24TOARGBROW_SSSE3 +#define HAS_RGB24TOYROW_SSSE3 +#define HAS_RGB565TOARGBROW_SSE2 +#define HAS_RGBATOUVROW_SSSE3 +#define HAS_RGBATOYROW_SSSE3 +#define HAS_SETROW_ERMS +#define HAS_SETROW_X86 +#define HAS_SPLITUVROW_SSE2 +#define HAS_UYVYTOARGBROW_SSSE3 +#define HAS_UYVYTOUV422ROW_SSE2 +#define HAS_UYVYTOUVROW_SSE2 +#define HAS_UYVYTOYROW_SSE2 +#define HAS_YUY2TOARGBROW_SSSE3 +#define HAS_YUY2TOUV422ROW_SSE2 +#define HAS_YUY2TOUVROW_SSE2 +#define HAS_YUY2TOYROW_SSE2 + +// Effects: +#define HAS_ARGBADDROW_SSE2 +#define HAS_ARGBAFFINEROW_SSE2 +#define HAS_ARGBATTENUATEROW_SSSE3 +#define HAS_ARGBBLENDROW_SSSE3 +#define HAS_ARGBCOLORMATRIXROW_SSSE3 +#define HAS_ARGBCOLORTABLEROW_X86 +#define HAS_ARGBCOPYALPHAROW_SSE2 +#define HAS_ARGBCOPYYTOALPHAROW_SSE2 +#define HAS_ARGBGRAYROW_SSSE3 +#define HAS_ARGBLUMACOLORTABLEROW_SSSE3 +#define HAS_ARGBMIRRORROW_SSE2 +#define HAS_ARGBMULTIPLYROW_SSE2 +#define HAS_ARGBPOLYNOMIALROW_SSE2 +#define HAS_ARGBQUANTIZEROW_SSE2 +#define HAS_ARGBSEPIAROW_SSSE3 +#define HAS_ARGBSHADEROW_SSE2 +#define HAS_ARGBSUBTRACTROW_SSE2 +#define HAS_ARGBUNATTENUATEROW_SSE2 +#define HAS_BLENDPLANEROW_SSSE3 +#define HAS_COMPUTECUMULATIVESUMROW_SSE2 +#define HAS_CUMULATIVESUMTOAVERAGEROW_SSE2 +#define HAS_INTERPOLATEROW_SSSE3 +#define HAS_RGBCOLORTABLEROW_X86 +#define HAS_SOBELROW_SSE2 +#define HAS_SOBELTOPLANEROW_SSE2 +#define HAS_SOBELXROW_SSE2 +#define HAS_SOBELXYROW_SSE2 +#define HAS_SOBELYROW_SSE2 + +// The following functions fail on gcc/clang 32 bit with fpic and framepointer. +// caveat: clangcl uses row_win.cc which works. +#if defined(NDEBUG) || !(defined(_DEBUG) && defined(__i386__)) || \ + !defined(__i386__) || defined(_MSC_VER) +// TODO(fbarchard): fix build error on x86 debug +// https://code.google.com/p/libyuv/issues/detail?id=524 +#define HAS_I411TOARGBROW_SSSE3 +// TODO(fbarchard): fix build error on android_full_debug=1 +// https://code.google.com/p/libyuv/issues/detail?id=517 +#define HAS_I422ALPHATOARGBROW_SSSE3 +#endif +#endif + +// The following are available on all x86 platforms, but +// require VS2012, clang 3.4 or gcc 4.7. +// The code supports NaCL but requires a new compiler and validator. +#if !defined(LIBYUV_DISABLE_X86) && (defined(VISUALC_HAS_AVX2) || \ + defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2)) +#define HAS_ARGBCOPYALPHAROW_AVX2 +#define HAS_ARGBCOPYYTOALPHAROW_AVX2 +#define HAS_ARGBMIRRORROW_AVX2 +#define HAS_ARGBPOLYNOMIALROW_AVX2 +#define HAS_ARGBSHUFFLEROW_AVX2 +#define HAS_ARGBTORGB565DITHERROW_AVX2 +#define HAS_ARGBTOUVJROW_AVX2 +#define HAS_ARGBTOUVROW_AVX2 +#define HAS_ARGBTOYJROW_AVX2 +#define HAS_ARGBTOYROW_AVX2 +#define HAS_COPYROW_AVX +#define HAS_H422TOARGBROW_AVX2 +#define HAS_I400TOARGBROW_AVX2 +#if !(defined(_DEBUG) && defined(__i386__)) +// TODO(fbarchard): fix build error on android_full_debug=1 +// https://code.google.com/p/libyuv/issues/detail?id=517 +#define HAS_I422ALPHATOARGBROW_AVX2 +#endif +#define HAS_I411TOARGBROW_AVX2 +#define HAS_I422TOARGB1555ROW_AVX2 +#define HAS_I422TOARGB4444ROW_AVX2 +#define HAS_I422TOARGBROW_AVX2 +#define HAS_I422TORGB24ROW_AVX2 +#define HAS_I422TORGB565ROW_AVX2 +#define HAS_I422TORGBAROW_AVX2 +#define HAS_I444TOARGBROW_AVX2 +#define HAS_INTERPOLATEROW_AVX2 +#define HAS_J422TOARGBROW_AVX2 +#define HAS_MERGEUVROW_AVX2 +#define HAS_MIRRORROW_AVX2 +#define HAS_NV12TOARGBROW_AVX2 +#define HAS_NV12TORGB565ROW_AVX2 +#define HAS_NV21TOARGBROW_AVX2 +#define HAS_SPLITUVROW_AVX2 +#define HAS_UYVYTOARGBROW_AVX2 +#define HAS_UYVYTOUV422ROW_AVX2 +#define HAS_UYVYTOUVROW_AVX2 +#define HAS_UYVYTOYROW_AVX2 +#define HAS_YUY2TOARGBROW_AVX2 +#define HAS_YUY2TOUV422ROW_AVX2 +#define HAS_YUY2TOUVROW_AVX2 +#define HAS_YUY2TOYROW_AVX2 +#define HAS_HALFFLOATROW_AVX2 + +// Effects: +#define HAS_ARGBADDROW_AVX2 +#define HAS_ARGBATTENUATEROW_AVX2 +#define HAS_ARGBMULTIPLYROW_AVX2 +#define HAS_ARGBSUBTRACTROW_AVX2 +#define HAS_ARGBUNATTENUATEROW_AVX2 +#define HAS_BLENDPLANEROW_AVX2 +#endif + +// The following are available for AVX2 Visual C and clangcl 32 bit: +// TODO(fbarchard): Port to gcc. +#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && \ + (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2)) +#define HAS_ARGB1555TOARGBROW_AVX2 +#define HAS_ARGB4444TOARGBROW_AVX2 +#define HAS_ARGBTOARGB1555ROW_AVX2 +#define HAS_ARGBTOARGB4444ROW_AVX2 +#define HAS_ARGBTORGB565ROW_AVX2 +#define HAS_J400TOARGBROW_AVX2 +#define HAS_RGB565TOARGBROW_AVX2 +#endif + +// The following are also available on x64 Visual C. +#if !defined(LIBYUV_DISABLE_X86) && defined(_MSC_VER) && defined(_M_X64) && \ + (!defined(__clang__) || defined(__SSSE3__)) +#define HAS_I422ALPHATOARGBROW_SSSE3 +#define HAS_I422TOARGBROW_SSSE3 +#endif + +// The following are available on gcc x86 platforms: +// TODO(fbarchard): Port to Visual C. +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER))) +#define HAS_HALFFLOATROW_SSE2 +#endif + +// The following are available on Neon platforms: +#if !defined(LIBYUV_DISABLE_NEON) && \ + (defined(__aarch64__) || defined(__ARM_NEON__) || defined(LIBYUV_NEON)) +#define HAS_ABGRTOUVROW_NEON +#define HAS_ABGRTOYROW_NEON +#define HAS_ARGB1555TOARGBROW_NEON +#define HAS_ARGB1555TOUVROW_NEON +#define HAS_ARGB1555TOYROW_NEON +#define HAS_ARGB4444TOARGBROW_NEON +#define HAS_ARGB4444TOUVROW_NEON +#define HAS_ARGB4444TOYROW_NEON +#define HAS_ARGBSETROW_NEON +#define HAS_ARGBTOARGB1555ROW_NEON +#define HAS_ARGBTOARGB4444ROW_NEON +#define HAS_ARGBTORAWROW_NEON +#define HAS_ARGBTORGB24ROW_NEON +#define HAS_ARGBTORGB565DITHERROW_NEON +#define HAS_ARGBTORGB565ROW_NEON +#define HAS_ARGBTOUV411ROW_NEON +#define HAS_ARGBTOUV444ROW_NEON +#define HAS_ARGBTOUVJROW_NEON +#define HAS_ARGBTOUVROW_NEON +#define HAS_ARGBTOYJROW_NEON +#define HAS_ARGBTOYROW_NEON +#define HAS_ARGBEXTRACTALPHAROW_NEON +#define HAS_BGRATOUVROW_NEON +#define HAS_BGRATOYROW_NEON +#define HAS_COPYROW_NEON +#define HAS_I400TOARGBROW_NEON +#define HAS_I411TOARGBROW_NEON +#define HAS_I422ALPHATOARGBROW_NEON +#define HAS_I422TOARGB1555ROW_NEON +#define HAS_I422TOARGB4444ROW_NEON +#define HAS_I422TOARGBROW_NEON +#define HAS_I422TORGB24ROW_NEON +#define HAS_I422TORGB565ROW_NEON +#define HAS_I422TORGBAROW_NEON +#define HAS_I422TOUYVYROW_NEON +#define HAS_I422TOYUY2ROW_NEON +#define HAS_I444TOARGBROW_NEON +#define HAS_J400TOARGBROW_NEON +#define HAS_MERGEUVROW_NEON +#define HAS_MIRRORROW_NEON +#define HAS_MIRRORUVROW_NEON +#define HAS_NV12TOARGBROW_NEON +#define HAS_NV12TORGB565ROW_NEON +#define HAS_NV21TOARGBROW_NEON +#define HAS_RAWTOARGBROW_NEON +#define HAS_RAWTORGB24ROW_NEON +#define HAS_RAWTOUVROW_NEON +#define HAS_RAWTOYROW_NEON +#define HAS_RGB24TOARGBROW_NEON +#define HAS_RGB24TOUVROW_NEON +#define HAS_RGB24TOYROW_NEON +#define HAS_RGB565TOARGBROW_NEON +#define HAS_RGB565TOUVROW_NEON +#define HAS_RGB565TOYROW_NEON +#define HAS_RGBATOUVROW_NEON +#define HAS_RGBATOYROW_NEON +#define HAS_SETROW_NEON +#define HAS_SPLITUVROW_NEON +#define HAS_UYVYTOARGBROW_NEON +#define HAS_UYVYTOUV422ROW_NEON +#define HAS_UYVYTOUVROW_NEON +#define HAS_UYVYTOYROW_NEON +#define HAS_YUY2TOARGBROW_NEON +#define HAS_YUY2TOUV422ROW_NEON +#define HAS_YUY2TOUVROW_NEON +#define HAS_YUY2TOYROW_NEON + +// Effects: +#define HAS_ARGBADDROW_NEON +#define HAS_ARGBATTENUATEROW_NEON +#define HAS_ARGBBLENDROW_NEON +#define HAS_ARGBCOLORMATRIXROW_NEON +#define HAS_ARGBGRAYROW_NEON +#define HAS_ARGBMIRRORROW_NEON +#define HAS_ARGBMULTIPLYROW_NEON +#define HAS_ARGBQUANTIZEROW_NEON +#define HAS_ARGBSEPIAROW_NEON +#define HAS_ARGBSHADEROW_NEON +#define HAS_ARGBSHUFFLEROW_NEON +#define HAS_ARGBSUBTRACTROW_NEON +#define HAS_INTERPOLATEROW_NEON +#define HAS_SOBELROW_NEON +#define HAS_SOBELTOPLANEROW_NEON +#define HAS_SOBELXROW_NEON +#define HAS_SOBELXYROW_NEON +#define HAS_SOBELYROW_NEON +#endif + +// The following are available on Mips platforms: +#if !defined(LIBYUV_DISABLE_MIPS) && defined(__mips__) && \ + (_MIPS_SIM == _MIPS_SIM_ABI32) && (__mips_isa_rev < 6) +#define HAS_COPYROW_MIPS +#if defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#define HAS_I422TOARGBROW_DSPR2 +#define HAS_INTERPOLATEROW_DSPR2 +#define HAS_MIRRORROW_DSPR2 +#define HAS_MIRRORUVROW_DSPR2 +#define HAS_SPLITUVROW_DSPR2 +#endif +#endif + +#if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) +#define HAS_MIRRORROW_MSA +#define HAS_ARGBMIRRORROW_MSA +#endif + +#if defined(_MSC_VER) && !defined(__CLR_VER) && !defined(__clang__) +#if defined(VISUALC_HAS_AVX2) +#define SIMD_ALIGNED(var) __declspec(align(32)) var +#else +#define SIMD_ALIGNED(var) __declspec(align(16)) var +#endif +typedef __declspec(align(16)) int16 vec16[8]; +typedef __declspec(align(16)) int32 vec32[4]; +typedef __declspec(align(16)) int8 vec8[16]; +typedef __declspec(align(16)) uint16 uvec16[8]; +typedef __declspec(align(16)) uint32 uvec32[4]; +typedef __declspec(align(16)) uint8 uvec8[16]; +typedef __declspec(align(32)) int16 lvec16[16]; +typedef __declspec(align(32)) int32 lvec32[8]; +typedef __declspec(align(32)) int8 lvec8[32]; +typedef __declspec(align(32)) uint16 ulvec16[16]; +typedef __declspec(align(32)) uint32 ulvec32[8]; +typedef __declspec(align(32)) uint8 ulvec8[32]; +#elif !defined(__pnacl__) && (defined(__GNUC__) || defined(__clang__)) +// Caveat GCC 4.2 to 4.7 have a known issue using vectors with const. +#if defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2) +#define SIMD_ALIGNED(var) var __attribute__((aligned(32))) +#else +#define SIMD_ALIGNED(var) var __attribute__((aligned(16))) +#endif +typedef int16 __attribute__((vector_size(16))) vec16; +typedef int32 __attribute__((vector_size(16))) vec32; +typedef int8 __attribute__((vector_size(16))) vec8; +typedef uint16 __attribute__((vector_size(16))) uvec16; +typedef uint32 __attribute__((vector_size(16))) uvec32; +typedef uint8 __attribute__((vector_size(16))) uvec8; +typedef int16 __attribute__((vector_size(32))) lvec16; +typedef int32 __attribute__((vector_size(32))) lvec32; +typedef int8 __attribute__((vector_size(32))) lvec8; +typedef uint16 __attribute__((vector_size(32))) ulvec16; +typedef uint32 __attribute__((vector_size(32))) ulvec32; +typedef uint8 __attribute__((vector_size(32))) ulvec8; +#else +#define SIMD_ALIGNED(var) var +typedef int16 vec16[8]; +typedef int32 vec32[4]; +typedef int8 vec8[16]; +typedef uint16 uvec16[8]; +typedef uint32 uvec32[4]; +typedef uint8 uvec8[16]; +typedef int16 lvec16[16]; +typedef int32 lvec32[8]; +typedef int8 lvec8[32]; +typedef uint16 ulvec16[16]; +typedef uint32 ulvec32[8]; +typedef uint8 ulvec8[32]; +#endif + +#if defined(__aarch64__) +// This struct is for Arm64 color conversion. +struct YuvConstants { + uvec16 kUVToRB; + uvec16 kUVToRB2; + uvec16 kUVToG; + uvec16 kUVToG2; + vec16 kUVBiasBGR; + vec32 kYToRgb; +}; +#elif defined(__arm__) +// This struct is for ArmV7 color conversion. +struct YuvConstants { + uvec8 kUVToRB; + uvec8 kUVToG; + vec16 kUVBiasBGR; + vec32 kYToRgb; +}; +#else +// This struct is for Intel color conversion. +struct YuvConstants { + int8 kUVToB[32]; + int8 kUVToG[32]; + int8 kUVToR[32]; + int16 kUVBiasB[16]; + int16 kUVBiasG[16]; + int16 kUVBiasR[16]; + int16 kYToRgb[16]; +}; + +// Offsets into YuvConstants structure +#define KUVTOB 0 +#define KUVTOG 32 +#define KUVTOR 64 +#define KUVBIASB 96 +#define KUVBIASG 128 +#define KUVBIASR 160 +#define KYTORGB 192 +#endif + +// Conversion matrix for YUV to RGB +extern const struct YuvConstants SIMD_ALIGNED(kYuvI601Constants); // BT.601 +extern const struct YuvConstants SIMD_ALIGNED(kYuvJPEGConstants); // JPeg +extern const struct YuvConstants SIMD_ALIGNED(kYuvH709Constants); // BT.709 + +// Conversion matrix for YVU to BGR +extern const struct YuvConstants SIMD_ALIGNED(kYvuI601Constants); // BT.601 +extern const struct YuvConstants SIMD_ALIGNED(kYvuJPEGConstants); // JPeg +extern const struct YuvConstants SIMD_ALIGNED(kYvuH709Constants); // BT.709 + +#if defined(__APPLE__) || defined(__x86_64__) || defined(__llvm__) +#define OMITFP +#else +#define OMITFP __attribute__((optimize("omit-frame-pointer"))) +#endif + +// NaCL macros for GCC x86 and x64. +#if defined(__native_client__) +#define LABELALIGN ".p2align 5\n" +#else +#define LABELALIGN +#endif +#if defined(__native_client__) && defined(__x86_64__) +// r14 is used for MEMOP macros. +#define NACL_R14 "r14", +#define BUNDLELOCK ".bundle_lock\n" +#define BUNDLEUNLOCK ".bundle_unlock\n" +#define MEMACCESS(base) "%%nacl:(%%r15,%q" #base ")" +#define MEMACCESS2(offset, base) "%%nacl:" #offset "(%%r15,%q" #base ")" +#define MEMLEA(offset, base) #offset "(%q" #base ")" +#define MEMLEA3(offset, index, scale) \ + #offset "(,%q" #index "," #scale ")" +#define MEMLEA4(offset, base, index, scale) \ + #offset "(%q" #base ",%q" #index "," #scale ")" +#define MEMMOVESTRING(s, d) "%%nacl:(%q" #s "),%%nacl:(%q" #d "), %%r15" +#define MEMSTORESTRING(reg, d) "%%" #reg ",%%nacl:(%q" #d "), %%r15" +#define MEMOPREG(opcode, offset, base, index, scale, reg) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #opcode " (%%r15,%%r14),%%" #reg "\n" \ + BUNDLEUNLOCK +#define MEMOPMEM(opcode, reg, offset, base, index, scale) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #opcode " %%" #reg ",(%%r15,%%r14)\n" \ + BUNDLEUNLOCK +#define MEMOPARG(opcode, offset, base, index, scale, arg) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #opcode " (%%r15,%%r14),%" #arg "\n" \ + BUNDLEUNLOCK +#define VMEMOPREG(opcode, offset, base, index, scale, reg1, reg2) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #opcode " (%%r15,%%r14),%%" #reg1 ",%%" #reg2 "\n" \ + BUNDLEUNLOCK +#define VEXTOPMEM(op, sel, reg, offset, base, index, scale) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #op " $" #sel ",%%" #reg ",(%%r15,%%r14)\n" \ + BUNDLEUNLOCK +#else // defined(__native_client__) && defined(__x86_64__) +#define NACL_R14 +#define BUNDLEALIGN +#define MEMACCESS(base) "(%" #base ")" +#define MEMACCESS2(offset, base) #offset "(%" #base ")" +#define MEMLEA(offset, base) #offset "(%" #base ")" +#define MEMLEA3(offset, index, scale) \ + #offset "(,%" #index "," #scale ")" +#define MEMLEA4(offset, base, index, scale) \ + #offset "(%" #base ",%" #index "," #scale ")" +#define MEMMOVESTRING(s, d) +#define MEMSTORESTRING(reg, d) +#define MEMOPREG(opcode, offset, base, index, scale, reg) \ + #opcode " " #offset "(%" #base ",%" #index "," #scale "),%%" #reg "\n" +#define MEMOPMEM(opcode, reg, offset, base, index, scale) \ + #opcode " %%" #reg ","#offset "(%" #base ",%" #index "," #scale ")\n" +#define MEMOPARG(opcode, offset, base, index, scale, arg) \ + #opcode " " #offset "(%" #base ",%" #index "," #scale "),%" #arg "\n" +#define VMEMOPREG(opcode, offset, base, index, scale, reg1, reg2) \ + #opcode " " #offset "(%" #base ",%" #index "," #scale "),%%" #reg1 ",%%" \ + #reg2 "\n" +#define VEXTOPMEM(op, sel, reg, offset, base, index, scale) \ + #op " $" #sel ",%%" #reg ","#offset "(%" #base ",%" #index "," #scale ")\n" +#endif // defined(__native_client__) && defined(__x86_64__) + +#if defined(__arm__) || defined(__aarch64__) +#undef MEMACCESS +#if defined(__native_client__) +#define MEMACCESS(base) ".p2align 3\nbic %" #base ", #0xc0000000\n" +#else +#define MEMACCESS(base) +#endif +#endif + +void I444ToARGBRow_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422AlphaToARGBRow_NEON(const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + const uint8* a_buf, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I411ToARGBRow_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGBARow_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB24Row_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgb24, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB565Row_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgb565, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB1555Row_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb1555, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB4444Row_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb4444, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToARGBRow_NEON(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToRGB565Row_NEON(const uint8* src_y, + const uint8* src_uv, + uint8* dst_rgb565, + const struct YuvConstants* yuvconstants, + int width); +void NV21ToARGBRow_NEON(const uint8* src_y, + const uint8* src_vu, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void YUY2ToARGBRow_NEON(const uint8* src_yuy2, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void UYVYToARGBRow_NEON(const uint8* src_uyvy, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); + +void ARGBToYRow_AVX2(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToYRow_Any_AVX2(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToYJRow_AVX2(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToYJRow_Any_AVX2(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToYJRow_SSSE3(const uint8* src_argb, uint8* dst_y, int width); +void BGRAToYRow_SSSE3(const uint8* src_bgra, uint8* dst_y, int width); +void ABGRToYRow_SSSE3(const uint8* src_abgr, uint8* dst_y, int width); +void RGBAToYRow_SSSE3(const uint8* src_rgba, uint8* dst_y, int width); +void RGB24ToYRow_SSSE3(const uint8* src_rgb24, uint8* dst_y, int width); +void RAWToYRow_SSSE3(const uint8* src_raw, uint8* dst_y, int width); +void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToYJRow_NEON(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToUV444Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v, + int width); +void ARGBToUV411Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v, + int width); +void ARGBToUVRow_NEON(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVJRow_NEON(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void BGRAToUVRow_NEON(const uint8* src_bgra, int src_stride_bgra, + uint8* dst_u, uint8* dst_v, int width); +void ABGRToUVRow_NEON(const uint8* src_abgr, int src_stride_abgr, + uint8* dst_u, uint8* dst_v, int width); +void RGBAToUVRow_NEON(const uint8* src_rgba, int src_stride_rgba, + uint8* dst_u, uint8* dst_v, int width); +void RGB24ToUVRow_NEON(const uint8* src_rgb24, int src_stride_rgb24, + uint8* dst_u, uint8* dst_v, int width); +void RAWToUVRow_NEON(const uint8* src_raw, int src_stride_raw, + uint8* dst_u, uint8* dst_v, int width); +void RGB565ToUVRow_NEON(const uint8* src_rgb565, int src_stride_rgb565, + uint8* dst_u, uint8* dst_v, int width); +void ARGB1555ToUVRow_NEON(const uint8* src_argb1555, int src_stride_argb1555, + uint8* dst_u, uint8* dst_v, int width); +void ARGB4444ToUVRow_NEON(const uint8* src_argb4444, int src_stride_argb4444, + uint8* dst_u, uint8* dst_v, int width); +void BGRAToYRow_NEON(const uint8* src_bgra, uint8* dst_y, int width); +void ABGRToYRow_NEON(const uint8* src_abgr, uint8* dst_y, int width); +void RGBAToYRow_NEON(const uint8* src_rgba, uint8* dst_y, int width); +void RGB24ToYRow_NEON(const uint8* src_rgb24, uint8* dst_y, int width); +void RAWToYRow_NEON(const uint8* src_raw, uint8* dst_y, int width); +void RGB565ToYRow_NEON(const uint8* src_rgb565, uint8* dst_y, int width); +void ARGB1555ToYRow_NEON(const uint8* src_argb1555, uint8* dst_y, int width); +void ARGB4444ToYRow_NEON(const uint8* src_argb4444, uint8* dst_y, int width); +void ARGBToYRow_C(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToYJRow_C(const uint8* src_argb, uint8* dst_y, int width); +void BGRAToYRow_C(const uint8* src_bgra, uint8* dst_y, int width); +void ABGRToYRow_C(const uint8* src_abgr, uint8* dst_y, int width); +void RGBAToYRow_C(const uint8* src_rgba, uint8* dst_y, int width); +void RGB24ToYRow_C(const uint8* src_rgb24, uint8* dst_y, int width); +void RAWToYRow_C(const uint8* src_raw, uint8* dst_y, int width); +void RGB565ToYRow_C(const uint8* src_rgb565, uint8* dst_y, int width); +void ARGB1555ToYRow_C(const uint8* src_argb1555, uint8* dst_y, int width); +void ARGB4444ToYRow_C(const uint8* src_argb4444, uint8* dst_y, int width); +void ARGBToYRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToYJRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int width); +void BGRAToYRow_Any_SSSE3(const uint8* src_bgra, uint8* dst_y, int width); +void ABGRToYRow_Any_SSSE3(const uint8* src_abgr, uint8* dst_y, int width); +void RGBAToYRow_Any_SSSE3(const uint8* src_rgba, uint8* dst_y, int width); +void RGB24ToYRow_Any_SSSE3(const uint8* src_rgb24, uint8* dst_y, int width); +void RAWToYRow_Any_SSSE3(const uint8* src_raw, uint8* dst_y, int width); +void ARGBToYRow_Any_NEON(const uint8* src_argb, uint8* dst_y, int width); +void ARGBToYJRow_Any_NEON(const uint8* src_argb, uint8* dst_y, int width); +void BGRAToYRow_Any_NEON(const uint8* src_bgra, uint8* dst_y, int width); +void ABGRToYRow_Any_NEON(const uint8* src_abgr, uint8* dst_y, int width); +void RGBAToYRow_Any_NEON(const uint8* src_rgba, uint8* dst_y, int width); +void RGB24ToYRow_Any_NEON(const uint8* src_rgb24, uint8* dst_y, int width); +void RAWToYRow_Any_NEON(const uint8* src_raw, uint8* dst_y, int width); +void RGB565ToYRow_Any_NEON(const uint8* src_rgb565, uint8* dst_y, int width); +void ARGB1555ToYRow_Any_NEON(const uint8* src_argb1555, uint8* dst_y, + int width); +void ARGB4444ToYRow_Any_NEON(const uint8* src_argb4444, uint8* dst_y, + int width); + +void ARGBToUVRow_AVX2(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVJRow_AVX2(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVRow_SSSE3(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVJRow_SSSE3(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void BGRAToUVRow_SSSE3(const uint8* src_bgra, int src_stride_bgra, + uint8* dst_u, uint8* dst_v, int width); +void ABGRToUVRow_SSSE3(const uint8* src_abgr, int src_stride_abgr, + uint8* dst_u, uint8* dst_v, int width); +void RGBAToUVRow_SSSE3(const uint8* src_rgba, int src_stride_rgba, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVRow_Any_AVX2(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVJRow_Any_AVX2(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVRow_Any_SSSE3(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVJRow_Any_SSSE3(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void BGRAToUVRow_Any_SSSE3(const uint8* src_bgra, int src_stride_bgra, + uint8* dst_u, uint8* dst_v, int width); +void ABGRToUVRow_Any_SSSE3(const uint8* src_abgr, int src_stride_abgr, + uint8* dst_u, uint8* dst_v, int width); +void RGBAToUVRow_Any_SSSE3(const uint8* src_rgba, int src_stride_rgba, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUV444Row_Any_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v, + int width); +void ARGBToUV411Row_Any_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v, + int width); +void ARGBToUVRow_Any_NEON(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVJRow_Any_NEON(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void BGRAToUVRow_Any_NEON(const uint8* src_bgra, int src_stride_bgra, + uint8* dst_u, uint8* dst_v, int width); +void ABGRToUVRow_Any_NEON(const uint8* src_abgr, int src_stride_abgr, + uint8* dst_u, uint8* dst_v, int width); +void RGBAToUVRow_Any_NEON(const uint8* src_rgba, int src_stride_rgba, + uint8* dst_u, uint8* dst_v, int width); +void RGB24ToUVRow_Any_NEON(const uint8* src_rgb24, int src_stride_rgb24, + uint8* dst_u, uint8* dst_v, int width); +void RAWToUVRow_Any_NEON(const uint8* src_raw, int src_stride_raw, + uint8* dst_u, uint8* dst_v, int width); +void RGB565ToUVRow_Any_NEON(const uint8* src_rgb565, int src_stride_rgb565, + uint8* dst_u, uint8* dst_v, int width); +void ARGB1555ToUVRow_Any_NEON(const uint8* src_argb1555, + int src_stride_argb1555, + uint8* dst_u, uint8* dst_v, int width); +void ARGB4444ToUVRow_Any_NEON(const uint8* src_argb4444, + int src_stride_argb4444, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVRow_C(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUVJRow_C(const uint8* src_argb, int src_stride_argb, + uint8* dst_u, uint8* dst_v, int width); +void BGRAToUVRow_C(const uint8* src_bgra, int src_stride_bgra, + uint8* dst_u, uint8* dst_v, int width); +void ABGRToUVRow_C(const uint8* src_abgr, int src_stride_abgr, + uint8* dst_u, uint8* dst_v, int width); +void RGBAToUVRow_C(const uint8* src_rgba, int src_stride_rgba, + uint8* dst_u, uint8* dst_v, int width); +void RGB24ToUVRow_C(const uint8* src_rgb24, int src_stride_rgb24, + uint8* dst_u, uint8* dst_v, int width); +void RAWToUVRow_C(const uint8* src_raw, int src_stride_raw, + uint8* dst_u, uint8* dst_v, int width); +void RGB565ToUVRow_C(const uint8* src_rgb565, int src_stride_rgb565, + uint8* dst_u, uint8* dst_v, int width); +void ARGB1555ToUVRow_C(const uint8* src_argb1555, int src_stride_argb1555, + uint8* dst_u, uint8* dst_v, int width); +void ARGB4444ToUVRow_C(const uint8* src_argb4444, int src_stride_argb4444, + uint8* dst_u, uint8* dst_v, int width); + +void ARGBToUV444Row_SSSE3(const uint8* src_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUV444Row_Any_SSSE3(const uint8* src_argb, + uint8* dst_u, uint8* dst_v, int width); + +void ARGBToUV444Row_C(const uint8* src_argb, + uint8* dst_u, uint8* dst_v, int width); +void ARGBToUV411Row_C(const uint8* src_argb, + uint8* dst_u, uint8* dst_v, int width); + +void MirrorRow_AVX2(const uint8* src, uint8* dst, int width); +void MirrorRow_SSSE3(const uint8* src, uint8* dst, int width); +void MirrorRow_NEON(const uint8* src, uint8* dst, int width); +void MirrorRow_DSPR2(const uint8* src, uint8* dst, int width); +void MirrorRow_MSA(const uint8* src, uint8* dst, int width); +void MirrorRow_C(const uint8* src, uint8* dst, int width); +void MirrorRow_Any_AVX2(const uint8* src, uint8* dst, int width); +void MirrorRow_Any_SSSE3(const uint8* src, uint8* dst, int width); +void MirrorRow_Any_SSE2(const uint8* src, uint8* dst, int width); +void MirrorRow_Any_NEON(const uint8* src, uint8* dst, int width); +void MirrorRow_Any_MSA(const uint8* src, uint8* dst, int width); + +void MirrorUVRow_SSSE3(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void MirrorUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void MirrorUVRow_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void MirrorUVRow_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width); + +void ARGBMirrorRow_AVX2(const uint8* src, uint8* dst, int width); +void ARGBMirrorRow_SSE2(const uint8* src, uint8* dst, int width); +void ARGBMirrorRow_NEON(const uint8* src, uint8* dst, int width); +void ARGBMirrorRow_MSA(const uint8* src, uint8* dst, int width); +void ARGBMirrorRow_C(const uint8* src, uint8* dst, int width); +void ARGBMirrorRow_Any_AVX2(const uint8* src, uint8* dst, int width); +void ARGBMirrorRow_Any_SSE2(const uint8* src, uint8* dst, int width); +void ARGBMirrorRow_Any_NEON(const uint8* src, uint8* dst, int width); +void ARGBMirrorRow_Any_MSA(const uint8* src, uint8* dst, int width); + +void SplitUVRow_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width); +void SplitUVRow_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void SplitUVRow_AVX2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void SplitUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void SplitUVRow_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void SplitUVRow_Any_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void SplitUVRow_Any_AVX2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void SplitUVRow_Any_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); +void SplitUVRow_Any_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width); + +void MergeUVRow_C(const uint8* src_u, const uint8* src_v, uint8* dst_uv, + int width); +void MergeUVRow_SSE2(const uint8* src_u, const uint8* src_v, uint8* dst_uv, + int width); +void MergeUVRow_AVX2(const uint8* src_u, const uint8* src_v, uint8* dst_uv, + int width); +void MergeUVRow_NEON(const uint8* src_u, const uint8* src_v, uint8* dst_uv, + int width); +void MergeUVRow_Any_SSE2(const uint8* src_u, const uint8* src_v, uint8* dst_uv, + int width); +void MergeUVRow_Any_AVX2(const uint8* src_u, const uint8* src_v, uint8* dst_uv, + int width); +void MergeUVRow_Any_NEON(const uint8* src_u, const uint8* src_v, uint8* dst_uv, + int width); + +void CopyRow_SSE2(const uint8* src, uint8* dst, int count); +void CopyRow_AVX(const uint8* src, uint8* dst, int count); +void CopyRow_ERMS(const uint8* src, uint8* dst, int count); +void CopyRow_NEON(const uint8* src, uint8* dst, int count); +void CopyRow_MIPS(const uint8* src, uint8* dst, int count); +void CopyRow_C(const uint8* src, uint8* dst, int count); +void CopyRow_Any_SSE2(const uint8* src, uint8* dst, int count); +void CopyRow_Any_AVX(const uint8* src, uint8* dst, int count); +void CopyRow_Any_NEON(const uint8* src, uint8* dst, int count); + +void CopyRow_16_C(const uint16* src, uint16* dst, int count); + +void ARGBCopyAlphaRow_C(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBCopyAlphaRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBCopyAlphaRow_AVX2(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBCopyAlphaRow_Any_SSE2(const uint8* src_argb, uint8* dst_argb, + int width); +void ARGBCopyAlphaRow_Any_AVX2(const uint8* src_argb, uint8* dst_argb, + int width); + +void ARGBExtractAlphaRow_C(const uint8* src_argb, uint8* dst_a, int width); +void ARGBExtractAlphaRow_SSE2(const uint8* src_argb, uint8* dst_a, int width); +void ARGBExtractAlphaRow_NEON(const uint8* src_argb, uint8* dst_a, int width); +void ARGBExtractAlphaRow_Any_SSE2(const uint8* src_argb, uint8* dst_a, + int width); +void ARGBExtractAlphaRow_Any_NEON(const uint8* src_argb, uint8* dst_a, + int width); + +void ARGBCopyYToAlphaRow_C(const uint8* src_y, uint8* dst_argb, int width); +void ARGBCopyYToAlphaRow_SSE2(const uint8* src_y, uint8* dst_argb, int width); +void ARGBCopyYToAlphaRow_AVX2(const uint8* src_y, uint8* dst_argb, int width); +void ARGBCopyYToAlphaRow_Any_SSE2(const uint8* src_y, uint8* dst_argb, + int width); +void ARGBCopyYToAlphaRow_Any_AVX2(const uint8* src_y, uint8* dst_argb, + int width); + +void SetRow_C(uint8* dst, uint8 v8, int count); +void SetRow_X86(uint8* dst, uint8 v8, int count); +void SetRow_ERMS(uint8* dst, uint8 v8, int count); +void SetRow_NEON(uint8* dst, uint8 v8, int count); +void SetRow_Any_X86(uint8* dst, uint8 v8, int count); +void SetRow_Any_NEON(uint8* dst, uint8 v8, int count); + +void ARGBSetRow_C(uint8* dst_argb, uint32 v32, int count); +void ARGBSetRow_X86(uint8* dst_argb, uint32 v32, int count); +void ARGBSetRow_NEON(uint8* dst_argb, uint32 v32, int count); +void ARGBSetRow_Any_NEON(uint8* dst_argb, uint32 v32, int count); + +// ARGBShufflers for BGRAToARGB etc. +void ARGBShuffleRow_C(const uint8* src_argb, uint8* dst_argb, + const uint8* shuffler, int width); +void ARGBShuffleRow_SSE2(const uint8* src_argb, uint8* dst_argb, + const uint8* shuffler, int width); +void ARGBShuffleRow_SSSE3(const uint8* src_argb, uint8* dst_argb, + const uint8* shuffler, int width); +void ARGBShuffleRow_AVX2(const uint8* src_argb, uint8* dst_argb, + const uint8* shuffler, int width); +void ARGBShuffleRow_NEON(const uint8* src_argb, uint8* dst_argb, + const uint8* shuffler, int width); +void ARGBShuffleRow_Any_SSE2(const uint8* src_argb, uint8* dst_argb, + const uint8* shuffler, int width); +void ARGBShuffleRow_Any_SSSE3(const uint8* src_argb, uint8* dst_argb, + const uint8* shuffler, int width); +void ARGBShuffleRow_Any_AVX2(const uint8* src_argb, uint8* dst_argb, + const uint8* shuffler, int width); +void ARGBShuffleRow_Any_NEON(const uint8* src_argb, uint8* dst_argb, + const uint8* shuffler, int width); + +void RGB24ToARGBRow_SSSE3(const uint8* src_rgb24, uint8* dst_argb, int width); +void RAWToARGBRow_SSSE3(const uint8* src_raw, uint8* dst_argb, int width); +void RAWToRGB24Row_SSSE3(const uint8* src_raw, uint8* dst_rgb24, int width); +void RGB565ToARGBRow_SSE2(const uint8* src_rgb565, uint8* dst_argb, int width); +void ARGB1555ToARGBRow_SSE2(const uint8* src_argb1555, uint8* dst_argb, + int width); +void ARGB4444ToARGBRow_SSE2(const uint8* src_argb4444, uint8* dst_argb, + int width); +void RGB565ToARGBRow_AVX2(const uint8* src_rgb565, uint8* dst_argb, int width); +void ARGB1555ToARGBRow_AVX2(const uint8* src_argb1555, uint8* dst_argb, + int width); +void ARGB4444ToARGBRow_AVX2(const uint8* src_argb4444, uint8* dst_argb, + int width); + +void RGB24ToARGBRow_NEON(const uint8* src_rgb24, uint8* dst_argb, int width); +void RAWToARGBRow_NEON(const uint8* src_raw, uint8* dst_argb, int width); +void RAWToRGB24Row_NEON(const uint8* src_raw, uint8* dst_rgb24, int width); +void RGB565ToARGBRow_NEON(const uint8* src_rgb565, uint8* dst_argb, int width); +void ARGB1555ToARGBRow_NEON(const uint8* src_argb1555, uint8* dst_argb, + int width); +void ARGB4444ToARGBRow_NEON(const uint8* src_argb4444, uint8* dst_argb, + int width); +void RGB24ToARGBRow_C(const uint8* src_rgb24, uint8* dst_argb, int width); +void RAWToARGBRow_C(const uint8* src_raw, uint8* dst_argb, int width); +void RAWToRGB24Row_C(const uint8* src_raw, uint8* dst_rgb24, int width); +void RGB565ToARGBRow_C(const uint8* src_rgb, uint8* dst_argb, int width); +void ARGB1555ToARGBRow_C(const uint8* src_argb, uint8* dst_argb, int width); +void ARGB4444ToARGBRow_C(const uint8* src_argb, uint8* dst_argb, int width); +void RGB24ToARGBRow_Any_SSSE3(const uint8* src_rgb24, uint8* dst_argb, + int width); +void RAWToARGBRow_Any_SSSE3(const uint8* src_raw, uint8* dst_argb, int width); +void RAWToRGB24Row_Any_SSSE3(const uint8* src_raw, uint8* dst_rgb24, int width); + +void RGB565ToARGBRow_Any_SSE2(const uint8* src_rgb565, uint8* dst_argb, + int width); +void ARGB1555ToARGBRow_Any_SSE2(const uint8* src_argb1555, uint8* dst_argb, + int width); +void ARGB4444ToARGBRow_Any_SSE2(const uint8* src_argb4444, uint8* dst_argb, + int width); +void RGB565ToARGBRow_Any_AVX2(const uint8* src_rgb565, uint8* dst_argb, + int width); +void ARGB1555ToARGBRow_Any_AVX2(const uint8* src_argb1555, uint8* dst_argb, + int width); +void ARGB4444ToARGBRow_Any_AVX2(const uint8* src_argb4444, uint8* dst_argb, + int width); + +void RGB24ToARGBRow_Any_NEON(const uint8* src_rgb24, uint8* dst_argb, + int width); +void RAWToARGBRow_Any_NEON(const uint8* src_raw, uint8* dst_argb, int width); +void RAWToRGB24Row_Any_NEON(const uint8* src_raw, uint8* dst_rgb24, int width); +void RGB565ToARGBRow_Any_NEON(const uint8* src_rgb565, uint8* dst_argb, + int width); +void ARGB1555ToARGBRow_Any_NEON(const uint8* src_argb1555, uint8* dst_argb, + int width); +void ARGB4444ToARGBRow_Any_NEON(const uint8* src_argb4444, uint8* dst_argb, + int width); + +void ARGBToRGB24Row_SSSE3(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRAWRow_SSSE3(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRGB565Row_SSE2(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB1555Row_SSE2(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB4444Row_SSE2(const uint8* src_argb, uint8* dst_rgb, int width); + +void ARGBToRGB565DitherRow_C(const uint8* src_argb, uint8* dst_rgb, + const uint32 dither4, int width); +void ARGBToRGB565DitherRow_SSE2(const uint8* src_argb, uint8* dst_rgb, + const uint32 dither4, int width); +void ARGBToRGB565DitherRow_AVX2(const uint8* src_argb, uint8* dst_rgb, + const uint32 dither4, int width); + +void ARGBToRGB565Row_AVX2(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB1555Row_AVX2(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB4444Row_AVX2(const uint8* src_argb, uint8* dst_rgb, int width); + +void ARGBToRGB24Row_NEON(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRAWRow_NEON(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRGB565Row_NEON(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB1555Row_NEON(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB4444Row_NEON(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRGB565DitherRow_NEON(const uint8* src_argb, uint8* dst_rgb, + const uint32 dither4, int width); + +void ARGBToRGBARow_C(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRGB24Row_C(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRAWRow_C(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRGB565Row_C(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB1555Row_C(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB4444Row_C(const uint8* src_argb, uint8* dst_rgb, int width); + +void J400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int width); +void J400ToARGBRow_AVX2(const uint8* src_y, uint8* dst_argb, int width); +void J400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int width); +void J400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width); +void J400ToARGBRow_Any_SSE2(const uint8* src_y, uint8* dst_argb, int width); +void J400ToARGBRow_Any_AVX2(const uint8* src_y, uint8* dst_argb, int width); +void J400ToARGBRow_Any_NEON(const uint8* src_y, uint8* dst_argb, int width); + +void I444ToARGBRow_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422AlphaToARGBRow_C(const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + const uint8* a_buf, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I411ToARGBRow_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToARGBRow_C(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToRGB565Row_C(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV21ToARGBRow_C(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void YUY2ToARGBRow_C(const uint8* src_yuy2, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void UYVYToARGBRow_C(const uint8* src_uyvy, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGBARow_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB24Row_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgb24, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB4444Row_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb4444, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB1555Row_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb4444, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB565Row_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgb565, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGBARow_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I444ToARGBRow_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I444ToARGBRow_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I444ToARGBRow_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I444ToARGBRow_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422AlphaToARGBRow_SSSE3(const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + const uint8* a_buf, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422AlphaToARGBRow_AVX2(const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + const uint8* a_buf, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I411ToARGBRow_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I411ToARGBRow_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToARGBRow_SSSE3(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToARGBRow_AVX2(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToRGB565Row_SSSE3(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToRGB565Row_AVX2(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV21ToARGBRow_SSSE3(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV21ToARGBRow_AVX2(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void YUY2ToARGBRow_SSSE3(const uint8* src_yuy2, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void UYVYToARGBRow_SSSE3(const uint8* src_uyvy, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void YUY2ToARGBRow_AVX2(const uint8* src_yuy2, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void UYVYToARGBRow_AVX2(const uint8* src_uyvy, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGBARow_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB4444Row_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB4444Row_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB1555Row_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB1555Row_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB565Row_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB565Row_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB24Row_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgb24, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB24Row_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgb24, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_Any_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGBARow_Any_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I444ToARGBRow_Any_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I444ToARGBRow_Any_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_Any_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422AlphaToARGBRow_Any_SSSE3(const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + const uint8* a_buf, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422AlphaToARGBRow_Any_AVX2(const uint8* y_buf, + const uint8* u_buf, + const uint8* v_buf, + const uint8* a_buf, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I411ToARGBRow_Any_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I411ToARGBRow_Any_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToARGBRow_Any_SSSE3(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToARGBRow_Any_AVX2(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV21ToARGBRow_Any_SSSE3(const uint8* src_y, + const uint8* src_vu, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV21ToARGBRow_Any_AVX2(const uint8* src_y, + const uint8* src_vu, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToRGB565Row_Any_SSSE3(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToRGB565Row_Any_AVX2(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void YUY2ToARGBRow_Any_SSSE3(const uint8* src_yuy2, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void UYVYToARGBRow_Any_SSSE3(const uint8* src_uyvy, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void YUY2ToARGBRow_Any_AVX2(const uint8* src_yuy2, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void UYVYToARGBRow_Any_AVX2(const uint8* src_uyvy, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGBARow_Any_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB4444Row_Any_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB4444Row_Any_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB1555Row_Any_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB1555Row_Any_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB565Row_Any_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB565Row_Any_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_rgba, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB24Row_Any_SSSE3(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB24Row_Any_AVX2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); + +void I400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_SSE2(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_AVX2(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_NEON(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_Any_SSE2(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_Any_AVX2(const uint8* src_y, uint8* dst_argb, int width); +void I400ToARGBRow_Any_NEON(const uint8* src_y, uint8* dst_argb, int width); + +// ARGB preattenuated alpha blend. +void ARGBBlendRow_SSSE3(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBBlendRow_NEON(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBBlendRow_C(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); + +// Unattenuated planar alpha blend. +void BlendPlaneRow_SSSE3(const uint8* src0, const uint8* src1, + const uint8* alpha, uint8* dst, int width); +void BlendPlaneRow_Any_SSSE3(const uint8* src0, const uint8* src1, + const uint8* alpha, uint8* dst, int width); +void BlendPlaneRow_AVX2(const uint8* src0, const uint8* src1, + const uint8* alpha, uint8* dst, int width); +void BlendPlaneRow_Any_AVX2(const uint8* src0, const uint8* src1, + const uint8* alpha, uint8* dst, int width); +void BlendPlaneRow_C(const uint8* src0, const uint8* src1, + const uint8* alpha, uint8* dst, int width); + +// ARGB multiply images. Same API as Blend, but these require +// pointer and width alignment for SSE2. +void ARGBMultiplyRow_C(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBMultiplyRow_SSE2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBMultiplyRow_Any_SSE2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBMultiplyRow_AVX2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBMultiplyRow_Any_AVX2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBMultiplyRow_NEON(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBMultiplyRow_Any_NEON(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); + +// ARGB add images. +void ARGBAddRow_C(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBAddRow_SSE2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBAddRow_Any_SSE2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBAddRow_AVX2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBAddRow_Any_AVX2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBAddRow_NEON(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBAddRow_Any_NEON(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); + +// ARGB subtract images. Same API as Blend, but these require +// pointer and width alignment for SSE2. +void ARGBSubtractRow_C(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBSubtractRow_SSE2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBSubtractRow_Any_SSE2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBSubtractRow_AVX2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBSubtractRow_Any_AVX2(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBSubtractRow_NEON(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); +void ARGBSubtractRow_Any_NEON(const uint8* src_argb, const uint8* src_argb1, + uint8* dst_argb, int width); + +void ARGBToRGB24Row_Any_SSSE3(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRAWRow_Any_SSSE3(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRGB565Row_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB1555Row_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, + int width); +void ARGBToARGB4444Row_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, + int width); + +void ARGBToRGB565DitherRow_Any_SSE2(const uint8* src_argb, uint8* dst_rgb, + const uint32 dither4, int width); +void ARGBToRGB565DitherRow_Any_AVX2(const uint8* src_argb, uint8* dst_rgb, + const uint32 dither4, int width); + +void ARGBToRGB565Row_Any_AVX2(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB1555Row_Any_AVX2(const uint8* src_argb, uint8* dst_rgb, + int width); +void ARGBToARGB4444Row_Any_AVX2(const uint8* src_argb, uint8* dst_rgb, + int width); + +void ARGBToRGB24Row_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRAWRow_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToRGB565Row_Any_NEON(const uint8* src_argb, uint8* dst_rgb, int width); +void ARGBToARGB1555Row_Any_NEON(const uint8* src_argb, uint8* dst_rgb, + int width); +void ARGBToARGB4444Row_Any_NEON(const uint8* src_argb, uint8* dst_rgb, + int width); +void ARGBToRGB565DitherRow_Any_NEON(const uint8* src_argb, uint8* dst_rgb, + const uint32 dither4, int width); + +void I444ToARGBRow_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422AlphaToARGBRow_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + const uint8* src_a, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I411ToARGBRow_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGBARow_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB24Row_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB4444Row_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGB1555Row_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToRGB565Row_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToARGBRow_Any_NEON(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV21ToARGBRow_Any_NEON(const uint8* src_y, + const uint8* src_vu, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void NV12ToRGB565Row_Any_NEON(const uint8* src_y, + const uint8* src_uv, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void YUY2ToARGBRow_Any_NEON(const uint8* src_yuy2, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void UYVYToARGBRow_Any_NEON(const uint8* src_uyvy, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_DSPR2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); +void I422ToARGBRow_DSPR2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_argb, + const struct YuvConstants* yuvconstants, + int width); + +void YUY2ToYRow_AVX2(const uint8* src_yuy2, uint8* dst_y, int width); +void YUY2ToUVRow_AVX2(const uint8* src_yuy2, int stride_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToUV422Row_AVX2(const uint8* src_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToYRow_SSE2(const uint8* src_yuy2, uint8* dst_y, int width); +void YUY2ToUVRow_SSE2(const uint8* src_yuy2, int stride_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToUV422Row_SSE2(const uint8* src_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToYRow_NEON(const uint8* src_yuy2, uint8* dst_y, int width); +void YUY2ToUVRow_NEON(const uint8* src_yuy2, int stride_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToUV422Row_NEON(const uint8* src_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToYRow_C(const uint8* src_yuy2, uint8* dst_y, int width); +void YUY2ToUVRow_C(const uint8* src_yuy2, int stride_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToUV422Row_C(const uint8* src_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToYRow_Any_AVX2(const uint8* src_yuy2, uint8* dst_y, int width); +void YUY2ToUVRow_Any_AVX2(const uint8* src_yuy2, int stride_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToUV422Row_Any_AVX2(const uint8* src_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToYRow_Any_SSE2(const uint8* src_yuy2, uint8* dst_y, int width); +void YUY2ToUVRow_Any_SSE2(const uint8* src_yuy2, int stride_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToUV422Row_Any_SSE2(const uint8* src_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToYRow_Any_NEON(const uint8* src_yuy2, uint8* dst_y, int width); +void YUY2ToUVRow_Any_NEON(const uint8* src_yuy2, int stride_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void YUY2ToUV422Row_Any_NEON(const uint8* src_yuy2, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToYRow_AVX2(const uint8* src_uyvy, uint8* dst_y, int width); +void UYVYToUVRow_AVX2(const uint8* src_uyvy, int stride_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToUV422Row_AVX2(const uint8* src_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToYRow_SSE2(const uint8* src_uyvy, uint8* dst_y, int width); +void UYVYToUVRow_SSE2(const uint8* src_uyvy, int stride_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToUV422Row_SSE2(const uint8* src_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToYRow_AVX2(const uint8* src_uyvy, uint8* dst_y, int width); +void UYVYToUVRow_AVX2(const uint8* src_uyvy, int stride_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToUV422Row_AVX2(const uint8* src_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToYRow_NEON(const uint8* src_uyvy, uint8* dst_y, int width); +void UYVYToUVRow_NEON(const uint8* src_uyvy, int stride_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToUV422Row_NEON(const uint8* src_uyvy, + uint8* dst_u, uint8* dst_v, int width); + +void UYVYToYRow_C(const uint8* src_uyvy, uint8* dst_y, int width); +void UYVYToUVRow_C(const uint8* src_uyvy, int stride_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToUV422Row_C(const uint8* src_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToYRow_Any_AVX2(const uint8* src_uyvy, uint8* dst_y, int width); +void UYVYToUVRow_Any_AVX2(const uint8* src_uyvy, int stride_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToUV422Row_Any_AVX2(const uint8* src_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToYRow_Any_SSE2(const uint8* src_uyvy, uint8* dst_y, int width); +void UYVYToUVRow_Any_SSE2(const uint8* src_uyvy, int stride_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToUV422Row_Any_SSE2(const uint8* src_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToYRow_Any_NEON(const uint8* src_uyvy, uint8* dst_y, int width); +void UYVYToUVRow_Any_NEON(const uint8* src_uyvy, int stride_uyvy, + uint8* dst_u, uint8* dst_v, int width); +void UYVYToUV422Row_Any_NEON(const uint8* src_uyvy, + uint8* dst_u, uint8* dst_v, int width); + +void I422ToYUY2Row_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_yuy2, int width); +void I422ToUYVYRow_C(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_uyvy, int width); +void I422ToYUY2Row_SSE2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_yuy2, int width); +void I422ToUYVYRow_SSE2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_uyvy, int width); +void I422ToYUY2Row_Any_SSE2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_yuy2, int width); +void I422ToUYVYRow_Any_SSE2(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_uyvy, int width); +void I422ToYUY2Row_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_yuy2, int width); +void I422ToUYVYRow_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_uyvy, int width); +void I422ToYUY2Row_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_yuy2, int width); +void I422ToUYVYRow_Any_NEON(const uint8* src_y, + const uint8* src_u, + const uint8* src_v, + uint8* dst_uyvy, int width); + +// Effects related row functions. +void ARGBAttenuateRow_C(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBAttenuateRow_SSSE3(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBAttenuateRow_AVX2(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBAttenuateRow_NEON(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBAttenuateRow_Any_SSE2(const uint8* src_argb, uint8* dst_argb, + int width); +void ARGBAttenuateRow_Any_SSSE3(const uint8* src_argb, uint8* dst_argb, + int width); +void ARGBAttenuateRow_Any_AVX2(const uint8* src_argb, uint8* dst_argb, + int width); +void ARGBAttenuateRow_Any_NEON(const uint8* src_argb, uint8* dst_argb, + int width); + +// Inverse table for unattenuate, shared by C and SSE2. +extern const uint32 fixed_invtbl8[256]; +void ARGBUnattenuateRow_C(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBUnattenuateRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBUnattenuateRow_AVX2(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBUnattenuateRow_Any_SSE2(const uint8* src_argb, uint8* dst_argb, + int width); +void ARGBUnattenuateRow_Any_AVX2(const uint8* src_argb, uint8* dst_argb, + int width); + +void ARGBGrayRow_C(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBGrayRow_SSSE3(const uint8* src_argb, uint8* dst_argb, int width); +void ARGBGrayRow_NEON(const uint8* src_argb, uint8* dst_argb, int width); + +void ARGBSepiaRow_C(uint8* dst_argb, int width); +void ARGBSepiaRow_SSSE3(uint8* dst_argb, int width); +void ARGBSepiaRow_NEON(uint8* dst_argb, int width); + +void ARGBColorMatrixRow_C(const uint8* src_argb, uint8* dst_argb, + const int8* matrix_argb, int width); +void ARGBColorMatrixRow_SSSE3(const uint8* src_argb, uint8* dst_argb, + const int8* matrix_argb, int width); +void ARGBColorMatrixRow_NEON(const uint8* src_argb, uint8* dst_argb, + const int8* matrix_argb, int width); + +void ARGBColorTableRow_C(uint8* dst_argb, const uint8* table_argb, int width); +void ARGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb, int width); + +void RGBColorTableRow_C(uint8* dst_argb, const uint8* table_argb, int width); +void RGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb, int width); + +void ARGBQuantizeRow_C(uint8* dst_argb, int scale, int interval_size, + int interval_offset, int width); +void ARGBQuantizeRow_SSE2(uint8* dst_argb, int scale, int interval_size, + int interval_offset, int width); +void ARGBQuantizeRow_NEON(uint8* dst_argb, int scale, int interval_size, + int interval_offset, int width); + +void ARGBShadeRow_C(const uint8* src_argb, uint8* dst_argb, int width, + uint32 value); +void ARGBShadeRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width, + uint32 value); +void ARGBShadeRow_NEON(const uint8* src_argb, uint8* dst_argb, int width, + uint32 value); + +// Used for blur. +void CumulativeSumToAverageRow_SSE2(const int32* topleft, const int32* botleft, + int width, int area, uint8* dst, int count); +void ComputeCumulativeSumRow_SSE2(const uint8* row, int32* cumsum, + const int32* previous_cumsum, int width); + +void CumulativeSumToAverageRow_C(const int32* topleft, const int32* botleft, + int width, int area, uint8* dst, int count); +void ComputeCumulativeSumRow_C(const uint8* row, int32* cumsum, + const int32* previous_cumsum, int width); + +LIBYUV_API +void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride, + uint8* dst_argb, const float* uv_dudv, int width); +LIBYUV_API +void ARGBAffineRow_SSE2(const uint8* src_argb, int src_argb_stride, + uint8* dst_argb, const float* uv_dudv, int width); + +// Used for I420Scale, ARGBScale, and ARGBInterpolate. +void InterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr, + ptrdiff_t src_stride_ptr, + int width, int source_y_fraction); +void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); +void InterpolateRow_AVX2(uint8* dst_ptr, const uint8* src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); +void InterpolateRow_NEON(uint8* dst_ptr, const uint8* src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); +void InterpolateRow_DSPR2(uint8* dst_ptr, const uint8* src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); +void InterpolateRow_Any_NEON(uint8* dst_ptr, const uint8* src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); +void InterpolateRow_Any_SSSE3(uint8* dst_ptr, const uint8* src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); +void InterpolateRow_Any_AVX2(uint8* dst_ptr, const uint8* src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); +void InterpolateRow_Any_DSPR2(uint8* dst_ptr, const uint8* src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRow_16_C(uint16* dst_ptr, const uint16* src_ptr, + ptrdiff_t src_stride_ptr, + int width, int source_y_fraction); + +// Sobel images. +void SobelXRow_C(const uint8* src_y0, const uint8* src_y1, const uint8* src_y2, + uint8* dst_sobelx, int width); +void SobelXRow_SSE2(const uint8* src_y0, const uint8* src_y1, + const uint8* src_y2, uint8* dst_sobelx, int width); +void SobelXRow_NEON(const uint8* src_y0, const uint8* src_y1, + const uint8* src_y2, uint8* dst_sobelx, int width); +void SobelYRow_C(const uint8* src_y0, const uint8* src_y1, + uint8* dst_sobely, int width); +void SobelYRow_SSE2(const uint8* src_y0, const uint8* src_y1, + uint8* dst_sobely, int width); +void SobelYRow_NEON(const uint8* src_y0, const uint8* src_y1, + uint8* dst_sobely, int width); +void SobelRow_C(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); +void SobelRow_SSE2(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); +void SobelRow_NEON(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); +void SobelToPlaneRow_C(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_y, int width); +void SobelToPlaneRow_SSE2(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_y, int width); +void SobelToPlaneRow_NEON(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_y, int width); +void SobelXYRow_C(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); +void SobelXYRow_SSE2(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); +void SobelXYRow_NEON(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); +void SobelRow_Any_SSE2(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); +void SobelRow_Any_NEON(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); +void SobelToPlaneRow_Any_SSE2(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_y, int width); +void SobelToPlaneRow_Any_NEON(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_y, int width); +void SobelXYRow_Any_SSE2(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); +void SobelXYRow_Any_NEON(const uint8* src_sobelx, const uint8* src_sobely, + uint8* dst_argb, int width); + +void ARGBPolynomialRow_C(const uint8* src_argb, + uint8* dst_argb, const float* poly, + int width); +void ARGBPolynomialRow_SSE2(const uint8* src_argb, + uint8* dst_argb, const float* poly, + int width); +void ARGBPolynomialRow_AVX2(const uint8* src_argb, + uint8* dst_argb, const float* poly, + int width); + +// Scale and convert to half float. +void HalfFloatRow_C(const uint16* src, uint16* dst, float scale, int width); +void HalfFloatRow_AVX2(const uint16* src, uint16* dst, float scale, int width); +void HalfFloatRow_Any_AVX2(const uint16* src, uint16* dst, float scale, + int width); +void HalfFloatRow_SSE2(const uint16* src, uint16* dst, float scale, int width); +void HalfFloatRow_Any_SSE2(const uint16* src, uint16* dst, float scale, + int width); + +void ARGBLumaColorTableRow_C(const uint8* src_argb, uint8* dst_argb, int width, + const uint8* luma, uint32 lumacoeff); +void ARGBLumaColorTableRow_SSSE3(const uint8* src_argb, uint8* dst_argb, + int width, + const uint8* luma, uint32 lumacoeff); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_ROW_H_ diff --git a/phonelibs/libyuv/include/libyuv/scale.h b/phonelibs/libyuv/include/libyuv/scale.h new file mode 100644 index 00000000000000..ae14694598b2cc --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/scale.h @@ -0,0 +1,103 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_SCALE_H_ +#define INCLUDE_LIBYUV_SCALE_H_ + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Supported filtering. +typedef enum FilterMode { + kFilterNone = 0, // Point sample; Fastest. + kFilterLinear = 1, // Filter horizontally only. + kFilterBilinear = 2, // Faster than box, but lower quality scaling down. + kFilterBox = 3 // Highest quality. +} FilterModeEnum; + +// Scale a YUV plane. +LIBYUV_API +void ScalePlane(const uint8* src, int src_stride, + int src_width, int src_height, + uint8* dst, int dst_stride, + int dst_width, int dst_height, + enum FilterMode filtering); + +LIBYUV_API +void ScalePlane_16(const uint16* src, int src_stride, + int src_width, int src_height, + uint16* dst, int dst_stride, + int dst_width, int dst_height, + enum FilterMode filtering); + +// Scales a YUV 4:2:0 image from the src width and height to the +// dst width and height. +// If filtering is kFilterNone, a simple nearest-neighbor algorithm is +// used. This produces basic (blocky) quality at the fastest speed. +// If filtering is kFilterBilinear, interpolation is used to produce a better +// quality image, at the expense of speed. +// If filtering is kFilterBox, averaging is used to produce ever better +// quality image, at further expense of speed. +// Returns 0 if successful. + +LIBYUV_API +int I420Scale(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + int src_width, int src_height, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int dst_width, int dst_height, + enum FilterMode filtering); + +LIBYUV_API +int I420Scale_16(const uint16* src_y, int src_stride_y, + const uint16* src_u, int src_stride_u, + const uint16* src_v, int src_stride_v, + int src_width, int src_height, + uint16* dst_y, int dst_stride_y, + uint16* dst_u, int dst_stride_u, + uint16* dst_v, int dst_stride_v, + int dst_width, int dst_height, + enum FilterMode filtering); + +#ifdef __cplusplus +// Legacy API. Deprecated. +LIBYUV_API +int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v, + int src_stride_y, int src_stride_u, int src_stride_v, + int src_width, int src_height, + uint8* dst_y, uint8* dst_u, uint8* dst_v, + int dst_stride_y, int dst_stride_u, int dst_stride_v, + int dst_width, int dst_height, + LIBYUV_BOOL interpolate); + +// Legacy API. Deprecated. +LIBYUV_API +int ScaleOffset(const uint8* src_i420, int src_width, int src_height, + uint8* dst_i420, int dst_width, int dst_height, int dst_yoffset, + LIBYUV_BOOL interpolate); + +// For testing, allow disabling of specialized scalers. +LIBYUV_API +void SetUseReferenceImpl(LIBYUV_BOOL use); +#endif // __cplusplus + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_SCALE_H_ diff --git a/phonelibs/libyuv/include/libyuv/scale_argb.h b/phonelibs/libyuv/include/libyuv/scale_argb.h new file mode 100644 index 00000000000000..35cd191c0f6123 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/scale_argb.h @@ -0,0 +1,56 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_SCALE_ARGB_H_ +#define INCLUDE_LIBYUV_SCALE_ARGB_H_ + +#include "libyuv/basic_types.h" +#include "libyuv/scale.h" // For FilterMode + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +LIBYUV_API +int ARGBScale(const uint8* src_argb, int src_stride_argb, + int src_width, int src_height, + uint8* dst_argb, int dst_stride_argb, + int dst_width, int dst_height, + enum FilterMode filtering); + +// Clipped scale takes destination rectangle coordinates for clip values. +LIBYUV_API +int ARGBScaleClip(const uint8* src_argb, int src_stride_argb, + int src_width, int src_height, + uint8* dst_argb, int dst_stride_argb, + int dst_width, int dst_height, + int clip_x, int clip_y, int clip_width, int clip_height, + enum FilterMode filtering); + +// Scale with YUV conversion to ARGB and clipping. +LIBYUV_API +int YUVToARGBScaleClip(const uint8* src_y, int src_stride_y, + const uint8* src_u, int src_stride_u, + const uint8* src_v, int src_stride_v, + uint32 src_fourcc, + int src_width, int src_height, + uint8* dst_argb, int dst_stride_argb, + uint32 dst_fourcc, + int dst_width, int dst_height, + int clip_x, int clip_y, int clip_width, int clip_height, + enum FilterMode filtering); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_SCALE_ARGB_H_ diff --git a/phonelibs/libyuv/include/libyuv/scale_row.h b/phonelibs/libyuv/include/libyuv/scale_row.h new file mode 100644 index 00000000000000..791fbf7d0538fb --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/scale_row.h @@ -0,0 +1,503 @@ +/* + * Copyright 2013 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_SCALE_ROW_H_ +#define INCLUDE_LIBYUV_SCALE_ROW_H_ + +#include "libyuv/basic_types.h" +#include "libyuv/scale.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +#if defined(__pnacl__) || defined(__CLR_VER) || \ + (defined(__i386__) && !defined(__SSE2__)) +#define LIBYUV_DISABLE_X86 +#endif +// MemorySanitizer does not support assembly code yet. http://crbug.com/344505 +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#define LIBYUV_DISABLE_X86 +#endif +#endif + +// GCC >= 4.7.0 required for AVX2. +#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) +#if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7)) +#define GCC_HAS_AVX2 1 +#endif // GNUC >= 4.7 +#endif // __GNUC__ + +// clang >= 3.4.0 required for AVX2. +#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) +#if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4)) +#define CLANG_HAS_AVX2 1 +#endif // clang >= 3.4 +#endif // __clang__ + +// Visual C 2012 required for AVX2. +#if defined(_M_IX86) && !defined(__clang__) && \ + defined(_MSC_VER) && _MSC_VER >= 1700 +#define VISUALC_HAS_AVX2 1 +#endif // VisualStudio >= 2012 + +// The following are available on all x86 platforms: +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) +#define HAS_FIXEDDIV1_X86 +#define HAS_FIXEDDIV_X86 +#define HAS_SCALEARGBCOLS_SSE2 +#define HAS_SCALEARGBCOLSUP2_SSE2 +#define HAS_SCALEARGBFILTERCOLS_SSSE3 +#define HAS_SCALEARGBROWDOWN2_SSE2 +#define HAS_SCALEARGBROWDOWNEVEN_SSE2 +#define HAS_SCALECOLSUP2_SSE2 +#define HAS_SCALEFILTERCOLS_SSSE3 +#define HAS_SCALEROWDOWN2_SSSE3 +#define HAS_SCALEROWDOWN34_SSSE3 +#define HAS_SCALEROWDOWN38_SSSE3 +#define HAS_SCALEROWDOWN4_SSSE3 +#define HAS_SCALEADDROW_SSE2 +#endif + +// The following are available on all x86 platforms, but +// require VS2012, clang 3.4 or gcc 4.7. +// The code supports NaCL but requires a new compiler and validator. +#if !defined(LIBYUV_DISABLE_X86) && (defined(VISUALC_HAS_AVX2) || \ + defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2)) +#define HAS_SCALEADDROW_AVX2 +#define HAS_SCALEROWDOWN2_AVX2 +#define HAS_SCALEROWDOWN4_AVX2 +#endif + +// The following are available on Neon platforms: +#if !defined(LIBYUV_DISABLE_NEON) && !defined(__native_client__) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__)) +#define HAS_SCALEARGBCOLS_NEON +#define HAS_SCALEARGBROWDOWN2_NEON +#define HAS_SCALEARGBROWDOWNEVEN_NEON +#define HAS_SCALEFILTERCOLS_NEON +#define HAS_SCALEROWDOWN2_NEON +#define HAS_SCALEROWDOWN34_NEON +#define HAS_SCALEROWDOWN38_NEON +#define HAS_SCALEROWDOWN4_NEON +#define HAS_SCALEARGBFILTERCOLS_NEON +#endif + +// The following are available on Mips platforms: +#if !defined(LIBYUV_DISABLE_MIPS) && !defined(__native_client__) && \ + defined(__mips__) && defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#define HAS_SCALEROWDOWN2_DSPR2 +#define HAS_SCALEROWDOWN4_DSPR2 +#define HAS_SCALEROWDOWN34_DSPR2 +#define HAS_SCALEROWDOWN38_DSPR2 +#endif + +// Scale ARGB vertically with bilinear interpolation. +void ScalePlaneVertical(int src_height, + int dst_width, int dst_height, + int src_stride, int dst_stride, + const uint8* src_argb, uint8* dst_argb, + int x, int y, int dy, + int bpp, enum FilterMode filtering); + +void ScalePlaneVertical_16(int src_height, + int dst_width, int dst_height, + int src_stride, int dst_stride, + const uint16* src_argb, uint16* dst_argb, + int x, int y, int dy, + int wpp, enum FilterMode filtering); + +// Simplify the filtering based on scale factors. +enum FilterMode ScaleFilterReduce(int src_width, int src_height, + int dst_width, int dst_height, + enum FilterMode filtering); + +// Divide num by div and return as 16.16 fixed point result. +int FixedDiv_C(int num, int div); +int FixedDiv_X86(int num, int div); +// Divide num - 1 by div - 1 and return as 16.16 fixed point result. +int FixedDiv1_C(int num, int div); +int FixedDiv1_X86(int num, int div); +#ifdef HAS_FIXEDDIV_X86 +#define FixedDiv FixedDiv_X86 +#define FixedDiv1 FixedDiv1_X86 +#else +#define FixedDiv FixedDiv_C +#define FixedDiv1 FixedDiv1_C +#endif + +// Compute slope values for stepping. +void ScaleSlope(int src_width, int src_height, + int dst_width, int dst_height, + enum FilterMode filtering, + int* x, int* y, int* dx, int* dy); + +void ScaleRowDown2_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* dst, int dst_width); +void ScaleRowDown2Linear_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2Linear_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* dst, int dst_width); +void ScaleRowDown2Box_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2Box_Odd_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* dst, int dst_width); +void ScaleRowDown4_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown4_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* dst, int dst_width); +void ScaleRowDown4Box_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown4Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* dst, int dst_width); +void ScaleRowDown34_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown34_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* dst, int dst_width); +void ScaleRowDown34_0_Box_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* d, int dst_width); +void ScaleRowDown34_0_Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* d, int dst_width); +void ScaleRowDown34_1_Box_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* d, int dst_width); +void ScaleRowDown34_1_Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* d, int dst_width); +void ScaleCols_C(uint8* dst_ptr, const uint8* src_ptr, + int dst_width, int x, int dx); +void ScaleCols_16_C(uint16* dst_ptr, const uint16* src_ptr, + int dst_width, int x, int dx); +void ScaleColsUp2_C(uint8* dst_ptr, const uint8* src_ptr, + int dst_width, int, int); +void ScaleColsUp2_16_C(uint16* dst_ptr, const uint16* src_ptr, + int dst_width, int, int); +void ScaleFilterCols_C(uint8* dst_ptr, const uint8* src_ptr, + int dst_width, int x, int dx); +void ScaleFilterCols_16_C(uint16* dst_ptr, const uint16* src_ptr, + int dst_width, int x, int dx); +void ScaleFilterCols64_C(uint8* dst_ptr, const uint8* src_ptr, + int dst_width, int x, int dx); +void ScaleFilterCols64_16_C(uint16* dst_ptr, const uint16* src_ptr, + int dst_width, int x, int dx); +void ScaleRowDown38_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown38_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* dst, int dst_width); +void ScaleRowDown38_3_Box_C(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown38_3_Box_16_C(const uint16* src_ptr, + ptrdiff_t src_stride, + uint16* dst_ptr, int dst_width); +void ScaleRowDown38_2_Box_C(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown38_2_Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride, + uint16* dst_ptr, int dst_width); +void ScaleAddRow_C(const uint8* src_ptr, uint16* dst_ptr, int src_width); +void ScaleAddRow_16_C(const uint16* src_ptr, uint32* dst_ptr, int src_width); +void ScaleARGBRowDown2_C(const uint8* src_argb, + ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2Linear_C(const uint8* src_argb, + ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2Box_C(const uint8* src_argb, ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDownEven_C(const uint8* src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDownEvenBox_C(const uint8* src_argb, + ptrdiff_t src_stride, + int src_stepx, + uint8* dst_argb, int dst_width); +void ScaleARGBCols_C(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); +void ScaleARGBCols64_C(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); +void ScaleARGBColsUp2_C(uint8* dst_argb, const uint8* src_argb, + int dst_width, int, int); +void ScaleARGBFilterCols_C(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); +void ScaleARGBFilterCols64_C(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); + +// Specialized scalers for x86. +void ScaleRowDown2_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Linear_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Box_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Linear_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Box_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4Box_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4Box_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); + +void ScaleRowDown34_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown34_1_Box_SSSE3(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown34_0_Box_SSSE3(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown38_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown38_3_Box_SSSE3(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown38_2_Box_SSSE3(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Linear_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Box_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Box_Odd_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Linear_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Box_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown2Box_Odd_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4Box_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4Box_Any_AVX2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); + +void ScaleRowDown34_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown34_1_Box_Any_SSSE3(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown34_0_Box_Any_SSSE3(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown38_Any_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown38_3_Box_Any_SSSE3(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown38_2_Box_Any_SSSE3(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); + +void ScaleAddRow_SSE2(const uint8* src_ptr, uint16* dst_ptr, int src_width); +void ScaleAddRow_AVX2(const uint8* src_ptr, uint16* dst_ptr, int src_width); +void ScaleAddRow_Any_SSE2(const uint8* src_ptr, uint16* dst_ptr, int src_width); +void ScaleAddRow_Any_AVX2(const uint8* src_ptr, uint16* dst_ptr, int src_width); + +void ScaleFilterCols_SSSE3(uint8* dst_ptr, const uint8* src_ptr, + int dst_width, int x, int dx); +void ScaleColsUp2_SSE2(uint8* dst_ptr, const uint8* src_ptr, + int dst_width, int x, int dx); + + +// ARGB Column functions +void ScaleARGBCols_SSE2(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); +void ScaleARGBFilterCols_SSSE3(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); +void ScaleARGBColsUp2_SSE2(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); +void ScaleARGBFilterCols_NEON(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); +void ScaleARGBCols_NEON(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); +void ScaleARGBFilterCols_Any_NEON(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); +void ScaleARGBCols_Any_NEON(uint8* dst_argb, const uint8* src_argb, + int dst_width, int x, int dx); + +// ARGB Row functions +void ScaleARGBRowDown2_SSE2(const uint8* src_argb, ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2Linear_SSE2(const uint8* src_argb, ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2Box_SSE2(const uint8* src_argb, ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleARGBRowDown2Linear_NEON(const uint8* src_argb, ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2Box_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleARGBRowDown2_Any_SSE2(const uint8* src_argb, ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2Linear_Any_SSE2(const uint8* src_argb, + ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2Box_Any_SSE2(const uint8* src_argb, ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleARGBRowDown2Linear_Any_NEON(const uint8* src_argb, + ptrdiff_t src_stride, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDown2Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); + +void ScaleARGBRowDownEven_SSE2(const uint8* src_argb, ptrdiff_t src_stride, + int src_stepx, uint8* dst_argb, int dst_width); +void ScaleARGBRowDownEvenBox_SSE2(const uint8* src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDownEven_NEON(const uint8* src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDownEvenBox_NEON(const uint8* src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDownEven_Any_SSE2(const uint8* src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDownEvenBox_Any_SSE2(const uint8* src_argb, + ptrdiff_t src_stride, + int src_stepx, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDownEven_Any_NEON(const uint8* src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8* dst_argb, int dst_width); +void ScaleARGBRowDownEvenBox_Any_NEON(const uint8* src_argb, + ptrdiff_t src_stride, + int src_stepx, + uint8* dst_argb, int dst_width); + +// ScaleRowDown2Box also used by planar functions +// NEON downscalers with interpolation. + +// Note - not static due to reuse in convert for 444 to 420. +void ScaleRowDown2_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2Linear_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2Box_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); + +void ScaleRowDown4_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4Box_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); + +// Down scale from 4 to 3 pixels. Use the neon multilane read/write +// to load up the every 4th pixel into a 4 different registers. +// Point samples 32 pixels to 24 pixels. +void ScaleRowDown34_NEON(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown34_0_Box_NEON(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown34_1_Box_NEON(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); + +// 32 -> 12 +void ScaleRowDown38_NEON(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +// 32x3 -> 12x1 +void ScaleRowDown38_3_Box_NEON(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +// 32x2 -> 12x1 +void ScaleRowDown38_2_Box_NEON(const uint8* src_ptr, + ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); + +void ScaleRowDown2_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2Linear_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2Box_Odd_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown4_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown4Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown34_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown34_0_Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown34_1_Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +// 32 -> 12 +void ScaleRowDown38_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +// 32x3 -> 12x1 +void ScaleRowDown38_3_Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +// 32x2 -> 12x1 +void ScaleRowDown38_2_Box_Any_NEON(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); + +void ScaleAddRow_NEON(const uint8* src_ptr, uint16* dst_ptr, int src_width); +void ScaleAddRow_Any_NEON(const uint8* src_ptr, uint16* dst_ptr, int src_width); + +void ScaleFilterCols_NEON(uint8* dst_ptr, const uint8* src_ptr, + int dst_width, int x, int dx); + +void ScaleFilterCols_Any_NEON(uint8* dst_ptr, const uint8* src_ptr, + int dst_width, int x, int dx); + +void ScaleRowDown2_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown2Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown4_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown4Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown34_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown34_0_Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* d, int dst_width); +void ScaleRowDown34_1_Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* d, int dst_width); +void ScaleRowDown38_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst, int dst_width); +void ScaleRowDown38_2_Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); +void ScaleRowDown38_3_Box_DSPR2(const uint8* src_ptr, ptrdiff_t src_stride, + uint8* dst_ptr, int dst_width); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_SCALE_ROW_H_ diff --git a/phonelibs/libyuv/include/libyuv/version.h b/phonelibs/libyuv/include/libyuv/version.h new file mode 100644 index 00000000000000..3a8f6337ca22cd --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/version.h @@ -0,0 +1,16 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_VERSION_H_ +#define INCLUDE_LIBYUV_VERSION_H_ + +#define LIBYUV_VERSION 1622 + +#endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/phonelibs/libyuv/include/libyuv/video_common.h b/phonelibs/libyuv/include/libyuv/video_common.h new file mode 100644 index 00000000000000..cb425426a256e0 --- /dev/null +++ b/phonelibs/libyuv/include/libyuv/video_common.h @@ -0,0 +1,184 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +// Common definitions for video, including fourcc and VideoFormat. + +#ifndef INCLUDE_LIBYUV_VIDEO_COMMON_H_ +#define INCLUDE_LIBYUV_VIDEO_COMMON_H_ + +#include "libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +////////////////////////////////////////////////////////////////////////////// +// Definition of FourCC codes +////////////////////////////////////////////////////////////////////////////// + +// Convert four characters to a FourCC code. +// Needs to be a macro otherwise the OS X compiler complains when the kFormat* +// constants are used in a switch. +#ifdef __cplusplus +#define FOURCC(a, b, c, d) ( \ + (static_cast(a)) | (static_cast(b) << 8) | \ + (static_cast(c) << 16) | (static_cast(d) << 24)) +#else +#define FOURCC(a, b, c, d) ( \ + ((uint32)(a)) | ((uint32)(b) << 8) | /* NOLINT */ \ + ((uint32)(c) << 16) | ((uint32)(d) << 24)) /* NOLINT */ +#endif + +// Some pages discussing FourCC codes: +// http://www.fourcc.org/yuv.php +// http://v4l2spec.bytesex.org/spec/book1.htm +// http://developer.apple.com/quicktime/icefloe/dispatch020.html +// http://msdn.microsoft.com/library/windows/desktop/dd206750.aspx#nv12 +// http://people.xiph.org/~xiphmont/containers/nut/nut4cc.txt + +// FourCC codes grouped according to implementation efficiency. +// Primary formats should convert in 1 efficient step. +// Secondary formats are converted in 2 steps. +// Auxilliary formats call primary converters. +enum FourCC { + // 9 Primary YUV formats: 5 planar, 2 biplanar, 2 packed. + FOURCC_I420 = FOURCC('I', '4', '2', '0'), + FOURCC_I422 = FOURCC('I', '4', '2', '2'), + FOURCC_I444 = FOURCC('I', '4', '4', '4'), + FOURCC_I411 = FOURCC('I', '4', '1', '1'), + FOURCC_I400 = FOURCC('I', '4', '0', '0'), + FOURCC_NV21 = FOURCC('N', 'V', '2', '1'), + FOURCC_NV12 = FOURCC('N', 'V', '1', '2'), + FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'), + FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'), + + // 2 Secondary YUV formats: row biplanar. + FOURCC_M420 = FOURCC('M', '4', '2', '0'), + FOURCC_Q420 = FOURCC('Q', '4', '2', '0'), // deprecated. + + // 9 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp. + FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'), + FOURCC_BGRA = FOURCC('B', 'G', 'R', 'A'), + FOURCC_ABGR = FOURCC('A', 'B', 'G', 'R'), + FOURCC_24BG = FOURCC('2', '4', 'B', 'G'), + FOURCC_RAW = FOURCC('r', 'a', 'w', ' '), + FOURCC_RGBA = FOURCC('R', 'G', 'B', 'A'), + FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // rgb565 LE. + FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // argb1555 LE. + FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444 LE. + + // 4 Secondary RGB formats: 4 Bayer Patterns. deprecated. + FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'), + FOURCC_BGGR = FOURCC('B', 'G', 'G', 'R'), + FOURCC_GRBG = FOURCC('G', 'R', 'B', 'G'), + FOURCC_GBRG = FOURCC('G', 'B', 'R', 'G'), + + // 1 Primary Compressed YUV format. + FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'), + + // 5 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias. + FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'), + FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'), + FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'), + FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'), // Linux version of I420. + FOURCC_J420 = FOURCC('J', '4', '2', '0'), + FOURCC_J400 = FOURCC('J', '4', '0', '0'), // unofficial fourcc + FOURCC_H420 = FOURCC('H', '4', '2', '0'), // unofficial fourcc + + // 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc. + FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420. + FOURCC_YU16 = FOURCC('Y', 'U', '1', '6'), // Alias for I422. + FOURCC_YU24 = FOURCC('Y', 'U', '2', '4'), // Alias for I444. + FOURCC_YUYV = FOURCC('Y', 'U', 'Y', 'V'), // Alias for YUY2. + FOURCC_YUVS = FOURCC('y', 'u', 'v', 's'), // Alias for YUY2 on Mac. + FOURCC_HDYC = FOURCC('H', 'D', 'Y', 'C'), // Alias for UYVY. + FOURCC_2VUY = FOURCC('2', 'v', 'u', 'y'), // Alias for UYVY on Mac. + FOURCC_JPEG = FOURCC('J', 'P', 'E', 'G'), // Alias for MJPG. + FOURCC_DMB1 = FOURCC('d', 'm', 'b', '1'), // Alias for MJPG on Mac. + FOURCC_BA81 = FOURCC('B', 'A', '8', '1'), // Alias for BGGR. + FOURCC_RGB3 = FOURCC('R', 'G', 'B', '3'), // Alias for RAW. + FOURCC_BGR3 = FOURCC('B', 'G', 'R', '3'), // Alias for 24BG. + FOURCC_CM32 = FOURCC(0, 0, 0, 32), // Alias for BGRA kCMPixelFormat_32ARGB + FOURCC_CM24 = FOURCC(0, 0, 0, 24), // Alias for RAW kCMPixelFormat_24RGB + FOURCC_L555 = FOURCC('L', '5', '5', '5'), // Alias for RGBO. + FOURCC_L565 = FOURCC('L', '5', '6', '5'), // Alias for RGBP. + FOURCC_5551 = FOURCC('5', '5', '5', '1'), // Alias for RGBO. + + // 1 Auxiliary compressed YUV format set aside for capturer. + FOURCC_H264 = FOURCC('H', '2', '6', '4'), + + // Match any fourcc. + FOURCC_ANY = -1, +}; + +enum FourCCBpp { + // Canonical fourcc codes used in our code. + FOURCC_BPP_I420 = 12, + FOURCC_BPP_I422 = 16, + FOURCC_BPP_I444 = 24, + FOURCC_BPP_I411 = 12, + FOURCC_BPP_I400 = 8, + FOURCC_BPP_NV21 = 12, + FOURCC_BPP_NV12 = 12, + FOURCC_BPP_YUY2 = 16, + FOURCC_BPP_UYVY = 16, + FOURCC_BPP_M420 = 12, + FOURCC_BPP_Q420 = 12, + FOURCC_BPP_ARGB = 32, + FOURCC_BPP_BGRA = 32, + FOURCC_BPP_ABGR = 32, + FOURCC_BPP_RGBA = 32, + FOURCC_BPP_24BG = 24, + FOURCC_BPP_RAW = 24, + FOURCC_BPP_RGBP = 16, + FOURCC_BPP_RGBO = 16, + FOURCC_BPP_R444 = 16, + FOURCC_BPP_RGGB = 8, + FOURCC_BPP_BGGR = 8, + FOURCC_BPP_GRBG = 8, + FOURCC_BPP_GBRG = 8, + FOURCC_BPP_YV12 = 12, + FOURCC_BPP_YV16 = 16, + FOURCC_BPP_YV24 = 24, + FOURCC_BPP_YU12 = 12, + FOURCC_BPP_J420 = 12, + FOURCC_BPP_J400 = 8, + FOURCC_BPP_H420 = 12, + FOURCC_BPP_MJPG = 0, // 0 means unknown. + FOURCC_BPP_H264 = 0, + FOURCC_BPP_IYUV = 12, + FOURCC_BPP_YU16 = 16, + FOURCC_BPP_YU24 = 24, + FOURCC_BPP_YUYV = 16, + FOURCC_BPP_YUVS = 16, + FOURCC_BPP_HDYC = 16, + FOURCC_BPP_2VUY = 16, + FOURCC_BPP_JPEG = 1, + FOURCC_BPP_DMB1 = 1, + FOURCC_BPP_BA81 = 8, + FOURCC_BPP_RGB3 = 24, + FOURCC_BPP_BGR3 = 24, + FOURCC_BPP_CM32 = 32, + FOURCC_BPP_CM24 = 24, + + // Match any fourcc. + FOURCC_BPP_ANY = 0, // 0 means unknown. +}; + +// Converts fourcc aliases into canonical ones. +LIBYUV_API uint32 CanonicalFourCC(uint32 fourcc); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_VIDEO_COMMON_H_ diff --git a/phonelibs/libyuv/lib/libyuv.a b/phonelibs/libyuv/lib/libyuv.a new file mode 100644 index 00000000000000..228de4d03e3f13 Binary files /dev/null and b/phonelibs/libyuv/lib/libyuv.a differ diff --git a/phonelibs/libyuv/mac/lib/libyuv.a b/phonelibs/libyuv/mac/lib/libyuv.a new file mode 100644 index 00000000000000..4a1609ca7a6754 Binary files /dev/null and b/phonelibs/libyuv/mac/lib/libyuv.a differ diff --git a/phonelibs/libyuv/tx2/libyuv.a b/phonelibs/libyuv/tx2/libyuv.a new file mode 100644 index 00000000000000..bfe5b5b378a5e4 Binary files /dev/null and b/phonelibs/libyuv/tx2/libyuv.a differ diff --git a/phonelibs/libyuv/x64/include b/phonelibs/libyuv/x64/include new file mode 120000 index 00000000000000..f5030fe8899824 --- /dev/null +++ b/phonelibs/libyuv/x64/include @@ -0,0 +1 @@ +../include \ No newline at end of file diff --git a/phonelibs/libyuv/x64/lib/libyuv.a b/phonelibs/libyuv/x64/lib/libyuv.a new file mode 100644 index 00000000000000..c6afc56433cdce Binary files /dev/null and b/phonelibs/libyuv/x64/lib/libyuv.a differ diff --git a/phonelibs/openblas/libopenblas.so b/phonelibs/openblas/libopenblas.so new file mode 120000 index 00000000000000..7a792bc9071885 --- /dev/null +++ b/phonelibs/openblas/libopenblas.so @@ -0,0 +1 @@ +libopenblas_armv8p-r0.2.19.so \ No newline at end of file diff --git a/phonelibs/openblas/libopenblas_armv8p-r0.2.19.so b/phonelibs/openblas/libopenblas_armv8p-r0.2.19.so new file mode 100755 index 00000000000000..ace58c8a13122f Binary files /dev/null and b/phonelibs/openblas/libopenblas_armv8p-r0.2.19.so differ diff --git a/phonelibs/snpe/include/DiagLog/IDiagLog.hpp b/phonelibs/snpe/include/DiagLog/IDiagLog.hpp new file mode 100644 index 00000000000000..af1ef8917e8627 --- /dev/null +++ b/phonelibs/snpe/include/DiagLog/IDiagLog.hpp @@ -0,0 +1,87 @@ +//============================================================================= +// +// Copyright (c) 2015 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= +#ifndef __IDIAGLOG_HPP_ +#define __IDIAGLOG_HPP_ + +#ifndef ZDL_LOGGING_EXPORT +#define ZDL_LOGGING_EXPORT __attribute__((visibility("default"))) +#endif + +#include + +#include "DiagLog/Options.hpp" +#include "DlSystem/String.hpp" + +namespace zdl +{ +namespace DiagLog +{ + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/// @brief . +/// +/// Interface for controlling logging for zdl components. + +class ZDL_LOGGING_EXPORT IDiagLog +{ +public: + + /// @brief . + /// + /// Sets the options after initialization occurs. + /// + /// @param[in] loggingOptions The options to set up diagnostic logging. + /// + /// @return False if the options could not be set. Ensure logging is not started. + virtual bool setOptions(const Options& loggingOptions) = 0; + + /// @brief . + /// + /// Gets the curent options for the diag logger. + /// + /// @return Diag log options object. + virtual Options getOptions() = 0; + + /// @brief . + /// + /// Allows for setting the log mask once diag logging has started + /// + /// @return True if the level was set successfully, false if a failure occurred. + virtual bool setDiagLogMask(const std::string& mask) = 0; + + /// @brief . + /// + /// Allows for setting the log mask once diag logging has started + /// + /// @return True if the level was set successfully, false if a failure occurred. + virtual bool setDiagLogMask(const zdl::DlSystem::String& mask) = 0; + + /// @brief . + /// + /// Enables logging for zdl components. + /// + /// Logging should be started prior to the instantiation of zdl components + /// to ensure all events are captured. + /// + /// @return False if diagnostic logging could not be started. + virtual bool start(void) = 0; + + /// @brief Disables logging for zdl components. + virtual bool stop(void) = 0; + + virtual ~IDiagLog() {}; +}; + +} // DiagLog namespace +} // zdl namespace + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif diff --git a/phonelibs/snpe/include/DiagLog/Options.hpp b/phonelibs/snpe/include/DiagLog/Options.hpp new file mode 100644 index 00000000000000..ba0c82119bfebb --- /dev/null +++ b/phonelibs/snpe/include/DiagLog/Options.hpp @@ -0,0 +1,75 @@ +//============================================================================= +// +// Copyright (c) 2015 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= +#ifndef __DIAGLOG_OPTIONS_HPP_ +#define __DIAGLOG_OPTIONS_HPP_ + +#ifndef ZDL_LOGGING_EXPORT +#define ZDL_LOGGING_EXPORT __attribute__((visibility("default"))) +#endif + +#include +#include + +namespace zdl +{ +namespace DiagLog +{ +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/// @brief . +/// +/// Options for setting up diagnostic logging for zdl components. +class ZDL_LOGGING_EXPORT Options +{ +public: + Options() : + DiagLogMask(""), + LogFileDirectory("diaglogs"), + LogFileName("DiagLog"), + LogFileRotateCount(20) + { + // Solves the empty string problem with multiple std libs + DiagLogMask.reserve(1); + } + + /// @brief . + /// + /// Enables diag logging only on the specified area mask (DNN_RUNTIME=ON | OFF) + std::string DiagLogMask; + + /// @brief . + /// + /// The path to the directory where log files will be written. + /// The path may be relative or absolute. Relative paths are interpreted + /// from the current working directory. + /// Default value is "diaglogs" + std::string LogFileDirectory; + + /// @brief . + /// + //// The name used for log files. If this value is empty then BaseName will be + /// used as the default file name. + /// Default value is "DiagLog" + std::string LogFileName; + + /// @brief . + /// + /// The maximum number of log files to create. If set to 0 no log rotation + /// will be used and the log file name specified will be used each time, overwriting + /// any existing log file that may exist. + /// Default value is 20 + uint32_t LogFileRotateCount; +}; +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +} // DiagLog namespace +} // zdl namespace + + +#endif diff --git a/phonelibs/snpe/include/DlContainer/IDlContainer.hpp b/phonelibs/snpe/include/DlContainer/IDlContainer.hpp new file mode 100644 index 00000000000000..c4b465fd04bbe6 --- /dev/null +++ b/phonelibs/snpe/include/DlContainer/IDlContainer.hpp @@ -0,0 +1,156 @@ +//============================================================================= +// +// Copyright (c) 2015 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef ZEROTH_IDNC_CONTAINER_HPP +#define ZEROTH_IDNC_CONTAINER_HPP + +#include +#include +#include +#include +#include +#include + +#include "DlSystem/ZdlExportDefine.hpp" +#include "DlSystem/String.hpp" + +namespace zdl { +namespace DlContainer { + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +class IDlContainer; +class dlc_error; + +/** + * The structure of a record in a DL container. + */ +struct ZDL_EXPORT DlcRecord +{ + /// Name of the record. + std::string name; + /// Byte blob holding the data for the record. + std::vector data; + + DlcRecord(); + DlcRecord( DlcRecord&& other ) + : name(std::move(other.name)) + , data(std::move(other.data)) + {} + + DlcRecord(const DlcRecord&) = delete; +}; + +// The maximum length of any record name. +extern const uint32_t RECORD_NAME_MAX_SIZE; +// The maximum size of the record payload (bytes). +extern const uint32_t RECORD_DATA_MAX_SIZE; +// The maximum number of records in an archive at one time. +extern const uint32_t ARCHIVE_MAX_RECORDS; + +/** + * Represents a container for a neural network model which can + * be used to load the model into the SNPE runtime. + */ +class ZDL_EXPORT IDlContainer +{ +public: + /** + * Initializes a container from a container archive file. + * + * @param[in] filename Container archive file path. + * + * @return A pointer to the initialized container + */ + ZDL_EXPORT static std::unique_ptr + open(const std::string &filename) noexcept; + + /** + * Initializes a container from a container archive file. + * + * @param[in] filename Container archive file path. + * + * @return A pointer to the initialized container + */ + ZDL_EXPORT static std::unique_ptr + open(const zdl::DlSystem::String &filename) noexcept; + + /** + * Initializes a container from a byte buffer. + * + * @param[in] buffer Byte buffer holding the contents of an archive + * file. + * + * @return A pointer to the initialized container + */ + ZDL_EXPORT static std::unique_ptr + open(const std::vector &buffer) noexcept; + + /** + * Initializes a container from a byte buffer. + * + * @param[in] buffer Byte buffer holding the contents of an archive + * file. + * + * @param[in] size Size of the byte buffer. + * + * @return A pointer to the initialized container + */ + ZDL_EXPORT static std::unique_ptr + open(const uint8_t* buffer, const size_t size) noexcept; + + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + + /** + * Get the record catalog for a container. + * + * @param[out] catalog Buffer that will hold the record names on + * return. + */ + virtual void getCatalog(std::set &catalog) const = 0; + + /** + * Get the record catalog for a container. + * + * @param[out] catalog Buffer that will hold the record names on + * return. + */ + virtual void getCatalog(std::set &catalog) const = 0; + + /** + * Get a record from a container by name. + * + * @param[in] name Name of the record to fetch. + * @param[out] record The passed in record will be populated with the + * record data on return. Note that the caller + * will own the data in the record and is + * responsible for freeing it if needed. + */ + virtual void getRecord(const std::string &name, DlcRecord &record) const = 0; + + /** + * Get a record from a container by name. + * + * @param[in] name Name of the record to fetch. + * @param[out] record The passed in record will be populated with the + * record data on return. Note that the caller + * will own the data in the record and is + * responsible for freeing it if needed. + */ + virtual void getRecord(const zdl::DlSystem::String &name, DlcRecord &record) const = 0; + + virtual ~IDlContainer() {} +}; + +} // ns DlContainer +} // ns zdl + + +#endif diff --git a/phonelibs/snpe/include/DlSystem/DlEnums.hpp b/phonelibs/snpe/include/DlSystem/DlEnums.hpp new file mode 100644 index 00000000000000..fde252ca7f6742 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/DlEnums.hpp @@ -0,0 +1,146 @@ +//============================================================================== +// +// Copyright (c) 2014-2018 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef _DL_ENUMS_HPP_ +#define _DL_ENUMS_HPP_ + +#include "DlSystem/ZdlExportDefine.hpp" + + +namespace zdl { +namespace DlSystem +{ +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * Enumeration of supported target runtimes. + */ +enum class Runtime_t +{ + /// Run the processing on Snapdragon CPU. + /// Data: float 32bit + /// Math: float 32bit + CPU_FLOAT32 = 0, + + /// Run the processing on the Adreno GPU. + /// Data: float 16bit + /// Math: float 32bit + GPU_FLOAT32_16_HYBRID = 1, + + /// Run the processing on the Hexagon DSP. + /// Data: 8bit fixed point Tensorflow style format + /// Math: 8bit fixed point Tensorflow style format + DSP_FIXED8_TF = 2, + + /// Run the processing on the Adreno GPU. + /// Data: float 16bit + /// Math: float 16bit + GPU_FLOAT16 = 3, + + /// Default legacy enum to retain backward compatibility. + /// CPU = CPU_FLOAT32 + CPU = CPU_FLOAT32, + + /// Default legacy enum to retain backward compatibility. + /// GPU = GPU_FLOAT32_16_HYBRID + GPU = GPU_FLOAT32_16_HYBRID, + + /// Default legacy enum to retain backward compatibility. + /// DSP = DSP_FIXED8_TF + DSP = DSP_FIXED8_TF +}; + +/** + * Enumeration of various performance profiles that can be requested. + */ +enum class PerformanceProfile_t +{ + /// Run in a standard mode. + /// This mode will be deprecated in the future and replaced with BALANCED. + DEFAULT = 0, + /// Run in a balanced mode. + BALANCED = 0, + + /// Run in high performance mode + HIGH_PERFORMANCE, + + /// Run in a power sensitive mode, at the expense of performance. + POWER_SAVER, + + /// Use system settings. SNPE makes no calls to any performance related APIs. + SYSTEM_SETTINGS, + + /// Run in sustained high performance mode + SUSTAINED_HIGH_PERFORMANCE + +}; + +/** + * Enumeration of various execution priority hints. + */ +enum class ExecutionPriorityHint_t +{ + /// Normal priority + NORMAL = 0, + + /// Higher than normal priority + HIGH, + + /// Lower priority + LOW + +}; + +/** @} */ /* end_addtogroup c_plus_plus_apis C++*/ + +/** + * Enumeration that lists the supported image encoding formats. + */ +enum class ImageEncoding_t +{ + /// For unknown image type. Also used as a default value for ImageEncoding_t. + UNKNOWN = 0, + + /// The RGB format consists of 3 bytes per pixel: one byte for + /// Red, one for Green, and one for Blue. The byte ordering is + /// endian independent and is always in RGB byte order. + RGB, + + /// The ARGB32 format consists of 4 bytes per pixel: one byte for + /// Red, one for Green, one for Blue, and one for the alpha channel. + /// The alpha channel is ignored. The byte ordering depends on the + /// underlying CPU. For little endian CPUs, the byte order is BGRA. + /// For big endian CPUs, the byte order is ARGB. + ARGB32, + + /// The RGBA format consists of 4 bytes per pixel: one byte for + /// Red, one for Green, one for Blue, and one for the alpha channel. + /// The alpha channel is ignored. The byte ordering is endian independent + /// and is always in RGBA byte order. + RGBA, + + /// The GRAYSCALE format is for 8-bit grayscale. + GRAYSCALE, + + /// NV21 is the Android version of YUV. The Chrominance is down + /// sampled and has a subsampling ratio of 4:2:0. Note that this + /// image format has 3 channels, but the U and V channels + /// are subsampled. For every four Y pixels there is one U and one V pixel. @newpage + NV21, + + /// The BGR format consists of 3 bytes per pixel: one byte for + /// Red, one for Green and one for Blue. The byte ordering is + /// endian independent and is always BGR byte order. + BGR +}; + +}} // namespaces end + + +#endif diff --git a/phonelibs/snpe/include/DlSystem/DlError.hpp b/phonelibs/snpe/include/DlSystem/DlError.hpp new file mode 100644 index 00000000000000..383403b5418a26 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/DlError.hpp @@ -0,0 +1,205 @@ +//============================================================================== +// +// Copyright (c) 2016-18 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef _DL_ERROR_HPP_ +#define _DL_ERROR_HPP_ + +#include +#include // numeric_limits + +#include "DlSystem/ZdlExportDefine.hpp" + +namespace zdl { +namespace DlSystem { + +// clang and arm gcc different in how ZDL_EXPORT is used with enum class +#if !defined (__clang__) +enum class ErrorCode : uint32_t ZDL_EXPORT { +#else +enum class ZDL_EXPORT ErrorCode : uint32_t { +#endif // ARM64V8A + NONE = 0, + + // System config errors + SNPE_CONFIG_MISSING_PARAM = 100, + SNPE_CONFIG_INVALID_PARAM = 101, + SNPE_CONFIG_MISSING_FILE = 102, + SNPE_CONFIG_NNCONFIG_NOT_SET = 103, + SNPE_CONFIG_NNCONFIG_INVALID = 104, + SNPE_CONFIG_WRONG_INPUT_NAME = 105, + SNPE_CONFIG_INCORRECT_INPUT_DIMENSIONS = 106, + SNPE_CONFIG_DIMENSIONS_MODIFICATION_NOT_SUPPORTED = 107, + + SNPE_CONFIG_NNCONFIG_ONLY_TENSOR_SUPPORTED = 120, + SNPE_CONFIG_NNCONFIG_ONLY_USER_BUFFER_SUPPORTED = 121, + + // DlSystem errors + SNPE_DLSYSTEM_MISSING_BUFFER = 200, + SNPE_DLSYSTEM_TENSOR_CAST_FAILED = 201, + SNPE_DLSYSTEM_FIXED_POINT_PARAM_INVALID = 202, + SNPE_DLSYSTEM_SIZE_MISMATCH = 203, + SNPE_DLSYSTEM_NAME_NOT_FOUND = 204, + SNPE_DLSYSTEM_VALUE_MISMATCH = 205, + SNPE_DLSYSTEM_INSERT_FAILED = 206, + SNPE_DLSYSTEM_TENSOR_FILE_READ_FAILED = 207, + SNPE_DLSYSTEM_DIAGLOG_FAILURE = 208, + SNPE_DLSYSTEM_LAYER_NOT_SET = 209, + SNPE_DLSYSTEM_WRONG_NUMBER_INPUT_BUFFERS = 210, + SNPE_DLSYSTEM_RUNTIME_TENSOR_SHAPE_MISMATCH = 211, + SNPE_DLSYSTEM_TENSOR_MISSING = 212, + SNPE_DLSYSTEM_TENSOR_ITERATION_UNSUPPORTED = 213, + SNPE_DLSYSTEM_BUFFER_MANAGER_MISSING = 214, + SNPE_DLSYSTEM_RUNTIME_BUFFER_SOURCE_UNSUPPORTED = 215, + SNPE_DLSYSTEM_BUFFER_CAST_FAILED = 216, + + SNPE_DLSYSTEM_BUFFERENCODING_UNKNOWN = 240, + + // DlContainer errors + SNPE_DLCONTAINER_MODEL_PARSING_FAILED = 300, + SNPE_DLCONTAINER_UNKNOWN_LAYER_CODE = 301, + SNPE_DLCONTAINER_MISSING_LAYER_PARAM = 302, + SNPE_DLCONTAINER_LAYER_PARAM_NOT_SUPPORTED = 303, + SNPE_DLCONTAINER_LAYER_PARAM_INVALID = 304, + SNPE_DLCONTAINER_TENSOR_DATA_MISSING = 305, + SNPE_DLCONTAINER_MODEL_LOAD_FAILED = 306, + SNPE_DLCONTAINER_MISSING_RECORDS = 307, + SNPE_DLCONTAINER_INVALID_RECORD = 308, + SNPE_DLCONTAINER_WRITE_FAILURE = 309, + SNPE_DLCONTAINER_READ_FAILURE = 310, + SNPE_DLCONTAINER_BAD_CONTAINER = 311, + SNPE_DLCONTAINER_BAD_DNN_FORMAT_VERSION = 312, + SNPE_DLCONTAINER_UNKNOWN_AXIS_ANNOTATION = 313, + SNPE_DLCONTAINER_UNKNOWN_SHUFFLE_TYPE = 314, + + // Network errors + SNPE_NETWORK_EMPTY_NETWORK = 400, + SNPE_NETWORK_CREATION_FAILED = 401, + SNPE_NETWORK_PARTITION_FAILED = 402, + SNPE_NETWORK_NO_OUTPUT_DEFINED = 403, + SNPE_NETWORK_MISMATCH_BETWEEN_NAMES_AND_DIMS = 404, + SNPE_NETWORK_MISSING_INPUT_NAMES = 405, + SNPE_NETWORK_MISSING_OUTPUT_NAMES = 406, + + // Host runtime errors + SNPE_HOST_RUNTIME_TARGET_UNAVAILABLE = 500, + + // CPU runtime errors + SNPE_CPU_LAYER_NOT_SUPPORTED = 600, + SNPE_CPU_LAYER_PARAM_NOT_SUPPORTED = 601, + SNPE_CPU_LAYER_PARAM_INVALID = 602, + SNPE_CPU_LAYER_PARAM_COMBINATION_INVALID = 603, + SNPE_CPU_BUFFER_NOT_FOUND = 604, + SNPE_CPU_NETWORK_NOT_SUPPORTED = 605, + + // CPU fixed-point runtime errors + SNPE_CPU_FXP_LAYER_NOT_SUPPORTED = 700, + SNPE_CPU_FXP_LAYER_PARAM_NOT_SUPPORTED = 701, + SNPE_CPU_FXP_LAYER_PARAM_INVALID = 702, + + // GPU runtime errors + SNPE_GPU_LAYER_NOT_SUPPORTED = 800, + SNPE_GPU_LAYER_PARAM_NOT_SUPPORTED = 801, + SNPE_GPU_LAYER_PARAM_INVALID = 802, + SNPE_GPU_LAYER_PARAM_COMBINATION_INVALID = 803, + SNPE_GPU_KERNEL_COMPILATION_FAILED = 804, + SNPE_GPU_CONTEXT_NOT_SET = 805, + SNPE_GPU_KERNEL_NOT_SET = 806, + SNPE_GPU_KERNEL_PARAM_INVALID = 807, + SNPE_GPU_OPENCL_CHECK_FAILED = 808, + SNPE_GPU_OPENCL_FUNCTION_ERROR = 809, + SNPE_GPU_BUFFER_NOT_FOUND = 810, + SNPE_GPU_TENSOR_DIM_INVALID = 811, + SNPE_GPU_MEMORY_FLAGS_INVALID = 812, + SNPE_GPU_UNEXPECTED_NUMBER_OF_IO = 813, + SNPE_GPU_LAYER_PROXY_ERROR = 814, + SNPE_GPU_BUFFER_IN_USE = 815, + SNPE_GPU_BUFFER_MODIFICATION_ERROR = 816, + + // DSP runtime errors + SNPE_DSP_LAYER_NOT_SUPPORTED = 900, + SNPE_DSP_LAYER_PARAM_NOT_SUPPORTED = 901, + SNPE_DSP_LAYER_PARAM_INVALID = 902, + SNPE_DSP_LAYER_PARAM_COMBINATION_INVALID = 903, + SNPE_DSP_STUB_NOT_PRESENT = 904, + SNPE_DSP_LAYER_NAME_TRUNCATED = 905, + SNPE_DSP_LAYER_INPUT_BUFFER_NAME_TRUNCATED = 906, + SNPE_DSP_LAYER_OUTPUT_BUFFER_NAME_TRUNCATED = 907, + SNPE_DSP_RUNTIME_COMMUNICATION_ERROR = 908, + SNPE_DSP_RUNTIME_INVALID_PARAM_ERROR = 909, + SNPE_DSP_RUNTIME_SYSTEM_ERROR = 910, + + // Model validataion errors + SNPE_MODEL_VALIDATION_LAYER_NOT_SUPPORTED = 1000, + SNPE_MODEL_VALIDATION_LAYER_PARAM_NOT_SUPPORTED = 1001, + SNPE_MODEL_VALIDATION_LAYER_PARAM_INVALID = 1002, + SNPE_MODEL_VALIDATION_LAYER_PARAM_MISSING = 1003, + SNPE_MODEL_VALIDATION_LAYER_PARAM_COMBINATION_INVALID = 1004, + SNPE_MODEL_VALIDATION_LAYER_ORDERING_INVALID = 1005, + SNPE_MODEL_VALIDATION_INVALID_CONSTRAINT = 1006, + SNPE_MODEL_VALIDATION_MISSING_BUFFER = 1007, + SNPE_MODEL_VALIDATION_BUFFER_REUSE_NOT_SUPPORTED = 1008, + + // UDL errors + SNPE_UDL_LAYER_EMPTY_UDL_NETWORK = 1100, + SNPE_UDL_LAYER_PARAM_INVALID = 1101, + SNPE_UDL_LAYER_INSTANCE_MISSING = 1102, + SNPE_UDL_LAYER_SETUP_FAILED = 1103, + SNPE_UDL_EXECUTE_FAILED = 1104, + SNPE_UDL_BUNDLE_INVALID = 1105, + + // Dependent library errors + SNPE_STD_LIBRARY_ERROR = 1200, + + // Unknown exception (catch (...)), Has no component attached to this + SNPE_UNKNOWN_EXCEPTION = 1210, + + // Storage Errors + SNPE_STORAGE_INVALID_KERNEL_REPO = 1300, + +}; + + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * Returns the error code of the last error encountered. + * + * @return The error code. + * + * @note The returned error code is significant only when the return + * value of the call indicated an error. + */ +ZDL_EXPORT ErrorCode getLastErrorCode(); + +/** + * Returns the error string of the last error encountered. + * + * @return The error string. + * + * @note The returned error string is significant only when the return + * value of the call indicated an error. + */ +ZDL_EXPORT const char* getLastErrorString(); + +/** + * Returns the uint32_t representation of the error code enum. + * + * @param[in] code The error code to be converted. + * + * @return uint32_t representation of the error code. + */ +ZDL_EXPORT uint32_t enumToUInt32(zdl::DlSystem::ErrorCode code); + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +} // DlSystem +} // zdl + +#endif // _DL_ERROR_HPP_ + diff --git a/phonelibs/snpe/include/DlSystem/DlOptional.hpp b/phonelibs/snpe/include/DlSystem/DlOptional.hpp new file mode 100644 index 00000000000000..2c41b6b6894ee4 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/DlOptional.hpp @@ -0,0 +1,224 @@ +//============================================================================== +// +// Copyright (c) 2016 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef _DL_SYSTEM_OPTIONAL_HPP_ +#define _DL_SYSTEM_OPTIONAL_HPP_ + +#include +#include + +#include "DlSystem/ZdlExportDefine.hpp" + +namespace zdl { +namespace DlSystem { + +template + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * Class to manage a value that may or may not exist. The boolean value + * of the Optional class is true if the object contains a value and false + * if it does not contain a value. + * + * The class must be evaluated and confirmed as true (containing a value) + * before being dereferenced. + */ +class ZDL_EXPORT Optional final { +public: + enum class LIFECYCLE { + NONE, + REFERENCE_OWNED, + POINTER_OWNED, + POINTER_NOT_OWNED + }; + + struct ReferenceCount { + size_t count = 0; + + void increment() { count++; } + + size_t decrement() { + if (count > 0) { + count--; + } + return count; + } + }; + + using U = typename std::remove_pointer::type; + + /** + * The default constructor is set to not have any value, and is + * therefore evaluated as false. + */ + // Do not explicit it so we can return {} + Optional() { + m_Type = LIFECYCLE::NONE; + } + + /** + * Construct an Optional class using an object. + * @param[in] Reference to an object v + * @param[out] Optional instance of object v + */ + template + Optional (const T& v, typename std::enable_if::value>::type* = 0) + : m_Type(LIFECYCLE::REFERENCE_OWNED) { + try { + m_StoragePtr = new T(v); + } catch (...) { + m_StoragePtr = nullptr; + m_Type = LIFECYCLE::NONE; + } + } + + template + Optional(U* v, LIFECYCLE type, typename std::enable_if::value>::type* = 0) + : m_Type(type) { + switch (m_Type) { + case LIFECYCLE::POINTER_OWNED: + m_StoragePtr = v; + m_Count = new ReferenceCount(); + m_Count->increment(); + break; + case LIFECYCLE::POINTER_NOT_OWNED: + m_StoragePtr = v; + break; + case LIFECYCLE::REFERENCE_OWNED: + throw std::bad_exception(); + case LIFECYCLE::NONE: + break; + } + } + + Optional(const Optional &other) : m_Type(other.m_Type), m_Count(other.m_Count) { + if (isReference()) { + m_StoragePtr = new U(*other.m_StoragePtr); + } else if (isPointer()) { + m_StoragePtr = other.m_StoragePtr; + if (isOwned()) { + m_Count->increment(); + } + } + } + + Optional& operator=(const Optional& other) noexcept { + Optional tmp(other); + swap(std::move(tmp)); + return *this; + } + + Optional(Optional&& other) noexcept { + swap(std::move(other)); + } + + Optional& operator=(Optional&& other) noexcept { + swap(std::move(other)); + return *this; + } + + ~Optional() { + if (isOwned()) { + if (isReference() || (isPointer() && m_Count->decrement() == 0)) { + delete m_StoragePtr; + delete m_Count; + } + } + } + + /** + * Boolean value of Optional class is only true when there exists a value. + */ + operator bool() const noexcept { return isValid(); } + + bool operator!() const noexcept { return !isValid(); } + + /** + * Get reference of Optional object + * @warning User must validate Optional has value before. + */ + const T& operator*() { return this->GetReference(); } + + /** + * Get reference of Optional object + * @warning User must validate Optional has value before. + */ + const T& operator*() const { return this->GetReference(); } + + operator T&() { return this->GetReference(); } + + T operator->() { + T self = this->GetReference(); + return self; + } +private: + void swap(Optional&& other) { + m_Type = other.m_Type; + m_StoragePtr = other.m_StoragePtr; + m_Count = other.m_Count; + + other.m_Type = LIFECYCLE::NONE; + other.m_StoragePtr = nullptr; + other.m_Count = nullptr; + } + + template + typename std::enable_if::value, const Q&>::type GetReference() const noexcept { + if (!isReference()) throw std::bad_exception(); + return *static_cast(m_StoragePtr); + } + + template + typename std::enable_if::value, const Q&>::type GetReference() const noexcept { + if (!isPointer()) throw std::bad_exception(); + return static_cast(m_StoragePtr); + } + + template + typename std::enable_if::value, Q&>::type GetReference() noexcept { + if (!isReference()) throw std::bad_exception(); + return *m_StoragePtr; + } + + template + typename std::enable_if::value, Q&>::type GetReference() noexcept { + if (!isPointer()) throw std::bad_exception(); + return m_StoragePtr; + } + + bool isPointer() const { + return m_Type == LIFECYCLE::POINTER_OWNED || m_Type == LIFECYCLE::POINTER_NOT_OWNED; + } + + bool isOwned() const { + return m_Type == LIFECYCLE::REFERENCE_OWNED || m_Type == LIFECYCLE::POINTER_OWNED; + } + + bool isReference() const { + return m_Type == LIFECYCLE::REFERENCE_OWNED; + } + + bool isValid() const { + return m_Type != LIFECYCLE::NONE; + } + + U* m_StoragePtr = nullptr; + LIFECYCLE m_Type; + ReferenceCount *m_Count = nullptr; +}; + +} // ns DlSystem +} // ns zdl + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif // _DL_SYSTEM_OPTIONAL_HPP_ diff --git a/phonelibs/snpe/include/DlSystem/DlVersion.hpp b/phonelibs/snpe/include/DlSystem/DlVersion.hpp new file mode 100644 index 00000000000000..beb8d75f218caf --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/DlVersion.hpp @@ -0,0 +1,78 @@ +//============================================================================== +// +// Copyright (c) 2014-2015 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + + +#ifndef _DL_VERSION_HPP_ +#define _DL_VERSION_HPP_ + +#include "ZdlExportDefine.hpp" +#include +#include +#include "DlSystem/String.hpp" + + +namespace zdl { +namespace DlSystem +{ + class Version_t; +}} + + +namespace zdl { namespace DlSystem +{ +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * A class that contains the different portions of a version number. + */ +class ZDL_EXPORT Version_t +{ +public: + /// Holds the major version number. Changes in this value indicate + /// major changes that break backward compatibility. + int32_t Major; + + /// Holds the minor version number. Changes in this value indicate + /// minor changes made to library that are backwards compatible + /// (such as additions to the interface). + int32_t Minor; + + /// Holds the teeny version number. Changes in this value indicate + /// changes such as bug fixes and patches made to the library that + /// do not affect the interface. + int32_t Teeny; + + /// This string holds information about the build version. + /// + std::string Build; + + static zdl::DlSystem::Version_t fromString(const std::string &stringValue); + + static zdl::DlSystem::Version_t fromString(const zdl::DlSystem::String &stringValue); + + /** + * @brief Returns a string in the form Major.Minor.Teeny.Build + * + * @return A formatted string holding the version information. + */ + const std::string toString() const; + + /** + * @brief Returns a string in the form Major.Minor.Teeny.Build + * + * @return A formatted string holding the version information. + */ + const zdl::DlSystem::String asString() const; +}; + +}} + +/** @} */ /* end_addtogroup c_plus_plus_apis */ + +#endif diff --git a/phonelibs/snpe/include/DlSystem/IBufferAttributes.hpp b/phonelibs/snpe/include/DlSystem/IBufferAttributes.hpp new file mode 100644 index 00000000000000..e80f6c134c9ab4 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/IBufferAttributes.hpp @@ -0,0 +1,78 @@ +//============================================================================== +// +// Copyright (c) 2017 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef _IBUFFER_ATTRIBUTES_HPP +#define _IBUFFER_ATTRIBUTES_HPP +#include "IUserBuffer.hpp" +#include "TensorShape.hpp" +#include "ZdlExportDefine.hpp" + +namespace zdl { + namespace DlSystem { + class UserBufferEncoding; + } +} + +namespace zdl { +namespace DlSystem { + + +/** + * @brief IBufferAttributes returns a buffer's dimension and alignment + * requirements, along with info on its encoding type + */ +class ZDL_EXPORT IBufferAttributes { +public: + + /** + * @brief Gets the buffer's element size, in bytes + * + * This can be used to compute the memory size required + * to back this buffer. + * + * @return Element size, in bytes + */ + virtual size_t getElementSize() const noexcept = 0; + + /** + * @brief Gets the element's encoding type + * + * @return encoding type + */ + virtual zdl::DlSystem::UserBufferEncoding::ElementType_t getEncodingType() const noexcept = 0; + + /** + * @brief Gets the number of elements in each dimension + * + * @return Dimension size, in terms of number of elements + */ + virtual const TensorShape getDims() const noexcept = 0; + + /** + * @brief Gets the alignment requirement of each dimension + * + * Alignment per each dimension is expressed as an multiple, for + * example, if one particular dimension can accept multiples of 8, + * the alignment will be 8. + * + * @return Alignment in each dimension, in terms of multiple of + * number of elements + */ + virtual const TensorShape getAlignments() const noexcept = 0; + + virtual ~IBufferAttributes() {} +}; + + + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +} +} + +#endif diff --git a/phonelibs/snpe/include/DlSystem/ITensor.hpp b/phonelibs/snpe/include/DlSystem/ITensor.hpp new file mode 100644 index 00000000000000..ed6d5f1072e888 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/ITensor.hpp @@ -0,0 +1,147 @@ +//============================================================================= +// +// Copyright (c) 2015-2018 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef _ITENSOR_HPP_ +#define _ITENSOR_HPP_ + +#include "ITensorItr.hpp" +#include "ITensorItrImpl.hpp" +#include "TensorShape.hpp" +#include "ZdlExportDefine.hpp" +#include +#include +#include +#include + +namespace zdl { +namespace DlSystem +{ + class ITensor; +}} + +namespace zdl { namespace DlSystem +{ +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * Represents a tensor which holds n-dimensional data. It is important to + * understand how the tensor data is represented in memory + * relative to the tensor dimensions. Tensors store data in + * memory in row-major order (i.e. the last tensor dimension is + * the fastest varying one). For example, if you have a two + * dimensional tensor with 3 rows and 2 columns (i.e. the tensor + * dimensions are 3,2 as returned in tensor dimension vectors) + * with the following data in terms rows and columns: + * + * | 1 2 |
+ * | 3 4 |
+ * | 5 6 |
+ * + * This data would be stored in memory as 1,2,3,4,5,6. + */ +class ZDL_EXPORT ITensor +{ +public: + + typedef zdl::DlSystem::ITensorItr iterator; + typedef zdl::DlSystem::ITensorItr const_iterator; + + virtual ~ITensor() {} + + /** + * Returns a tensor iterator pointing to the beginning + * of the data in the tensor. + * + * @return A tensor iterator that points to the first data + * element in the tensor. + */ + virtual iterator begin() = 0; + + /** + * Returns the const version of a tensor iterator + * pointing to the beginning of the data in the tensor. + * + * @return A tensor const iterator that points to the first data + * element in the tensor. + */ + virtual const_iterator cbegin() const = 0; + + /** + * Returns a tensor iterator pointing to the end of the + * data in the tensor. This tensor should not be + * dereferenced. + * + * @return A tensor iterator that points to the end of the data + * (one past the last element) in the tensor. + */ + virtual iterator end() = 0; + + /** + * Returns the const version of a tensor iterator + * pointing to the end of the data in the tensor. This + * tensor should not be dereferenced. + * + * @return A tensor const iterator that points to the end of the + * data (one past the last element) in the tensor. + */ + virtual const_iterator cend() const = 0; + + /** + * @brief Gets the shape of this tensor. + * + * The last element of the vector represents the fastest varying + * dimension and the zeroth element represents the slowest + * varying dimension, etc. + * + * @return A shape class holding the tensor dimensions. + */ + virtual TensorShape getShape() const = 0; + + /** + * Returns the element size of the data in the tensor + * (discounting strides). This is how big a buffer would + * need to be to hold the tensor data contiguously in + * memory. + * + * @return The size of the tensor (in elements). + */ + virtual size_t getSize() const = 0; + + /** + * @brief Serializes the tensor to an output stream. + * + * @param[in] output The output stream to which to write the tensor + * + * @throw std::runtime_error If the stream is ever in a bad + * state before the tensor is fully serialized. + */ + virtual void serialize(std::ostream &output) const = 0; + + friend iterator; + friend const_iterator; + + virtual bool isQuantized() {return false;} + virtual float GetDelta() {return NAN;}; + virtual float GetOffset() {return NAN;}; + +protected: + + /** + * Returns the tensor iterator implementation. + * + * @return A pointer to the tensor iterator implementation. + */ + virtual std::unique_ptr<::DlSystem::ITensorItrImpl> getItrImpl() const = 0; +}; + +}} + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif diff --git a/phonelibs/snpe/include/DlSystem/ITensorFactory.hpp b/phonelibs/snpe/include/DlSystem/ITensorFactory.hpp new file mode 100644 index 00000000000000..57d2c8ea992375 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/ITensorFactory.hpp @@ -0,0 +1,92 @@ +//============================================================================= +// +// Copyright (c) 2015-2016 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef _ITENSOR_FACTORY_HPP +#define _ITENSOR_FACTORY_HPP + +#include "ITensor.hpp" +#include "TensorShape.hpp" +#include "ZdlExportDefine.hpp" +#include + +namespace zdl { + namespace DlSystem + { + class ITensor; + class TensorShape; + } +} + +namespace zdl { namespace DlSystem +{ + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * Factory interface class to create ITensor objects. + */ +class ZDL_EXPORT ITensorFactory +{ +public: + virtual ~ITensorFactory() = default; + + /** + * Creates a new ITensor with uninitialized data. + * + * The strides for the tensor will match the tensor dimensions + * (i.e., the tensor data is contiguous in memory). + * + * @param[in] shape The dimensions for the tensor in which the last + * element of the vector represents the fastest varying + * dimension and the zeroth element represents the slowest + * varying, etc. + * + * @return A pointer to the created tensor or nullptr if creating failed. + */ + virtual std::unique_ptr + createTensor(const TensorShape &shape) noexcept = 0; + + /** + * Creates a new ITensor by loading it from a file. + * + * @param[in] input The input stream from which to read the tensor + * data. + * + * @return A pointer to the created tensor or nullptr if creating failed. + * + */ + virtual std::unique_ptr createTensor(std::istream &input) noexcept = 0; + + /** + * Create a new ITensor with specific data. + * (i.e. the tensor data is contiguous in memory). This tensor is + * primarily used to create a tensor where tensor size can't be + * computed directly from dimension. One such example is + * NV21-formatted image, or any YUV formatted image + * + * @param[in] shape The dimensions for the tensor in which the last + * element of the vector represents the fastest varying + * dimension and the zeroth element represents the slowest + * varying, etc. + * + * @param[in] data The actual data with which the Tensor object is filled. + * + * @param[in] dataSize The size of data + * + * @return A pointer to the created tensor + */ + virtual std::unique_ptr + createTensor(const TensorShape &shape, const unsigned char *data, size_t dataSize) noexcept = 0; +}; + +}} + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif diff --git a/phonelibs/snpe/include/DlSystem/ITensorItr.hpp b/phonelibs/snpe/include/DlSystem/ITensorItr.hpp new file mode 100644 index 00000000000000..4ce12a9f113acb --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/ITensorItr.hpp @@ -0,0 +1,182 @@ +//============================================================================= +// +// Copyright (c) 2015 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef _ITENSOR_ITR_HPP_ +#define _ITENSOR_ITR_HPP_ + +#include "ZdlExportDefine.hpp" +#include "ITensorItrImpl.hpp" + +#include +#include +#include + +namespace zdl { +namespace DlSystem +{ + template class ITensorItr; + class ITensor; + void ZDL_EXPORT fill(ITensorItr first, ITensorItr end, float val); + template OutItr ZDL_EXPORT copy(InItr first, InItr last, OutItr result) + { + return std::copy(first, last, result); + } +}} +namespace DlSystem +{ + class ITensorItrImpl; +} + +namespace zdl { namespace DlSystem +{ + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * A bidirectional iterator (with limited random access + * capabilities) for the zdl::DlSystem::ITensor class. + * + * This is a standard bidrectional iterator and is compatible + * with standard algorithm functions that operate on bidirectional + * access iterators (e.g., std::copy, std::fill, etc.). It uses a + * template parameter to create const and non-const iterators + * from the same code. Iterators are easiest to declare via the + * typedefs iterator and const_iterator in the ITensor class + * (e.g., zdl::DlSystem::ITensor::iterator). + * + * Note that if the tensor the iterator is traversing was + * created with nondefault (i.e., nontrivial) strides, the + * iterator will obey the strides when traversing the tensor + * data. + * + * Also note that nontrivial strides dramatically affect the + * performance of the iterator (on the order of 20x slower). + */ +template +class ZDL_EXPORT ITensorItr : public std::iterator +{ +public: + + typedef typename std::conditional::type VALUE_REF; + + ITensorItr() = delete; + virtual ~ITensorItr() {} + + ITensorItr(std::unique_ptr<::DlSystem::ITensorItrImpl> impl, + bool isTrivial = false, + float* data = nullptr) + : m_Impl(impl->clone()) + , m_IsTrivial(isTrivial) + , m_Data(data) + , m_DataStart(data) {} + + ITensorItr(const ITensorItr& itr) + : m_Impl(itr.m_Impl->clone()), + m_IsTrivial(itr.m_IsTrivial), + m_Data(itr.m_Data), + m_DataStart(itr.m_DataStart) {} + + zdl::DlSystem::ITensorItr& operator=(const ITensorItr& other) + { + if (this == &other) return *this; + m_Impl = std::move(other.m_Impl->clone()); + m_IsTrivial = other.m_IsTrivial; + m_Data = other.m_Data; + m_DataStart = other.m_DataStart; + return *this; + } + + inline zdl::DlSystem::ITensorItr& operator++() + { + if (m_IsTrivial) m_Data++; else m_Impl->increment(); + return *this; + } + inline zdl::DlSystem::ITensorItr operator++(int) + { + ITensorItr tmp(*this); + operator++(); + return tmp; + } + inline zdl::DlSystem::ITensorItr& operator--() + { + if (m_IsTrivial) m_Data--; else m_Impl->decrement(); + return *this; + } + inline zdl::DlSystem::ITensorItr operator--(int) + { + ITensorItr tmp(*this); + operator--(); + return tmp; + } + inline zdl::DlSystem::ITensorItr& operator+=(int rhs) + { + if (m_IsTrivial) m_Data += rhs; else m_Impl->increment(rhs); + return *this; + } + inline friend zdl::DlSystem::ITensorItr operator+(zdl::DlSystem::ITensorItr lhs, int rhs) + { lhs += rhs; return lhs; } + inline zdl::DlSystem::ITensorItr& operator-=(int rhs) + { + if (m_IsTrivial) m_Data -= rhs; else m_Impl->decrement(rhs); + return *this; + } + inline friend zdl::DlSystem::ITensorItr operator-(zdl::DlSystem::ITensorItr lhs, int rhs) + { lhs -= rhs; return lhs; } + + inline size_t operator-(const zdl::DlSystem::ITensorItr& rhs) + { + if (m_IsTrivial) return (m_Data - m_DataStart) - (rhs.m_Data - rhs.m_DataStart); + return m_Impl->getPosition() - rhs.m_Impl->getPosition(); + } + + inline friend bool operator<(const ITensorItr& lhs, const ITensorItr& rhs) + { + if (lhs.m_IsTrivial) return lhs.m_Data < rhs.m_Data; + return lhs.m_Impl->dataPointer() < rhs.m_Impl->dataPointer(); + } + inline friend bool operator>(const ITensorItr& lhs, const ITensorItr& rhs) + { return rhs < lhs; } + inline friend bool operator<=(const ITensorItr& lhs, const ITensorItr& rhs) + { return !(lhs > rhs); } + inline friend bool operator>=(const ITensorItr& lhs, const ITensorItr& rhs) + { return !(lhs < rhs); } + + inline bool operator==(const ITensorItr& rhs) const + { + if (m_IsTrivial) return m_Data == rhs.m_Data; + return m_Impl->dataPointer() == rhs.m_Impl->dataPointer(); + } + inline bool operator!=(const ITensorItr& rhs) const + { return !operator==(rhs); } + + inline VALUE_REF operator[](size_t idx) + { + if (m_IsTrivial) return *(m_DataStart + idx); + return m_Impl->getReferenceAt(idx); + } + inline VALUE_REF operator*() + { if (m_IsTrivial) return *m_Data; else return m_Impl->getReference(); } + inline VALUE_REF operator->() + { return *(*this); } + inline float* dataPointer() const + { if (m_IsTrivial) return m_Data; else return m_Impl->dataPointer(); } + + +protected: + std::unique_ptr<::DlSystem::ITensorItrImpl> m_Impl; + bool m_IsTrivial = false; + float* m_Data = nullptr; + float* m_DataStart = nullptr; +}; + +}} + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif diff --git a/phonelibs/snpe/include/DlSystem/ITensorItrImpl.hpp b/phonelibs/snpe/include/DlSystem/ITensorItrImpl.hpp new file mode 100644 index 00000000000000..7923c160b95b0d --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/ITensorItrImpl.hpp @@ -0,0 +1,43 @@ +//============================================================================= +// +// Copyright (c) 2015 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef _ITENSOR_ITR_IMPL_HPP_ +#define _ITENSOR_ITR_IMPL_HPP_ + +#include "ZdlExportDefine.hpp" + +#include +#include +#include + +namespace DlSystem +{ + class ITensorItrImpl; +} + +class ZDL_EXPORT DlSystem::ITensorItrImpl +{ +public: + ITensorItrImpl() {} + virtual ~ITensorItrImpl() {} + + virtual float getValue() const = 0; + virtual float& getReference() = 0; + virtual float& getReferenceAt(size_t idx) = 0; + virtual float* dataPointer() const = 0; + virtual void increment(int incVal = 1) = 0; + virtual void decrement(int decVal = 1) = 0; + virtual size_t getPosition() = 0; + virtual std::unique_ptr clone() = 0; + +private: + ITensorItrImpl& operator=(const ITensorItrImpl& other) = delete; + ITensorItrImpl(const ITensorItrImpl& other) = delete; +}; + +#endif diff --git a/phonelibs/snpe/include/DlSystem/IUDL.hpp b/phonelibs/snpe/include/DlSystem/IUDL.hpp new file mode 100644 index 00000000000000..2e9dddc48f53c4 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/IUDL.hpp @@ -0,0 +1,98 @@ +//============================================================================= +// +// Copyright (c) 2016-2017 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef _DL_SYSTEM_IUDL_HPP_ +#define _DL_SYSTEM_IUDL_HPP_ + +#include "ZdlExportDefine.hpp" + +namespace zdl { +namespace DlSystem { +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * Base class user concrete UDL implementation. + * + * All functions are marked as: + * + * - virtual + * - noexcept + * + * User should make sure no exceptions are propagated outside of + * their module. Errors can be communicated via return values. + */ +class ZDL_EXPORT IUDL { +public: + /** + * @brief . + * + * Destructor + */ + virtual ~IUDL() = default; + + /** + * @brief Sets up the user's environment. + * This is called by the SNPE framework to allow the user the + * opportunity to setup anything which is needed for running + * user defined layers. + * + * @param cookie User provided opaque data returned by the SNPE + * runtime + * + * @param insz How many elements in input size array + * @param indim Pointer to a buffer that holds input dimension + * array + * @param indimsz Input dimension size array of the buffer + * 'indim'. Corresponds to indim + * + * @param outsz How many elements in output size array + * @param outdim Pointer to a buffer that holds output + * dimension array + * @param outdimsz Output dimension size of the buffer 'oudim'. + * Corresponds to indim + * + * @return true on success, false otherwise + */ + virtual bool setup(void *cookie, + size_t insz, const size_t **indim, const size_t *indimsz, + size_t outsz, const size_t **outdim, const size_t *outdimsz) = 0; + + /** + * @brief Close the instance. Invoked by the SNPE + * framework to allow the user the opportunity to release any resources + * allocated during setup. + * + * @param cookie - User provided opaque data returned by the SNPE runtime + */ + virtual void close(void *cookie) noexcept = 0; + + /** + * @brief Execute the user defined layer + * + * @param cookie User provided opaque data returned by the SNPE + * runtime + * + * @param input Const pointer to a float buffer that contains + * the input + * + * @param output Float pointer to a buffer that would hold + * the user defined layer's output. This buffer + * is allocated and owned by SNPE runtime. + */ + virtual bool execute(void *cookie, const float **input, float **output) = 0; +}; +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +} // ns DlSystem + +} // ns zdl + +#endif // _DL_SYSTEM_IUDL_HPP_ diff --git a/phonelibs/snpe/include/DlSystem/IUserBuffer.hpp b/phonelibs/snpe/include/DlSystem/IUserBuffer.hpp new file mode 100644 index 00000000000000..70f6b33cbba1a9 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/IUserBuffer.hpp @@ -0,0 +1,289 @@ +//============================================================================== +// +// Copyright (c) 2017-2018 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef _IUSER_BUFFER_HPP +#define _IUSER_BUFFER_HPP + +#include "TensorShape.hpp" +#include "ZdlExportDefine.hpp" + +namespace zdl { +namespace DlSystem { + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + + +/** + * @brief . + * + * A base class buffer encoding type + */ +class ZDL_EXPORT UserBufferEncoding { +public: + + /** + * @brief . + * + * An enum class of all supported element types in a IUserBuffer + */ + enum class ElementType_t + { + /// Unknown element type. + UNKNOWN = 0, + + /// Each element is presented by float. + FLOAT = 1, + + /// Each element is presented by an unsigned int. + UNSIGNED8BIT = 2, + + /// Each element is presented by an 8-bit quantized value. + TF8 = 10 + }; + + /** + * @brief Retrieves the size of the element, in bytes. + * + * @return Size of the element, in bytes. + */ + virtual size_t getElementSize() const noexcept = 0; + + /** + * @brief Retrieves the element type + * + * @return Element type + */ + ElementType_t getElementType() const noexcept {return m_ElementType;}; + + virtual ~UserBufferEncoding() {} + +protected: + UserBufferEncoding(ElementType_t elementType) : m_ElementType(elementType) {}; +private: + const ElementType_t m_ElementType; +}; + +/** + * @brief . + * + * A base class buffer source type + * + * @note User buffer from CPU support all kinds of runtimes; + * User buffer from GLBUFFER support only GPU runtime. + */ +class ZDL_EXPORT UserBufferSource { +public: + enum class SourceType_t + { + /// Unknown buffer source type. + UNKNOWN = 0, + + /// The network inputs are from CPU buffer. + CPU = 1, + + /// The network inputs are from OpenGL buffer. + GLBUFFER = 2 + }; + + /** + * @brief Retrieves the source type + * + * @return Source type + */ + SourceType_t getSourceType() const noexcept {return m_SourceType;}; + +protected: + UserBufferSource(SourceType_t sourceType): m_SourceType(sourceType) {}; +private: + const SourceType_t m_SourceType; +}; + +/** + * @brief . + * + * An source type where input data is delivered from OpenGL buffer + */ +class ZDL_EXPORT UserBufferSourceGLBuffer : public UserBufferSource{ +public: + UserBufferSourceGLBuffer() : UserBufferSource(SourceType_t::GLBUFFER) {}; +}; + +/** + * @brief . + * + * An encoding type where each element is represented by an unsigned int + */ +class ZDL_EXPORT UserBufferEncodingUnsigned8Bit : public UserBufferEncoding { +public: + UserBufferEncodingUnsigned8Bit() : UserBufferEncoding(ElementType_t::UNSIGNED8BIT) {}; + size_t getElementSize() const noexcept override; + +protected: + UserBufferEncodingUnsigned8Bit(ElementType_t elementType) : UserBufferEncoding(elementType) {}; + +}; + +/** + * @brief . + * + * An encoding type where each element is represented by a float + */ +class ZDL_EXPORT UserBufferEncodingFloat : public UserBufferEncoding { +public: + UserBufferEncodingFloat() : UserBufferEncoding(ElementType_t::FLOAT) {}; + size_t getElementSize() const noexcept override; + +}; + +/** + * @brief . + * + * An encoding type where each element is represented by tf8, which is an + * 8-bit quantizd value, which has an exact representation of 0.0 + */ +class ZDL_EXPORT UserBufferEncodingTf8 : public UserBufferEncodingUnsigned8Bit { +public: + UserBufferEncodingTf8() = delete; + UserBufferEncodingTf8(unsigned char stepFor0, float stepSize) : + UserBufferEncodingUnsigned8Bit(ElementType_t::TF8), + m_StepExactly0(stepFor0), + m_QuantizedStepSize(stepSize) {}; + + /** + * @brief Sets the step value that represents 0 + * + * @param[in] stepExactly0 The step value that represents 0 + * + */ + void setStepExactly0(const unsigned char stepExactly0) { + m_StepExactly0 = stepExactly0; + } + + /** + * @brief Sets the float value that each step represents + * + * @param[in] quantizedStepSize The float value of each step size + * + */ + void setQuantizedStepSize(const float quantizedStepSize) { + m_QuantizedStepSize = quantizedStepSize; + } + + /** + * @brief Retrieves the step that represents 0.0 + * + * @return Step value + */ + unsigned char getStepExactly0() const { + return m_StepExactly0; + } + + /** + * Calculates the minimum floating point value that + * can be represented with this encoding. + * + * @return Minimum representable floating point value + */ + float getMin() const { + return m_QuantizedStepSize * (0 - m_StepExactly0); + } + + /** + * Calculates the maximum floating point value that + * can be represented with this encoding. + * + * @return Maximum representable floating point value + */ + float getMax() const { + return m_QuantizedStepSize * (255 - m_StepExactly0); + } + + /** + * @brief Retrieves the step size + * + * @return Step size + */ + float getQuantizedStepSize() const { + return m_QuantizedStepSize; + } + +private: + unsigned char m_StepExactly0; + + float m_QuantizedStepSize; +}; + +/** + * @brief UserBuffer contains a pointer and info on how to walk it and interpret its content. + */ +class ZDL_EXPORT IUserBuffer { +public: + virtual ~IUserBuffer() = default; + + /** + * @brief Retrieves the total number of bytes between elements in each dimension if + * the buffer were to be interpreted as a multi-dimensional array. + * + * @return Number of bytes between elements in each dimension. + * e.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would + * return strides of [24, 8, 4]. + */ + virtual const TensorShape& getStrides() const = 0; + + /** + * @brief Retrieves the size of the buffer, in bytes. + * + * @return Size of the underlying buffer, in bytes. + */ + virtual size_t getSize() const = 0; + + /** + * @brief Changes the underlying memory that backs the UserBuffer. + * + * This can be used to avoid creating multiple UserBuffer objects + * when the only thing that differs is the memory location. + * + * @param[in] buffer Pointer to the memory location + * + * @return Whether the set succeeds. + */ + virtual bool setBufferAddress(void *buffer) noexcept = 0; + + /** + * @brief Gets a const reference to the data encoding object of + * the underlying buffer + * + * This is necessary when the UserBuffer is filled by SNPE with + * data types such as TF8, where the caller needs to know the quantization + * parameters in order to interpret the data properly + * + * @return A read-only encoding object + */ + virtual const UserBufferEncoding& getEncoding() const noexcept = 0; + + /** + * @brief Gets a reference to the data encoding object of + * the underlying buffer + * + * This is necessary when the UserBuffer is re-used, and the encoding + * parameters can change. For example, each input can be quantized with + * different step sizes. + * + * @return Data encoding meta-data + */ + virtual UserBufferEncoding& getEncoding() noexcept = 0; + +}; + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +} +} + +#endif diff --git a/phonelibs/snpe/include/DlSystem/IUserBufferFactory.hpp b/phonelibs/snpe/include/DlSystem/IUserBufferFactory.hpp new file mode 100644 index 00000000000000..59803fbd8f8772 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/IUserBufferFactory.hpp @@ -0,0 +1,81 @@ +//============================================================================= +// +// Copyright (c) 2017 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef _IUSERBUFFER_FACTORY_HPP +#define _IUSERBUFFER_FACTORY_HPP + +#include "IUserBuffer.hpp" +#include "TensorShape.hpp" +#include "ZdlExportDefine.hpp" +#include "DlEnums.hpp" +namespace zdl { + namespace DlSystem { + class IUserBuffer; + + class TensorShape; + } +} + +namespace zdl { +namespace DlSystem { + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** +* Factory interface class to create IUserBuffer objects. +*/ +class ZDL_EXPORT IUserBufferFactory { +public: + virtual ~IUserBufferFactory() = default; + + /** + * @brief Creates a UserBuffer + * + * @param[in] buffer Pointer to the buffer that the caller supplies + * + * @param[in] bufSize Buffer size, in bytes + * + * @param[in] strides Total number of bytes between elements in each dimension. + * E.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would have strides of [24, 8, 4]. + * + * @param[in] userBufferEncoding Reference to an UserBufferEncoding object + * + * @note Caller has to ensure that memory pointed to by buffer stays accessible + * for the lifetime of the object created + */ + virtual std::unique_ptr + createUserBuffer(void *buffer, size_t bufSize, const zdl::DlSystem::TensorShape &strides, zdl::DlSystem::UserBufferEncoding* userBufferEncoding) noexcept = 0; + + /** + * @brief Creates a UserBuffer + * + * @param[in] buffer Pointer to the buffer that the caller supplies + * + * @param[in] bufSize Buffer size, in bytes + * + * @param[in] strides Total number of bytes between elements in each dimension. + * E.g. A tightly packed tensor of floats with dimensions [4, 3, 2] would have strides of [24, 8, 4]. + * + * @param[in] userBufferEncoding Reference to an UserBufferEncoding object + * + * @param[in] userBufferSource Reference to an UserBufferSource object + * + * @note Caller has to ensure that memory pointed to by buffer stays accessible + * for the lifetime of the object created + */ + virtual std::unique_ptr + createUserBuffer(void *buffer, size_t bufSize, const zdl::DlSystem::TensorShape &strides, zdl::DlSystem::UserBufferEncoding* userBufferEncoding, zdl::DlSystem::UserBufferSource* userBufferSource) noexcept = 0; +}; +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +} +} + + +#endif diff --git a/phonelibs/snpe/include/DlSystem/PlatformConfig.hpp b/phonelibs/snpe/include/DlSystem/PlatformConfig.hpp new file mode 100644 index 00000000000000..df452dc46970bf --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/PlatformConfig.hpp @@ -0,0 +1,168 @@ +//============================================================================= +// +// Copyright (c) 2017-2018 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef _DL_SYSTEM_PLATFORM_CONFIG_HPP_ +#define _DL_SYSTEM_PLATFORM_CONFIG_HPP_ + +#include "DlSystem/ZdlExportDefine.hpp" + +namespace zdl{ +namespace DlSystem +{ + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + + +/** + * @brief . + * + * A structure OpenGL configuration + * + * @note When certain OpenGL context and display are provided to UserGLConfig for using + * GPU buffer as input directly, the user MUST ensure the particular OpenGL + * context and display remain vaild throughout the execution of neural network models. + */ +struct ZDL_EXPORT UserGLConfig +{ + /// Holds user EGL context. + /// + void* userGLContext = nullptr; + + /// Holds user EGL display. + void* userGLDisplay = nullptr; +}; + +/** + * @brief . + * + * A structure Gpu configuration + */ +struct ZDL_EXPORT UserGpuConfig{ + /// Holds user OpenGL configuration. + /// + UserGLConfig userGLConfig; +}; + +/** + * @brief . + * + * A class user platform configuration + */ +class ZDL_EXPORT PlatformConfig +{ +public: + + /** + * @brief . + * + * An enum class of all supported platform types + */ + enum class PlatformType_t + { + /// Unknown platform type. + UNKNOWN = 0, + + /// Snapdragon CPU. + CPU = 1, + + /// Adreno GPU. + GPU = 2, + + /// Hexagon DSP. + DSP = 3 + }; + + /** + * @brief . + * + * A union class user platform configuration information + */ + union PlatformConfigInfo + { + /// Holds user GPU Configuration. + /// + UserGpuConfig userGpuConfig; + + PlatformConfigInfo(){}; + }; + + PlatformConfig() : m_PlatformType(PlatformType_t::UNKNOWN) {}; + + /** + * @brief Retrieves the platform type + * + * @return Platform type + */ + PlatformType_t getPlatformType() const {return m_PlatformType;}; + + /** + * @brief Indicates whther the plaform configuration is valid. + * + * @return True if the platform configuration is valid; false otherwise. + */ + bool isValid() const {return (PlatformType_t::UNKNOWN != m_PlatformType);}; + + /** + * @brief Retrieves the Gpu configuration + * + * @param[out] userGpuConfig The passed in userGpuConfig populated with the Gpu configuration on return. + * + * @return True if Gpu configuration was retrieved; false otherwise. + */ + bool getUserGpuConfig(UserGpuConfig& userGpuConfig) const + { + if(m_PlatformType == PlatformType_t::GPU) + { + userGpuConfig = m_PlatformConfigInfo.userGpuConfig; + return true; + } + else + { + return false; + } + } + + /** + * @brief Sets the Gpu configuration + * + * @param[in] userGpuConfig Gpu Configuration + * + * @return True if Gpu configuration was successfully set; false otherwise. + */ + bool setUserGpuConfig(UserGpuConfig& userGpuConfig) + { + if((userGpuConfig.userGLConfig.userGLContext != nullptr) && (userGpuConfig.userGLConfig.userGLDisplay != nullptr)) + { + switch (m_PlatformType) + { + case PlatformType_t::GPU: + m_PlatformConfigInfo.userGpuConfig = userGpuConfig; + return true; + case PlatformType_t::UNKNOWN: + m_PlatformType = PlatformType_t::GPU; + m_PlatformConfigInfo.userGpuConfig = userGpuConfig; + return true; + default: + return false; + } + } + else + return false; + } + +private: + PlatformType_t m_PlatformType; + PlatformConfigInfo m_PlatformConfigInfo; +}; + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +}} //namespace end + +#endif diff --git a/phonelibs/snpe/include/DlSystem/String.hpp b/phonelibs/snpe/include/DlSystem/String.hpp new file mode 100644 index 00000000000000..97b07726c72bc7 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/String.hpp @@ -0,0 +1,108 @@ +//============================================================================= +// +// Copyright (c) 2017 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef PLATFORM_STANDARD_STRING_HPP +#define PLATFORM_STANDARD_STRING_HPP + +#include +#include +#include + +#ifndef ZDL_EXPORT +#define ZDL_EXPORT __attribute__((visibility("default"))) +#endif + +namespace zdl +{ +namespace DlSystem +{ +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * Class for wrapping char * as a really stripped down std::string replacement. + */ +class ZDL_EXPORT String final +{ +public: + String() = delete; + + /** + * Construct a string from std::string reference. + * @param str Reference to a std::string + */ + explicit String(const std::string& str); + + /** + * Construct a string from char* reference. + * @param a char* + */ + explicit String(const char* str); + + /** + * move constructor. + */ + String(String&& other) noexcept; + + /** + * copy constructor. + */ + String(const String& other) = delete; + + /** + * assignment operator. + */ + String& operator=(const String&) = delete; + + /** + * move assignment operator. + */ + String& operator=(String&&) = delete; + + /** + * class comparators + */ + bool operator<(const String& rhs) const noexcept; + bool operator>(const String& rhs) const noexcept; + bool operator<=(const String& rhs) const noexcept; + bool operator>=(const String& rhs) const noexcept; + bool operator==(const String& rhs) const noexcept; + bool operator!=(const String& rhs) const noexcept; + + /** + * class comparators against std::string + */ + bool operator<(const std::string& rhs) const noexcept; + bool operator>(const std::string& rhs) const noexcept; + bool operator<=(const std::string& rhs) const noexcept; + bool operator>=(const std::string& rhs) const noexcept; + bool operator==(const std::string& rhs) const noexcept; + bool operator!=(const std::string& rhs) const noexcept; + + const char* c_str() const noexcept; + + ~String(); +private: + + char* m_string; +}; + +/** + * overloaded << operator + */ +ZDL_EXPORT std::ostream& operator<<(std::ostream& os, const String& str) noexcept; + +} // DlSystem namespace +} // zdl namespace + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif // PLATFORM_STANDARD_STRING_HPP + diff --git a/phonelibs/snpe/include/DlSystem/StringList.hpp b/phonelibs/snpe/include/DlSystem/StringList.hpp new file mode 100644 index 00000000000000..a9a7d5ed89674c --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/StringList.hpp @@ -0,0 +1,107 @@ +//============================================================================= +// +// Copyright (c) 2016 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= +#include +#include "ZdlExportDefine.hpp" + +#ifndef DL_SYSTEM_STRINGLIST_HPP +#define DL_SYSTEM_STRINGLIST_HPP + +namespace zdl +{ +namespace DlSystem +{ +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * Class for holding an order list of null-terminated ASCII strings. + */ +class ZDL_EXPORT StringList final +{ +public: + StringList() {} + + /** + * Construct a string list with some pre-allocated memory. + * @warning Contents of the list will be uninitialized + * @param[in] length Number of elements for which to pre-allocate space. + */ + explicit StringList(size_t length); + + /** + * Append a string to the list. + * @param[in] str Null-terminated ASCII string to append to the list. + */ + void append(const char* str); + + /** + * Returns the string at the indicated position, + * or an empty string if the positions is greater than the size + * of the list. + * @param[in] idx Position in the list of the desired string + */ + const char* at(size_t idx) const noexcept; + + /** + * Pointer to the first string in the list. + * Can be used to iterate through the list. + */ + const char** begin() const noexcept; + + /** + * Pointer to one after the last string in the list. + * Can be used to iterate through the list. + */ + const char** end() const noexcept; + + /** + * Return the number of valid string pointers held by this list. + */ + size_t size() const noexcept; + + + /** + * assignment operator. + */ + StringList& operator=(const StringList&) noexcept; + + /** + * copy constructor. + * @param[in] other object to copy. + */ + StringList(const StringList& other); + + /** + * move constructor. + * @param[in] other object to move. + */ + StringList(StringList&& other) noexcept; + + ~StringList(); +private: + void copy(const StringList& other); + + void resize(size_t length); + + void clear(); + + static const char* s_Empty; + const char** m_Strings = nullptr; + const char** m_End = nullptr; + size_t m_Size = 0; +}; + +} // DlSystem namespace +} // zdl namespace + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif // DL_SYSTEM_STRINGLIST_HPP + diff --git a/phonelibs/snpe/include/DlSystem/TensorMap.hpp b/phonelibs/snpe/include/DlSystem/TensorMap.hpp new file mode 100644 index 00000000000000..feecec666729ad --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/TensorMap.hpp @@ -0,0 +1,120 @@ +//============================================================================= +// +// Copyright (c) 2016 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= +#include +#include "ZdlExportDefine.hpp" +#include "ITensor.hpp" +#include "StringList.hpp" + +#ifndef DL_SYSTEM_TENSOR_MAP_HPP +#define DL_SYSTEM_TENSOR_MAP_HPP + +namespace DlSystem +{ + // Forward declaration of tensor map implementation. + class TensorMapImpl; +} + +namespace zdl +{ +namespace DlSystem +{ + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * A class representing the map of tensor. + */ +class ZDL_EXPORT TensorMap final +{ +public: + + /** + * @brief . + * + * Creates a new empty tensor map + */ + TensorMap(); + + /** + * copy constructor. + * @param[in] other object to copy. + */ + TensorMap(const TensorMap& other); + + /** + * assignment operator. + */ + TensorMap& operator=(const TensorMap& other); + + /** + * @brief Adds a name and the corresponding tensor pointer + * to the map + * + * @param[in] name The name of the tensor + * @param[out] tensor The pointer to the tensor + * + * @note If a tensor with the same name already exists, the + * tensor is replaced with the existing tensor. + */ + void add(const char *name, zdl::DlSystem::ITensor *tensor); + + /** + * @brief Removes a mapping of tensor and its name by its name + * + * @param[in] name The name of tensor to be removed + * + * @note If no tensor with the specified name is found, nothing + * is done. + */ + void remove(const char *name) noexcept; + + /** + * @brief Returns the number of tensors in the map + */ + size_t size() const noexcept; + + /** + * @brief . + * + * Removes all tensors from the map + */ + void clear() noexcept; + + /** + * @brief Returns the tensor given its name. + * + * @param[in] name The name of the tensor to get. + * + * @return nullptr if no tensor with the specified name is + * found; otherwise, a valid pointer to the tensor. + */ + zdl::DlSystem::ITensor* getTensor(const char *name) const noexcept; + + /** + * @brief . + * + * Returns the names of all tensors + */ + zdl::DlSystem::StringList getTensorNames() const; + + ~TensorMap(); +private: + void swap(const TensorMap &other); + std::unique_ptr<::DlSystem::TensorMapImpl> m_TensorMapImpl; +}; + +} // DlSystem namespace +} // zdl namespace + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif // DL_SYSTEM_TENSOR_MAP_HPP + diff --git a/phonelibs/snpe/include/DlSystem/TensorShape.hpp b/phonelibs/snpe/include/DlSystem/TensorShape.hpp new file mode 100644 index 00000000000000..99583dccb40bac --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/TensorShape.hpp @@ -0,0 +1,203 @@ +//============================================================================= +// +// Copyright (c) 2016 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= +#include +#include +#include +#include +#include "ZdlExportDefine.hpp" + +#ifndef DL_SYSTEM_TENSOR_SHAPE_HPP +#define DL_SYSTEM_TENSOR_SHAPE_HPP + +namespace DlSystem +{ + // Forward declaration of tensor shape implementation. + class TensorShapeImpl; +} + +namespace zdl +{ +namespace DlSystem +{ + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * Convenient typedef to represent dimension + */ +using Dimension = size_t; + +/** + * @brief . + * + * A class representing the shape of tensor. It is used at the + * time of creation of tensor. + */ +class ZDL_EXPORT TensorShape final +{ +public: + + /** + * @brief . + * + * Creates a new shape with a list of dims specified in + * initializer list fashion. + * + * @param[in] dims The dimensions are specified in which the last + * element of the vector represents the fastest varying + * dimension and the zeroth element represents the slowest + * varying, etc. + * + */ + TensorShape(std::initializer_list dims); + + /** + * @brief . + * + * Creates a new shape with a list of dims specified in array + * + * @param[in] dims The dimensions are specified in which the last + * element of the vector represents the fastest varying + * dimension and the zeroth element represents the slowest + * varying, etc. + * + * @param[in] size Size of the array. + * + */ + TensorShape(const Dimension *dims, size_t size); + + /** + * @brief . + * + * Creates a new shape with a vector of dims specified in + * vector fashion. + * + * @param[in] dims The dimensions are specified in which the last + * element of the vector represents the fastest varying + * dimension and the zeroth element represents the slowest + * varying, etc. + * + */ + TensorShape(std::vector dims); + + /** + * @brief . + * + * copy constructor. + * @param[in] other object to copy. + */ + TensorShape(const TensorShape& other); + + /** + * @brief . + * + * assignment operator. + */ + TensorShape& operator=(const TensorShape& other); + + /** + * @brief . + * + * Creates a new shape with no dims. It can be extended later + * by invoking concatenate. + */ + TensorShape(); + + /** + * @brief . + * + * Concatenates additional dimensions specified in + * initializer list fashion to the existing dimensions. + * + * @param[in] dims The dimensions are specified in which the last + * element of the vector represents the fastest varying + * dimension and the zeroth element represents the slowest + * varying, etc. + * + */ + void concatenate(std::initializer_list dims); + + /** + * @brief . + * + * Concatenates additional dimensions specified in + * the array to the existing dimensions. + * + * @param[in] dims The dimensions are specified in which the last + * element of the vector represents the fastest varying + * dimension and the zeroth element represents the slowest + * varying, etc. + * + * @param[in] size Size of the array. + * + */ + void concatenate(const Dimension *dims, size_t size); + + /** + * @brief . + * + * Concatenates an additional dimension to the existing + * dimensions. + * + * @param[in] dim The dimensions are specified in which the last element + * of the vector represents the fastest varying dimension and the + * zeroth element represents the slowest varying, etc. + * + */ + void concatenate(const Dimension &dim); + + /** + * @brief . + * + * Retrieves a single dimension, based on its index. + * + * @return The value of dimension + * + * @throws std::out_of_range if the index is >= the number of + * dimensions (or rank). + */ + Dimension& operator[](size_t index); + Dimension& operator[](size_t index) const; + + /** + * @brief . + * + * Retrieves the rank i.e. number of dimensions. + * + * @return The rank + */ + size_t rank() const; + + /** + * @brief . + * + * Retrieves a pointer to the first dimension of shape + * + * @return nullptr if no dimension exists; otherwise, points to + * the first dimension. + * + */ + const Dimension* getDimensions() const; + + ~TensorShape(); + +private: + void swap(const TensorShape &other); + std::unique_ptr<::DlSystem::TensorShapeImpl> m_TensorShapeImpl; +}; + +} // DlSystem namespace +} // zdl namespace + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif // DL_SYSTEM_TENSOR_SHAPE_HPP + diff --git a/phonelibs/snpe/include/DlSystem/TensorShapeMap.hpp b/phonelibs/snpe/include/DlSystem/TensorShapeMap.hpp new file mode 100644 index 00000000000000..00dc41a113160d --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/TensorShapeMap.hpp @@ -0,0 +1,128 @@ +//============================================================================= +// +// Copyright (c) 2017 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= +#include +#include +#include +#include +#include "ZdlExportDefine.hpp" +#include "DlSystem/TensorShape.hpp" +#include "DlSystem/StringList.hpp" + +#ifndef DL_SYSTEM_TENSOR_SHAPE_MAP_HPP +#define DL_SYSTEM_TENSOR_SHAPE_MAP_HPP + +namespace DlSystem +{ + // Forward declaration of tensor shape map implementation. + class TensorShapeMapImpl; +} + +namespace zdl +{ +namespace DlSystem +{ + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * A class representing the map of names and tensorshapes. + */ +class ZDL_EXPORT TensorShapeMap final +{ +public: + + /** + * @brief . + * + * Creates a new tensor shape map + * + */ + TensorShapeMap(); + + /** + * @brief . + * + * copy constructor. + * @param[in] other object to copy. + */ + TensorShapeMap(const TensorShapeMap& other); + + /** + * @brief . + * + * assignment operator. + */ + TensorShapeMap& operator=(const TensorShapeMap& other); + + /** + * @brief Adds a name and the corresponding tensor pointer + * to the map + * + * @param[in] name The name of the tensor + * @param[out] tensor The pointer to the tensor + * + * @note If a tensor with the same name already exists, no new + * tensor is added. + */ + void add(const char *name, const zdl::DlSystem::TensorShape& tensorShape); + + /** + * @brief Removes a mapping of tensor and its name by its name + * + * @param[in] name The name of tensor to be removed + * + * @note If no tensor with the specified name is found, nothing + * is done. + */ + void remove(const char *name) noexcept; + + /** + * @brief Returns the number of tensors in the map + */ + size_t size() const noexcept; + + /** + * @brief . + * + * Removes all tensors from the map + */ + void clear() noexcept; + + /** + * @brief Returns the tensor given its name. + * + * @param[in] name The name of the tensor to get. + * + * @return nullptr if no tensor with the specified name is + * found; otherwise, a valid pointer to the tensor. + */ + zdl::DlSystem::TensorShape getTensorShape(const char *name) const noexcept; + + /** + * @brief . + * + * Returns the names of all tensor shapes + */ + zdl::DlSystem::StringList getTensorShapeNames() const; + + ~TensorShapeMap(); +private: + void swap(const TensorShapeMap &other); + std::unique_ptr<::DlSystem::TensorShapeMapImpl> m_TensorShapeMapImpl; +}; + +} // DlSystem namespace +} // zdl namespace + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +#endif // DL_SYSTEM_TENSOR_SHAPE_MAP_HPP + diff --git a/phonelibs/snpe/include/DlSystem/UDLContext.hpp b/phonelibs/snpe/include/DlSystem/UDLContext.hpp new file mode 100644 index 00000000000000..6b7c07d3ebf182 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/UDLContext.hpp @@ -0,0 +1,244 @@ +//============================================================================== +// +// Copyright (c) 2016 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef UDL_CONTEXT_HPP +#define UDL_CONTEXT_HPP + +#include // memset +#include + +#include "ZdlExportDefine.hpp" + +namespace zdl { namespace DlSystem { +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * UDLContext holds the user defined layer context which + * consists of a layer name, layer ID, blob and blob size. + * + * An instance of UDLContext is passed as an argument to the + * UDLFactoryFunc provided by the user every time the SNPE + * runtime encounters an unknown layer descriptor. The instance + * of a UDLContext is created by the SNPE runtime and is + * consumed by the user's factory function. The user should + * obtain a copy of this class and should not assume any + * prolonged object lifetime beyond the UDLFactoryFunction. + */ +class ZDL_EXPORT UDLContext final { +public: + /** + * @brief Constructor + * + * @param[in] name name of the layer + * + * @param[in] type layer type + * + * @param[in] id identifier for the layer + * + * @param[in] id Blob/bytes as packed by the user code as part of + * the Python converter script + */ + UDLContext(const std::string& name, + const std::string& type, + int32_t id, + const std::string& blob) : + m_Name(name), m_Type(type), m_Size(blob.size()), m_Id(id) { + // FIXME not dealing with alloc error + m_Buffer = new uint8_t[m_Size]; + std::memcpy(m_Buffer, blob.data(), m_Size); + } + + /** + * @brief . + * + * Empty constructor is useful for + * creating an empty UDLContext and then run copy constructor + * from a fully initialized one. + */ + explicit UDLContext() {} + + /** + * @brief . + * + * destructor Deallocates any internal allocated memory + */ + ~UDLContext() { release(); } + + /** + * @brief . + * + * Deallocate any internally allocated memory + */ + void release() { + if (m_Buffer && m_Size) + std::memset(m_Buffer, 0, m_Size); + delete []m_Buffer; + m_Buffer = nullptr; + m_Size = 0; + } + + /** + * @brief . + * + * Copy Constructor - makes a copy from ctx + * + * @param[in] ctx Source UDLContext to copy from + */ + UDLContext(const UDLContext& ctx) : m_Name(ctx.m_Name), + m_Type(ctx.m_Type), + m_Id(ctx.m_Id) { + std::tuple cpy = ctx.getCopy(); + // current compiler does not support get + m_Buffer = std::get<0>(cpy); + m_Size = std::get<1>(cpy); + } + + /** + * @brief + * + * Assignment operator - makes a copy from ctx + * + * @param[in] ctx Source UDLContext to copy from + * + * @return this + */ + UDLContext& operator=(const UDLContext& ctx) { + UDLContext c (ctx); + this->swap(c); // non throwing swap + return *this; + } + + /** + * @brief . + * + * Move Constructor - Move internals from ctx into this + * + * @param[in] ctx Source UDLContext to move from + */ + UDLContext(UDLContext&& ctx) : + m_Name(std::move(ctx.m_Name)), + m_Type(std::move(ctx.m_Type)), + m_Buffer(ctx.m_Buffer), + m_Size(ctx.m_Size), + m_Id(ctx.m_Id) { + ctx.clear(); + } + + /** + * @brief . + * + * Assignment move - Move assignment operator from ctx + * + * @param[in] ctx Source UDLContext to move from + * + * @return this + */ + UDLContext& operator=(UDLContext&& ctx) { + m_Name = std::move(ctx.m_Name); + m_Type = std::move(ctx.m_Type); + m_Buffer = ctx.m_Buffer; + m_Size = ctx.m_Size; + m_Id = ctx.m_Id; + ctx.clear(); + return *this; + } + + /** + * @brief . + * + * Obtain the name of the layer + * + * @return const reference to the name of the layer + */ + const std::string& getName() const noexcept { return m_Name; } + + /** + * @brief . + * + * Obtain the type of the layer + * + * @return const reference to the type of the layer + */ + const std::string& getType() const noexcept { return m_Type; } + + /** + * @brief . + * + * Obtain the Id of the layer + * + * @return The id of the layer + */ + int32_t getId() const noexcept { return m_Id; } + + /** + * @brief . + * + * Obtain the size of the blob + * + * @return Size of the internal blob + */ + size_t getSize() const noexcept { return m_Size; } + + /** + * @brief . + * + * Get a const pointer to the internal blob + * + * @return Const pointer to the internal blob + */ + const uint8_t* getBlob() const noexcept { return m_Buffer; } + + /** + * @brief . + * + * Get a copy of the blob/size into a tuple + * + * @return A tuple with a pointer to a copy of the blob and a + * size + */ + std::tuple getCopy() const { + uint8_t* buf = new uint8_t[m_Size]; + // FIXME missing memcpy + std::memcpy(buf, m_Buffer, m_Size); + return std::make_tuple(buf, m_Size); + } + + /** + * @brief . + * + * Set zeros in the internals members + */ + void clear() { + m_Name.clear(); + m_Type.clear(); + m_Buffer = 0; + m_Size = 0; + m_Id = -1; + } +private: + void swap(UDLContext& c) noexcept { + std::swap(m_Name, c.m_Name); + std::swap(m_Type, c.m_Type); + std::swap(m_Id, c.m_Id); + std::swap(m_Buffer, c.m_Buffer); + std::swap(m_Size, c.m_Size); + } + std::string m_Name; // name of the layer instance + std::string m_Type; // The actual layer type + uint8_t* m_Buffer = nullptr; + size_t m_Size = 0; + int32_t m_Id = -1; +}; +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +}} + +#endif /* UDL_CONTEXT_HPP */ diff --git a/phonelibs/snpe/include/DlSystem/UDLFunc.hpp b/phonelibs/snpe/include/DlSystem/UDLFunc.hpp new file mode 100644 index 00000000000000..633ce985bf006b --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/UDLFunc.hpp @@ -0,0 +1,84 @@ +//============================================================================== +// +// Copyright (c) 2015 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef _UDL_FUNC_HPP_ +#define _UDL_FUNC_HPP_ + +#include + +#include "ZdlExportDefine.hpp" +#include + +namespace zdl { + namespace DlSystem { + class UDLContext; + } +} + +namespace zdl { namespace DlSystem { +/** @addtogroup c_plus_plus_apis C++ +@{ */ +/** + * @brief . + * + * Definition of UDLFactoyFunc, using/typedef and default FactoryFunction + * UDLBundle - a simple way to bundle func and cookie into one type + */ + + +/** + * @brief . + * + * Convenient typedef for user defined layer creation factory + * + * @param[out] void* Cookie - a user opaque data that was passed during SNPE's runtime's + * CreateInstance. SNPE's runtime is passing this back to the user. + * + * @param[out] DlSystem::UDLContext* - The specific Layer Description context what is passe + * SNPE runtime. + * + * @return IUDL* - a Concrete instance of IUDL derivative + */ +using UDLFactoryFunc = std::function; + +/** + * @brief . + * + * default UDL factory implementation + * + * @param[out] DlSystem::UDLContext* - The specific Layer Description context what is passe + * SNPE runtime. + * + * @param[out] void* Cookie - a user opaque data that was passed during SNPE's runtime's + * CreateInstance. SNPE's runtime is passing this back to the user. + * + * @return IUDL* - nullptr to indicate SNPE's runtime that there is no specific + * implementation for UDL. When SNPE's runtime sees nullptr as a return + * value from the factory, it will halt execution if model has an unknown layer + * + */ +inline ZDL_EXPORT zdl::DlSystem::IUDL* DefaultUDLFunc(void*, const zdl::DlSystem::UDLContext*) { return nullptr; } + +/** + * @brief . + * + * Simple struct to bundle 2 elements. + * A user defined cookie that would be returned for each + * IUDL call. The user can place anything there and the + * SNPE runtime will provide it back + */ +struct ZDL_EXPORT UDLBundle { + void *cookie = nullptr; + UDLFactoryFunc func = DefaultUDLFunc; +}; + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ +}} + + +#endif // _UDL_FUNC_HPP_ diff --git a/phonelibs/snpe/include/DlSystem/UserBufferMap.hpp b/phonelibs/snpe/include/DlSystem/UserBufferMap.hpp new file mode 100644 index 00000000000000..a03ddfe1d11ad8 --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/UserBufferMap.hpp @@ -0,0 +1,122 @@ +//============================================================================= +// +// Copyright (c) 2017 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= +#include +#include "ZdlExportDefine.hpp" +#include "StringList.hpp" + +#ifndef DL_SYSTEM_USER_BUFFER_MAP_HPP +#define DL_SYSTEM_USER_BUFFER_MAP_HPP + +namespace DlSystem +{ + // Forward declaration of UserBuffer map implementation. + class UserBufferMapImpl; +} + +namespace zdl +{ +namespace DlSystem +{ +class IUserBuffer; + +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * A class representing the map of UserBuffer. + */ +class ZDL_EXPORT UserBufferMap final +{ +public: + + /** + * @brief . + * + * Creates a new empty UserBuffer map + */ + UserBufferMap(); + + /** + * copy constructor. + * @param[in] other object to copy. + */ + UserBufferMap(const UserBufferMap& other); + + /** + * assignment operator. + */ + UserBufferMap& operator=(const UserBufferMap& other); + + /** + * @brief Adds a name and the corresponding UserBuffer pointer + * to the map + * + * @param[in] name The name of the UserBuffer + * @param[in] userBuffer The pointer to the UserBuffer + * + * @note If a UserBuffer with the same name already exists, the new + * UserBuffer pointer would be updated. + */ + void add(const char *name, zdl::DlSystem::IUserBuffer *buffer); + + /** + * @brief Removes a mapping of one UserBuffer and its name by its name + * + * @param[in] name The name of UserBuffer to be removed + * + * @note If no UserBuffer with the specified name is found, nothing + * is done. + */ + void remove(const char *name) noexcept; + + /** + * @brief Returns the number of UserBuffers in the map + */ + size_t size() const noexcept; + + /** + * @brief . + * + * Removes all UserBuffers from the map + */ + void clear() noexcept; + + /** + * @brief Returns the UserBuffer given its name. + * + * @param[in] name The name of the UserBuffer to get. + * + * @return nullptr if no UserBuffer with the specified name is + * found; otherwise, a valid pointer to the UserBuffer. + */ + zdl::DlSystem::IUserBuffer* getUserBuffer(const char *name) const noexcept; + + /** + * @brief . + * + * Returns the names of all UserBuffers + * + * @return A list of UserBuffer names. + */ + zdl::DlSystem::StringList getUserBufferNames() const; + + ~UserBufferMap(); +private: + void swap(const UserBufferMap &other); + std::unique_ptr<::DlSystem::UserBufferMapImpl> m_UserBufferMapImpl; +}; +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +} // DlSystem namespace +} // zdl namespace + + +#endif // DL_SYSTEM_TENSOR_MAP_HPP + diff --git a/phonelibs/snpe/include/DlSystem/ZdlExportDefine.hpp b/phonelibs/snpe/include/DlSystem/ZdlExportDefine.hpp new file mode 100644 index 00000000000000..dd0704dd8c996d --- /dev/null +++ b/phonelibs/snpe/include/DlSystem/ZdlExportDefine.hpp @@ -0,0 +1,16 @@ +//============================================================================= +// +// Copyright (c) 2015 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================= + +#ifndef _ZDL_EXPORT_DEFINE_HPP_ +#define _ZDL_EXPORT_DEFINE_HPP_ + +#ifndef ZDL_EXPORT +#define ZDL_EXPORT __attribute__((visibility("default"))) +#endif + +#endif diff --git a/phonelibs/snpe/include/SNPE/SNPE.hpp b/phonelibs/snpe/include/SNPE/SNPE.hpp new file mode 100644 index 00000000000000..ba84265b9663f8 --- /dev/null +++ b/phonelibs/snpe/include/SNPE/SNPE.hpp @@ -0,0 +1,239 @@ +//============================================================================== +// +// Copyright (c) 2015-2017 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef _SNPE_SNPE_HPP_ +#define _SNPE_SNPE_HPP_ + +#include +#include + +#include "DlSystem/DlOptional.hpp" +#include "DlSystem/DlVersion.hpp" +#include "DlSystem/IBufferAttributes.hpp" +#include "DlSystem/ITensor.hpp" +#include "DlSystem/TensorShape.hpp" +#include "DlSystem/TensorMap.hpp" +#include "DlSystem/String.hpp" +#include "DlSystem/StringList.hpp" +#include "DlSystem/IUserBuffer.hpp" +#include "DlSystem/UserBufferMap.hpp" +#include "DlSystem/ZdlExportDefine.hpp" + +namespace zdl { + namespace SNPE + { + class SnpeRuntime; + } +} +namespace zdl { + namespace DiagLog + { + class IDiagLog; + } +} + +namespace zdl { namespace SNPE { +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * @brief . + * + * The SNPE interface class definition + */ +class ZDL_EXPORT SNPE final +{ +public: + + // keep this undocumented to be hidden in doxygen using HIDE_UNDOC_MEMBERS + explicit SNPE(std::unique_ptr&& runtime) noexcept; + ~SNPE(); + + /** + * @brief Gets the names of input tensors to the network + * + * To support multiple input scenarios, where multiple tensors are + * passed through execute() in a TensorMap, each tensor needs to + * be uniquely named. The names of tensors can be retrieved + * through this function. + * + * In the case of a single input, one name will be returned. + * + * @note Note that because the returned value is an Optional list, + * the list must be verified as boolean true value before being + * dereferenced. + * + * @return An Optional List of input tensor names. + * + * @see zdl::DlSystem::Optional + */ + zdl::DlSystem::Optional + getInputTensorNames() const noexcept; + + /** + * @brief Gets the names of output tensors to the network + * + * @return List of output tensor names. + */ + zdl::DlSystem::Optional + getOutputTensorNames() const noexcept; + + /** + * @brief Processes the input data and returns the output + * + * @param[in] A map of tensors that contains the input data for + * each input. The names of tensors needs to be + * matched with names retrieved through + * getInputTensorNames() + * + * @param[in,out] An empty map of tensors that will contain the output + * data of potentially multiple layers (the key + * in the map is the layer name) upon return + * + * @note output tensormap has to be empty. To forward propagate + * and get results in user-supplied tensors, use + * executeWithSuppliedOutputTensors. + */ + bool execute(const zdl::DlSystem::TensorMap &input, + zdl::DlSystem::TensorMap &output) noexcept; + + /** + * @brief Processes the input data and returns the output + * + * @param[in] A single tensor contains the input data. + * + * @param[in,out] An empty map of tensors that will contain the output + * data of potentially multiple layers (the key + * in the map is the layer name) upon return + * + * @note output tensormap has to be empty. + */ + bool execute(const zdl::DlSystem::ITensor *input, + zdl::DlSystem::TensorMap &output) noexcept; + + /** + * @brief Processes the input data and returns the output, using + * user-supplied buffers + * + * @param[in] A map of UserBuffers that contains the input data for + * each input. The names of UserBuffers needs to be + * matched with names retrieved through + * getInputTensorNames() + * + * @param[in,out] A map of UserBuffers that will hold the output + * data of potentially multiple layers (the key + * in the map is the UserBuffer name) + * + * @note input and output UserBuffer maps must be fully pre-populated. with + * dimensions matching what the network expects. + * For example, if there are 5 output UserBuffers they all have to be + * present in map. + * + * Caller must guarantee that for the duration of execute(), the buffer + * stored in UserBuffer would remain valid. For more detail on buffer + * ownership and lifetime requirements, please refer to zdl::DlSystem::UserBuffer + * documentation. + */ + bool execute(const zdl::DlSystem::UserBufferMap &input, + const zdl::DlSystem::UserBufferMap &output) noexcept; + + /** + * @brief Returns the version string embedded at model conversion + * time. + * + * @return Model version string, which is a free-form string + * supplied at the time of the conversion + * + */ + zdl::DlSystem::String getModelVersion() const noexcept; + + /** + * @brief Returns the dimensions of the input data to the model in the + * form of TensorShape. The dimensions in TensorShape corresponds to + * what the tensor dimensions would need to be for an input tensor to + * the model. + * + * @param[in] layer input name. + * + * @note Note that this function only makes sense for networks + * that have a fixed input size. For networks in which the + * input size varies with each call of Execute(), this + * function should not be used. + * + * @note Because the returned type is an Optional instance, it must + * be verified as a boolean true value before being dereferenced. + * + * @return An Optional instance of TensorShape that maintains dimensions, + * matching the tensor dimensions for input to the model, + * where the last entry is the fastest varying dimension, etc. + * + * @see zdl::DlSystem::ITensor + * @see zdl::DlSystem::TensorShape + * @see zdl::DlSystem::Optional + */ + zdl::DlSystem::Optional + getInputDimensions() const noexcept; + zdl::DlSystem::Optional + getInputDimensions(const char *name) const noexcept; + + /** + * @brief Gets the output layer(s) for the network. + * + * Note that the output layers returned by this function may be + * different than those specified when the network was created + * via the zdl::SNPE::SNPEBuilder. For example, if the + * network was created in debug mode with no explicit output + * layers specified, this will contain all layers. + * + * @note Note that because the returned value is an Optional StringList, + * the list must be verified as a boolean true value before being + * dereferenced. + * + * @return A List of output layer names. + * + * @see zdl::DlSystem::Optional + */ + zdl::DlSystem::Optional + getOutputLayerNames() const noexcept; + + /** + * @brief Returns attributes of buffers used to feed input tensors and receive result from output tensors. + * + * @param[in] Tensor name. + * + * @return BufferAttributes of input/output tensor named + */ + zdl::DlSystem::Optional getInputOutputBufferAttributes(const char *name) const noexcept; + + zdl::DlSystem::Optional getInputOutputBufferAttributesTf8(const char *name) const noexcept; + + /** + * @brief . + * + * Get the diagnostic logging interface + * + * @note Note that because the returned type is an Optional instance, + * it must be verified as a boolean true value before being + * dereferenced. + * + * @see zdl::DlSystem::Optional + */ + zdl::DlSystem::Optional + getDiagLogInterface() noexcept; + +private: + SNPE(const SNPE&) = delete; + SNPE& operator=(const SNPE&) = delete; + + std::unique_ptr m_Runtime; +}; + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ +}} + +#endif diff --git a/phonelibs/snpe/include/SNPE/SNPEBuilder.hpp b/phonelibs/snpe/include/SNPE/SNPEBuilder.hpp new file mode 100644 index 00000000000000..13e80e8c1a703d --- /dev/null +++ b/phonelibs/snpe/include/SNPE/SNPEBuilder.hpp @@ -0,0 +1,210 @@ +//============================================================================== +// +// Copyright (c) 2017 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef _SNPE_BUILDER_HPP_ +#define _SNPE_BUILDER_HPP_ + +#include "SNPE/SNPE.hpp" +#include "DlSystem/DlEnums.hpp" +#include "DlSystem/UDLFunc.hpp" +#include "DlSystem/DlOptional.hpp" +#include "DlSystem/TensorShapeMap.hpp" +#include "DlSystem/PlatformConfig.hpp" + +namespace zdl { + namespace DlContainer + { + class IDlContainer; + } +} + +struct SNPEBuilderImpl; + + +namespace zdl { namespace SNPE { +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * The builder class for creating SNPE objects. + * Not meant to be extended. + */ +class ZDL_EXPORT SNPEBuilder final +{ +private: + std::unique_ptr<::SNPEBuilderImpl> m_Impl; +public: + + /** + * @brief Constructor of NeuralNetwork Builder with a supplied model. + * + * @param[in] container A container holding the model. + * + * @return A new instance of a SNPEBuilder object + * that can be used to configure and build + * an instance of SNPE. + * + */ + explicit SNPEBuilder( + zdl::DlContainer::IDlContainer* container); + ~SNPEBuilder(); + + /** + * @brief Sets the runtime processor. + * + * @param[in] targetRuntimeProcessor The target runtime. + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setRuntimeProcessor( + zdl::DlSystem::Runtime_t targetRuntimeProcessor); + + /** + * @brief Requests a performance profile. + * + * @param[in] targetRuntimeProfile The target performance profile. + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setPerformanceProfile( + zdl::DlSystem::PerformanceProfile_t performanceProfile); + + /** + * @brief Sets a preference for execution priority. + * + * This allows the caller to give coarse hint to SNPE runtime + * about the priority of the network. SNPE runtime is free to use + * this information to co-ordinate between different workloads + * that may or may not extend beyond SNPE. + * + * @param[in] ExecutionPriorityHint_t The target performance profile. + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setExecutionPriorityHint( + zdl::DlSystem::ExecutionPriorityHint_t priority); + + /** + * @brief Sets the layers that will generate output. + * + * @param[in] outputLayerNames List of layer names to + * output. An empty list will + * result in only the final + * layer of the model being + * the output layer. The list + * will be copied. + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setOutputLayers( + const zdl::DlSystem::StringList& outputLayerNames); + + /** + * @brief Passes in a User-defined layer. + * + * @param udlBundle Bundle of udl factory function and a cookie + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setUdlBundle( + zdl::DlSystem::UDLBundle udlBundle); + + /** + * @brief Sets whether this neural network will perform inference with + * input from user-supplied buffers, and write output to user-supplied + * buffers. Default behaviour is to use tensors created by + * ITensorFactory. + * + * @param[in] bufferMode Whether to use user-supplied buffer or not. + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setUseUserSuppliedBuffers( + bool bufferMode); + + /** + * @brief Sets the debug mode of the runtime. + * + * @param[in] debugMode This enables debug mode for the runtime. It + * does two things. For an empty + * outputLayerNames list, all layers will be + * output. It might also disable some internal + * runtime optimizations (e.g., some networks + * might be optimized by combining layers, + * etc.). + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setDebugMode( + bool debugMode); + + /** + * @brief Sets the mode of CPU fallback functionality. + * + * @param[in] mode This flag enables/disables the functionality + * of CPU fallback. When the CPU fallback + * functionality is enabled, layers in model that + * violates runtime constraints will run on CPU + * while the rest of non-violating layers will + * run on the chosen runtime processor. In + * disabled mode, models with layers violating + * runtime constraints will NOT run on the chosen + * runtime processor and will result in runtime + * exception. By default, the functionality is + * enabled. + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setCPUFallbackMode( + bool mode); + + + /** + * @brief Sets network's input dimensions to enable resizing of + * the spatial dimensions of each layer for fully convolutional networks, + * and the batch dimension for all networks. + * + * @param[in] tensorShapeMap The map of input names and their new dimensions. + * The new dimensions overwrite the input dimensions + * embedded in the model and then resize each layer + * of the model. If the model contains + * layers whose dimensions cannot be resized e.g FullyConnected, + * exception will be thrown when SNPE instance is actually built. + * In general the batch dimension is always resizable. + * After resizing of layers' dimensions in model based + * on new input dimensions, the new model is revalidated + * against all runtime constraints, whose failures may + * result in cpu fallback situation. + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setInputDimensions(const zdl::DlSystem::TensorShapeMap& inputDimensionsMap); + + /** + * @brief Returns an instance of SNPE based on the current parameters. + * + * @return A new instance of a SNPE object that can be used + * to execute models or null if any errors occur. + */ + std::unique_ptr build() noexcept; + + /** + * @brief Sets the platform configuration. + * + * @param[in] platformConfig The platform configuration. + * + * @return The current instance of SNPEBuilder. + */ + SNPEBuilder& setPlatformConfig(const zdl::DlSystem::PlatformConfig& platformConfig); + +}; +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ + +}} + +#endif diff --git a/phonelibs/snpe/include/SNPE/SNPEFactory.hpp b/phonelibs/snpe/include/SNPE/SNPEFactory.hpp new file mode 100644 index 00000000000000..bb9921afe10591 --- /dev/null +++ b/phonelibs/snpe/include/SNPE/SNPEFactory.hpp @@ -0,0 +1,104 @@ +//============================================================================== +// +// Copyright (c) 2015-2016 Qualcomm Technologies, Inc. +// All Rights Reserved. +// Confidential and Proprietary - Qualcomm Technologies, Inc. +// +//============================================================================== + +#ifndef _SNPE_FACTORY_HPP_ +#define _SNPE_FACTORY_HPP_ + +#include "SNPE/SNPE.hpp" +#include "DlSystem/DlEnums.hpp" +#include "DlSystem/UDLFunc.hpp" +#include "DlSystem/ZdlExportDefine.hpp" +#include "DlSystem/DlOptional.hpp" + +namespace zdl { + namespace DlSystem + { + class ITensorFactory; + class IUserBufferFactory; + } + namespace DlContainer + { + class IDlContainer; + } +} + + + +namespace zdl { namespace SNPE { +/** @addtogroup c_plus_plus_apis C++ +@{ */ + +/** + * The factory class for creating SNPE objects. + * + */ +class ZDL_EXPORT SNPEFactory +{ +public: + + /** + * Indicates whether the supplied runtime is available on the + * current platform. + * + * @param[in] runtime The target runtime to check. + * + * @return True if the supplied runtime is available; false, + * otherwise. + */ + static bool isRuntimeAvailable(zdl::DlSystem::Runtime_t runtime); + + /** + * Gets a reference to the tensor factory. + * + * @return A reference to the tensor factory. + */ + static zdl::DlSystem::ITensorFactory& getTensorFactory(); + + /** + * Gets a reference to the UserBuffer factory. + * + * @return A reference to the UserBuffer factory. + */ + static zdl::DlSystem::IUserBufferFactory& getUserBufferFactory(); + + /** + * Gets the version of the SNPE library. + * + * @return Version of the SNPE library. + * + */ + static zdl::DlSystem::Version_t getLibraryVersion(); + + /** + * Set the SNPE storage location for all SNPE instances in this + * process. Note that this may only be called once, and if so + * must be called before creating any SNPE instances. + * + * @param[in] storagePath Absolute path to a directory which SNPE may + * use for caching and other storage purposes. + * + * @return True if the supplied path was succesfully set as + * the SNPE storage location, false otherwise. + */ + static bool setSNPEStorageLocation(const char* storagePath); + + /** + * Indicates whether the OpenGL and OpenCL interoperability is supported + * on GPU platform. + * + * @return True if the OpenGL and OpenCl interop is supported; false, + * otherwise. + */ + static bool isGLCLInteropSupported(); +}; + +/** @} */ /* end_addtogroup c_plus_plus_apis C++ */ +}} + + +#endif diff --git a/phonelibs/zlib/build.txt b/phonelibs/zlib/build.txt new file mode 100644 index 00000000000000..b67f9cd57ac853 --- /dev/null +++ b/phonelibs/zlib/build.txt @@ -0,0 +1,5 @@ +# with neos tree +cd ~/android/system +mka libz + +cp ~/android/system/out/target/product/oneplus3/obj/STATIC_LIBRARIES/libz_intermediates/libz.a lib/ diff --git a/phonelibs/zlib/lib/libz.a b/phonelibs/zlib/lib/libz.a new file mode 100644 index 00000000000000..d2170d8b87eb3b Binary files /dev/null and b/phonelibs/zlib/lib/libz.a differ diff --git a/phonelibs/zmq/aarch64-linux/bin/curve_keygen b/phonelibs/zmq/aarch64-linux/bin/curve_keygen new file mode 100755 index 00000000000000..3d76817f73c7f9 Binary files /dev/null and b/phonelibs/zmq/aarch64-linux/bin/curve_keygen differ diff --git a/phonelibs/zmq/aarch64-linux/include/czmq.h b/phonelibs/zmq/aarch64-linux/include/czmq.h new file mode 100644 index 00000000000000..dbf1fe5e40a517 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/czmq.h @@ -0,0 +1,39 @@ +/* ========================================================================= + CZMQ - a high-level binding in C for ZeroMQ + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= + + "Tell them I was a writer. + A maker of software. + A humanist. A father. + And many things. + But above all, a writer. + Thank You. :) + - Pieter Hintjens +*/ + +#ifndef __CZMQ_H_INCLUDED__ +#define __CZMQ_H_INCLUDED__ + +// These are signatures for handler functions that customize the +// behavior of CZMQ containers. These are shared between all CZMQ +// container types. + +// -- destroy an item +typedef void (czmq_destructor) (void **item); +// -- duplicate an item +typedef void *(czmq_duplicator) (const void *item); +// - compare two items, for sorting +typedef int (czmq_comparator) (const void *item1, const void *item2); + +// Include the project library file +#include "czmq_library.h" + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/czmq_library.h b/phonelibs/zmq/aarch64-linux/include/czmq_library.h new file mode 100644 index 00000000000000..89dc4eb9179dd6 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/czmq_library.h @@ -0,0 +1,178 @@ +/* ========================================================================= + czmq - generated layer of public API + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ + ========================================================================= +*/ + +#ifndef CZMQ_LIBRARY_H_INCLUDED +#define CZMQ_LIBRARY_H_INCLUDED + +// Set up environment for the application +#include "czmq_prelude.h" + +// External dependencies +#include + +// CZMQ version macros for compile-time API detection +#define CZMQ_VERSION_MAJOR 4 +#define CZMQ_VERSION_MINOR 0 +#define CZMQ_VERSION_PATCH 2 + +#define CZMQ_MAKE_VERSION(major, minor, patch) \ + ((major) * 10000 + (minor) * 100 + (patch)) +#define CZMQ_VERSION \ + CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH) + +#if defined (__WINDOWS__) +# if defined CZMQ_STATIC +# define CZMQ_EXPORT +# elif defined CZMQ_INTERNAL_BUILD +# if defined DLL_EXPORT +# define CZMQ_EXPORT __declspec(dllexport) +# else +# define CZMQ_EXPORT +# endif +# elif defined CZMQ_EXPORTS +# define CZMQ_EXPORT __declspec(dllexport) +# else +# define CZMQ_EXPORT __declspec(dllimport) +# endif +# define CZMQ_PRIVATE +#else +# define CZMQ_EXPORT +# if (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER +# define CZMQ_PRIVATE __attribute__ ((visibility ("hidden"))) +# else +# define CZMQ_PRIVATE +# endif +#endif + +// Opaque class structures to allow forward references +// These classes are stable or legacy and built in all releases +typedef struct _zactor_t zactor_t; +#define ZACTOR_T_DEFINED +typedef struct _zarmour_t zarmour_t; +#define ZARMOUR_T_DEFINED +typedef struct _zcert_t zcert_t; +#define ZCERT_T_DEFINED +typedef struct _zcertstore_t zcertstore_t; +#define ZCERTSTORE_T_DEFINED +typedef struct _zchunk_t zchunk_t; +#define ZCHUNK_T_DEFINED +typedef struct _zclock_t zclock_t; +#define ZCLOCK_T_DEFINED +typedef struct _zconfig_t zconfig_t; +#define ZCONFIG_T_DEFINED +typedef struct _zdigest_t zdigest_t; +#define ZDIGEST_T_DEFINED +typedef struct _zdir_t zdir_t; +#define ZDIR_T_DEFINED +typedef struct _zdir_patch_t zdir_patch_t; +#define ZDIR_PATCH_T_DEFINED +typedef struct _zfile_t zfile_t; +#define ZFILE_T_DEFINED +typedef struct _zframe_t zframe_t; +#define ZFRAME_T_DEFINED +typedef struct _zhash_t zhash_t; +#define ZHASH_T_DEFINED +typedef struct _zhashx_t zhashx_t; +#define ZHASHX_T_DEFINED +typedef struct _ziflist_t ziflist_t; +#define ZIFLIST_T_DEFINED +typedef struct _zlist_t zlist_t; +#define ZLIST_T_DEFINED +typedef struct _zlistx_t zlistx_t; +#define ZLISTX_T_DEFINED +typedef struct _zloop_t zloop_t; +#define ZLOOP_T_DEFINED +typedef struct _zmsg_t zmsg_t; +#define ZMSG_T_DEFINED +typedef struct _zpoller_t zpoller_t; +#define ZPOLLER_T_DEFINED +typedef struct _zsock_t zsock_t; +#define ZSOCK_T_DEFINED +typedef struct _zstr_t zstr_t; +#define ZSTR_T_DEFINED +typedef struct _zuuid_t zuuid_t; +#define ZUUID_T_DEFINED +typedef struct _zauth_t zauth_t; +#define ZAUTH_T_DEFINED +typedef struct _zbeacon_t zbeacon_t; +#define ZBEACON_T_DEFINED +typedef struct _zgossip_t zgossip_t; +#define ZGOSSIP_T_DEFINED +typedef struct _zmonitor_t zmonitor_t; +#define ZMONITOR_T_DEFINED +typedef struct _zproxy_t zproxy_t; +#define ZPROXY_T_DEFINED +typedef struct _zrex_t zrex_t; +#define ZREX_T_DEFINED +typedef struct _zsys_t zsys_t; +#define ZSYS_T_DEFINED +// Draft classes are by default not built in stable releases +#ifdef CZMQ_BUILD_DRAFT_API +typedef struct _zproc_t zproc_t; +#define ZPROC_T_DEFINED +typedef struct _ztimerset_t ztimerset_t; +#define ZTIMERSET_T_DEFINED +typedef struct _ztrie_t ztrie_t; +#define ZTRIE_T_DEFINED +#endif // CZMQ_BUILD_DRAFT_API + + +// Public classes, each with its own header file +#include "zactor.h" +#include "zarmour.h" +#include "zcert.h" +#include "zcertstore.h" +#include "zchunk.h" +#include "zclock.h" +#include "zconfig.h" +#include "zdigest.h" +#include "zdir.h" +#include "zdir_patch.h" +#include "zfile.h" +#include "zframe.h" +#include "zhash.h" +#include "zhashx.h" +#include "ziflist.h" +#include "zlist.h" +#include "zlistx.h" +#include "zloop.h" +#include "zmsg.h" +#include "zpoller.h" +#include "zsock.h" +#include "zstr.h" +#include "zuuid.h" +#include "zauth.h" +#include "zbeacon.h" +#include "zgossip.h" +#include "zmonitor.h" +#include "zproxy.h" +#include "zrex.h" +#include "zsys.h" +#ifdef CZMQ_BUILD_DRAFT_API +#include "zproc.h" +#include "ztimerset.h" +#include "ztrie.h" +#endif // CZMQ_BUILD_DRAFT_API + +#endif +/* +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ +*/ diff --git a/phonelibs/zmq/aarch64-linux/include/czmq_prelude.h b/phonelibs/zmq/aarch64-linux/include/czmq_prelude.h new file mode 100644 index 00000000000000..534f47023cc756 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/czmq_prelude.h @@ -0,0 +1,647 @@ +/* ========================================================================= + czmq_prelude.h - CZMQ environment + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __CZMQ_PRELUDE_H_INCLUDED__ +#define __CZMQ_PRELUDE_H_INCLUDED__ + +//- Establish the compiler and computer system ------------------------------ +/* + * Defines zero or more of these symbols, for use in any non-portable + * code: + * + * __WINDOWS__ Microsoft C/C++ with Windows calls + * __MSDOS__ System is MS-DOS (set if __WINDOWS__ set) + * __VMS__ System is VAX/VMS or Alpha/OpenVMS + * __UNIX__ System is UNIX + * __OS2__ System is OS/2 + * + * __IS_32BIT__ OS/compiler is 32 bits + * __IS_64BIT__ OS/compiler is 64 bits + * + * When __UNIX__ is defined, we also define exactly one of these: + * + * __UTYPE_AUX Apple AUX + * __UTYPE_BEOS BeOS + * __UTYPE_BSDOS BSD/OS + * __UTYPE_DECALPHA Digital UNIX (Alpha) + * __UTYPE_IBMAIX IBM RS/6000 AIX + * __UTYPE_FREEBSD FreeBSD + * __UTYPE_HPUX HP/UX + * __UTYPE_ANDROID Android + * __UTYPE_LINUX Linux + * __UTYPE_GNU GNU/Hurd + * __UTYPE_MIPS MIPS (BSD 4.3/System V mixture) + * __UTYPE_NETBSD NetBSD + * __UTYPE_NEXT NeXT + * __UTYPE_OPENBSD OpenBSD + * __UTYPE_OSX Apple Macintosh OS X + * __UTYPE_IOS Apple iOS + * __UTYPE_QNX QNX + * __UTYPE_IRIX Silicon Graphics IRIX + * __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix) + * __UTYPE_SUNOS SunOS + * __UTYPE_SUNSOLARIS Sun Solaris + * __UTYPE_UNIXWARE SCO UnixWare + * ... these are the ones I know about so far. + * __UTYPE_GENERIC Any other UNIX + * + * When __VMS__ is defined, we may define one or more of these: + * + * __VMS_XOPEN Supports XOPEN functions + */ + +#if (defined (__64BIT__) || defined (__x86_64__)) +# define __IS_64BIT__ // May have 64-bit OS/compiler +#else +# define __IS_32BIT__ // Else assume 32-bit OS/compiler +#endif + +#if (defined WIN32 || defined _WIN32) +# undef __WINDOWS__ +# define __WINDOWS__ +# undef __MSDOS__ +# define __MSDOS__ +#endif + +#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__) +# undef __WINDOWS__ +# define __WINDOWS__ +# undef __MSDOS__ +# define __MSDOS__ +// Stop cheeky warnings about "deprecated" functions like fopen +# if _MSC_VER >= 1500 +# undef _CRT_SECURE_NO_DEPRECATE +# define _CRT_SECURE_NO_DEPRECATE +# pragma warning(disable: 4996) +# endif +#endif + +// MSDOS Microsoft C +// _MSC_VER Microsoft C +#if (defined (MSDOS) || defined (_MSC_VER)) +# undef __MSDOS__ +# define __MSDOS__ +# if (defined (_DEBUG) && !defined (DEBUG)) +# define DEBUG +# endif +#endif + +#if (defined (__EMX__) && defined (__i386__)) +# undef __OS2__ +# define __OS2__ +#endif + +// VMS VAX C (VAX/VMS) +// __VMS Dec C (Alpha/OpenVMS) +// __vax__ gcc +#if (defined (VMS) || defined (__VMS) || defined (__vax__)) +# undef __VMS__ +# define __VMS__ +# if (__VMS_VER >= 70000000) +# define __VMS_XOPEN +# endif +#endif + +// Try to define a __UTYPE_xxx symbol... +// unix SunOS at least +// __unix__ gcc +// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS +#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE)) +# if (!defined (__VMS__)) +# undef __UNIX__ +# define __UNIX__ +# if (defined (__alpha)) // Digital UNIX is 64-bit +# undef __IS_32BIT__ +# define __IS_64BIT__ +# define __UTYPE_DECALPHA +# endif +# endif +#endif + +#if (defined (_AUX)) +# define __UTYPE_AUX +# define __UNIX__ +#elif (defined (__BEOS__)) +# define __UTYPE_BEOS +# define __UNIX__ +#elif (defined (__hpux)) +# define __UTYPE_HPUX +# define __UNIX__ +# define _INCLUDE_HPUX_SOURCE +# define _INCLUDE_XOPEN_SOURCE +# define _INCLUDE_POSIX_SOURCE +#elif (defined (_AIX) || defined (AIX)) +# define __UTYPE_IBMAIX +# define __UNIX__ +#elif (defined (BSD) || defined (bsd)) +# define __UTYPE_BSDOS +# define __UNIX__ +#elif (defined (__ANDROID__)) +# define __UTYPE_ANDROID +# define __UNIX__ +#elif (defined (LINUX) || defined (linux) || defined (__linux__)) +# define __UTYPE_LINUX +# define __UNIX__ +# ifndef __NO_CTYPE +# define __NO_CTYPE // Suppress warnings on tolower() +# endif +# ifndef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix +# endif +#elif (defined (__GNU__)) +# define __UTYPE_GNU +# define __UNIX__ +#elif (defined (Mips)) +# define __UTYPE_MIPS +# define __UNIX__ +#elif (defined (FreeBSD) || defined (__FreeBSD__)) +# define __UTYPE_FREEBSD +# define __UNIX__ +#elif (defined (NetBSD) || defined (__NetBSD__)) +# define __UTYPE_NETBSD +# define __UNIX__ +#elif (defined (OpenBSD) || defined (__OpenBSD__)) +# define __UTYPE_OPENBSD +# define __UNIX__ +#elif (defined (APPLE) || defined (__APPLE__)) +# include +# define __UNIX__ +# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR +# define __UTYPE_IOS +# else +# define __UTYPE_OSX +# endif +#elif (defined (NeXT)) +# define __UTYPE_NEXT +# define __UNIX__ +#elif (defined (__QNX__)) +# define __UTYPE_QNX +# define __UNIX__ +#elif (defined (sgi)) +# define __UTYPE_IRIX +# define __UNIX__ +#elif (defined (sinix)) +# define __UTYPE_SINIX +# define __UNIX__ +#elif (defined (SOLARIS) || defined (__SVR4)) || defined (SVR4) +# define __UTYPE_SUNSOLARIS +# define __UNIX__ +#elif (defined (SUNOS) || defined (SUN) || defined (sun)) +# define __UTYPE_SUNOS +# define __UNIX__ +#elif (defined (__USLC__) || defined (UnixWare)) +# define __UTYPE_UNIXWARE +# define __UNIX__ +#elif (defined (__CYGWIN__)) +# define __UTYPE_CYGWIN +# define __UNIX__ +#elif (defined (__UNIX__)) +# define __UTYPE_GENERIC +#endif + +//- Always include ZeroMQ headers ------------------------------------------- + +#include "zmq.h" +#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0)) +# include "zmq_utils.h" +#endif + +//- Standard ANSI include files --------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//- System-specific include files ------------------------------------------- + +#if (defined (__MSDOS__)) +# if (defined (__WINDOWS__)) +# if (_WIN32_WINNT < 0x0600) +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 +# endif +# if (!defined (FD_SETSIZE)) +# define FD_SETSIZE 1024 // Max. filehandles/sockets +# endif +# include +# include +# include +# include +# include // For getnameinfo () +# include // For GetAdaptersAddresses () +# endif +# include +# include +# include +# include +# include +# include +# include +# include +#endif + +#if (defined (__UNIX__)) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include // Let CZMQ build with libzmq/3.x +# include // Must come before arpa/inet.h +# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \ + && (!defined (__UTYPE_HPUX)) +# include +# endif +# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS) +# include +# endif +# if (!defined (__UTYPE_BEOS)) +# include +# if (!defined (TCP_NODELAY)) +# include +# endif +# endif +# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX)) +# include +# endif +# if (defined (__UTYPE_BEOS)) +# include +# endif +# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \ + || (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L))) +# include +# endif +# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS)) +# include +# include // For monotonic clocks +# endif +# if (defined (__UTYPE_OSX)) +# include // For _NSGetEnviron() +# endif +# if (defined (__UTYPE_ANDROID)) +# include +# endif +# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD)) +# include +# endif +#endif + +#if (defined (__VMS__)) +# if (!defined (vaxc)) +# include // Not provided by Vax C +# endif +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif + +#if (defined (__OS2__)) +# include // Required near top +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include // Must come before arpa/inet.h +# include +# include +# if (!defined (TCP_NODELAY)) +# include +# endif +#endif + +// Add missing defines for non-POSIX systems +#ifndef S_IRUSR +# define S_IRUSR S_IREAD +#endif +#ifndef S_IWUSR +# define S_IWUSR S_IWRITE +#endif +#ifndef S_ISDIR +# define S_ISDIR(m) (((m) & S_IFDIR) != 0) +#endif +#ifndef S_ISREG +# define S_ISREG(m) (((m) & S_IFREG) != 0) +#endif + + +//- Check compiler data type sizes ------------------------------------------ + +#if (UCHAR_MAX != 0xFF) +# error "Cannot compile: must change definition of 'byte'." +#endif +#if (USHRT_MAX != 0xFFFFU) +# error "Cannot compile: must change definition of 'dbyte'." +#endif +#if (UINT_MAX != 0xFFFFFFFFU) +# error "Cannot compile: must change definition of 'qbyte'." +#endif + +//- Data types -------------------------------------------------------------- + +typedef unsigned char byte; // Single unsigned byte = 8 bits +typedef unsigned short dbyte; // Double byte = 16 bits +typedef unsigned int qbyte; // Quad byte = 32 bits +typedef struct sockaddr_in inaddr_t; // Internet socket address structure +typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure + +// Common structure to hold inaddr_t and in6addr_t with length +typedef struct { + union { + inaddr_t __addr; // IPv4 address + in6addr_t __addr6; // IPv6 address + } __inaddr_u; +#define ipv4addr __inaddr_u.__addr +#define ipv6addr __inaddr_u.__addr6 + int inaddrlen; +} inaddr_storage_t; + +//- Inevitable macros ------------------------------------------------------- + +#define streq(s1,s2) (!strcmp ((s1), (s2))) +#define strneq(s1,s2) (strcmp ((s1), (s2))) + +// Provide random number from 0..(num-1) +// Note that (at least in Solaris) while rand() returns an int limited by +// RAND_MAX, random() returns a 32-bit value all filled with random bits. +#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \ + || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) || (defined (__UTYPE_SOLARIS)) +# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) +#else +# if defined(RAND_MAX) +# define randof(num) (int) ((float) (num) * (random () % RAND_MAX) / (RAND_MAX + 1.0)) +# else +# define randof(num) (int) ((float) (num) * (uint32_t)random () / (UINT32_MAX + 1.0)) +# endif +#endif + +// Windows MSVS doesn't have stdbool +#if (defined (_MSC_VER)) +# if (!defined (__cplusplus) && (!defined (true))) +# define true 1 +# define false 0 + typedef char bool; +# endif +#else +# include +#endif + +//- A number of POSIX and C99 keywords and data types ----------------------- +// CZMQ uses uint for array indices; equivalent to unsigned int, but more +// convenient in code. We define it in czmq_prelude.h on systems that do +// not define it by default. + +#if (defined (__WINDOWS__)) +# if (!defined (__cplusplus) && (!defined (inline))) +# define inline __inline +# endif +# define strtoull _strtoui64 +# define atoll _atoi64 +# define srandom srand +# define TIMEZONE _timezone +# if (!defined (__MINGW32__)) +# define snprintf _snprintf +# define vsnprintf _vsnprintf +# endif + typedef unsigned long ulong; + typedef unsigned int uint; +# if (!defined (__MINGW32__)) + typedef int mode_t; +# if !defined (_SSIZE_T_DEFINED) +typedef intptr_t ssize_t; +# define _SSIZE_T_DEFINED +# endif +# endif +# if ((!defined (__MINGW32__) \ + || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ + && !defined (ZMQ_DEFINED_STDINT)) + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; +# endif + typedef uint32_t in_addr_t; +# if (!defined (PRId8)) +# define PRId8 "d" +# endif +# if (!defined (PRId16)) +# define PRId16 "d" +# endif +# if (!defined (PRId32)) +# define PRId32 "d" +# endif +# if (!defined (PRId64)) +# define PRId64 "I64d" +# endif +# if (!defined (PRIu8)) +# define PRIu8 "u" +# endif +# if (!defined (PRIu16)) +# define PRIu16 "u" +# endif +# if (!defined (PRIu32)) +# define PRIu32 "u" +# endif +# if (!defined (PRIu64)) +# define PRIu64 "I64u" +# endif +# if (!defined (va_copy)) + // MSVC does not support C99's va_copy so we use a regular assignment +# define va_copy(dest,src) (dest) = (src) +# endif +#elif (defined (__UTYPE_OSX)) + typedef unsigned long ulong; + typedef unsigned int uint; + // This fixes header-order dependence problem with some Linux versions +#elif (defined (__UTYPE_LINUX)) +# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC)) + typedef unsigned int uint; +# endif +#endif + +//- Non-portable declaration specifiers ------------------------------------- + +// For thread-local storage +#if defined (__WINDOWS__) +# define CZMQ_THREADLS __declspec(thread) +#else +# define CZMQ_THREADLS __thread +#endif + +// Replacement for malloc() which asserts if we run out of heap, and +// which zeroes the allocated block. +static inline void * +safe_malloc (size_t size, const char *file, unsigned line) +{ +// printf ("%s:%u %08d\n", file, line, (int) size); + void *mem = calloc (1, size); + if (mem == NULL) { + fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line); + fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n"); + fflush (stderr); + abort (); + } + return mem; +} + +// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace, +// otherwise all allocations will claim to come from czmq_prelude.h. For best +// results, compile all classes so you see dangling object allocations. +// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate +// out of memory condition back up the call stack. +#if defined (_ZMALLOC_DEBUG) || defined (_ZMALLOC_PEDANTIC) +# define zmalloc(size) calloc(1,(size)) +#else +# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__) +#endif + +// GCC supports validating format strings for functions that act like printf +#if defined (__GNUC__) && (__GNUC__ >= 2) +# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1))) +#else +# define CHECK_PRINTF(a) +#endif + +// Lets us write code that compiles both on Windows and normal platforms +#if !defined (__WINDOWS__) +typedef int SOCKET; +# define closesocket close +# define INVALID_SOCKET -1 +# define SOCKET_ERROR -1 +# define O_BINARY 0 +#endif + +//- Include non-portable header files based on platform.h ------------------- + +#if defined (HAVE_LINUX_WIRELESS_H) +# include +// This would normally come from net/if.h +unsigned int if_nametoindex (const char *ifname); +#else +# if defined (HAVE_NET_IF_H) +# include +# endif +# if defined (HAVE_NET_IF_MEDIA_H) +# include +# endif +#endif + +#if defined (__WINDOWS__) && !defined (HAVE_UUID) +# define HAVE_UUID 1 +#endif +#if defined (__UTYPE_OSX) && !defined (HAVE_UUID) +# define HAVE_UUID 1 +#endif +#if defined (HAVE_UUID) +# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD) +# include +# elif defined __UTYPE_HPUX +# include +# elif defined (__UNIX__) +# include +# endif +#endif + +// ZMQ compatibility macros + +#if ZMQ_VERSION_MAJOR == 4 +# define ZMQ_POLL_MSEC 1 // zmq_poll is msec + +#elif ZMQ_VERSION_MAJOR == 3 +# define ZMQ_POLL_MSEC 1 // zmq_poll is msec +# if ZMQ_VERSION_MINOR < 2 +# define zmq_ctx_new zmq_init +# endif +# define zmq_ctx_term zmq_term + +#elif ZMQ_VERSION_MAJOR == 2 +# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec +# define zmq_sendmsg zmq_send // Smooth out 2.x changes +# define zmq_recvmsg zmq_recv +# define zmq_ctx_new zmq_init +# define zmq_ctx_term zmq_term +# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f)) +# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f)) + // Older libzmq APIs may be missing some aspects of libzmq v3.0 +# ifndef ZMQ_ROUTER +# define ZMQ_ROUTER ZMQ_XREP +# endif +# ifndef ZMQ_DEALER +# define ZMQ_DEALER ZMQ_XREQ +# endif +# ifndef ZMQ_DONTWAIT +# define ZMQ_DONTWAIT ZMQ_NOBLOCK +# endif +# ifndef ZMQ_XSUB +# error "please upgrade your libzmq from http://zeromq.org" +# endif +# if ZMQ_VERSION_MINOR == 0 \ + || (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7) +# error "CZMQ requires at least libzmq/2.1.7 stable" +# endif +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zactor.h b/phonelibs/zmq/aarch64-linux/include/zactor.h new file mode 100644 index 00000000000000..c865c65daf1efa --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zactor.h @@ -0,0 +1,76 @@ +/* ========================================================================= + zactor - actor + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZACTOR_H_INCLUDED__ +#define __ZACTOR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zactor.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Actors get a pipe and arguments from caller +typedef void (zactor_fn) ( + zsock_t *pipe, void *args); + +// Create a new actor passing arbitrary arguments reference. +CZMQ_EXPORT zactor_t * + zactor_new (zactor_fn task, void *args); + +// Destroy an actor. +CZMQ_EXPORT void + zactor_destroy (zactor_t **self_p); + +// Send a zmsg message to the actor, take ownership of the message +// and destroy when it has been sent. +CZMQ_EXPORT int + zactor_send (zactor_t *self, zmsg_t **msg_p); + +// Receive a zmsg message from the actor. Returns NULL if the actor +// was interrupted before the message could be received, or if there +// was a timeout on the actor. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zmsg_t * + zactor_recv (zactor_t *self); + +// Probe the supplied object, and report if it looks like a zactor_t. +CZMQ_EXPORT bool + zactor_is (void *self); + +// Probe the supplied reference. If it looks like a zactor_t instance, +// return the underlying libzmq actor handle; else if it looks like +// a libzmq actor handle, return the supplied value. +CZMQ_EXPORT void * + zactor_resolve (void *self); + +// Return the actor's zsock handle. Use this when you absolutely need +// to work with the zsock instance rather than the actor. +CZMQ_EXPORT zsock_t * + zactor_sock (zactor_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zactor_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zarmour.h b/phonelibs/zmq/aarch64-linux/include/zarmour.h new file mode 100644 index 00000000000000..c7f299f7afe989 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zarmour.h @@ -0,0 +1,114 @@ +/* ========================================================================= + zarmour - armoured text encoding and decoding + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZARMOUR_H_INCLUDED__ +#define __ZARMOUR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zarmour.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 +#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 +#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 +#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 +#define ZARMOUR_MODE_BASE16 4 // Standard base 16 +#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 + +// Create a new zarmour +CZMQ_EXPORT zarmour_t * + zarmour_new (void); + +// Destroy the zarmour +CZMQ_EXPORT void + zarmour_destroy (zarmour_t **self_p); + +// Encode a stream of bytes into an armoured string. Returns the armoured +// string, or NULL if there was insufficient memory available to allocate +// a new string. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zarmour_encode (zarmour_t *self, const byte *data, size_t size); + +// Decode an armoured string into a chunk. The decoded output is +// null-terminated, so it may be treated as a string, if that's what +// it was prior to encoding. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zarmour_decode (zarmour_t *self, const char *data); + +// Get the mode property. +CZMQ_EXPORT int + zarmour_mode (zarmour_t *self); + +// Get printable string for mode. +CZMQ_EXPORT const char * + zarmour_mode_str (zarmour_t *self); + +// Set the mode property. +CZMQ_EXPORT void + zarmour_set_mode (zarmour_t *self, int mode); + +// Return true if padding is turned on. +CZMQ_EXPORT bool + zarmour_pad (zarmour_t *self); + +// Turn padding on or off. Default is on. +CZMQ_EXPORT void + zarmour_set_pad (zarmour_t *self, bool pad); + +// Get the padding character. +CZMQ_EXPORT char + zarmour_pad_char (zarmour_t *self); + +// Set the padding character. +CZMQ_EXPORT void + zarmour_set_pad_char (zarmour_t *self, char pad_char); + +// Return if splitting output into lines is turned on. Default is off. +CZMQ_EXPORT bool + zarmour_line_breaks (zarmour_t *self); + +// Turn splitting output into lines on or off. +CZMQ_EXPORT void + zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); + +// Get the line length used for splitting lines. +CZMQ_EXPORT size_t + zarmour_line_length (zarmour_t *self); + +// Set the line length used for splitting lines. +CZMQ_EXPORT void + zarmour_set_line_length (zarmour_t *self, size_t line_length); + +// Print properties of object +CZMQ_EXPORT void + zarmour_print (zarmour_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zarmour_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zauth.h b/phonelibs/zmq/aarch64-linux/include/zauth.h new file mode 100644 index 00000000000000..3e0e59ecabf544 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zauth.h @@ -0,0 +1,100 @@ +/* ========================================================================= + zauth - authentication for ZeroMQ security mechanisms + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZAUTH_H_INCLUDED__ +#define __ZAUTH_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#define CURVE_ALLOW_ANY "*" + +// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated). +// +// Create new zauth actor instance. This installs authentication on all +// zsock sockets. Until you add policies, all incoming NULL connections are +// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections +// are denied: +// +// zactor_t *auth = zactor_new (zauth, NULL); +// +// Destroy zauth instance. This removes authentication and allows all +// connections to pass, without authentication: +// +// zactor_destroy (&auth); +// +// Note that all zauth commands are synchronous, so your application always +// waits for a signal from the actor after each command. +// +// Enable verbose logging of commands and activity. Verbose logging can help +// debug non-trivial authentication policies: +// +// zstr_send (auth, "VERBOSE"); +// zsock_wait (auth); +// +// Allow (whitelist) a list of IP addresses. For NULL, all clients from +// these addresses will be accepted. For PLAIN and CURVE, they will be +// allowed to continue with authentication. You can call this method +// multiple times to whitelist more IP addresses. If you whitelist one +// or more addresses, any non-whitelisted addresses are treated as +// blacklisted: +// +// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL); +// zsock_wait (auth); +// +// Deny (blacklist) a list of IP addresses. For all security mechanisms, +// this rejects the connection without any further authentication. Use +// either a whitelist, or a blacklist, not not both. If you define both +// a whitelist and a blacklist, only the whitelist takes effect: +// +// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL); +// zsock_wait (auth); +// +// Configure PLAIN authentication using a plain-text password file. You can +// modify the password file at any time; zauth will reload it automatically +// if modified externally: +// +// zstr_sendx (auth, "PLAIN", filename, NULL); +// zsock_wait (auth); +// +// Configure CURVE authentication, using a directory that holds all public +// client certificates, i.e. their public keys. The certificates must be in +// zcert_save format. You can add and remove certificates in that directory +// at any time. To allow all client keys without checking, specify +// CURVE_ALLOW_ANY for the directory name: +// +// zstr_sendx (auth, "CURVE", directory, NULL); +// zsock_wait (auth); +// +// Configure GSSAPI authentication, using an underlying mechanism (usually +// Kerberos) to establish a secure context and perform mutual authentication: +// +// zstr_sendx (auth, "GSSAPI", NULL); +// zsock_wait (auth); +// +// This is the zauth constructor as a zactor_fn: +CZMQ_EXPORT void + zauth (zsock_t *pipe, void *certstore); + +// Selftest +CZMQ_EXPORT void + zauth_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zbeacon.h b/phonelibs/zmq/aarch64-linux/include/zbeacon.h new file mode 100644 index 00000000000000..78917e9577e40f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zbeacon.h @@ -0,0 +1,86 @@ +/* ========================================================================= + zbeacon - LAN discovery and presence + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZBEACON_H_INCLUDED__ +#define __ZBEACON_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create new zbeacon actor instance: +// +// zactor_t *beacon = zactor_new (zbeacon, NULL); +// +// Destroy zbeacon instance: +// +// zactor_destroy (&beacon); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (beacon, "VERBOSE"); +// +// Configure beacon to run on specified UDP port, and return the name of +// the host, which can be used as endpoint for incoming connections. To +// force the beacon to operate on a given interface, set the environment +// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating +// the beacon. If the system does not support UDP broadcasts (lacking a +// workable interface), returns an empty hostname: +// +// // Pictures: 's' = C string, 'i' = int +// zsock_send (beacon, "si", "CONFIGURE", port_number); +// char *hostname = zstr_recv (beacon); +// +// Start broadcasting a beacon at a specified interval in msec. The beacon +// data can be at most UDP_FRAME_MAX bytes; this constant is defined in +// zsys.h to be 255: +// +// // Pictures: 'b' = byte * data + size_t size +// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); +// +// Stop broadcasting the beacon: +// +// zstr_sendx (beacon, "SILENCE", NULL); +// +// Start listening to beacons from peers. The filter is used to do a prefix +// match on received beacons, to remove junk. Note that any received data +// that is identical to our broadcast beacon_data is discarded in any case. +// If the filter size is zero, we get all peer beacons: +// +// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); +// +// Stop listening to other peers +// +// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); +// +// Receive next beacon from a peer. Received beacons are always a 2-frame +// message containing the ipaddress of the sender, and then the binary +// beacon data as published by the sender: +// +// zmsg_t *msg = zmsg_recv (beacon); +// +// This is the zbeacon constructor as a zactor_fn: +CZMQ_EXPORT void + zbeacon (zsock_t *pipe, void *unused); + +// Self test of this class +CZMQ_EXPORT void + zbeacon_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zcert.h b/phonelibs/zmq/aarch64-linux/include/zcert.h new file mode 100644 index 00000000000000..3161bc0596b51b --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zcert.h @@ -0,0 +1,128 @@ +/* ========================================================================= + zcert - work with CURVE security certificates + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCERT_H_INCLUDED__ +#define __ZCERT_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zcert.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create and initialize a new certificate in memory +CZMQ_EXPORT zcert_t * + zcert_new (void); + +// Accepts public/secret key pair from caller +CZMQ_EXPORT zcert_t * + zcert_new_from (const byte *public_key, const byte *secret_key); + +// Load certificate from file +CZMQ_EXPORT zcert_t * + zcert_load (const char *filename); + +// Destroy a certificate in memory +CZMQ_EXPORT void + zcert_destroy (zcert_t **self_p); + +// Return public part of key pair as 32-byte binary string +CZMQ_EXPORT const byte * + zcert_public_key (zcert_t *self); + +// Return secret part of key pair as 32-byte binary string +CZMQ_EXPORT const byte * + zcert_secret_key (zcert_t *self); + +// Return public part of key pair as Z85 armored string +CZMQ_EXPORT const char * + zcert_public_txt (zcert_t *self); + +// Return secret part of key pair as Z85 armored string +CZMQ_EXPORT const char * + zcert_secret_txt (zcert_t *self); + +// Set certificate metadata from formatted string. +CZMQ_EXPORT void + zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3); + +// Get metadata value from certificate; if the metadata value doesn't +// exist, returns NULL. +CZMQ_EXPORT const char * + zcert_meta (zcert_t *self, const char *name); + +// Get list of metadata fields from certificate. Caller is responsible for +// destroying list. Caller should not modify the values of list items. +CZMQ_EXPORT zlist_t * + zcert_meta_keys (zcert_t *self); + +// Save full certificate (public + secret) to file for persistent storage +// This creates one public file and one secret file (filename + "_secret"). +CZMQ_EXPORT int + zcert_save (zcert_t *self, const char *filename); + +// Save public certificate only to file for persistent storage +CZMQ_EXPORT int + zcert_save_public (zcert_t *self, const char *filename); + +// Save secret certificate only to file for persistent storage +CZMQ_EXPORT int + zcert_save_secret (zcert_t *self, const char *filename); + +// Apply certificate to socket, i.e. use for CURVE security on socket. +// If certificate was loaded from public file, the secret key will be +// undefined, and this certificate will not work successfully. +CZMQ_EXPORT void + zcert_apply (zcert_t *self, void *socket); + +// Return copy of certificate; if certificate is NULL or we exhausted +// heap memory, returns NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zcert_t * + zcert_dup (zcert_t *self); + +// Return true if two certificates have the same keys +CZMQ_EXPORT bool + zcert_eq (zcert_t *self, zcert_t *compare); + +// Print certificate contents to stdout +CZMQ_EXPORT void + zcert_print (zcert_t *self); + +// Self test of this class +CZMQ_EXPORT void + zcert_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Unset certificate metadata. +CZMQ_EXPORT void + zcert_unset_meta (zcert_t *self, const char *name); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zcert_dump(s) zcert_print(s) + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zcertstore.h b/phonelibs/zmq/aarch64-linux/include/zcertstore.h new file mode 100644 index 00000000000000..689b228ac1ed17 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zcertstore.h @@ -0,0 +1,92 @@ +/* ========================================================================= + zcertstore - work with CURVE security certificate stores + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCERTSTORE_H_INCLUDED__ +#define __ZCERTSTORE_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zcertstore.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create a new certificate store from a disk directory, loading and +// indexing all certificates in that location. The directory itself may be +// absent, and created later, or modified at any time. The certificate store +// is automatically refreshed on any zcertstore_lookup() call. If the +// location is specified as NULL, creates a pure-memory store, which you +// can work with by inserting certificates at runtime. +CZMQ_EXPORT zcertstore_t * + zcertstore_new (const char *location); + +// Destroy a certificate store object in memory. Does not affect anything +// stored on disk. +CZMQ_EXPORT void + zcertstore_destroy (zcertstore_t **self_p); + +// Look up certificate by public key, returns zcert_t object if found, +// else returns NULL. The public key is provided in Z85 text format. +CZMQ_EXPORT zcert_t * + zcertstore_lookup (zcertstore_t *self, const char *public_key); + +// Insert certificate into certificate store in memory. Note that this +// does not save the certificate to disk. To do that, use zcert_save() +// directly on the certificate. Takes ownership of zcert_t object. +CZMQ_EXPORT void + zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); + +// Print list of certificates in store to logging facility +CZMQ_EXPORT void + zcertstore_print (zcertstore_t *self); + +// Self test of this class +CZMQ_EXPORT void + zcertstore_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// Loaders retrieve certificates from an arbitrary source. +typedef void (zcertstore_loader) ( + zcertstore_t *self); + +// Destructor for loader state. +typedef void (zcertstore_destructor) ( + void **self_p); + +// *** Draft method, for development use, may change without warning *** +// Override the default disk loader with a custom loader fn. +CZMQ_EXPORT void + zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); + +// *** Draft method, for development use, may change without warning *** +// Empty certificate hashtable. This wrapper exists to be friendly to bindings, +// which don't usually have access to struct internals. +CZMQ_EXPORT void + zcertstore_empty (zcertstore_t *self); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zcertstore_dump(s) zcertstore_print(s) + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zchunk.h b/phonelibs/zmq/aarch64-linux/include/zchunk.h new file mode 100644 index 00000000000000..56f29b161a37e5 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zchunk.h @@ -0,0 +1,163 @@ +/* ========================================================================= + zchunk - work with memory chunks + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCHUNK_H_INCLUDED__ +#define __ZCHUNK_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zchunk.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create a new chunk of the specified size. If you specify the data, it +// is copied into the chunk. If you do not specify the data, the chunk is +// allocated and left empty, and you can then add data using zchunk_append. +CZMQ_EXPORT zchunk_t * + zchunk_new (const void *data, size_t size); + +// Destroy a chunk +CZMQ_EXPORT void + zchunk_destroy (zchunk_t **self_p); + +// Resizes chunk max_size as requested; chunk_cur size is set to zero +CZMQ_EXPORT void + zchunk_resize (zchunk_t *self, size_t size); + +// Return chunk cur size +CZMQ_EXPORT size_t + zchunk_size (zchunk_t *self); + +// Return chunk max size +CZMQ_EXPORT size_t + zchunk_max_size (zchunk_t *self); + +// Return chunk data +CZMQ_EXPORT byte * + zchunk_data (zchunk_t *self); + +// Set chunk data from user-supplied data; truncate if too large. Data may +// be null. Returns actual size of chunk +CZMQ_EXPORT size_t + zchunk_set (zchunk_t *self, const void *data, size_t size); + +// Fill chunk data from user-supplied octet +CZMQ_EXPORT size_t + zchunk_fill (zchunk_t *self, byte filler, size_t size); + +// Append user-supplied data to chunk, return resulting chunk size. If the +// data would exceeded the available space, it is truncated. If you want to +// grow the chunk to accommodate new data, use the zchunk_extend method. +CZMQ_EXPORT size_t + zchunk_append (zchunk_t *self, const void *data, size_t size); + +// Append user-supplied data to chunk, return resulting chunk size. If the +// data would exceeded the available space, the chunk grows in size. +CZMQ_EXPORT size_t + zchunk_extend (zchunk_t *self, const void *data, size_t size); + +// Copy as much data from 'source' into the chunk as possible; returns the +// new size of chunk. If all data from 'source' is used, returns exhausted +// on the source chunk. Source can be consumed as many times as needed until +// it is exhausted. If source was already exhausted, does not change chunk. +CZMQ_EXPORT size_t + zchunk_consume (zchunk_t *self, zchunk_t *source); + +// Returns true if the chunk was exhausted by consume methods, or if the +// chunk has a size of zero. +CZMQ_EXPORT bool + zchunk_exhausted (zchunk_t *self); + +// Read chunk from an open file descriptor +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_read (FILE *handle, size_t bytes); + +// Write chunk to an open file descriptor +CZMQ_EXPORT int + zchunk_write (zchunk_t *self, FILE *handle); + +// Try to slurp an entire file into a chunk. Will read up to maxsize of +// the file. If maxsize is 0, will attempt to read the entire file and +// fail with an assertion if that cannot fit into memory. Returns a new +// chunk containing the file data, or NULL if the file could not be read. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_slurp (const char *filename, size_t maxsize); + +// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t +// object, or null if there was not enough heap memory. If chunk is null, +// returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_dup (zchunk_t *self); + +// Return chunk data encoded as printable hex string. Caller must free +// string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zchunk_strhex (zchunk_t *self); + +// Return chunk data copied into freshly allocated string +// Caller must free string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zchunk_strdup (zchunk_t *self); + +// Return TRUE if chunk body is equal to string, excluding terminator +CZMQ_EXPORT bool + zchunk_streq (zchunk_t *self, const char *string); + +// Transform zchunk into a zframe that can be sent in a message. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zchunk_pack (zchunk_t *self); + +// Transform a zframe into a zchunk. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_unpack (zframe_t *frame); + +// Calculate SHA1 digest for chunk, using zdigest class. +CZMQ_EXPORT const char * + zchunk_digest (zchunk_t *self); + +// Dump chunk to FILE stream, for debugging and tracing. +CZMQ_EXPORT void + zchunk_fprint (zchunk_t *self, FILE *file); + +// Dump message to stderr, for debugging and tracing. +// See zchunk_fprint for details +CZMQ_EXPORT void + zchunk_print (zchunk_t *self); + +// Probe the supplied object, and report if it looks like a zchunk_t. +CZMQ_EXPORT bool + zchunk_is (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zchunk_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/phonelibs/zmq/aarch64-linux/include/zclock.h b/phonelibs/zmq/aarch64-linux/include/zclock.h new file mode 100644 index 00000000000000..eb064162c4722a --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zclock.h @@ -0,0 +1,73 @@ +/* ========================================================================= + zclock - millisecond clocks and delays + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCLOCK_H_INCLUDED__ +#define __ZCLOCK_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zclock.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Sleep for a number of milliseconds +CZMQ_EXPORT void + zclock_sleep (int msecs); + +// Return current system clock as milliseconds. Note that this clock can +// jump backwards (if the system clock is changed) so is unsafe to use for +// timers and time offsets. Use zclock_mono for that instead. +CZMQ_EXPORT int64_t + zclock_time (void); + +// Return current monotonic clock in milliseconds. Use this when you compute +// time offsets. The monotonic clock is not affected by system changes and +// so will never be reset backwards, unlike a system clock. +CZMQ_EXPORT int64_t + zclock_mono (void); + +// Return current monotonic clock in microseconds. Use this when you compute +// time offsets. The monotonic clock is not affected by system changes and +// so will never be reset backwards, unlike a system clock. +CZMQ_EXPORT int64_t + zclock_usecs (void); + +// Return formatted date/time as fresh string. Free using zstr_free(). +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zclock_timestr (void); + +// Self test of this class. +CZMQ_EXPORT void + zclock_test (bool verbose); + +// @end + + +// DEPRECATED in favor of zsys logging, see issue #519 +// Print formatted string to stdout, prefixed by date/time and +// terminated with a newline. +CZMQ_EXPORT void + zclock_log (const char *format, ...); + +// Compiler hints +CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zconfig.h b/phonelibs/zmq/aarch64-linux/include/zconfig.h new file mode 100644 index 00000000000000..df0c708493f512 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zconfig.h @@ -0,0 +1,185 @@ +/* ========================================================================= + zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL. + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCONFIG_H_INCLUDED__ +#define __ZCONFIG_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zconfig.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// +typedef int (zconfig_fct) ( + zconfig_t *self, void *arg, int level); + +// Create new config item +CZMQ_EXPORT zconfig_t * + zconfig_new (const char *name, zconfig_t *parent); + +// Load a config tree from a specified ZPL text file; returns a zconfig_t +// reference for the root, if the file exists and is readable. Returns NULL +// if the file does not exist. +CZMQ_EXPORT zconfig_t * + zconfig_load (const char *filename); + +// Equivalent to zconfig_load, taking a format string instead of a fixed +// filename. +CZMQ_EXPORT zconfig_t * + zconfig_loadf (const char *format, ...) CHECK_PRINTF (1); + +// Destroy a config item and all its children +CZMQ_EXPORT void + zconfig_destroy (zconfig_t **self_p); + +// Return name of config item +CZMQ_EXPORT char * + zconfig_name (zconfig_t *self); + +// Return value of config item +CZMQ_EXPORT char * + zconfig_value (zconfig_t *self); + +// Insert or update configuration key with value +CZMQ_EXPORT void + zconfig_put (zconfig_t *self, const char *path, const char *value); + +// Equivalent to zconfig_put, accepting a format specifier and variable +// argument list, instead of a single string value. +CZMQ_EXPORT void + zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3); + +// Get value for config item into a string value; leading slash is optional +// and ignored. +CZMQ_EXPORT char * + zconfig_get (zconfig_t *self, const char *path, const char *default_value); + +// Set config item name, name may be NULL +CZMQ_EXPORT void + zconfig_set_name (zconfig_t *self, const char *name); + +// Set new value for config item. The new value may be a string, a printf +// format, or NULL. Note that if string may possibly contain '%', or if it +// comes from an insecure source, you must use '%s' as the format, followed +// by the string. +CZMQ_EXPORT void + zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Find our first child, if any +CZMQ_EXPORT zconfig_t * + zconfig_child (zconfig_t *self); + +// Find our first sibling, if any +CZMQ_EXPORT zconfig_t * + zconfig_next (zconfig_t *self); + +// Find a config item along a path; leading slash is optional and ignored. +CZMQ_EXPORT zconfig_t * + zconfig_locate (zconfig_t *self, const char *path); + +// Locate the last config item at a specified depth +CZMQ_EXPORT zconfig_t * + zconfig_at_depth (zconfig_t *self, int level); + +// Execute a callback for each config item in the tree; returns zero if +// successful, else -1. +CZMQ_EXPORT int + zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); + +// Add comment to config item before saving to disk. You can add as many +// comment lines as you like. If you use a null format, all comments are +// deleted. +CZMQ_EXPORT void + zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Return comments of config item, as zlist. +CZMQ_EXPORT zlist_t * + zconfig_comments (zconfig_t *self); + +// Save a config tree to a specified ZPL text file, where a filename +// "-" means dump to standard output. +CZMQ_EXPORT int + zconfig_save (zconfig_t *self, const char *filename); + +// Equivalent to zconfig_save, taking a format string instead of a fixed +// filename. +CZMQ_EXPORT int + zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Report filename used during zconfig_load, or NULL if none +CZMQ_EXPORT const char * + zconfig_filename (zconfig_t *self); + +// Reload config tree from same file that it was previously loaded from. +// Returns 0 if OK, -1 if there was an error (and then does not change +// existing data). +CZMQ_EXPORT int + zconfig_reload (zconfig_t **self_p); + +// Load a config tree from a memory chunk +CZMQ_EXPORT zconfig_t * + zconfig_chunk_load (zchunk_t *chunk); + +// Save a config tree to a new memory chunk +CZMQ_EXPORT zchunk_t * + zconfig_chunk_save (zconfig_t *self); + +// Load a config tree from a null-terminated string +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zconfig_t * + zconfig_str_load (const char *string); + +// Save a config tree to a new null terminated string +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zconfig_str_save (zconfig_t *self); + +// Return true if a configuration tree was loaded from a file and that +// file has changed in since the tree was loaded. +CZMQ_EXPORT bool + zconfig_has_changed (zconfig_t *self); + +// Print the config file to open stream +CZMQ_EXPORT void + zconfig_fprint (zconfig_t *self, FILE *file); + +// Print properties of object +CZMQ_EXPORT void + zconfig_print (zconfig_t *self); + +// Self test of this class +CZMQ_EXPORT void + zconfig_test (bool verbose); + +// @end + +// Self test of this class +CZMQ_EXPORT void + zconfig_test (bool verbose); + +// Compiler hints +CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zconfig_dump(s) zconfig_print(s) +#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d)) + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zdigest.h b/phonelibs/zmq/aarch64-linux/include/zdigest.h new file mode 100644 index 00000000000000..def9e860537094 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zdigest.h @@ -0,0 +1,65 @@ +/* ========================================================================= + zdigest - provides hashing functions (SHA-1 at present) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZDIGEST_H_INCLUDED__ +#define __ZDIGEST_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zdigest.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Constructor - creates new digest object, which you use to build up a +// digest by repeatedly calling zdigest_update() on chunks of data. +CZMQ_EXPORT zdigest_t * + zdigest_new (void); + +// Destroy a digest object +CZMQ_EXPORT void + zdigest_destroy (zdigest_t **self_p); + +// Add buffer into digest calculation +CZMQ_EXPORT void + zdigest_update (zdigest_t *self, const byte *buffer, size_t length); + +// Return final digest hash data. If built without crypto support, +// returns NULL. +CZMQ_EXPORT const byte * + zdigest_data (zdigest_t *self); + +// Return final digest hash size +CZMQ_EXPORT size_t + zdigest_size (zdigest_t *self); + +// Return digest as printable hex string; caller should not modify nor +// free this string. After calling this, you may not use zdigest_update() +// on the same digest. If built without crypto support, returns NULL. +CZMQ_EXPORT char * + zdigest_string (zdigest_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zdigest_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zdir.h b/phonelibs/zmq/aarch64-linux/include/zdir.h new file mode 100644 index 00000000000000..6c5551b57eead4 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zdir.h @@ -0,0 +1,149 @@ +/* ========================================================================= + zdir - work with file-system directories + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZDIR_H_INCLUDED__ +#define __ZDIR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zdir.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create a new directory item that loads in the full tree of the specified +// path, optionally located under some parent path. If parent is "-", then +// loads only the top-level directory, and does not use parent as a path. +CZMQ_EXPORT zdir_t * + zdir_new (const char *path, const char *parent); + +// Destroy a directory tree and all children it contains. +CZMQ_EXPORT void + zdir_destroy (zdir_t **self_p); + +// Return directory path +CZMQ_EXPORT const char * + zdir_path (zdir_t *self); + +// Return last modification time for directory. +CZMQ_EXPORT time_t + zdir_modified (zdir_t *self); + +// Return total hierarchy size, in bytes of data contained in all files +// in the directory tree. +CZMQ_EXPORT off_t + zdir_cursize (zdir_t *self); + +// Return directory count +CZMQ_EXPORT size_t + zdir_count (zdir_t *self); + +// Returns a sorted list of zfile objects; Each entry in the list is a pointer +// to a zfile_t item already allocated in the zdir tree. Do not destroy the +// original zdir tree until you are done with this list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zdir_list (zdir_t *self); + +// Remove directory, optionally including all files that it contains, at +// all levels. If force is false, will only remove the directory if empty. +// If force is true, will remove all files and all subdirectories. +CZMQ_EXPORT void + zdir_remove (zdir_t *self, bool force); + +// Calculate differences between two versions of a directory tree. +// Returns a list of zdir_patch_t patches. Either older or newer may +// be null, indicating the directory is empty/absent. If alias is set, +// generates virtual filename (minus path, plus alias). +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); + +// Return full contents of directory as a zdir_patch list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zdir_resync (zdir_t *self, const char *alias); + +// Load directory cache; returns a hash table containing the SHA-1 digests +// of every file in the tree. The cache is saved between runs in .cache. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zhash_t * + zdir_cache (zdir_t *self); + +// Print contents of directory to open stream +CZMQ_EXPORT void + zdir_fprint (zdir_t *self, FILE *file, int indent); + +// Print contents of directory to stdout +CZMQ_EXPORT void + zdir_print (zdir_t *self, int indent); + +// Create a new zdir_watch actor instance: +// +// zactor_t *watch = zactor_new (zdir_watch, NULL); +// +// Destroy zdir_watch instance: +// +// zactor_destroy (&watch); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (watch, "VERBOSE"); +// +// Subscribe to changes to a directory path: +// +// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); +// +// Unsubscribe from changes to a directory path: +// +// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); +// +// Receive directory changes: +// zsock_recv (watch, "sp", &path, &patches); +// +// // Delete the received data. +// free (path); +// zlist_destroy (&patches); +CZMQ_EXPORT void + zdir_watch (zsock_t *pipe, void *unused); + +// Self test of this class. +CZMQ_EXPORT void + zdir_test (bool verbose); + +// @end + + +// Returns a sorted array of zfile objects; returns a single block of memory, +// that you destroy by calling zstr_free(). Each entry in the array is a pointer +// to a zfile_t item already allocated in the zdir tree. The array ends with +// a null pointer. Do not destroy the original zdir tree until you are done +// with this array. +CZMQ_EXPORT zfile_t ** + zdir_flatten (zdir_t *self); + +// Free a provided string, and nullify the parent pointer. Safe to call on +// a null pointer. +CZMQ_EXPORT void + zdir_flatten_free (zfile_t ***files_p); + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zdir_dump(s,i) zdir_print(s,i) + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zdir_patch.h b/phonelibs/zmq/aarch64-linux/include/zdir_patch.h new file mode 100644 index 00000000000000..8d15b9aeb40c42 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zdir_patch.h @@ -0,0 +1,82 @@ +/* ========================================================================= + zdir_patch - work with directory patches + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZDIR_PATCH_H_INCLUDED__ +#define __ZDIR_PATCH_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// un-namespaced enumeration values +#define patch_create ZDIR_PATCH_CREATE +#define patch_delete ZDIR_PATCH_DELETE + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zdir_patch.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +#define ZDIR_PATCH_CREATE 1 // Creates a new file +#define ZDIR_PATCH_DELETE 2 // Delete a file + +// Create new patch +CZMQ_EXPORT zdir_patch_t * + zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); + +// Destroy a patch +CZMQ_EXPORT void + zdir_patch_destroy (zdir_patch_t **self_p); + +// Create copy of a patch. If the patch is null, or memory was exhausted, +// returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zdir_patch_t * + zdir_patch_dup (zdir_patch_t *self); + +// Return patch file directory path +CZMQ_EXPORT const char * + zdir_patch_path (zdir_patch_t *self); + +// Return patch file item +CZMQ_EXPORT zfile_t * + zdir_patch_file (zdir_patch_t *self); + +// Return operation +CZMQ_EXPORT int + zdir_patch_op (zdir_patch_t *self); + +// Return patch virtual file path +CZMQ_EXPORT const char * + zdir_patch_vpath (zdir_patch_t *self); + +// Calculate hash digest for file (create only) +CZMQ_EXPORT void + zdir_patch_digest_set (zdir_patch_t *self); + +// Return hash digest for patch file +CZMQ_EXPORT const char * + zdir_patch_digest (zdir_patch_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zdir_patch_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zfile.h b/phonelibs/zmq/aarch64-linux/include/zfile.h new file mode 100644 index 00000000000000..75c35774b97fd1 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zfile.h @@ -0,0 +1,177 @@ +/* ========================================================================= + zfile - helper functions for working with files. + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZFILE_H_INCLUDED__ +#define __ZFILE_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zfile.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// If file exists, populates properties. CZMQ supports portable symbolic +// links, which are files with the extension ".ln". A symbolic link is a +// text file containing one line, the filename of a target file. Reading +// data from the symbolic link actually reads from the target file. Path +// may be NULL, in which case it is not used. +CZMQ_EXPORT zfile_t * + zfile_new (const char *path, const char *name); + +// Destroy a file item +CZMQ_EXPORT void + zfile_destroy (zfile_t **self_p); + +// Duplicate a file item, returns a newly constructed item. If the file +// is null, or memory was exhausted, returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zfile_t * + zfile_dup (zfile_t *self); + +// Return file name, remove path if provided +CZMQ_EXPORT const char * + zfile_filename (zfile_t *self, const char *path); + +// Refresh file properties from disk; this is not done automatically +// on access methods, otherwise it is not possible to compare directory +// snapshots. +CZMQ_EXPORT void + zfile_restat (zfile_t *self); + +// Return when the file was last modified. If you want this to reflect the +// current situation, call zfile_restat before checking this property. +CZMQ_EXPORT time_t + zfile_modified (zfile_t *self); + +// Return the last-known size of the file. If you want this to reflect the +// current situation, call zfile_restat before checking this property. +CZMQ_EXPORT off_t + zfile_cursize (zfile_t *self); + +// Return true if the file is a directory. If you want this to reflect +// any external changes, call zfile_restat before checking this property. +CZMQ_EXPORT bool + zfile_is_directory (zfile_t *self); + +// Return true if the file is a regular file. If you want this to reflect +// any external changes, call zfile_restat before checking this property. +CZMQ_EXPORT bool + zfile_is_regular (zfile_t *self); + +// Return true if the file is readable by this process. If you want this to +// reflect any external changes, call zfile_restat before checking this +// property. +CZMQ_EXPORT bool + zfile_is_readable (zfile_t *self); + +// Return true if the file is writeable by this process. If you want this +// to reflect any external changes, call zfile_restat before checking this +// property. +CZMQ_EXPORT bool + zfile_is_writeable (zfile_t *self); + +// Check if file has stopped changing and can be safely processed. +// Updates the file statistics from disk at every call. +CZMQ_EXPORT bool + zfile_is_stable (zfile_t *self); + +// Return true if the file was changed on disk since the zfile_t object +// was created, or the last zfile_restat() call made on it. +CZMQ_EXPORT bool + zfile_has_changed (zfile_t *self); + +// Remove the file from disk +CZMQ_EXPORT void + zfile_remove (zfile_t *self); + +// Open file for reading +// Returns 0 if OK, -1 if not found or not accessible +CZMQ_EXPORT int + zfile_input (zfile_t *self); + +// Open file for writing, creating directory if needed +// File is created if necessary; chunks can be written to file at any +// location. Returns 0 if OK, -1 if error. +CZMQ_EXPORT int + zfile_output (zfile_t *self); + +// Read chunk from file at specified position. If this was the last chunk, +// sets the eof property. Returns a null chunk in case of error. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zfile_read (zfile_t *self, size_t bytes, off_t offset); + +// Returns true if zfile_read() just read the last chunk in the file. +CZMQ_EXPORT bool + zfile_eof (zfile_t *self); + +// Write chunk to file at specified position +// Return 0 if OK, else -1 +CZMQ_EXPORT int + zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); + +// Read next line of text from file. Returns a pointer to the text line, +// or NULL if there was nothing more to read from the file. +CZMQ_EXPORT const char * + zfile_readln (zfile_t *self); + +// Close file, if open +CZMQ_EXPORT void + zfile_close (zfile_t *self); + +// Return file handle, if opened +CZMQ_EXPORT FILE * + zfile_handle (zfile_t *self); + +// Calculate SHA1 digest for file, using zdigest class. +CZMQ_EXPORT const char * + zfile_digest (zfile_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zfile_test (bool verbose); + +// @end + + +// @interface +// These methods are deprecated, and now moved to zsys class. +CZMQ_EXPORT bool + zfile_exists (const char *filename); +CZMQ_EXPORT ssize_t + zfile_size (const char *filename); +CZMQ_EXPORT mode_t + zfile_mode (const char *filename); +CZMQ_EXPORT int + zfile_delete (const char *filename); +CZMQ_EXPORT bool + zfile_stable (const char *filename); +CZMQ_EXPORT int + zfile_mkdir (const char *pathname); +CZMQ_EXPORT int + zfile_rmdir (const char *pathname); +CZMQ_EXPORT void + zfile_mode_private (void); +CZMQ_EXPORT void + zfile_mode_default (void); +// @end + +#ifdef __cplusplus +} +#endif + + +#endif // __ZFILE_H_INCLUDED__ diff --git a/phonelibs/zmq/aarch64-linux/include/zframe.h b/phonelibs/zmq/aarch64-linux/include/zframe.h new file mode 100644 index 00000000000000..728093c36ce117 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zframe.h @@ -0,0 +1,176 @@ +/* ========================================================================= + zframe - working with single message frames + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZFRAME_H_INCLUDED__ +#define __ZFRAME_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zframe.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +#define ZFRAME_MORE 1 // +#define ZFRAME_REUSE 2 // +#define ZFRAME_DONTWAIT 4 // + +// Create a new frame. If size is not null, allocates the frame data +// to the specified size. If additionally, data is not null, copies +// size octets from the specified data into the frame body. +CZMQ_EXPORT zframe_t * + zframe_new (const void *data, size_t size); + +// Create an empty (zero-sized) frame +CZMQ_EXPORT zframe_t * + zframe_new_empty (void); + +// Create a frame with a specified string content. +CZMQ_EXPORT zframe_t * + zframe_from (const char *string); + +// Receive frame from socket, returns zframe_t object or NULL if the recv +// was interrupted. Does a blocking recv, if you want to not block then use +// zpoller or zloop. +CZMQ_EXPORT zframe_t * + zframe_recv (void *source); + +// Destroy a frame +CZMQ_EXPORT void + zframe_destroy (zframe_t **self_p); + +// Send a frame to a socket, destroy frame after sending. +// Return -1 on error, 0 on success. +CZMQ_EXPORT int + zframe_send (zframe_t **self_p, void *dest, int flags); + +// Return number of bytes in frame data +CZMQ_EXPORT size_t + zframe_size (zframe_t *self); + +// Return address of frame data +CZMQ_EXPORT byte * + zframe_data (zframe_t *self); + +// Return meta data property for frame +// Caller must free string when finished with it. +CZMQ_EXPORT const char * + zframe_meta (zframe_t *self, const char *property); + +// Create a new frame that duplicates an existing frame. If frame is null, +// or memory was exhausted, returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zframe_dup (zframe_t *self); + +// Return frame data encoded as printable hex string, useful for 0MQ UUIDs. +// Caller must free string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zframe_strhex (zframe_t *self); + +// Return frame data copied into freshly allocated string +// Caller must free string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zframe_strdup (zframe_t *self); + +// Return TRUE if frame body is equal to string, excluding terminator +CZMQ_EXPORT bool + zframe_streq (zframe_t *self, const char *string); + +// Return frame MORE indicator (1 or 0), set when reading frame from socket +// or by the zframe_set_more() method +CZMQ_EXPORT int + zframe_more (zframe_t *self); + +// Set frame MORE indicator (1 or 0). Note this is NOT used when sending +// frame to socket, you have to specify flag explicitly. +CZMQ_EXPORT void + zframe_set_more (zframe_t *self, int more); + +// Return TRUE if two frames have identical size and data +// If either frame is NULL, equality is always false. +CZMQ_EXPORT bool + zframe_eq (zframe_t *self, zframe_t *other); + +// Set new contents for frame +CZMQ_EXPORT void + zframe_reset (zframe_t *self, const void *data, size_t size); + +// Send message to zsys log sink (may be stdout, or system facility as +// configured by zsys_set_logstream). Prefix shows before frame, if not null. +CZMQ_EXPORT void + zframe_print (zframe_t *self, const char *prefix); + +// Probe the supplied object, and report if it looks like a zframe_t. +CZMQ_EXPORT bool + zframe_is (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zframe_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Return frame routing ID, if the frame came from a ZMQ_SERVER socket. +// Else returns zero. +CZMQ_EXPORT uint32_t + zframe_routing_id (zframe_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on frame. This is used if/when the frame is sent to a +// ZMQ_SERVER socket. +CZMQ_EXPORT void + zframe_set_routing_id (zframe_t *self, uint32_t routing_id); + +// *** Draft method, for development use, may change without warning *** +// Return frame group of radio-dish pattern. +CZMQ_EXPORT const char * + zframe_group (zframe_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set group on frame. This is used if/when the frame is sent to a +// ZMQ_RADIO socket. +// Return -1 on error, 0 on success. +CZMQ_EXPORT int + zframe_set_group (zframe_t *self, const char *group); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +// DEPRECATED as poor style -- callers should use zloop or zpoller +// Receive a new frame off the socket. Returns newly allocated frame, or +// NULL if there was no input waiting, or if the read was interrupted. +CZMQ_EXPORT zframe_t * + zframe_recv_nowait (void *source); + +// DEPRECATED as inconsistent; breaks principle that logging should all go +// to a single destination. +// Print contents of the frame to FILE stream. +CZMQ_EXPORT void + zframe_fprint (zframe_t *self, const char *prefix, FILE *file); + +// Deprecated method aliases +#define zframe_print_to_stream(s,p,F) zframe_fprint(s,p,F) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zgossip.h b/phonelibs/zmq/aarch64-linux/include/zgossip.h new file mode 100644 index 00000000000000..647cb28c080731 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zgossip.h @@ -0,0 +1,95 @@ +/* ========================================================================= + zgossip - zgossip server + + ** WARNING ************************************************************* + THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose + your changes at the next build cycle. This is great for temporary printf + statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places + for commits are: + + * The XML model used for this code generation: zgossip.xml, or + * The code generation script that built this file: zproto_server_c + ************************************************************************ + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef ZGOSSIP_H_INCLUDED +#define ZGOSSIP_H_INCLUDED + +#include "czmq.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// To work with zgossip, use the CZMQ zactor API: +// +// Create new zgossip instance, passing logging prefix: +// +// zactor_t *zgossip = zactor_new (zgossip, "myname"); +// +// Destroy zgossip instance +// +// zactor_destroy (&zgossip); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (zgossip, "VERBOSE"); +// +// Bind zgossip to specified endpoint. TCP endpoints may specify +// the port number as "*" to aquire an ephemeral port: +// +// zstr_sendx (zgossip, "BIND", endpoint, NULL); +// +// Return assigned port number, specifically when BIND was done using an +// an ephemeral port: +// +// zstr_sendx (zgossip, "PORT", NULL); +// char *command, *port_str; +// zstr_recvx (zgossip, &command, &port_str, NULL); +// assert (streq (command, "PORT")); +// +// Specify configuration file to load, overwriting any previous loaded +// configuration file or options: +// +// zstr_sendx (zgossip, "LOAD", filename, NULL); +// +// Set configuration path value: +// +// zstr_sendx (zgossip, "SET", path, value, NULL); +// +// Save configuration data to config file on disk: +// +// zstr_sendx (zgossip, "SAVE", filename, NULL); +// +// Send zmsg_t instance to zgossip: +// +// zactor_send (zgossip, &msg); +// +// Receive zmsg_t instance from zgossip: +// +// zmsg_t *msg = zactor_recv (zgossip); +// +// This is the zgossip constructor as a zactor_fn: +// +CZMQ_EXPORT void + zgossip (zsock_t *pipe, void *args); + +// Self test of this class +CZMQ_EXPORT void + zgossip_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zhash.h b/phonelibs/zmq/aarch64-linux/include/zhash.h new file mode 100644 index 00000000000000..138adf63ac00e9 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zhash.h @@ -0,0 +1,182 @@ +/* ========================================================================= + zhash - generic type-free hash container (simple) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZHASH_H_INCLUDED__ +#define __ZHASH_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zhash.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Callback function for zhash_freefn method +typedef void (zhash_free_fn) ( + void *data); + +// Create a new, empty hash container +CZMQ_EXPORT zhash_t * + zhash_new (void); + +// Unpack binary frame into a new hash table. Packed data must follow format +// defined by zhash_pack. Hash table is set to autofree. An empty frame +// unpacks to an empty hash table. +CZMQ_EXPORT zhash_t * + zhash_unpack (zframe_t *frame); + +// Destroy a hash container and all items in it +CZMQ_EXPORT void + zhash_destroy (zhash_t **self_p); + +// Insert item into hash table with specified key and item. +// If key is already present returns -1 and leaves existing item unchanged +// Returns 0 on success. +CZMQ_EXPORT int + zhash_insert (zhash_t *self, const char *key, void *item); + +// Update item into hash table with specified key and item. +// If key is already present, destroys old item and inserts new one. +// Use free_fn method to ensure deallocator is properly called on item. +CZMQ_EXPORT void + zhash_update (zhash_t *self, const char *key, void *item); + +// Remove an item specified by key from the hash table. If there was no such +// item, this function does nothing. +CZMQ_EXPORT void + zhash_delete (zhash_t *self, const char *key); + +// Return the item at the specified key, or null +CZMQ_EXPORT void * + zhash_lookup (zhash_t *self, const char *key); + +// Reindexes an item from an old key to a new key. If there was no such +// item, does nothing. Returns 0 if successful, else -1. +CZMQ_EXPORT int + zhash_rename (zhash_t *self, const char *old_key, const char *new_key); + +// Set a free function for the specified hash table item. When the item is +// destroyed, the free function, if any, is called on that item. +// Use this when hash items are dynamically allocated, to ensure that +// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. +// Returns the item, or NULL if there is no such item. +CZMQ_EXPORT void * + zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); + +// Return the number of keys/items in the hash table +CZMQ_EXPORT size_t + zhash_size (zhash_t *self); + +// Make copy of hash table; if supplied table is null, returns null. +// Does not copy items themselves. Rebuilds new table so may be slow on +// very large tables. NOTE: only works with item values that are strings +// since there's no other way to know how to duplicate the item value. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zhash_t * + zhash_dup (zhash_t *self); + +// Return keys for items in table +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zhash_keys (zhash_t *self); + +// Simple iterator; returns first item in hash table, in no given order, +// or NULL if the table is empty. This method is simpler to use than the +// foreach() method, which is deprecated. To access the key for this item +// use zhash_cursor(). NOTE: do NOT modify the table while iterating. +CZMQ_EXPORT void * + zhash_first (zhash_t *self); + +// Simple iterator; returns next item in hash table, in no given order, +// or NULL if the last item was already returned. Use this together with +// zhash_first() to process all items in a hash table. If you need the +// items in sorted order, use zhash_keys() and then zlist_sort(). To +// access the key for this item use zhash_cursor(). NOTE: do NOT modify +// the table while iterating. +CZMQ_EXPORT void * + zhash_next (zhash_t *self); + +// After a successful first/next method, returns the key for the item that +// was returned. This is a constant string that you may not modify or +// deallocate, and which lasts as long as the item in the hash. After an +// unsuccessful first/next, returns NULL. +CZMQ_EXPORT const char * + zhash_cursor (zhash_t *self); + +// Add a comment to hash table before saving to disk. You can add as many +// comment lines as you like. These comment lines are discarded when loading +// the file. If you use a null format, all comments are deleted. +CZMQ_EXPORT void + zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Serialize hash table to a binary frame that can be sent in a message. +// The packed format is compatible with the 'dictionary' type defined in +// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: +// +// ; A list of name/value pairs +// dictionary = dict-count *( dict-name dict-value ) +// dict-count = number-4 +// dict-value = longstr +// dict-name = string +// +// ; Strings are always length + text contents +// longstr = number-4 *VCHAR +// string = number-1 *VCHAR +// +// ; Numbers are unsigned integers in network byte order +// number-1 = 1OCTET +// number-4 = 4OCTET +// +// Comments are not included in the packed data. Item values MUST be +// strings. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zhash_pack (zhash_t *self); + +// Save hash table to a text file in name=value format. Hash values must be +// printable strings; keys may not contain '=' character. Returns 0 if OK, +// else -1 if a file error occurred. +CZMQ_EXPORT int + zhash_save (zhash_t *self, const char *filename); + +// Load hash table from a text file in name=value format; hash table must +// already exist. Hash values must printable strings; keys may not contain +// '=' character. Returns 0 if OK, else -1 if a file was not readable. +CZMQ_EXPORT int + zhash_load (zhash_t *self, const char *filename); + +// When a hash table was loaded from a file by zhash_load, this method will +// reload the file if it has been modified since, and is "stable", i.e. not +// still changing. Returns 0 if OK, -1 if there was an error reloading the +// file. +CZMQ_EXPORT int + zhash_refresh (zhash_t *self); + +// Set hash for automatic value destruction +CZMQ_EXPORT void + zhash_autofree (zhash_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zhash_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zhashx.h b/phonelibs/zmq/aarch64-linux/include/zhashx.h new file mode 100644 index 00000000000000..360a773ee88ec1 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zhashx.h @@ -0,0 +1,277 @@ +/* ========================================================================= + zhashx - extended generic type-free hash container + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZHASHX_H_INCLUDED__ +#define __ZHASHX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zhashx.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Destroy an item +typedef void (zhashx_destructor_fn) ( + void **item); + +// Duplicate an item +typedef void * (zhashx_duplicator_fn) ( + const void *item); + +// Compare two items, for sorting +typedef int (zhashx_comparator_fn) ( + const void *item1, const void *item2); + +// compare two items, for sorting +typedef void (zhashx_free_fn) ( + void *data); + +// compare two items, for sorting +typedef size_t (zhashx_hash_fn) ( + const void *key); + +// Serializes an item to a longstr. +// The caller takes ownership of the newly created object. +typedef char * (zhashx_serializer_fn) ( + const void *item); + +// Deserializes a longstr into an item. +// The caller takes ownership of the newly created object. +typedef void * (zhashx_deserializer_fn) ( + const char *item_str); + +// Create a new, empty hash container +CZMQ_EXPORT zhashx_t * + zhashx_new (void); + +// Unpack binary frame into a new hash table. Packed data must follow format +// defined by zhashx_pack. Hash table is set to autofree. An empty frame +// unpacks to an empty hash table. +CZMQ_EXPORT zhashx_t * + zhashx_unpack (zframe_t *frame); + +// Destroy a hash container and all items in it +CZMQ_EXPORT void + zhashx_destroy (zhashx_t **self_p); + +// Insert item into hash table with specified key and item. +// If key is already present returns -1 and leaves existing item unchanged +// Returns 0 on success. +CZMQ_EXPORT int + zhashx_insert (zhashx_t *self, const void *key, void *item); + +// Update or insert item into hash table with specified key and item. If the +// key is already present, destroys old item and inserts new one. If you set +// a container item destructor, this is called on the old value. If the key +// was not already present, inserts a new item. Sets the hash cursor to the +// new item. +CZMQ_EXPORT void + zhashx_update (zhashx_t *self, const void *key, void *item); + +// Remove an item specified by key from the hash table. If there was no such +// item, this function does nothing. +CZMQ_EXPORT void + zhashx_delete (zhashx_t *self, const void *key); + +// Delete all items from the hash table. If the key destructor is +// set, calls it on every key. If the item destructor is set, calls +// it on every item. +CZMQ_EXPORT void + zhashx_purge (zhashx_t *self); + +// Return the item at the specified key, or null +CZMQ_EXPORT void * + zhashx_lookup (zhashx_t *self, const void *key); + +// Reindexes an item from an old key to a new key. If there was no such +// item, does nothing. Returns 0 if successful, else -1. +CZMQ_EXPORT int + zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); + +// Set a free function for the specified hash table item. When the item is +// destroyed, the free function, if any, is called on that item. +// Use this when hash items are dynamically allocated, to ensure that +// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. +// Returns the item, or NULL if there is no such item. +CZMQ_EXPORT void * + zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); + +// Return the number of keys/items in the hash table +CZMQ_EXPORT size_t + zhashx_size (zhashx_t *self); + +// Return a zlistx_t containing the keys for the items in the +// table. Uses the key_duplicator to duplicate all keys and sets the +// key_destructor as destructor for the list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlistx_t * + zhashx_keys (zhashx_t *self); + +// Return a zlistx_t containing the values for the items in the +// table. Uses the duplicator to duplicate all items and sets the +// destructor as destructor for the list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlistx_t * + zhashx_values (zhashx_t *self); + +// Simple iterator; returns first item in hash table, in no given order, +// or NULL if the table is empty. This method is simpler to use than the +// foreach() method, which is deprecated. To access the key for this item +// use zhashx_cursor(). NOTE: do NOT modify the table while iterating. +CZMQ_EXPORT void * + zhashx_first (zhashx_t *self); + +// Simple iterator; returns next item in hash table, in no given order, +// or NULL if the last item was already returned. Use this together with +// zhashx_first() to process all items in a hash table. If you need the +// items in sorted order, use zhashx_keys() and then zlistx_sort(). To +// access the key for this item use zhashx_cursor(). NOTE: do NOT modify +// the table while iterating. +CZMQ_EXPORT void * + zhashx_next (zhashx_t *self); + +// After a successful first/next method, returns the key for the item that +// was returned. This is a constant string that you may not modify or +// deallocate, and which lasts as long as the item in the hash. After an +// unsuccessful first/next, returns NULL. +CZMQ_EXPORT const void * + zhashx_cursor (zhashx_t *self); + +// Add a comment to hash table before saving to disk. You can add as many +// comment lines as you like. These comment lines are discarded when loading +// the file. If you use a null format, all comments are deleted. +CZMQ_EXPORT void + zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Save hash table to a text file in name=value format. Hash values must be +// printable strings; keys may not contain '=' character. Returns 0 if OK, +// else -1 if a file error occurred. +CZMQ_EXPORT int + zhashx_save (zhashx_t *self, const char *filename); + +// Load hash table from a text file in name=value format; hash table must +// already exist. Hash values must printable strings; keys may not contain +// '=' character. Returns 0 if OK, else -1 if a file was not readable. +CZMQ_EXPORT int + zhashx_load (zhashx_t *self, const char *filename); + +// When a hash table was loaded from a file by zhashx_load, this method will +// reload the file if it has been modified since, and is "stable", i.e. not +// still changing. Returns 0 if OK, -1 if there was an error reloading the +// file. +CZMQ_EXPORT int + zhashx_refresh (zhashx_t *self); + +// Serialize hash table to a binary frame that can be sent in a message. +// The packed format is compatible with the 'dictionary' type defined in +// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: +// +// ; A list of name/value pairs +// dictionary = dict-count *( dict-name dict-value ) +// dict-count = number-4 +// dict-value = longstr +// dict-name = string +// +// ; Strings are always length + text contents +// longstr = number-4 *VCHAR +// string = number-1 *VCHAR +// +// ; Numbers are unsigned integers in network byte order +// number-1 = 1OCTET +// number-4 = 4OCTET +// +// Comments are not included in the packed data. Item values MUST be +// strings. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zhashx_pack (zhashx_t *self); + +// Make a copy of the list; items are duplicated if you set a duplicator +// for the list, otherwise not. Copying a null reference returns a null +// reference. Note that this method's behavior changed slightly for CZMQ +// v3.x, as it does not set nor respect autofree. It does however let you +// duplicate any hash table safely. The old behavior is in zhashx_dup_v2. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zhashx_t * + zhashx_dup (zhashx_t *self); + +// Set a user-defined deallocator for hash items; by default items are not +// freed when the hash is destroyed. +CZMQ_EXPORT void + zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); + +// Set a user-defined duplicator for hash items; by default items are not +// copied when the hash is duplicated. +CZMQ_EXPORT void + zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); + +// Set a user-defined deallocator for keys; by default keys are freed +// when the hash is destroyed using free(). +CZMQ_EXPORT void + zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); + +// Set a user-defined duplicator for keys; by default keys are duplicated +// using strdup. +CZMQ_EXPORT void + zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); + +// Set a user-defined comparator for keys; by default keys are +// compared using strcmp. +CZMQ_EXPORT void + zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); + +// Set a user-defined comparator for keys; by default keys are +// compared using strcmp. +CZMQ_EXPORT void + zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); + +// Make copy of hash table; if supplied table is null, returns null. +// Does not copy items themselves. Rebuilds new table so may be slow on +// very large tables. NOTE: only works with item values that are strings +// since there's no other way to know how to duplicate the item value. +CZMQ_EXPORT zhashx_t * + zhashx_dup_v2 (zhashx_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zhashx_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Same as unpack but uses a user-defined deserializer function to convert +// a longstr back into item format. +CZMQ_EXPORT zhashx_t * + zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); + +// *** Draft method, for development use, may change without warning *** +// Same as pack but uses a user-defined serializer function to convert items +// into longstr. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/ziflist.h b/phonelibs/zmq/aarch64-linux/include/ziflist.h new file mode 100644 index 00000000000000..cb2b1448025f89 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/ziflist.h @@ -0,0 +1,77 @@ +/* ========================================================================= + ziflist - List of network interfaces available on system + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZIFLIST_H_INCLUDED__ +#define __ZIFLIST_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/ziflist.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Get a list of network interfaces currently defined on the system +CZMQ_EXPORT ziflist_t * + ziflist_new (void); + +// Destroy a ziflist instance +CZMQ_EXPORT void + ziflist_destroy (ziflist_t **self_p); + +// Reload network interfaces from system +CZMQ_EXPORT void + ziflist_reload (ziflist_t *self); + +// Return the number of network interfaces on system +CZMQ_EXPORT size_t + ziflist_size (ziflist_t *self); + +// Get first network interface, return NULL if there are none +CZMQ_EXPORT const char * + ziflist_first (ziflist_t *self); + +// Get next network interface, return NULL if we hit the last one +CZMQ_EXPORT const char * + ziflist_next (ziflist_t *self); + +// Return the current interface IP address as a printable string +CZMQ_EXPORT const char * + ziflist_address (ziflist_t *self); + +// Return the current interface broadcast address as a printable string +CZMQ_EXPORT const char * + ziflist_broadcast (ziflist_t *self); + +// Return the current interface network mask as a printable string +CZMQ_EXPORT const char * + ziflist_netmask (ziflist_t *self); + +// Return the list of interfaces. +CZMQ_EXPORT void + ziflist_print (ziflist_t *self); + +// Self test of this class. +CZMQ_EXPORT void + ziflist_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zlist.h b/phonelibs/zmq/aarch64-linux/include/zlist.h new file mode 100644 index 00000000000000..1dcd39b9955c9e --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zlist.h @@ -0,0 +1,158 @@ +/* ========================================================================= + zlist - simple generic list container + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZLIST_H_INCLUDED__ +#define __ZLIST_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zlist.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Comparison function e.g. for sorting and removing. +typedef int (zlist_compare_fn) ( + void *item1, void *item2); + +// Callback function for zlist_freefn method +typedef void (zlist_free_fn) ( + void *data); + +// Create a new list container +CZMQ_EXPORT zlist_t * + zlist_new (void); + +// Destroy a list container +CZMQ_EXPORT void + zlist_destroy (zlist_t **self_p); + +// Return the item at the head of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the head item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlist_first (zlist_t *self); + +// Return the next item. If the list is empty, returns NULL. To move to +// the start of the list call zlist_first (). Advances the cursor. +CZMQ_EXPORT void * + zlist_next (zlist_t *self); + +// Return the item at the tail of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the tail item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlist_last (zlist_t *self); + +// Return first item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlist_head (zlist_t *self); + +// Return last item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlist_tail (zlist_t *self); + +// Return the current item of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the current item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlist_item (zlist_t *self); + +// Append an item to the end of the list, return 0 if OK or -1 if this +// failed for some reason (out of memory). Note that if a duplicator has +// been set, this method will also duplicate the item. +CZMQ_EXPORT int + zlist_append (zlist_t *self, void *item); + +// Push an item to the start of the list, return 0 if OK or -1 if this +// failed for some reason (out of memory). Note that if a duplicator has +// been set, this method will also duplicate the item. +CZMQ_EXPORT int + zlist_push (zlist_t *self, void *item); + +// Pop the item off the start of the list, if any +CZMQ_EXPORT void * + zlist_pop (zlist_t *self); + +// Checks if an item already is present. Uses compare method to determine if +// items are equal. If the compare method is NULL the check will only compare +// pointers. Returns true if item is present else false. +CZMQ_EXPORT bool + zlist_exists (zlist_t *self, void *item); + +// Remove the specified item from the list if present +CZMQ_EXPORT void + zlist_remove (zlist_t *self, void *item); + +// Make a copy of list. If the list has autofree set, the copied list will +// duplicate all items, which must be strings. Otherwise, the list will hold +// pointers back to the items in the original list. If list is null, returns +// NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zlist_dup (zlist_t *self); + +// Purge all items from list +CZMQ_EXPORT void + zlist_purge (zlist_t *self); + +// Return number of items in the list +CZMQ_EXPORT size_t + zlist_size (zlist_t *self); + +// Sort the list. If the compare function is null, sorts the list by +// ascending key value using a straight ASCII comparison. If you specify +// a compare function, this decides how items are sorted. The sort is not +// stable, so may reorder items with the same keys. The algorithm used is +// combsort, a compromise between performance and simplicity. +CZMQ_EXPORT void + zlist_sort (zlist_t *self, zlist_compare_fn compare); + +// Set list for automatic item destruction; item values MUST be strings. +// By default a list item refers to a value held elsewhere. When you set +// this, each time you append or push a list item, zlist will take a copy +// of the string value. Then, when you destroy the list, it will free all +// item values automatically. If you use any other technique to allocate +// list values, you must free them explicitly before destroying the list. +// The usual technique is to pop list items and destroy them, until the +// list is empty. +CZMQ_EXPORT void + zlist_autofree (zlist_t *self); + +// Sets a compare function for this list. The function compares two items. +// It returns an integer less than, equal to, or greater than zero if the +// first item is found, respectively, to be less than, to match, or be +// greater than the second item. +// This function is used for sorting, removal and exists checking. +CZMQ_EXPORT void + zlist_comparefn (zlist_t *self, zlist_compare_fn fn); + +// Set a free function for the specified list item. When the item is +// destroyed, the free function, if any, is called on that item. +// Use this when list items are dynamically allocated, to ensure that +// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. +// Returns the item, or NULL if there is no such item. +CZMQ_EXPORT void * + zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); + +// Self test of this class. +CZMQ_EXPORT void + zlist_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zlistx.h b/phonelibs/zmq/aarch64-linux/include/zlistx.h new file mode 100644 index 00000000000000..512637cef3bff5 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zlistx.h @@ -0,0 +1,205 @@ +/* ========================================================================= + zlistx - extended generic list container + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZLISTX_H_INCLUDED__ +#define __ZLISTX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zlistx.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Destroy an item +typedef void (zlistx_destructor_fn) ( + void **item); + +// Duplicate an item +typedef void * (zlistx_duplicator_fn) ( + const void *item); + +// Compare two items, for sorting +typedef int (zlistx_comparator_fn) ( + const void *item1, const void *item2); + +// Create a new, empty list. +CZMQ_EXPORT zlistx_t * + zlistx_new (void); + +// Destroy a list. If an item destructor was specified, all items in the +// list are automatically destroyed as well. +CZMQ_EXPORT void + zlistx_destroy (zlistx_t **self_p); + +// Add an item to the head of the list. Calls the item duplicator, if any, +// on the item. Resets cursor to list head. Returns an item handle on +// success, NULL if memory was exhausted. +CZMQ_EXPORT void * + zlistx_add_start (zlistx_t *self, void *item); + +// Add an item to the tail of the list. Calls the item duplicator, if any, +// on the item. Resets cursor to list head. Returns an item handle on +// success, NULL if memory was exhausted. +CZMQ_EXPORT void * + zlistx_add_end (zlistx_t *self, void *item); + +// Return the number of items in the list +CZMQ_EXPORT size_t + zlistx_size (zlistx_t *self); + +// Return first item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlistx_head (zlistx_t *self); + +// Return last item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlistx_tail (zlistx_t *self); + +// Return the item at the head of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the head item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlistx_first (zlistx_t *self); + +// Return the next item. At the end of the list (or in an empty list), +// returns NULL. Use repeated zlistx_next () calls to work through the list +// from zlistx_first (). First time, acts as zlistx_first(). +CZMQ_EXPORT void * + zlistx_next (zlistx_t *self); + +// Return the previous item. At the start of the list (or in an empty list), +// returns NULL. Use repeated zlistx_prev () calls to work through the list +// backwards from zlistx_last (). First time, acts as zlistx_last(). +CZMQ_EXPORT void * + zlistx_prev (zlistx_t *self); + +// Return the item at the tail of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the tail item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlistx_last (zlistx_t *self); + +// Returns the value of the item at the cursor, or NULL if the cursor is +// not pointing to an item. +CZMQ_EXPORT void * + zlistx_item (zlistx_t *self); + +// Returns the handle of the item at the cursor, or NULL if the cursor is +// not pointing to an item. +CZMQ_EXPORT void * + zlistx_cursor (zlistx_t *self); + +// Returns the item associated with the given list handle, or NULL if passed +// in handle is NULL. Asserts that the passed in handle points to a list element. +CZMQ_EXPORT void * + zlistx_handle_item (void *handle); + +// Find an item in the list, searching from the start. Uses the item +// comparator, if any, else compares item values directly. Returns the +// item handle found, or NULL. Sets the cursor to the found item, if any. +CZMQ_EXPORT void * + zlistx_find (zlistx_t *self, void *item); + +// Detach an item from the list, using its handle. The item is not modified, +// and the caller is responsible for destroying it if necessary. If handle is +// null, detaches the first item on the list. Returns item that was detached, +// or null if none was. If cursor was at item, moves cursor to previous item, +// so you can detach items while iterating forwards through a list. +CZMQ_EXPORT void * + zlistx_detach (zlistx_t *self, void *handle); + +// Detach item at the cursor, if any, from the list. The item is not modified, +// and the caller is responsible for destroying it as necessary. Returns item +// that was detached, or null if none was. Moves cursor to previous item, so +// you can detach items while iterating forwards through a list. +CZMQ_EXPORT void * + zlistx_detach_cur (zlistx_t *self); + +// Delete an item, using its handle. Calls the item destructor is any is +// set. If handle is null, deletes the first item on the list. Returns 0 +// if an item was deleted, -1 if not. If cursor was at item, moves cursor +// to previous item, so you can delete items while iterating forwards +// through a list. +CZMQ_EXPORT int + zlistx_delete (zlistx_t *self, void *handle); + +// Move an item to the start of the list, via its handle. +CZMQ_EXPORT void + zlistx_move_start (zlistx_t *self, void *handle); + +// Move an item to the end of the list, via its handle. +CZMQ_EXPORT void + zlistx_move_end (zlistx_t *self, void *handle); + +// Remove all items from the list, and destroy them if the item destructor +// is set. +CZMQ_EXPORT void + zlistx_purge (zlistx_t *self); + +// Sort the list. If an item comparator was set, calls that to compare +// items, otherwise compares on item value. The sort is not stable, so may +// reorder equal items. +CZMQ_EXPORT void + zlistx_sort (zlistx_t *self); + +// Create a new node and insert it into a sorted list. Calls the item +// duplicator, if any, on the item. If low_value is true, starts searching +// from the start of the list, otherwise searches from the end. Use the item +// comparator, if any, to find where to place the new node. Returns a handle +// to the new node, or NULL if memory was exhausted. Resets the cursor to the +// list head. +CZMQ_EXPORT void * + zlistx_insert (zlistx_t *self, void *item, bool low_value); + +// Move an item, specified by handle, into position in a sorted list. Uses +// the item comparator, if any, to determine the new location. If low_value +// is true, starts searching from the start of the list, otherwise searches +// from the end. +CZMQ_EXPORT void + zlistx_reorder (zlistx_t *self, void *handle, bool low_value); + +// Make a copy of the list; items are duplicated if you set a duplicator +// for the list, otherwise not. Copying a null reference returns a null +// reference. +CZMQ_EXPORT zlistx_t * + zlistx_dup (zlistx_t *self); + +// Set a user-defined deallocator for list items; by default items are not +// freed when the list is destroyed. +CZMQ_EXPORT void + zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); + +// Set a user-defined duplicator for list items; by default items are not +// copied when the list is duplicated. +CZMQ_EXPORT void + zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); + +// Set a user-defined comparator for zlistx_find and zlistx_sort; the method +// must return -1, 0, or 1 depending on whether item1 is less than, equal to, +// or greater than, item2. +CZMQ_EXPORT void + zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); + +// Self test of this class. +CZMQ_EXPORT void + zlistx_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zloop.h b/phonelibs/zmq/aarch64-linux/include/zloop.h new file mode 100644 index 00000000000000..83f46f282aa2ec --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zloop.h @@ -0,0 +1,163 @@ +/* ========================================================================= + zloop - event-driven reactor + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZLOOP_H_INCLUDED__ +#define __ZLOOP_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zloop.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Callback function for reactor socket activity +typedef int (zloop_reader_fn) ( + zloop_t *loop, zsock_t *reader, void *arg); + +// Callback function for reactor events (low-level) +typedef int (zloop_fn) ( + zloop_t *loop, zmq_pollitem_t *item, void *arg); + +// Callback for reactor timer events +typedef int (zloop_timer_fn) ( + zloop_t *loop, int timer_id, void *arg); + +// Create a new zloop reactor +CZMQ_EXPORT zloop_t * + zloop_new (void); + +// Destroy a reactor +CZMQ_EXPORT void + zloop_destroy (zloop_t **self_p); + +// Register socket reader with the reactor. When the reader has messages, +// the reactor will call the handler, passing the arg. Returns 0 if OK, -1 +// if there was an error. If you register the same socket more than once, +// each instance will invoke its corresponding handler. +CZMQ_EXPORT int + zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); + +// Cancel a socket reader from the reactor. If multiple readers exist for +// same socket, cancels ALL of them. +CZMQ_EXPORT void + zloop_reader_end (zloop_t *self, zsock_t *sock); + +// Configure a registered reader to ignore errors. If you do not set this, +// then readers that have errors are removed from the reactor silently. +CZMQ_EXPORT void + zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); + +// Register low-level libzmq pollitem with the reactor. When the pollitem +// is ready, will call the handler, passing the arg. Returns 0 if OK, -1 +// if there was an error. If you register the pollitem more than once, each +// instance will invoke its corresponding handler. A pollitem with +// socket=NULL and fd=0 means 'poll on FD zero'. +CZMQ_EXPORT int + zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); + +// Cancel a pollitem from the reactor, specified by socket or FD. If both +// are specified, uses only socket. If multiple poll items exist for same +// socket/FD, cancels ALL of them. +CZMQ_EXPORT void + zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); + +// Configure a registered poller to ignore errors. If you do not set this, +// then poller that have errors are removed from the reactor silently. +CZMQ_EXPORT void + zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); + +// Register a timer that expires after some delay and repeats some number of +// times. At each expiry, will call the handler, passing the arg. To run a +// timer forever, use 0 times. Returns a timer_id that is used to cancel the +// timer in the future. Returns -1 if there was an error. +CZMQ_EXPORT int + zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); + +// Cancel a specific timer identified by a specific timer_id (as returned by +// zloop_timer). +CZMQ_EXPORT int + zloop_timer_end (zloop_t *self, int timer_id); + +// Register a ticket timer. Ticket timers are very fast in the case where +// you use a lot of timers (thousands), and frequently remove and add them. +// The main use case is expiry timers for servers that handle many clients, +// and which reset the expiry timer for each message received from a client. +// Whereas normal timers perform poorly as the number of clients grows, the +// cost of ticket timers is constant, no matter the number of clients. You +// must set the ticket delay using zloop_set_ticket_delay before creating a +// ticket. Returns a handle to the timer that you should use in +// zloop_ticket_reset and zloop_ticket_delete. +CZMQ_EXPORT void * + zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); + +// Reset a ticket timer, which moves it to the end of the ticket list and +// resets its execution time. This is a very fast operation. +CZMQ_EXPORT void + zloop_ticket_reset (zloop_t *self, void *handle); + +// Delete a ticket timer. We do not actually delete the ticket here, as +// other code may still refer to the ticket. We mark as deleted, and remove +// later and safely. +CZMQ_EXPORT void + zloop_ticket_delete (zloop_t *self, void *handle); + +// Set the ticket delay, which applies to all tickets. If you lower the +// delay and there are already tickets created, the results are undefined. +CZMQ_EXPORT void + zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); + +// Set hard limit on number of timers allowed. Setting more than a small +// number of timers (10-100) can have a dramatic impact on the performance +// of the reactor. For high-volume cases, use ticket timers. If the hard +// limit is reached, the reactor stops creating new timers and logs an +// error. +CZMQ_EXPORT void + zloop_set_max_timers (zloop_t *self, size_t max_timers); + +// Set verbose tracing of reactor on/off. The default verbose setting is +// off (false). +CZMQ_EXPORT void + zloop_set_verbose (zloop_t *self, bool verbose); + +// By default the reactor stops if the process receives a SIGINT or SIGTERM +// signal. This makes it impossible to shut-down message based architectures +// like zactors. This method lets you switch off break handling. The default +// nonstop setting is off (false). +CZMQ_EXPORT void + zloop_set_nonstop (zloop_t *self, bool nonstop); + +// Start the reactor. Takes control of the thread and returns when the 0MQ +// context is terminated or the process is interrupted, or any event handler +// returns -1. Event handlers may register new sockets and timers, and +// cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. +CZMQ_EXPORT int + zloop_start (zloop_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zloop_test (bool verbose); + +// @end + + +// Deprecated method aliases +#define zloop_set_tolerant(s,i) zloop_poller_set_tolerant(s,i) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zmonitor.h b/phonelibs/zmq/aarch64-linux/include/zmonitor.h new file mode 100644 index 00000000000000..b490bcb1a0dfbc --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zmonitor.h @@ -0,0 +1,73 @@ +/* ========================================================================= + zmonitor - socket event monitor + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMONITOR_H_INCLUDED__ +#define __ZMONITOR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create new zmonitor actor instance to monitor a zsock_t socket: +// +// zactor_t *monitor = zactor_new (zmonitor, mysocket); +// +// Destroy zmonitor instance. +// +// zactor_destroy (&monitor); +// +// Enable verbose logging of commands and activity. +// +// zstr_send (monitor, "VERBOSE"); +// +// Listen to monitor event type (zero or types, ending in NULL): +// zstr_sendx (monitor, "LISTEN", type, ..., NULL); +// +// Events: +// CONNECTED +// CONNECT_DELAYED +// CONNECT_RETRIED +// LISTENING +// BIND_FAILED +// ACCEPTED +// ACCEPT_FAILED +// CLOSED +// CLOSE_FAILED +// DISCONNECTED +// MONITOR_STOPPED +// ALL +// +// Start monitor; after this, any further LISTEN commands are ignored. +// +// zstr_send (monitor, "START"); +// zsock_wait (monitor); +// +// Receive next monitor event: +// +// zmsg_t *msg = zmsg_recv (monitor); +// +// This is the zmonitor constructor as a zactor_fn; the argument can be +// a zactor_t, zsock_t, or libzmq void * socket: +CZMQ_EXPORT void + zmonitor (zsock_t *pipe, void *sock); + +// Selftest +CZMQ_EXPORT void + zmonitor_test (bool verbose); +// @end +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zmq.h b/phonelibs/zmq/aarch64-linux/include/zmq.h new file mode 100644 index 00000000000000..21a78eb6576be2 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zmq.h @@ -0,0 +1,643 @@ +/* + Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file + + This file is part of libzmq, the ZeroMQ core engine in C++. + + libzmq is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + As a special exception, the Contributors give you permission to link + this library with independent modules to produce an executable, + regardless of the license terms of these independent modules, and to + copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the + terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. + If you modify this library, you must extend this exception to your + version of the library. + + libzmq 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 program. If not, see . + + ************************************************************************* + NOTE to contributors. This file comprises the principal public contract + for ZeroMQ API users. Any change to this file supplied in a stable + release SHOULD not break existing applications. + In practice this means that the value of constants must not change, and + that old values may not be reused for new constants. + ************************************************************************* +*/ + +#ifndef __ZMQ_H_INCLUDED__ +#define __ZMQ_H_INCLUDED__ + +/* Version macros for compile-time API version detection */ +#define ZMQ_VERSION_MAJOR 4 +#define ZMQ_VERSION_MINOR 2 +#define ZMQ_VERSION_PATCH 2 + +#define ZMQ_MAKE_VERSION(major, minor, patch) \ + ((major) * 10000 + (minor) * 100 + (patch)) +#define ZMQ_VERSION \ + ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined _WIN32_WCE +#include +#endif +#include +#include +#if defined _WIN32 +// Set target version to Windows Server 2008, Windows Vista or higher. +// Windows XP (0x0501) is supported but without client & server socket types. +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif + +#ifdef __MINGW32__ +// Require Windows XP or higher with MinGW for getaddrinfo(). +#if(_WIN32_WINNT >= 0x0600) +#else +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#endif +#include +#endif + +/* Handle DSO symbol visibility */ +#if defined _WIN32 +# if defined ZMQ_STATIC +# define ZMQ_EXPORT +# elif defined DLL_EXPORT +# define ZMQ_EXPORT __declspec(dllexport) +# else +# define ZMQ_EXPORT __declspec(dllimport) +# endif +#else +# if defined __SUNPRO_C || defined __SUNPRO_CC +# define ZMQ_EXPORT __global +# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER +# define ZMQ_EXPORT __attribute__ ((visibility("default"))) +# else +# define ZMQ_EXPORT +# endif +#endif + +/* Define integer types needed for event interface */ +#define ZMQ_DEFINED_STDINT 1 +#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS +# include +#elif defined _MSC_VER && _MSC_VER < 1600 +# ifndef int32_t + typedef __int32 int32_t; +# endif +# ifndef uint16_t + typedef unsigned __int16 uint16_t; +# endif +# ifndef uint8_t + typedef unsigned __int8 uint8_t; +# endif +#else +# include +#endif + +// 32-bit AIX's pollfd struct members are called reqevents and rtnevents so it +// defines compatibility macros for them. Need to include that header first to +// stop build failures since zmq_pollset_t defines them as events and revents. +#ifdef ZMQ_HAVE_AIX + #include +#endif + + +/******************************************************************************/ +/* 0MQ errors. */ +/******************************************************************************/ + +/* A number random enough not to collide with different errno ranges on */ +/* different OSes. The assumption is that error_t is at least 32-bit type. */ +#define ZMQ_HAUSNUMERO 156384712 + +/* On Windows platform some of the standard POSIX errnos are not defined. */ +#ifndef ENOTSUP +#define ENOTSUP (ZMQ_HAUSNUMERO + 1) +#endif +#ifndef EPROTONOSUPPORT +#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) +#endif +#ifndef ENOBUFS +#define ENOBUFS (ZMQ_HAUSNUMERO + 3) +#endif +#ifndef ENETDOWN +#define ENETDOWN (ZMQ_HAUSNUMERO + 4) +#endif +#ifndef EADDRINUSE +#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) +#endif +#ifndef EADDRNOTAVAIL +#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) +#endif +#ifndef ECONNREFUSED +#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) +#endif +#ifndef EINPROGRESS +#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) +#endif +#ifndef ENOTSOCK +#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) +#endif +#ifndef EMSGSIZE +#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) +#endif +#ifndef EAFNOSUPPORT +#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) +#endif +#ifndef ENETUNREACH +#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) +#endif +#ifndef ECONNABORTED +#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) +#endif +#ifndef ECONNRESET +#define ECONNRESET (ZMQ_HAUSNUMERO + 14) +#endif +#ifndef ENOTCONN +#define ENOTCONN (ZMQ_HAUSNUMERO + 15) +#endif +#ifndef ETIMEDOUT +#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) +#endif +#ifndef EHOSTUNREACH +#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) +#endif +#ifndef ENETRESET +#define ENETRESET (ZMQ_HAUSNUMERO + 18) +#endif + +/* Native 0MQ error codes. */ +#define EFSM (ZMQ_HAUSNUMERO + 51) +#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) +#define ETERM (ZMQ_HAUSNUMERO + 53) +#define EMTHREAD (ZMQ_HAUSNUMERO + 54) + +/* This function retrieves the errno as it is known to 0MQ library. The goal */ +/* of this function is to make the code 100% portable, including where 0MQ */ +/* compiled with certain CRT library (on Windows) is linked to an */ +/* application that uses different CRT library. */ +ZMQ_EXPORT int zmq_errno (void); + +/* Resolves system errors and 0MQ errors to human-readable string. */ +ZMQ_EXPORT const char *zmq_strerror (int errnum); + +/* Run-time API version detection */ +ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); + +/******************************************************************************/ +/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ +/******************************************************************************/ + +/* Context options */ +#define ZMQ_IO_THREADS 1 +#define ZMQ_MAX_SOCKETS 2 +#define ZMQ_SOCKET_LIMIT 3 +#define ZMQ_THREAD_PRIORITY 3 +#define ZMQ_THREAD_SCHED_POLICY 4 +#define ZMQ_MAX_MSGSZ 5 + +/* Default for new contexts */ +#define ZMQ_IO_THREADS_DFLT 1 +#define ZMQ_MAX_SOCKETS_DFLT 1023 +#define ZMQ_THREAD_PRIORITY_DFLT -1 +#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 + +ZMQ_EXPORT void *zmq_ctx_new (void); +ZMQ_EXPORT int zmq_ctx_term (void *context); +ZMQ_EXPORT int zmq_ctx_shutdown (void *context); +ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); +ZMQ_EXPORT int zmq_ctx_get (void *context, int option); + +/* Old (legacy) API */ +ZMQ_EXPORT void *zmq_init (int io_threads); +ZMQ_EXPORT int zmq_term (void *context); +ZMQ_EXPORT int zmq_ctx_destroy (void *context); + + +/******************************************************************************/ +/* 0MQ message definition. */ +/******************************************************************************/ + +/* Some architectures, like sparc64 and some variants of aarch64, enforce pointer + * alignment and raise sigbus on violations. Make sure applications allocate + * zmq_msg_t on addresses aligned on a pointer-size boundary to avoid this issue. + */ +typedef struct zmq_msg_t { +#if defined (__GNUC__) || defined ( __INTEL_COMPILER) || \ + (defined (__SUNPRO_C) && __SUNPRO_C >= 0x590) || \ + (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x590) + unsigned char _ [64] __attribute__ ((aligned (sizeof (void *)))); +#elif defined (_MSC_VER) && (defined (_M_X64) || defined (_M_ARM64)) + __declspec (align (8)) unsigned char _ [64]; +#elif defined (_MSC_VER) && (defined (_M_IX86) || defined (_M_ARM_ARMV7VE)) + __declspec (align (4)) unsigned char _ [64]; +#else + unsigned char _ [64]; +#endif +} zmq_msg_t; + +typedef void (zmq_free_fn) (void *data, void *hint); + +ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); +ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, + size_t size, zmq_free_fn *ffn, void *hint); +ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); +ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); +ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); +ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); +ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); +ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); +ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); +ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); + +/******************************************************************************/ +/* 0MQ socket definition. */ +/******************************************************************************/ + +/* Socket types. */ +#define ZMQ_PAIR 0 +#define ZMQ_PUB 1 +#define ZMQ_SUB 2 +#define ZMQ_REQ 3 +#define ZMQ_REP 4 +#define ZMQ_DEALER 5 +#define ZMQ_ROUTER 6 +#define ZMQ_PULL 7 +#define ZMQ_PUSH 8 +#define ZMQ_XPUB 9 +#define ZMQ_XSUB 10 +#define ZMQ_STREAM 11 + +/* Deprecated aliases */ +#define ZMQ_XREQ ZMQ_DEALER +#define ZMQ_XREP ZMQ_ROUTER + +/* Socket options. */ +#define ZMQ_AFFINITY 4 +#define ZMQ_IDENTITY 5 +#define ZMQ_SUBSCRIBE 6 +#define ZMQ_UNSUBSCRIBE 7 +#define ZMQ_RATE 8 +#define ZMQ_RECOVERY_IVL 9 +#define ZMQ_SNDBUF 11 +#define ZMQ_RCVBUF 12 +#define ZMQ_RCVMORE 13 +#define ZMQ_FD 14 +#define ZMQ_EVENTS 15 +#define ZMQ_TYPE 16 +#define ZMQ_LINGER 17 +#define ZMQ_RECONNECT_IVL 18 +#define ZMQ_BACKLOG 19 +#define ZMQ_RECONNECT_IVL_MAX 21 +#define ZMQ_MAXMSGSIZE 22 +#define ZMQ_SNDHWM 23 +#define ZMQ_RCVHWM 24 +#define ZMQ_MULTICAST_HOPS 25 +#define ZMQ_RCVTIMEO 27 +#define ZMQ_SNDTIMEO 28 +#define ZMQ_LAST_ENDPOINT 32 +#define ZMQ_ROUTER_MANDATORY 33 +#define ZMQ_TCP_KEEPALIVE 34 +#define ZMQ_TCP_KEEPALIVE_CNT 35 +#define ZMQ_TCP_KEEPALIVE_IDLE 36 +#define ZMQ_TCP_KEEPALIVE_INTVL 37 +#define ZMQ_IMMEDIATE 39 +#define ZMQ_XPUB_VERBOSE 40 +#define ZMQ_ROUTER_RAW 41 +#define ZMQ_IPV6 42 +#define ZMQ_MECHANISM 43 +#define ZMQ_PLAIN_SERVER 44 +#define ZMQ_PLAIN_USERNAME 45 +#define ZMQ_PLAIN_PASSWORD 46 +#define ZMQ_CURVE_SERVER 47 +#define ZMQ_CURVE_PUBLICKEY 48 +#define ZMQ_CURVE_SECRETKEY 49 +#define ZMQ_CURVE_SERVERKEY 50 +#define ZMQ_PROBE_ROUTER 51 +#define ZMQ_REQ_CORRELATE 52 +#define ZMQ_REQ_RELAXED 53 +#define ZMQ_CONFLATE 54 +#define ZMQ_ZAP_DOMAIN 55 +#define ZMQ_ROUTER_HANDOVER 56 +#define ZMQ_TOS 57 +#define ZMQ_CONNECT_RID 61 +#define ZMQ_GSSAPI_SERVER 62 +#define ZMQ_GSSAPI_PRINCIPAL 63 +#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 +#define ZMQ_GSSAPI_PLAINTEXT 65 +#define ZMQ_HANDSHAKE_IVL 66 +#define ZMQ_SOCKS_PROXY 68 +#define ZMQ_XPUB_NODROP 69 +#define ZMQ_BLOCKY 70 +#define ZMQ_XPUB_MANUAL 71 +#define ZMQ_XPUB_WELCOME_MSG 72 +#define ZMQ_STREAM_NOTIFY 73 +#define ZMQ_INVERT_MATCHING 74 +#define ZMQ_HEARTBEAT_IVL 75 +#define ZMQ_HEARTBEAT_TTL 76 +#define ZMQ_HEARTBEAT_TIMEOUT 77 +#define ZMQ_XPUB_VERBOSER 78 +#define ZMQ_CONNECT_TIMEOUT 79 +#define ZMQ_TCP_MAXRT 80 +#define ZMQ_THREAD_SAFE 81 +#define ZMQ_MULTICAST_MAXTPDU 84 +#define ZMQ_VMCI_BUFFER_SIZE 85 +#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 +#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 +#define ZMQ_VMCI_CONNECT_TIMEOUT 88 +#define ZMQ_USE_FD 89 + +/* Message options */ +#define ZMQ_MORE 1 +#define ZMQ_SHARED 3 + +/* Send/recv options. */ +#define ZMQ_DONTWAIT 1 +#define ZMQ_SNDMORE 2 + +/* Security mechanisms */ +#define ZMQ_NULL 0 +#define ZMQ_PLAIN 1 +#define ZMQ_CURVE 2 +#define ZMQ_GSSAPI 3 + +/* RADIO-DISH protocol */ +#define ZMQ_GROUP_MAX_LENGTH 15 + +/* Deprecated options and aliases */ +#define ZMQ_TCP_ACCEPT_FILTER 38 +#define ZMQ_IPC_FILTER_PID 58 +#define ZMQ_IPC_FILTER_UID 59 +#define ZMQ_IPC_FILTER_GID 60 +#define ZMQ_IPV4ONLY 31 +#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE +#define ZMQ_NOBLOCK ZMQ_DONTWAIT +#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY +#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY + +/* Deprecated Message options */ +#define ZMQ_SRCFD 2 + +/******************************************************************************/ +/* 0MQ socket events and monitoring */ +/******************************************************************************/ + +/* Socket transport events (TCP, IPC and TIPC only) */ + +#define ZMQ_EVENT_CONNECTED 0x0001 +#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 +#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 +#define ZMQ_EVENT_LISTENING 0x0008 +#define ZMQ_EVENT_BIND_FAILED 0x0010 +#define ZMQ_EVENT_ACCEPTED 0x0020 +#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 +#define ZMQ_EVENT_CLOSED 0x0080 +#define ZMQ_EVENT_CLOSE_FAILED 0x0100 +#define ZMQ_EVENT_DISCONNECTED 0x0200 +#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 +#define ZMQ_EVENT_ALL 0xFFFF + +ZMQ_EXPORT void *zmq_socket (void *, int type); +ZMQ_EXPORT int zmq_close (void *s); +ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, + size_t optvallen); +ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, + size_t *optvallen); +ZMQ_EXPORT int zmq_bind (void *s, const char *addr); +ZMQ_EXPORT int zmq_connect (void *s, const char *addr); +ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); +ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); +ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); + + +/******************************************************************************/ +/* I/O multiplexing. */ +/******************************************************************************/ + +#define ZMQ_POLLIN 1 +#define ZMQ_POLLOUT 2 +#define ZMQ_POLLERR 4 +#define ZMQ_POLLPRI 8 + +typedef struct zmq_pollitem_t +{ + void *socket; +#if defined _WIN32 + SOCKET fd; +#else + int fd; +#endif + short events; + short revents; +} zmq_pollitem_t; + +#define ZMQ_POLLITEMS_DFLT 16 + +ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); + +/******************************************************************************/ +/* Message proxying */ +/******************************************************************************/ + +ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); +ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); + +/******************************************************************************/ +/* Probe library capabilities */ +/******************************************************************************/ + +#define ZMQ_HAS_CAPABILITIES 1 +ZMQ_EXPORT int zmq_has (const char *capability); + +/* Deprecated aliases */ +#define ZMQ_STREAMER 1 +#define ZMQ_FORWARDER 2 +#define ZMQ_QUEUE 3 + +/* Deprecated methods */ +ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); +ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); +ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); +struct iovec; +ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); +ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); + +/******************************************************************************/ +/* Encryption functions */ +/******************************************************************************/ + +/* Encode data with Z85 encoding. Returns encoded data */ +ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); + +/* Decode data with Z85 encoding. Returns decoded data */ +ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); + +/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ +/* Returns 0 on success. */ +ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); + +/* Derive the z85-encoded public key from the z85-encoded secret key. */ +/* Returns 0 on success. */ +ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); + +/******************************************************************************/ +/* Atomic utility methods */ +/******************************************************************************/ + +ZMQ_EXPORT void *zmq_atomic_counter_new (void); +ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); +ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); +ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); +ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); +ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); + + +/******************************************************************************/ +/* These functions are not documented by man pages -- use at your own risk. */ +/* If you need these to be part of the formal ZMQ API, then (a) write a man */ +/* page, and (b) write a test case in tests. */ +/******************************************************************************/ + +/* Helper functions are used by perf tests so that they don't have to care */ +/* about minutiae of time-related functions on different OS platforms. */ + +/* Starts the stopwatch. Returns the handle to the watch. */ +ZMQ_EXPORT void *zmq_stopwatch_start (void); + +/* Stops the stopwatch. Returns the number of microseconds elapsed since */ +/* the stopwatch was started. */ +ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); + +/* Sleeps for specified number of seconds. */ +ZMQ_EXPORT void zmq_sleep (int seconds_); + +typedef void (zmq_thread_fn) (void*); + +/* Start a thread. Returns a handle to the thread. */ +ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); + +/* Wait for thread to complete then free up resources. */ +ZMQ_EXPORT void zmq_threadclose (void* thread); + + +/******************************************************************************/ +/* These functions are DRAFT and disabled in stable releases, and subject to */ +/* change at ANY time until declared stable. */ +/******************************************************************************/ + +#ifdef ZMQ_BUILD_DRAFT_API + +/* DRAFT Socket types. */ +#define ZMQ_SERVER 12 +#define ZMQ_CLIENT 13 +#define ZMQ_RADIO 14 +#define ZMQ_DISH 15 +#define ZMQ_GATHER 16 +#define ZMQ_SCATTER 17 +#define ZMQ_DGRAM 18 + +/* DRAFT 0MQ socket events and monitoring */ +#define ZMQ_EVENT_HANDSHAKE_FAILED 0x0800 +#define ZMQ_EVENT_HANDSHAKE_SUCCEED 0x1000 + +/* DRAFT Context options */ +#define ZMQ_MSG_T_SIZE 6 + +/* DRAFT Socket methods. */ +ZMQ_EXPORT int zmq_join (void *s, const char *group); +ZMQ_EXPORT int zmq_leave (void *s, const char *group); + +/* DRAFT Msg methods. */ +ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); +ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); +ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg); + +/******************************************************************************/ +/* Poller polling on sockets,fd and thread-safe sockets */ +/******************************************************************************/ + +#define ZMQ_HAVE_POLLER + +typedef struct zmq_poller_event_t +{ + void *socket; +#if defined _WIN32 + SOCKET fd; +#else + int fd; +#endif + void *user_data; + short events; +} zmq_poller_event_t; + +ZMQ_EXPORT void *zmq_poller_new (void); +ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); +ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); +ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); +ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); +ZMQ_EXPORT int zmq_poller_wait_all (void *poller, zmq_poller_event_t *events, int n_events, long timeout); + +#if defined _WIN32 +ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); +ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); +#else +ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); +ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); +#endif + +/******************************************************************************/ +/* Scheduling timers */ +/******************************************************************************/ + +#define ZMQ_HAVE_TIMERS + +typedef void (zmq_timer_fn)(int timer_id, void *arg); + +ZMQ_EXPORT void *zmq_timers_new (void); +ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); +ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); +ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); +ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); +ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); +ZMQ_EXPORT long zmq_timers_timeout (void *timers); +ZMQ_EXPORT int zmq_timers_execute (void *timers); + +#endif // ZMQ_BUILD_DRAFT_API + + +#undef ZMQ_EXPORT + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zmq_utils.h b/phonelibs/zmq/aarch64-linux/include/zmq_utils.h new file mode 100644 index 00000000000000..f29638d5539414 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zmq_utils.h @@ -0,0 +1,48 @@ +/* + Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file + + This file is part of libzmq, the ZeroMQ core engine in C++. + + libzmq is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + As a special exception, the Contributors give you permission to link + this library with independent modules to produce an executable, + regardless of the license terms of these independent modules, and to + copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the + terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. + If you modify this library, you must extend this exception to your + version of the library. + + libzmq 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 program. If not, see . +*/ + +/* This file is deprecated, and all its functionality provided by zmq.h */ +/* Note that -Wpedantic compilation requires GCC to avoid using its custom + extensions such as #warning, hence the trick below. Also, pragmas for + warnings or other messages are not standard, not portable, and not all + compilers even have an equivalent concept. + So in the worst case, this include file is treated as silently empty. */ + +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) +#if defined(__GNUC__) || defined(__GNUG__) +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wcpp" +#pragma GCC diagnostic ignored "-Werror" +#pragma GCC diagnostic ignored "-Wall" +#endif +#pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") +#if defined(__GNUC__) || defined(__GNUG__) +#pragma GCC diagnostic pop +#endif +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zmsg.h b/phonelibs/zmq/aarch64-linux/include/zmsg.h new file mode 100644 index 00000000000000..d8a84d1f4198ed --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zmsg.h @@ -0,0 +1,280 @@ +/* ========================================================================= + zmsg - working with multipart messages + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMSG_H_INCLUDED__ +#define __ZMSG_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zmsg.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create a new empty message object +CZMQ_EXPORT zmsg_t * + zmsg_new (void); + +// Receive message from socket, returns zmsg_t object or NULL if the recv +// was interrupted. Does a blocking recv. If you want to not block then use +// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input +// before receiving. +CZMQ_EXPORT zmsg_t * + zmsg_recv (void *source); + +// Load/append an open file into new message, return the message. +// Returns NULL if the message could not be loaded. +CZMQ_EXPORT zmsg_t * + zmsg_load (FILE *file); + +// Decodes a serialized message frame created by zmsg_encode () and returns +// a new zmsg_t object. Returns NULL if the frame was badly formatted or +// there was insufficient memory to work. +CZMQ_EXPORT zmsg_t * + zmsg_decode (zframe_t *frame); + +// Generate a signal message encoding the given status. A signal is a short +// message carrying a 1-byte success/failure code (by convention, 0 means +// OK). Signals are encoded to be distinguishable from "normal" messages. +CZMQ_EXPORT zmsg_t * + zmsg_new_signal (byte status); + +// Destroy a message object and all frames it contains +CZMQ_EXPORT void + zmsg_destroy (zmsg_t **self_p); + +// Send message to destination socket, and destroy the message after sending +// it successfully. If the message has no frames, sends nothing but destroys +// the message anyhow. Nullifies the caller's reference to the message (as +// it is a destructor). +CZMQ_EXPORT int + zmsg_send (zmsg_t **self_p, void *dest); + +// Send message to destination socket as part of a multipart sequence, and +// destroy the message after sending it successfully. Note that after a +// zmsg_sendm, you must call zmsg_send or another method that sends a final +// message part. If the message has no frames, sends nothing but destroys +// the message anyhow. Nullifies the caller's reference to the message (as +// it is a destructor). +CZMQ_EXPORT int + zmsg_sendm (zmsg_t **self_p, void *dest); + +// Return size of message, i.e. number of frames (0 or more). +CZMQ_EXPORT size_t + zmsg_size (zmsg_t *self); + +// Return total size of all frames in message. +CZMQ_EXPORT size_t + zmsg_content_size (zmsg_t *self); + +// Push frame to the front of the message, i.e. before all other frames. +// Message takes ownership of frame, will destroy it when message is sent. +// Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not +// nullify the caller's frame reference. +CZMQ_EXPORT int + zmsg_prepend (zmsg_t *self, zframe_t **frame_p); + +// Add frame to the end of the message, i.e. after all other frames. +// Message takes ownership of frame, will destroy it when message is sent. +// Returns 0 on success. Deprecates zmsg_add, which did not nullify the +// caller's frame reference. +CZMQ_EXPORT int + zmsg_append (zmsg_t *self, zframe_t **frame_p); + +// Remove first frame from message, if any. Returns frame, or NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zmsg_pop (zmsg_t *self); + +// Push block of memory to front of message, as a new frame. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_pushmem (zmsg_t *self, const void *data, size_t size); + +// Add block of memory to the end of the message, as a new frame. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_addmem (zmsg_t *self, const void *data, size_t size); + +// Push string as new frame to front of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_pushstr (zmsg_t *self, const char *string); + +// Push string as new frame to end of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_addstr (zmsg_t *self, const char *string); + +// Push formatted string as new frame to front of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Push formatted string as new frame to end of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Pop frame off front of message, return as fresh string. If there were +// no more frames in the message, returns NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zmsg_popstr (zmsg_t *self); + +// Push encoded message as a new frame. Message takes ownership of +// submessage, so the original is destroyed in this call. Returns 0 on +// success, -1 on error. +CZMQ_EXPORT int + zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); + +// Remove first submessage from message, if any. Returns zmsg_t, or NULL if +// decoding was not successful. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zmsg_t * + zmsg_popmsg (zmsg_t *self); + +// Remove specified frame from list, if present. Does not destroy frame. +CZMQ_EXPORT void + zmsg_remove (zmsg_t *self, zframe_t *frame); + +// Set cursor to first frame in message. Returns frame, or NULL, if the +// message is empty. Use this to navigate the frames as a list. +CZMQ_EXPORT zframe_t * + zmsg_first (zmsg_t *self); + +// Return the next frame. If there are no more frames, returns NULL. To move +// to the first frame call zmsg_first(). Advances the cursor. +CZMQ_EXPORT zframe_t * + zmsg_next (zmsg_t *self); + +// Return the last frame. If there are no frames, returns NULL. +CZMQ_EXPORT zframe_t * + zmsg_last (zmsg_t *self); + +// Save message to an open file, return 0 if OK, else -1. The message is +// saved as a series of frames, each with length and data. Note that the +// file is NOT guaranteed to be portable between operating systems, not +// versions of CZMQ. The file format is at present undocumented and liable +// to arbitrary change. +CZMQ_EXPORT int + zmsg_save (zmsg_t *self, FILE *file); + +// Serialize multipart message to a single message frame. Use this method +// to send structured messages across transports that do not support +// multipart data. Allocates and returns a new frame containing the +// serialized message. To decode a serialized message frame, use +// zmsg_decode (). +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zmsg_encode (zmsg_t *self); + +// Create copy of message, as new message object. Returns a fresh zmsg_t +// object. If message is null, or memory was exhausted, returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zmsg_t * + zmsg_dup (zmsg_t *self); + +// Send message to zsys log sink (may be stdout, or system facility as +// configured by zsys_set_logstream). +CZMQ_EXPORT void + zmsg_print (zmsg_t *self); + +// Return true if the two messages have the same number of frames and each +// frame in the first message is identical to the corresponding frame in the +// other message. As with zframe_eq, return false if either message is NULL. +CZMQ_EXPORT bool + zmsg_eq (zmsg_t *self, zmsg_t *other); + +// Return signal value, 0 or greater, if message is a signal, -1 if not. +CZMQ_EXPORT int + zmsg_signal (zmsg_t *self); + +// Probe the supplied object, and report if it looks like a zmsg_t. +CZMQ_EXPORT bool + zmsg_is (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zmsg_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Return message routing ID, if the message came from a ZMQ_SERVER socket. +// Else returns zero. +CZMQ_EXPORT uint32_t + zmsg_routing_id (zmsg_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on message. This is used if/when the message is sent to a +// ZMQ_SERVER socket. +CZMQ_EXPORT void + zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +// DEPRECATED as over-engineered, poor style +// Pop frame off front of message, caller now owns frame +// If next frame is empty, pops and destroys that empty frame. +CZMQ_EXPORT zframe_t * + zmsg_unwrap (zmsg_t *self); + +// DEPRECATED as poor style -- callers should use zloop or zpoller +// Receive message from socket, returns zmsg_t object, or NULL either if +// there was no input waiting, or the recv was interrupted. +CZMQ_EXPORT zmsg_t * + zmsg_recv_nowait (void *source); + +// DEPRECATED as unsafe -- does not nullify frame reference. +// Push frame plus empty frame to front of message, before first frame. +// Message takes ownership of frame, will destroy it when message is sent. +CZMQ_EXPORT void + zmsg_wrap (zmsg_t *self, zframe_t *frame); + +// DEPRECATED - will be removed for next + 1 stable release +// Add frame to the front of the message, i.e. before all other frames. +// Message takes ownership of frame, will destroy it when message is sent. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_push (zmsg_t *self, zframe_t *frame); + +// DEPRECATED - will be removed for next stable release +CZMQ_EXPORT int + zmsg_add (zmsg_t *self, zframe_t *frame); + +// DEPRECATED as inconsistent; breaks principle that logging should all go +// to a single destination. +// Print message to open stream +// Truncates to first 10 frames, for readability. +CZMQ_EXPORT void + zmsg_fprint (zmsg_t *self, FILE *file); + +// Compiler hints +CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zmsg_dump(s) zmsg_print(s) +#define zmsg_dump_to_stream(s,F) zmsg_fprint(s,F) + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zpoller.h b/phonelibs/zmq/aarch64-linux/include/zpoller.h new file mode 100644 index 00000000000000..3b394c35161840 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zpoller.h @@ -0,0 +1,87 @@ +/* ========================================================================= + zpoller - trivial socket poller class + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __zpoller_H_INCLUDED__ +#define __zpoller_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zpoller.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create new poller, specifying zero or more readers. The list of +// readers ends in a NULL. Each reader can be a zsock_t instance, a +// zactor_t instance, a libzmq socket (void *), or a file handle. +CZMQ_EXPORT zpoller_t * + zpoller_new (void *reader, ...); + +// Destroy a poller +CZMQ_EXPORT void + zpoller_destroy (zpoller_t **self_p); + +// Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may +// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. +CZMQ_EXPORT int + zpoller_add (zpoller_t *self, void *reader); + +// Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader +// must have been passed during construction, or in an zpoller_add () call. +CZMQ_EXPORT int + zpoller_remove (zpoller_t *self, void *reader); + +// By default the poller stops if the process receives a SIGINT or SIGTERM +// signal. This makes it impossible to shut-down message based architectures +// like zactors. This method lets you switch off break handling. The default +// nonstop setting is off (false). +CZMQ_EXPORT void + zpoller_set_nonstop (zpoller_t *self, bool nonstop); + +// Poll the registered readers for I/O, return first reader that has input. +// The reader will be a libzmq void * socket, or a zsock_t or zactor_t +// instance as specified in zpoller_new/zpoller_add. The timeout should be +// zero or greater, or -1 to wait indefinitely. Socket priority is defined +// by their order in the poll list. If you need a balanced poll, use the low +// level zmq_poll method directly. If the poll call was interrupted (SIGINT), +// or the ZMQ context was destroyed, or the timeout expired, returns NULL. +// You can test the actual exit condition by calling zpoller_expired () and +// zpoller_terminated (). The timeout is in msec. +CZMQ_EXPORT void * + zpoller_wait (zpoller_t *self, int timeout); + +// Return true if the last zpoller_wait () call ended because the timeout +// expired, without any error. +CZMQ_EXPORT bool + zpoller_expired (zpoller_t *self); + +// Return true if the last zpoller_wait () call ended because the process +// was interrupted, or the parent context was destroyed. +CZMQ_EXPORT bool + zpoller_terminated (zpoller_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zpoller_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/phonelibs/zmq/aarch64-linux/include/zproxy.h b/phonelibs/zmq/aarch64-linux/include/zproxy.h new file mode 100644 index 00000000000000..f672c5e72417a5 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zproxy.h @@ -0,0 +1,111 @@ +/* ========================================================================= + zproxy - run a steerable proxy in the background + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZPROXY_H_INCLUDED__ +#define __ZPROXY_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create new zproxy actor instance. The proxy switches messages between +// a frontend socket and a backend socket; use the FRONTEND and BACKEND +// commands to configure these: +// +// zactor_t *proxy = zactor_new (zproxy, NULL); +// +// Destroy zproxy instance. This destroys the two sockets and stops any +// message flow between them: +// +// zactor_destroy (&proxy); +// +// Note that all zproxy commands are synchronous, so your application always +// waits for a signal from the actor after each command. +// +// Enable verbose logging of commands and activity: +// +// zstr_send (proxy, "VERBOSE"); +// zsock_wait (proxy); +// +// Specify frontend socket type -- see zsock_type_str () -- and attach to +// endpoints, see zsock_attach (). Note that a proxy socket is always +// serverish: +// +// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); +// zsock_wait (proxy); +// +// Specify backend socket type -- see zsock_type_str () -- and attach to +// endpoints, see zsock_attach (). Note that a proxy socket is always +// serverish: +// +// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); +// zsock_wait (proxy); +// +// Capture all proxied messages; these are delivered to the application +// via an inproc PULL socket that you have already bound to the specified +// endpoint: +// +// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); +// zsock_wait (proxy); +// +// Pause the proxy. A paused proxy will cease processing messages, causing +// them to be queued up and potentially hit the high-water mark on the +// frontend or backend socket, causing messages to be dropped, or writing +// applications to block: +// +// zstr_sendx (proxy, "PAUSE", NULL); +// zsock_wait (proxy); +// +// Resume the proxy. Note that the proxy starts automatically as soon as it +// has a properly attached frontend and backend socket: +// +// zstr_sendx (proxy, "RESUME", NULL); +// zsock_wait (proxy); +// +// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy +// socket -- see zsock_set_zap_domain (). Call before binding socket: +// +// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); +// zsock_wait (proxy); +// +// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy +// socket -- see zsock_set_plain_server (). Call before binding socket: +// +// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); +// zsock_wait (proxy); +// +// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy +// socket -- see zsock_set_curve_server () -- specifying both the public and +// secret keys of a certificate as Z85 armored strings -- see +// zcert_public_txt () and zcert_secret_txt (). Call before binding socket: +// +// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); +// zsock_wait (proxy); +// +// This is the zproxy constructor as a zactor_fn; the argument is a +// character string specifying frontend and backend socket types as two +// uppercase strings separated by a hyphen: +CZMQ_EXPORT void + zproxy (zsock_t *pipe, void *unused); + +// Selftest +CZMQ_EXPORT void + zproxy_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zrex.h b/phonelibs/zmq/aarch64-linux/include/zrex.h new file mode 100644 index 00000000000000..8b50618a34837c --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zrex.h @@ -0,0 +1,82 @@ +/* ========================================================================= + zrex - work with regular expressions + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZREX_H_INCLUDED__ +#define __ZREX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Constructor. Optionally, sets an expression against which we can match +// text and capture hits. If there is an error in the expression, reports +// zrex_valid() as false and provides the error in zrex_strerror(). If you +// set a pattern, you can call zrex_matches() to test it against text. +CZMQ_EXPORT zrex_t * + zrex_new (const char *expression); + +// Destructor +CZMQ_EXPORT void + zrex_destroy (zrex_t **self_p); + +// Return true if the expression was valid and compiled without errors. +CZMQ_EXPORT bool + zrex_valid (zrex_t *self); + +// Return the error message generated during compilation of the expression. +CZMQ_EXPORT const char * + zrex_strerror (zrex_t *self); + +// Returns true if the text matches the previously compiled expression. +// Use this method to compare one expression against many strings. +CZMQ_EXPORT bool + zrex_matches (zrex_t *self, const char *text); + +// Returns true if the text matches the supplied expression. Use this +// method to compare one string against several expressions. +CZMQ_EXPORT bool + zrex_eq (zrex_t *self, const char *text, const char *expression); + +// Returns number of hits from last zrex_matches or zrex_eq. If the text +// matched, returns 1 plus the number of capture groups. If the text did +// not match, returns zero. To retrieve individual capture groups, call +// zrex_hit (). +CZMQ_EXPORT int + zrex_hits (zrex_t *self); + +// Returns the Nth capture group from the last expression match, where +// N is 0 to the value returned by zrex_hits(). Capture group 0 is the +// whole matching string. Sequence 1 is the first capture group, if any, +// and so on. +CZMQ_EXPORT const char * + zrex_hit (zrex_t *self, uint index); + +// Fetches hits into string variables provided by caller; this makes for +// nicer code than accessing hits by index. Caller should not modify nor +// free the returned values. Returns number of strings returned. This +// method starts at hit 1, i.e. first capture group, as hit 0 is always +// the original matched string. +CZMQ_EXPORT int + zrex_fetch (zrex_t *self, const char **string_p, ...); + +// Self test of this class +CZMQ_EXPORT void + zrex_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zsock.h b/phonelibs/zmq/aarch64-linux/include/zsock.h new file mode 100644 index 00000000000000..9ab060d6a3b8e4 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zsock.h @@ -0,0 +1,1159 @@ +/* ========================================================================= + zsock - high-level socket API that hides libzmq contexts and sockets + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSOCK_H_INCLUDED__ +#define __ZSOCK_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// This interface includes some smart constructors, which create sockets with +// additional set-up. In all of these, the endpoint is NULL, or starts with +// '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by +// commas. If endpoint does not start with '@' or '>', default action depends +// on socket type. + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zsock.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create a new socket. Returns the new socket, or NULL if the new socket +// could not be created. Note that the symbol zsock_new (and other +// constructors/destructors for zsock) are redirected to the *_checked +// variant, enabling intelligent socket leak detection. This can have +// performance implications if you use a LOT of sockets. To turn off this +// redirection behaviour, define ZSOCK_NOCHECK. +CZMQ_EXPORT zsock_t * + zsock_new (int type); + +// Create a PUB socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_pub (const char *endpoint); + +// Create a SUB socket, and optionally subscribe to some prefix string. Default +// action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_sub (const char *endpoint, const char *subscribe); + +// Create a REQ socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_req (const char *endpoint); + +// Create a REP socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_rep (const char *endpoint); + +// Create a DEALER socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_dealer (const char *endpoint); + +// Create a ROUTER socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_router (const char *endpoint); + +// Create a PUSH socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_push (const char *endpoint); + +// Create a PULL socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_pull (const char *endpoint); + +// Create an XPUB socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_xpub (const char *endpoint); + +// Create an XSUB socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_xsub (const char *endpoint); + +// Create a PAIR socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_pair (const char *endpoint); + +// Create a STREAM socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_stream (const char *endpoint); + +// Destroy the socket. You must use this for any socket created via the +// zsock_new method. +CZMQ_EXPORT void + zsock_destroy (zsock_t **self_p); + +// Bind a socket to a formatted endpoint. For tcp:// endpoints, supports +// ephemeral ports, if you specify the port number as "*". By default +// zsock uses the IANA designated range from C000 (49152) to FFFF (65535). +// To override this range, follow the "*" with "[first-last]". Either or +// both first and last may be empty. To bind to a random port within the +// range, use "!" in place of "*". +// +// Examples: +// tcp://127.0.0.1:* bind to first free port from C000 up +// tcp://127.0.0.1:! bind to random port from C000 to FFFF +// tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up +// tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 +// tcp://127.0.0.1:![55000-55999] +// bind to random port from 55000 to 55999 +// +// On success, returns the actual port number used, for tcp:// endpoints, +// and 0 for other transports. On failure, returns -1. Note that when using +// ephemeral ports, a port may be reused by different services without +// clients being aware. Protocols that run on ephemeral ports should take +// this into account. +CZMQ_EXPORT int + zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Returns last bound endpoint, if any. +CZMQ_EXPORT const char * + zsock_endpoint (zsock_t *self); + +// Unbind a socket from a formatted endpoint. +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Connect a socket to a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid. +CZMQ_EXPORT int + zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Disconnect a socket from a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); + +// Attach a socket to zero or more endpoints. If endpoints is not null, +// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by +// '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all +// endpoints were valid, or -1 if there was a syntax error. If the endpoint +// does not start with '@' or '>', the serverish argument defines whether +// it is used to bind (serverish = true) or connect (serverish = false). +CZMQ_EXPORT int + zsock_attach (zsock_t *self, const char *endpoints, bool serverish); + +// Returns socket type as printable constant string. +CZMQ_EXPORT const char * + zsock_type_str (zsock_t *self); + +// Send a 'picture' message to the socket (or actor). The picture is a +// string that defines the type of each frame. This makes it easy to send +// a complex multiframe message in one call. The picture can contain any +// of these characters, each corresponding to one or two arguments: +// +// i = int (signed) +// 1 = uint8_t +// 2 = uint16_t +// 4 = uint32_t +// 8 = uint64_t +// s = char * +// b = byte *, size_t (2 arguments) +// c = zchunk_t * +// f = zframe_t * +// h = zhashx_t * +// U = zuuid_t * +// p = void * (sends the pointer value, only meaningful over inproc) +// m = zmsg_t * (sends all frames in the zmsg) +// z = sends zero-sized frame (0 arguments) +// u = uint (deprecated) +// +// Note that s, b, c, and f are encoded the same way and the choice is +// offered as a convenience to the sender, which may or may not already +// have data in a zchunk or zframe. Does not change or take ownership of +// any arguments. Returns 0 if successful, -1 if sending failed for any +// reason. +CZMQ_EXPORT int + zsock_send (void *self, const char *picture, ...); + +// Send a 'picture' message to the socket (or actor). This is a va_list +// version of zsock_send (), so please consult its documentation for the +// details. +CZMQ_EXPORT int + zsock_vsend (void *self, const char *picture, va_list argptr); + +// Receive a 'picture' message to the socket (or actor). See zsock_send for +// the format and meaning of the picture. Returns the picture elements into +// a series of pointers as provided by the caller: +// +// i = int * (stores signed integer) +// 4 = uint32_t * (stores 32-bit unsigned integer) +// 8 = uint64_t * (stores 64-bit unsigned integer) +// s = char ** (allocates new string) +// b = byte **, size_t * (2 arguments) (allocates memory) +// c = zchunk_t ** (creates zchunk) +// f = zframe_t ** (creates zframe) +// U = zuuid_t * (creates a zuuid with the data) +// h = zhashx_t ** (creates zhashx) +// p = void ** (stores pointer) +// m = zmsg_t ** (creates a zmsg with the remaing frames) +// z = null, asserts empty frame (0 arguments) +// u = uint * (stores unsigned integer, deprecated) +// +// Note that zsock_recv creates the returned objects, and the caller must +// destroy them when finished with them. The supplied pointers do not need +// to be initialized. Returns 0 if successful, or -1 if it failed to recv +// a message, in which case the pointers are not modified. When message +// frames are truncated (a short message), sets return values to zero/null. +// If an argument pointer is NULL, does not store any value (skips it). +// An 'n' picture matches an empty frame; if the message does not match, +// the method will return -1. +CZMQ_EXPORT int + zsock_recv (void *self, const char *picture, ...); + +// Receive a 'picture' message from the socket (or actor). This is a +// va_list version of zsock_recv (), so please consult its documentation +// for the details. +CZMQ_EXPORT int + zsock_vrecv (void *self, const char *picture, va_list argptr); + +// Send a binary encoded 'picture' message to the socket (or actor). This +// method is similar to zsock_send, except the arguments are encoded in a +// binary format that is compatible with zproto, and is designed to reduce +// memory allocations. The pattern argument is a string that defines the +// type of each argument. Supports these argument types: +// +// pattern C type zproto type: +// 1 uint8_t type = "number" size = "1" +// 2 uint16_t type = "number" size = "2" +// 4 uint32_t type = "number" size = "3" +// 8 uint64_t type = "number" size = "4" +// s char *, 0-255 chars type = "string" +// S char *, 0-2^32-1 chars type = "longstr" +// c zchunk_t * type = "chunk" +// f zframe_t * type = "frame" +// u zuuid_t * type = "uuid" +// m zmsg_t * type = "msg" +// p void *, sends pointer value, only over inproc +// +// Does not change or take ownership of any arguments. Returns 0 if +// successful, -1 if sending failed for any reason. +CZMQ_EXPORT int + zsock_bsend (void *self, const char *picture, ...); + +// Receive a binary encoded 'picture' message from the socket (or actor). +// This method is similar to zsock_recv, except the arguments are encoded +// in a binary format that is compatible with zproto, and is designed to +// reduce memory allocations. The pattern argument is a string that defines +// the type of each argument. See zsock_bsend for the supported argument +// types. All arguments must be pointers; this call sets them to point to +// values held on a per-socket basis. +// Note that zsock_brecv creates the returned objects, and the caller must +// destroy them when finished with them. The supplied pointers do not need +// to be initialized. Returns 0 if successful, or -1 if it failed to read +// a message. +CZMQ_EXPORT int + zsock_brecv (void *self, const char *picture, ...); + +// Set socket to use unbounded pipes (HWM=0); use this in cases when you are +// totally certain the message volume can fit in memory. This method works +// across all versions of ZeroMQ. Takes a polymorphic socket reference. +CZMQ_EXPORT void + zsock_set_unbounded (void *self); + +// Send a signal over a socket. A signal is a short message carrying a +// success/failure code (by convention, 0 means OK). Signals are encoded +// to be distinguishable from "normal" messages. Accepts a zsock_t or a +// zactor_t argument, and returns 0 if successful, -1 if the signal could +// not be sent. Takes a polymorphic socket reference. +CZMQ_EXPORT int + zsock_signal (void *self, byte status); + +// Wait on a signal. Use this to coordinate between threads, over pipe +// pairs. Blocks until the signal is received. Returns -1 on error, 0 or +// greater on success. Accepts a zsock_t or a zactor_t as argument. +// Takes a polymorphic socket reference. +CZMQ_EXPORT int + zsock_wait (void *self); + +// If there is a partial message still waiting on the socket, remove and +// discard it. This is useful when reading partial messages, to get specific +// message types. +CZMQ_EXPORT void + zsock_flush (void *self); + +// Probe the supplied object, and report if it looks like a zsock_t. +// Takes a polymorphic socket reference. +CZMQ_EXPORT bool + zsock_is (void *self); + +// Probe the supplied reference. If it looks like a zsock_t instance, return +// the underlying libzmq socket handle; else if it looks like a file +// descriptor, return NULL; else if it looks like a libzmq socket handle, +// return the supplied value. Takes a polymorphic socket reference. +CZMQ_EXPORT void * + zsock_resolve (void *self); + +// Get socket option `heartbeat_ivl`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_heartbeat_ivl (void *self); + +// Set socket option `heartbeat_ivl`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); + +// Get socket option `heartbeat_ttl`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_heartbeat_ttl (void *self); + +// Set socket option `heartbeat_ttl`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); + +// Get socket option `heartbeat_timeout`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_heartbeat_timeout (void *self); + +// Set socket option `heartbeat_timeout`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); + +// Get socket option `use_fd`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_use_fd (void *self); + +// Set socket option `use_fd`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_use_fd (void *self, int use_fd); + +// Set socket option `xpub_manual`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_xpub_manual (void *self, int xpub_manual); + +// Set socket option `xpub_welcome_msg`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_xpub_welcome_msg (void *self, const char *xpub_welcome_msg); + +// Set socket option `stream_notify`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_stream_notify (void *self, int stream_notify); + +// Get socket option `invert_matching`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_invert_matching (void *self); + +// Set socket option `invert_matching`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_invert_matching (void *self, int invert_matching); + +// Set socket option `xpub_verboser`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_xpub_verboser (void *self, int xpub_verboser); + +// Get socket option `connect_timeout`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_connect_timeout (void *self); + +// Set socket option `connect_timeout`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_connect_timeout (void *self, int connect_timeout); + +// Get socket option `tcp_maxrt`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_maxrt (void *self); + +// Set socket option `tcp_maxrt`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_tcp_maxrt (void *self, int tcp_maxrt); + +// Get socket option `thread_safe`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_thread_safe (void *self); + +// Get socket option `multicast_maxtpdu`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_multicast_maxtpdu (void *self); + +// Set socket option `multicast_maxtpdu`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_multicast_maxtpdu (void *self, int multicast_maxtpdu); + +// Get socket option `vmci_buffer_size`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_vmci_buffer_size (void *self); + +// Set socket option `vmci_buffer_size`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_vmci_buffer_size (void *self, int vmci_buffer_size); + +// Get socket option `vmci_buffer_min_size`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_vmci_buffer_min_size (void *self); + +// Set socket option `vmci_buffer_min_size`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_vmci_buffer_min_size (void *self, int vmci_buffer_min_size); + +// Get socket option `vmci_buffer_max_size`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_vmci_buffer_max_size (void *self); + +// Set socket option `vmci_buffer_max_size`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_vmci_buffer_max_size (void *self, int vmci_buffer_max_size); + +// Get socket option `vmci_connect_timeout`. +// Available from libzmq 4.2.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_vmci_connect_timeout (void *self); + +// Set socket option `vmci_connect_timeout`. +// Available from libzmq 4.2.0. +CZMQ_EXPORT void + zsock_set_vmci_connect_timeout (void *self, int vmci_connect_timeout); + +// Get socket option `tos`. +// Available from libzmq 4.1.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tos (void *self); + +// Set socket option `tos`. +// Available from libzmq 4.1.0. +CZMQ_EXPORT void + zsock_set_tos (void *self, int tos); + +// Set socket option `router_handover`. +// Available from libzmq 4.1.0. +CZMQ_EXPORT void + zsock_set_router_handover (void *self, int router_handover); + +// Set socket option `connect_rid`. +// Available from libzmq 4.1.0. +CZMQ_EXPORT void + zsock_set_connect_rid (void *self, const char *connect_rid); + +// Set socket option `connect_rid` from 32-octet binary +// Available from libzmq 4.1.0. +CZMQ_EXPORT void + zsock_set_connect_rid_bin (void *self, const byte *connect_rid); + +// Get socket option `handshake_ivl`. +// Available from libzmq 4.1.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_handshake_ivl (void *self); + +// Set socket option `handshake_ivl`. +// Available from libzmq 4.1.0. +CZMQ_EXPORT void + zsock_set_handshake_ivl (void *self, int handshake_ivl); + +// Get socket option `socks_proxy`. +// Available from libzmq 4.1.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_socks_proxy (void *self); + +// Set socket option `socks_proxy`. +// Available from libzmq 4.1.0. +CZMQ_EXPORT void + zsock_set_socks_proxy (void *self, const char *socks_proxy); + +// Set socket option `xpub_nodrop`. +// Available from libzmq 4.1.0. +CZMQ_EXPORT void + zsock_set_xpub_nodrop (void *self, int xpub_nodrop); + +// Set socket option `router_mandatory`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_router_mandatory (void *self, int router_mandatory); + +// Set socket option `probe_router`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_probe_router (void *self, int probe_router); + +// Set socket option `req_relaxed`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_req_relaxed (void *self, int req_relaxed); + +// Set socket option `req_correlate`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_req_correlate (void *self, int req_correlate); + +// Set socket option `conflate`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_conflate (void *self, int conflate); + +// Get socket option `zap_domain`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_zap_domain (void *self); + +// Set socket option `zap_domain`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_zap_domain (void *self, const char *zap_domain); + +// Get socket option `mechanism`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_mechanism (void *self); + +// Get socket option `plain_server`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_plain_server (void *self); + +// Set socket option `plain_server`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_plain_server (void *self, int plain_server); + +// Get socket option `plain_username`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_plain_username (void *self); + +// Set socket option `plain_username`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_plain_username (void *self, const char *plain_username); + +// Get socket option `plain_password`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_plain_password (void *self); + +// Set socket option `plain_password`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_plain_password (void *self, const char *plain_password); + +// Get socket option `curve_server`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_curve_server (void *self); + +// Set socket option `curve_server`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_curve_server (void *self, int curve_server); + +// Get socket option `curve_publickey`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_curve_publickey (void *self); + +// Set socket option `curve_publickey`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_curve_publickey (void *self, const char *curve_publickey); + +// Set socket option `curve_publickey` from 32-octet binary +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); + +// Get socket option `curve_secretkey`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_curve_secretkey (void *self); + +// Set socket option `curve_secretkey`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_curve_secretkey (void *self, const char *curve_secretkey); + +// Set socket option `curve_secretkey` from 32-octet binary +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); + +// Get socket option `curve_serverkey`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_curve_serverkey (void *self); + +// Set socket option `curve_serverkey`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_curve_serverkey (void *self, const char *curve_serverkey); + +// Set socket option `curve_serverkey` from 32-octet binary +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); + +// Get socket option `gssapi_server`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_gssapi_server (void *self); + +// Set socket option `gssapi_server`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_gssapi_server (void *self, int gssapi_server); + +// Get socket option `gssapi_plaintext`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_gssapi_plaintext (void *self); + +// Set socket option `gssapi_plaintext`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); + +// Get socket option `gssapi_principal`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_gssapi_principal (void *self); + +// Set socket option `gssapi_principal`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_gssapi_principal (void *self, const char *gssapi_principal); + +// Get socket option `gssapi_service_principal`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_gssapi_service_principal (void *self); + +// Set socket option `gssapi_service_principal`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); + +// Get socket option `ipv6`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_ipv6 (void *self); + +// Set socket option `ipv6`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_ipv6 (void *self, int ipv6); + +// Get socket option `immediate`. +// Available from libzmq 4.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_immediate (void *self); + +// Set socket option `immediate`. +// Available from libzmq 4.0.0. +CZMQ_EXPORT void + zsock_set_immediate (void *self, int immediate); + +// Get socket option `type`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_type (void *self); + +// Get socket option `sndhwm`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_sndhwm (void *self); + +// Set socket option `sndhwm`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_sndhwm (void *self, int sndhwm); + +// Get socket option `rcvhwm`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvhwm (void *self); + +// Set socket option `rcvhwm`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_rcvhwm (void *self, int rcvhwm); + +// Get socket option `affinity`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_affinity (void *self); + +// Set socket option `affinity`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_affinity (void *self, int affinity); + +// Set socket option `subscribe`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_subscribe (void *self, const char *subscribe); + +// Set socket option `unsubscribe`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_unsubscribe (void *self, const char *unsubscribe); + +// Get socket option `identity`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_identity (void *self); + +// Set socket option `identity`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_identity (void *self, const char *identity); + +// Get socket option `rate`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rate (void *self); + +// Set socket option `rate`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_rate (void *self, int rate); + +// Get socket option `recovery_ivl`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_recovery_ivl (void *self); + +// Set socket option `recovery_ivl`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_recovery_ivl (void *self, int recovery_ivl); + +// Get socket option `sndbuf`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_sndbuf (void *self); + +// Set socket option `sndbuf`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_sndbuf (void *self, int sndbuf); + +// Get socket option `rcvbuf`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvbuf (void *self); + +// Set socket option `rcvbuf`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_rcvbuf (void *self, int rcvbuf); + +// Get socket option `linger`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_linger (void *self); + +// Set socket option `linger`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_linger (void *self, int linger); + +// Get socket option `reconnect_ivl`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_reconnect_ivl (void *self); + +// Set socket option `reconnect_ivl`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_reconnect_ivl (void *self, int reconnect_ivl); + +// Get socket option `reconnect_ivl_max`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_reconnect_ivl_max (void *self); + +// Set socket option `reconnect_ivl_max`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); + +// Get socket option `backlog`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_backlog (void *self); + +// Set socket option `backlog`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_backlog (void *self, int backlog); + +// Get socket option `maxmsgsize`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_maxmsgsize (void *self); + +// Set socket option `maxmsgsize`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_maxmsgsize (void *self, int maxmsgsize); + +// Get socket option `multicast_hops`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_multicast_hops (void *self); + +// Set socket option `multicast_hops`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_multicast_hops (void *self, int multicast_hops); + +// Get socket option `rcvtimeo`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvtimeo (void *self); + +// Set socket option `rcvtimeo`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_rcvtimeo (void *self, int rcvtimeo); + +// Get socket option `sndtimeo`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_sndtimeo (void *self); + +// Set socket option `sndtimeo`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_sndtimeo (void *self, int sndtimeo); + +// Set socket option `xpub_verbose`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_xpub_verbose (void *self, int xpub_verbose); + +// Get socket option `tcp_keepalive`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive (void *self); + +// Set socket option `tcp_keepalive`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_tcp_keepalive (void *self, int tcp_keepalive); + +// Get socket option `tcp_keepalive_idle`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive_idle (void *self); + +// Set socket option `tcp_keepalive_idle`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); + +// Get socket option `tcp_keepalive_cnt`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive_cnt (void *self); + +// Set socket option `tcp_keepalive_cnt`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); + +// Get socket option `tcp_keepalive_intvl`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive_intvl (void *self); + +// Set socket option `tcp_keepalive_intvl`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); + +// Get socket option `tcp_accept_filter`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_tcp_accept_filter (void *self); + +// Set socket option `tcp_accept_filter`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); + +// Get socket option `rcvmore`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvmore (void *self); + +// Get socket option `fd`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT SOCKET + zsock_fd (void *self); + +// Get socket option `events`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_events (void *self); + +// Get socket option `last_endpoint`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_last_endpoint (void *self); + +// Set socket option `router_raw`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_router_raw (void *self, int router_raw); + +// Get socket option `ipv4only`. +// Available from libzmq 3.0.0. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_ipv4only (void *self); + +// Set socket option `ipv4only`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_ipv4only (void *self, int ipv4only); + +// Set socket option `delay_attach_on_connect`. +// Available from libzmq 3.0.0. +CZMQ_EXPORT void + zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); + +// Self test of this class. +CZMQ_EXPORT void + zsock_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Create a SERVER socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_server (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a CLIENT socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_client (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a RADIO socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_radio (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a DISH socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_dish (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a GATHER socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_gather (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a SCATTER socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_scatter (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Return socket routing ID if any. This returns 0 if the socket is not +// of type ZMQ_SERVER or if no request was already received on it. +CZMQ_EXPORT uint32_t + zsock_routing_id (zsock_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. +// This will be used when sending messages on the socket via the zsock API. +CZMQ_EXPORT void + zsock_set_routing_id (zsock_t *self, uint32_t routing_id); + +// *** Draft method, for development use, may change without warning *** +// Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. +// Returns 0 if OK, -1 if failed. +CZMQ_EXPORT int + zsock_join (void *self, const char *group); + +// *** Draft method, for development use, may change without warning *** +// Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. +// Returns 0 if OK, -1 if failed. +CZMQ_EXPORT int + zsock_leave (void *self, const char *group); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +// zsock leak detection - not a part of the official interface to zsock. This +// enables CZMQ to report socket leaks intelligently. +#if defined ZSOCK_NOCHECK + // no checking active - use the above interface methods directly. +#else +# define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__) +# define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__) +# define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__) +# define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__) +# define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__) +# define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__) +# define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__) +# define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__) +# define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__) +# define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__) +# define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__) +# define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__) +# define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__) +# define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__) +#endif + +CZMQ_EXPORT zsock_t * + zsock_new_checked (int type, const char *filename, size_t line_nbr); + +CZMQ_EXPORT void + zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr); + +#ifdef CZMQ_BUILD_DRAFT_API +CZMQ_EXPORT zsock_t * + zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr); +#endif // CZMQ_BUILD_DRAFT_API + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zstr.h b/phonelibs/zmq/aarch64-linux/include/zstr.h new file mode 100644 index 00000000000000..67f2f852b623ea --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zstr.h @@ -0,0 +1,110 @@ +/* ========================================================================= + zstr - sending and receiving strings + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSTR_H_INCLUDED__ +#define __ZSTR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zstr.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Receive C string from socket. Caller must free returned string using +// zstr_free(). Returns NULL if the context is being terminated or the +// process was interrupted. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zstr_recv (void *source); + +// Receive a series of strings (until NULL) from multipart data. +// Each string is allocated and filled with string data; if there +// are not enough frames, unallocated strings are set to NULL. +// Returns -1 if the message could not be read, else returns the +// number of strings filled, zero or more. Free each returned string +// using zstr_free(). If not enough strings are provided, remaining +// multipart frames in the message are dropped. +CZMQ_EXPORT int + zstr_recvx (void *source, char **string_p, ...); + +// Send a C string to a socket, as a frame. The string is sent without +// trailing null byte; to read this you can use zstr_recv, or a similar +// method that adds a null terminator on the received string. String +// may be NULL, which is sent as "". +CZMQ_EXPORT int + zstr_send (void *dest, const char *string); + +// Send a C string to a socket, as zstr_send(), with a MORE flag, so that +// you can send further strings in the same multi-part message. +CZMQ_EXPORT int + zstr_sendm (void *dest, const char *string); + +// Send a formatted string to a socket. Note that you should NOT use +// user-supplied strings in the format (they may contain '%' which +// will create security holes). +CZMQ_EXPORT int + zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); + +// Send a formatted string to a socket, as for zstr_sendf(), with a +// MORE flag, so that you can send further strings in the same multi-part +// message. +CZMQ_EXPORT int + zstr_sendfm (void *dest, const char *format, ...) CHECK_PRINTF (2); + +// Send a series of strings (until NULL) as multipart data +// Returns 0 if the strings could be sent OK, or -1 on error. +CZMQ_EXPORT int + zstr_sendx (void *dest, const char *string, ...); + +// Free a provided string, and nullify the parent pointer. Safe to call on +// a null pointer. +CZMQ_EXPORT void + zstr_free (char **string_p); + +// Self test of this class. +CZMQ_EXPORT void + zstr_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Accepts a void pointer and returns a fresh character string. If source +// is null, returns an empty string. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zstr_str (void *source); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +// DEPRECATED as poor style -- callers should use zloop or zpoller +// Receive C string from socket, if socket had input ready. Caller must +// free returned string using zstr_free. Returns NULL if there was no input +// waiting, or if the context was terminated. Use zctx_interrupted to exit +// any loop that relies on this method. +CZMQ_EXPORT char * + zstr_recv_nowait (void *source); + +// Compiler hints +CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zsys.h b/phonelibs/zmq/aarch64-linux/include/zsys.h new file mode 100644 index 00000000000000..200271d9249cbb --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zsys.h @@ -0,0 +1,395 @@ +/* ========================================================================= + zsys - system-level methods + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSYS_H_INCLUDED__ +#define __ZSYS_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#define UDP_FRAME_MAX 255 // Max size of UDP frame + +// Callback for interrupt signal handler +typedef void (zsys_handler_fn) (int signal_value); + +// Initialize CZMQ zsys layer; this happens automatically when you create +// a socket or an actor; however this call lets you force initialization +// earlier, so e.g. logging is properly set-up before you start working. +// Not threadsafe, so call only from main thread. Safe to call multiple +// times. Returns global CZMQ context. +CZMQ_EXPORT void * + zsys_init (void); + +// Optionally shut down the CZMQ zsys layer; this normally happens automatically +// when the process exits; however this call lets you force a shutdown +// earlier, avoiding any potential problems with atexit() ordering, especially +// with Windows dlls. +CZMQ_EXPORT void + zsys_shutdown (void); + +// Get a new ZMQ socket, automagically creating a ZMQ context if this is +// the first time. Caller is responsible for destroying the ZMQ socket +// before process exits, to avoid a ZMQ deadlock. Note: you should not use +// this method in CZMQ apps, use zsock_new() instead. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void * + zsys_socket (int type, const char *filename, size_t line_nbr); + +// Destroy/close a ZMQ socket. You should call this for every socket you +// create using zsys_socket(). +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_close (void *handle, const char *filename, size_t line_nbr); + +// Return ZMQ socket name for socket type +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT char * + zsys_sockname (int socktype); + +// Create a pipe, which consists of two PAIR sockets connected over inproc. +// The pipe is configured to use the zsys_pipehwm setting. Returns the +// frontend socket successful, NULL if failed. +CZMQ_EXPORT zsock_t * + zsys_create_pipe (zsock_t **backend_p); + +// Set interrupt handler; this saves the default handlers so that a +// zsys_handler_reset () can restore them. If you call this multiple times +// then the last handler will take affect. If handler_fn is NULL, disables +// default SIGINT/SIGTERM handling in CZMQ. +CZMQ_EXPORT void + zsys_handler_set (zsys_handler_fn *handler_fn); + +// Reset interrupt handler, call this at exit if needed +CZMQ_EXPORT void + zsys_handler_reset (void); + +// Set default interrupt handler, so Ctrl-C or SIGTERM will set +// zsys_interrupted. Idempotent; safe to call multiple times. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void + zsys_catch_interrupts (void); + +// Return 1 if file exists, else zero +CZMQ_EXPORT bool + zsys_file_exists (const char *filename); + +// Return size of file, or -1 if not found +CZMQ_EXPORT ssize_t + zsys_file_size (const char *filename); + +// Return file modification time. Returns 0 if the file does not exist. +CZMQ_EXPORT time_t + zsys_file_modified (const char *filename); + +// Return file mode; provides at least support for the POSIX S_ISREG(m) +// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. +// Returns a mode_t cast to int, or -1 in case of error. +CZMQ_EXPORT int + zsys_file_mode (const char *filename); + +// Delete file. Does not complain if the file is absent +CZMQ_EXPORT int + zsys_file_delete (const char *filename); + +// Check if file is 'stable' +CZMQ_EXPORT bool + zsys_file_stable (const char *filename); + +// Create a file path if it doesn't exist. The file path is treated as a +// printf format. +CZMQ_EXPORT int + zsys_dir_create (const char *pathname, ...); + +// Remove a file path if empty; the pathname is treated as printf format. +CZMQ_EXPORT int + zsys_dir_delete (const char *pathname, ...); + +// Move to a specified working directory. Returns 0 if OK, -1 if this failed. +CZMQ_EXPORT int + zsys_dir_change (const char *pathname); + +// Set private file creation mode; all files created from here will be +// readable/writable by the owner only. +CZMQ_EXPORT void + zsys_file_mode_private (void); + +// Reset default file creation mode; all files created from here will use +// process file mode defaults. +CZMQ_EXPORT void + zsys_file_mode_default (void); + +// Return the CZMQ version for run-time API detection; returns version +// number into provided fields, providing reference isn't null in each case. +CZMQ_EXPORT void + zsys_version (int *major, int *minor, int *patch); + +// Format a string using printf formatting, returning a freshly allocated +// buffer. If there was insufficient memory, returns NULL. Free the returned +// string using zstr_free(). +CZMQ_EXPORT char * + zsys_sprintf (const char *format, ...); + +// Format a string with a va_list argument, returning a freshly allocated +// buffer. If there was insufficient memory, returns NULL. Free the returned +// string using zstr_free(). +CZMQ_EXPORT char * + zsys_vprintf (const char *format, va_list argptr); + +// Create UDP beacon socket; if the routable option is true, uses +// multicast (not yet implemented), else uses broadcast. This method +// and related ones might _eventually_ be moved to a zudp class. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT SOCKET + zsys_udp_new (bool routable); + +// Close a UDP socket +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_udp_close (SOCKET handle); + +// Send zframe to UDP socket, return -1 if sending failed due to +// interface having disappeared (happens easily with WiFi) +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); + +// Receive zframe from UDP socket, and set address of peer that sent it +// The peername must be a char [INET_ADDRSTRLEN] array. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT zframe_t * + zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); + +// Handle an I/O error on some socket operation; will report and die on +// fatal errors, and continue silently on "try again" errors. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void + zsys_socket_error (const char *reason); + +// Return current host name, for use in public tcp:// endpoints. Caller gets +// a freshly allocated string, should free it using zstr_free(). If the host +// name is not resolvable, returns NULL. +CZMQ_EXPORT char * + zsys_hostname (void); + +// Move the current process into the background. The precise effect depends +// on the operating system. On POSIX boxes, moves to a specified working +// directory (if specified), closes all file handles, reopens stdin, stdout, +// and stderr to the null device, and sets the process to ignore SIGHUP. On +// Windows, does nothing. Returns 0 if OK, -1 if there was an error. +CZMQ_EXPORT int + zsys_daemonize (const char *workdir); + +// Drop the process ID into the lockfile, with exclusive lock, and switch +// the process to the specified group and/or user. Any of the arguments +// may be null, indicating a no-op. Returns 0 on success, -1 on failure. +// Note if you combine this with zsys_daemonize, run after, not before +// that method, or the lockfile will hold the wrong process ID. +CZMQ_EXPORT int + zsys_run_as (const char *lockfile, const char *group, const char *user); + +// Returns true if the underlying libzmq supports CURVE security. +// Uses a heuristic probe according to the version of libzmq being used. +CZMQ_EXPORT bool + zsys_has_curve (void); + +// Configure the number of I/O threads that ZeroMQ will use. A good +// rule of thumb is one thread per gigabit of traffic in or out. The +// default is 1, sufficient for most applications. If the environment +// variable ZSYS_IO_THREADS is defined, that provides the default. +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zsys_set_io_threads (size_t io_threads); + +// Configure the number of sockets that ZeroMQ will allow. The default +// is 1024. The actual limit depends on the system, and you can query it +// by using zsys_socket_limit (). A value of zero means "maximum". +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zsys_set_max_sockets (size_t max_sockets); + +// Return maximum number of ZeroMQ sockets that the system will support. +CZMQ_EXPORT size_t + zsys_socket_limit (void); + +// Configure the maximum allowed size of a message sent. +// The default is INT_MAX. +CZMQ_EXPORT void + zsys_set_max_msgsz (int max_msgsz); + +// Return maximum message size. +CZMQ_EXPORT int + zsys_max_msgsz (void); + +// Configure the default linger timeout in msecs for new zsock instances. +// You can also set this separately on each zsock_t instance. The default +// linger time is zero, i.e. any pending messages will be dropped. If the +// environment variable ZSYS_LINGER is defined, that provides the default. +// Note that process exit will typically be delayed by the linger time. +CZMQ_EXPORT void + zsys_set_linger (size_t linger); + +// Configure the default outgoing pipe limit (HWM) for new zsock instances. +// You can also set this separately on each zsock_t instance. The default +// HWM is 1,000, on all versions of ZeroMQ. If the environment variable +// ZSYS_SNDHWM is defined, that provides the default. Note that a value of +// zero means no limit, i.e. infinite memory consumption. +CZMQ_EXPORT void + zsys_set_sndhwm (size_t sndhwm); + +// Configure the default incoming pipe limit (HWM) for new zsock instances. +// You can also set this separately on each zsock_t instance. The default +// HWM is 1,000, on all versions of ZeroMQ. If the environment variable +// ZSYS_RCVHWM is defined, that provides the default. Note that a value of +// zero means no limit, i.e. infinite memory consumption. +CZMQ_EXPORT void + zsys_set_rcvhwm (size_t rcvhwm); + +// Configure the default HWM for zactor internal pipes; this is set on both +// ends of the pipe, for outgoing messages only (sndhwm). The default HWM is +// 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is +// defined, that provides the default. Note that a value of zero means no +// limit, i.e. infinite memory consumption. +CZMQ_EXPORT void + zsys_set_pipehwm (size_t pipehwm); + +// Return the HWM for zactor internal pipes. +CZMQ_EXPORT size_t + zsys_pipehwm (void); + +// Configure use of IPv6 for new zsock instances. By default sockets accept +// and make only IPv4 connections. When you enable IPv6, sockets will accept +// and connect to both IPv4 and IPv6 peers. You can override the setting on +// each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the +// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the +// default. Note: has no effect on ZMQ v2. +CZMQ_EXPORT void + zsys_set_ipv6 (int ipv6); + +// Return use of IPv6 for zsock instances. +CZMQ_EXPORT int + zsys_ipv6 (void); + +// Set network interface name to use for broadcasts, particularly zbeacon. +// This lets the interface be configured for test environments where required. +// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is +// the default when there is no specified interface. If the environment +// variable ZSYS_INTERFACE is set, use that as the default interface name. +// Setting the interface to "*" means "use all available interfaces". +CZMQ_EXPORT void + zsys_set_interface (const char *value); + +// Return network interface to use for broadcasts, or "" if none was set. +CZMQ_EXPORT const char * + zsys_interface (void); + +// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. +// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses +// on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, +// use that as the default IPv6 address. +CZMQ_EXPORT void + zsys_set_ipv6_address (const char *value); + +// Return IPv6 address to use for zbeacon reception, or "" if none was set. +CZMQ_EXPORT const char * + zsys_ipv6_address (void); + +// Set IPv6 milticast address to use for sending zbeacon messages. This needs +// to be set if IPv6 is enabled. If the environment variable +// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast +// address. +CZMQ_EXPORT void + zsys_set_ipv6_mcast_address (const char *value); + +// Return IPv6 multicast address to use for sending zbeacon, or "" if none was +// set. +CZMQ_EXPORT const char * + zsys_ipv6_mcast_address (void); + +// Configure the automatic use of pre-allocated FDs when creating new sockets. +// If 0 (default), nothing will happen. Else, when a new socket is bound, the +// system API will be used to check if an existing pre-allocated FD with a +// matching port (if TCP) or path (if IPC) exists, and if it does it will be +// set via the ZMQ_USE_FD socket option so that the library will use it +// instead of creating a new socket. +CZMQ_EXPORT void + zsys_set_auto_use_fd (int auto_use_fd); + +// Return use of automatic pre-allocated FDs for zsock instances. +CZMQ_EXPORT int + zsys_auto_use_fd (void); + +// Set log identity, which is a string that prefixes all log messages sent +// by this process. The log identity defaults to the environment variable +// ZSYS_LOGIDENT, if that is set. +CZMQ_EXPORT void + zsys_set_logident (const char *value); + +// Set stream to receive log traffic. By default, log traffic is sent to +// stdout. If you set the stream to NULL, no stream will receive the log +// traffic (it may still be sent to the system facility). +CZMQ_EXPORT void + zsys_set_logstream (FILE *stream); + +// Sends log output to a PUB socket bound to the specified endpoint. To +// collect such log output, create a SUB socket, subscribe to the traffic +// you care about, and connect to the endpoint. Log traffic is sent as a +// single string frame, in the same format as when sent to stdout. The +// log system supports a single sender; multiple calls to this method will +// bind the same sender to multiple endpoints. To disable the sender, call +// this method with a null argument. +CZMQ_EXPORT void + zsys_set_logsender (const char *endpoint); + +// Enable or disable logging to the system facility (syslog on POSIX boxes, +// event log on Windows). By default this is disabled. +CZMQ_EXPORT void + zsys_set_logsystem (bool logsystem); + +// Log error condition - highest priority +CZMQ_EXPORT void + zsys_error (const char *format, ...); + +// Log warning condition - high priority +CZMQ_EXPORT void + zsys_warning (const char *format, ...); + +// Log normal, but significant, condition - normal priority +CZMQ_EXPORT void + zsys_notice (const char *format, ...); + +// Log informational message - low priority +CZMQ_EXPORT void + zsys_info (const char *format, ...); + +// Log debug-level message - lowest priority +CZMQ_EXPORT void + zsys_debug (const char *format, ...); + +// Self test of this class +CZMQ_EXPORT void + zsys_test (bool verbose); + +// Global signal indicator, TRUE when user presses Ctrl-C or the process +// gets a SIGTERM signal. +CZMQ_EXPORT extern volatile int zsys_interrupted; +// Deprecated name for this variable +CZMQ_EXPORT extern volatile int zctx_interrupted; +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/include/zuuid.h b/phonelibs/zmq/aarch64-linux/include/zuuid.h new file mode 100644 index 00000000000000..afc1104fea952b --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/include/zuuid.h @@ -0,0 +1,96 @@ +/* ========================================================================= + zuuid - UUID support class + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZUUID_H_INCLUDED__ +#define __ZUUID_H_INCLUDED__ + +#define ZUUID_LEN 16 +#define ZUUID_STR_LEN (ZUUID_LEN * 2) + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zuuid.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create a new UUID object. +CZMQ_EXPORT zuuid_t * + zuuid_new (void); + +// Create UUID object from supplied ZUUID_LEN-octet value. +CZMQ_EXPORT zuuid_t * + zuuid_new_from (const byte *source); + +// Destroy a specified UUID object. +CZMQ_EXPORT void + zuuid_destroy (zuuid_t **self_p); + +// Set UUID to new supplied ZUUID_LEN-octet value. +CZMQ_EXPORT void + zuuid_set (zuuid_t *self, const byte *source); + +// Set UUID to new supplied string value skipping '-' and '{' '}' +// optional delimiters. Return 0 if OK, else returns -1. +CZMQ_EXPORT int + zuuid_set_str (zuuid_t *self, const char *source); + +// Return UUID binary data. +CZMQ_EXPORT const byte * + zuuid_data (zuuid_t *self); + +// Return UUID binary size +CZMQ_EXPORT size_t + zuuid_size (zuuid_t *self); + +// Returns UUID as string +CZMQ_EXPORT const char * + zuuid_str (zuuid_t *self); + +// Return UUID in the canonical string format: 8-4-4-4-12, in lower +// case. Caller does not modify or free returned value. See +// http://en.wikipedia.org/wiki/Universally_unique_identifier +CZMQ_EXPORT const char * + zuuid_str_canonical (zuuid_t *self); + +// Store UUID blob in target array +CZMQ_EXPORT void + zuuid_export (zuuid_t *self, byte *target); + +// Check if UUID is same as supplied value +CZMQ_EXPORT bool + zuuid_eq (zuuid_t *self, const byte *compare); + +// Check if UUID is different from supplied value +CZMQ_EXPORT bool + zuuid_neq (zuuid_t *self, const byte *compare); + +// Make copy of UUID object; if uuid is null, or memory was exhausted, +// returns null. +CZMQ_EXPORT zuuid_t * + zuuid_dup (zuuid_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zuuid_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.a b/phonelibs/zmq/aarch64-linux/lib/libczmq.a new file mode 100644 index 00000000000000..ba2b0a3ca663dd Binary files /dev/null and b/phonelibs/zmq/aarch64-linux/lib/libczmq.a differ diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.la b/phonelibs/zmq/aarch64-linux/lib/libczmq.la new file mode 100755 index 00000000000000..81ef66bdbb0340 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/lib/libczmq.la @@ -0,0 +1,41 @@ +# libczmq.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libczmq.so.4' + +# Names of this library. +library_names='libczmq.so.4.0.2 libczmq.so.4 libczmq.so' + +# The name of the static archive. +old_library='libczmq.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags=' -pthread' + +# Libraries that this one depends upon. +dependency_libs=' -L/home/nvidia/build/zmq/lib /home/nvidia/build/zmq/lib/libzmq.la -lrt -lpthread -ldl -luuid' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libczmq. +current=4 +age=0 +revision=2 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/home/nvidia/build/zmq/lib' diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.so b/phonelibs/zmq/aarch64-linux/lib/libczmq.so new file mode 120000 index 00000000000000..db9aa60f9b5868 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/lib/libczmq.so @@ -0,0 +1 @@ +libczmq.so.4.0.2 \ No newline at end of file diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4 b/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4 new file mode 120000 index 00000000000000..db9aa60f9b5868 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4 @@ -0,0 +1 @@ +libczmq.so.4.0.2 \ No newline at end of file diff --git a/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4.0.2 b/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4.0.2 new file mode 100755 index 00000000000000..bb9c2d52ebdaea Binary files /dev/null and b/phonelibs/zmq/aarch64-linux/lib/libczmq.so.4.0.2 differ diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.a b/phonelibs/zmq/aarch64-linux/lib/libzmq.a new file mode 100644 index 00000000000000..7578d109e45ed4 Binary files /dev/null and b/phonelibs/zmq/aarch64-linux/lib/libzmq.a differ diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.la b/phonelibs/zmq/aarch64-linux/lib/libzmq.la new file mode 100755 index 00000000000000..2aef5c45d0f8a6 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/lib/libzmq.la @@ -0,0 +1,41 @@ +# libzmq.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libzmq.so.5' + +# Names of this library. +library_names='libzmq.so.5.1.2 libzmq.so.5 libzmq.so' + +# The name of the static archive. +old_library='libzmq.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -lrt -lpthread -ldl' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libzmq. +current=6 +age=1 +revision=2 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/home/nvidia/build/zmq/lib' diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.so b/phonelibs/zmq/aarch64-linux/lib/libzmq.so new file mode 120000 index 00000000000000..ef44cafc6ac861 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/lib/libzmq.so @@ -0,0 +1 @@ +libzmq.so.5.1.2 \ No newline at end of file diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5 b/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5 new file mode 120000 index 00000000000000..ef44cafc6ac861 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5 @@ -0,0 +1 @@ +libzmq.so.5.1.2 \ No newline at end of file diff --git a/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5.1.2 b/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5.1.2 new file mode 100755 index 00000000000000..e96750a8ef4365 Binary files /dev/null and b/phonelibs/zmq/aarch64-linux/lib/libzmq.so.5.1.2 differ diff --git a/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libczmq.pc b/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libczmq.pc new file mode 100644 index 00000000000000..7740eec8c0d3b5 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libczmq.pc @@ -0,0 +1,24 @@ +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ + +prefix=/home/nvidia/build/zmq +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libczmq +Description: The high-level C binding for 0MQ +Version: 4.0.2 + +Requires:libzmq + +Libs: -L${libdir} -lczmq +Cflags: -I${includedir} +Libs.private: -lzmq -luuid + +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ diff --git a/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libzmq.pc b/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libzmq.pc new file mode 100644 index 00000000000000..885271757d640f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/lib/pkgconfig/libzmq.pc @@ -0,0 +1,11 @@ +prefix=/home/nvidia/build/zmq +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libzmq +Description: 0MQ c++ library +Version: 4.2.2 +Libs: -L${libdir} -lzmq +Libs.private: -lstdc++ +Cflags: -I${includedir} diff --git a/phonelibs/zmq/aarch64-linux/share/man/man1/zmakecert.1 b/phonelibs/zmq/aarch64-linux/share/man/man1/zmakecert.1 new file mode 100644 index 00000000000000..7a702496b821e8 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man1/zmakecert.1 @@ -0,0 +1,73 @@ +'\" t +.\" Title: zmakecert +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZMAKECERT" "1" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmakecert \- no title found +.SH "SYNOPSIS" +.sp +.nf +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmakecert\&.c\*(Aq\&. +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmakecert\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +Please add \fI@header\fR section in \fI\&./\&.\&./src/zmakecert\&.c\fR\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zmakecert\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zmakecert_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +Please add \*(Aq@selftest\*(Aq section in \*(Aq\&./\&.\&./src/zmakecert\&.c\*(Aq\&. +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zactor.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zactor.3 new file mode 100644 index 00000000000000..481edc396e61fb --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zactor.3 @@ -0,0 +1,127 @@ +'\" t +.\" Title: zactor +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZACTOR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zactor \- simple actor framework +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Actors get a pipe and arguments from caller +typedef void (zactor_fn) ( + zsock_t *pipe, void *args); + +// Create a new actor passing arbitrary arguments reference\&. +CZMQ_EXPORT zactor_t * + zactor_new (zactor_fn task, void *args); + +// Destroy an actor\&. +CZMQ_EXPORT void + zactor_destroy (zactor_t **self_p); + +// Send a zmsg message to the actor, take ownership of the message +// and destroy when it has been sent\&. +CZMQ_EXPORT int + zactor_send (zactor_t *self, zmsg_t **msg_p); + +// Receive a zmsg message from the actor\&. Returns NULL if the actor +// was interrupted before the message could be received, or if there +// was a timeout on the actor\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zmsg_t * + zactor_recv (zactor_t *self); + +// Probe the supplied object, and report if it looks like a zactor_t\&. +CZMQ_EXPORT bool + zactor_is (void *self); + +// Probe the supplied reference\&. If it looks like a zactor_t instance, +// return the underlying libzmq actor handle; else if it looks like +// a libzmq actor handle, return the supplied value\&. +CZMQ_EXPORT void * + zactor_resolve (void *self); + +// Return the actor\*(Aqs zsock handle\&. Use this when you absolutely need +// to work with the zsock instance rather than the actor\&. +CZMQ_EXPORT zsock_t * + zactor_sock (zactor_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zactor_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zactor\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zactor class provides a simple actor framework\&. It replaces the CZMQ zthread class, which had a complex API that did not fit the CLASS standard\&. A CZMQ actor is implemented as a thread plus a PAIR\-PAIR pipe\&. The constructor and destructor are always synchronized, so the caller can be sure all resources are created, and destroyed, when these calls complete\&. (This solves a major problem with zthread, that a caller could not be sure when a child thread had finished\&.) +.sp +A zactor_t instance acts like a zsock_t and you can pass it to any CZMQ method that would take a zsock_t argument, including methods in zframe, zmsg, zstr, and zpoller\&. (zloop somehow escaped and needs catching\&.) +.sp +An actor function MUST call zsock_signal (pipe) when initialized and MUST listen to pipe and exit on $TERM command\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zactor\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zactor_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zactor_t *actor = zactor_new (echo_actor, "Hello, World"); +assert (actor); +zstr_sendx (actor, "ECHO", "This is a string", NULL); +char *string = zstr_recv (actor); +assert (streq (string, "This is a string")); +free (string); +zactor_destroy (&actor); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zarmour.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zarmour.3 new file mode 100644 index 00000000000000..ea806777259889 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zarmour.3 @@ -0,0 +1,372 @@ +'\" t +.\" Title: zarmour +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZARMOUR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zarmour \- armoured text encoding and decoding +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 +#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 +#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 +#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 +#define ZARMOUR_MODE_BASE16 4 // Standard base 16 +#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 + +// Create a new zarmour +CZMQ_EXPORT zarmour_t * + zarmour_new (void); + +// Destroy the zarmour +CZMQ_EXPORT void + zarmour_destroy (zarmour_t **self_p); + +// Encode a stream of bytes into an armoured string\&. Returns the armoured +// string, or NULL if there was insufficient memory available to allocate +// a new string\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zarmour_encode (zarmour_t *self, const byte *data, size_t size); + +// Decode an armoured string into a chunk\&. The decoded output is +// null\-terminated, so it may be treated as a string, if that\*(Aqs what +// it was prior to encoding\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zchunk_t * + zarmour_decode (zarmour_t *self, const char *data); + +// Get the mode property\&. +CZMQ_EXPORT int + zarmour_mode (zarmour_t *self); + +// Get printable string for mode\&. +CZMQ_EXPORT const char * + zarmour_mode_str (zarmour_t *self); + +// Set the mode property\&. +CZMQ_EXPORT void + zarmour_set_mode (zarmour_t *self, int mode); + +// Return true if padding is turned on\&. +CZMQ_EXPORT bool + zarmour_pad (zarmour_t *self); + +// Turn padding on or off\&. Default is on\&. +CZMQ_EXPORT void + zarmour_set_pad (zarmour_t *self, bool pad); + +// Get the padding character\&. +CZMQ_EXPORT char + zarmour_pad_char (zarmour_t *self); + +// Set the padding character\&. +CZMQ_EXPORT void + zarmour_set_pad_char (zarmour_t *self, char pad_char); + +// Return if splitting output into lines is turned on\&. Default is off\&. +CZMQ_EXPORT bool + zarmour_line_breaks (zarmour_t *self); + +// Turn splitting output into lines on or off\&. +CZMQ_EXPORT void + zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); + +// Get the line length used for splitting lines\&. +CZMQ_EXPORT size_t + zarmour_line_length (zarmour_t *self); + +// Set the line length used for splitting lines\&. +CZMQ_EXPORT void + zarmour_set_line_length (zarmour_t *self, size_t line_length); + +// Print properties of object +CZMQ_EXPORT void + zarmour_print (zarmour_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zarmour_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zarmour\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +zarmour \- armoured text encoding and decoding +.sp +The zarmour class implements encoding and decoding of armoured text data\&. The following codecs are implemented: * RFC 4648 (\m[blue]\fBhttp://www\&.ietf\&.org/rfc/rfc4648\&.txt\fR\m[]) \- base64 \- base64url \- base32 \- base32hex \- base16 * Z85 (\m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:32\fR\m[]) All RFC4648 base64 and base32 variants support padding the output\&. The pad character is configurable\&. Default is padding on, with character \fI=\fR\&. Additionally, in some cases (e\&.g\&. MIME), splitting the output into lines of a specific length is required\&. This feature is also supported, though turned off by default\&. The z85 mode does neither padding nor line breaks; it is merely a wrapping of the corresponding libzmq methods\&. Encoding will assert if input length is not divisible by 4 and decoding will assert if input length is not divisible by 5\&. +.SH "EXAMPLE" +.PP +\fBFrom zarmour_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zarmour_t *self = zarmour_new (); +assert (self); + +int mode = zarmour_mode (self); +assert (mode == ZARMOUR_MODE_BASE64_STD); + +zarmour_set_mode (self, ZARMOUR_MODE_BASE64_URL); +mode = zarmour_mode (self); +assert (mode == ZARMOUR_MODE_BASE64_URL); + +assert (zarmour_pad (self)); +zarmour_set_pad (self, false); +assert (!zarmour_pad (self)); + +assert (zarmour_pad_char (self) == \*(Aq=\*(Aq); +zarmour_set_pad_char (self, \*(Aq!\*(Aq); +assert (zarmour_pad_char (self) == \*(Aq!\*(Aq); +zarmour_set_pad_char (self, \*(Aq=\*(Aq); +assert (zarmour_pad_char (self) == \*(Aq=\*(Aq); + +assert (!zarmour_line_breaks (self)); +zarmour_set_line_breaks (self, true); +assert (zarmour_line_breaks (self)); + +assert (zarmour_line_length (self) == 72); +zarmour_set_line_length (self, 64); +assert (zarmour_line_length (self) == 64); + +// Test against test vectors from RFC4648\&. +zarmour_set_mode (self, ZARMOUR_MODE_BASE64_STD); +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "f", "Zg", verbose); +s_armour_test (self, "fo", "Zm8", verbose); +s_armour_test (self, "foo", "Zm9v", verbose); +s_armour_test (self, "foob", "Zm9vYg", verbose); +s_armour_test (self, "fooba", "Zm9vYmE", verbose); +s_armour_test (self, "foobar", "Zm9vYmFy", verbose); +zarmour_set_pad (self, true); +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "f", "Zg==", verbose); +s_armour_test (self, "fo", "Zm8=", verbose); +s_armour_test (self, "foo", "Zm9v", verbose); +s_armour_test (self, "foob", "Zm9vYg==", verbose); +s_armour_test (self, "fooba", "Zm9vYmE=", verbose); +s_armour_test (self, "foobar", "Zm9vYmFy", verbose); + +zarmour_set_pad (self, false); +zarmour_set_mode (self, ZARMOUR_MODE_BASE64_URL); +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "f", "Zg", verbose); +s_armour_test (self, "fo", "Zm8", verbose); +s_armour_test (self, "foo", "Zm9v", verbose); +s_armour_test (self, "foob", "Zm9vYg", verbose); +s_armour_test (self, "fooba", "Zm9vYmE", verbose); +s_armour_test (self, "foobar", "Zm9vYmFy", verbose); +zarmour_set_pad (self, true); +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "f", "Zg==", verbose); +s_armour_test (self, "fo", "Zm8=", verbose); +s_armour_test (self, "foo", "Zm9v", verbose); +s_armour_test (self, "foob", "Zm9vYg==", verbose); +s_armour_test (self, "fooba", "Zm9vYmE=", verbose); +s_armour_test (self, "foobar", "Zm9vYmFy", verbose); + +zarmour_set_pad (self, false); +zarmour_set_mode (self, ZARMOUR_MODE_BASE32_STD); +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "f", "MY", verbose); +s_armour_test (self, "fo", "MZXQ", verbose); +s_armour_test (self, "foo", "MZXW6", verbose); +s_armour_test (self, "foob", "MZXW6YQ", verbose); +s_armour_test (self, "fooba", "MZXW6YTB", verbose); +s_armour_test (self, "foobar", "MZXW6YTBOI", verbose); +s_armour_decode (self, "my", "f", verbose); +s_armour_decode (self, "mzxq", "fo", verbose); +s_armour_decode (self, "mzxw6", "foo", verbose); +s_armour_decode (self, "mzxw6yq", "foob", verbose); +s_armour_decode (self, "mzxw6ytb", "fooba", verbose); +s_armour_decode (self, "mzxw6ytboi", "foobar", verbose); +zarmour_set_pad (self, true); +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "f", "MY======", verbose); +s_armour_test (self, "fo", "MZXQ====", verbose); +s_armour_test (self, "foo", "MZXW6===", verbose); +s_armour_test (self, "foob", "MZXW6YQ=", verbose); +s_armour_test (self, "fooba", "MZXW6YTB", verbose); +s_armour_test (self, "foobar", "MZXW6YTBOI======", verbose); +s_armour_decode (self, "my======", "f", verbose); +s_armour_decode (self, "mzxq====", "fo", verbose); +s_armour_decode (self, "mzxw6===", "foo", verbose); +s_armour_decode (self, "mzxw6yq=", "foob", verbose); +s_armour_decode (self, "mzxw6ytb", "fooba", verbose); +s_armour_decode (self, "mzxw6ytboi======", "foobar", verbose); + +zarmour_set_pad (self, false); +zarmour_set_mode (self, ZARMOUR_MODE_BASE32_HEX); +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "f", "CO", verbose); +s_armour_test (self, "fo", "CPNG", verbose); +s_armour_test (self, "foo", "CPNMU", verbose); +s_armour_test (self, "foob", "CPNMUOG", verbose); +s_armour_test (self, "fooba", "CPNMUOJ1", verbose); +s_armour_test (self, "foobar", "CPNMUOJ1E8", verbose); +s_armour_decode (self, "co", "f", verbose); +s_armour_decode (self, "cpng", "fo", verbose); +s_armour_decode (self, "cpnmu", "foo", verbose); +s_armour_decode (self, "cpnmuog", "foob", verbose); +s_armour_decode (self, "cpnmuoj1", "fooba", verbose); +s_armour_decode (self, "cpnmuoj1e8", "foobar", verbose); +zarmour_set_pad (self, true); +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "f", "CO======", verbose); +s_armour_test (self, "fo", "CPNG====", verbose); +s_armour_test (self, "foo", "CPNMU===", verbose); +s_armour_test (self, "foob", "CPNMUOG=", verbose); +s_armour_test (self, "fooba", "CPNMUOJ1", verbose); +s_armour_test (self, "foobar", "CPNMUOJ1E8======", verbose); +s_armour_decode (self, "co======", "f", verbose); +s_armour_decode (self, "cpng====", "fo", verbose); +s_armour_decode (self, "cpnmu===", "foo", verbose); +s_armour_decode (self, "cpnmuog=", "foob", verbose); +s_armour_decode (self, "cpnmuoj1", "fooba", verbose); +s_armour_decode (self, "cpnmuoj1e8======", "foobar", verbose); +zarmour_set_pad (self, true); + +zarmour_set_mode (self, ZARMOUR_MODE_BASE16); +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "f", "66", verbose); +s_armour_test (self, "fo", "666F", verbose); +s_armour_test (self, "foo", "666F6F", verbose); +s_armour_test (self, "foob", "666F6F62", verbose); +s_armour_test (self, "fooba", "666F6F6261", verbose); +s_armour_test (self, "foobar", "666F6F626172", verbose); +s_armour_decode (self, "666f", "fo", verbose); +s_armour_decode (self, "666f6f", "foo", verbose); +s_armour_decode (self, "666f6f62", "foob", verbose); +s_armour_decode (self, "666f6f6261", "fooba", verbose); +s_armour_decode (self, "666f6f626172", "foobar", verbose); + +#ifdef _INCLUDE_Z85 +// Z85 test is homemade; using 0, 4 and 8 bytes, with precalculated +// test vectors created with a libzmq test\&. +// \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- + +// Make a fake curve key from hex (base16) string, making sure +// there are no null bytes inside, so we can use our test utility +zarmour_set_mode (self, ZARMOUR_MODE_BASE16); +zarmour_set_line_breaks (self, false); + +zchunk_t *chunk = zarmour_decode (self, + "4E6F87E2FB6EB22A1EF5E257B75D79124949565F0B8B36A878A4F03111C96E0B"); +assert (chunk); + +zarmour_set_mode (self, ZARMOUR_MODE_Z85); // Z85 mode does not support padding or line breaks +zarmour_set_pad (self, false); // so these two are superfluous; +zarmour_set_line_breaks (self, false); // just for consistency +if (verbose) + zarmour_print (self); + +s_armour_test (self, "", "", verbose); +s_armour_test (self, "foob", "w]zP%", verbose); +s_armour_test (self, "foobar!!", "w]zP%vr9Im", verbose); +s_armour_test (self, (char *) zchunk_data (chunk), + "ph+{E}!&X?9}!I]W{sm(nL8@&3Yu{wC+<*\-5Y[[#", verbose); +zchunk_destroy (&chunk); +#endif + +// Armouring longer byte array to test line breaks +zarmour_set_pad (self, true); +zarmour_set_line_breaks (self, true); +byte test_data [256]; +int index; +for (index = 0; index < 256; index++) + test_data [index] = index; + +zarmour_set_mode (self, ZARMOUR_MODE_BASE64_STD); +s_armour_test_long (self, test_data, 256, verbose); +zarmour_set_mode (self, ZARMOUR_MODE_BASE64_URL); +s_armour_test_long (self, test_data, 256, verbose); +zarmour_set_mode (self, ZARMOUR_MODE_BASE32_STD); +s_armour_test_long (self, test_data, 256, verbose); +zarmour_set_mode (self, ZARMOUR_MODE_BASE32_HEX); +s_armour_test_long (self, test_data, 256, verbose); +zarmour_set_mode (self, ZARMOUR_MODE_BASE16); +s_armour_test_long (self, test_data, 256, verbose); +#ifdef _INCLUDE_Z85 +zarmour_set_mode (self, ZARMOUR_MODE_Z85); +s_armour_test_long (self, test_data, 256, verbose); +#endif + +zarmour_destroy (&self); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zauth.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zauth.3 new file mode 100644 index 00000000000000..b119d13e9afec2 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zauth.3 @@ -0,0 +1,309 @@ +'\" t +.\" Title: zauth +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZAUTH" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zauth \- authentication for ZeroMQ security mechanisms +.SH "SYNOPSIS" +.sp +.nf +#define CURVE_ALLOW_ANY "*" + +// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated)\&. +// +// Create new zauth actor instance\&. This installs authentication on all +// zsock sockets\&. Until you add policies, all incoming NULL connections are +// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections +// are denied: +// +// zactor_t *auth = zactor_new (zauth, NULL); +// +// Destroy zauth instance\&. This removes authentication and allows all +// connections to pass, without authentication: +// +// zactor_destroy (&auth); +// +// Note that all zauth commands are synchronous, so your application always +// waits for a signal from the actor after each command\&. +// +// Enable verbose logging of commands and activity\&. Verbose logging can help +// debug non\-trivial authentication policies: +// +// zstr_send (auth, "VERBOSE"); +// zsock_wait (auth); +// +// Allow (whitelist) a list of IP addresses\&. For NULL, all clients from +// these addresses will be accepted\&. For PLAIN and CURVE, they will be +// allowed to continue with authentication\&. You can call this method +// multiple times to whitelist more IP addresses\&. If you whitelist one +// or more addresses, any non\-whitelisted addresses are treated as +// blacklisted: +// +// zstr_sendx (auth, "ALLOW", "127\&.0\&.0\&.1", "127\&.0\&.0\&.2", NULL); +// zsock_wait (auth); +// +// Deny (blacklist) a list of IP addresses\&. For all security mechanisms, +// this rejects the connection without any further authentication\&. Use +// either a whitelist, or a blacklist, not not both\&. If you define both +// a whitelist and a blacklist, only the whitelist takes effect: +// +// zstr_sendx (auth, "DENY", "192\&.168\&.0\&.1", "192\&.168\&.0\&.2", NULL); +// zsock_wait (auth); +// +// Configure PLAIN authentication using a plain\-text password file\&. You can +// modify the password file at any time; zauth will reload it automatically +// if modified externally: +// +// zstr_sendx (auth, "PLAIN", filename, NULL); +// zsock_wait (auth); +// +// Configure CURVE authentication, using a directory that holds all public +// client certificates, i\&.e\&. their public keys\&. The certificates must be in +// zcert_save format\&. You can add and remove certificates in that directory +// at any time\&. To allow all client keys without checking, specify +// CURVE_ALLOW_ANY for the directory name: +// +// zstr_sendx (auth, "CURVE", directory, NULL); +// zsock_wait (auth); +// +// Configure GSSAPI authentication, using an underlying mechanism (usually +// Kerberos) to establish a secure context and perform mutual authentication: +// +// zstr_sendx (auth, "GSSAPI", NULL); +// zsock_wait (auth); +// +// This is the zauth constructor as a zactor_fn: +CZMQ_EXPORT void + zauth (zsock_t *pipe, void *certstore); + +// Selftest +CZMQ_EXPORT void + zauth_test (bool verbose); +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zauth\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +A zauth actor takes over authentication for all incoming connections in its context\&. You can whitelist or blacklist peers based on IP address, and define policies for securing PLAIN, CURVE, and GSSAPI connections\&. +.sp +This class replaces zauth_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. +.SH "EXAMPLE" +.PP +\fBFrom zauth_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create temporary directory for test files +# define TESTDIR "\&.test_zauth" +zsys_dir_create (TESTDIR); + +// Check there\*(Aqs no authentication +zsock_t *server = zsock_new (ZMQ_PULL); +assert (server); +zsock_t *client = zsock_new (ZMQ_PUSH); +assert (client); +bool success = s_can_connect (&server, &client, true); +assert (success); + +// Install the authenticator +zactor_t *auth = zactor_new (zauth, NULL); +assert (auth); +if (verbose) { + zstr_sendx (auth, "VERBOSE", NULL); + zsock_wait (auth); +} +// Check there\*(Aqs no authentication on a default NULL server +success = s_can_connect (&server, &client, true); +assert (success); + +// When we set a domain on the server, we switch on authentication +// for NULL sockets, but with no policies, the client connection +// will be allowed\&. +zsock_set_zap_domain (server, "global"); +success = s_can_connect (&server, &client, true); +assert (success); + +// Blacklist 127\&.0\&.0\&.1, connection should fail +zsock_set_zap_domain (server, "global"); +zstr_sendx (auth, "DENY", "127\&.0\&.0\&.1", NULL); +zsock_wait (auth); +success = s_can_connect (&server, &client, true); +assert (!success); + +// Whitelist our address, which overrides the blacklist +zsock_set_zap_domain (server, "global"); +zstr_sendx (auth, "ALLOW", "127\&.0\&.0\&.1", NULL); +zsock_wait (auth); +success = s_can_connect (&server, &client, true); +assert (success); + +// Try PLAIN authentication +zsock_set_plain_server (server, 1); +zsock_set_plain_username (client, "admin"); +zsock_set_plain_password (client, "Password"); +success = s_can_connect (&server, &client, true); +assert (!success); + +FILE *password = fopen (TESTDIR "/password\-file", "w"); +assert (password); +fprintf (password, "admin=Password\en"); +fclose (password); +zsock_set_plain_server (server, 1); +zsock_set_plain_username (client, "admin"); +zsock_set_plain_password (client, "Password"); +zstr_sendx (auth, "PLAIN", TESTDIR "/password\-file", NULL); +zsock_wait (auth); +success = s_can_connect (&server, &client, true); +assert (success); + +zsock_set_plain_server (server, 1); +zsock_set_plain_username (client, "admin"); +zsock_set_plain_password (client, "Bogus"); +success = s_can_connect (&server, &client, true); +assert (!success); + +if (zsys_has_curve ()) { + // Try CURVE authentication + // We\*(Aqll create two new certificates and save the client public + // certificate on disk; in a real case we\*(Aqd transfer this securely + // from the client machine to the server machine\&. + zcert_t *server_cert = zcert_new (); + assert (server_cert); + zcert_t *client_cert = zcert_new (); + assert (client_cert); + const char *server_key = zcert_public_txt (server_cert); + + // Test without setting\-up any authentication + zcert_apply (server_cert, server); + zcert_apply (client_cert, client); + zsock_set_curve_server (server, 1); + zsock_set_curve_serverkey (client, server_key); + success = s_can_connect (&server, &client, true); + assert (!success); + + // Test CURVE_ALLOW_ANY + zcert_apply (server_cert, server); + zcert_apply (client_cert, client); + zsock_set_curve_server (server, 1); + zsock_set_curve_serverkey (client, server_key); + zstr_sendx (auth, "CURVE", CURVE_ALLOW_ANY, NULL); + zsock_wait (auth); + success = s_can_connect (&server, &client, true); + assert (success); + + // Test full client authentication using certificates + zcert_set_meta (client_cert, "Hello", "%s", "World!"); + zcert_apply (server_cert, server); + zcert_apply (client_cert, client); + zsock_set_curve_server (server, 1); + zsock_set_curve_serverkey (client, server_key); + zcert_save_public (client_cert, TESTDIR "/mycert\&.txt"); + zstr_sendx (auth, "CURVE", TESTDIR, NULL); + zsock_wait (auth); + success = s_can_connect (&server, &client, false); + assert (success); + +#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (4, 1, 0)) + // Test send/recv certificate metadata + zframe_t *frame = zframe_recv (server); + assert (frame != NULL); + const char *meta = zframe_meta (frame, "Hello"); + assert (meta != NULL); + assert (streq (meta, "World!")); + zframe_destroy (&frame); + s_renew_sockets(&server, &client); +#endif + + zcert_destroy (&server_cert); + zcert_destroy (&client_cert); + + // Test custom zcertstore + zcertstore_t *certstore = zcertstore_new (NULL); + zcertstore_set_loader (certstore, s_test_loader, NULL, NULL); + zactor_destroy(&auth); + auth = zactor_new (zauth, certstore); + assert (auth); + if (verbose) { + zstr_sendx (auth, "VERBOSE", NULL); + zsock_wait (auth); + } + + byte public_key [32] = { 105, 76, 150, 58, 214, 191, 218, 65, 50, 172, + 131, 188, 247, 211, 136, 170, 227, 26, 57, 170, + 185, 63, 246, 225, 177, 230, 12, 8, 134, 136, + 105, 106 }; + byte secret_key [32] = { 245, 217, 172, 73, 106, 28, 195, 17, 218, 132, + 135, 209, 99, 240, 98, 232, 7, 137, 244, 100, + 242, 23, 29, 114, 70, 223, 83, 1, 113, 207, + 132, 149 }; + zcert_t *shared_cert = zcert_new_from (public_key, secret_key); + assert (shared_cert); + zcert_apply (shared_cert, server); + zcert_apply (shared_cert, client); + zsock_set_curve_server (server, 1); + zsock_set_curve_serverkey (client, "x?T*N/1Y{8goubv{Ts}#&#f}TXJ//DVe#D2HkoLU"); + success = s_can_connect (&server, &client, true); + assert (success); + zcert_destroy (&shared_cert); +} +// Remove the authenticator and check a normal connection works +zactor_destroy (&auth); +success = s_can_connect (&server, &client, true); +assert (success); + +zsock_destroy (&client); +zsock_destroy (&server); + +// Delete all test files +zdir_t *dir = zdir_new (TESTDIR, NULL); +assert (dir); +zdir_remove (dir, true); +zdir_destroy (&dir); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zbeacon.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zbeacon.3 new file mode 100644 index 00000000000000..40e3abbac4056a --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zbeacon.3 @@ -0,0 +1,236 @@ +'\" t +.\" Title: zbeacon +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZBEACON" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zbeacon \- LAN discovery and presence +.SH "SYNOPSIS" +.sp +.nf +// Create new zbeacon actor instance: +// +// zactor_t *beacon = zactor_new (zbeacon, NULL); +// +// Destroy zbeacon instance: +// +// zactor_destroy (&beacon); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (beacon, "VERBOSE"); +// +// Configure beacon to run on specified UDP port, and return the name of +// the host, which can be used as endpoint for incoming connections\&. To +// force the beacon to operate on a given interface, set the environment +// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating +// the beacon\&. If the system does not support UDP broadcasts (lacking a +// workable interface), returns an empty hostname: +// +// // Pictures: \*(Aqs\*(Aq = C string, \*(Aqi\*(Aq = int +// zsock_send (beacon, "si", "CONFIGURE", port_number); +// char *hostname = zstr_recv (beacon); +// +// Start broadcasting a beacon at a specified interval in msec\&. The beacon +// data can be at most UDP_FRAME_MAX bytes; this constant is defined in +// zsys\&.h to be 255: +// +// // Pictures: \*(Aqb\*(Aq = byte * data + size_t size +// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); +// +// Stop broadcasting the beacon: +// +// zstr_sendx (beacon, "SILENCE", NULL); +// +// Start listening to beacons from peers\&. The filter is used to do a prefix +// match on received beacons, to remove junk\&. Note that any received data +// that is identical to our broadcast beacon_data is discarded in any case\&. +// If the filter size is zero, we get all peer beacons: +// +// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); +// +// Stop listening to other peers +// +// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); +// +// Receive next beacon from a peer\&. Received beacons are always a 2\-frame +// message containing the ipaddress of the sender, and then the binary +// beacon data as published by the sender: +// +// zmsg_t *msg = zmsg_recv (beacon); +// +// This is the zbeacon constructor as a zactor_fn: +CZMQ_EXPORT void + zbeacon (zsock_t *pipe, void *unused); + +// Self test of this class +CZMQ_EXPORT void + zbeacon_test (bool verbose); +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zbeacon\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zbeacon class implements a peer\-to\-peer discovery service for local networks\&. A beacon can broadcast and/or capture service announcements using UDP messages on the local area network\&. This implementation uses IPv4 UDP broadcasts\&. You can define the format of your outgoing beacons, and set a filter that validates incoming beacons\&. Beacons are sent and received asynchronously in the background\&. +.sp +This class replaces zbeacon_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. +.SH "EXAMPLE" +.PP +\fBFrom zbeacon_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Test 1 \- two beacons, one speaking, one listening +// Create speaker beacon to broadcast our service +zactor_t *speaker = zactor_new (zbeacon, NULL); +assert (speaker); +if (verbose) + zstr_sendx (speaker, "VERBOSE", NULL); + +zsock_send (speaker, "si", "CONFIGURE", 9999); +char *hostname = zstr_recv (speaker); +if (!*hostname) { + printf ("OK (skipping test, no UDP broadcasting)\en"); + zactor_destroy (&speaker); + free (hostname); + return; +} +free (hostname); + +// Create listener beacon on port 9999 to lookup service +zactor_t *listener = zactor_new (zbeacon, NULL); +assert (listener); +if (verbose) + zstr_sendx (listener, "VERBOSE", NULL); +zsock_send (listener, "si", "CONFIGURE", 9999); +hostname = zstr_recv (listener); +assert (*hostname); +free (hostname); + +// We will broadcast the magic value 0xCAFE +byte announcement [2] = { 0xCA, 0xFE }; +zsock_send (speaker, "sbi", "PUBLISH", announcement, 2, 100); +// We will listen to anything (empty subscription) +zsock_send (listener, "sb", "SUBSCRIBE", "", 0); + +// Wait for at most 1/2 second if there\*(Aqs no broadcasting +zsock_set_rcvtimeo (listener, 500); +char *ipaddress = zstr_recv (listener); +if (ipaddress) { + zframe_t *content = zframe_recv (listener); + assert (zframe_size (content) == 2); + assert (zframe_data (content) [0] == 0xCA); + assert (zframe_data (content) [1] == 0xFE); + zframe_destroy (&content); + zstr_free (&ipaddress); + zstr_sendx (speaker, "SILENCE", NULL); +} +zactor_destroy (&listener); +zactor_destroy (&speaker); + +// Test subscription filter using a 3\-node setup +zactor_t *node1 = zactor_new (zbeacon, NULL); +assert (node1); +zsock_send (node1, "si", "CONFIGURE", 5670); +hostname = zstr_recv (node1); +assert (*hostname); +free (hostname); + +zactor_t *node2 = zactor_new (zbeacon, NULL); +assert (node2); +zsock_send (node2, "si", "CONFIGURE", 5670); +hostname = zstr_recv (node2); +assert (*hostname); +free (hostname); + +zactor_t *node3 = zactor_new (zbeacon, NULL); +assert (node3); +zsock_send (node3, "si", "CONFIGURE", 5670); +hostname = zstr_recv (node3); +assert (*hostname); +free (hostname); + +zsock_send (node1, "sbi", "PUBLISH", "NODE/1", 6, 250); +zsock_send (node2, "sbi", "PUBLISH", "NODE/2", 6, 250); +zsock_send (node3, "sbi", "PUBLISH", "RANDOM", 6, 250); +zsock_send (node1, "sb", "SUBSCRIBE", "NODE", 4); + +// Poll on three API sockets at once +zpoller_t *poller = zpoller_new (node1, node2, node3, NULL); +assert (poller); +int64_t stop_at = zclock_mono () + 1000; +while (zclock_mono () < stop_at) { + long timeout = (long) (stop_at \- zclock_mono ()); + if (timeout < 0) + timeout = 0; + void *which = zpoller_wait (poller, timeout * ZMQ_POLL_MSEC); + if (which) { + assert (which == node1); + char *ipaddress, *received; + zstr_recvx (node1, &ipaddress, &received, NULL); + assert (streq (received, "NODE/2")); + zstr_free (&ipaddress); + zstr_free (&received); + } +} +zpoller_destroy (&poller); + +// Stop listening +zstr_sendx (node1, "UNSUBSCRIBE", NULL); + +// Stop all node broadcasts +zstr_sendx (node1, "SILENCE", NULL); +zstr_sendx (node2, "SILENCE", NULL); +zstr_sendx (node3, "SILENCE", NULL); + +// Destroy the test nodes +zactor_destroy (&node1); +zactor_destroy (&node2); +zactor_destroy (&node3); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zcert.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zcert.3 new file mode 100644 index 00000000000000..e2c81dbf10bd64 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zcert.3 @@ -0,0 +1,215 @@ +'\" t +.\" Title: zcert +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZCERT" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zcert \- work with CURVE security certificates +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// This class has draft methods, which may change over time\&. They are not +// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. +// Create and initialize a new certificate in memory +CZMQ_EXPORT zcert_t * + zcert_new (void); + +// Accepts public/secret key pair from caller +CZMQ_EXPORT zcert_t * + zcert_new_from (const byte *public_key, const byte *secret_key); + +// Load certificate from file +CZMQ_EXPORT zcert_t * + zcert_load (const char *filename); + +// Destroy a certificate in memory +CZMQ_EXPORT void + zcert_destroy (zcert_t **self_p); + +// Return public part of key pair as 32\-byte binary string +CZMQ_EXPORT const byte * + zcert_public_key (zcert_t *self); + +// Return secret part of key pair as 32\-byte binary string +CZMQ_EXPORT const byte * + zcert_secret_key (zcert_t *self); + +// Return public part of key pair as Z85 armored string +CZMQ_EXPORT const char * + zcert_public_txt (zcert_t *self); + +// Return secret part of key pair as Z85 armored string +CZMQ_EXPORT const char * + zcert_secret_txt (zcert_t *self); + +// Set certificate metadata from formatted string\&. +CZMQ_EXPORT void + zcert_set_meta (zcert_t *self, const char *name, const char *format, \&.\&.\&.) CHECK_PRINTF (3); + +// Get metadata value from certificate; if the metadata value doesn\*(Aqt +// exist, returns NULL\&. +CZMQ_EXPORT const char * + zcert_meta (zcert_t *self, const char *name); + +// Get list of metadata fields from certificate\&. Caller is responsible for +// destroying list\&. Caller should not modify the values of list items\&. +CZMQ_EXPORT zlist_t * + zcert_meta_keys (zcert_t *self); + +// Save full certificate (public + secret) to file for persistent storage +// This creates one public file and one secret file (filename + "_secret")\&. +CZMQ_EXPORT int + zcert_save (zcert_t *self, const char *filename); + +// Save public certificate only to file for persistent storage +CZMQ_EXPORT int + zcert_save_public (zcert_t *self, const char *filename); + +// Save secret certificate only to file for persistent storage +CZMQ_EXPORT int + zcert_save_secret (zcert_t *self, const char *filename); + +// Apply certificate to socket, i\&.e\&. use for CURVE security on socket\&. +// If certificate was loaded from public file, the secret key will be +// undefined, and this certificate will not work successfully\&. +CZMQ_EXPORT void + zcert_apply (zcert_t *self, void *socket); + +// Return copy of certificate; if certificate is NULL or we exhausted +// heap memory, returns NULL\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zcert_t * + zcert_dup (zcert_t *self); + +// Return true if two certificates have the same keys +CZMQ_EXPORT bool + zcert_eq (zcert_t *self, zcert_t *compare); + +// Print certificate contents to stdout +CZMQ_EXPORT void + zcert_print (zcert_t *self); + +// Self test of this class +CZMQ_EXPORT void + zcert_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Unset certificate metadata\&. +CZMQ_EXPORT void + zcert_unset_meta (zcert_t *self, const char *name); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zcert\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zcert class provides a way to create and work with security certificates for the ZMQ CURVE mechanism\&. A certificate contains a public + secret key pair, plus metadata\&. It can be used as a temporary object in memory, or persisted to disk\&. On disk, a certificate is stored as two files\&. One is public and contains only the public key\&. The second is secret and contains both keys\&. The two have the same filename, with the secret file adding "_secret"\&. To exchange certificates, send the public file via some secure route\&. Certificates are not signed but are text files that can be verified by eye\&. +.sp +Certificates are stored in the ZPL (ZMQ RFC 4) format\&. They have two sections, "metadata" and "curve"\&. The first contains a list of \fIname = value\fR pairs, one per line\&. Values may be enclosed in quotes\&. The curve section has a \fIpublic\-key = keyvalue\fR and, for secret certificates, a \fIsecret\-key = keyvalue\fR line\&. The keyvalue is a Z85\-encoded CURVE key\&. +.SH "EXAMPLE" +.PP +\fBFrom zcert_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create temporary directory for test files +# define TESTDIR "\&.test_zcert" +zsys_dir_create (TESTDIR); + +// Create a simple certificate with metadata +zcert_t *cert = zcert_new (); +assert (cert); +zcert_set_meta (cert, "email", "ph@imatix\&.com"); +zcert_set_meta (cert, "name", "Pieter Hintjens"); +zcert_set_meta (cert, "organization", "iMatix Corporation"); +zcert_set_meta (cert, "version", "%d", 1); +zcert_set_meta (cert, "delete_me", "now"); +zcert_unset_meta (cert, "delete_me"); +assert (streq (zcert_meta (cert, "email"), "ph@imatix\&.com")); +zlist_t *keys = zcert_meta_keys (cert); +assert (zlist_size (keys) == 4); +zlist_destroy (&keys); + +// Check the dup and eq methods +zcert_t *shadow = zcert_dup (cert); +assert (zcert_eq (cert, shadow)); +zcert_destroy (&shadow); + +// Check we can save and load certificate +zcert_save (cert, TESTDIR "/mycert\&.txt"); +assert (zsys_file_exists (TESTDIR "/mycert\&.txt")); +assert (zsys_file_exists (TESTDIR "/mycert\&.txt_secret")); + +// Load certificate, will in fact load secret one +shadow = zcert_load (TESTDIR "/mycert\&.txt"); +assert (shadow); +assert (zcert_eq (cert, shadow)); +zcert_destroy (&shadow); + +// Delete secret certificate, load public one +int rc = zsys_file_delete (TESTDIR "/mycert\&.txt_secret"); +assert (rc == 0); +shadow = zcert_load (TESTDIR "/mycert\&.txt"); + +// 32\-byte null key encodes as 40 \*(Aq0\*(Aq characters +assert (streq (zcert_secret_txt (shadow), FORTY_ZEROES)); + +zcert_destroy (&shadow); +zcert_destroy (&cert); + +// Delete all test files +zdir_t *dir = zdir_new (TESTDIR, NULL); +assert (dir); +zdir_remove (dir, true); +zdir_destroy (&dir); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zcertstore.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zcertstore.3 new file mode 100644 index 00000000000000..5b76f253db8c1b --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zcertstore.3 @@ -0,0 +1,173 @@ +'\" t +.\" Title: zcertstore +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZCERTSTORE" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zcertstore \- work with CURVE security certificate stores +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// This class has draft methods, which may change over time\&. They are not +// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. +// Create a new certificate store from a disk directory, loading and +// indexing all certificates in that location\&. The directory itself may be +// absent, and created later, or modified at any time\&. The certificate store +// is automatically refreshed on any zcertstore_lookup() call\&. If the +// location is specified as NULL, creates a pure\-memory store, which you +// can work with by inserting certificates at runtime\&. +CZMQ_EXPORT zcertstore_t * + zcertstore_new (const char *location); + +// Destroy a certificate store object in memory\&. Does not affect anything +// stored on disk\&. +CZMQ_EXPORT void + zcertstore_destroy (zcertstore_t **self_p); + +// Look up certificate by public key, returns zcert_t object if found, +// else returns NULL\&. The public key is provided in Z85 text format\&. +CZMQ_EXPORT zcert_t * + zcertstore_lookup (zcertstore_t *self, const char *public_key); + +// Insert certificate into certificate store in memory\&. Note that this +// does not save the certificate to disk\&. To do that, use zcert_save() +// directly on the certificate\&. Takes ownership of zcert_t object\&. +CZMQ_EXPORT void + zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); + +// Print list of certificates in store to logging facility +CZMQ_EXPORT void + zcertstore_print (zcertstore_t *self); + +// Self test of this class +CZMQ_EXPORT void + zcertstore_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// Loaders retrieve certificates from an arbitrary source\&. +typedef void (zcertstore_loader) ( + zcertstore_t *self); + +// Destructor for loader state\&. +typedef void (zcertstore_destructor) ( + void **self_p); + +// *** Draft method, for development use, may change without warning *** +// Override the default disk loader with a custom loader fn\&. +CZMQ_EXPORT void + zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); + +// *** Draft method, for development use, may change without warning *** +// Empty certificate hashtable\&. This wrapper exists to be friendly to bindings, +// which don\*(Aqt usually have access to struct internals\&. +CZMQ_EXPORT void + zcertstore_empty (zcertstore_t *self); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zcertstore\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +To authenticate new clients using the ZeroMQ CURVE security mechanism, we have to check that the client\(cqs public key matches a key we know and accept\&. There are numerous ways to store accepted client public keys\&. The mechanism CZMQ implements is "certificates" (plain text files) held in a "certificate store" (a disk directory)\&. This class works with such certificate stores, and lets you easily load them from disk, and check if a given client public key is known or not\&. The zcert class does the work of managing a single certificate\&. +.sp +The certificate store can be memory\-only, in which case you can load it yourself by inserting certificate objects one by one, or it can be loaded from disk, in which case you can add, modify, or remove certificates on disk at any time, and the store will detect such changes and refresh itself automatically\&. In most applications you won\(cqt use this class directly but through the zauth class, which provides a high\-level API for authentication (and manages certificate stores for you)\&. To actually create certificates on disk, use the zcert class in code, or the tools/zmakecert\&.c command line tool, or any text editor\&. The format of a certificate file is defined in the zcert man page\&. +.SH "EXAMPLE" +.PP +\fBFrom zcertstore_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create temporary directory for test files +# define TESTDIR "\&.test_zcertstore" +zsys_dir_create (TESTDIR); + +// Load certificate store from disk; it will be empty +zcertstore_t *certstore = zcertstore_new (TESTDIR); +assert (certstore); + +// Create a single new certificate and save to disk +zcert_t *cert = zcert_new (); +assert (cert); +char *client_key = strdup (zcert_public_txt (cert)); +assert (client_key); +zcert_set_meta (cert, "name", "John Doe"); +zcert_save (cert, TESTDIR "/mycert\&.txt"); +zcert_destroy (&cert); + +// Check that certificate store refreshes as expected +cert = zcertstore_lookup (certstore, client_key); +assert (cert); +assert (streq (zcert_meta (cert, "name"), "John Doe")); + +// Test custom loader +test_loader_state *state = (test_loader_state *) zmalloc (sizeof (test_loader_state)); +state\->index = 0; +zcertstore_set_loader (certstore, s_test_loader, s_test_destructor, (void *)state); +#if (ZMQ_VERSION_MAJOR >= 4) +cert = zcertstore_lookup (certstore, client_key); +assert (cert == NULL); +cert = zcertstore_lookup (certstore, "abcdefghijklmnopqrstuvwxyzabcdefghijklmn"); +assert (cert); +#endif + +free (client_key); + +if (verbose) + zcertstore_print (certstore); +zcertstore_destroy (&certstore); + +// Delete all test files +zdir_t *dir = zdir_new (TESTDIR, NULL); +assert (dir); +zdir_remove (dir, true); +zdir_destroy (&dir); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zchunk.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zchunk.3 new file mode 100644 index 00000000000000..5b5d4378609b24 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zchunk.3 @@ -0,0 +1,266 @@ +'\" t +.\" Title: zchunk +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZCHUNK" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zchunk \- work with memory chunks +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Create a new chunk of the specified size\&. If you specify the data, it +// is copied into the chunk\&. If you do not specify the data, the chunk is +// allocated and left empty, and you can then add data using zchunk_append\&. +CZMQ_EXPORT zchunk_t * + zchunk_new (const void *data, size_t size); + +// Destroy a chunk +CZMQ_EXPORT void + zchunk_destroy (zchunk_t **self_p); + +// Resizes chunk max_size as requested; chunk_cur size is set to zero +CZMQ_EXPORT void + zchunk_resize (zchunk_t *self, size_t size); + +// Return chunk cur size +CZMQ_EXPORT size_t + zchunk_size (zchunk_t *self); + +// Return chunk max size +CZMQ_EXPORT size_t + zchunk_max_size (zchunk_t *self); + +// Return chunk data +CZMQ_EXPORT byte * + zchunk_data (zchunk_t *self); + +// Set chunk data from user\-supplied data; truncate if too large\&. Data may +// be null\&. Returns actual size of chunk +CZMQ_EXPORT size_t + zchunk_set (zchunk_t *self, const void *data, size_t size); + +// Fill chunk data from user\-supplied octet +CZMQ_EXPORT size_t + zchunk_fill (zchunk_t *self, byte filler, size_t size); + +// Append user\-supplied data to chunk, return resulting chunk size\&. If the +// data would exceeded the available space, it is truncated\&. If you want to +// grow the chunk to accommodate new data, use the zchunk_extend method\&. +CZMQ_EXPORT size_t + zchunk_append (zchunk_t *self, const void *data, size_t size); + +// Append user\-supplied data to chunk, return resulting chunk size\&. If the +// data would exceeded the available space, the chunk grows in size\&. +CZMQ_EXPORT size_t + zchunk_extend (zchunk_t *self, const void *data, size_t size); + +// Copy as much data from \*(Aqsource\*(Aq into the chunk as possible; returns the +// new size of chunk\&. If all data from \*(Aqsource\*(Aq is used, returns exhausted +// on the source chunk\&. Source can be consumed as many times as needed until +// it is exhausted\&. If source was already exhausted, does not change chunk\&. +CZMQ_EXPORT size_t + zchunk_consume (zchunk_t *self, zchunk_t *source); + +// Returns true if the chunk was exhausted by consume methods, or if the +// chunk has a size of zero\&. +CZMQ_EXPORT bool + zchunk_exhausted (zchunk_t *self); + +// Read chunk from an open file descriptor +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zchunk_t * + zchunk_read (FILE *handle, size_t bytes); + +// Write chunk to an open file descriptor +CZMQ_EXPORT int + zchunk_write (zchunk_t *self, FILE *handle); + +// Try to slurp an entire file into a chunk\&. Will read up to maxsize of +// the file\&. If maxsize is 0, will attempt to read the entire file and +// fail with an assertion if that cannot fit into memory\&. Returns a new +// chunk containing the file data, or NULL if the file could not be read\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zchunk_t * + zchunk_slurp (const char *filename, size_t maxsize); + +// Create copy of chunk, as new chunk object\&. Returns a fresh zchunk_t +// object, or null if there was not enough heap memory\&. If chunk is null, +// returns null\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zchunk_t * + zchunk_dup (zchunk_t *self); + +// Return chunk data encoded as printable hex string\&. Caller must free +// string when finished with it\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zchunk_strhex (zchunk_t *self); + +// Return chunk data copied into freshly allocated string +// Caller must free string when finished with it\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zchunk_strdup (zchunk_t *self); + +// Return TRUE if chunk body is equal to string, excluding terminator +CZMQ_EXPORT bool + zchunk_streq (zchunk_t *self, const char *string); + +// Transform zchunk into a zframe that can be sent in a message\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zframe_t * + zchunk_pack (zchunk_t *self); + +// Transform a zframe into a zchunk\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zchunk_t * + zchunk_unpack (zframe_t *frame); + +// Calculate SHA1 digest for chunk, using zdigest class\&. +CZMQ_EXPORT const char * + zchunk_digest (zchunk_t *self); + +// Dump chunk to FILE stream, for debugging and tracing\&. +CZMQ_EXPORT void + zchunk_fprint (zchunk_t *self, FILE *file); + +// Dump message to stderr, for debugging and tracing\&. +// See zchunk_fprint for details +CZMQ_EXPORT void + zchunk_print (zchunk_t *self); + +// Probe the supplied object, and report if it looks like a zchunk_t\&. +CZMQ_EXPORT bool + zchunk_is (void *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zchunk_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zchunk\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zchunk class works with variable sized blobs\&. Not as efficient as ZeroMQ\(cqs messages but they do less weirdness and so are easier to understand\&. The chunk class has methods to read and write chunks from disk\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zchunk\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zchunk_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zchunk_t *chunk = zchunk_new ("1234567890", 10); +assert (chunk); +assert (zchunk_size (chunk) == 10); +assert (memcmp (zchunk_data (chunk), "1234567890", 10) == 0); +zchunk_destroy (&chunk); + +chunk = zchunk_new (NULL, 10); +assert (chunk); +zchunk_append (chunk, "12345678", 8); +zchunk_append (chunk, "90ABCDEF", 8); +zchunk_append (chunk, "GHIJKLMN", 8); +assert (memcmp (zchunk_data (chunk), "1234567890", 10) == 0); +assert (zchunk_size (chunk) == 10); +assert (zchunk_streq (chunk, "1234567890")); +assert (streq (zchunk_digest (chunk), "01B307ACBA4F54F55AAFC33BB06BBBF6CA803E9A")); +char *string = zchunk_strdup (chunk); +assert (streq (string, "1234567890")); +free (string); +string = zchunk_strhex (chunk); +assert (streq (string, "31323334353637383930")); +free (string); + +zframe_t *frame = zchunk_pack (chunk); +assert (frame); + +zchunk_t *chunk2 = zchunk_unpack (frame); +assert (chunk2); +assert (memcmp (zchunk_data (chunk2), "1234567890", 10) == 0); +zframe_destroy (&frame); +zchunk_destroy (&chunk2); + +zchunk_t *copy = zchunk_dup (chunk); +assert (copy); +assert (memcmp (zchunk_data (copy), "1234567890", 10) == 0); +assert (zchunk_size (copy) == 10); +zchunk_destroy (©); +zchunk_destroy (&chunk); + +chunk = zchunk_new (NULL, 0); +zchunk_extend (chunk, "12345678", 8); +zchunk_extend (chunk, "90ABCDEF", 8); +zchunk_extend (chunk, "GHIJKLMN", 8); +assert (zchunk_size (chunk) == 24); +assert (zchunk_streq (chunk, "1234567890ABCDEFGHIJKLMN")); +zchunk_destroy (&chunk); + +copy = zchunk_new ("1234567890abcdefghij", 20); +assert (copy); +chunk = zchunk_new (NULL, 8); +assert (chunk); +zchunk_consume (chunk, copy); +assert (!zchunk_exhausted (copy)); +assert (memcmp (zchunk_data (chunk), "12345678", 8) == 0); +zchunk_set (chunk, NULL, 0); +zchunk_consume (chunk, copy); +assert (!zchunk_exhausted (copy)); +assert (memcmp (zchunk_data (chunk), "90abcdef", 8) == 0); +zchunk_set (chunk, NULL, 0); +zchunk_consume (chunk, copy); +assert (zchunk_exhausted (copy)); +assert (zchunk_size (chunk) == 4); +assert (memcmp (zchunk_data (chunk), "ghij", 4) == 0); +zchunk_destroy (©); +zchunk_destroy (&chunk); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zclock.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zclock.3 new file mode 100644 index 00000000000000..10691d17aa7e0d --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zclock.3 @@ -0,0 +1,116 @@ +'\" t +.\" Title: zclock +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZCLOCK" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zclock \- millisecond clocks and delays +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Sleep for a number of milliseconds +CZMQ_EXPORT void + zclock_sleep (int msecs); + +// Return current system clock as milliseconds\&. Note that this clock can +// jump backwards (if the system clock is changed) so is unsafe to use for +// timers and time offsets\&. Use zclock_mono for that instead\&. +CZMQ_EXPORT int64_t + zclock_time (void); + +// Return current monotonic clock in milliseconds\&. Use this when you compute +// time offsets\&. The monotonic clock is not affected by system changes and +// so will never be reset backwards, unlike a system clock\&. +CZMQ_EXPORT int64_t + zclock_mono (void); + +// Return current monotonic clock in microseconds\&. Use this when you compute +// time offsets\&. The monotonic clock is not affected by system changes and +// so will never be reset backwards, unlike a system clock\&. +CZMQ_EXPORT int64_t + zclock_usecs (void); + +// Return formatted date/time as fresh string\&. Free using zstr_free()\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zclock_timestr (void); + +// Self test of this class\&. +CZMQ_EXPORT void + zclock_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zclock\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zclock class provides essential sleep and system time functions, used to slow down threads for testing, and calculate timers for polling\&. Wraps the non\-portable system calls in a simple portable API\&. +.sp +The Win32 Sleep() call defaults to 16ms resolution unless the system timer resolution is increased with a call to timeBeginPeriod() permitting 1ms granularity\&. +.SH "EXAMPLE" +.PP +\fBFrom zclock_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +int64_t start = zclock_time (); +zclock_sleep (10); +assert ((zclock_time () \- start) >= 10); +start = zclock_mono (); +int64_t usecs = zclock_usecs (); +zclock_sleep (10); +assert ((zclock_mono () \- start) >= 10); +assert ((zclock_usecs () \- usecs) >= 10000); +char *timestr = zclock_timestr (); +if (verbose) + puts (timestr); +free (timestr); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zconfig.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zconfig.3 new file mode 100644 index 00000000000000..5cd00c97073ed0 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zconfig.3 @@ -0,0 +1,342 @@ +'\" t +.\" Title: zconfig +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZCONFIG" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zconfig \- work with config files written in rfc\&.zeromq\&.org/spec:4/ZPL\&. +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// +typedef int (zconfig_fct) ( + zconfig_t *self, void *arg, int level); + +// Create new config item +CZMQ_EXPORT zconfig_t * + zconfig_new (const char *name, zconfig_t *parent); + +// Load a config tree from a specified ZPL text file; returns a zconfig_t +// reference for the root, if the file exists and is readable\&. Returns NULL +// if the file does not exist\&. +CZMQ_EXPORT zconfig_t * + zconfig_load (const char *filename); + +// Equivalent to zconfig_load, taking a format string instead of a fixed +// filename\&. +CZMQ_EXPORT zconfig_t * + zconfig_loadf (const char *format, \&.\&.\&.) CHECK_PRINTF (1); + +// Destroy a config item and all its children +CZMQ_EXPORT void + zconfig_destroy (zconfig_t **self_p); + +// Return name of config item +CZMQ_EXPORT char * + zconfig_name (zconfig_t *self); + +// Return value of config item +CZMQ_EXPORT char * + zconfig_value (zconfig_t *self); + +// Insert or update configuration key with value +CZMQ_EXPORT void + zconfig_put (zconfig_t *self, const char *path, const char *value); + +// Equivalent to zconfig_put, accepting a format specifier and variable +// argument list, instead of a single string value\&. +CZMQ_EXPORT void + zconfig_putf (zconfig_t *self, const char *path, const char *format, \&.\&.\&.) CHECK_PRINTF (3); + +// Get value for config item into a string value; leading slash is optional +// and ignored\&. +CZMQ_EXPORT char * + zconfig_get (zconfig_t *self, const char *path, const char *default_value); + +// Set config item name, name may be NULL +CZMQ_EXPORT void + zconfig_set_name (zconfig_t *self, const char *name); + +// Set new value for config item\&. The new value may be a string, a printf +// format, or NULL\&. Note that if string may possibly contain \*(Aq%\*(Aq, or if it +// comes from an insecure source, you must use \*(Aq%s\*(Aq as the format, followed +// by the string\&. +CZMQ_EXPORT void + zconfig_set_value (zconfig_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Find our first child, if any +CZMQ_EXPORT zconfig_t * + zconfig_child (zconfig_t *self); + +// Find our first sibling, if any +CZMQ_EXPORT zconfig_t * + zconfig_next (zconfig_t *self); + +// Find a config item along a path; leading slash is optional and ignored\&. +CZMQ_EXPORT zconfig_t * + zconfig_locate (zconfig_t *self, const char *path); + +// Locate the last config item at a specified depth +CZMQ_EXPORT zconfig_t * + zconfig_at_depth (zconfig_t *self, int level); + +// Execute a callback for each config item in the tree; returns zero if +// successful, else \-1\&. +CZMQ_EXPORT int + zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); + +// Add comment to config item before saving to disk\&. You can add as many +// comment lines as you like\&. If you use a null format, all comments are +// deleted\&. +CZMQ_EXPORT void + zconfig_set_comment (zconfig_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Return comments of config item, as zlist\&. +CZMQ_EXPORT zlist_t * + zconfig_comments (zconfig_t *self); + +// Save a config tree to a specified ZPL text file, where a filename +// "\-" means dump to standard output\&. +CZMQ_EXPORT int + zconfig_save (zconfig_t *self, const char *filename); + +// Equivalent to zconfig_save, taking a format string instead of a fixed +// filename\&. +CZMQ_EXPORT int + zconfig_savef (zconfig_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Report filename used during zconfig_load, or NULL if none +CZMQ_EXPORT const char * + zconfig_filename (zconfig_t *self); + +// Reload config tree from same file that it was previously loaded from\&. +// Returns 0 if OK, \-1 if there was an error (and then does not change +// existing data)\&. +CZMQ_EXPORT int + zconfig_reload (zconfig_t **self_p); + +// Load a config tree from a memory chunk +CZMQ_EXPORT zconfig_t * + zconfig_chunk_load (zchunk_t *chunk); + +// Save a config tree to a new memory chunk +CZMQ_EXPORT zchunk_t * + zconfig_chunk_save (zconfig_t *self); + +// Load a config tree from a null\-terminated string +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zconfig_t * + zconfig_str_load (const char *string); + +// Save a config tree to a new null terminated string +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zconfig_str_save (zconfig_t *self); + +// Return true if a configuration tree was loaded from a file and that +// file has changed in since the tree was loaded\&. +CZMQ_EXPORT bool + zconfig_has_changed (zconfig_t *self); + +// Print the config file to open stream +CZMQ_EXPORT void + zconfig_fprint (zconfig_t *self, FILE *file); + +// Print properties of object +CZMQ_EXPORT void + zconfig_print (zconfig_t *self); + +// Self test of this class +CZMQ_EXPORT void + zconfig_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zconfig\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +Lets applications load, work with, and save configuration files\&. This implements rfc\&.zeromq\&.org/spec:4/ZPL, which is a simple structured text format for configuration files\&. +.sp +Here is an example ZPL stream and corresponding config structure: +.sp +.if n \{\ +.RS 4 +.\} +.nf +context + iothreads = 1 + verbose = 1 # Ask for a trace +main + type = zqueue # ZMQ_DEVICE type + frontend + option + hwm = 1000 + swap = 25000000 # 25MB + bind = \*(Aqinproc://addr1\*(Aq + bind = \*(Aqipc://addr2\*(Aq + backend + bind = inproc://addr3 +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +root Down = child +| Across = next +v +context\-\->main +| | +| v +| type=queue\-\->frontend\-\->backend +| | | +| | v +| | bind=inproc://addr3 +| v +| option\-\->bind=inproc://addr1\-\->bind=ipc://addr2 +| | +| v +| hwm=1000\-\->swap=25000000 +v +iothreads=1\-\->verbose=false +.fi +.if n \{\ +.RE +.\} +.SH "EXAMPLE" +.PP +\fBFrom zconfig_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create temporary directory for test files +# define TESTDIR "\&.test_zconfig" +zsys_dir_create (TESTDIR); + +zconfig_t *root = zconfig_new ("root", NULL); +assert (root); +zconfig_t *section, *item; + +section = zconfig_new ("headers", root); +assert (section); +item = zconfig_new ("email", section); +assert (item); +zconfig_set_value (item, "some@random\&.com"); +item = zconfig_new ("name", section); +assert (item); +zconfig_set_value (item, "Justin Kayce"); +zconfig_putf (root, "/curve/secret\-key", "%s", "Top Secret"); +zconfig_set_comment (root, " CURVE certificate"); +zconfig_set_comment (root, " \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-"); +assert (zconfig_comments (root)); +zconfig_save (root, TESTDIR "/test\&.cfg"); +zconfig_destroy (&root); +root = zconfig_load (TESTDIR "/test\&.cfg"); +if (verbose) + zconfig_save (root, "\-"); +assert (streq (zconfig_filename (root), TESTDIR "/test\&.cfg")); + +char *email = zconfig_get (root, "/headers/email", NULL); +assert (email); +assert (streq (email, "some@random\&.com")); +char *passwd = zconfig_get (root, "/curve/secret\-key", NULL); +assert (passwd); +assert (streq (passwd, "Top Secret")); + +zconfig_savef (root, "%s/%s", TESTDIR, "test\&.cfg"); +assert (!zconfig_has_changed (root)); +int rc = zconfig_reload (&root); +assert (rc == 0); +assert (!zconfig_has_changed (root)); +zconfig_destroy (&root); + +// Test chunk load/save +root = zconfig_new ("root", NULL); +assert (root); +section = zconfig_new ("section", root); +assert (section); +item = zconfig_new ("value", section); +assert (item); +zconfig_set_value (item, "somevalue"); +zconfig_t *search = zconfig_locate (root, "section/value"); +assert (search == item); +zchunk_t *chunk = zconfig_chunk_save (root); +assert (strlen ((char *) zchunk_data (chunk)) == 32); +char *string = zconfig_str_save (root); +assert (string); +assert (streq (string, (char *) zchunk_data (chunk))); +free (string); +assert (chunk); +zconfig_destroy (&root); + +root = zconfig_chunk_load (chunk); +assert (root); +char *value = zconfig_get (root, "/section/value", NULL); +assert (value); +assert (streq (value, "somevalue")); + +// Test config can\*(Aqt be saved to a file in a path that doesn\*(Aqt +// exist or isn\*(Aqt writable +rc = zconfig_savef (root, "%s/path/that/doesnt/exist/%s", TESTDIR, "test\&.cfg"); +assert (rc == \-1); + +zconfig_destroy (&root); +zchunk_destroy (&chunk); + +// Delete all test files +zdir_t *dir = zdir_new (TESTDIR, NULL); +assert (dir); +zdir_remove (dir, true); +zdir_destroy (&dir); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zdigest.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zdigest.3 new file mode 100644 index 00000000000000..cabae72d053426 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zdigest.3 @@ -0,0 +1,120 @@ +'\" t +.\" Title: zdigest +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZDIGEST" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zdigest \- provides hashing functions (SHA\-1 at present) +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Constructor \- creates new digest object, which you use to build up a +// digest by repeatedly calling zdigest_update() on chunks of data\&. +CZMQ_EXPORT zdigest_t * + zdigest_new (void); + +// Destroy a digest object +CZMQ_EXPORT void + zdigest_destroy (zdigest_t **self_p); + +// Add buffer into digest calculation +CZMQ_EXPORT void + zdigest_update (zdigest_t *self, const byte *buffer, size_t length); + +// Return final digest hash data\&. If built without crypto support, +// returns NULL\&. +CZMQ_EXPORT const byte * + zdigest_data (zdigest_t *self); + +// Return final digest hash size +CZMQ_EXPORT size_t + zdigest_size (zdigest_t *self); + +// Return digest as printable hex string; caller should not modify nor +// free this string\&. After calling this, you may not use zdigest_update() +// on the same digest\&. If built without crypto support, returns NULL\&. +CZMQ_EXPORT char * + zdigest_string (zdigest_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zdigest_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zdigest\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zdigest class generates a hash from zchunks of data\&. The current algorithm is SHA\-1, chosen for speed\&. We are aiming to generate a unique digest for a file, and there are no security issues in this use case\&. +.sp +The current code depends on OpenSSL, which might be replaced by hard coded SHA\-1 implementation to reduce build dependencies\&. +.SH "EXAMPLE" +.PP +\fBFrom zdigest_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +byte *buffer = (byte *) zmalloc (1024); +memset (buffer, 0xAA, 1024); + +zdigest_t *digest = zdigest_new (); +assert (digest); +zdigest_update (digest, buffer, 1024); +const byte *data = zdigest_data (digest); +assert (data [0] == 0xDE); +assert (data [1] == 0xB2); +assert (data [2] == 0x38); +assert (data [3] == 0x07); +assert (streq (zdigest_string (digest), + "DEB23807D4FE025E900FE9A9C7D8410C3DDE9671")); +zdigest_destroy (&digest); +free (buffer); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zdir.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zdir.3 new file mode 100644 index 00000000000000..04cbc80542e838 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zdir.3 @@ -0,0 +1,287 @@ +'\" t +.\" Title: zdir +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZDIR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zdir \- work with file\-system directories +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Create a new directory item that loads in the full tree of the specified +// path, optionally located under some parent path\&. If parent is "\-", then +// loads only the top\-level directory, and does not use parent as a path\&. +CZMQ_EXPORT zdir_t * + zdir_new (const char *path, const char *parent); + +// Destroy a directory tree and all children it contains\&. +CZMQ_EXPORT void + zdir_destroy (zdir_t **self_p); + +// Return directory path +CZMQ_EXPORT const char * + zdir_path (zdir_t *self); + +// Return last modification time for directory\&. +CZMQ_EXPORT time_t + zdir_modified (zdir_t *self); + +// Return total hierarchy size, in bytes of data contained in all files +// in the directory tree\&. +CZMQ_EXPORT off_t + zdir_cursize (zdir_t *self); + +// Return directory count +CZMQ_EXPORT size_t + zdir_count (zdir_t *self); + +// Returns a sorted list of zfile objects; Each entry in the list is a pointer +// to a zfile_t item already allocated in the zdir tree\&. Do not destroy the +// original zdir tree until you are done with this list\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zlist_t * + zdir_list (zdir_t *self); + +// Remove directory, optionally including all files that it contains, at +// all levels\&. If force is false, will only remove the directory if empty\&. +// If force is true, will remove all files and all subdirectories\&. +CZMQ_EXPORT void + zdir_remove (zdir_t *self, bool force); + +// Calculate differences between two versions of a directory tree\&. +// Returns a list of zdir_patch_t patches\&. Either older or newer may +// be null, indicating the directory is empty/absent\&. If alias is set, +// generates virtual filename (minus path, plus alias)\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zlist_t * + zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); + +// Return full contents of directory as a zdir_patch list\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zlist_t * + zdir_resync (zdir_t *self, const char *alias); + +// Load directory cache; returns a hash table containing the SHA\-1 digests +// of every file in the tree\&. The cache is saved between runs in \&.cache\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zhash_t * + zdir_cache (zdir_t *self); + +// Print contents of directory to open stream +CZMQ_EXPORT void + zdir_fprint (zdir_t *self, FILE *file, int indent); + +// Print contents of directory to stdout +CZMQ_EXPORT void + zdir_print (zdir_t *self, int indent); + +// Create a new zdir_watch actor instance: +// +// zactor_t *watch = zactor_new (zdir_watch, NULL); +// +// Destroy zdir_watch instance: +// +// zactor_destroy (&watch); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (watch, "VERBOSE"); +// +// Subscribe to changes to a directory path: +// +// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); +// +// Unsubscribe from changes to a directory path: +// +// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); +// +// Receive directory changes: +// zsock_recv (watch, "sp", &path, &patches); +// +// // Delete the received data\&. +// free (path); +// zlist_destroy (&patches); +CZMQ_EXPORT void + zdir_watch (zsock_t *pipe, void *unused); + +// Self test of this class\&. +CZMQ_EXPORT void + zdir_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zdir\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zdir class gives access to the file system index\&. It will load a directory tree (a directory plus all child directories) into a zdir structure and then let you navigate that structure\&. It exists mainly to wrap non\-portable OS functions to do this\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zdir\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zdir_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// need to create a file in the test directory we\*(Aqre watching +// in order to ensure the directory exists +zfile_t *initfile = zfile_new ("\&./zdir\-test\-dir", "initial_file"); +assert (initfile); +zfile_output (initfile); +fprintf (zfile_handle (initfile), "initial file\en"); +zfile_close (initfile); +zfile_destroy (&initfile); + +zdir_t *older = zdir_new ("zdir\-test\-dir", NULL); +assert (older); +if (verbose) { + printf ("\en"); + zdir_dump (older, 0); +} +zdir_t *newer = zdir_new ("\&.", NULL); +assert (newer); +zlist_t *patches = zdir_diff (older, newer, "/"); +assert (patches); +while (zlist_size (patches)) { + zdir_patch_t *patch = (zdir_patch_t *) zlist_pop (patches); + zdir_patch_destroy (&patch); +} +zlist_destroy (&patches); +zdir_destroy (&older); +zdir_destroy (&newer); + +zdir_t *nosuch = zdir_new ("does\-not\-exist", NULL); +assert (nosuch == NULL); + +// zdir_watch test: +zactor_t *watch = zactor_new (zdir_watch, NULL); +assert (watch); + +if (verbose) { + zsock_send (watch, "s", "VERBOSE"); + assert (zsock_wait (watch) == 0); +} + +zclock_sleep (1001); // wait for initial file to become \*(Aqstable\*(Aq + +zsock_send (watch, "si", "TIMEOUT", 100); +assert (zsock_wait (watch) == 0); + +zsock_send (watch, "ss", "SUBSCRIBE", "zdir\-test\-dir"); +assert (zsock_wait (watch) == 0); + +zsock_send (watch, "ss", "UNSUBSCRIBE", "zdir\-test\-dir"); +assert (zsock_wait (watch) == 0); + +zsock_send (watch, "ss", "SUBSCRIBE", "zdir\-test\-dir"); +assert (zsock_wait (watch) == 0); + +zfile_t *newfile = zfile_new ("zdir\-test\-dir", "test_abc"); +zfile_output (newfile); +fprintf (zfile_handle (newfile), "test file\en"); +zfile_close (newfile); + +zpoller_t *watch_poll = zpoller_new (watch, NULL); + +// poll for a certain timeout before giving up and failing the test\&. +assert (zpoller_wait (watch_poll, 1001) == watch); + +// wait for notification of the file being added +char *path; +int rc = zsock_recv (watch, "sp", &path, &patches); +assert (rc == 0); + +assert (streq (path, "zdir\-test\-dir")); +free (path); + +assert (zlist_size (patches) == 1); + +zdir_patch_t *patch = (zdir_patch_t *) zlist_pop (patches); +assert (streq (zdir_patch_path (patch), "zdir\-test\-dir")); + +zfile_t *patch_file = zdir_patch_file (patch); +assert (streq (zfile_filename (patch_file, ""), "zdir\-test\-dir/test_abc")); + +zdir_patch_destroy (&patch); +zlist_destroy (&patches); + +// remove the file +zfile_remove (newfile); +zfile_destroy (&newfile); + +// poll for a certain timeout before giving up and failing the test\&. +assert (zpoller_wait (watch_poll, 1001) == watch); + +// wait for notification of the file being removed +rc = zsock_recv (watch, "sp", &path, &patches); +assert (rc == 0); + +assert (streq (path, "zdir\-test\-dir")); +free (path); + +assert (zlist_size (patches) == 1); + +patch = (zdir_patch_t *) zlist_pop (patches); +assert (streq (zdir_patch_path (patch), "zdir\-test\-dir")); + +patch_file = zdir_patch_file (patch); +assert (streq (zfile_filename (patch_file, ""), "zdir\-test\-dir/test_abc")); + +zdir_patch_destroy (&patch); +zlist_destroy (&patches); + +zpoller_destroy (&watch_poll); +zactor_destroy (&watch); + +// clean up by removing the test directory\&. +zdir_t *testdir = zdir_new ("zdir\-test\-dir", NULL); +zdir_remove (testdir, true); +zdir_destroy (&testdir); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zdir_patch.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zdir_patch.3 new file mode 100644 index 00000000000000..61789b32c0477c --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zdir_patch.3 @@ -0,0 +1,129 @@ +'\" t +.\" Title: zdir_patch +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZDIR_PATCH" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zdir_patch \- work with directory patches +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +#define ZDIR_PATCH_CREATE 1 // Creates a new file +#define ZDIR_PATCH_DELETE 2 // Delete a file + +// Create new patch +CZMQ_EXPORT zdir_patch_t * + zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); + +// Destroy a patch +CZMQ_EXPORT void + zdir_patch_destroy (zdir_patch_t **self_p); + +// Create copy of a patch\&. If the patch is null, or memory was exhausted, +// returns null\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zdir_patch_t * + zdir_patch_dup (zdir_patch_t *self); + +// Return patch file directory path +CZMQ_EXPORT const char * + zdir_patch_path (zdir_patch_t *self); + +// Return patch file item +CZMQ_EXPORT zfile_t * + zdir_patch_file (zdir_patch_t *self); + +// Return operation +CZMQ_EXPORT int + zdir_patch_op (zdir_patch_t *self); + +// Return patch virtual file path +CZMQ_EXPORT const char * + zdir_patch_vpath (zdir_patch_t *self); + +// Calculate hash digest for file (create only) +CZMQ_EXPORT void + zdir_patch_digest_set (zdir_patch_t *self); + +// Return hash digest for patch file +CZMQ_EXPORT const char * + zdir_patch_digest (zdir_patch_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zdir_patch_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zdir_patch\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zdir_patch class works with one patch, which says "create this file" or "delete this file" (referring to a zfile item each time)\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zdir_patch\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zdir_patch_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zfile_t *file = zfile_new ("\&.", "bilbo"); +assert (file); +zdir_patch_t *patch = zdir_patch_new ("\&.", file, patch_create, "/"); +assert (patch); +zfile_destroy (&file); + +file = zdir_patch_file (patch); +assert (file); +assert (streq (zfile_filename (file, "\&."), "bilbo")); +assert (streq (zdir_patch_vpath (patch), "/bilbo")); +zdir_patch_destroy (&patch); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zfile.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zfile.3 new file mode 100644 index 00000000000000..f3b6591812528f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zfile.3 @@ -0,0 +1,340 @@ +'\" t +.\" Title: zfile +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZFILE" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zfile \- provides methods to work with files in a portable fashion\&. +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// If file exists, populates properties\&. CZMQ supports portable symbolic +// links, which are files with the extension "\&.ln"\&. A symbolic link is a +// text file containing one line, the filename of a target file\&. Reading +// data from the symbolic link actually reads from the target file\&. Path +// may be NULL, in which case it is not used\&. +CZMQ_EXPORT zfile_t * + zfile_new (const char *path, const char *name); + +// Destroy a file item +CZMQ_EXPORT void + zfile_destroy (zfile_t **self_p); + +// Duplicate a file item, returns a newly constructed item\&. If the file +// is null, or memory was exhausted, returns null\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zfile_t * + zfile_dup (zfile_t *self); + +// Return file name, remove path if provided +CZMQ_EXPORT const char * + zfile_filename (zfile_t *self, const char *path); + +// Refresh file properties from disk; this is not done automatically +// on access methods, otherwise it is not possible to compare directory +// snapshots\&. +CZMQ_EXPORT void + zfile_restat (zfile_t *self); + +// Return when the file was last modified\&. If you want this to reflect the +// current situation, call zfile_restat before checking this property\&. +CZMQ_EXPORT time_t + zfile_modified (zfile_t *self); + +// Return the last\-known size of the file\&. If you want this to reflect the +// current situation, call zfile_restat before checking this property\&. +CZMQ_EXPORT off_t + zfile_cursize (zfile_t *self); + +// Return true if the file is a directory\&. If you want this to reflect +// any external changes, call zfile_restat before checking this property\&. +CZMQ_EXPORT bool + zfile_is_directory (zfile_t *self); + +// Return true if the file is a regular file\&. If you want this to reflect +// any external changes, call zfile_restat before checking this property\&. +CZMQ_EXPORT bool + zfile_is_regular (zfile_t *self); + +// Return true if the file is readable by this process\&. If you want this to +// reflect any external changes, call zfile_restat before checking this +// property\&. +CZMQ_EXPORT bool + zfile_is_readable (zfile_t *self); + +// Return true if the file is writeable by this process\&. If you want this +// to reflect any external changes, call zfile_restat before checking this +// property\&. +CZMQ_EXPORT bool + zfile_is_writeable (zfile_t *self); + +// Check if file has stopped changing and can be safely processed\&. +// Updates the file statistics from disk at every call\&. +CZMQ_EXPORT bool + zfile_is_stable (zfile_t *self); + +// Return true if the file was changed on disk since the zfile_t object +// was created, or the last zfile_restat() call made on it\&. +CZMQ_EXPORT bool + zfile_has_changed (zfile_t *self); + +// Remove the file from disk +CZMQ_EXPORT void + zfile_remove (zfile_t *self); + +// Open file for reading +// Returns 0 if OK, \-1 if not found or not accessible +CZMQ_EXPORT int + zfile_input (zfile_t *self); + +// Open file for writing, creating directory if needed +// File is created if necessary; chunks can be written to file at any +// location\&. Returns 0 if OK, \-1 if error\&. +CZMQ_EXPORT int + zfile_output (zfile_t *self); + +// Read chunk from file at specified position\&. If this was the last chunk, +// sets the eof property\&. Returns a null chunk in case of error\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zchunk_t * + zfile_read (zfile_t *self, size_t bytes, off_t offset); + +// Returns true if zfile_read() just read the last chunk in the file\&. +CZMQ_EXPORT bool + zfile_eof (zfile_t *self); + +// Write chunk to file at specified position +// Return 0 if OK, else \-1 +CZMQ_EXPORT int + zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); + +// Read next line of text from file\&. Returns a pointer to the text line, +// or NULL if there was nothing more to read from the file\&. +CZMQ_EXPORT const char * + zfile_readln (zfile_t *self); + +// Close file, if open +CZMQ_EXPORT void + zfile_close (zfile_t *self); + +// Return file handle, if opened +CZMQ_EXPORT FILE * + zfile_handle (zfile_t *self); + +// Calculate SHA1 digest for file, using zdigest class\&. +CZMQ_EXPORT const char * + zfile_digest (zfile_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zfile_test (bool verbose); + +// These methods are deprecated, and now moved to zsys class\&. +CZMQ_EXPORT bool + zfile_exists (const char *filename); +CZMQ_EXPORT ssize_t + zfile_size (const char *filename); +CZMQ_EXPORT mode_t + zfile_mode (const char *filename); +CZMQ_EXPORT int + zfile_delete (const char *filename); +CZMQ_EXPORT bool + zfile_stable (const char *filename); +CZMQ_EXPORT int + zfile_mkdir (const char *pathname); +CZMQ_EXPORT int + zfile_rmdir (const char *pathname); +CZMQ_EXPORT void + zfile_mode_private (void); +CZMQ_EXPORT void + zfile_mode_default (void); +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zfile\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zfile class provides methods to work with disk files\&. A file object provides the modified date, current size, and type of the file\&. You can create a file object for a filename that does not yet exist\&. To read or write data from the file, use the input and output methods, and then read and write chunks\&. The output method lets you both read and write chunks, at any offset\&. Finally, this class provides portable symbolic links\&. If a filename ends in "\&.ln", the first line of text in the file is read, and used as the underlying file for read/write operations\&. This lets you manipulate (e\&.g\&.) copy symbolic links without copying the perhaps very large files they point to\&. +.sp +This class is a new API, deprecating the old zfile class (which still exists but is implemented in zsys now)\&. +.SH "EXAMPLE" +.PP +\fBFrom zfile_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zfile_t *file = zfile_new (NULL, "bilbo"); +assert (file); +assert (streq (zfile_filename (file, "\&."), "bilbo")); +assert (zfile_is_readable (file) == false); +zfile_destroy (&file); + +// Create a test file in some random subdirectory +file = zfile_new ("\&./this/is/a/test", "bilbo"); +assert (file); +int rc = zfile_output (file); +assert (rc == 0); +zchunk_t *chunk = zchunk_new (NULL, 100); +assert (chunk); +zchunk_fill (chunk, 0, 100); + +// Write 100 bytes at position 1,000,000 in the file +rc = zfile_write (file, chunk, 1000000); +assert (rc == 0); +zchunk_destroy (&chunk); +zfile_close (file); +assert (zfile_is_readable (file)); +assert (zfile_cursize (file) == 1000100); +assert (!zfile_is_stable (file)); +assert (zfile_digest (file)); + +// Now truncate file from outside +int handle = open ("\&./this/is/a/test/bilbo", O_WRONLY | O_TRUNC | O_BINARY, 0); +assert (handle >= 0); +rc = write (handle, "Hello, World\en", 13); +assert (rc == 13); +close (handle); +assert (zfile_has_changed (file)); +zclock_sleep (1001); +assert (zfile_has_changed (file)); + +assert (!zfile_is_stable (file)); +zfile_restat (file); +assert (zfile_is_stable (file)); +assert (streq (zfile_digest (file), "4AB299C8AD6ED14F31923DD94F8B5F5CB89DFB54")); + +// Check we can read from file +rc = zfile_input (file); +assert (rc == 0); +chunk = zfile_read (file, 1000100, 0); +assert (chunk); +assert (zchunk_size (chunk) == 13); +zchunk_destroy (&chunk); +zfile_close (file); + +// Check we can read lines from file +rc = zfile_input (file); +assert (rc == 0); +const char *line = zfile_readln (file); +assert (streq (line, "Hello, World")); +line = zfile_readln (file); +assert (line == NULL); +zfile_close (file); + +// Try some fun with symbolic links +zfile_t *link = zfile_new ("\&./this/is/a/test", "bilbo\&.ln"); +assert (link); +rc = zfile_output (link); +assert (rc == 0); +fprintf (zfile_handle (link), "\&./this/is/a/test/bilbo\en"); +zfile_destroy (&link); + +link = zfile_new ("\&./this/is/a/test", "bilbo\&.ln"); +assert (link); +rc = zfile_input (link); +assert (rc == 0); +chunk = zfile_read (link, 1000100, 0); +assert (chunk); +assert (zchunk_size (chunk) == 13); +zchunk_destroy (&chunk); +zfile_destroy (&link); + +// Remove file and directory +zdir_t *dir = zdir_new ("\&./this", NULL); +assert (dir); +assert (zdir_cursize (dir) == 26); +zdir_remove (dir, true); +assert (zdir_cursize (dir) == 0); +zdir_destroy (&dir); + +// Check we can no longer read from file +assert (zfile_is_readable (file)); +zfile_restat (file); +assert (!zfile_is_readable (file)); +rc = zfile_input (file); +assert (rc == \-1); +zfile_destroy (&file); + +file = zfile_new ("\&./", "eof_checkfile"); +assert (file); +// 1\&. Write something first +rc = zfile_output (file); +assert (rc == 0); +chunk = zchunk_new ("123456789", 9); +assert (chunk); + +rc = zfile_write (file, chunk, 0); +assert (rc == 0); +zchunk_destroy (&chunk); +zfile_close (file); +assert (zfile_cursize (file) == 9); + +// 2\&. Read the written something +rc = zfile_input (file); +assert (rc != \-1); +// try to read more bytes than there is in the file +chunk = zfile_read (file, 1000, 0); +assert (zfile_eof(file)); +assert (zchunk_streq (chunk, "123456789")); +zchunk_destroy (&chunk); + +// reading is ok +chunk = zfile_read (file, 5, 0); +assert (!zfile_eof(file)); +assert (zchunk_streq (chunk, "12345")); +zchunk_destroy (&chunk); + +// read from non zero offset until the end +chunk = zfile_read (file, 5, 5); +assert (zfile_eof(file)); +assert (zchunk_streq (chunk, "6789")); +zchunk_destroy (&chunk); +zfile_remove (file); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zframe.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zframe.3 new file mode 100644 index 00000000000000..f723dd61054003 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zframe.3 @@ -0,0 +1,357 @@ +'\" t +.\" Title: zframe +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZFRAME" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zframe \- working with single message frames +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// This class has draft methods, which may change over time\&. They are not +// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. +#define ZFRAME_MORE 1 // +#define ZFRAME_REUSE 2 // +#define ZFRAME_DONTWAIT 4 // + +// Create a new frame\&. If size is not null, allocates the frame data +// to the specified size\&. If additionally, data is not null, copies +// size octets from the specified data into the frame body\&. +CZMQ_EXPORT zframe_t * + zframe_new (const void *data, size_t size); + +// Create an empty (zero\-sized) frame +CZMQ_EXPORT zframe_t * + zframe_new_empty (void); + +// Create a frame with a specified string content\&. +CZMQ_EXPORT zframe_t * + zframe_from (const char *string); + +// Receive frame from socket, returns zframe_t object or NULL if the recv +// was interrupted\&. Does a blocking recv, if you want to not block then use +// zpoller or zloop\&. +CZMQ_EXPORT zframe_t * + zframe_recv (void *source); + +// Destroy a frame +CZMQ_EXPORT void + zframe_destroy (zframe_t **self_p); + +// Send a frame to a socket, destroy frame after sending\&. +// Return \-1 on error, 0 on success\&. +CZMQ_EXPORT int + zframe_send (zframe_t **self_p, void *dest, int flags); + +// Return number of bytes in frame data +CZMQ_EXPORT size_t + zframe_size (zframe_t *self); + +// Return address of frame data +CZMQ_EXPORT byte * + zframe_data (zframe_t *self); + +// Return meta data property for frame +// Caller must free string when finished with it\&. +CZMQ_EXPORT const char * + zframe_meta (zframe_t *self, const char *property); + +// Create a new frame that duplicates an existing frame\&. If frame is null, +// or memory was exhausted, returns null\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zframe_t * + zframe_dup (zframe_t *self); + +// Return frame data encoded as printable hex string, useful for 0MQ UUIDs\&. +// Caller must free string when finished with it\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zframe_strhex (zframe_t *self); + +// Return frame data copied into freshly allocated string +// Caller must free string when finished with it\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zframe_strdup (zframe_t *self); + +// Return TRUE if frame body is equal to string, excluding terminator +CZMQ_EXPORT bool + zframe_streq (zframe_t *self, const char *string); + +// Return frame MORE indicator (1 or 0), set when reading frame from socket +// or by the zframe_set_more() method +CZMQ_EXPORT int + zframe_more (zframe_t *self); + +// Set frame MORE indicator (1 or 0)\&. Note this is NOT used when sending +// frame to socket, you have to specify flag explicitly\&. +CZMQ_EXPORT void + zframe_set_more (zframe_t *self, int more); + +// Return TRUE if two frames have identical size and data +// If either frame is NULL, equality is always false\&. +CZMQ_EXPORT bool + zframe_eq (zframe_t *self, zframe_t *other); + +// Set new contents for frame +CZMQ_EXPORT void + zframe_reset (zframe_t *self, const void *data, size_t size); + +// Send message to zsys log sink (may be stdout, or system facility as +// configured by zsys_set_logstream)\&. Prefix shows before frame, if not null\&. +CZMQ_EXPORT void + zframe_print (zframe_t *self, const char *prefix); + +// Probe the supplied object, and report if it looks like a zframe_t\&. +CZMQ_EXPORT bool + zframe_is (void *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zframe_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Return frame routing ID, if the frame came from a ZMQ_SERVER socket\&. +// Else returns zero\&. +CZMQ_EXPORT uint32_t + zframe_routing_id (zframe_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on frame\&. This is used if/when the frame is sent to a +// ZMQ_SERVER socket\&. +CZMQ_EXPORT void + zframe_set_routing_id (zframe_t *self, uint32_t routing_id); + +// *** Draft method, for development use, may change without warning *** +// Return frame group of radio\-dish pattern\&. +CZMQ_EXPORT const char * + zframe_group (zframe_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set group on frame\&. This is used if/when the frame is sent to a +// ZMQ_RADIO socket\&. +// Return \-1 on error, 0 on success\&. +CZMQ_EXPORT int + zframe_set_group (zframe_t *self, const char *group); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zframe\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zframe class provides methods to send and receive single message frames across 0MQ sockets\&. A \fIframe\fR corresponds to one zmq_msg_t\&. When you read a frame from a socket, the zframe_more() method indicates if the frame is part of an unfinished multipart message\&. The zframe_send method normally destroys the frame, but with the ZFRAME_REUSE flag, you can send the same frame many times\&. Frames are binary, and this class has no special support for text data\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zframe\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zframe_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create two PAIR sockets and connect over inproc +zsock_t *output = zsock_new_pair ("@tcp://127\&.0\&.0\&.1:9001"); +assert (output); +zsock_t *input = zsock_new_pair (">tcp://127\&.0\&.0\&.1:9001"); +assert (input); + +// Send five different frames, test ZFRAME_MORE +int frame_nbr; +for (frame_nbr = 0; frame_nbr < 5; frame_nbr++) { + frame = zframe_new ("Hello", 5); + assert (frame); + rc = zframe_send (&frame, output, ZFRAME_MORE); + assert (rc == 0); +} +// Send same frame five times, test ZFRAME_REUSE +frame = zframe_new ("Hello", 5); +assert (frame); +for (frame_nbr = 0; frame_nbr < 5; frame_nbr++) { + rc = zframe_send (&frame, output, ZFRAME_MORE + ZFRAME_REUSE); + assert (rc == 0); +} +assert (frame); +zframe_t *copy = zframe_dup (frame); +assert (zframe_eq (frame, copy)); +zframe_destroy (&frame); +assert (!zframe_eq (frame, copy)); +assert (zframe_size (copy) == 5); +zframe_destroy (©); +assert (!zframe_eq (frame, copy)); + +// Test zframe_new_empty +frame = zframe_new_empty (); +assert (frame); +assert (zframe_size (frame) == 0); +zframe_destroy (&frame); + +// Send END frame +frame = zframe_new ("NOT", 3); +assert (frame); +zframe_reset (frame, "END", 3); +char *string = zframe_strhex (frame); +assert (streq (string, "454E44")); +free (string); +string = zframe_strdup (frame); +assert (streq (string, "END")); +free (string); +rc = zframe_send (&frame, output, 0); +assert (rc == 0); + +// Read and count until we receive END +frame_nbr = 0; +for (frame_nbr = 0;; frame_nbr++) { + zframe_t *frame = zframe_recv (input); + if (zframe_streq (frame, "END")) { + zframe_destroy (&frame); + break; + } + assert (zframe_more (frame)); + zframe_set_more (frame, 0); + assert (zframe_more (frame) == 0); + zframe_destroy (&frame); +} +assert (frame_nbr == 10); + +#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (4, 1, 0)) +// Test zframe_meta +frame = zframe_new ("Hello", 5); +assert (frame); +rc = zframe_send (&frame, output, 0); +assert (rc == 0); +frame = zframe_recv (input); +const char *meta = zframe_meta (frame, "Socket\-Type"); +assert (meta != NULL); +assert (streq (meta, "PAIR")); +assert (zframe_meta (frame, "nonexistent") == NULL); +zframe_destroy (&frame); +#endif + +zsock_destroy (&input); +zsock_destroy (&output); + +#if defined (ZMQ_SERVER) +// Create server and client sockets and connect over inproc +zsock_t *server = zsock_new_server ("inproc://zframe\-test\-routing"); +assert (server); +zsock_t *client = zsock_new_client ("inproc://zframe\-test\-routing"); +assert (client); + +// Send request from client to server +zframe_t *request = zframe_new ("Hello", 5); +assert (request); +rc = zframe_send (&request, client, 0); +assert (rc == 0); +assert (!request); + +// Read request and send reply +request = zframe_recv (server); +assert (request); +assert (zframe_streq (request, "Hello")); +assert (zframe_routing_id (request)); + +zframe_t *reply = zframe_new ("World", 5); +assert (reply); +zframe_set_routing_id (reply, zframe_routing_id (request)); +rc = zframe_send (&reply, server, 0); +assert (rc == 0); +zframe_destroy (&request); + +// Read reply +reply = zframe_recv (client); +assert (zframe_streq (reply, "World")); +assert (zframe_routing_id (reply) == 0); +zframe_destroy (&reply); + +// Client and server disallow multipart +frame = zframe_new ("Hello", 5); +rc = zframe_send (&frame, client, ZFRAME_MORE); +assert (rc == \-1); +rc = zframe_send (&frame, server, ZFRAME_MORE); +assert (rc == \-1); +zframe_destroy (&frame); + +zsock_destroy (&client); +zsock_destroy (&server); +#endif + +#ifdef ZMQ_RADIO +// Create radio and dish sockets and connect over inproc +zsock_t *radio = zsock_new_radio ("inproc://zframe\-test\-radio"); +assert (radio); +zsock_t *dish = zsock_new_dish ("inproc://zframe\-test\-radio"); +assert (dish); + +// Join the group +rc = zsock_join (dish, "World"); +assert (rc == 0); + +// Publish message from radio +zframe_t *message = zframe_new ("Hello", 5); +assert (message); +rc = zframe_set_group (message, "World"); +assert (rc == 0); +rc = zframe_send (&message, radio, 0); +assert (rc == 0); +assert (!message); + +// Receive the message from dish +message = zframe_recv (dish); +assert (message); +assert (zframe_streq (message, "Hello")); +assert (strcmp("World", zframe_group (message)) == 0); +zframe_destroy (&message); + +zsock_destroy (&dish); +zsock_destroy (&radio); +#endif +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zgossip.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zgossip.3 new file mode 100644 index 00000000000000..170d3a2271bc83 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zgossip.3 @@ -0,0 +1,338 @@ +'\" t +.\" Title: zgossip +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZGOSSIP" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zgossip \- decentralized configuration management +.SH "SYNOPSIS" +.sp +.nf +// To work with zgossip, use the CZMQ zactor API: +// +// Create new zgossip instance, passing logging prefix: +// +// zactor_t *zgossip = zactor_new (zgossip, "myname"); +// +// Destroy zgossip instance +// +// zactor_destroy (&zgossip); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (zgossip, "VERBOSE"); +// +// Bind zgossip to specified endpoint\&. TCP endpoints may specify +// the port number as "*" to aquire an ephemeral port: +// +// zstr_sendx (zgossip, "BIND", endpoint, NULL); +// +// Return assigned port number, specifically when BIND was done using an +// an ephemeral port: +// +// zstr_sendx (zgossip, "PORT", NULL); +// char *command, *port_str; +// zstr_recvx (zgossip, &command, &port_str, NULL); +// assert (streq (command, "PORT")); +// +// Specify configuration file to load, overwriting any previous loaded +// configuration file or options: +// +// zstr_sendx (zgossip, "LOAD", filename, NULL); +// +// Set configuration path value: +// +// zstr_sendx (zgossip, "SET", path, value, NULL); +// +// Save configuration data to config file on disk: +// +// zstr_sendx (zgossip, "SAVE", filename, NULL); +// +// Send zmsg_t instance to zgossip: +// +// zactor_send (zgossip, &msg); +// +// Receive zmsg_t instance from zgossip: +// +// zmsg_t *msg = zactor_recv (zgossip); +// +// This is the zgossip constructor as a zactor_fn: +// +CZMQ_EXPORT void + zgossip (zsock_t *pipe, void *args); + +// Self test of this class +CZMQ_EXPORT void + zgossip_test (bool verbose); +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zgossip\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +Implements a gossip protocol for decentralized configuration management\&. Your applications nodes form a loosely connected network (which can have cycles), and publish name/value tuples\&. Each node re\-distributes the new tuples it receives, so that the entire network eventually achieves a consistent state\&. The current design does not expire tuples\&. +.sp +Provides these commands (sent as multipart strings to the actor): +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +BIND endpoint \(em binds the gossip service to specified endpoint +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +PORT \(em returns the last TCP port, if any, used for binding +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +LOAD configfile \(em load configuration from specified file +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +SET configpath value \(em set configuration path = value +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +SAVE configfile \(em save configuration to specified file +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +CONNECT endpoint \(em connect the gossip service to the specified peer +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +PUBLISH key value \(em publish a key/value pair to the gossip cluster +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +STATUS \(em return number of key/value pairs held by gossip service +.RE +.sp +Returns these messages: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +PORT number \(em reply to PORT command +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +STATUS number \(em reply to STATUS command +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +DELIVER key value \(em new tuple delivered from network +.RE +.sp +The gossip protocol distributes information around a loosely\-connected network of gossip services\&. The information consists of name/value pairs published by applications at any point in the network\&. The goal of the gossip protocol is to create eventual consistency between all the using applications\&. +.sp +The name/value pairs (tuples) can be used for configuration data, for status updates, for presence, or for discovery\&. When used for discovery, the gossip protocol works as an alternative to e\&.g\&. UDP beaconing\&. +.sp +The gossip network consists of a set of loosely\-coupled nodes that exchange tuples\&. Nodes can be connected across arbitrary transports, so the gossip network can have nodes that communicate over inproc, over IPC, and/or over TCP, at the same time\&. +.sp +Each node runs the same stack, which is a server\-client hybrid using a modified Harmony pattern (from Chapter 8 of the Guide): \m[blue]\fBhttp://zguide\&.zeromq\&.org/page:all#True\-Peer\-Connectivity\-Harmony\-Pattern\fR\m[] +.sp +Each node provides a ROUTER socket that accepts client connections on an key defined by the application via a BIND command\&. The state machine for these connections is in zgossip\&.xml, and the generated code is in zgossip_engine\&.inc\&. +.sp +Each node additionally creates outbound connections via DEALER sockets to a set of servers ("remotes"), and under control of the calling app, which sends CONNECT commands for each configured remote\&. +.sp +The messages between client and server are defined in zgossip_msg\&.xml\&. We built this stack using the zeromq/zproto toolkit\&. +.sp +To join the gossip network, a node connects to one or more peers\&. Each peer acts as a forwarder\&. This loosely\-coupled network can scale to thousands of nodes\&. However the gossip protocol is NOT designed to be efficient, and should not be used for application data, as the same tuples may be sent many times across the network\&. +.sp +The basic logic of the gossip service is to accept PUBLISH messages from its owning application, and to forward these to every remote, and every client it talks to\&. When a node gets a duplicate tuple, it throws it away\&. When a node gets a new tuple, it stores it, and fowards it as just described\&. At any point the application can access the node\(cqs set of tuples\&. +.sp +At present there is no way to expire tuples from the network\&. +.sp +The assumptions in this design are: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The data set is slow\-changing\&. Thus, the cost of the gossip protocol is irrelevant with respect to other traffic\&. +.RE +.SH "EXAMPLE" +.PP +\fBFrom zgossip_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Test basic client\-to\-server operation of the protocol +zactor_t *server = zactor_new (zgossip, "server"); +assert (server); +if (verbose) + zstr_send (server, "VERBOSE"); +zstr_sendx (server, "BIND", "inproc://zgossip", NULL); + +zsock_t *client = zsock_new (ZMQ_DEALER); +assert (client); +zsock_set_rcvtimeo (client, 2000); +int rc = zsock_connect (client, "inproc://zgossip"); +assert (rc == 0); + +// Send HELLO, which gets no message +zgossip_msg_t *message = zgossip_msg_new (); +zgossip_msg_set_id (message, ZGOSSIP_MSG_HELLO); +zgossip_msg_send (message, client); + +// Send PING, expect PONG back +zgossip_msg_set_id (message, ZGOSSIP_MSG_PING); +zgossip_msg_send (message, client); +zgossip_msg_recv (message, client); +assert (zgossip_msg_id (message) == ZGOSSIP_MSG_PONG); +zgossip_msg_destroy (&message); + +zactor_destroy (&server); +zsock_destroy (&client); + +// Test peer\-to\-peer operations +zactor_t *base = zactor_new (zgossip, "base"); +assert (base); +if (verbose) + zstr_send (base, "VERBOSE"); +// Set a 100msec timeout on clients so we can test expiry +zstr_sendx (base, "SET", "server/timeout", "100", NULL); +zstr_sendx (base, "BIND", "inproc://base", NULL); + +zactor_t *alpha = zactor_new (zgossip, "alpha"); +assert (alpha); +zstr_sendx (alpha, "CONNECT", "inproc://base", NULL); +zstr_sendx (alpha, "PUBLISH", "inproc://alpha\-1", "service1", NULL); +zstr_sendx (alpha, "PUBLISH", "inproc://alpha\-2", "service2", NULL); + +zactor_t *beta = zactor_new (zgossip, "beta"); +assert (beta); +zstr_sendx (beta, "CONNECT", "inproc://base", NULL); +zstr_sendx (beta, "PUBLISH", "inproc://beta\-1", "service1", NULL); +zstr_sendx (beta, "PUBLISH", "inproc://beta\-2", "service2", NULL); + +// got nothing +zclock_sleep (200); + +zactor_destroy (&base); +zactor_destroy (&alpha); +zactor_destroy (&beta); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zhash.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zhash.3 new file mode 100644 index 00000000000000..8d0d45ab3f3184 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zhash.3 @@ -0,0 +1,382 @@ +'\" t +.\" Title: zhash +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZHASH" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zhash \- simple generic hash container +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Callback function for zhash_freefn method +typedef void (zhash_free_fn) ( + void *data); + +// Create a new, empty hash container +CZMQ_EXPORT zhash_t * + zhash_new (void); + +// Unpack binary frame into a new hash table\&. Packed data must follow format +// defined by zhash_pack\&. Hash table is set to autofree\&. An empty frame +// unpacks to an empty hash table\&. +CZMQ_EXPORT zhash_t * + zhash_unpack (zframe_t *frame); + +// Destroy a hash container and all items in it +CZMQ_EXPORT void + zhash_destroy (zhash_t **self_p); + +// Insert item into hash table with specified key and item\&. +// If key is already present returns \-1 and leaves existing item unchanged +// Returns 0 on success\&. +CZMQ_EXPORT int + zhash_insert (zhash_t *self, const char *key, void *item); + +// Update item into hash table with specified key and item\&. +// If key is already present, destroys old item and inserts new one\&. +// Use free_fn method to ensure deallocator is properly called on item\&. +CZMQ_EXPORT void + zhash_update (zhash_t *self, const char *key, void *item); + +// Remove an item specified by key from the hash table\&. If there was no such +// item, this function does nothing\&. +CZMQ_EXPORT void + zhash_delete (zhash_t *self, const char *key); + +// Return the item at the specified key, or null +CZMQ_EXPORT void * + zhash_lookup (zhash_t *self, const char *key); + +// Reindexes an item from an old key to a new key\&. If there was no such +// item, does nothing\&. Returns 0 if successful, else \-1\&. +CZMQ_EXPORT int + zhash_rename (zhash_t *self, const char *old_key, const char *new_key); + +// Set a free function for the specified hash table item\&. When the item is +// destroyed, the free function, if any, is called on that item\&. +// Use this when hash items are dynamically allocated, to ensure that +// you don\*(Aqt have memory leaks\&. You can pass \*(Aqfree\*(Aq or NULL as a free_fn\&. +// Returns the item, or NULL if there is no such item\&. +CZMQ_EXPORT void * + zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); + +// Return the number of keys/items in the hash table +CZMQ_EXPORT size_t + zhash_size (zhash_t *self); + +// Make copy of hash table; if supplied table is null, returns null\&. +// Does not copy items themselves\&. Rebuilds new table so may be slow on +// very large tables\&. NOTE: only works with item values that are strings +// since there\*(Aqs no other way to know how to duplicate the item value\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zhash_t * + zhash_dup (zhash_t *self); + +// Return keys for items in table +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zlist_t * + zhash_keys (zhash_t *self); + +// Simple iterator; returns first item in hash table, in no given order, +// or NULL if the table is empty\&. This method is simpler to use than the +// foreach() method, which is deprecated\&. To access the key for this item +// use zhash_cursor()\&. NOTE: do NOT modify the table while iterating\&. +CZMQ_EXPORT void * + zhash_first (zhash_t *self); + +// Simple iterator; returns next item in hash table, in no given order, +// or NULL if the last item was already returned\&. Use this together with +// zhash_first() to process all items in a hash table\&. If you need the +// items in sorted order, use zhash_keys() and then zlist_sort()\&. To +// access the key for this item use zhash_cursor()\&. NOTE: do NOT modify +// the table while iterating\&. +CZMQ_EXPORT void * + zhash_next (zhash_t *self); + +// After a successful first/next method, returns the key for the item that +// was returned\&. This is a constant string that you may not modify or +// deallocate, and which lasts as long as the item in the hash\&. After an +// unsuccessful first/next, returns NULL\&. +CZMQ_EXPORT const char * + zhash_cursor (zhash_t *self); + +// Add a comment to hash table before saving to disk\&. You can add as many +// comment lines as you like\&. These comment lines are discarded when loading +// the file\&. If you use a null format, all comments are deleted\&. +CZMQ_EXPORT void + zhash_comment (zhash_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Serialize hash table to a binary frame that can be sent in a message\&. +// The packed format is compatible with the \*(Aqdictionary\*(Aq type defined in +// http://rfc\&.zeromq\&.org/spec:35/FILEMQ, and implemented by zproto: +// +// ; A list of name/value pairs +// dictionary = dict\-count *( dict\-name dict\-value ) +// dict\-count = number\-4 +// dict\-value = longstr +// dict\-name = string +// +// ; Strings are always length + text contents +// longstr = number\-4 *VCHAR +// string = number\-1 *VCHAR +// +// ; Numbers are unsigned integers in network byte order +// number\-1 = 1OCTET +// number\-4 = 4OCTET +// +// Comments are not included in the packed data\&. Item values MUST be +// strings\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zframe_t * + zhash_pack (zhash_t *self); + +// Save hash table to a text file in name=value format\&. Hash values must be +// printable strings; keys may not contain \*(Aq=\*(Aq character\&. Returns 0 if OK, +// else \-1 if a file error occurred\&. +CZMQ_EXPORT int + zhash_save (zhash_t *self, const char *filename); + +// Load hash table from a text file in name=value format; hash table must +// already exist\&. Hash values must printable strings; keys may not contain +// \*(Aq=\*(Aq character\&. Returns 0 if OK, else \-1 if a file was not readable\&. +CZMQ_EXPORT int + zhash_load (zhash_t *self, const char *filename); + +// When a hash table was loaded from a file by zhash_load, this method will +// reload the file if it has been modified since, and is "stable", i\&.e\&. not +// still changing\&. Returns 0 if OK, \-1 if there was an error reloading the +// file\&. +CZMQ_EXPORT int + zhash_refresh (zhash_t *self); + +// Set hash for automatic value destruction +CZMQ_EXPORT void + zhash_autofree (zhash_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zhash_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zhash\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +zhash is an expandable hash table container\&. This is a simple container\&. For heavy\-duty applications we recommend using zhashx\&. +.sp +Note that it\(cqs relatively slow (50K insertions/deletes per second), so don\(cqt do inserts/updates on the critical path for message I/O\&. It can do 2\&.5M lookups per second for 16\-char keys\&. Timed on a 1\&.6GHz CPU\&. +.SH "EXAMPLE" +.PP +\fBFrom zhash_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zhash_t *hash = zhash_new (); +assert (hash); +assert (zhash_size (hash) == 0); +assert (zhash_first (hash) == NULL); +assert (zhash_cursor (hash) == NULL); + +// Insert some items +int rc; +rc = zhash_insert (hash, "DEADBEEF", "dead beef"); +char *item = (char *) zhash_first (hash); +assert (streq (zhash_cursor (hash), "DEADBEEF")); +assert (streq (item, "dead beef")); +assert (rc == 0); +rc = zhash_insert (hash, "ABADCAFE", "a bad cafe"); +assert (rc == 0); +rc = zhash_insert (hash, "C0DEDBAD", "coded bad"); +assert (rc == 0); +rc = zhash_insert (hash, "DEADF00D", "dead food"); +assert (rc == 0); +assert (zhash_size (hash) == 4); + +// Look for existing items +item = (char *) zhash_lookup (hash, "DEADBEEF"); +assert (streq (item, "dead beef")); +item = (char *) zhash_lookup (hash, "ABADCAFE"); +assert (streq (item, "a bad cafe")); +item = (char *) zhash_lookup (hash, "C0DEDBAD"); +assert (streq (item, "coded bad")); +item = (char *) zhash_lookup (hash, "DEADF00D"); +assert (streq (item, "dead food")); + +// Look for non\-existent items +item = (char *) zhash_lookup (hash, "foo"); +assert (item == NULL); + +// Try to insert duplicate items +rc = zhash_insert (hash, "DEADBEEF", "foo"); +assert (rc == \-1); +item = (char *) zhash_lookup (hash, "DEADBEEF"); +assert (streq (item, "dead beef")); + +// Some rename tests + +// Valid rename, key is now LIVEBEEF +rc = zhash_rename (hash, "DEADBEEF", "LIVEBEEF"); +assert (rc == 0); +item = (char *) zhash_lookup (hash, "LIVEBEEF"); +assert (streq (item, "dead beef")); + +// Trying to rename an unknown item to a non\-existent key +rc = zhash_rename (hash, "WHATBEEF", "NONESUCH"); +assert (rc == \-1); + +// Trying to rename an unknown item to an existing key +rc = zhash_rename (hash, "WHATBEEF", "LIVEBEEF"); +assert (rc == \-1); +item = (char *) zhash_lookup (hash, "LIVEBEEF"); +assert (streq (item, "dead beef")); + +// Trying to rename an existing item to another existing item +rc = zhash_rename (hash, "LIVEBEEF", "ABADCAFE"); +assert (rc == \-1); +item = (char *) zhash_lookup (hash, "LIVEBEEF"); +assert (streq (item, "dead beef")); +item = (char *) zhash_lookup (hash, "ABADCAFE"); +assert (streq (item, "a bad cafe")); + +// Test keys method +zlist_t *keys = zhash_keys (hash); +assert (zlist_size (keys) == 4); +zlist_destroy (&keys); + +// Test dup method +zhash_t *copy = zhash_dup (hash); +assert (zhash_size (copy) == 4); +item = (char *) zhash_lookup (copy, "LIVEBEEF"); +assert (item); +assert (streq (item, "dead beef")); +zhash_destroy (©); + +// Test pack/unpack methods +zframe_t *frame = zhash_pack (hash); +copy = zhash_unpack (frame); +zframe_destroy (&frame); +assert (zhash_size (copy) == 4); +item = (char *) zhash_lookup (copy, "LIVEBEEF"); +assert (item); +assert (streq (item, "dead beef")); +zhash_destroy (©); + +// Test save and load +zhash_comment (hash, "This is a test file"); +zhash_comment (hash, "Created by %s", "czmq_selftest"); +zhash_save (hash, "\&.cache"); +copy = zhash_new (); +assert (copy); +zhash_load (copy, "\&.cache"); +item = (char *) zhash_lookup (copy, "LIVEBEEF"); +assert (item); +assert (streq (item, "dead beef")); +zhash_destroy (©); +zsys_file_delete ("\&.cache"); + +// Delete a item +zhash_delete (hash, "LIVEBEEF"); +item = (char *) zhash_lookup (hash, "LIVEBEEF"); +assert (item == NULL); +assert (zhash_size (hash) == 3); + +// Check that the queue is robust against random usage +struct { + char name [100]; + bool exists; +} testset [200]; +memset (testset, 0, sizeof (testset)); +int testmax = 200, testnbr, iteration; + +srandom ((unsigned) time (NULL)); +for (iteration = 0; iteration < 25000; iteration++) { + testnbr = randof (testmax); + assert (testnbr != testmax); + assert (testnbr < testmax); + if (testset [testnbr]\&.exists) { + item = (char *) zhash_lookup (hash, testset [testnbr]\&.name); + assert (item); + zhash_delete (hash, testset [testnbr]\&.name); + testset [testnbr]\&.exists = false; + } + else { + sprintf (testset [testnbr]\&.name, "%x\-%x", rand (), rand ()); + if (zhash_insert (hash, testset [testnbr]\&.name, "") == 0) + testset [testnbr]\&.exists = true; + } +} +// Test 10K lookups +for (iteration = 0; iteration < 10000; iteration++) + item = (char *) zhash_lookup (hash, "DEADBEEFABADCAFE"); + +// Destructor should be safe to call twice +zhash_destroy (&hash); +zhash_destroy (&hash); +assert (hash == NULL); + +// Test autofree; automatically copies and frees string values +hash = zhash_new (); +assert (hash); +zhash_autofree (hash); +char value [255]; +strcpy (value, "This is a string"); +rc = zhash_insert (hash, "key1", value); +assert (rc == 0); +strcpy (value, "Inserting with the same key will fail"); +rc = zhash_insert (hash, "key1", value); +assert (rc == \-1); +strcpy (value, "Ring a ding ding"); +rc = zhash_insert (hash, "key2", value); +assert (rc == 0); +assert (streq ((char *) zhash_lookup (hash, "key1"), "This is a string")); +assert (streq ((char *) zhash_lookup (hash, "key2"), "Ring a ding ding")); +zhash_destroy (&hash); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zhashx.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zhashx.3 new file mode 100644 index 00000000000000..d78b29a4312ecb --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zhashx.3 @@ -0,0 +1,498 @@ +'\" t +.\" Title: zhashx +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZHASHX" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zhashx \- extended generic hash container +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// This class has draft methods, which may change over time\&. They are not +// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. +// Destroy an item +typedef void (zhashx_destructor_fn) ( + void **item); + +// Duplicate an item +typedef void * (zhashx_duplicator_fn) ( + const void *item); + +// Compare two items, for sorting +typedef int (zhashx_comparator_fn) ( + const void *item1, const void *item2); + +// compare two items, for sorting +typedef void (zhashx_free_fn) ( + void *data); + +// compare two items, for sorting +typedef size_t (zhashx_hash_fn) ( + const void *key); + +// Serializes an item to a longstr\&. +// The caller takes ownership of the newly created object\&. +typedef char * (zhashx_serializer_fn) ( + const void *item); + +// Deserializes a longstr into an item\&. +// The caller takes ownership of the newly created object\&. +typedef void * (zhashx_deserializer_fn) ( + const char *item_str); + +// Create a new, empty hash container +CZMQ_EXPORT zhashx_t * + zhashx_new (void); + +// Unpack binary frame into a new hash table\&. Packed data must follow format +// defined by zhashx_pack\&. Hash table is set to autofree\&. An empty frame +// unpacks to an empty hash table\&. +CZMQ_EXPORT zhashx_t * + zhashx_unpack (zframe_t *frame); + +// Destroy a hash container and all items in it +CZMQ_EXPORT void + zhashx_destroy (zhashx_t **self_p); + +// Insert item into hash table with specified key and item\&. +// If key is already present returns \-1 and leaves existing item unchanged +// Returns 0 on success\&. +CZMQ_EXPORT int + zhashx_insert (zhashx_t *self, const void *key, void *item); + +// Update or insert item into hash table with specified key and item\&. If the +// key is already present, destroys old item and inserts new one\&. If you set +// a container item destructor, this is called on the old value\&. If the key +// was not already present, inserts a new item\&. Sets the hash cursor to the +// new item\&. +CZMQ_EXPORT void + zhashx_update (zhashx_t *self, const void *key, void *item); + +// Remove an item specified by key from the hash table\&. If there was no such +// item, this function does nothing\&. +CZMQ_EXPORT void + zhashx_delete (zhashx_t *self, const void *key); + +// Delete all items from the hash table\&. If the key destructor is +// set, calls it on every key\&. If the item destructor is set, calls +// it on every item\&. +CZMQ_EXPORT void + zhashx_purge (zhashx_t *self); + +// Return the item at the specified key, or null +CZMQ_EXPORT void * + zhashx_lookup (zhashx_t *self, const void *key); + +// Reindexes an item from an old key to a new key\&. If there was no such +// item, does nothing\&. Returns 0 if successful, else \-1\&. +CZMQ_EXPORT int + zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); + +// Set a free function for the specified hash table item\&. When the item is +// destroyed, the free function, if any, is called on that item\&. +// Use this when hash items are dynamically allocated, to ensure that +// you don\*(Aqt have memory leaks\&. You can pass \*(Aqfree\*(Aq or NULL as a free_fn\&. +// Returns the item, or NULL if there is no such item\&. +CZMQ_EXPORT void * + zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); + +// Return the number of keys/items in the hash table +CZMQ_EXPORT size_t + zhashx_size (zhashx_t *self); + +// Return a zlistx_t containing the keys for the items in the +// table\&. Uses the key_duplicator to duplicate all keys and sets the +// key_destructor as destructor for the list\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zlistx_t * + zhashx_keys (zhashx_t *self); + +// Return a zlistx_t containing the values for the items in the +// table\&. Uses the duplicator to duplicate all items and sets the +// destructor as destructor for the list\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zlistx_t * + zhashx_values (zhashx_t *self); + +// Simple iterator; returns first item in hash table, in no given order, +// or NULL if the table is empty\&. This method is simpler to use than the +// foreach() method, which is deprecated\&. To access the key for this item +// use zhashx_cursor()\&. NOTE: do NOT modify the table while iterating\&. +CZMQ_EXPORT void * + zhashx_first (zhashx_t *self); + +// Simple iterator; returns next item in hash table, in no given order, +// or NULL if the last item was already returned\&. Use this together with +// zhashx_first() to process all items in a hash table\&. If you need the +// items in sorted order, use zhashx_keys() and then zlistx_sort()\&. To +// access the key for this item use zhashx_cursor()\&. NOTE: do NOT modify +// the table while iterating\&. +CZMQ_EXPORT void * + zhashx_next (zhashx_t *self); + +// After a successful first/next method, returns the key for the item that +// was returned\&. This is a constant string that you may not modify or +// deallocate, and which lasts as long as the item in the hash\&. After an +// unsuccessful first/next, returns NULL\&. +CZMQ_EXPORT const void * + zhashx_cursor (zhashx_t *self); + +// Add a comment to hash table before saving to disk\&. You can add as many +// comment lines as you like\&. These comment lines are discarded when loading +// the file\&. If you use a null format, all comments are deleted\&. +CZMQ_EXPORT void + zhashx_comment (zhashx_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Save hash table to a text file in name=value format\&. Hash values must be +// printable strings; keys may not contain \*(Aq=\*(Aq character\&. Returns 0 if OK, +// else \-1 if a file error occurred\&. +CZMQ_EXPORT int + zhashx_save (zhashx_t *self, const char *filename); + +// Load hash table from a text file in name=value format; hash table must +// already exist\&. Hash values must printable strings; keys may not contain +// \*(Aq=\*(Aq character\&. Returns 0 if OK, else \-1 if a file was not readable\&. +CZMQ_EXPORT int + zhashx_load (zhashx_t *self, const char *filename); + +// When a hash table was loaded from a file by zhashx_load, this method will +// reload the file if it has been modified since, and is "stable", i\&.e\&. not +// still changing\&. Returns 0 if OK, \-1 if there was an error reloading the +// file\&. +CZMQ_EXPORT int + zhashx_refresh (zhashx_t *self); + +// Serialize hash table to a binary frame that can be sent in a message\&. +// The packed format is compatible with the \*(Aqdictionary\*(Aq type defined in +// http://rfc\&.zeromq\&.org/spec:35/FILEMQ, and implemented by zproto: +// +// ; A list of name/value pairs +// dictionary = dict\-count *( dict\-name dict\-value ) +// dict\-count = number\-4 +// dict\-value = longstr +// dict\-name = string +// +// ; Strings are always length + text contents +// longstr = number\-4 *VCHAR +// string = number\-1 *VCHAR +// +// ; Numbers are unsigned integers in network byte order +// number\-1 = 1OCTET +// number\-4 = 4OCTET +// +// Comments are not included in the packed data\&. Item values MUST be +// strings\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zframe_t * + zhashx_pack (zhashx_t *self); + +// Make a copy of the list; items are duplicated if you set a duplicator +// for the list, otherwise not\&. Copying a null reference returns a null +// reference\&. Note that this method\*(Aqs behavior changed slightly for CZMQ +// v3\&.x, as it does not set nor respect autofree\&. It does however let you +// duplicate any hash table safely\&. The old behavior is in zhashx_dup_v2\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zhashx_t * + zhashx_dup (zhashx_t *self); + +// Set a user\-defined deallocator for hash items; by default items are not +// freed when the hash is destroyed\&. +CZMQ_EXPORT void + zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); + +// Set a user\-defined duplicator for hash items; by default items are not +// copied when the hash is duplicated\&. +CZMQ_EXPORT void + zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); + +// Set a user\-defined deallocator for keys; by default keys are freed +// when the hash is destroyed using free()\&. +CZMQ_EXPORT void + zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); + +// Set a user\-defined duplicator for keys; by default keys are duplicated +// using strdup\&. +CZMQ_EXPORT void + zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); + +// Set a user\-defined comparator for keys; by default keys are +// compared using strcmp\&. +CZMQ_EXPORT void + zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); + +// Set a user\-defined comparator for keys; by default keys are +// compared using strcmp\&. +CZMQ_EXPORT void + zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); + +// Make copy of hash table; if supplied table is null, returns null\&. +// Does not copy items themselves\&. Rebuilds new table so may be slow on +// very large tables\&. NOTE: only works with item values that are strings +// since there\*(Aqs no other way to know how to duplicate the item value\&. +CZMQ_EXPORT zhashx_t * + zhashx_dup_v2 (zhashx_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zhashx_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Same as unpack but uses a user\-defined deserializer function to convert +// a longstr back into item format\&. +CZMQ_EXPORT zhashx_t * + zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); + +// *** Draft method, for development use, may change without warning *** +// Same as pack but uses a user\-defined serializer function to convert items +// into longstr\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zframe_t * + zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zhashx\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +zhashx is an extended hash table container with more functionality than zhash, its simpler cousin\&. +.sp +The hash table always has a size that is prime and roughly doubles its size when 75% full\&. In case of hash collisions items are chained in a linked list\&. The hash table size is increased slightly (up to 5 times before roughly doubling the size) when an overly long chain (between 1 and 63 items depending on table size) is detected\&. +.SH "EXAMPLE" +.PP +\fBFrom zhashx_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zhashx_t *hash = zhashx_new (); +assert (hash); +assert (zhashx_size (hash) == 0); +assert (zhashx_first (hash) == NULL); +assert (zhashx_cursor (hash) == NULL); + +// Insert some items +int rc; +rc = zhashx_insert (hash, "DEADBEEF", "dead beef"); +char *item = (char *) zhashx_first (hash); +assert (streq ((char *) zhashx_cursor (hash), "DEADBEEF")); +assert (streq (item, "dead beef")); +assert (rc == 0); +rc = zhashx_insert (hash, "ABADCAFE", "a bad cafe"); +assert (rc == 0); +rc = zhashx_insert (hash, "C0DEDBAD", "coded bad"); +assert (rc == 0); +rc = zhashx_insert (hash, "DEADF00D", "dead food"); +assert (rc == 0); +assert (zhashx_size (hash) == 4); + +// Look for existing items +item = (char *) zhashx_lookup (hash, "DEADBEEF"); +assert (streq (item, "dead beef")); +item = (char *) zhashx_lookup (hash, "ABADCAFE"); +assert (streq (item, "a bad cafe")); +item = (char *) zhashx_lookup (hash, "C0DEDBAD"); +assert (streq (item, "coded bad")); +item = (char *) zhashx_lookup (hash, "DEADF00D"); +assert (streq (item, "dead food")); + +// Look for non\-existent items +item = (char *) zhashx_lookup (hash, "foo"); +assert (item == NULL); + +// Try to insert duplicate items +rc = zhashx_insert (hash, "DEADBEEF", "foo"); +assert (rc == \-1); +item = (char *) zhashx_lookup (hash, "DEADBEEF"); +assert (streq (item, "dead beef")); + +// Some rename tests + +// Valid rename, key is now LIVEBEEF +rc = zhashx_rename (hash, "DEADBEEF", "LIVEBEEF"); +assert (rc == 0); +item = (char *) zhashx_lookup (hash, "LIVEBEEF"); +assert (streq (item, "dead beef")); + +// Trying to rename an unknown item to a non\-existent key +rc = zhashx_rename (hash, "WHATBEEF", "NONESUCH"); +assert (rc == \-1); + +// Trying to rename an unknown item to an existing key +rc = zhashx_rename (hash, "WHATBEEF", "LIVEBEEF"); +assert (rc == \-1); +item = (char *) zhashx_lookup (hash, "LIVEBEEF"); +assert (streq (item, "dead beef")); + +// Trying to rename an existing item to another existing item +rc = zhashx_rename (hash, "LIVEBEEF", "ABADCAFE"); +assert (rc == \-1); +item = (char *) zhashx_lookup (hash, "LIVEBEEF"); +assert (streq (item, "dead beef")); +item = (char *) zhashx_lookup (hash, "ABADCAFE"); +assert (streq (item, "a bad cafe")); + +// Test keys method +zlistx_t *keys = zhashx_keys (hash); +assert (zlistx_size (keys) == 4); +zlistx_destroy (&keys); + +zlistx_t *values = zhashx_values(hash); +assert (zlistx_size (values) == 4); +zlistx_destroy (&values); + +// Test dup method +zhashx_t *copy = zhashx_dup (hash); +assert (zhashx_size (copy) == 4); +item = (char *) zhashx_lookup (copy, "LIVEBEEF"); +assert (item); +assert (streq (item, "dead beef")); +zhashx_destroy (©); + +// Test pack/unpack methods +zframe_t *frame = zhashx_pack (hash); +copy = zhashx_unpack (frame); +zframe_destroy (&frame); +assert (zhashx_size (copy) == 4); +item = (char *) zhashx_lookup (copy, "LIVEBEEF"); +assert (item); +assert (streq (item, "dead beef")); +zhashx_destroy (©); + +#ifdef CZMQ_BUILD_DRAFT_API +// Test own pack/unpack methods +zhashx_t *own_hash = zhashx_new (); +zhashx_set_destructor (own_hash, s_test_destroy_int); +assert (own_hash); +int *val1 = (int *) zmalloc (sizeof (int)); +int *val2 = (int *) zmalloc (sizeof (int)); +*val1 = 25; +*val2 = 100; +zhashx_insert (own_hash, "val1", val1); +zhashx_insert (own_hash, "val2", val2); +frame = zhashx_pack_own (own_hash, s_test_serialize_int); +copy = zhashx_unpack_own (frame, s_test_deserialze_int); +zhashx_set_destructor (copy, s_test_destroy_int); +zframe_destroy (&frame); +assert (zhashx_size (copy) == 2); +assert (*((int *) zhashx_lookup (copy, "val1")) == 25); +assert (*((int *) zhashx_lookup (copy, "val2")) == 100); +zhashx_destroy (©); +zhashx_destroy (&own_hash); +#endif // CZMQ_BUILD_DRAFT_API + +// Test save and load +zhashx_comment (hash, "This is a test file"); +zhashx_comment (hash, "Created by %s", "czmq_selftest"); +zhashx_save (hash, "\&.cache"); +copy = zhashx_new (); +assert (copy); +zhashx_load (copy, "\&.cache"); +item = (char *) zhashx_lookup (copy, "LIVEBEEF"); +assert (item); +assert (streq (item, "dead beef")); +zhashx_destroy (©); +zsys_file_delete ("\&.cache"); + +// Delete a item +zhashx_delete (hash, "LIVEBEEF"); +item = (char *) zhashx_lookup (hash, "LIVEBEEF"); +assert (item == NULL); +assert (zhashx_size (hash) == 3); + +// Check that the queue is robust against random usage +struct { + char name [100]; + bool exists; +} testset [200]; +memset (testset, 0, sizeof (testset)); +int testmax = 200, testnbr, iteration; + +srandom ((unsigned) time (NULL)); +for (iteration = 0; iteration < 25000; iteration++) { + testnbr = randof (testmax); + if (testset [testnbr]\&.exists) { + item = (char *) zhashx_lookup (hash, testset [testnbr]\&.name); + assert (item); + zhashx_delete (hash, testset [testnbr]\&.name); + testset [testnbr]\&.exists = false; + } + else { + sprintf (testset [testnbr]\&.name, "%x\-%x", rand (), rand ()); + if (zhashx_insert (hash, testset [testnbr]\&.name, "") == 0) + testset [testnbr]\&.exists = true; + } +} +// Test 10K lookups +for (iteration = 0; iteration < 10000; iteration++) + item = (char *) zhashx_lookup (hash, "DEADBEEFABADCAFE"); + +// Destructor should be safe to call twice +zhashx_destroy (&hash); +zhashx_destroy (&hash); +assert (hash == NULL); + +// Test destructor; automatically copies and frees string values +hash = zhashx_new (); +assert (hash); +zhashx_set_destructor (hash, (zhashx_destructor_fn *) zstr_free); +zhashx_set_duplicator (hash, (zhashx_duplicator_fn *) strdup); +char value [255]; +strcpy (value, "This is a string"); +rc = zhashx_insert (hash, "key1", value); +assert (rc == 0); +strcpy (value, "Ring a ding ding"); +rc = zhashx_insert (hash, "key2", value); +assert (rc == 0); +assert (streq ((char *) zhashx_lookup (hash, "key1"), "This is a string")); +assert (streq ((char *) zhashx_lookup (hash, "key2"), "Ring a ding ding")); +zhashx_destroy (&hash); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/ziflist.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/ziflist.3 new file mode 100644 index 00000000000000..b50b06c0f3b98c --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/ziflist.3 @@ -0,0 +1,134 @@ +'\" t +.\" Title: ziflist +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZIFLIST" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +ziflist \- list of network interfaces available on system +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Get a list of network interfaces currently defined on the system +CZMQ_EXPORT ziflist_t * + ziflist_new (void); + +// Destroy a ziflist instance +CZMQ_EXPORT void + ziflist_destroy (ziflist_t **self_p); + +// Reload network interfaces from system +CZMQ_EXPORT void + ziflist_reload (ziflist_t *self); + +// Return the number of network interfaces on system +CZMQ_EXPORT size_t + ziflist_size (ziflist_t *self); + +// Get first network interface, return NULL if there are none +CZMQ_EXPORT const char * + ziflist_first (ziflist_t *self); + +// Get next network interface, return NULL if we hit the last one +CZMQ_EXPORT const char * + ziflist_next (ziflist_t *self); + +// Return the current interface IP address as a printable string +CZMQ_EXPORT const char * + ziflist_address (ziflist_t *self); + +// Return the current interface broadcast address as a printable string +CZMQ_EXPORT const char * + ziflist_broadcast (ziflist_t *self); + +// Return the current interface network mask as a printable string +CZMQ_EXPORT const char * + ziflist_netmask (ziflist_t *self); + +// Return the list of interfaces\&. +CZMQ_EXPORT void + ziflist_print (ziflist_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + ziflist_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/ziflist\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The ziflist class takes a snapshot of the network interfaces that the system currently supports (this can change arbitrarily, especially on mobile devices)\&. The caller can then access the network interface information using an iterator that works like zlistx\&. Only stores those interfaces with broadcast capability, and ignores the loopback interface\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/ziflist\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom ziflist_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +ziflist_t *iflist = ziflist_new (); +assert (iflist); + +size_t items = ziflist_size (iflist); + +if (verbose) { + printf ("ziflist: interfaces=%zu\en", ziflist_size (iflist)); + const char *name = ziflist_first (iflist); + while (name) { + printf (" \- name=%s address=%s netmask=%s broadcast=%s\en", + name, ziflist_address (iflist), ziflist_netmask (iflist), ziflist_broadcast (iflist)); + name = ziflist_next (iflist); + } +} +ziflist_reload (iflist); +assert (items == ziflist_size (iflist)); +ziflist_destroy (&iflist); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zlist.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zlist.3 new file mode 100644 index 00000000000000..a7131f40e00e1f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zlist.3 @@ -0,0 +1,316 @@ +'\" t +.\" Title: zlist +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZLIST" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zlist \- simple generic list container +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Comparison function e\&.g\&. for sorting and removing\&. +typedef int (zlist_compare_fn) ( + void *item1, void *item2); + +// Callback function for zlist_freefn method +typedef void (zlist_free_fn) ( + void *data); + +// Create a new list container +CZMQ_EXPORT zlist_t * + zlist_new (void); + +// Destroy a list container +CZMQ_EXPORT void + zlist_destroy (zlist_t **self_p); + +// Return the item at the head of list\&. If the list is empty, returns NULL\&. +// Leaves cursor pointing at the head item, or NULL if the list is empty\&. +CZMQ_EXPORT void * + zlist_first (zlist_t *self); + +// Return the next item\&. If the list is empty, returns NULL\&. To move to +// the start of the list call zlist_first ()\&. Advances the cursor\&. +CZMQ_EXPORT void * + zlist_next (zlist_t *self); + +// Return the item at the tail of list\&. If the list is empty, returns NULL\&. +// Leaves cursor pointing at the tail item, or NULL if the list is empty\&. +CZMQ_EXPORT void * + zlist_last (zlist_t *self); + +// Return first item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlist_head (zlist_t *self); + +// Return last item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlist_tail (zlist_t *self); + +// Return the current item of list\&. If the list is empty, returns NULL\&. +// Leaves cursor pointing at the current item, or NULL if the list is empty\&. +CZMQ_EXPORT void * + zlist_item (zlist_t *self); + +// Append an item to the end of the list, return 0 if OK or \-1 if this +// failed for some reason (out of memory)\&. Note that if a duplicator has +// been set, this method will also duplicate the item\&. +CZMQ_EXPORT int + zlist_append (zlist_t *self, void *item); + +// Push an item to the start of the list, return 0 if OK or \-1 if this +// failed for some reason (out of memory)\&. Note that if a duplicator has +// been set, this method will also duplicate the item\&. +CZMQ_EXPORT int + zlist_push (zlist_t *self, void *item); + +// Pop the item off the start of the list, if any +CZMQ_EXPORT void * + zlist_pop (zlist_t *self); + +// Checks if an item already is present\&. Uses compare method to determine if +// items are equal\&. If the compare method is NULL the check will only compare +// pointers\&. Returns true if item is present else false\&. +CZMQ_EXPORT bool + zlist_exists (zlist_t *self, void *item); + +// Remove the specified item from the list if present +CZMQ_EXPORT void + zlist_remove (zlist_t *self, void *item); + +// Make a copy of list\&. If the list has autofree set, the copied list will +// duplicate all items, which must be strings\&. Otherwise, the list will hold +// pointers back to the items in the original list\&. If list is null, returns +// NULL\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zlist_t * + zlist_dup (zlist_t *self); + +// Purge all items from list +CZMQ_EXPORT void + zlist_purge (zlist_t *self); + +// Return number of items in the list +CZMQ_EXPORT size_t + zlist_size (zlist_t *self); + +// Sort the list\&. If the compare function is null, sorts the list by +// ascending key value using a straight ASCII comparison\&. If you specify +// a compare function, this decides how items are sorted\&. The sort is not +// stable, so may reorder items with the same keys\&. The algorithm used is +// combsort, a compromise between performance and simplicity\&. +CZMQ_EXPORT void + zlist_sort (zlist_t *self, zlist_compare_fn compare); + +// Set list for automatic item destruction; item values MUST be strings\&. +// By default a list item refers to a value held elsewhere\&. When you set +// this, each time you append or push a list item, zlist will take a copy +// of the string value\&. Then, when you destroy the list, it will free all +// item values automatically\&. If you use any other technique to allocate +// list values, you must free them explicitly before destroying the list\&. +// The usual technique is to pop list items and destroy them, until the +// list is empty\&. +CZMQ_EXPORT void + zlist_autofree (zlist_t *self); + +// Sets a compare function for this list\&. The function compares two items\&. +// It returns an integer less than, equal to, or greater than zero if the +// first item is found, respectively, to be less than, to match, or be +// greater than the second item\&. +// This function is used for sorting, removal and exists checking\&. +CZMQ_EXPORT void + zlist_comparefn (zlist_t *self, zlist_compare_fn fn); + +// Set a free function for the specified list item\&. When the item is +// destroyed, the free function, if any, is called on that item\&. +// Use this when list items are dynamically allocated, to ensure that +// you don\*(Aqt have memory leaks\&. You can pass \*(Aqfree\*(Aq or NULL as a free_fn\&. +// Returns the item, or NULL if there is no such item\&. +CZMQ_EXPORT void * + zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); + +// Self test of this class\&. +CZMQ_EXPORT void + zlist_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zlist\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +Provides a generic container implementing a fast singly\-linked list\&. You can use this to construct multi\-dimensional lists, and other structures together with other generic containers like zhash\&. This is a simple class\&. For demanding applications we recommend using zlistx\&. +.sp +To iterate through a list, use zlist_first to get the first item, then loop while not null, and do zlist_next at the end of each iteration\&. +.SH "EXAMPLE" +.PP +\fBFrom zlist_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zlist_t *list = zlist_new (); +assert (list); +assert (zlist_size (list) == 0); + +// Three items we\*(Aqll use as test data +// List items are void *, not particularly strings +char *cheese = "boursin"; +char *bread = "baguette"; +char *wine = "bordeaux"; + +zlist_append (list, cheese); +assert (zlist_size (list) == 1); +assert ( zlist_exists (list, cheese)); +assert (!zlist_exists (list, bread)); +assert (!zlist_exists (list, wine)); +zlist_append (list, bread); +assert (zlist_size (list) == 2); +assert ( zlist_exists (list, cheese)); +assert ( zlist_exists (list, bread)); +assert (!zlist_exists (list, wine)); +zlist_append (list, wine); +assert (zlist_size (list) == 3); +assert ( zlist_exists (list, cheese)); +assert ( zlist_exists (list, bread)); +assert ( zlist_exists (list, wine)); + +assert (zlist_head (list) == cheese); +assert (zlist_next (list) == cheese); + +assert (zlist_first (list) == cheese); +assert (zlist_tail (list) == wine); +assert (zlist_next (list) == bread); + +assert (zlist_first (list) == cheese); +assert (zlist_next (list) == bread); +assert (zlist_next (list) == wine); +assert (zlist_next (list) == NULL); +// After we reach end of list, next wraps around +assert (zlist_next (list) == cheese); +assert (zlist_size (list) == 3); + +zlist_remove (list, wine); +assert (zlist_size (list) == 2); + +assert (zlist_first (list) == cheese); +zlist_remove (list, cheese); +assert (zlist_size (list) == 1); +assert (zlist_first (list) == bread); + +zlist_remove (list, bread); +assert (zlist_size (list) == 0); + +zlist_append (list, cheese); +zlist_append (list, bread); +assert (zlist_last (list) == bread); +zlist_remove (list, bread); +assert (zlist_last (list) == cheese); +zlist_remove (list, cheese); +assert (zlist_last (list) == NULL); + +zlist_push (list, cheese); +assert (zlist_size (list) == 1); +assert (zlist_first (list) == cheese); + +zlist_push (list, bread); +assert (zlist_size (list) == 2); +assert (zlist_first (list) == bread); +assert (zlist_item (list) == bread); + +zlist_append (list, wine); +assert (zlist_size (list) == 3); +assert (zlist_first (list) == bread); + +zlist_t *sub_list = zlist_dup (list); +assert (sub_list); +assert (zlist_size (sub_list) == 3); + +zlist_sort (list, NULL); +char *item; +item = (char *) zlist_pop (list); +assert (item == bread); +item = (char *) zlist_pop (list); +assert (item == wine); +item = (char *) zlist_pop (list); +assert (item == cheese); +assert (zlist_size (list) == 0); + +assert (zlist_size (sub_list) == 3); +zlist_push (list, sub_list); +zlist_t *sub_list_2 = zlist_dup (sub_list); +zlist_append (list, sub_list_2); +assert (zlist_freefn (list, sub_list, &s_zlist_free, false) == sub_list); +assert (zlist_freefn (list, sub_list_2, &s_zlist_free, true) == sub_list_2); +zlist_destroy (&list); + +// Test autofree functionality +list = zlist_new (); +assert (list); +zlist_autofree (list); +// Set equals function otherwise equals will not work as autofree copies strings +zlist_comparefn (list, (zlist_compare_fn *) strcmp); +zlist_push (list, bread); +zlist_append (list, cheese); +assert (zlist_size (list) == 2); +zlist_append (list, wine); +assert (zlist_exists (list, wine)); +zlist_remove (list, wine); +assert (!zlist_exists (list, wine)); +assert (streq ((const char *) zlist_first (list), bread)); +item = (char *) zlist_pop (list); +assert (streq (item, bread)); +free (item); +item = (char *) zlist_pop (list); +assert (streq (item, cheese)); +free (item); + +zlist_destroy (&list); +assert (list == NULL); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zlistx.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zlistx.3 new file mode 100644 index 00000000000000..2e1068554b6945 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zlistx.3 @@ -0,0 +1,346 @@ +'\" t +.\" Title: zlistx +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZLISTX" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zlistx \- extended generic list container +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Destroy an item +typedef void (zlistx_destructor_fn) ( + void **item); + +// Duplicate an item +typedef void * (zlistx_duplicator_fn) ( + const void *item); + +// Compare two items, for sorting +typedef int (zlistx_comparator_fn) ( + const void *item1, const void *item2); + +// Create a new, empty list\&. +CZMQ_EXPORT zlistx_t * + zlistx_new (void); + +// Destroy a list\&. If an item destructor was specified, all items in the +// list are automatically destroyed as well\&. +CZMQ_EXPORT void + zlistx_destroy (zlistx_t **self_p); + +// Add an item to the head of the list\&. Calls the item duplicator, if any, +// on the item\&. Resets cursor to list head\&. Returns an item handle on +// success, NULL if memory was exhausted\&. +CZMQ_EXPORT void * + zlistx_add_start (zlistx_t *self, void *item); + +// Add an item to the tail of the list\&. Calls the item duplicator, if any, +// on the item\&. Resets cursor to list head\&. Returns an item handle on +// success, NULL if memory was exhausted\&. +CZMQ_EXPORT void * + zlistx_add_end (zlistx_t *self, void *item); + +// Return the number of items in the list +CZMQ_EXPORT size_t + zlistx_size (zlistx_t *self); + +// Return first item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlistx_head (zlistx_t *self); + +// Return last item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlistx_tail (zlistx_t *self); + +// Return the item at the head of list\&. If the list is empty, returns NULL\&. +// Leaves cursor pointing at the head item, or NULL if the list is empty\&. +CZMQ_EXPORT void * + zlistx_first (zlistx_t *self); + +// Return the next item\&. At the end of the list (or in an empty list), +// returns NULL\&. Use repeated zlistx_next () calls to work through the list +// from zlistx_first ()\&. First time, acts as zlistx_first()\&. +CZMQ_EXPORT void * + zlistx_next (zlistx_t *self); + +// Return the previous item\&. At the start of the list (or in an empty list), +// returns NULL\&. Use repeated zlistx_prev () calls to work through the list +// backwards from zlistx_last ()\&. First time, acts as zlistx_last()\&. +CZMQ_EXPORT void * + zlistx_prev (zlistx_t *self); + +// Return the item at the tail of list\&. If the list is empty, returns NULL\&. +// Leaves cursor pointing at the tail item, or NULL if the list is empty\&. +CZMQ_EXPORT void * + zlistx_last (zlistx_t *self); + +// Returns the value of the item at the cursor, or NULL if the cursor is +// not pointing to an item\&. +CZMQ_EXPORT void * + zlistx_item (zlistx_t *self); + +// Returns the handle of the item at the cursor, or NULL if the cursor is +// not pointing to an item\&. +CZMQ_EXPORT void * + zlistx_cursor (zlistx_t *self); + +// Returns the item associated with the given list handle, or NULL if passed +// in handle is NULL\&. Asserts that the passed in handle points to a list element\&. +CZMQ_EXPORT void * + zlistx_handle_item (void *handle); + +// Find an item in the list, searching from the start\&. Uses the item +// comparator, if any, else compares item values directly\&. Returns the +// item handle found, or NULL\&. Sets the cursor to the found item, if any\&. +CZMQ_EXPORT void * + zlistx_find (zlistx_t *self, void *item); + +// Detach an item from the list, using its handle\&. The item is not modified, +// and the caller is responsible for destroying it if necessary\&. If handle is +// null, detaches the first item on the list\&. Returns item that was detached, +// or null if none was\&. If cursor was at item, moves cursor to previous item, +// so you can detach items while iterating forwards through a list\&. +CZMQ_EXPORT void * + zlistx_detach (zlistx_t *self, void *handle); + +// Detach item at the cursor, if any, from the list\&. The item is not modified, +// and the caller is responsible for destroying it as necessary\&. Returns item +// that was detached, or null if none was\&. Moves cursor to previous item, so +// you can detach items while iterating forwards through a list\&. +CZMQ_EXPORT void * + zlistx_detach_cur (zlistx_t *self); + +// Delete an item, using its handle\&. Calls the item destructor is any is +// set\&. If handle is null, deletes the first item on the list\&. Returns 0 +// if an item was deleted, \-1 if not\&. If cursor was at item, moves cursor +// to previous item, so you can delete items while iterating forwards +// through a list\&. +CZMQ_EXPORT int + zlistx_delete (zlistx_t *self, void *handle); + +// Move an item to the start of the list, via its handle\&. +CZMQ_EXPORT void + zlistx_move_start (zlistx_t *self, void *handle); + +// Move an item to the end of the list, via its handle\&. +CZMQ_EXPORT void + zlistx_move_end (zlistx_t *self, void *handle); + +// Remove all items from the list, and destroy them if the item destructor +// is set\&. +CZMQ_EXPORT void + zlistx_purge (zlistx_t *self); + +// Sort the list\&. If an item comparator was set, calls that to compare +// items, otherwise compares on item value\&. The sort is not stable, so may +// reorder equal items\&. +CZMQ_EXPORT void + zlistx_sort (zlistx_t *self); + +// Create a new node and insert it into a sorted list\&. Calls the item +// duplicator, if any, on the item\&. If low_value is true, starts searching +// from the start of the list, otherwise searches from the end\&. Use the item +// comparator, if any, to find where to place the new node\&. Returns a handle +// to the new node, or NULL if memory was exhausted\&. Resets the cursor to the +// list head\&. +CZMQ_EXPORT void * + zlistx_insert (zlistx_t *self, void *item, bool low_value); + +// Move an item, specified by handle, into position in a sorted list\&. Uses +// the item comparator, if any, to determine the new location\&. If low_value +// is true, starts searching from the start of the list, otherwise searches +// from the end\&. +CZMQ_EXPORT void + zlistx_reorder (zlistx_t *self, void *handle, bool low_value); + +// Make a copy of the list; items are duplicated if you set a duplicator +// for the list, otherwise not\&. Copying a null reference returns a null +// reference\&. +CZMQ_EXPORT zlistx_t * + zlistx_dup (zlistx_t *self); + +// Set a user\-defined deallocator for list items; by default items are not +// freed when the list is destroyed\&. +CZMQ_EXPORT void + zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); + +// Set a user\-defined duplicator for list items; by default items are not +// copied when the list is duplicated\&. +CZMQ_EXPORT void + zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); + +// Set a user\-defined comparator for zlistx_find and zlistx_sort; the method +// must return \-1, 0, or 1 depending on whether item1 is less than, equal to, +// or greater than, item2\&. +CZMQ_EXPORT void + zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); + +// Self test of this class\&. +CZMQ_EXPORT void + zlistx_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zlistx\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +Provides a generic doubly\-linked list container\&. This container provides hooks for duplicator, comparator, and destructor functions\&. These tie into CZMQ and standard C semantics, so e\&.g\&. for string items you can use strdup, strcmp, and zstr_free\&. To store custom objects, define your own duplicator and comparator, and use the standard object destructor\&. +.sp +This is a reworking of the simpler zlist container\&. It is faster to insert and delete items anywhere in the list, and to keep ordered lists\&. +.SH "EXAMPLE" +.PP +\fBFrom zlistx_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zlistx_t *list = zlistx_new (); +assert (list); +assert (zlistx_size (list) == 0); + +// Test operations on an empty list +assert (zlistx_first (list) == NULL); +assert (zlistx_last (list) == NULL); +assert (zlistx_next (list) == NULL); +assert (zlistx_prev (list) == NULL); +assert (zlistx_find (list, "hello") == NULL); +assert (zlistx_delete (list, NULL) == \-1); +assert (zlistx_detach (list, NULL) == NULL); +assert (zlistx_delete (list, NULL) == \-1); +assert (zlistx_detach (list, NULL) == NULL); +zlistx_purge (list); +zlistx_sort (list); + +// Use item handlers +zlistx_set_destructor (list, (zlistx_destructor_fn *) zstr_free); +zlistx_set_duplicator (list, (zlistx_duplicator_fn *) strdup); +zlistx_set_comparator (list, (zlistx_comparator_fn *) strcmp); + +// Try simple insert/sort/delete/next +assert (zlistx_next (list) == NULL); +zlistx_add_end (list, "world"); +assert (streq ((char *) zlistx_next (list), "world")); +zlistx_add_end (list, "hello"); +assert (streq ((char *) zlistx_prev (list), "hello")); +zlistx_sort (list); +assert (zlistx_size (list) == 2); +void *handle = zlistx_find (list, "hello"); +char *item1 = (char *) zlistx_item (list); +char *item2 = (char *) zlistx_handle_item (handle); +assert (item1 == item2); +assert (streq (item1, "hello")); +zlistx_delete (list, handle); +assert (zlistx_size (list) == 1); +char *string = (char *) zlistx_detach (list, NULL); +assert (streq (string, "world")); +free (string); +assert (zlistx_size (list) == 0); + +// Check next/back work +// Now populate the list with items +zlistx_add_start (list, "five"); +zlistx_add_end (list, "six"); +zlistx_add_start (list, "four"); +zlistx_add_end (list, "seven"); +zlistx_add_start (list, "three"); +zlistx_add_end (list, "eight"); +zlistx_add_start (list, "two"); +zlistx_add_end (list, "nine"); +zlistx_add_start (list, "one"); +zlistx_add_end (list, "ten"); + +// Test our navigation skills +assert (zlistx_size (list) == 10); +assert (streq ((char *) zlistx_last (list), "ten")); +assert (streq ((char *) zlistx_prev (list), "nine")); +assert (streq ((char *) zlistx_prev (list), "eight")); +assert (streq ((char *) zlistx_prev (list), "seven")); +assert (streq ((char *) zlistx_prev (list), "six")); +assert (streq ((char *) zlistx_prev (list), "five")); +assert (streq ((char *) zlistx_first (list), "one")); +assert (streq ((char *) zlistx_next (list), "two")); +assert (streq ((char *) zlistx_next (list), "three")); +assert (streq ((char *) zlistx_next (list), "four")); + +// Sort by alphabetical order +zlistx_sort (list); +assert (streq ((char *) zlistx_first (list), "eight")); +assert (streq ((char *) zlistx_last (list), "two")); + +// Moving items around +handle = zlistx_find (list, "six"); +zlistx_move_start (list, handle); +assert (streq ((char *) zlistx_first (list), "six")); +zlistx_move_end (list, handle); +assert (streq ((char *) zlistx_last (list), "six")); +zlistx_sort (list); +assert (streq ((char *) zlistx_last (list), "two")); + +// Copying a list +zlistx_t *copy = zlistx_dup (list); +assert (copy); +assert (zlistx_size (copy) == 10); +assert (streq ((char *) zlistx_first (copy), "eight")); +assert (streq ((char *) zlistx_last (copy), "two")); +zlistx_destroy (©); + +// Delete items while iterating +string = (char *) zlistx_first (list); +assert (streq (string, "eight")); +string = (char *) zlistx_next (list); +assert (streq (string, "five")); +zlistx_delete (list, zlistx_cursor (list)); +string = (char *) zlistx_next (list); +assert (streq (string, "four")); + +zlistx_purge (list); +zlistx_destroy (&list); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zloop.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zloop.3 new file mode 100644 index 00000000000000..7d5c84949f542e --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zloop.3 @@ -0,0 +1,261 @@ +'\" t +.\" Title: zloop +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZLOOP" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zloop \- event\-driven reactor +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Callback function for reactor socket activity +typedef int (zloop_reader_fn) ( + zloop_t *loop, zsock_t *reader, void *arg); + +// Callback function for reactor events (low\-level) +typedef int (zloop_fn) ( + zloop_t *loop, zmq_pollitem_t *item, void *arg); + +// Callback for reactor timer events +typedef int (zloop_timer_fn) ( + zloop_t *loop, int timer_id, void *arg); + +// Create a new zloop reactor +CZMQ_EXPORT zloop_t * + zloop_new (void); + +// Destroy a reactor +CZMQ_EXPORT void + zloop_destroy (zloop_t **self_p); + +// Register socket reader with the reactor\&. When the reader has messages, +// the reactor will call the handler, passing the arg\&. Returns 0 if OK, \-1 +// if there was an error\&. If you register the same socket more than once, +// each instance will invoke its corresponding handler\&. +CZMQ_EXPORT int + zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); + +// Cancel a socket reader from the reactor\&. If multiple readers exist for +// same socket, cancels ALL of them\&. +CZMQ_EXPORT void + zloop_reader_end (zloop_t *self, zsock_t *sock); + +// Configure a registered reader to ignore errors\&. If you do not set this, +// then readers that have errors are removed from the reactor silently\&. +CZMQ_EXPORT void + zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); + +// Register low\-level libzmq pollitem with the reactor\&. When the pollitem +// is ready, will call the handler, passing the arg\&. Returns 0 if OK, \-1 +// if there was an error\&. If you register the pollitem more than once, each +// instance will invoke its corresponding handler\&. A pollitem with +// socket=NULL and fd=0 means \*(Aqpoll on FD zero\*(Aq\&. +CZMQ_EXPORT int + zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); + +// Cancel a pollitem from the reactor, specified by socket or FD\&. If both +// are specified, uses only socket\&. If multiple poll items exist for same +// socket/FD, cancels ALL of them\&. +CZMQ_EXPORT void + zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); + +// Configure a registered poller to ignore errors\&. If you do not set this, +// then poller that have errors are removed from the reactor silently\&. +CZMQ_EXPORT void + zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); + +// Register a timer that expires after some delay and repeats some number of +// times\&. At each expiry, will call the handler, passing the arg\&. To run a +// timer forever, use 0 times\&. Returns a timer_id that is used to cancel the +// timer in the future\&. Returns \-1 if there was an error\&. +CZMQ_EXPORT int + zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); + +// Cancel a specific timer identified by a specific timer_id (as returned by +// zloop_timer)\&. +CZMQ_EXPORT int + zloop_timer_end (zloop_t *self, int timer_id); + +// Register a ticket timer\&. Ticket timers are very fast in the case where +// you use a lot of timers (thousands), and frequently remove and add them\&. +// The main use case is expiry timers for servers that handle many clients, +// and which reset the expiry timer for each message received from a client\&. +// Whereas normal timers perform poorly as the number of clients grows, the +// cost of ticket timers is constant, no matter the number of clients\&. You +// must set the ticket delay using zloop_set_ticket_delay before creating a +// ticket\&. Returns a handle to the timer that you should use in +// zloop_ticket_reset and zloop_ticket_delete\&. +CZMQ_EXPORT void * + zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); + +// Reset a ticket timer, which moves it to the end of the ticket list and +// resets its execution time\&. This is a very fast operation\&. +CZMQ_EXPORT void + zloop_ticket_reset (zloop_t *self, void *handle); + +// Delete a ticket timer\&. We do not actually delete the ticket here, as +// other code may still refer to the ticket\&. We mark as deleted, and remove +// later and safely\&. +CZMQ_EXPORT void + zloop_ticket_delete (zloop_t *self, void *handle); + +// Set the ticket delay, which applies to all tickets\&. If you lower the +// delay and there are already tickets created, the results are undefined\&. +CZMQ_EXPORT void + zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); + +// Set hard limit on number of timers allowed\&. Setting more than a small +// number of timers (10\-100) can have a dramatic impact on the performance +// of the reactor\&. For high\-volume cases, use ticket timers\&. If the hard +// limit is reached, the reactor stops creating new timers and logs an +// error\&. +CZMQ_EXPORT void + zloop_set_max_timers (zloop_t *self, size_t max_timers); + +// Set verbose tracing of reactor on/off\&. The default verbose setting is +// off (false)\&. +CZMQ_EXPORT void + zloop_set_verbose (zloop_t *self, bool verbose); + +// By default the reactor stops if the process receives a SIGINT or SIGTERM +// signal\&. This makes it impossible to shut\-down message based architectures +// like zactors\&. This method lets you switch off break handling\&. The default +// nonstop setting is off (false)\&. +CZMQ_EXPORT void + zloop_set_nonstop (zloop_t *self, bool nonstop); + +// Start the reactor\&. Takes control of the thread and returns when the 0MQ +// context is terminated or the process is interrupted, or any event handler +// returns \-1\&. Event handlers may register new sockets and timers, and +// cancel sockets\&. Returns 0 if interrupted, \-1 if canceled by a handler\&. +CZMQ_EXPORT int + zloop_start (zloop_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zloop_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zloop\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zloop class provides an event\-driven reactor pattern\&. The reactor handles zmq_pollitem_t items (pollers or writers, sockets or fds), and once\-off or repeated timers\&. Its resolution is 1 msec\&. It uses a tickless timer to reduce CPU interrupts in inactive processes\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zloop\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zloop_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create two PAIR sockets and connect over inproc +zsock_t *output = zsock_new (ZMQ_PAIR); +assert (output); +zsock_bind (output, "inproc://zloop\&.test"); + +zsock_t *input = zsock_new (ZMQ_PAIR); +assert (input); +zsock_connect (input, "inproc://zloop\&.test"); + +zloop_t *loop = zloop_new (); +assert (loop); +zloop_set_verbose (loop, verbose); + +// Create a timer that will be cancelled +int timer_id = zloop_timer (loop, 1000, 1, s_timer_event, NULL); +zloop_timer (loop, 5, 1, s_cancel_timer_event, &timer_id); + +// After 20 msecs, send a ping message to output3 +zloop_timer (loop, 20, 1, s_timer_event, output); + +// Set up some tickets that will never expire +zloop_set_ticket_delay (loop, 10000); +void *ticket1 = zloop_ticket (loop, s_timer_event, NULL); +void *ticket2 = zloop_ticket (loop, s_timer_event, NULL); +void *ticket3 = zloop_ticket (loop, s_timer_event, NULL); + +// When we get the ping message, end the reactor +rc = zloop_reader (loop, input, s_socket_event, NULL); +assert (rc == 0); +zloop_reader_set_tolerant (loop, input); +zloop_start (loop); + +zloop_ticket_delete (loop, ticket1); +zloop_ticket_delete (loop, ticket2); +zloop_ticket_delete (loop, ticket3); + +// Check whether loop properly ignores zsys_interrupted flag +// when asked to +zloop_destroy (&loop); +loop = zloop_new (); + +bool timer_event_called = false; +zloop_timer (loop, 1, 1, s_timer_event3, &timer_event_called); + +zsys_interrupted = 1; +zloop_start (loop); +// zloop returns immediately without giving any handler a chance to run +assert (!timer_event_called); + +zloop_set_nonstop (loop, true); +zloop_start (loop); +// zloop runs the handler which will terminate the loop +assert (timer_event_called); +zsys_interrupted = 0; + +// cleanup +zloop_destroy (&loop); +assert (loop == NULL); + +zsock_destroy (&input); +zsock_destroy (&output); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmonitor.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmonitor.3 new file mode 100644 index 00000000000000..8d716863d4544c --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmonitor.3 @@ -0,0 +1,157 @@ +'\" t +.\" Title: zmonitor +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZMONITOR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmonitor \- socket event monitor +.SH "SYNOPSIS" +.sp +.nf +// Create new zmonitor actor instance to monitor a zsock_t socket: +// +// zactor_t *monitor = zactor_new (zmonitor, mysocket); +// +// Destroy zmonitor instance\&. +// +// zactor_destroy (&monitor); +// +// Enable verbose logging of commands and activity\&. +// +// zstr_send (monitor, "VERBOSE"); +// +// Listen to monitor event type (zero or types, ending in NULL): +// zstr_sendx (monitor, "LISTEN", type, \&.\&.\&., NULL); +// +// Events: +// CONNECTED +// CONNECT_DELAYED +// CONNECT_RETRIED +// LISTENING +// BIND_FAILED +// ACCEPTED +// ACCEPT_FAILED +// CLOSED +// CLOSE_FAILED +// DISCONNECTED +// MONITOR_STOPPED +// ALL +// +// Start monitor; after this, any further LISTEN commands are ignored\&. +// +// zstr_send (monitor, "START"); +// zsock_wait (monitor); +// +// Receive next monitor event: +// +// zmsg_t *msg = zmsg_recv (monitor); +// +// This is the zmonitor constructor as a zactor_fn; the argument can be +// a zactor_t, zsock_t, or libzmq void * socket: +CZMQ_EXPORT void + zmonitor (zsock_t *pipe, void *sock); + +// Selftest +CZMQ_EXPORT void + zmonitor_test (bool verbose); +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmonitor\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zmonitor actor provides an API for obtaining socket events such as connected, listen, disconnected, etc\&. Socket events are only available for sockets connecting or bound to ipc:// and tcp:// endpoints\&. +.sp +This class wraps the ZMQ socket monitor API, see zmq_socket_monitor for details\&. Works on all versions of libzmq from 3\&.2 onwards\&. This class replaces zproxy_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. +.SH "EXAMPLE" +.PP +\fBFrom zmonitor_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zsock_t *client = zsock_new (ZMQ_DEALER); +assert (client); +zactor_t *clientmon = zactor_new (zmonitor, client); +assert (clientmon); +if (verbose) + zstr_sendx (clientmon, "VERBOSE", NULL); +zstr_sendx (clientmon, "LISTEN", "LISTENING", "ACCEPTED", NULL); +zstr_sendx (clientmon, "START", NULL); +zsock_wait (clientmon); + +zsock_t *server = zsock_new (ZMQ_DEALER); +assert (server); +zactor_t *servermon = zactor_new (zmonitor, server); +assert (servermon); +if (verbose) + zstr_sendx (servermon, "VERBOSE", NULL); +zstr_sendx (servermon, "LISTEN", "CONNECTED", "DISCONNECTED", NULL); +zstr_sendx (servermon, "START", NULL); +zsock_wait (servermon); + +// Allow a brief time for the message to get there\&.\&.\&. +zmq_poll (NULL, 0, 200); + +// Check client is now listening +int port_nbr = zsock_bind (client, "tcp://127\&.0\&.0\&.1:*"); +assert (port_nbr != \-1); +s_assert_event (clientmon, "LISTENING"); + +// Check server connected to client +zsock_connect (server, "tcp://127\&.0\&.0\&.1:%d", port_nbr); +s_assert_event (servermon, "CONNECTED"); + +// Check client accepted connection +s_assert_event (clientmon, "ACCEPTED"); + +zactor_destroy (&clientmon); +zactor_destroy (&servermon); +zsock_destroy (&client); +zsock_destroy (&server); +#endif +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_dec.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_dec.3 new file mode 100644 index 00000000000000..40fde8be8d9bfb --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_dec.3 @@ -0,0 +1,73 @@ +'\" t +.\" Title: zmq_atomic_counter_dec +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_ATOMIC_COUNTER_D" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_atomic_counter_dec \- decrement an atomic counter +.SH "SYNOPSIS" +.sp +\fBint zmq_atomic_counter_dec (void *counter);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_atomic_counter_dec\fR function decrements an atomic counter in a threadsafe fashion\&. This function uses platform specific atomic operations\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_atomic_counter_dec()\fR function returns 1 if the counter is greater than zero after decrementing, or zero if the counter reached zero\&. +.SH "EXAMPLE" +.PP +\fBTest code for atomic counters\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *counter = zmq_atomic_counter_new (); +assert (zmq_atomic_counter_value (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 1); +assert (zmq_atomic_counter_inc (counter) == 2); +assert (zmq_atomic_counter_value (counter) == 3); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_set (counter, 2); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_destroy (&counter); +return 0; +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_value\fR(3) \fBzmq_atomic_counter_destroy\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_destroy.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_destroy.3 new file mode 100644 index 00000000000000..b37bd42407a586 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_destroy.3 @@ -0,0 +1,73 @@ +'\" t +.\" Title: zmq_atomic_counter_destroy +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_ATOMIC_COUNTER_D" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_atomic_counter_destroy \- destroy an atomic counter +.SH "SYNOPSIS" +.sp +\fBvoid zmq_atomic_counter_destroy (void **counter_p);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_atomic_counter_destroy\fR function destroys an atomic counter and nullifies its reference\&. Pass the address of an atomic counter (void **) rather than the counter itself\&. You must destroy all counters that you create, to avoid memory leakage\&. This function uses platform specific atomic operations\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_atomic_counter_destroy()\fR function has no return value\&. +.SH "EXAMPLE" +.PP +\fBTest code for atomic counters\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *counter = zmq_atomic_counter_new (); +assert (zmq_atomic_counter_value (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 1); +assert (zmq_atomic_counter_inc (counter) == 2); +assert (zmq_atomic_counter_value (counter) == 3); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_set (counter, 2); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_destroy (&counter); +return 0; +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_value\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_inc.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_inc.3 new file mode 100644 index 00000000000000..8d7064f9ccd5b6 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_inc.3 @@ -0,0 +1,73 @@ +'\" t +.\" Title: zmq_atomic_counter_inc +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_ATOMIC_COUNTER_I" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_atomic_counter_inc \- increment an atomic counter +.SH "SYNOPSIS" +.sp +\fBint zmq_atomic_counter_inc (void *counter);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_atomic_counter_inc\fR function increments an atomic counter in a threadsafe fashion\&. This function uses platform specific atomic operations\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_atomic_counter_inc()\fR function returns the old value of the counter, before incrementing\&. +.SH "EXAMPLE" +.PP +\fBTest code for atomic counters\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *counter = zmq_atomic_counter_new (); +assert (zmq_atomic_counter_value (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 1); +assert (zmq_atomic_counter_inc (counter) == 2); +assert (zmq_atomic_counter_value (counter) == 3); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_set (counter, 2); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_destroy (&counter); +return 0; +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_value\fR(3) \fBzmq_atomic_counter_destroy\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_new.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_new.3 new file mode 100644 index 00000000000000..124130917b0936 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_new.3 @@ -0,0 +1,73 @@ +'\" t +.\" Title: zmq_atomic_counter_new +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_ATOMIC_COUNTER_N" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_atomic_counter_new \- create a new atomic counter +.SH "SYNOPSIS" +.sp +\fBvoid *zmq_atomic_counter_new (void);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_atomic_counter_new\fR function creates a new atomic counter\&. You can use this in multithreaded applications to do, for example, reference counting of shared objects\&. The atomic counter is at least 32 bits large\&. This function uses platform specific atomic operations\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_atomic_counter_new()\fR function returns the new atomic counter if successful\&. Otherwise it returns NULL\&. +.SH "EXAMPLE" +.PP +\fBTest code for atomic counters\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *counter = zmq_atomic_counter_new (); +assert (zmq_atomic_counter_value (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 1); +assert (zmq_atomic_counter_inc (counter) == 2); +assert (zmq_atomic_counter_value (counter) == 3); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_set (counter, 2); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_destroy (&counter); +return 0; +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_value\fR(3) \fBzmq_atomic_counter_destroy\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_set.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_set.3 new file mode 100644 index 00000000000000..5cdac995d6ceec --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_set.3 @@ -0,0 +1,73 @@ +'\" t +.\" Title: zmq_atomic_counter_set +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_ATOMIC_COUNTER_S" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_atomic_counter_set \- set atomic counter to new value +.SH "SYNOPSIS" +.sp +\fBvoid zmq_atomic_counter_set (void *counter, int value);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_atomic_counter_set\fR function sets the counter to a new value, in a threadsafe fashion\&. The largest value that is guaranteed to work across all platforms is 2^31\-1\&. This function uses platform specific atomic operations\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_atomic_counter_set()\fR function has no return value\&. +.SH "EXAMPLE" +.PP +\fBTest code for atomic counters\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *counter = zmq_atomic_counter_new (); +assert (zmq_atomic_counter_value (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 1); +assert (zmq_atomic_counter_inc (counter) == 2); +assert (zmq_atomic_counter_value (counter) == 3); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_set (counter, 2); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_destroy (&counter); +return 0; +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_value\fR(3) \fBzmq_atomic_counter_destroy\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_value.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_value.3 new file mode 100644 index 00000000000000..f62f8b4714758e --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_atomic_counter_value.3 @@ -0,0 +1,73 @@ +'\" t +.\" Title: zmq_atomic_counter_value +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_ATOMIC_COUNTER_V" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_atomic_counter_value \- return value of atomic counter +.SH "SYNOPSIS" +.sp +\fBint zmq_atomic_counter_value (void *counter);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_atomic_counter_value\fR function returns the value of an atomic counter\&. This function uses platform specific atomic operations\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_atomic_counter_value()\fR function returns the new atomic counter if successful\&. Otherwise it returns NULL\&. +.SH "EXAMPLE" +.PP +\fBTest code for atomic counters\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *counter = zmq_atomic_counter_new (); +assert (zmq_atomic_counter_value (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 0); +assert (zmq_atomic_counter_inc (counter) == 1); +assert (zmq_atomic_counter_inc (counter) == 2); +assert (zmq_atomic_counter_value (counter) == 3); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_set (counter, 2); +assert (zmq_atomic_counter_dec (counter) == 1); +assert (zmq_atomic_counter_dec (counter) == 0); +zmq_atomic_counter_destroy (&counter); +return 0; +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_atomic_counter_new\fR(3) \fBzmq_atomic_counter_set\fR(3) \fBzmq_atomic_counter_inc\fR(3) \fBzmq_atomic_counter_dec\fR(3) \fBzmq_atomic_counter_destroy\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_bind.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_bind.3 new file mode 100644 index 00000000000000..472961186563c6 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_bind.3 @@ -0,0 +1,200 @@ +'\" t +.\" Title: zmq_bind +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_BIND" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_bind \- accept incoming connections on a socket +.SH "SYNOPSIS" +.sp +\fBint zmq_bind (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_bind()\fR function binds the \fIsocket\fR to a local \fIendpoint\fR and then accepts incoming connections on that endpoint\&. +.sp +The \fIendpoint\fR is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to bind to\&. +.sp +0MQ provides the the following transports: +.PP +\fItcp\fR +.RS 4 +unicast transport using TCP, see +\fBzmq_tcp\fR(7) +.RE +.PP +\fIipc\fR +.RS 4 +local inter\-process communication transport, see +\fBzmq_ipc\fR(7) +.RE +.PP +\fIinproc\fR +.RS 4 +local in\-process (inter\-thread) communication transport, see +\fBzmq_inproc\fR(7) +.RE +.PP +\fIpgm\fR, \fIepgm\fR +.RS 4 +reliable multicast transport using PGM, see +\fBzmq_pgm\fR(7) +.RE +.PP +\fIvmci\fR +.RS 4 +virtual machine communications interface (VMCI), see +\fBzmq_vmci\fR(7) +.RE +.sp +Every 0MQ socket type except \fIZMQ_PAIR\fR supports one\-to\-many and many\-to\-one semantics\&. The precise semantics depend on the socket type and are defined in \fBzmq_socket\fR(3)\&. +.sp +The \fIipc\fR, \fItcp\fR and \fIvmci\fR transports accept wildcard addresses: see \fBzmq_ipc\fR(7), \fBzmq_tcp\fR(7) and \fBzmq_vmci\fR(7) for details\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +the address syntax may be different for \fIzmq_bind()\fR and \fIzmq_connect()\fR especially for the \fItcp\fR, \fIpgm\fR and \fIepgm\fR transports\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +following a \fIzmq_bind()\fR, the socket enters a \fImute\fR state unless or until at least one incoming or outgoing connection is made, at which point the socket enters a \fIready\fR state\&. In the mute state, the socket blocks or drops messages according to the socket type, as defined in \fBzmq_socket\fR(3)\&. By contrast, following a libzmq:zmq_connect[3], the socket enters the \fIready\fR state\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_bind()\fR function returns zero if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The endpoint supplied is invalid\&. +.RE +.PP +\fBEPROTONOSUPPORT\fR +.RS 4 +The requested +\fItransport\fR +protocol is not supported\&. +.RE +.PP +\fBENOCOMPATPROTO\fR +.RS 4 +The requested +\fItransport\fR +protocol is not compatible with the socket type\&. +.RE +.PP +\fBEADDRINUSE\fR +.RS 4 +The requested +\fIaddress\fR +is already in use\&. +.RE +.PP +\fBEADDRNOTAVAIL\fR +.RS 4 +The requested +\fIaddress\fR +was not local\&. +.RE +.PP +\fBENODEV\fR +.RS 4 +The requested +\fIaddress\fR +specifies a nonexistent interface\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEMTHREAD\fR +.RS 4 +No I/O thread is available to accomplish the task\&. +.RE +.SH "EXAMPLE" +.PP +\fBBinding a publisher socket to an in-process and a TCP transport\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Create a ZMQ_PUB socket */ +void *socket = zmq_socket (context, ZMQ_PUB); +assert (socket); +/* Bind it to a in\-process transport with the address \*(Aqmy_publisher\*(Aq */ +int rc = zmq_bind (socket, "inproc://my_publisher"); +assert (rc == 0); +/* Bind it to a TCP transport on port 5555 of the \*(Aqeth0\*(Aq interface */ +rc = zmq_bind (socket, "tcp://eth0:5555"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_close.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_close.3 new file mode 100644 index 00000000000000..f3b45dc49e8cbf --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_close.3 @@ -0,0 +1,70 @@ +'\" t +.\" Title: zmq_close +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CLOSE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_close \- close 0MQ socket +.SH "SYNOPSIS" +.sp +\fBint zmq_close (void \fR\fB\fI*socket\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_close()\fR function shall destroy the socket referenced by the \fIsocket\fR argument\&. Any outstanding messages physically received from the network but not yet received by the application with \fIzmq_recv()\fR shall be discarded\&. The behaviour for discarding messages sent by the application with \fIzmq_send()\fR but not yet physically transferred to the network depends on the value of the \fIZMQ_LINGER\fR socket option for the specified \fIsocket\fR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +The default setting of \fIZMQ_LINGER\fR does not discard unsent messages; this behaviour may cause the application to block when calling \fIzmq_ctx_term()\fR\&. For details refer to \fBzmq_setsockopt\fR(3) and \fBzmq_ctx_term\fR(3)\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_close()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.SH "SEE ALSO" +.sp +\fBzmq_socket\fR(3) \fBzmq_ctx_term\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_connect.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_connect.3 new file mode 100644 index 00000000000000..ba263b85f82616 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_connect.3 @@ -0,0 +1,177 @@ +'\" t +.\" Title: zmq_connect +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CONNECT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_connect \- create outgoing connection from socket +.SH "SYNOPSIS" +.sp +\fBint zmq_connect (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_connect()\fR function connects the \fIsocket\fR to an \fIendpoint\fR and then accepts incoming connections on that endpoint\&. +.sp +The \fIendpoint\fR is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. +.sp +0MQ provides the the following transports: +.PP +\fItcp\fR +.RS 4 +unicast transport using TCP, see +\fBzmq_tcp\fR(7) +.RE +.PP +\fIipc\fR +.RS 4 +local inter\-process communication transport, see +\fBzmq_ipc\fR(7) +.RE +.PP +\fIinproc\fR +.RS 4 +local in\-process (inter\-thread) communication transport, see +\fBzmq_inproc\fR(7) +.RE +.PP +\fIpgm\fR, \fIepgm\fR +.RS 4 +reliable multicast transport using PGM, see +\fBzmq_pgm\fR(7) +.RE +.PP +\fIvmci\fR +.RS 4 +virtual machine communications interface (VMCI), see +\fBzmq_vmci\fR(7) +.RE +.sp +Every 0MQ socket type except \fIZMQ_PAIR\fR supports one\-to\-many and many\-to\-one semantics\&. The precise semantics depend on the socket type and are defined in \fBzmq_socket\fR(3)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +for most transports and socket types the connection is not performed immediately but as needed by 0MQ\&. Thus a successful call to \fIzmq_connect()\fR does not mean that the connection was or could actually be established\&. Because of this, for most transports and socket types the order in which a \fIserver\fR socket is bound and a \fIclient\fR socket is connected to it does not matter\&. The first exception is when using the inproc:// transport: you must call \fIzmq_bind()\fR before calling \fIzmq_connect()\fR\&. The second exception are \fIZMQ_PAIR\fR sockets, which do not automatically reconnect to endpoints\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +following a \fIzmq_connect()\fR, for socket types except for ZMQ_ROUTER, the socket enters its normal \fIready\fR state\&. By contrast, following a \fIzmq_bind()\fR alone, the socket enters a \fImute\fR state in which the socket blocks or drops messages according to the socket type, as defined in \fBzmq_socket\fR(3)\&. A ZMQ_ROUTER socket enters its normal \fIready\fR state for a specific peer only when handshaking is complete for that peer, which may take an arbitrary time\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_connect()\fR function returns zero if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The endpoint supplied is invalid\&. +.RE +.PP +\fBEPROTONOSUPPORT\fR +.RS 4 +The requested +\fItransport\fR +protocol is not supported\&. +.RE +.PP +\fBENOCOMPATPROTO\fR +.RS 4 +The requested +\fItransport\fR +protocol is not compatible with the socket type\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEMTHREAD\fR +.RS 4 +No I/O thread is available to accomplish the task\&. +.RE +.SH "EXAMPLE" +.PP +\fBConnecting a subscriber socket to an in-process and a TCP transport\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Create a ZMQ_SUB socket */ +void *socket = zmq_socket (context, ZMQ_SUB); +assert (socket); +/* Connect it to an in\-process transport with the address \*(Aqmy_publisher\*(Aq */ +int rc = zmq_connect (socket, "inproc://my_publisher"); +assert (rc == 0); +/* Connect it to the host server001, port 5555 using a TCP transport */ +rc = zmq_connect (socket, "tcp://server001:5555"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_bind\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_get.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_get.3 new file mode 100644 index 00000000000000..fef5be66499bd1 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_get.3 @@ -0,0 +1,106 @@ +'\" t +.\" Title: zmq_ctx_get +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CTX_GET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_ctx_get \- get context options +.SH "SYNOPSIS" +.sp +\fBint zmq_ctx_get (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_ctx_get()\fR function shall return the option specified by the \fIoption_name\fR argument\&. +.sp +The \fIzmq_ctx_get()\fR function accepts the following option names: +.SS "ZMQ_IO_THREADS: Get number of I/O threads" +.sp +The \fIZMQ_IO_THREADS\fR argument returns the size of the 0MQ thread pool for this context\&. +.SS "ZMQ_MAX_SOCKETS: Get maximum number of sockets" +.sp +The \fIZMQ_MAX_SOCKETS\fR argument returns the maximum number of sockets allowed for this context\&. +.SS "ZMQ_MAX_MSGSZ: Get maximum message size" +.sp +The \fIZMQ_MAX_MSGSZ\fR argument returns the maximum size of a message allowed for this context\&. Default value is INT_MAX\&. +.SS "ZMQ_SOCKET_LIMIT: Get largest configurable number of sockets" +.sp +The \fIZMQ_SOCKET_LIMIT\fR argument returns the largest number of sockets that \fBzmq_ctx_set\fR(3) will accept\&. +.SS "ZMQ_IPV6: Set IPv6 option" +.sp +The \fIZMQ_IPV6\fR argument returns the IPv6 option for the context\&. +.SS "ZMQ_BLOCKY: Get blocky setting" +.sp +The \fIZMQ_BLOCKY\fR argument returns 1 if the context will block on terminate, zero if the "block forever on context termination" gambit was disabled by setting ZMQ_BLOCKY to false on all new contexts\&. +.SS "ZMQ_MSG_T_SIZE: Get the zmq_msg_t size at runtime" +.sp +The \fIZMQ_MSG_T_SIZE\fR argument returns the size of the zmq_msg_t structure at runtime, as defined in the include/zmq\&.h public header\&. This is useful for example for FFI bindings that can\(cqt simply do a sizeof()\&. NOTE: in DRAFT state, not yet available in stable releases\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_ctx_get()\fR function returns a value of 0 or greater if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The requested option +\fIoption_name\fR +is unknown\&. +.RE +.SH "EXAMPLE" +.PP +\fBSetting a limit on the number of sockets\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *context = zmq_ctx_new (); +zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256); +int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS); +assert (max_sockets == 256); +.fi +.if n \{\ +.RE +.\} +.PP +\fBSwitching off the context deadlock gambit\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zmq_ctx_set (ctx, ZMQ_BLOCKY, false); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_ctx_set\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_new.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_new.3 new file mode 100644 index 00000000000000..23d1af87f73c83 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_new.3 @@ -0,0 +1,55 @@ +'\" t +.\" Title: zmq_ctx_new +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CTX_NEW" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_ctx_new \- create new 0MQ context +.SH "SYNOPSIS" +.sp +\fBvoid *zmq_ctx_new ();\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_ctx_new()\fR function creates a new 0MQ \fIcontext\fR\&. +.sp +This function replaces the deprecated function \fBzmq_init\fR(3)\&. +.PP +\fBThread safety\fR. A 0MQ +\fIcontext\fR +is thread safe and may be shared among as many application threads as necessary, without any additional locking required on the part of the caller\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_ctx_new()\fR function shall return an opaque handle to the newly created \fIcontext\fR if successful\&. Otherwise it shall return NULL and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.sp +No error values are defined for this function\&. +.SH "SEE ALSO" +.sp +\fBzmq\fR(7) \fBzmq_ctx_set\fR(3) \fBzmq_ctx_get\fR(3) \fBzmq_ctx_term\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_set.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_set.3 new file mode 100644 index 00000000000000..b7d3e39cbc9945 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_set.3 @@ -0,0 +1,186 @@ +'\" t +.\" Title: zmq_ctx_set +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CTX_SET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_ctx_set \- set context options +.SH "SYNOPSIS" +.sp +\fBint zmq_ctx_set (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, int \fR\fB\fIoption_value\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_ctx_set()\fR function shall set the option specified by the \fIoption_name\fR argument to the value of the \fIoption_value\fR argument\&. +.sp +The \fIzmq_ctx_set()\fR function accepts the following options: +.SS "ZMQ_BLOCKY: Fix blocky behavior" +.sp +By default the context will block, forever, on a zmq_ctx_term call\&. The assumption behind this behavior is that abrupt termination will cause message loss\&. Most real applications use some form of handshaking to ensure applications receive termination messages, and then terminate the context with \fIZMQ_LINGER\fR set to zero on all sockets\&. This setting is an easier way to get the same result\&. When \fIZMQ_BLOCKY\fR is set to false, all new sockets are given a linger timeout of zero\&. You must still close all sockets before calling zmq_ctx_term\&. +.TS +tab(:); +lt lt. +T{ +.sp +Default value +T}:T{ +.sp +true (old behavior) +T} +.TE +.sp 1 +.SS "ZMQ_IO_THREADS: Set number of I/O threads" +.sp +The \fIZMQ_IO_THREADS\fR argument specifies the size of the 0MQ thread pool to handle I/O operations\&. If your application is using only the \fIinproc\fR transport for messaging you may set this to zero, otherwise set it to at least one\&. This option only applies before creating any sockets on the context\&. +.TS +tab(:); +lt lt. +T{ +.sp +Default value +T}:T{ +.sp +1 +T} +.TE +.sp 1 +.SS "ZMQ_THREAD_SCHED_POLICY: Set scheduling policy for I/O threads" +.sp +The \fIZMQ_THREAD_SCHED_POLICY\fR argument sets the scheduling policy for internal context\(cqs thread pool\&. This option is not available on windows\&. Supported values for this option can be found in sched\&.h file, or at \m[blue]\fBhttp://man7\&.org/linux/man\-pages/man2/sched_setscheduler\&.2\&.html\fR\m[]\&. This option only applies before creating any sockets on the context\&. +.TS +tab(:); +lt lt. +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +.TE +.sp 1 +.SS "ZMQ_THREAD_PRIORITY: Set scheduling priority for I/O threads" +.sp +The \fIZMQ_THREAD_PRIORITY\fR argument sets scheduling priority for internal context\(cqs thread pool\&. This option is not available on windows\&. Supported values for this option depend on chosen scheduling policy\&. Details can be found in sched\&.h file, or at \m[blue]\fBhttp://man7\&.org/linux/man\-pages/man2/sched_setscheduler\&.2\&.html\fR\m[]\&. This option only applies before creating any sockets on the context\&. +.TS +tab(:); +lt lt. +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +.TE +.sp 1 +.SS "ZMQ_MAX_MSGSZ: Set maximum message size" +.sp +The \fIZMQ_MAX_MSGSZ\fR argument sets the maximum allowed size of a message sent in the context\&. You can query the maximal allowed value with \fBzmq_ctx_get\fR(3) using the \fIZMQ_MAX_MSGSZ\fR option\&. +.TS +tab(:); +lt lt +lt lt. +T{ +.sp +Default value +T}:T{ +.sp +INT_MAX +T} +T{ +.sp +Maximum value +T}:T{ +.sp +INT_MAX +T} +.TE +.sp 1 +.SS "ZMQ_MAX_SOCKETS: Set maximum number of sockets" +.sp +The \fIZMQ_MAX_SOCKETS\fR argument sets the maximum number of sockets allowed on the context\&. You can query the maximal allowed value with \fBzmq_ctx_get\fR(3) using the \fIZMQ_SOCKET_LIMIT\fR option\&. +.TS +tab(:); +lt lt. +T{ +.sp +Default value +T}:T{ +.sp +1024 +T} +.TE +.sp 1 +.SS "ZMQ_IPV6: Set IPv6 option" +.sp +The \fIZMQ_IPV6\fR argument sets the IPv6 value for all sockets created in the context from this point onwards\&. A value of 1 means IPv6 is enabled, while 0 means the socket will use only IPv4\&. When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts\&. +.TS +tab(:); +lt lt. +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +.TE +.sp 1 +.SH "RETURN VALUE" +.sp +The \fIzmq_ctx_set()\fR function returns zero if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The requested option +\fIoption_name\fR +is unknown\&. +.RE +.SH "EXAMPLE" +.PP +\fBSetting a limit on the number of sockets\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *context = zmq_ctx_new (); +zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256); +int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS); +assert (max_sockets == 256); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_ctx_get\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_shutdown.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_shutdown.3 new file mode 100644 index 00000000000000..1e1d21dea3891f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_shutdown.3 @@ -0,0 +1,58 @@ +'\" t +.\" Title: zmq_ctx_shutdown +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CTX_SHUTDOWN" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_ctx_shutdown \- shutdown a 0MQ context +.SH "SYNOPSIS" +.sp +\fBint zmq_ctx_shutdown (void \fR\fB\fI*context\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_ctx_shutdown()\fR function shall shutdown the 0MQ context \fIcontext\fR\&. +.sp +Context shutdown will cause any blocking operations currently in progress on sockets open within \fIcontext\fR to return immediately with an error code of ETERM\&. With the exception of \fIzmq_close()\fR, any further operations on sockets open within \fIcontext\fR shall fail with an error code of ETERM\&. +.sp +This function is optional, client code is still required to call the \fBzmq_ctx_term\fR(3) function to free all resources allocated by zeromq\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_ctx_shutdown()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEFAULT\fR +.RS 4 +The provided +\fIcontext\fR +was invalid\&. +.RE +.SH "SEE ALSO" +.sp +\fBzmq\fR(7) \fBzmq_init\fR(3) \fBzmq_ctx_term\fR(3) \fBzmq_close\fR(3) \fBzmq_setsockopt\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_term.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_term.3 new file mode 100644 index 00000000000000..c7a5700f4e862b --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_ctx_term.3 @@ -0,0 +1,126 @@ +'\" t +.\" Title: zmq_ctx_term +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CTX_TERM" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_ctx_term \- terminate a 0MQ context +.SH "SYNOPSIS" +.sp +\fBint zmq_ctx_term (void \fR\fB\fI*context\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_ctx_term()\fR function shall destroy the 0MQ context \fIcontext\fR\&. +.sp +Context termination is performed in the following steps: +.sp +.RS 4 +.ie n \{\ +\h'-04' 1.\h'+01'\c +.\} +.el \{\ +.sp -1 +.IP " 1." 4.2 +.\} +Any blocking operations currently in progress on sockets open within +\fIcontext\fR +shall return immediately with an error code of ETERM\&. With the exception of +\fIzmq_close()\fR, any further operations on sockets open within +\fIcontext\fR +shall fail with an error code of ETERM\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04' 2.\h'+01'\c +.\} +.el \{\ +.sp -1 +.IP " 2." 4.2 +.\} +After interrupting all blocking calls, +\fIzmq_ctx_term()\fR +shall +\fIblock\fR +until the following conditions are satisfied: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +All sockets open within +\fIcontext\fR +have been closed with +\fIzmq_close()\fR\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +For each socket within +\fIcontext\fR, all messages sent by the application with +\fIzmq_send()\fR +have either been physically transferred to a network peer, or the socket\(cqs linger period set with the +\fIZMQ_LINGER\fR +socket option has expired\&. +.RE +.RE +.sp +For further details regarding socket linger behaviour refer to the \fIZMQ_LINGER\fR option in \fBzmq_setsockopt\fR(3)\&. +.sp +This function replaces the deprecated functions \fBzmq_term\fR(3) and \fBzmq_ctx_destroy\fR(3)\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_ctx_term()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEFAULT\fR +.RS 4 +The provided +\fIcontext\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +Termination was interrupted by a signal\&. It can be restarted if needed\&. +.RE +.SH "SEE ALSO" +.sp +\fBzmq\fR(7) \fBzmq_init\fR(3) \fBzmq_close\fR(3) \fBzmq_setsockopt\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_keypair.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_keypair.3 new file mode 100644 index 00000000000000..5a58963cff6361 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_keypair.3 @@ -0,0 +1,69 @@ +'\" t +.\" Title: zmq_curve_keypair +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CURVE_KEYPAIR" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_curve_keypair \- generate a new CURVE keypair +.SH "SYNOPSIS" +.sp +\fBint zmq_curve_keypair (char *z85_public_key, char *z85_secret_key);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_curve_keypair()\fR function shall return a newly generated random keypair consisting of a public key and a secret key\&. The caller provides two buffers, each at least 41 octets large, in which this method will store the keys\&. The keys are encoded using \fBzmq_z85_encode\fR(3)\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_curve_keypair()\fR function shall return 0 if successful, else it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBENOTSUP\fR +.RS 4 +The libzmq library was not built with cryptographic support (libsodium)\&. +.RE +.SH "EXAMPLE" +.PP +\fBGenerating a new CURVE keypair\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +char public_key [41]; +char secret_key [41]; +int rc = zmq_curve_keypair (public_key, secret_key); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_z85_decode\fR(3) \fBzmq_z85_encode\fR(3) \fBzmq_curve\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_public.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_public.3 new file mode 100644 index 00000000000000..f7dceeb5d94d3e --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_curve_public.3 @@ -0,0 +1,73 @@ +'\" t +.\" Title: zmq_curve_public +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CURVE_PUBLIC" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_curve_public \- derive the public key from a private key +.SH "SYNOPSIS" +.sp +\fBint zmq_curve_public (char *z85_public_key, char *z85_secret_key);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_curve_public()\fR function shall derive the public key from a private key\&. The caller provides two buffers, each at least 41 octets large\&. In z85_secret_key the caller shall provide the private key, and the function will store the public key in z85_public_key\&. The keys are encoded using \fBzmq_z85_encode\fR(3)\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_curve_public()\fR function shall return 0 if successful, else it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBENOTSUP\fR +.RS 4 +The libzmq library was not built with cryptographic support (libsodium)\&. +.RE +.SH "EXAMPLE" +.PP +\fBDeriving the public key from a CURVE private key\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +char public_key [41]; +char secret_key [41]; +int rc = zmq_curve_keypair (public_key, secret_key); +assert (rc == 0); +char derived_public[41]; +rc = zmq_curve_public (derived_public, secret_key); +assert (rc == 0); +assert (!strcmp (derived_public, public_key)); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_z85_decode\fR(3) \fBzmq_z85_encode\fR(3) \fBzmq_curve_keypair\fR(3) \fBzmq_curve\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_disconnect.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_disconnect.3 new file mode 100644 index 00000000000000..ff5075fd31f794 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_disconnect.3 @@ -0,0 +1,113 @@ +'\" t +.\" Title: zmq_disconnect +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_DISCONNECT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_disconnect \- Disconnect a socket +.SH "SYNOPSIS" +.sp +\fBint zmq_disconnect (void \fR\fB\fI*socket\fR\fR\fB, const char \fR\fB\fI*endpoint\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_disconnect()\fR function shall disconnect a socket specified by the \fIsocket\fR argument from the endpoint specified by the \fIendpoint\fR argument\&. Any outstanding messages physically received from the network but not yet received by the application with \fIzmq_recv()\fR shall be discarded\&. The behaviour for discarding messages sent by the application with \fIzmq_send()\fR but not yet physically transferred to the network depends on the value of the \fIZMQ_LINGER\fR socket option for the specified \fIsocket\fR\&. +.sp +The \fIendpoint\fR argument is as described in \fBzmq_connect\fR(3) +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +The default setting of \fIZMQ_LINGER\fR does not discard unsent messages; this behaviour may cause the application to block when calling \fIzmq_ctx_term()\fR\&. For details refer to \fBzmq_setsockopt\fR(3) and \fBzmq_ctx_term\fR(3)\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_disconnect()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The endpoint supplied is invalid\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBENOENT\fR +.RS 4 +The provided endpoint is not connected\&. +.RE +.SH "EXAMPLE" +.PP +\fBConnecting a subscriber socket to an in-process and a TCP transport\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Create a ZMQ_SUB socket */ +void *socket = zmq_socket (context, ZMQ_SUB); +assert (socket); +/* Connect it to the host server001, port 5555 using a TCP transport */ +rc = zmq_connect (socket, "tcp://server001:5555"); +assert (rc == 0); +/* Disconnect from the previously connected endpoint */ +rc = zmq_disconnect (socket, "tcp://server001:5555"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_errno.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_errno.3 new file mode 100644 index 00000000000000..b7cb977fd1906e --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_errno.3 @@ -0,0 +1,67 @@ +'\" t +.\" Title: zmq_errno +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_ERRNO" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_errno \- retrieve value of errno for the calling thread +.SH "SYNOPSIS" +.sp +\fBint zmq_errno (void);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_errno()\fR function shall retrieve the value of the \fIerrno\fR variable for the calling thread\&. +.sp +The \fIzmq_errno()\fR function is provided to assist users on non\-POSIX systems who are experiencing issues with retrieving the correct value of \fIerrno\fR directly\&. Specifically, users on Win32 systems whose application is using a different C run\-time library from the C run\-time library in use by 0MQ will need to use \fIzmq_errno()\fR for correct operation\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBImportant\fR +.ps -1 +.br +.sp +Users not experiencing issues with retrieving the correct value of \fIerrno\fR should not use this function and should instead access the \fIerrno\fR variable directly\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_errno()\fR function shall return the value of the \fIerrno\fR variable for the calling thread\&. +.SH "ERRORS" +.sp +No errors are defined\&. +.SH "SEE ALSO" +.sp +\fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_getsockopt.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_getsockopt.3 new file mode 100644 index 00000000000000..7a51c1e6788c02 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_getsockopt.3 @@ -0,0 +1,2298 @@ +'\" t +.\" Title: zmq_getsockopt +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_GETSOCKOPT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_getsockopt \- get 0MQ socket options +.SH "SYNOPSIS" +.sp +\fBint zmq_getsockopt (void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, void \fR\fB\fI*option_value\fR\fR\fB, size_t \fR\fB\fI*option_len\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_getsockopt()\fR function shall retrieve the value for the option specified by the \fIoption_name\fR argument for the 0MQ socket pointed to by the \fIsocket\fR argument, and store it in the buffer pointed to by the \fIoption_value\fR argument\&. The \fIoption_len\fR argument is the size in bytes of the buffer pointed to by \fIoption_value\fR; upon successful completion \fIzmq_getsockopt()\fR shall modify the \fIoption_len\fR argument to indicate the actual size of the option value stored in the buffer\&. +.sp +The following options can be retrieved with the \fIzmq_getsockopt()\fR function: +.SS "ZMQ_AFFINITY: Retrieve I/O thread affinity" +.sp +The \fIZMQ_AFFINITY\fR option shall retrieve the I/O thread affinity for newly created connections on the specified \fIsocket\fR\&. +.sp +Affinity determines which threads from the 0MQ I/O thread pool associated with the socket\(cqs \fIcontext\fR shall handle newly created connections\&. A value of zero specifies no affinity, meaning that work shall be distributed fairly among all 0MQ I/O threads in the thread pool\&. For non\-zero values, the lowest bit corresponds to thread 1, second lowest bit to thread 2 and so on\&. For example, a value of 3 specifies that subsequent connections on \fIsocket\fR shall be handled exclusively by I/O threads 1 and 2\&. +.sp +See also \fBzmq_init\fR(3) for details on allocating the number of I/O threads for a specific \fIcontext\fR\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +uint64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A (bitmap) +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +N/A +T} +.TE +.sp 1 +.SS "ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections" +.sp +The \fIZMQ_BACKLOG\fR option shall retrieve the maximum length of the queue of outstanding peer connections for the specified \fIsocket\fR; this only applies to connection\-oriented transports\&. For details refer to your operating system documentation for the \fIlisten\fR function\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +connections +T} +T{ +.sp +Default value +T}:T{ +.sp +100 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, only for connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_CONNECT_TIMEOUT: Retrieve connect() timeout" +.sp +Retrieves how long to wait before timing\-out a connect() system call\&. The connect() system call normally takes a long time before it returns a time out error\&. Setting this option allows the library to time out the call at an earlier interval\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (disabled) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key" +.sp +Retrieves the current long term public key for the socket\&. You can provide either a 32 byte buffer, to retrieve the binary key value, or a 41 byte buffer, to retrieve the key in a printable Z85 format\&. NOTE: to fetch a printable key, the buffer must be 41 bytes large to hold the 40\-char key value and one null byte\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data or Z85 text string +T} +T{ +.sp +Option value size +T}:T{ +.sp +32 or 41 +T} +T{ +.sp +Default value +T}:T{ +.sp +null +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key" +.sp +Retrieves the current long term secret key for the socket\&. You can provide either a 32 byte buffer, to retrieve the binary key value, or a 41 byte buffer, to retrieve the key in a printable Z85 format\&. NOTE: to fetch a printable key, the buffer must be 41 bytes large to hold the 40\-char key value and one null byte\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data or Z85 text string +T} +T{ +.sp +Option value size +T}:T{ +.sp +32 or 41 +T} +T{ +.sp +Default value +T}:T{ +.sp +null +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_CURVE_SERVERKEY: Retrieve current CURVE server key" +.sp +Retrieves the current server key for the client socket\&. You can provide either a 32 byte buffer, to retrieve the binary key value, or a 41\-byte buffer, to retrieve the key in a printable Z85 format\&. NOTE: to fetch a printable key, the buffer must be 41 bytes large to hold the 40\-char key value and one null byte\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data or Z85 text string +T} +T{ +.sp +Option value size +T}:T{ +.sp +32 or 41 +T} +T{ +.sp +Default value +T}:T{ +.sp +null +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_EVENTS: Retrieve socket event state" +.sp +The \fIZMQ_EVENTS\fR option shall retrieve the event state for the specified \fIsocket\fR\&. The returned value is a bit mask constructed by OR\(cqing a combination of the following event flags: +.PP +\fBZMQ_POLLIN\fR +.RS 4 +Indicates that at least one message may be received from the specified socket without blocking\&. +.RE +.PP +\fBZMQ_POLLOUT\fR +.RS 4 +Indicates that at least one message may be sent to the specified socket without blocking\&. +.RE +.sp +The combination of a file descriptor returned by the \fIZMQ_FD\fR option being ready for reading but no actual events returned by a subsequent retrieval of the \fIZMQ_EVENTS\fR option is valid; applications should simply ignore this case and restart their polling operation/event loop\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A (flags) +T} +T{ +.sp +Default value +T}:T{ +.sp +N/A +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_FD: Retrieve file descriptor associated with the socket" +.sp +The \fIZMQ_FD\fR option shall retrieve the file descriptor associated with the specified \fIsocket\fR\&. The returned file descriptor can be used to integrate the socket into an existing event loop; the 0MQ library shall signal any pending events on the socket in an \fIedge\-triggered\fR fashion by making the file descriptor become ready for reading\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +The ability to read from the returned file descriptor does not necessarily indicate that messages are available to be read from, or can be written to, the underlying socket; applications must retrieve the actual event state with a subsequent retrieval of the \fIZMQ_EVENTS\fR option\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +The returned file descriptor is also used internally by the \fIzmq_send\fR and \fIzmq_recv\fR functions\&. As the descriptor is edge triggered, applications must update the state of \fIZMQ_EVENTS\fR after each invocation of \fIzmq_send\fR or \fIzmq_recv\fR\&.To be more explicit: after calling \fIzmq_send\fR the socket may become readable (and vice versa) without triggering a read event on the file descriptor\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +The returned file descriptor is intended for use with a \fIpoll\fR or similar system call only\&. Applications must never attempt to read or write data to it directly, neither should they try to close it\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int on POSIX systems, SOCKET on Windows +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +N/A +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_GSSAPI_PLAINTEXT: Retrieve GSSAPI plaintext or encrypted status" +.sp +Returns the \fIZMQ_GSSAPI_PLAINTEXT\fR option, if any, previously set on the socket\&. A value of \fI1\fR means that communications will be plaintext\&. A value of \fI0\fR means communications will be encrypted\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (false) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP or IPC transports +T} +.TE +.sp 1 +.SS "ZMQ_GSSAPI_PRINCIPAL: Retrieve the name of the GSSAPI principal" +.sp +The \fIZMQ_GSSAPI_PRINCIPAL\fR option shall retrieve the principal name set for the GSSAPI security mechanism\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +NULL\-terminated character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +null string +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP or IPC transports +T} +.TE +.sp 1 +.SS "ZMQ_GSSAPI_SERVER: Retrieve current GSSAPI server role" +.sp +Returns the \fIZMQ_GSSAPI_SERVER\fR option, if any, previously set on the socket\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (false) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP or IPC transports +T} +.TE +.sp 1 +.SS "ZMQ_GSSAPI_SERVICE_PRINCIPAL: Retrieve the name of the GSSAPI service principal" +.sp +The \fIZMQ_GSSAPI_SERVICE_PRINCIPAL\fR option shall retrieve the principal name of the GSSAPI server to which a GSSAPI client socket intends to connect\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +NULL\-terminated character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +null string +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP or IPC transports +T} +.TE +.sp 1 +.SS "ZMQ_HANDSHAKE_IVL: Retrieve maximum handshake interval" +.sp +The \fIZMQ_HANDSHAKE_IVL\fR option shall retrieve the maximum handshake interval for the specified \fIsocket\fR\&. Handshaking is the exchange of socket configuration information (socket type, identity, security) that occurs when a connection is first opened, only for connection\-oriented transports\&. If handshaking does not complete within the configured time, the connection shall be closed\&. The value 0 means no handshake time limit\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +30000 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all but ZMQ_STREAM, only for connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_IDENTITY: Retrieve socket identity" +.sp +The \fIZMQ_IDENTITY\fR option shall retrieve the identity of the specified \fIsocket\fR\&. Socket identity is used only by request/reply pattern\&. Namely, it can be used in tandem with ROUTER socket to route messages to the peer with specific identity\&. +.sp +Identity should be at least one byte and at most 255 bytes long\&. Identities starting with binary zero are reserved for use by 0MQ infrastructure\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +NULL +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_REP, ZMQ_REQ, ZMQ_ROUTER, ZMQ_DEALER\&. +T} +.TE +.sp 1 +.SS "ZMQ_IMMEDIATE: Retrieve attach\-on\-connect value" +.sp +Retrieve the state of the attach on connect value\&. If set to 1, will delay the attachment of a pipe on connect until the underlying connection has completed\&. This will cause the socket to block if there are no other connections, but will prevent queues from filling on pipes awaiting connection\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +boolean +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (false) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, primarily when using TCP/IPC transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_INVERT_MATCHING: Retrieve inverted filtering status" +.sp +Returns the value of the \fIZMQ_INVERT_MATCHING\fR option\&. A value of 1 means the socket uses inverted prefix matching\&. +.sp +On \fIPUB\fR and \fIXPUB\fR sockets, this causes messages to be sent to all connected sockets \fIexcept\fR those subscribed to a prefix that matches the message\&. On \fISUB\fR sockets, this causes only incoming messages that do \fInot\fR match any of the socket\(cqs subscriptions to be received by the user\&. +.sp +Whenever \fIZMQ_INVERT_MATCHING\fR is set to 1 on a \fIPUB\fR socket, all \fISUB\fR sockets connecting to it must also have the option set to 1\&. Failure to do so will have the \fISUB\fR sockets reject everything the \fIPUB\fR socket sends them\&. \fIXSUB\fR sockets do not need to do this because they do not filter incoming messages\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0,1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_PUB, ZMQ_XPUB, ZMQ_SUB +T} +.TE +.sp 1 +.SS "ZMQ_IPV4ONLY: Retrieve IPv4\-only socket override status" +.sp +Retrieve the IPv4\-only option for the socket\&. This option is deprecated\&. Please use the ZMQ_IPV6 option\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +boolean +T} +T{ +.sp +Default value +T}:T{ +.sp +1 (true) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_IPV6: Retrieve IPv6 socket status" +.sp +Retrieve the IPv6 option for the socket\&. A value of 1 means IPv6 is enabled on the socket, while 0 means the socket will use only IPv4\&. When IPv6 is enabled the socket will connect to, or accept connections from, both IPv4 and IPv6 hosts\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +boolean +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (false) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_LAST_ENDPOINT: Retrieve the last endpoint set" +.sp +The \fIZMQ_LAST_ENDPOINT\fR option shall retrieve the last endpoint bound for TCP and IPC transports\&. The returned value will be a string in the form of a ZMQ DSN\&. Note that if the TCP host is INADDR_ANY, indicated by a *, then the returned address will be 0\&.0\&.0\&.0 (for IPv4)\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +NULL\-terminated character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +NULL +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when binding TCP or IPC transports +T} +.TE +.sp 1 +.SS "ZMQ_LINGER: Retrieve linger period for socket shutdown" +.sp +The \fIZMQ_LINGER\fR option shall retrieve the linger period for the specified \fIsocket\fR\&. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is closed with \fBzmq_close\fR(3), and further affects the termination of the socket\(cqs context with \fBzmq_ctx_term\fR(3)\&. The following outlines the different behaviours: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The default value of +\fI\-1\fR +specifies an infinite linger period\&. Pending messages shall not be discarded after a call to +\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with +\fIzmq_ctx_term()\fR +shall block until all pending messages have been sent to a peer\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The value of +\fI0\fR +specifies no linger period\&. Pending messages shall be discarded immediately when the socket is closed with +\fIzmq_close()\fR\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Positive values specify an upper bound for the linger period in milliseconds\&. Pending messages shall not be discarded after a call to +\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with +\fIzmq_ctx_term()\fR +shall block until either all pending messages have been sent to a peer, or the linger period expires, after which any pending messages shall be discarded\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +Option value type +T}:T{ +int +T} +T{ +Option value unit +T}:T{ +milliseconds +T} +T{ +Default value +T}:T{ +\-1 (infinite) +T} +T{ +Applicable socket types +T}:T{ +all +T} +.TE +.sp 1 +.RE +.SS "ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size" +.sp +The option shall retrieve limit for the inbound messages\&. If a peer sends a message larger than ZMQ_MAXMSGSIZE it is disconnected\&. Value of \-1 means \fIno limit\fR\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_MECHANISM: Retrieve current security mechanism" +.sp +The \fIZMQ_MECHANISM\fR option shall retrieve the current security mechanism for the socket\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +ZMQ_NULL, ZMQ_PLAIN, ZMQ_CURVE, or ZMQ_GSSAPI +T} +T{ +.sp +Default value +T}:T{ +.sp +ZMQ_NULL +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP or IPC transports +T} +.TE +.sp 1 +.SS "ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets" +.sp +The option shall retrieve time\-to\-live used for outbound multicast packets\&. The default of 1 means that the multicast packets don\(cqt leave the local network\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +network hops +T} +T{ +.sp +Default value +T}:T{ +.sp +1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using multicast transports +T} +.TE +.sp 1 +.SS "ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets" +.sp +The \fIZMQ_MULTICAST_MAXTPDU\fR option shall retrieve the maximum transport data unit size used for outbound multicast packets\&. +.sp +This must be set at or below the minimum Maximum Transmission Unit (MTU) for all network paths over which multicast reception is required\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +1500 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using multicast transports +T} +.TE +.sp 1 +.SS "ZMQ_PLAIN_PASSWORD: Retrieve current password" +.sp +The \fIZMQ_PLAIN_PASSWORD\fR option shall retrieve the last password set for the PLAIN security mechanism\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +NULL\-terminated character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +null string +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP or IPC transports +T} +.TE +.sp 1 +.SS "ZMQ_PLAIN_SERVER: Retrieve current PLAIN server role" +.sp +Returns the \fIZMQ_PLAIN_SERVER\fR option, if any, previously set on the socket\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +int +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP or IPC transports +T} +.TE +.sp 1 +.SS "ZMQ_PLAIN_USERNAME: Retrieve current PLAIN username" +.sp +The \fIZMQ_PLAIN_USERNAME\fR option shall retrieve the last username set for the PLAIN security mechanism\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +NULL\-terminated character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +null string +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP or IPC transports +T} +.TE +.sp 1 +.SS "ZMQ_USE_FD: Retrieve the pre\-allocated socket file descriptor" +.sp +The \fIZMQ_USE_FD\fR option shall retrieve the pre\-allocated file descriptor that has been assigned to a ZMQ socket, if any\&. \-1 shall be returned if a pre\-allocated file descriptor was not set for the socket\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +file descriptor +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all bound sockets, when using IPC or TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_RATE: Retrieve multicast data rate" +.sp +The \fIZMQ_RATE\fR option shall retrieve the maximum send or receive data rate for multicast transports using the specified \fIsocket\fR\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +kilobits per second +T} +T{ +.sp +Default value +T}:T{ +.sp +100 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using multicast transports +T} +.TE +.sp 1 +.SS "ZMQ_RCVBUF: Retrieve kernel receive buffer size" +.sp +The \fIZMQ_RCVBUF\fR option shall retrieve the underlying kernel receive buffer size for the specified \fIsocket\fR\&. For details refer to your operating system documentation for the \fISO_RCVBUF\fR socket option\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +8192 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_RCVHWM: Retrieve high water mark for inbound messages" +.sp +The \fIZMQ_RCVHWM\fR option shall return the high water mark for inbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. +.sp +If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +messages +T} +T{ +.sp +Default value +T}:T{ +.sp +1000 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_RCVMORE: More message data parts to follow" +.sp +The \fIZMQ_RCVMORE\fR option shall return True (1) if the message part last received from the \fIsocket\fR was a data part with more parts to follow\&. If there are no data parts to follow, this option shall return False (0)\&. +.sp +Refer to \fBzmq_send\fR(3) and \fBzmq_recv\fR(3) for a detailed description of multi\-part messages\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +boolean +T} +T{ +.sp +Default value +T}:T{ +.sp +N/A +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN" +.sp +Retrieve the timeout for recv operation on the socket\&. If the value is 0, \fIzmq_recv(3)\fR will return immediately, with a EAGAIN error if there is no message to receive\&. If the value is \-1, it will block until a message is available\&. For all other values, it will wait for a message for that amount of time before returning with an EAGAIN error\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (infinite) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_RECONNECT_IVL: Retrieve reconnection interval" +.sp +The \fIZMQ_RECONNECT_IVL\fR option shall retrieve the initial reconnection interval for the specified \fIsocket\fR\&. The reconnection interval is the period 0MQ shall wait between attempts to reconnect disconnected peers when using connection\-oriented transports\&. The value \-1 means no reconnection\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +The reconnection interval may be randomized by 0MQ to prevent reconnection storms in topologies with a large number of peers per socket\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +100 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, only for connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval" +.sp +The \fIZMQ_RECONNECT_IVL_MAX\fR option shall retrieve the maximum reconnection interval for the specified \fIsocket\fR\&. This is the maximum period 0MQ shall wait between attempts to reconnect\&. On each reconnect attempt, the previous interval shall be doubled untill ZMQ_RECONNECT_IVL_MAX is reached\&. This allows for exponential backoff strategy\&. Default value means no exponential backoff is performed and reconnect interval calculations are only based on ZMQ_RECONNECT_IVL\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +Values less than ZMQ_RECONNECT_IVL will be ignored\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (only use ZMQ_RECONNECT_IVL) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, only for connection\-oriented transport +T} +.TE +.sp 1 +.SS "ZMQ_RECOVERY_IVL: Get multicast recovery interval" +.sp +The \fIZMQ_RECOVERY_IVL\fR option shall retrieve the recovery interval for multicast transports using the specified \fIsocket\fR\&. The recovery interval determines the maximum time in milliseconds that a receiver can be absent from a multicast group before unrecoverable data loss will occur\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +10000 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using multicast transports +T} +.TE +.sp 1 +.SS "ZMQ_SNDBUF: Retrieve kernel transmit buffer size" +.sp +The \fIZMQ_SNDBUF\fR option shall retrieve the underlying kernel transmit buffer size for the specified \fIsocket\fR\&. For details refer to your operating system documentation for the \fISO_SNDBUF\fR socket option\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +8192 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_SNDHWM: Retrieves high water mark for outbound messages" +.sp +The \fIZMQ_SNDHWM\fR option shall return the high water mark for outbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. +.sp +If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +messages +T} +T{ +.sp +Default value +T}:T{ +.sp +1000 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN" +.sp +Retrieve the timeout for send operation on the socket\&. If the value is 0, \fIzmq_send(3)\fR will return immediately, with a EAGAIN error if the message cannot be sent\&. If the value is \-1, it will block until the message is sent\&. For all other values, it will try to send the message for that amount of time before returning with an EAGAIN error\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (infinite) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_SOCKS_PROXY: Retrieve SOCKS5 proxy address" +.sp +The \fIZMQ_SOCKS_PROXY\fR option shall retrieve the SOCKS5 proxy address in string format\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +NULL\-terminated character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +null string +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports +T} +.TE +.sp 1 +.SS "ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option" +.sp +Override \fISO_KEEPALIVE\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +\-1,0,1 +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option" +.sp +Override \fITCP_KEEPCNT\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +\-1,>0 +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPIDLE (or TCP_KEEPALIVE on some OS)" +.sp +Override \fITCP_KEEPIDLE\fR(or \fITCP_KEEPALIVE\fR on some OS) socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +\-1,>0 +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option" +.sp +Override \fITCP_KEEPINTVL\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +\-1,>0 +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_TCP_MAXRT: Retrieve Max TCP Retransmit Timeout" +.sp +On OSes where it is supported, retrieves how long before an unacknowledged TCP retransmit times out\&. The system normally attempts many TCP retransmits following an exponential backoff strategy\&. This means that after a network outage, it may take a long time before the session can be re\-established\&. Setting this option allows the timeout to happen at a shorter interval\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_THREAD_SAFE: Retrieve socket thread safety" +.sp +The \fIZMQ_THREAD_SAFE\fR option shall retrieve a boolean value indicating whether or not the socket is threadsafe\&. Currently \fIZMQ_CLIENT\fR and \fIZMQ_SERVER\fR sockets are threadsafe\&. +.TS +tab(:); +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +boolean +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_TOS: Retrieve the Type\-of\-Service socket override status" +.sp +Retrieve the IP_TOS option for the socket\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +>0 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, only for connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_TYPE: Retrieve socket type" +.sp +The \fIZMQ_TYPE\fR option shall retrieve the socket type for the specified \fIsocket\fR\&. The socket type is specified at socket creation time and cannot be modified afterwards\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +N/A +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_ZAP_DOMAIN: Retrieve RFC 27 authentication domain" +.sp +The \fIZMQ_ZAP_DOMAIN\fR option shall retrieve the last ZAP domain set for the socket\&. The returned value shall be a NULL\-terminated string and MAY be empty\&. The returned size SHALL include the terminating null byte\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +not set +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_VMCI_BUFFER_SIZE: Retrieve buffer size of the VMCI socket" +.sp +The ZMQ_VMCI_BUFFER_SIZE option shall retrieve the size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +uint64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +65546 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using VMCI transport +T} +.TE +.sp 1 +.SS "ZMQ_VMCI_BUFFER_MIN_SIZE: Retrieve min buffer size of the VMCI socket" +.sp +The ZMQ_VMCI_BUFFER_MIN_SIZE option shall retrieve the min size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +uint64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +128 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using VMCI transport +T} +.TE +.sp 1 +.SS "ZMQ_VMCI_BUFFER_MAX_SIZE: Retrieve max buffer size of the VMCI socket" +.sp +The ZMQ_VMCI_BUFFER_MAX_SIZE option shall retrieve the max size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +uint64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +262144 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using VMCI transport +T} +.TE +.sp 1 +.SS "ZMQ_VMCI_CONNECT_TIMEOUT: Retrieve connection timeout of the VMCI socket" +.sp +The ZMQ_VMCI_CONNECT_TIMEOUT option shall retrieve connection timeout for the socket\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using VMCI transport +T} +.TE +.sp 1 +.SH "RETURN VALUE" +.sp +The \fIzmq_getsockopt()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The requested option +\fIoption_name\fR +is unknown, or the requested +\fIoption_len\fR +or +\fIoption_value\fR +is invalid, or the size of the buffer pointed to by +\fIoption_value\fR, as specified by +\fIoption_len\fR, is insufficient for storing the option value\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal\&. +.RE +.SH "EXAMPLE" +.PP +\fBRetrieving the high water mark for outgoing messages\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Retrieve high water mark into sndhwm */ +int sndhwm; +size_t sndhwm_size = sizeof (sndhwm); +rc = zmq_getsockopt (socket, ZMQ_SNDHWM, &sndhwm, &sndhwm_size); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_setsockopt\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_has.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_has.3 new file mode 100644 index 00000000000000..37a01001056863 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_has.3 @@ -0,0 +1,124 @@ +'\" t +.\" Title: zmq_has +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_HAS" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_has \- check a ZMQ capability +.SH "SYNOPSIS" +.sp +\fBint zmq_has (const char *capability);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_has()\fR function shall report whether a specified capability is available in the library\&. This allows bindings and applications to probe a library directly, for transport and security options\&. +.sp +Capabilities shall be lowercase strings\&. The following capabilities are defined: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +ipc \- the library supports the ipc:// protocol +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +pgm \- the library supports the pgm:// protocol +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +tipc \- the library supports the tipc:// protocol +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +norm \- the library supports the norm:// protocol +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +curve \- the library supports the CURVE security mechanism +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +gssapi \- the library supports the GSSAPI security mechanism +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +draft \- the library is built with the draft api +.RE +.sp +When this method is provided, the zmq\&.h header file will define ZMQ_HAS_CAPABILITIES\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_has()\fR function shall return 1 if the specified capability is provided\&. Otherwise it shall return 0\&. +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_close.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_close.3 new file mode 100644 index 00000000000000..098a5a8b3c4eba --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_close.3 @@ -0,0 +1,70 @@ +'\" t +.\" Title: zmq_msg_close +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_CLOSE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_close \- release 0MQ message +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_close (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_close()\fR function shall inform the 0MQ infrastructure that any resources associated with the message object referenced by \fImsg\fR are no longer required and may be released\&. Actual release of resources associated with the message object shall be postponed by 0MQ until all users of the message or underlying data buffer have indicated it is no longer required\&. +.sp +Applications should ensure that \fIzmq_msg_close()\fR is called once a message is no longer required, otherwise memory leaks may occur\&. Note that this is NOT necessary after a successful \fIzmq_msg_send()\fR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_close()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEFAULT\fR +.RS 4 +Invalid message\&. +.RE +.SH "SEE ALSO" +.sp +\fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_copy.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_copy.3 new file mode 100644 index 00000000000000..d8136ef9aaa45c --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_copy.3 @@ -0,0 +1,106 @@ +'\" t +.\" Title: zmq_msg_copy +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_COPY" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_copy \- copy content of a message to another message +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_copy (zmq_msg_t \fR\fB\fI*dest\fR\fR\fB, zmq_msg_t \fR\fB\fI*src\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_copy()\fR function shall copy the message object referenced by \fIsrc\fR to the message object referenced by \fIdest\fR\&. The original content of \fIdest\fR, if any, shall be released\&. You must initialise \fIdest\fR before copying to it\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +The implementation may choose not to physically copy the message content, rather to share the underlying buffer between \fIsrc\fR and \fIdest\fR\&. Avoid modifying message content after a message has been copied with \fIzmq_msg_copy()\fR, doing so can result in undefined behaviour\&. If what you need is an actual hard copy, allocate a new message using \fIzmq_msg_init_size()\fR and copy the message content using \fImemcpy()\fR\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_copy()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEFAULT\fR +.RS 4 +Invalid message\&. +.RE +.SH "EXAMPLE" +.PP +\fBCopying a message\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zmq_msg_t msg; +zmq_msg_init_size (&msg, 255); +memcpy (zmq_msg_data (&msg, "Hello, World", 12); +zmq_msg_t copy; +zmq_msg_init (©); +zmq_msg_copy (©, &msg); +\&.\&.\&. +zmq_msg_close (©); +zmq_msg_close (&msg); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_msg_move\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_data.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_data.3 new file mode 100644 index 00000000000000..7525f5cce86928 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_data.3 @@ -0,0 +1,65 @@ +'\" t +.\" Title: zmq_msg_data +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_DATA" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_data \- retrieve pointer to message content +.SH "SYNOPSIS" +.sp +\fBvoid *zmq_msg_data (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_data()\fR function shall return a pointer to the message content of the message object referenced by \fImsg\fR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +Upon successful completion, \fIzmq_msg_data()\fR shall return a pointer to the message content\&. +.SH "ERRORS" +.sp +No errors are defined\&. +.SH "SEE ALSO" +.sp +\fBzmq_msg_size\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_get.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_get.3 new file mode 100644 index 00000000000000..ec1764be3848a3 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_get.3 @@ -0,0 +1,104 @@ +'\" t +.\" Title: zmq_msg_get +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_GET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_get \- get message property +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_get (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, int \fR\fB\fIproperty\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_get()\fR function shall return the value for the property specified by the \fIproperty\fR argument for the message pointed to by the \fImessage\fR argument\&. +.sp +The following properties can be retrieved with the \fIzmq_msg_get()\fR function: +.PP +\fBZMQ_MORE\fR +.RS 4 +Indicates that there are more message frames to follow after the +\fImessage\fR\&. +.RE +.PP +\fBZMQ_SRCFD\fR +.RS 4 +Returns the file descriptor of the socket the +\fImessage\fR +was read from\&. This allows application to retrieve the remote endpoint via +\fIgetpeername(2)\fR\&. Be aware that the respective socket might be closed already, reused even\&. Currently only implemented for TCP sockets\&. +.RE +.PP +\fBZMQ_SHARED\fR +.RS 4 +Indicates that a message MAY share underlying storage with another copy of this message\&. +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_get()\fR function shall return the value for the property if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The requested +\fIproperty\fR +is unknown\&. +.RE +.SH "EXAMPLE" +.PP +\fBReceiving a multi-frame message\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zmq_msg_t frame; +while (true) { + // Create an empty 0MQ message to hold the message frame + int rc = zmq_msg_init (&frame); + assert (rc == 0); + // Block until a message is available to be received from socket + rc = zmq_msg_recv (socket, &frame, 0); + assert (rc != \-1); + if (zmq_msg_get (&frame, ZMQ_MORE)) + fprintf (stderr, "more\en"); + else { + fprintf (stderr, "end\en"); + break; + } + zmq_msg_close (&frame); +} +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_msg_set\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_gets.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_gets.3 new file mode 100644 index 00000000000000..2624896f605299 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_gets.3 @@ -0,0 +1,93 @@ +'\" t +.\" Title: zmq_msg_gets +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_GETS" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_gets \- get message metadata property +.SH "SYNOPSIS" +.sp +\fBconst char *zmq_msg_gets (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, const char *\fR\fB\fIproperty\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_gets()\fR function shall return the string value for the metadata property specified by the \fIproperty\fR argument for the message pointed to by the \fImessage\fR argument\&. Both the \fIproperty\fR argument and the \fIvalue\fR shall be NULL\-terminated UTF8\-encoded strings\&. +.sp +Metadata is defined on a per\-connection basis during the ZeroMQ connection handshake as specified in \&. +.sp +The following ZMTP properties can be retrieved with the \fIzmq_msg_gets()\fR function: +.sp +.if n \{\ +.RS 4 +.\} +.nf +Socket\-Type +Identity +Resource +.fi +.if n \{\ +.RE +.\} +.sp +Additionally, when available for the underlying transport, the \fBPeer\-Address\fR property will return the IP address of the remote endpoint as returned by getnameinfo(2)\&. +.sp +Other properties may be defined based on the underlying security mechanism, see ZAP authenticated connection sample below\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_gets()\fR function shall return the string value for the property if successful\&. Otherwise it shall return NULL and set \fIerrno\fR to one of the values defined below\&. The caller shall not modify or free the returned value, which shall be owned by the message\&. The encoding of the property and value shall be UTF8\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The requested +\fIproperty\fR +is unknown\&. +.RE +.SH "EXAMPLE" +.PP +\fBGetting the ZAP authenticated user id for a message:\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zmq_msg_t msg; +zmq_msg_init (&msg); +rc = zmq_msg_recv (&msg, dealer, 0); +assert (rc != \-1); +const char *user_id = zmq_msg_gets (&msg, "User\-Id"); +zmq_msg_close (&msg); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init.3 new file mode 100644 index 00000000000000..baf280b251f482 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init.3 @@ -0,0 +1,99 @@ +'\" t +.\" Title: zmq_msg_init +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_INIT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_init \- initialise empty 0MQ message +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_init (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_init()\fR function shall initialise the message object referenced by \fImsg\fR to represent an empty message\&. This function is most useful when called before receiving a message with \fIzmq_recv()\fR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +The functions \fIzmq_msg_init()\fR, \fIzmq_msg_init_data()\fR and \fIzmq_msg_init_size()\fR are mutually exclusive\&. Never initialise the same \fIzmq_msg_t\fR twice\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_init()\fR function always returns zero\&. +.SH "ERRORS" +.sp +No errors are defined\&. +.SH "EXAMPLE" +.PP +\fBReceiving a message from a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zmq_msg_t msg; +rc = zmq_msg_init (&msg); +assert (rc == 0); +int nbytes = zmq_recv (socket, &msg, 0); +assert (nbytes != \-1); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_data.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_data.3 new file mode 100644 index 00000000000000..1130b76c72251f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_data.3 @@ -0,0 +1,146 @@ +'\" t +.\" Title: zmq_msg_init_data +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_INIT_DATA" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_init_data \- initialise 0MQ message from a supplied buffer +.SH "SYNOPSIS" +.sp +\fBtypedef void (zmq_free_fn) (void \fR\fB\fI*data\fR\fR\fB, void \fR\fB\fI*hint\fR\fR\fB);\fR +.sp +\fBint zmq_msg_init_data (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, void \fR\fB\fI*data\fR\fR\fB, size_t \fR\fB\fIsize\fR\fR\fB, zmq_free_fn \fR\fB\fI*ffn\fR\fR\fB, void \fR\fB\fI*hint\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_init_data()\fR function shall initialise the message object referenced by \fImsg\fR to represent the content referenced by the buffer located at address \fIdata\fR, \fIsize\fR bytes long\&. No copy of \fIdata\fR shall be performed and 0MQ shall take ownership of the supplied buffer\&. +.sp +If provided, the deallocation function \fIffn\fR shall be called once the data buffer is no longer required by 0MQ, with the \fIdata\fR and \fIhint\fR arguments supplied to \fIzmq_msg_init_data()\fR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +The deallocation function \fIffn\fR needs to be thread\-safe, since it will be called from an arbitrary thread\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +If the deallocation function is not provided, the allocated memory will not be freed, and this may cause a memory leak\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +The functions \fIzmq_msg_init()\fR, \fIzmq_msg_init_data()\fR and \fIzmq_msg_init_size()\fR are mutually exclusive\&. Never initialise the same \fIzmq_msg_t\fR twice\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_init_data()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBENOMEM\fR +.RS 4 +Insufficient storage space is available\&. +.RE +.SH "EXAMPLE" +.PP +\fBInitialising a message from a supplied buffer\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void my_free (void *data, void *hint) +{ + free (data); +} + + /* \&.\&.\&. */ + +void *data = malloc (6); +assert (data); +memcpy (data, "ABCDEF", 6); +zmq_msg_t msg; +rc = zmq_msg_init_data (&msg, data, 6, my_free, NULL); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_msg_init_size\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_size.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_size.3 new file mode 100644 index 00000000000000..f0f4eb51edafec --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_init_size.3 @@ -0,0 +1,86 @@ +'\" t +.\" Title: zmq_msg_init_size +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_INIT_SIZE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_init_size \- initialise 0MQ message of a specified size +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_init_size (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, size_t \fR\fB\fIsize\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_init_size()\fR function shall allocate any resources required to store a message \fIsize\fR bytes long and initialise the message object referenced by \fImsg\fR to represent the newly allocated message\&. +.sp +The implementation shall choose whether to store message content on the stack (small messages) or on the heap (large messages)\&. For performance reasons \fIzmq_msg_init_size()\fR shall not clear the message data\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +The functions \fIzmq_msg_init()\fR, \fIzmq_msg_init_data()\fR and \fIzmq_msg_init_size()\fR are mutually exclusive\&. Never initialise the same \fIzmq_msg_t\fR twice\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_init_size()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBENOMEM\fR +.RS 4 +Insufficient storage space is available\&. +.RE +.SH "SEE ALSO" +.sp +\fBzmq_msg_init_data\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq_msg_data\fR(3) \fBzmq_msg_size\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_more.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_more.3 new file mode 100644 index 00000000000000..d10ff83f8923b1 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_more.3 @@ -0,0 +1,75 @@ +'\" t +.\" Title: zmq_msg_more +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_MORE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_more \- indicate if there are more message parts to receive +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_more (zmq_msg_t \fR\fB\fI*message\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_more()\fR function indicates whether this is part of a multi\-part message, and there are further parts to receive\&. This method can safely be called after \fIzmq_msg_close()\fR\&. This method is identical to \fIzmq_msg_get()\fR with an argument of ZMQ_MORE\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_more()\fR function shall return zero if this is the final part of a multi\-part message, or the only part of a single\-part message\&. It shall return 1 if there are further parts to receive\&. +.SH "EXAMPLE" +.PP +\fBReceiving a multi-part message\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zmq_msg_t part; +while (true) { + // Create an empty 0MQ message to hold the message part + int rc = zmq_msg_init (&part); + assert (rc == 0); + // Block until a message is available to be received from socket + rc = zmq_msg_recv (socket, &part, 0); + assert (rc != \-1); + if (zmq_msg_more (&part)) + fprintf (stderr, "more\en"); + else { + fprintf (stderr, "end\en"); + break; + } + zmq_msg_close (&part); +} +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_msg_get\fR(3) \fBzmq_msg_set\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_move.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_move.3 new file mode 100644 index 00000000000000..7328f994645581 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_move.3 @@ -0,0 +1,68 @@ +'\" t +.\" Title: zmq_msg_move +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_MOVE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_move \- move content of a message to another message +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_move (zmq_msg_t \fR\fB\fI*dest\fR\fR\fB, zmq_msg_t \fR\fB\fI*src\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_move()\fR function shall move the content of the message object referenced by \fIsrc\fR to the message object referenced by \fIdest\fR\&. No actual copying of message content is performed, \fIdest\fR is simply updated to reference the new content\&. \fIsrc\fR becomes an empty message after calling \fIzmq_msg_move()\fR\&. The original content of \fIdest\fR, if any, shall be released\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_move()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEFAULT\fR +.RS 4 +Invalid message\&. +.RE +.SH "SEE ALSO" +.sp +\fBzmq_msg_copy\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_recv.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_recv.3 new file mode 100644 index 00000000000000..3f8b8a3e7b9cb7 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_recv.3 @@ -0,0 +1,161 @@ +'\" t +.\" Title: zmq_msg_recv +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_RECV" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_recv \- receive a message part from a socket +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_recv (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_recv()\fR function is identical to \fBzmq_recvmsg\fR(3), which shall be deprecated in future versions\&. \fIzmq_msg_recv()\fR is more consistent with other message manipulation functions\&. +.sp +The \fIzmq_msg_recv()\fR function shall receive a message part from the socket referenced by the \fIsocket\fR argument and store it in the message referenced by the \fImsg\fR argument\&. Any content previously stored in \fImsg\fR shall be properly deallocated\&. If there are no message parts available on the specified \fIsocket\fR the \fIzmq_msg_recv()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below: +.PP +\fBZMQ_DONTWAIT\fR +.RS 4 +Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified +\fIsocket\fR, the +\fIzmq_msg_recv()\fR +function shall fail with +\fIerrno\fR +set to EAGAIN\&. +.RE +.SS "Multi\-part messages" +.sp +A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. +.sp +An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_msg_recv()\fR to determine if there are further parts to receive\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_recv()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEAGAIN\fR +.RS 4 +Non\-blocking mode was requested and no messages are available at the moment\&. +.RE +.PP +\fBENOTSUP\fR +.RS 4 +The +\fIzmq_msg_recv()\fR +operation is not supported by this socket type\&. +.RE +.PP +\fBEFSM\fR +.RS 4 +The +\fIzmq_msg_recv()\fR +operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the +\fImessaging patterns\fR +section of +\fBzmq_socket\fR(3) +for more information\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal before a message was available\&. +.RE +.PP +\fBEFAULT\fR +.RS 4 +The message passed to the function was invalid\&. +.RE +.SH "EXAMPLE" +.PP +\fBReceiving a message from a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Create an empty 0MQ message */ +zmq_msg_t msg; +int rc = zmq_msg_init (&msg); +assert (rc == 0); +/* Block until a message is available to be received from socket */ +rc = zmq_msg_recv (&msg, socket, 0); +assert (rc != \-1); +/* Release message */ +zmq_msg_close (&msg); +.fi +.if n \{\ +.RE +.\} +.PP +\fBReceiving a multi-part message\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +int more; +size_t more_size = sizeof (more); +do { + /* Create an empty 0MQ message to hold the message part */ + zmq_msg_t part; + int rc = zmq_msg_init (&part); + assert (rc == 0); + /* Block until a message is available to be received from socket */ + rc = zmq_msg_recv (&part, socket, 0); + assert (rc != \-1); + /* Determine if more message parts are to follow */ + rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); + assert (rc == 0); + zmq_msg_close (&part); +} while (more); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_recv\fR(3) \fBzmq_send\fR(3) \fBzmq_msg_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_routing_id.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_routing_id.3 new file mode 100644 index 00000000000000..94a832143b458f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_routing_id.3 @@ -0,0 +1,76 @@ +'\" t +.\" Title: zmq_msg_routing_id +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_ROUTING_ID" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_routing_id \- return routing ID for message, if any +.SH "SYNOPSIS" +.sp +\fBuint32_t zmq_msg_routing_id (zmq_msg_t \fR\fB\fI*message\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_routing_id()\fR function returns the routing ID for the message, if any\&. The routing ID is set on all messages received from a \fIZMQ_SERVER\fR socket\&. To send a message to a \fIZMQ_SERVER\fR socket you must set the routing ID of a connected \fIZMQ_CLIENT\fR peer\&. Routing IDs are transient\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_routing_id()\fR function shall return zero if there is no routing ID, otherwise it shall return an unsigned 32\-bit integer greater than zero\&. +.SH "EXAMPLE" +.PP +\fBReceiving a client message and routing ID\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *ctx = zmq_ctx_new (); +assert (ctx); + +void *server = zmq_socket (ctx, ZMQ_SERVER); +assert (server); +int rc = zmq_bind (server, "tcp://127\&.0\&.0\&.1:8080"); +assert (rc == 0); + +zmq_msg_t message; +rc = zmq_msg_init (&message); +assert (rc == 0); + +// Receive a message from socket +rc = zmq_msg_recv (server, &message, 0); +assert (rc != \-1); +uint32_t routing_id = zmq_msg_routing_id (&message); +assert (routing_id); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_msg_set_routing_id\fR(3) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_send.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_send.3 new file mode 100644 index 00000000000000..a6070a8672b301 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_send.3 @@ -0,0 +1,184 @@ +'\" t +.\" Title: zmq_msg_send +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_SEND" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_send \- send a message part on a socket +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_send (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_send()\fR function is identical to \fBzmq_sendmsg\fR(3), which shall be deprecated in future versions\&. \fIzmq_msg_send()\fR is more consistent with other message manipulation functions\&. +.sp +The \fIzmq_msg_send()\fR function shall queue the message referenced by the \fImsg\fR argument to be sent to the socket referenced by the \fIsocket\fR argument\&. The \fIflags\fR argument is a combination of the flags defined below: +.PP +\fBZMQ_DONTWAIT\fR +.RS 4 +For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the +\fIsocket\fR, the +\fIzmq_msg_send()\fR +function shall fail with +\fIerrno\fR +set to EAGAIN\&. +.RE +.PP +\fBZMQ_SNDMORE\fR +.RS 4 +Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. +.RE +.sp +The \fIzmq_msg_t\fR structure passed to \fIzmq_msg_send()\fR is nullified during the call\&. If you want to send the same message to multiple sockets you have to copy it (e\&.g\&. using \fIzmq_msg_copy()\fR)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +A successful invocation of \fIzmq_msg_send()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. You do not need to call \fIzmq_msg_close()\fR after a successful \fIzmq_msg_send()\fR\&. +.sp .5v +.RE +.SS "Multi\-part messages" +.sp +A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. +.sp +An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_send()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEAGAIN\fR +.RS 4 +Non\-blocking mode was requested and the message cannot be sent at the moment\&. +.RE +.PP +\fBENOTSUP\fR +.RS 4 +The +\fIzmq_msg_send()\fR +operation is not supported by this socket type\&. +.RE +.PP +\fBEINVAL\fR +.RS 4 +The sender tried to send multipart data, which the socket type does not allow\&. +.RE +.PP +\fBEFSM\fR +.RS 4 +The +\fIzmq_msg_send()\fR +operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the +\fImessaging patterns\fR +section of +\fBzmq_socket\fR(3) +for more information\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal before the message was sent\&. +.RE +.PP +\fBEFAULT\fR +.RS 4 +Invalid message\&. +.RE +.PP +\fBEHOSTUNREACH\fR +.RS 4 +The message cannot be routed\&. +.RE +.SH "EXAMPLE" +.PP +\fBFilling in a message and sending it to a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Create a new message, allocating 6 bytes for message content */ +zmq_msg_t msg; +int rc = zmq_msg_init_size (&msg, 6); +assert (rc == 0); +/* Fill in message content with \*(AqAAAAAA\*(Aq */ +memset (zmq_msg_data (&msg), \*(AqA\*(Aq, 6); +/* Send the message to the socket */ +rc = zmq_msg_send (&msg, socket, 0); +assert (rc == 6); +.fi +.if n \{\ +.RE +.\} +.PP +\fBSending a multi-part message\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Send a multi\-part message consisting of three parts to socket */ +rc = zmq_msg_send (&part1, socket, ZMQ_SNDMORE); +rc = zmq_msg_send (&part2, socket, ZMQ_SNDMORE); +/* Final part; no more parts to follow */ +rc = zmq_msg_send (&part3, socket, 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_recv\fR(3) \fBzmq_send\fR(3) \fBzmq_msg_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set.3 new file mode 100644 index 00000000000000..a2c5da543ba0a4 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set.3 @@ -0,0 +1,56 @@ +'\" t +.\" Title: zmq_msg_set +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_SET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_set \- set message property +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_set (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, int \fR\fB\fIproperty\fR\fR\fB, int \fR\fB\fIvalue\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_set()\fR function shall set the property specified by the \fIproperty\fR argument to the value of the \fIvalue\fR argument for the 0MQ message fragment pointed to by the \fImessage\fR argument\&. +.sp +Currently the \fIzmq_msg_set()\fR function does not support any property names\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_set()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The requested property +\fIproperty\fR +is unknown\&. +.RE +.SH "SEE ALSO" +.sp +\fBzmq_msg_get\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set_routing_id.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set_routing_id.3 new file mode 100644 index 00000000000000..c11c84cd678e38 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_set_routing_id.3 @@ -0,0 +1,54 @@ +'\" t +.\" Title: zmq_msg_set_routing_id +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_SET_ROUTING_" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_set_routing_id \- set routing ID property on message +.SH "SYNOPSIS" +.sp +\fBint zmq_msg_set_routing_id (zmq_msg_t \fR\fB\fI*message\fR\fR\fB, uint32_t \fR\fB\fIrouting_id\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_set_routing_id()\fR function sets the \fIrouting_id\fR specified, on the the message pointed to by the \fImessage\fR argument\&. The \fIrouting_id\fR must be greater than zero\&. To get a valid routing ID, you must receive a message from a \fIZMQ_SERVER\fR socket, and use the libzmq:zmq_msg_routing_id method\&. Routing IDs are transient\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_msg_set_routing_id()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The provided +\fIrouting_id\fR +is zero\&. +.RE +.SH "SEE ALSO" +.sp +\fBzmq_msg_routing_id\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_size.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_size.3 new file mode 100644 index 00000000000000..7e808b7223e21c --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_msg_size.3 @@ -0,0 +1,65 @@ +'\" t +.\" Title: zmq_msg_size +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_MSG_SIZE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_msg_size \- retrieve message content size in bytes +.SH "SYNOPSIS" +.sp +\fBsize_t zmq_msg_size (zmq_msg_t \fR\fB\fI*msg\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_msg_size()\fR function shall return the size in bytes of the content of the message object referenced by \fImsg\fR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +Never access \fIzmq_msg_t\fR members directly, instead always use the \fIzmq_msg\fR family of functions\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +Upon successful completion, \fIzmq_msg_size()\fR shall return the size of the message content in bytes\&. +.SH "ERRORS" +.sp +No errors are defined\&. +.SH "SEE ALSO" +.sp +\fBzmq_msg_data\fR(3) \fBzmq_msg_init\fR(3) \fBzmq_msg_init_size\fR(3) \fBzmq_msg_init_data\fR(3) \fBzmq_msg_close\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_poll.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_poll.3 new file mode 100644 index 00000000000000..928bde440e2110 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_poll.3 @@ -0,0 +1,182 @@ +'\" t +.\" Title: zmq_poll +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_POLL" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_poll \- input/output multiplexing +.SH "SYNOPSIS" +.sp +\fBint zmq_poll (zmq_pollitem_t \fR\fB\fI*items\fR\fR\fB, int \fR\fB\fInitems\fR\fR\fB, long \fR\fB\fItimeout\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_poll()\fR function provides a mechanism for applications to multiplex input/output events in a level\-triggered fashion over a set of sockets\&. Each member of the array pointed to by the \fIitems\fR argument is a \fBzmq_pollitem_t\fR structure\&. The \fInitems\fR argument specifies the number of items in the \fIitems\fR array\&. The \fBzmq_pollitem_t\fR structure is defined as follows: +.sp +.if n \{\ +.RS 4 +.\} +.nf +typedef struct +{ + void \fI*socket\fR; + int \fIfd\fR; + short \fIevents\fR; + short \fIrevents\fR; +} zmq_pollitem_t; +.fi +.if n \{\ +.RE +.\} +.sp +For each \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall examine either the 0MQ socket referenced by \fIsocket\fR \fBor\fR the standard socket specified by the file descriptor \fIfd\fR, for the event(s) specified in \fIevents\fR\&. If both \fIsocket\fR and \fIfd\fR are set in a single \fBzmq_pollitem_t\fR, the 0MQ socket referenced by \fIsocket\fR shall take precedence and the value of \fIfd\fR shall be ignored\&. +.sp +For each \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall first clear the \fIrevents\fR member, and then indicate any requested events that have occurred by setting the bit corresponding to the event condition in the \fIrevents\fR member\&. +.sp +If none of the requested events have occurred on any \fBzmq_pollitem_t\fR item, \fIzmq_poll()\fR shall wait \fItimeout\fR milliseconds for an event to occur on any of the requested items\&. If the value of \fItimeout\fR is 0, \fIzmq_poll()\fR shall return immediately\&. If the value of \fItimeout\fR is \-1, \fIzmq_poll()\fR shall block indefinitely until a requested event has occurred on at least one \fBzmq_pollitem_t\fR\&. +.sp +The \fIevents\fR and \fIrevents\fR members of \fBzmq_pollitem_t\fR are bit masks constructed by OR\(cqing a combination of the following event flags: +.PP +\fBZMQ_POLLIN\fR +.RS 4 +For 0MQ sockets, at least one message may be received from the +\fIsocket\fR +without blocking\&. For standard sockets this is equivalent to the +\fIPOLLIN\fR +flag of the +\fIpoll()\fR +system call and generally means that at least one byte of data may be read from +\fIfd\fR +without blocking\&. +.RE +.PP +\fBZMQ_POLLOUT\fR +.RS 4 +For 0MQ sockets, at least one message may be sent to the +\fIsocket\fR +without blocking\&. For standard sockets this is equivalent to the +\fIPOLLOUT\fR +flag of the +\fIpoll()\fR +system call and generally means that at least one byte of data may be written to +\fIfd\fR +without blocking\&. +.RE +.PP +\fBZMQ_POLLERR\fR +.RS 4 +For standard sockets, this flag is passed through +\fIzmq_poll()\fR +to the underlying +\fIpoll()\fR +system call and generally means that some sort of error condition is present on the socket specified by +\fIfd\fR\&. For 0MQ sockets this flag has no effect if set in +\fIevents\fR, and shall never be returned in +\fIrevents\fR +by +\fIzmq_poll()\fR\&. +.RE +.PP +\fBZMQ_POLLPRI\fR +.RS 4 +For 0MQ sockets this flags is of no use\&. For standard sockets this means there is urgent data to read\&. Refer to the POLLPRI flag for more informations\&. For file descriptor, refer to your use case: as an example, GPIO interrupts are signaled through a POLLPRI event\&. This flag has no effect on Windows\&. +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +The \fIzmq_poll()\fR function may be implemented or emulated using operating system interfaces other than \fIpoll()\fR, and as such may be subject to the limits of those interfaces in ways not defined in this documentation\&. +.sp .5v +.RE +.SH "RETURN VALUE" +.sp +Upon successful completion, the \fIzmq_poll()\fR function shall return the number of \fBzmq_pollitem_t\fR structures with events signaled in \fIrevents\fR or 0 if no events have been signaled\&. Upon failure, \fIzmq_poll()\fR shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBETERM\fR +.RS 4 +At least one of the members of the +\fIitems\fR +array refers to a +\fIsocket\fR +whose associated 0MQ +\fIcontext\fR +was terminated\&. +.RE +.PP +\fBEFAULT\fR +.RS 4 +The provided +\fIitems\fR +was not valid (NULL)\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal before any events were available\&. +.RE +.SH "EXAMPLE" +.PP +\fBPolling indefinitely for input events on both a 0MQ socket and a standard socket.\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zmq_pollitem_t items [2]; +/* First item refers to 0MQ socket \*(Aqsocket\*(Aq */ +items[0]\&.socket = socket; +items[0]\&.events = ZMQ_POLLIN; +/* Second item refers to standard socket \*(Aqfd\*(Aq */ +items[1]\&.socket = NULL; +items[1]\&.fd = fd; +items[1]\&.events = ZMQ_POLLIN; +/* Poll for events indefinitely */ +int rc = zmq_poll (items, 2, \-1); +assert (rc >= 0); +/* Returned events will be stored in items[]\&.revents */ +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_socket\fR(3) \fBzmq_send\fR(3) \fBzmq_recv\fR(3) \fBzmq\fR(7) +.sp +Your operating system documentation for the \fIpoll()\fR system call\&. +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy.3 new file mode 100644 index 00000000000000..73b244b7f377c8 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy.3 @@ -0,0 +1,89 @@ +'\" t +.\" Title: zmq_proxy +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_PROXY" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_proxy \- start built\-in 0MQ proxy +.SH "SYNOPSIS" +.sp +\fBint zmq_proxy (const void \fR\fB\fI*frontend\fR\fR\fB, const void \fR\fB\fI*backend\fR\fR\fB, const void \fR\fB\fI*capture\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_proxy()\fR function starts the built\-in 0MQ proxy in the current application thread\&. +.sp +The proxy connects a frontend socket to a backend socket\&. Conceptually, data flows from frontend to backend\&. Depending on the socket types, replies may flow in the opposite direction\&. The direction is conceptual only; the proxy is fully symmetric and there is no technical difference between frontend and backend\&. +.sp +Before calling \fIzmq_proxy()\fR you must set any socket options, and connect or bind both frontend and backend sockets\&. The two conventional proxy models are: +.sp +\fIzmq_proxy()\fR runs in the current thread and returns only if/when the current context is closed\&. +.sp +If the capture socket is not NULL, the proxy shall send all messages, received on both frontend and backend, to the capture socket\&. The capture socket should be a \fIZMQ_PUB\fR, \fIZMQ_DEALER\fR, \fIZMQ_PUSH\fR, or \fIZMQ_PAIR\fR socket\&. +.sp +Refer to \fBzmq_socket\fR(3) for a description of the available socket types\&. +.SH "EXAMPLE USAGE" +.SS "Shared Queue" +.sp +When the frontend is a ZMQ_ROUTER socket, and the backend is a ZMQ_DEALER socket, the proxy shall act as a shared queue that collects requests from a set of clients, and distributes these fairly among a set of services\&. Requests shall be fair\-queued from frontend connections and distributed evenly across backend connections\&. Replies shall automatically return to the client that made the original request\&. +.SS "Forwarder" +.sp +When the frontend is a ZMQ_XSUB socket, and the backend is a ZMQ_XPUB socket, the proxy shall act as a message forwarder that collects messages from a set of publishers and forwards these to a set of subscribers\&. This may be used to bridge networks transports, e\&.g\&. read on tcp:// and forward on pgm://\&. +.SS "Streamer" +.sp +When the frontend is a ZMQ_PULL socket, and the backend is a ZMQ_PUSH socket, the proxy shall collect tasks from a set of clients and forwards these to a set of workers using the pipeline pattern\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_proxy()\fR function always returns \-1 and \fIerrno\fR set to \fBETERM\fR or \fBEINTR\fR (the 0MQ \fIcontext\fR associated with either of the specified sockets was terminated)\&. +.SH "EXAMPLE" +.PP +\fBCreating a shared queue proxy\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create frontend and backend sockets +void *frontend = zmq_socket (context, ZMQ_ROUTER); +assert (backend); +void *backend = zmq_socket (context, ZMQ_DEALER); +assert (frontend); +// Bind both sockets to TCP ports +assert (zmq_bind (frontend, "tcp://*:5555") == 0); +assert (zmq_bind (backend, "tcp://*:5556") == 0); +// Start the queue proxy, which runs until ETERM +zmq_proxy (frontend, backend, NULL); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy_steerable.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy_steerable.3 new file mode 100644 index 00000000000000..2cf1209e9c7dd5 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_proxy_steerable.3 @@ -0,0 +1,112 @@ +'\" t +.\" Title: zmq_proxy_steerable +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_PROXY_STEERABLE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_proxy_steerable \- built\-in 0MQ proxy with control flow +.SH "SYNOPSIS" +.sp +\fBint zmq_proxy_steerable (const void \fR\fB\fI*frontend\fR\fR\fB, const void \fR\fB\fI*backend\fR\fR\fB, const void \fR\fB\fI*capture\fR\fR\fB, const void \fR\fB\fI*control\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_proxy_steerable()\fR function starts the built\-in 0MQ proxy in the current application thread, as \fIzmq_proxy()\fR do\&. Please, refer to this function for the general description and usage\&. We describe here only the additional control flow provided by the socket passed as the fourth argument "control"\&. +.sp +If the control socket is not NULL, the proxy supports control flow\&. If \fIPAUSE\fR is received on this socket, the proxy suspends its activities\&. If \fIRESUME\fR is received, it goes on\&. If \fITERMINATE\fR is received, it terminates smoothly\&. At start, the proxy runs normally as if zmq_proxy was used\&. +.sp +If the control socket is NULL, the function behave exactly as if zmq_proxy had been called\&. +.sp +Refer to \fBzmq_socket\fR(3) for a description of the available socket types\&. Refer to \fBzmq_proxy\fR(3) for a description of the zmq_proxy\&. +.SH "EXAMPLE USAGE" +.sp +cf zmq_proxy +.SH "RETURN VALUE" +.sp +The \fIzmq_proxy_steerable()\fR function returns 0 if TERMINATE is sent to its control socket\&. Otherwise, it returns \-1 and \fIerrno\fR set to \fBETERM\fR or \fBEINTR\fR (the 0MQ \fIcontext\fR associated with either of the specified sockets was terminated)\&. +.SH "EXAMPLE" +.PP +\fBCreating a shared queue proxy\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create frontend, backend and control sockets +void *frontend = zmq_socket (context, ZMQ_ROUTER); +assert (backend); +void *backend = zmq_socket (context, ZMQ_DEALER); +assert (frontend); +void *control = zmq_socket (context, ZMQ_SUB); +assert (control); + +// Bind sockets to TCP ports +assert (zmq_bind (frontend, "tcp://*:5555") == 0); +assert (zmq_bind (backend, "tcp://*:5556") == 0); +assert (zmq_connect (control, "tcp://*:5557") == 0); + +// Subscribe to the control socket since we have chosen SUB here +assert (zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", 0)); + +// Start the queue proxy, which runs until ETERM or "TERMINATE" +// received on the control socket +zmq_proxy_steerable (frontend, backend, NULL, control); +.fi +.if n \{\ +.RE +.\} +.PP +\fBSet up a controller in another node, process or whatever\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *control = zmq_socket (context, ZMQ_PUB); +assert (control); +assert (zmq_bind (control, "tcp://*:5557") == 0); + +// pause the proxy +assert (zmq_send (control, "PAUSE", 5, 0) == 0); + +// resume the proxy +assert (zmq_send (control, "RESUME", 6, 0) == 0); + +// terminate the proxy +assert (zmq_send (control, "TERMINATE", 9, 0) == 0); +\-\-\- + + +SEE ALSO +.fi +.if n \{\ +.RE +.\} +.sp +\fBzmq_proxy\fR(3) \fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recv.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recv.3 new file mode 100644 index 00000000000000..f90366ae309170 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recv.3 @@ -0,0 +1,122 @@ +'\" t +.\" Title: zmq_recv +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_RECV" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_recv \- receive a message part from a socket +.SH "SYNOPSIS" +.sp +\fBint zmq_recv (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_recv()\fR function shall receive a message from the socket referenced by the \fIsocket\fR argument and store it in the buffer referenced by the \fIbuf\fR argument\&. Any bytes exceeding the length specified by the \fIlen\fR argument shall be truncated\&. If there are no messages available on the specified \fIsocket\fR the \fIzmq_recv()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below: The \fIbuf\fR argument may be null if len is zero\&. +.PP +\fBZMQ_DONTWAIT\fR +.RS 4 +Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified +\fIsocket\fR, the +\fIzmq_recv()\fR +function shall fail with +\fIerrno\fR +set to EAGAIN\&. +.RE +.SS "Multi\-part messages" +.sp +A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. +.sp +An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_recv()\fR to determine if there are further parts to receive\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_recv()\fR function shall return number of bytes in the message if successful\&. Note that the value can exceed the value of the \fIlen\fR parameter in case the message was truncated\&. If not successful the function shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEAGAIN\fR +.RS 4 +Non\-blocking mode was requested and no messages are available at the moment\&. +.RE +.PP +\fBENOTSUP\fR +.RS 4 +The +\fIzmq_recv()\fR +operation is not supported by this socket type\&. +.RE +.PP +\fBEFSM\fR +.RS 4 +The +\fIzmq_recv()\fR +operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the +\fImessaging patterns\fR +section of +\fBzmq_socket\fR(3) +for more information\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal before a message was available\&. +.RE +.SH "EXAMPLE" +.PP +\fBReceiving a message from a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +char buf [256]; +nbytes = zmq_recv (socket, buf, 256, 0); +assert (nbytes != \-1); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recvmsg.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recvmsg.3 new file mode 100644 index 00000000000000..c3b0b44bb10e3f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_recvmsg.3 @@ -0,0 +1,175 @@ +'\" t +.\" Title: zmq_recvmsg +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_RECVMSG" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_recvmsg \- receive a message part from a socket +.SH "SYNOPSIS" +.sp +\fBint zmq_recvmsg (void \fR\fB\fI*socket\fR\fR\fB, zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_recvmsg()\fR function shall receive a message part from the socket referenced by the \fIsocket\fR argument and store it in the message referenced by the \fImsg\fR argument\&. Any content previously stored in \fImsg\fR shall be properly deallocated\&. If there are no message parts available on the specified \fIsocket\fR the \fIzmq_recvmsg()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below: +.PP +\fBZMQ_DONTWAIT\fR +.RS 4 +Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified +\fIsocket\fR, the +\fIzmq_recvmsg()\fR +function shall fail with +\fIerrno\fR +set to EAGAIN\&. +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +this API method is deprecated in favor of zmq_msg_recv(3)\&. +.sp .5v +.RE +.SS "Multi\-part messages" +.sp +A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. +.sp +An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_recvmsg()\fR to determine if there are further parts to receive\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_recvmsg()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEAGAIN\fR +.RS 4 +Non\-blocking mode was requested and no messages are available at the moment\&. +.RE +.PP +\fBENOTSUP\fR +.RS 4 +The +\fIzmq_recvmsg()\fR +operation is not supported by this socket type\&. +.RE +.PP +\fBEFSM\fR +.RS 4 +The +\fIzmq_recvmsg()\fR +operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the +\fImessaging patterns\fR +section of +\fBzmq_socket\fR(3) +for more information\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal before a message was available\&. +.RE +.PP +\fBEFAULT\fR +.RS 4 +The message passed to the function was invalid\&. +.RE +.SH "EXAMPLE" +.PP +\fBReceiving a message from a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Create an empty 0MQ message */ +zmq_msg_t msg; +int rc = zmq_msg_init (&msg); +assert (rc == 0); +/* Block until a message is available to be received from socket */ +rc = zmq_recvmsg (socket, &msg, 0); +assert (rc != \-1); +/* Release message */ +zmq_msg_close (&msg); +.fi +.if n \{\ +.RE +.\} +.PP +\fBReceiving a multi-part message\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +int more; +size_t more_size = sizeof (more); +do { + /* Create an empty 0MQ message to hold the message part */ + zmq_msg_t part; + int rc = zmq_msg_init (&part); + assert (rc == 0); + /* Block until a message is available to be received from socket */ + rc = zmq_recvmsg (socket, &part, 0); + assert (rc != \-1); + /* Determine if more message parts are to follow */ + rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size); + assert (rc == 0); + zmq_msg_close (&part); +} while (more); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_recv\fR(3) \fBzmq_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send.3 new file mode 100644 index 00000000000000..f0bb2adadb310b --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send.3 @@ -0,0 +1,158 @@ +'\" t +.\" Title: zmq_send +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_SEND" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_send \- send a message part on a socket +.SH "SYNOPSIS" +.sp +\fBint zmq_send (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_send()\fR function shall queue a message created from the buffer referenced by the \fIbuf\fR and \fIlen\fR arguments\&. The \fIflags\fR argument is a combination of the flags defined below: +.PP +\fBZMQ_DONTWAIT\fR +.RS 4 +For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the +\fIsocket\fR, the +\fIzmq_send()\fR +function shall fail with +\fIerrno\fR +set to EAGAIN\&. +.RE +.PP +\fBZMQ_SNDMORE\fR +.RS 4 +Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +A successful invocation of \fIzmq_send()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. +.sp .5v +.RE +.SS "Multi\-part messages" +.sp +A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. +.sp +An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_send()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEAGAIN\fR +.RS 4 +Non\-blocking mode was requested and the message cannot be sent at the moment\&. +.RE +.PP +\fBENOTSUP\fR +.RS 4 +The +\fIzmq_send()\fR +operation is not supported by this socket type\&. +.RE +.PP +\fBEINVAL\fR +.RS 4 +The sender tried to send multipart data, which the socket type does not allow\&. +.RE +.PP +\fBEFSM\fR +.RS 4 +The +\fIzmq_send()\fR +operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the +\fImessaging patterns\fR +section of +\fBzmq_socket\fR(3) +for more information\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal before the message was sent\&. +.RE +.PP +\fBEHOSTUNREACH\fR +.RS 4 +The message cannot be routed\&. +.RE +.SH "EXAMPLE" +.PP +\fBSending a multi-part message\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Send a multi\-part message consisting of three parts to socket */ +rc = zmq_send (socket, "ABC", 3, ZMQ_SNDMORE); +assert (rc == 3); +rc = zmq_send (socket, "DEFGH", 5, ZMQ_SNDMORE); +assert (rc == 5); +/* Final part; no more parts to follow */ +rc = zmq_send (socket, "JK", 2, 0); +assert (rc == 2); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_send_const\fR(3) \fBzmq_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send_const.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send_const.3 new file mode 100644 index 00000000000000..11175ff3267475 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_send_const.3 @@ -0,0 +1,153 @@ +'\" t +.\" Title: zmq_send_const +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_SEND_CONST" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_send_const \- send a constant\-memory message part on a socket +.SH "SYNOPSIS" +.sp +\fBint zmq_send_const (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_send_const()\fR function shall queue a message created from the buffer referenced by the \fIbuf\fR and \fIlen\fR arguments\&. The message buffer is assumed to be constant\-memory and will therefore not be copied or deallocated in any way\&. The \fIflags\fR argument is a combination of the flags defined below: +.PP +\fBZMQ_DONTWAIT\fR +.RS 4 +For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the +\fIsocket\fR, the +\fIzmq_send_const()\fR +function shall fail with +\fIerrno\fR +set to EAGAIN\&. +.RE +.PP +\fBZMQ_SNDMORE\fR +.RS 4 +Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +A successful invocation of \fIzmq_send_const()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. +.sp .5v +.RE +.SS "Multi\-part messages" +.sp +A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. +.sp +An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_send_const()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEAGAIN\fR +.RS 4 +Non\-blocking mode was requested and the message cannot be sent at the moment\&. +.RE +.PP +\fBENOTSUP\fR +.RS 4 +The +\fIzmq_send_const()\fR +operation is not supported by this socket type\&. +.RE +.PP +\fBEFSM\fR +.RS 4 +The +\fIzmq_send_const()\fR +operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the +\fImessaging patterns\fR +section of +\fBzmq_socket\fR(3) +for more information\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal before the message was sent\&. +.RE +.PP +\fBEHOSTUNREACH\fR +.RS 4 +The message cannot be routed\&. +.RE +.SH "EXAMPLE" +.PP +\fBSending a multi-part message\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Send a multi\-part message consisting of three parts to socket */ +rc = zmq_send_const (socket, "ABC", 3, ZMQ_SNDMORE); +assert (rc == 3); +rc = zmq_send_const (socket, "DEFGH", 5, ZMQ_SNDMORE); +assert (rc == 5); +/* Final part; no more parts to follow */ +rc = zmq_send_const (socket, "JK", 2, 0); +assert (rc == 2); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_send\fR(3) \fBzmq_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_sendmsg.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_sendmsg.3 new file mode 100644 index 00000000000000..4074be3a45056a --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_sendmsg.3 @@ -0,0 +1,198 @@ +'\" t +.\" Title: zmq_sendmsg +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_SENDMSG" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_sendmsg \- send a message part on a socket +.SH "SYNOPSIS" +.sp +\fBint zmq_sendmsg (void \fR\fB\fI*socket\fR\fR\fB, zmq_msg_t \fR\fB\fI*msg\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_sendmsg()\fR function shall queue the message referenced by the \fImsg\fR argument to be sent to the socket referenced by the \fIsocket\fR argument\&. The \fIflags\fR argument is a combination of the flags defined below: +.PP +\fBZMQ_DONTWAIT\fR +.RS 4 +For socket types (DEALER, PUSH) that block when there are no available peers (or all peers have full high\-water mark), specifies that the operation should be performed in non\-blocking mode\&. If the message cannot be queued on the +\fIsocket\fR, the +\fIzmq_sendmsg()\fR +function shall fail with +\fIerrno\fR +set to EAGAIN\&. +.RE +.PP +\fBZMQ_SNDMORE\fR +.RS 4 +Specifies that the message being sent is a multi\-part message, and that further message parts are to follow\&. Refer to the section regarding multi\-part messages below for a detailed description\&. +.RE +.sp +The \fIzmq_msg_t\fR structure passed to \fIzmq_sendmsg()\fR is nullified during the call\&. If you want to send the same message to multiple sockets you have to copy it (e\&.g\&. using \fIzmq_msg_copy()\fR)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +A successful invocation of \fIzmq_sendmsg()\fR does not indicate that the message has been transmitted to the network, only that it has been queued on the \fIsocket\fR and 0MQ has assumed responsibility for the message\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +this API method is deprecated in favor of zmq_msg_send(3)\&. +.sp .5v +.RE +.SS "Multi\-part messages" +.sp +A 0MQ message is composed of 1 or more message parts\&. Each message part is an independent \fIzmq_msg_t\fR in its own right\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&. +.sp +An application that sends multi\-part messages must use the \fIZMQ_SNDMORE\fR flag when sending each message part except the final one\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_sendmsg()\fR function shall return number of bytes in the message if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEAGAIN\fR +.RS 4 +Non\-blocking mode was requested and the message cannot be sent at the moment\&. +.RE +.PP +\fBENOTSUP\fR +.RS 4 +The +\fIzmq_sendmsg()\fR +operation is not supported by this socket type\&. +.RE +.PP +\fBEINVAL\fR +.RS 4 +The sender tried to send multipart data, which the socket type does not allow\&. +.RE +.PP +\fBEFSM\fR +.RS 4 +The +\fIzmq_sendmsg()\fR +operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the +\fImessaging patterns\fR +section of +\fBzmq_socket\fR(3) +for more information\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal before the message was sent\&. +.RE +.PP +\fBEFAULT\fR +.RS 4 +Invalid message\&. +.RE +.PP +\fBEHOSTUNREACH\fR +.RS 4 +The message cannot be routed\&. +.RE +.SH "EXAMPLE" +.PP +\fBFilling in a message and sending it to a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Create a new message, allocating 6 bytes for message content */ +zmq_msg_t msg; +int rc = zmq_msg_init_size (&msg, 6); +assert (rc == 0); +/* Fill in message content with \*(AqAAAAAA\*(Aq */ +memset (zmq_msg_data (&msg), \*(AqA\*(Aq, 6); +/* Send the message to the socket */ +rc = zmq_sendmsg (socket, &msg, 0); +assert (rc == 6); +.fi +.if n \{\ +.RE +.\} +.PP +\fBSending a multi-part message\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Send a multi\-part message consisting of three parts to socket */ +rc = zmq_sendmsg (socket, &part1, ZMQ_SNDMORE); +rc = zmq_sendmsg (socket, &part2, ZMQ_SNDMORE); +/* Final part; no more parts to follow */ +rc = zmq_sendmsg (socket, &part3, 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_recv\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_setsockopt.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_setsockopt.3 new file mode 100644 index 00000000000000..af381286e8fb3d --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_setsockopt.3 @@ -0,0 +1,3201 @@ +'\" t +.\" Title: zmq_setsockopt +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_SETSOCKOPT" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_setsockopt \- set 0MQ socket options +.SH "SYNOPSIS" +.sp +\fBint zmq_setsockopt (void \fR\fB\fI*socket\fR\fR\fB, int \fR\fB\fIoption_name\fR\fR\fB, const void \fR\fB\fI*option_value\fR\fR\fB, size_t \fR\fB\fIoption_len\fR\fR\fB);\fR +.sp +Caution: All options, with the exception of ZMQ_SUBSCRIBE, ZMQ_UNSUBSCRIBE, ZMQ_LINGER, ZMQ_ROUTER_HANDOVER, ZMQ_ROUTER_MANDATORY, ZMQ_PROBE_ROUTER, ZMQ_XPUB_VERBOSE, ZMQ_XPUB_VERBOSER, ZMQ_REQ_CORRELATE, ZMQ_REQ_RELAXED, ZMQ_SNDHWM and ZMQ_RCVHWM, only take effect for subsequent socket bind/connects\&. +.sp +Specifically, security options take effect for subsequent bind/connect calls, and can be changed at any time to affect subsequent binds and/or connects\&. +.SH "DESCRIPTION" +.sp +The \fIzmq_setsockopt()\fR function shall set the option specified by the \fIoption_name\fR argument to the value pointed to by the \fIoption_value\fR argument for the 0MQ socket pointed to by the \fIsocket\fR argument\&. The \fIoption_len\fR argument is the size of the option value in bytes\&. For options taking a value of type "character string", the provided byte data should either contain no zero bytes, or end in a single zero byte (terminating ASCII NUL character)\&. +.sp +The following socket options can be set with the \fIzmq_setsockopt()\fR function: +.SS "ZMQ_AFFINITY: Set I/O thread affinity" +.sp +The \fIZMQ_AFFINITY\fR option shall set the I/O thread affinity for newly created connections on the specified \fIsocket\fR\&. +.sp +Affinity determines which threads from the 0MQ I/O thread pool associated with the socket\(cqs \fIcontext\fR shall handle newly created connections\&. A value of zero specifies no affinity, meaning that work shall be distributed fairly among all 0MQ I/O threads in the thread pool\&. For non\-zero values, the lowest bit corresponds to thread 1, second lowest bit to thread 2 and so on\&. For example, a value of 3 specifies that subsequent connections on \fIsocket\fR shall be handled exclusively by I/O threads 1 and 2\&. +.sp +See also \fBzmq_init\fR(3) for details on allocating the number of I/O threads for a specific \fIcontext\fR\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +uint64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A (bitmap) +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +N/A +T} +.TE +.sp 1 +.SS "ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections" +.sp +The \fIZMQ_BACKLOG\fR option shall set the maximum length of the queue of outstanding peer connections for the specified \fIsocket\fR; this only applies to connection\-oriented transports\&. For details refer to your operating system documentation for the \fIlisten\fR function\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +connections +T} +T{ +.sp +Default value +T}:T{ +.sp +100 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, only for connection\-oriented transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_CONNECT_RID: Assign the next outbound connection id" +.sp +The \fIZMQ_CONNECT_RID\fR option sets the peer id of the next host connected via the zmq_connect() call, and immediately readies that connection for data transfer with the named id\&. This option applies only to the first subsequent call to zmq_connect(), calls thereafter use default connection behaviour\&. +.sp +Typical use is to set this socket option ahead of each zmq_connect() attempt to a new host\&. Each connection MUST be assigned a unique name\&. Assigning a name that is already in use is not allowed\&. +.sp +Useful when connecting ROUTER to ROUTER, or STREAM to STREAM, as it allows for immediate sending to peers\&. Outbound id framing requirements for ROUTER and STREAM sockets apply\&. +.sp +The peer id should be from 1 to 255 bytes long and MAY NOT start with binary zero\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +NULL +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_ROUTER, ZMQ_STREAM +T} +.TE +.sp 1 +.SS "ZMQ_CONFLATE: Keep only last message" +.sp +If set, a socket shall keep only one message in its inbound/outbound queue, this message being the last message received/the last message to be sent\&. Ignores \fIZMQ_RCVHWM\fR and \fIZMQ_SNDHWM\fR options\&. Does not support multi\-part messages, in particular, only one part of it is kept in the socket internal queue\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +boolean +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (false) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_PULL, ZMQ_PUSH, ZMQ_SUB, ZMQ_PUB, ZMQ_DEALER +T} +.TE +.sp 1 +.SS "ZMQ_CONNECT_TIMEOUT: Set connect() timeout" +.sp +Sets how long to wait before timing\-out a connect() system call\&. The connect() system call normally takes a long time before it returns a time out error\&. Setting this option allows the library to time out the call at an earlier interval\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (disabled) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_CURVE_PUBLICKEY: Set CURVE public key" +.sp +Sets the socket\(cqs long term public key\&. You must set this on CURVE client sockets, see \fBzmq_curve\fR(7)\&. You can provide the key as 32 binary bytes, or as a 40\-character string encoded in the Z85 encoding format and terminated in a null byte\&. The public key must always be used with the matching secret key\&. To generate a public/secret key pair, use \fBzmq_curve_keypair\fR(3)\&. To derive the public key from a secret key, use \fBzmq_curve_public\fR(3)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +an option value size of 40 is supported for backwards compatibility, though is deprecated\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data or Z85 text string +T} +T{ +.sp +Option value size +T}:T{ +.sp +32 or 41 +T} +T{ +.sp +Default value +T}:T{ +.sp +NULL +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_CURVE_SECRETKEY: Set CURVE secret key" +.sp +Sets the socket\(cqs long term secret key\&. You must set this on both CURVE client and server sockets, see \fBzmq_curve\fR(7)\&. You can provide the key as 32 binary bytes, or as a 40\-character string encoded in the Z85 encoding format and terminated in a null byte\&. To generate a public/secret key pair, use \fBzmq_curve_keypair\fR(3)\&. To derive the public key from a secret key, use \fBzmq_curve_public\fR(3)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +an option value size of 40 is supported for backwards compatibility, though is deprecated\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data or Z85 text string +T} +T{ +.sp +Option value size +T}:T{ +.sp +32 or 41 +T} +T{ +.sp +Default value +T}:T{ +.sp +NULL +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_CURVE_SERVER: Set CURVE server role" +.sp +Defines whether the socket will act as server for CURVE security, see \fBzmq_curve\fR(7)\&. A value of \fI1\fR means the socket will act as CURVE server\&. A value of \fI0\fR means the socket will not act as CURVE server, and its security role then depends on other option settings\&. Setting this to \fI0\fR shall reset the socket security to NULL\&. When you set this you must also set the server\(cqs secret key using the ZMQ_CURVE_SECRETKEY option\&. A server socket does not need to know its own public key\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_CURVE_SERVERKEY: Set CURVE server key" +.sp +Sets the socket\(cqs long term server key\&. You must set this on CURVE client sockets, see \fBzmq_curve\fR(7)\&. You can provide the key as 32 binary bytes, or as a 40\-character string encoded in the Z85 encoding format and terminated in a null byte\&. This key must have been generated together with the server\(cqs secret key\&. To generate a public/secret key pair, use \fBzmq_curve_keypair\fR(3)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +an option value size of 40 is supported for backwards compatibility, though is deprecated\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data or Z85 text string +T} +T{ +.sp +Option value size +T}:T{ +.sp +32 or 41 +T} +T{ +.sp +Default value +T}:T{ +.sp +NULL +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_GSSAPI_PLAINTEXT: Disable GSSAPI encryption" +.sp +Defines whether communications on the socket will be encrypted, see \fBzmq_gssapi\fR(7)\&. A value of \fI1\fR means that communications will be plaintext\&. A value of \fI0\fR means communications will be encrypted\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (false) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_GSSAPI_PRINCIPAL: Set name of GSSAPI principal" +.sp +Sets the name of the principal for whom GSSAPI credentials should be acquired\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +not set +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_GSSAPI_SERVER: Set GSSAPI server role" +.sp +Defines whether the socket will act as server for GSSAPI security, see \fBzmq_gssapi\fR(7)\&. A value of \fI1\fR means the socket will act as GSSAPI server\&. A value of \fI0\fR means the socket will act as GSSAPI client\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (false) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_GSSAPI_SERVICE_PRINCIPAL: Set name of GSSAPI service principal" +.sp +Sets the name of the principal of the GSSAPI server to which a GSSAPI client intends to connect\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +not set +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_HANDSHAKE_IVL: Set maximum handshake interval" +.sp +The \fIZMQ_HANDSHAKE_IVL\fR option shall set the maximum handshake interval for the specified \fIsocket\fR\&. Handshaking is the exchange of socket configuration information (socket type, identity, security) that occurs when a connection is first opened, only for connection\-oriented transports\&. If handshaking does not complete within the configured time, the connection shall be closed\&. The value 0 means no handshake time limit\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +30000 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all but ZMQ_STREAM, only for connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_HEARTBEAT_IVL: Set interval between sending ZMTP heartbeats" +.sp +The \fIZMQ_HEARTBEAT_IVL\fR option shall set the interval between sending ZMTP heartbeats for the specified \fIsocket\fR\&. If this option is set and is greater than 0, then a \fIPING\fR ZMTP command will be sent every \fIZMQ_HEARTBEAT_IVL\fR milliseconds\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_HEARTBEAT_TIMEOUT: Set timeout for ZMTP heartbeats" +.sp +The \fIZMQ_HEARTBEAT_TIMEOUT\fR option shall set how long to wait before timing\-out a connection after sending a \fIPING\fR ZMTP command and not receiving any traffic\&. This option is only valid if \fIZMQ_HEARTBEAT_IVL\fR is also set, and is greater than 0\&. The connection will time out if there is no traffic received after sending the \fIPING\fR command, but the received traffic does not have to be a \fIPONG\fR command \- any received traffic will cancel the timeout\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_HEARTBEAT_TTL: Set the TTL value for ZMTP heartbeats" +.sp +The \fIZMQ_HEARTBEAT_TTL\fR option shall set the timeout on the remote peer for ZMTP heartbeats\&. If this option is greater than 0, the remote side shall time out the connection if it does not receive any more traffic within the TTL period\&. This option does not have any effect if \fIZMQ_HEARTBEAT_IVL\fR is not set or is 0\&. Internally, this value is rounded down to the nearest decisecond, any value less than 100 will have no effect\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_IDENTITY: Set socket identity" +.sp +The \fIZMQ_IDENTITY\fR option shall set the identity of the specified \fIsocket\fR when connecting to a ROUTER socket\&. The identity should be from 1 to 255 bytes long and may contain any values\&. +.sp +If two clients use the same identity when connecting to a ROUTER, the results shall depend on the ZMQ_ROUTER_HANDOVER option setting\&. If that is not set (or set to the default of zero), the ROUTER socket shall reject clients trying to connect with an already\-used identity\&. If that option is set to 1, the ROUTER socket shall hand\-over the connection to the new client and disconnect the existing one\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +NULL +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_REQ, ZMQ_REP, ZMQ_ROUTER, ZMQ_DEALER\&. +T} +.TE +.sp 1 +.SS "ZMQ_IMMEDIATE: Queue messages only to completed connections" +.sp +By default queues will fill on outgoing connections even if the connection has not completed\&. This can lead to "lost" messages on sockets with round\-robin routing (REQ, PUSH, DEALER)\&. If this option is set to 1, messages shall be queued only to completed connections\&. This will cause the socket to block if there are no other connections, but will prevent queues from filling on pipes awaiting connection\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +boolean +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (false) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, only for connection\-oriented transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_INVERT_MATCHING: Invert message filtering" +.sp +Reverses the filtering behavior of PUB\-SUB sockets, when set to 1\&. +.sp +On \fIPUB\fR and \fIXPUB\fR sockets, this causes messages to be sent to all connected sockets \fIexcept\fR those subscribed to a prefix that matches the message\&. On \fISUB\fR sockets, this causes only incoming messages that do \fInot\fR match any of the socket\(cqs subscriptions to be received by the user\&. +.sp +Whenever \fIZMQ_INVERT_MATCHING\fR is set to 1 on a \fIPUB\fR socket, all \fISUB\fR sockets connecting to it must also have the option set to 1\&. Failure to do so will have the \fISUB\fR sockets reject everything the \fIPUB\fR socket sends them\&. \fIXSUB\fR sockets do not need to do this because they do not filter incoming messages\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0,1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_PUB, ZMQ_XPUB, ZMQ_SUB +T} +.TE +.sp 1 +.SS "ZMQ_IPV6: Enable IPv6 on socket" +.sp +Set the IPv6 option for the socket\&. A value of 1 means IPv6 is enabled on the socket, while 0 means the socket will use only IPv4\&. When IPv6 is enabled the socket will connect to, or accept connections from, both IPv4 and IPv6 hosts\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +boolean +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (false) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_LINGER: Set linger period for socket shutdown" +.sp +The \fIZMQ_LINGER\fR option shall set the linger period for the specified \fIsocket\fR\&. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is disconnected with \fBzmq_disconnect\fR(3) or closed with \fBzmq_close\fR(3), and further affects the termination of the socket\(cqs context with \fBzmq_ctx_term\fR(3)\&. The following outlines the different behaviours: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +A value of +\fI\-1\fR +specifies an infinite linger period\&. Pending messages shall not be discarded after a call to +\fIzmq_disconnect()\fR +or +\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with +\fIzmq_ctx_term()\fR +shall block until all pending messages have been sent to a peer\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The value of +\fI0\fR +specifies no linger period\&. Pending messages shall be discarded immediately after a call to +\fIzmq_disconnect()\fR +or +\fIzmq_close()\fR\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Positive values specify an upper bound for the linger period in milliseconds\&. Pending messages shall not be discarded after a call to +\fIzmq_disconnect()\fR +or +\fIzmq_close()\fR; attempting to terminate the socket\(cqs context with +\fIzmq_ctx_term()\fR +shall block until either all pending messages have been sent to a peer, or the linger period expires, after which any pending messages shall be discarded\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +Option value type +T}:T{ +int +T} +T{ +Option value unit +T}:T{ +milliseconds +T} +T{ +Default value +T}:T{ +30000 (thirty seconds) +T} +T{ +Applicable socket types +T}:T{ +all +T} +.TE +.sp 1 +.RE +.SS "ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size" +.sp +Limits the size of the inbound message\&. If a peer sends a message larger than ZMQ_MAXMSGSIZE it is disconnected\&. Value of \-1 means \fIno limit\fR\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets" +.sp +Sets the time\-to\-live field in every multicast packet sent from this socket\&. The default is 1 which means that the multicast packets don\(cqt leave the local network\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +network hops +T} +T{ +.sp +Default value +T}:T{ +.sp +1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using multicast transports +T} +.TE +.sp 1 +.SS "ZMQ_MULTICAST_MAXTPDU: Maximum transport data unit size for multicast packets" +.sp +Sets the maximum transport data unit size used for outbound multicast packets\&. +.sp +This must be set at or below the minimum Maximum Transmission Unit (MTU) for all network paths over which multicast reception is required\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +1500 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using multicast transports +T} +.TE +.sp 1 +.SS "ZMQ_PLAIN_PASSWORD: Set PLAIN security password" +.sp +Sets the password for outgoing connections over TCP or IPC\&. If you set this to a non\-null value, the security mechanism used for connections shall be PLAIN, see \fBzmq_plain\fR(7)\&. If you set this to a null value, the security mechanism used for connections shall be NULL, see \fBzmq_null\fR(3)\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +not set +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_PLAIN_SERVER: Set PLAIN server role" +.sp +Defines whether the socket will act as server for PLAIN security, see \fBzmq_plain\fR(7)\&. A value of \fI1\fR means the socket will act as PLAIN server\&. A value of \fI0\fR means the socket will not act as PLAIN server, and its security role then depends on other option settings\&. Setting this to \fI0\fR shall reset the socket security to NULL\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_PLAIN_USERNAME: Set PLAIN security username" +.sp +Sets the username for outgoing connections over TCP or IPC\&. If you set this to a non\-null value, the security mechanism used for connections shall be PLAIN, see \fBzmq_plain\fR(7)\&. If you set this to a null value, the security mechanism used for connections shall be NULL, see \fBzmq_null\fR(3)\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +not set +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_USE_FD: Set the pre\-allocated socket file descriptor" +.sp +When set to a positive integer value before zmq_bind is called on the socket, the socket shall use the corresponding file descriptor for connections over TCP or IPC instead of allocating a new file descriptor\&. Useful for writing systemd socket activated services\&. If set to \-1 (default), a new file descriptor will be allocated instead (default behaviour)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +if set after calling zmq_bind, this option shall have no effect\&. NOTE: the file descriptor passed through MUST have been ran through the "bind" and "listen" system calls beforehand\&. Also, socket option that would normally be passed through zmq_setsockopt like TCP buffers length, IP_TOS or SO_REUSEADDR MUST be set beforehand by the caller, as they must be set before the socket is bound\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +file descriptor +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all bound sockets, when using IPC or TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_PROBE_ROUTER: bootstrap connections to ROUTER sockets" +.sp +When set to 1, the socket will automatically send an empty message when a new connection is made or accepted\&. You may set this on REQ, DEALER, or ROUTER sockets connected to a ROUTER socket\&. The application must filter such empty messages\&. The ZMQ_PROBE_ROUTER option in effect provides the ROUTER application with an event signaling the arrival of a new peer\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +do not set this option on a socket that talks to any other socket types: the results are undefined\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_ROUTER, ZMQ_DEALER, ZMQ_REQ +T} +.TE +.sp 1 +.SS "ZMQ_RATE: Set multicast data rate" +.sp +The \fIZMQ_RATE\fR option shall set the maximum send or receive data rate for multicast transports such as \fBzmq_pgm\fR(7) using the specified \fIsocket\fR\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +kilobits per second +T} +T{ +.sp +Default value +T}:T{ +.sp +100 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using multicast transports +T} +.TE +.sp 1 +.SS "ZMQ_RCVBUF: Set kernel receive buffer size" +.sp +The \fIZMQ_RCVBUF\fR option shall set the underlying kernel receive buffer size for the \fIsocket\fR to the specified size in bytes\&. A value of \-1 means leave the OS default unchanged\&. For details refer to your operating system documentation for the \fISO_RCVBUF\fR socket option\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_RCVHWM: Set high water mark for inbound messages" +.sp +The \fIZMQ_RCVHWM\fR option shall set the high water mark for inbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. +.sp +If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +messages +T} +T{ +.sp +Default value +T}:T{ +.sp +1000 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN" +.sp +Sets the timeout for receive operation on the socket\&. If the value is 0, \fIzmq_recv(3)\fR will return immediately, with a EAGAIN error if there is no message to receive\&. If the value is \-1, it will block until a message is available\&. For all other values, it will wait for a message for that amount of time before returning with an EAGAIN error\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (infinite) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_RECONNECT_IVL: Set reconnection interval" +.sp +The \fIZMQ_RECONNECT_IVL\fR option shall set the initial reconnection interval for the specified \fIsocket\fR\&. The reconnection interval is the period 0MQ shall wait between attempts to reconnect disconnected peers when using connection\-oriented transports\&. The value \-1 means no reconnection\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +The reconnection interval may be randomized by 0MQ to prevent reconnection storms in topologies with a large number of peers per socket\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +100 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, only for connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval" +.sp +The \fIZMQ_RECONNECT_IVL_MAX\fR option shall set the maximum reconnection interval for the specified \fIsocket\fR\&. This is the maximum period 0MQ shall wait between attempts to reconnect\&. On each reconnect attempt, the previous interval shall be doubled untill ZMQ_RECONNECT_IVL_MAX is reached\&. This allows for exponential backoff strategy\&. Default value means no exponential backoff is performed and reconnect interval calculations are only based on ZMQ_RECONNECT_IVL\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +Values less than ZMQ_RECONNECT_IVL will be ignored\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (only use ZMQ_RECONNECT_IVL) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, only for connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_RECOVERY_IVL: Set multicast recovery interval" +.sp +The \fIZMQ_RECOVERY_IVL\fR option shall set the recovery interval for multicast transports using the specified \fIsocket\fR\&. The recovery interval determines the maximum time in milliseconds that a receiver can be absent from a multicast group before unrecoverable data loss will occur\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +Exercise care when setting large recovery intervals as the data needed for recovery will be held in memory\&. For example, a 1 minute recovery interval at a data rate of 1Gbps requires a 7GB in\-memory buffer\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +10000 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using multicast transports +T} +.TE +.sp 1 +.SS "ZMQ_REQ_CORRELATE: match replies with requests" +.sp +The default behaviour of REQ sockets is to rely on the ordering of messages to match requests and responses and that is usually sufficient\&. When this option is set to 1, the REQ socket will prefix outgoing messages with an extra frame containing a request id\&. That means the full message is (request id, 0, user frames\&...)\&. The REQ socket will discard all incoming messages that don\(cqt begin with these two frames\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_REQ +T} +.TE +.sp 1 +.SS "ZMQ_REQ_RELAXED: relax strict alternation between request and reply" +.sp +By default, a REQ socket does not allow initiating a new request with \fIzmq_send(3)\fR until the reply to the previous one has been received\&. When set to 1, sending another message is allowed and previous replies will be discarded if any\&. The request\-reply state machine is reset and a new request is sent to the next available peer\&. +.sp +If set to 1, also enable ZMQ_REQ_CORRELATE to ensure correct matching of requests and replies\&. Otherwise a late reply to an aborted request can be reported as the reply to the superseding request\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_REQ +T} +.TE +.sp 1 +.SS "ZMQ_ROUTER_HANDOVER: handle duplicate client identities on ROUTER sockets" +.sp +If two clients use the same identity when connecting to a ROUTER, the results shall depend on the ZMQ_ROUTER_HANDOVER option setting\&. If that is not set (or set to the default of zero), the ROUTER socket shall reject clients trying to connect with an already\-used identity\&. If that option is set to 1, the ROUTER socket shall hand\-over the connection to the new client and disconnect the existing one\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_ROUTER +T} +.TE +.sp 1 +.SS "ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets" +.sp +Sets the ROUTER socket behaviour when an unroutable message is encountered\&. A value of 0 is the default and discards the message silently when it cannot be routed or the peers SNDHWM is reached\&. A value of 1 returns an \fIEHOSTUNREACH\fR error code if the message cannot be routed or \fIEAGAIN\fR error code if the SNDHWM is reached and ZMQ_DONTWAIT was used\&. Without ZMQ_DONTWAIT it will block until the SNDTIMEO is reached or a spot in the send queue opens up\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_ROUTER +T} +.TE +.sp 1 +.SS "ZMQ_ROUTER_RAW: switch ROUTER socket to raw mode" +.sp +Sets the raw mode on the ROUTER, when set to 1\&. When the ROUTER socket is in raw mode, and when using the tcp:// transport, it will read and write TCP data without 0MQ framing\&. This lets 0MQ applications talk to non\-0MQ applications\&. When using raw mode, you cannot set explicit identities, and the ZMQ_SNDMORE flag is ignored when sending data messages\&. In raw mode you can close a specific connection by sending it a zero\-length message (following the identity frame)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +This option is deprecated, please use ZMQ_STREAM sockets instead\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_ROUTER +T} +.TE +.sp 1 +.SS "ZMQ_SNDBUF: Set kernel transmit buffer size" +.sp +The \fIZMQ_SNDBUF\fR option shall set the underlying kernel transmit buffer size for the \fIsocket\fR to the specified size in bytes\&. A value of \-1 means leave the OS default unchanged\&. For details please refer to your operating system documentation for the \fISO_SNDBUF\fR socket option\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_SNDHWM: Set high water mark for outbound messages" +.sp +The \fIZMQ_SNDHWM\fR option shall set the high water mark for outbound messages on the specified \fIsocket\fR\&. The high water mark is a hard limit on the maximum number of outstanding messages 0MQ shall queue in memory for any single peer that the specified \fIsocket\fR is communicating with\&. A value of zero means no limit\&. +.sp +If this limit has been reached the socket shall enter an exceptional state and depending on the socket type, 0MQ shall take appropriate action such as blocking or dropping sent messages\&. Refer to the individual socket descriptions in \fBzmq_socket\fR(3) for details on the exact action taken for each socket type\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +0MQ does not guarantee that the socket will accept as many as ZMQ_SNDHWM messages, and the actual limit may be as much as 60\-70% lower depending on the flow of messages on the socket\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +messages +T} +T{ +.sp +Default value +T}:T{ +.sp +1000 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN" +.sp +Sets the timeout for send operation on the socket\&. If the value is 0, \fIzmq_send(3)\fR will return immediately, with a EAGAIN error if the message cannot be sent\&. If the value is \-1, it will block until the message is sent\&. For all other values, it will try to send the message for that amount of time before returning with an EAGAIN error\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (infinite) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all +T} +.TE +.sp 1 +.SS "ZMQ_SOCKS_PROXY: Set SOCKS5 proxy address" +.sp +Sets the SOCKS5 proxy address that shall be used by the socket for the TCP connection(s)\&. Does not support SOCKS5 authentication\&. If the endpoints are domain names instead of addresses they shall not be resolved and they shall be forwarded unchanged to the SOCKS proxy service in the client connection request message (address type 0x03 domain name)\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +not set +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_STREAM_NOTIFY: send connect and disconnect notifications" +.sp +Enables connect and disconnect notifications on a STREAM socket, when set to 1\&. When notifications are enabled, the socket delivers a zero\-length message when a peer connects or disconnects\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_STREAM +T} +.TE +.sp 1 +.SS "ZMQ_SUBSCRIBE: Establish message filter" +.sp +The \fIZMQ_SUBSCRIBE\fR option shall establish a new message filter on a \fIZMQ_SUB\fR socket\&. Newly created \fIZMQ_SUB\fR sockets shall filter out all incoming messages, therefore you should call this option to establish an initial message filter\&. +.sp +An empty \fIoption_value\fR of length zero shall subscribe to all incoming messages\&. A non\-empty \fIoption_value\fR shall subscribe to all messages beginning with the specified prefix\&. Multiple filters may be attached to a single \fIZMQ_SUB\fR socket, in which case a message shall be accepted if it matches at least one filter\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +N/A +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_SUB +T} +.TE +.sp 1 +.SS "ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option" +.sp +Override \fISO_KEEPALIVE\fR socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +\-1,0,1 +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option" +.sp +Override \fITCP_KEEPCNT\fR socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +\-1,>0 +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPIDLE (or TCP_KEEPALIVE on some OS)" +.sp +Override \fITCP_KEEPIDLE\fR (or \fITCP_KEEPALIVE\fR on some OS) socket option (where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +\-1,>0 +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option" +.sp +Override \fITCP_KEEPINTVL\fR socket option(where supported by OS)\&. The default value of \-1 means to skip any overrides and leave it to OS default\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +\-1,>0 +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_TCP_MAXRT: Set TCP Maximum Retransmit Timeout" +.sp +On OSes where it is supported, sets how long before an unacknowledged TCP retransmit times out\&. The system normally attempts many TCP retransmits following an exponential backoff strategy\&. This means that after a network outage, it may take a long time before the session can be re\-established\&. Setting this option allows the timeout to happen at a shorter interval\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +0 (leave to OS default) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_TOS: Set the Type\-of\-Service on socket" +.sp +Sets the ToS fields (Differentiated services (DS) and Explicit Congestion Notification (ECN) field of the IP header\&. The ToS field is typically used to specify a packets priority\&. The availability of this option is dependent on intermediate network equipment that inspect the ToS field and provide a path for low\-delay, high\-throughput, highly\-reliable service, etc\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +>0 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, only for connection\-oriented transports +T} +.TE +.sp 1 +.SS "ZMQ_UNSUBSCRIBE: Remove message filter" +.sp +The \fIZMQ_UNSUBSCRIBE\fR option shall remove an existing message filter on a \fIZMQ_SUB\fR socket\&. The filter specified must match an existing filter previously established with the \fIZMQ_SUBSCRIBE\fR option\&. If the socket has several instances of the same filter attached the \fIZMQ_UNSUBSCRIBE\fR option shall remove only one instance, leaving the rest in place and functional\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +N/A +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_SUB +T} +.TE +.sp 1 +.SS "ZMQ_XPUB_VERBOSE: pass subscribe messages on XPUB socket" +.sp +Sets the \fIXPUB\fR socket behaviour on new subscriptions\&. If enabled, the socket passes all subscribe messages to the caller\&. If disabled, these are not visible to the caller\&. The default is 0 (disabled)\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_XPUB +T} +.TE +.sp 1 +.SS "ZMQ_XPUB_VERBOSER: pass subscribe and unsubscribe messages on XPUB socket" +.sp +Sets the \fIXPUB\fR socket behaviour on new subscriptions and ubsubscriptions\&. If enabled, the socket passes all subscribe and unsubscribe messages to the caller\&. If disabled, these are not visible to the caller\&. The default is 0 (disabled)\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_XPUB +T} +.TE +.sp 1 +.SS "ZMQ_XPUB_MANUAL: change the subscription handling to manual" +.sp +Sets the \fIXPUB\fR socket subscription handling mode manual/automatic\&. A value of \fI0\fR is the default and subscription requests will be handled automatically\&. A value of \fI1\fR will change the subscription requests handling to manual, with manual mode subscription requests are not added to the subscription list\&. To add subscription the user need to call setsockopt with ZMQ_SUBSCRIBE on XPUB socket\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_XPUB +T} +.TE +.sp 1 +.SS "ZMQ_XPUB_NODROP: do not silently drop messages if SENDHWM is reached" +.sp +Sets the \fIXPUB\fR socket behaviour to return error EAGAIN if SENDHWM is reached and the message could not be send\&. +.sp +A value of 0 is the default and drops the message silently when the peers SNDHWM is reached\&. A value of 1 returns an \fIEAGAIN\fR error code if the SNDHWM is reached and ZMQ_DONTWAIT was used\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +0, 1 +T} +T{ +.sp +Default value +T}:T{ +.sp +0 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_XPUB, ZMQ_PUB +T} +.TE +.sp 1 +.SS "ZMQ_XPUB_WELCOME_MSG: set welcome message that will be received by subscriber when connecting" +.sp +Sets a welcome message the will be recieved by subscriber when connecting\&. Subscriber must subscribe to the Welcome message before connecting\&. Welcome message will also be sent on reconnecting\&. For welcome message to work well user must poll on incoming subscription messages on the XPUB socket and handle them\&. +.sp +Use NULL and lenght of zero to disable welcome message\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +NULL +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +ZMQ_XPUB +T} +.TE +.sp 1 +.SS "ZMQ_ZAP_DOMAIN: Set RFC 27 authentication domain" +.sp +Sets the domain for ZAP (ZMQ RFC 27) authentication\&. For NULL security (the default on all tcp:// connections), ZAP authentication only happens if you set a non\-empty domain\&. For PLAIN and CURVE security, ZAP requests are always made, if there is a ZAP handler present\&. See \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:27\fR\m[] for more details\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +character string +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +not set +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transport +T} +.TE +.sp 1 +.SS "ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections" +.sp +Assign an arbitrary number of filters that will be applied for each new TCP transport connection on a listening socket\&. If no filters are applied, then the TCP transport allows connections from any IP address\&. If at least one filter is applied then new connection source ip should be matched\&. To clear all filters call zmq_setsockopt(socket, ZMQ_TCP_ACCEPT_FILTER, NULL, 0)\&. Filter is a null\-terminated string with ipv6 or ipv4 CIDR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +This option is deprecated, please use authentication via the ZAP API and IP address whitelisting / blacklisting\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +binary data +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +no filters (allow from all) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all listening sockets, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_IPC_FILTER_GID: Assign group ID filters to allow new IPC connections" +.sp +Assign an arbitrary number of filters that will be applied for each new IPC transport connection on a listening socket\&. If no IPC filters are applied, then the IPC transport allows connections from any process\&. If at least one UID, GID, or PID filter is applied then new connection credentials should be matched\&. To clear all GID filters call zmq_setsockopt(socket, ZMQ_IPC_FILTER_GID, NULL, 0)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +GID filters are only available on platforms supporting SO_PEERCRED or LOCAL_PEERCRED socket options (currently only Linux and later versions of OS X)\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +This option is deprecated, please use authentication via the ZAP API and IPC whitelisting / blacklisting\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +gid_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +no filters (allow from all) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all listening sockets, when using IPC transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_IPC_FILTER_PID: Assign process ID filters to allow new IPC connections" +.sp +Assign an arbitrary number of filters that will be applied for each new IPC transport connection on a listening socket\&. If no IPC filters are applied, then the IPC transport allows connections from any process\&. If at least one UID, GID, or PID filter is applied then new connection credentials should be matched\&. To clear all PID filters call zmq_setsockopt(socket, ZMQ_IPC_FILTER_PID, NULL, 0)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +PID filters are only available on platforms supporting the SO_PEERCRED socket option (currently only Linux)\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +This option is deprecated, please use authentication via the ZAP API and IPC whitelisting / blacklisting\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +pid_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +no filters (allow from all) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all listening sockets, when using IPC transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_IPC_FILTER_UID: Assign user ID filters to allow new IPC connections" +.sp +Assign an arbitrary number of filters that will be applied for each new IPC transport connection on a listening socket\&. If no IPC filters are applied, then the IPC transport allows connections from any process\&. If at least one UID, GID, or PID filter is applied then new connection credentials should be matched\&. To clear all UID filters call zmq_setsockopt(socket, ZMQ_IPC_FILTER_UID, NULL, 0)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +UID filters are only available on platforms supporting SO_PEERCRED or LOCAL_PEERCRED socket options (currently only Linux and later versions of OS X)\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +This option is deprecated, please use authentication via the ZAP API and IPC whitelisting / blacklisting\&. +.sp .5v +.RE +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +uid_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +N/A +T} +T{ +.sp +Default value +T}:T{ +.sp +no filters (allow from all) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all listening sockets, when using IPC transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_IPV4ONLY: Use IPv4\-only on socket" +.sp +Set the IPv4\-only option for the socket\&. This option is deprecated\&. Please use the ZMQ_IPV6 option\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +boolean +T} +T{ +.sp +Default value +T}:T{ +.sp +1 (true) +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using TCP transports\&. +T} +.TE +.sp 1 +.SS "ZMQ_VMCI_BUFFER_SIZE: Set buffer size of the VMCI socket" +.sp +The ZMQ_VMCI_BUFFER_SIZE option shall set the size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +uint64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +65546 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using VMCI transport +T} +.TE +.sp 1 +.SS "ZMQ_VMCI_BUFFER_MIN_SIZE: Set min buffer size of the VMCI socket" +.sp +The ZMQ_VMCI_BUFFER_MIN_SIZE option shall set the min size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +uint64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +128 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using VMCI transport +T} +.TE +.sp 1 +.SS "ZMQ_VMCI_BUFFER_MAX_SIZE: Set max buffer size of the VMCI socket" +.sp +The ZMQ_VMCI_BUFFER_MAX_SIZE option shall set the max size of the underlying buffer for the socket\&. Used during negotiation before the connection is established\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +uint64_t +T} +T{ +.sp +Option value unit +T}:T{ +.sp +bytes +T} +T{ +.sp +Default value +T}:T{ +.sp +262144 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using VMCI transport +T} +.TE +.sp 1 +.SS "ZMQ_VMCI_CONNECT_TIMEOUT: Set connection timeout of the VMCI socket" +.sp +The ZMQ_VMCI_CONNECT_TIMEOUT option shall set connection timeout for the socket\&. +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Option value type +T}:T{ +.sp +int +T} +T{ +.sp +Option value unit +T}:T{ +.sp +milliseconds +T} +T{ +.sp +Default value +T}:T{ +.sp +\-1 +T} +T{ +.sp +Applicable socket types +T}:T{ +.sp +all, when using VMCI transport +T} +.TE +.sp 1 +.SH "RETURN VALUE" +.sp +The \fIzmq_setsockopt()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The requested option +\fIoption_name\fR +is unknown, or the requested +\fIoption_len\fR +or +\fIoption_value\fR +is invalid\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBEINTR\fR +.RS 4 +The operation was interrupted by delivery of a signal\&. +.RE +.SH "EXAMPLE" +.PP +\fBSubscribing to messages on a ZMQ_SUB socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Subscribe to all messages */ +rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "", 0); +assert (rc == 0); +/* Subscribe to messages prefixed with "ANIMALS\&.CATS" */ +rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "ANIMALS\&.CATS", 12); +.fi +.if n \{\ +.RE +.\} +.PP +\fBSetting I/O thread affinity\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +int64_t affinity; +/* Incoming connections on TCP port 5555 shall be handled by I/O thread 1 */ +affinity = 1; +rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof (affinity)); +assert (rc); +rc = zmq_bind (socket, "tcp://lo:5555"); +assert (rc); +/* Incoming connections on TCP port 5556 shall be handled by I/O thread 2 */ +affinity = 2; +rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof (affinity)); +assert (rc); +rc = zmq_bind (socket, "tcp://lo:5556"); +assert (rc); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(3) \fBzmq_plain\fR(7) \fBzmq_curve\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket.3 new file mode 100644 index 00000000000000..eaf039a03f9533 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket.3 @@ -0,0 +1,1403 @@ +'\" t +.\" Title: zmq_socket +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_SOCKET" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_socket \- create 0MQ socket +.SH "SYNOPSIS" +.sp +\fBvoid *zmq_socket (void \fR\fB\fI*context\fR\fR\fB, int \fR\fB\fItype\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_socket()\fR function shall create a 0MQ socket within the specified \fIcontext\fR and return an opaque handle to the newly created socket\&. The \fItype\fR argument specifies the socket type, which determines the semantics of communication over the socket\&. +.sp +The newly created socket is initially unbound, and not associated with any endpoints\&. In order to establish a message flow a socket must first be connected to at least one endpoint with \fBzmq_connect\fR(3), or at least one endpoint must be created for accepting incoming connections with \fBzmq_bind\fR(3)\&. +.PP +\fBKey differences to conventional sockets\fR. Generally speaking, conventional sockets present a +\fIsynchronous\fR +interface to either connection\-oriented reliable byte streams (SOCK_STREAM), or connection\-less unreliable datagrams (SOCK_DGRAM)\&. In comparison, 0MQ sockets present an abstraction of an asynchronous +\fImessage queue\fR, with the exact queueing semantics depending on the socket type in use\&. Where conventional sockets transfer streams of bytes or discrete datagrams, 0MQ sockets transfer discrete +\fImessages\fR\&. +.sp +0MQ sockets being \fIasynchronous\fR means that the timings of the physical connection setup and tear down, reconnect and effective delivery are transparent to the user and organized by 0MQ itself\&. Further, messages may be \fIqueued\fR in the event that a peer is unavailable to receive them\&. +.sp +Conventional sockets allow only strict one\-to\-one (two peers), many\-to\-one (many clients, one server), or in some cases one\-to\-many (multicast) relationships\&. With the exception of \fIZMQ_PAIR\fR, 0MQ sockets may be connected \fBto multiple endpoints\fR using \fIzmq_connect()\fR, while simultaneously accepting incoming connections \fBfrom multiple endpoints\fR bound to the socket using \fIzmq_bind()\fR, thus allowing many\-to\-many relationships\&. +.PP +\fBThread safety\fR. 0MQ has both thread safe socket type and +\fInot\fR +thread safe socket types\&. Applications MUST NOT use a +\fInot\fR +thread safe socket from multiple threads except after migrating a socket from one thread to another with a "full fence" memory barrier\&. +.sp +Following are the thread safe sockets: * ZMQ_CLIENT * ZMQ_SERVER * ZMQ_DISH * ZMQ_RADIO * ZMQ_SCATTER * ZMQ_GATHER +.PP +\fBSocket types\fR. The following sections present the socket types defined by 0MQ, grouped by the general +\fImessaging pattern\fR +which is built from related socket types\&. +.SS "Client\-server pattern" +.sp +The client\-server pattern is used to allow a single \fIZMQ_SERVER\fR \fIserver\fR talk to one or more \fIZMQ_CLIENT\fR \fIclients\fR\&. The client always starts the conversation, after which either peer can send messages asynchronously, to the other\&. +.sp +The client\-server pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:41\fR\m[]\&. +.sp +Note: this pattern is meant to eventually deprecate the use of \fIZMQ_DEALER\fR and \fIZMQ_ROUTER\fR to build client\-server architectures, as well as \fIZMQ_REP\fR and \fIZMQ_REQ\fR for request\-reply\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_CLIENT\fR +.RS 4 +.sp +A \fIZMQ_CLIENT\fR socket talks to a \fIZMQ_SERVER\fR socket\&. Either peer can connect, though the usual and recommended model is to bind the \fIZMQ_SERVER\fR and connect the \fIZMQ_CLIENT\fR\&. +.sp +If the \fIZMQ_CLIENT\fR socket has established a connection, \fBzmq_send\fR(3) will accept messages, queue them, and send them as rapidly as the network allows\&. The outgoing buffer limit is defined by the high water mark for the socket\&. If the outgoing buffer is full, or if there is no connected peer, \fBzmq_send\fR(3) will block, by default\&. The \fIZMQ_CLIENT\fR socket will not drop messages\&. +.sp +When a \fIZMQ_CLIENT\fR socket is connected to multiple \fIZMQ_SERVER\fR sockets, outgoing messages are distributed between connected peers on a round\-robin basis\&. Likewise, the \fIZMQ_CLIENT\fR socket receives messages fairly from each connected peer\&. This usage is sensible only for stateless protocols\&. +.sp +\fIZMQ_CLIENT\fR sockets are threadsafe and can be used from multiple threads at the same time\&. Note that replies from a \fIZMQ_SERVER\fR socket will go to the first client thread that calls libzmq:zmq_msg_recv\&. If you need to get replies back to the originating thread, use one \fIZMQ_CLIENT\fR socket per thread\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +\fIZMQ_CLIENT\fR sockets are threadsafe\&. They do not accept the ZMQ_SNDMORE option on sends not ZMQ_RCVMORE on receives\&. This limits them to single part data\&. The intention is to extend the API to allow scatter/gather of multi\-part data\&. +.sp .5v +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&1.\ \&Summary of ZMQ_CLIENT characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_SERVER\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Bidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Unrestricted +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +Round\-robin +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Block +T} +.TE +.sp 1 +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_SERVER\fR +.RS 4 +.sp +A \fIZMQ_SERVER\fR socket talks to a set of \fIZMQ_CLIENT\fR sockets\&. A \fIZMQ_SERVER\fR socket can only reply to an incoming message: the \fIZMQ_CLIENT\fR peer must always initiate a conversation\&. +.sp +Each received message has a \fIrouting_id\fR that is a 32\-bit unsigned integer\&. The application can fetch this with \fBzmq_msg_routing_id\fR(3)\&. To send a message to a given \fIZMQ_CLIENT\fR peer the application must set the peer\(cqs \fIrouting_id\fR on the message, using \fBzmq_msg_set_routing_id\fR(3)\&. +.sp +If the \fIrouting_id\fR is not specified, or does not refer to a connected client peer, the send call will fail with EHOSTUNREACH\&. If the outgoing buffer for the client peer is full, the send call shall block, unless ZMQ_DONT_WAIT is used in the send, in which case it shall fail with EAGAIN\&. The \fIZMQ_SERVER\fR socket shall not drop messages in any case\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +\fIZMQ_SERVER\fR sockets are threadsafe\&. They do not accept the ZMQ_SNDMORE option on sends not ZMQ_RCVMORE on receives\&. This limits them to single part data\&. The intention is to extend the API to allow scatter/gather of multi\-part data\&. +.sp .5v +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&2.\ \&Summary of ZMQ_SERVER characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_CLIENT\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Bidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Unrestricted +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +See text +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Return EAGAIN +T} +.TE +.sp 1 +.RE +.SS "Radio\-dish pattern" +.sp +The radio\-dish pattern is used for one\-to\-many distribution of data from a single \fIpublisher\fR to multiple \fIsubscribers\fR in a fan out fashion\&. +.sp +Radio\-dish is using groups (vs Pub\-sub topics), Dish sockets can join a group and each message sent by Radio sockets belong to a group\&. +.sp +Groups are null terminated strings limited to 16 chars length (including null)\&. The intention is to increase the length to 40 chars (including null)\&. +.sp +Groups are matched using exact matching (vs prefix matching of PubSub)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +Radio\-dish is still in draft phase\&. +.sp .5v +.RE +.sp +Note: this pattern is meant to eventually deprecate the use of \fIZMQ_PUB\fR and \fIZMQ_SUB\fR to build pub\-sub architectures\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_RADIO\fR +.RS 4 +.sp +A socket of type \fIZMQ_RADIO\fR is used by a \fIpublisher\fR to distribute data\&. Each message belong to a group, a group is specified with linkzmq_zmq_msg_set_group[3]\&. Messages are distributed to all members of a group\&. The \fBzmq_recv\fR(3) function is not implemented for this socket type\&. +.sp +When a \fIZMQ_RADIO\fR socket enters the \fImute\fR state due to having reached the high water mark for a \fIsubscriber\fR, then any messages that would be sent to the \fIsubscriber\fR in question shall instead be dropped until the mute state ends\&. The \fIzmq_send()\fR function shall never block for this socket type\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +\fIZMQ_RADIO\fR sockets are threadsafe\&. They do not accept the ZMQ_SNDMORE option on sends\&. This limits them to single part data\&. +.sp .5v +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&3.\ \&Summary of ZMQ_RADIO characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_DISH\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Unidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Send only +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +N/A +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +Fan out +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Drop +T} +.TE +.sp 1 +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_DISH\fR +.RS 4 +.sp +A socket of type \fIZMQ_DISH\fR is used by a \fIsubscriber\fR to subscribe to groups distributed by a \fIradio\fR\&. Initially a \fIZMQ_DISH\fR socket is not subscribed to any groups, use \fBzmq_join\fR(3) to join a group\&. To get the group the message belong to call \fBzmq_msg_group\fR(3)\&. The \fIzmq_send()\fR function is not implemented for this socket type\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +\fIZMQ_DISH\fR sockets are threadsafe\&. They do not accept ZMQ_RCVMORE on receives\&. This limits them to single part data\&. +.sp .5v +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&4.\ \&Summary of ZMQ_DISH characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_RADIO\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Unidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Receive only +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +N/A +T} +.TE +.sp 1 +.RE +.SS "Publish\-subscribe pattern" +.sp +The publish\-subscribe pattern is used for one\-to\-many distribution of data from a single \fIpublisher\fR to multiple \fIsubscribers\fR in a fan out fashion\&. +.sp +The publish\-subscribe pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:29\fR\m[]\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_PUB\fR +.RS 4 +.sp +A socket of type \fIZMQ_PUB\fR is used by a \fIpublisher\fR to distribute data\&. Messages sent are distributed in a fan out fashion to all connected peers\&. The \fBzmq_recv\fR(3) function is not implemented for this socket type\&. +.sp +When a \fIZMQ_PUB\fR socket enters the \fImute\fR state due to having reached the high water mark for a \fIsubscriber\fR, then any messages that would be sent to the \fIsubscriber\fR in question shall instead be dropped until the mute state ends\&. The \fIzmq_send()\fR function shall never block for this socket type\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&5.\ \&Summary of ZMQ_PUB characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_SUB\fR, \fIZMQ_XSUB\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Unidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Send only +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +N/A +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +Fan out +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Drop +T} +.TE +.sp 1 +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_SUB\fR +.RS 4 +.sp +A socket of type \fIZMQ_SUB\fR is used by a \fIsubscriber\fR to subscribe to data distributed by a \fIpublisher\fR\&. Initially a \fIZMQ_SUB\fR socket is not subscribed to any messages, use the \fIZMQ_SUBSCRIBE\fR option of \fBzmq_setsockopt\fR(3) to specify which messages to subscribe to\&. The \fIzmq_send()\fR function is not implemented for this socket type\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&6.\ \&Summary of ZMQ_SUB characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_PUB\fR, \fIZMQ_XPUB\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Unidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Receive only +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +N/A +T} +.TE +.sp 1 +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_XPUB\fR +.RS 4 +.sp +Same as ZMQ_PUB except that you can receive subscriptions from the peers in form of incoming messages\&. Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body\&. Messages without a sub/unsub prefix are also received, but have no effect on subscription status\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&7.\ \&Summary of ZMQ_XPUB characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_SUB\fR, \fIZMQ_XSUB\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Unidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Send messages, receive subscriptions +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +N/A +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +Fan out +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Drop +T} +.TE +.sp 1 +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_XSUB\fR +.RS 4 +.sp +Same as ZMQ_SUB except that you subscribe by sending subscription messages to the socket\&. Subscription message is a byte 1 (for subscriptions) or byte 0 (for unsubscriptions) followed by the subscription body\&. Messages without a sub/unsub prefix may also be sent, but have no effect on subscription status\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&8.\ \&Summary of ZMQ_XSUB characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_PUB\fR, \fIZMQ_XPUB\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Unidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Receive messages, send subscriptions +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +N/A +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Drop +T} +.TE +.sp 1 +.RE +.SS "Pipeline pattern" +.sp +The pipeline pattern is used for distributing data to \fInodes\fR arranged in a pipeline\&. Data always flows down the pipeline, and each stage of the pipeline is connected to at least one \fInode\fR\&. When a pipeline stage is connected to multiple \fInodes\fR data is round\-robined among all connected \fInodes\fR\&. +.sp +The pipeline pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:30\fR\m[]\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_PUSH\fR +.RS 4 +.sp +A socket of type \fIZMQ_PUSH\fR is used by a pipeline \fInode\fR to send messages to downstream pipeline \fInodes\fR\&. Messages are round\-robined to all connected downstream \fInodes\fR\&. The \fIzmq_recv()\fR function is not implemented for this socket type\&. +.sp +When a \fIZMQ_PUSH\fR socket enters the \fImute\fR state due to having reached the high water mark for all downstream \fInodes\fR, or if there are no downstream \fInodes\fR at all, then any \fBzmq_send\fR(3) operations on the socket shall block until the mute state ends or at least one downstream \fInode\fR becomes available for sending; messages are not discarded\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&9.\ \&Summary of ZMQ_PUSH characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_PULL\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Unidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Send only +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +N/A +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +Round\-robin +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Block +T} +.TE +.sp 1 +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_PULL\fR +.RS 4 +.sp +A socket of type \fIZMQ_PULL\fR is used by a pipeline \fInode\fR to receive messages from upstream pipeline \fInodes\fR\&. Messages are fair\-queued from among all connected upstream \fInodes\fR\&. The \fIzmq_send()\fR function is not implemented for this socket type\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&10.\ \&Summary of ZMQ_PULL characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_PUSH\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Unidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Receive only +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +N/A +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Block +T} +.TE +.sp 1 +.RE +.SS "Exclusive pair pattern" +.sp +The exclusive pair pattern is used to connect a peer to precisely one other peer\&. This pattern is used for inter\-thread communication across the inproc transport\&. +.sp +The exclusive pair pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:31\fR\m[]\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_PAIR\fR +.RS 4 +.sp +A socket of type \fIZMQ_PAIR\fR can only be connected to a single peer at any one time\&. No message routing or filtering is performed on messages sent over a \fIZMQ_PAIR\fR socket\&. +.sp +When a \fIZMQ_PAIR\fR socket enters the \fImute\fR state due to having reached the high water mark for the connected peer, or if no peer is connected, then any \fBzmq_send\fR(3) operations on the socket shall block until the peer becomes available for sending; messages are not discarded\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +\fIZMQ_PAIR\fR sockets are designed for inter\-thread communication across the \fBzmq_inproc\fR(7) transport and do not implement functionality such as auto\-reconnection\&. +.sp .5v +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&11.\ \&Summary of ZMQ_PAIR characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_PAIR\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Bidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Unrestricted +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +N/A +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +N/A +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Block +T} +.TE +.sp 1 +.RE +.SS "Native Pattern" +.sp +The native pattern is used for communicating with TCP peers and allows asynchronous requests and replies in either direction\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_STREAM\fR +.RS 4 +.sp +A socket of type \fIZMQ_STREAM\fR is used to send and receive TCP data from a non\-0MQ peer, when using the tcp:// transport\&. A \fIZMQ_STREAM\fR socket can act as client and/or server, sending and/or receiving TCP data asynchronously\&. +.sp +When receiving TCP data, a \fIZMQ_STREAM\fR socket shall prepend a message part containing the \fIidentity\fR of the originating peer to the message before passing it to the application\&. Messages received are fair\-queued from among all connected peers\&. +.sp +When sending TCP data, a \fIZMQ_STREAM\fR socket shall remove the first part of the message and use it to determine the \fIidentity\fR of the peer the message shall be routed to, and unroutable messages shall cause an EHOSTUNREACH or EAGAIN error\&. +.sp +To open a connection to a server, use the zmq_connect call, and then fetch the socket identity using the ZMQ_IDENTITY zmq_getsockopt call\&. +.sp +To close a specific connection, send the identity frame followed by a zero\-length message (see EXAMPLE section)\&. +.sp +When a connection is made, a zero\-length message will be received by the application\&. Similarly, when the peer disconnects (or the connection is lost), a zero\-length message will be received by the application\&. +.sp +You must send one identity frame followed by one data frame\&. The ZMQ_SNDMORE flag is required for identity frames but is ignored on data frames\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&12.\ \&Summary of ZMQ_STREAM characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +none\&. +T} +T{ +.sp +Direction +T}:T{ +.sp +Bidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Unrestricted +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +See text +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +EAGAIN +T} +.TE +.sp 1 +.RE +.SS "Request\-reply pattern" +.sp +The request\-reply pattern is used for sending requests from a ZMQ_REQ \fIclient\fR to one or more ZMQ_REP \fIservices\fR, and receiving subsequent replies to each request sent\&. +.sp +The request\-reply pattern is formally defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:28\fR\m[]\&. +.sp +Note: this pattern will be deprecated in favor of the client\-server pattern\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_REQ\fR +.RS 4 +.sp +A socket of type \fIZMQ_REQ\fR is used by a \fIclient\fR to send requests to and receive replies from a \fIservice\fR\&. This socket type allows only an alternating sequence of \fIzmq_send(request)\fR and subsequent \fIzmq_recv(reply)\fR calls\&. Each request sent is round\-robined among all \fIservices\fR, and each reply received is matched with the last issued request\&. +.sp +If no services are available, then any send operation on the socket shall block until at least one \fIservice\fR becomes available\&. The REQ socket shall not discard messages\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&13.\ \&Summary of ZMQ_REQ characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_REP\fR, \fIZMQ_ROUTER\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Bidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Send, Receive, Send, Receive, \&... +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +Round\-robin +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Last peer +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Block +T} +.TE +.sp 1 +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_REP\fR +.RS 4 +.sp +A socket of type \fIZMQ_REP\fR is used by a \fIservice\fR to receive requests from and send replies to a \fIclient\fR\&. This socket type allows only an alternating sequence of \fIzmq_recv(request)\fR and subsequent \fIzmq_send(reply)\fR calls\&. Each request received is fair\-queued from among all \fIclients\fR, and each reply sent is routed to the \fIclient\fR that issued the last request\&. If the original requester does not exist any more the reply is silently discarded\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&14.\ \&Summary of ZMQ_REP characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_REQ\fR, \fIZMQ_DEALER\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Bidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Receive, Send, Receive, Send, \&... +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +Last peer +T} +.TE +.sp 1 +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_DEALER\fR +.RS 4 +.sp +A socket of type \fIZMQ_DEALER\fR is an advanced pattern used for extending request/reply sockets\&. Each message sent is round\-robined among all connected peers, and each message received is fair\-queued from all connected peers\&. +.sp +When a \fIZMQ_DEALER\fR socket enters the \fImute\fR state due to having reached the high water mark for all peers, or if there are no peers at all, then any \fBzmq_send\fR(3) operations on the socket shall block until the mute state ends or at least one peer becomes available for sending; messages are not discarded\&. +.sp +When a \fIZMQ_DEALER\fR socket is connected to a \fIZMQ_REP\fR socket each message sent must consist of an empty message part, the \fIdelimiter\fR, followed by one or more \fIbody parts\fR\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&15.\ \&Summary of ZMQ_DEALER characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_ROUTER\fR, \fIZMQ_REP\fR, \fIZMQ_DEALER\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Bidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Unrestricted +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +Round\-robin +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Block +T} +.TE +.sp 1 +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBZMQ_ROUTER\fR +.RS 4 +.sp +A socket of type \fIZMQ_ROUTER\fR is an advanced socket type used for extending request/reply sockets\&. When receiving messages a \fIZMQ_ROUTER\fR socket shall prepend a message part containing the \fIidentity\fR of the originating peer to the message before passing it to the application\&. Messages received are fair\-queued from among all connected peers\&. When sending messages a \fIZMQ_ROUTER\fR socket shall remove the first part of the message and use it to determine the \fIidentity\fR of the peer the message shall be routed to\&. If the peer does not exist anymore the message shall be silently discarded by default, unless \fIZMQ_ROUTER_MANDATORY\fR socket option is set to \fI1\fR\&. +.sp +When a \fIZMQ_ROUTER\fR socket enters the \fImute\fR state due to having reached the high water mark for all peers, then any messages sent to the socket shall be dropped until the mute state ends\&. Likewise, any messages routed to a peer for which the individual high water mark has been reached shall also be dropped, unless \fIZMQ_ROUTER_MANDATORY\fR socket option is set\&. +.sp +When a \fIZMQ_REQ\fR socket is connected to a \fIZMQ_ROUTER\fR socket, in addition to the \fIidentity\fR of the originating peer each message received shall contain an empty \fIdelimiter\fR message part\&. Hence, the entire structure of each received message as seen by the application becomes: one or more \fIidentity\fR parts, \fIdelimiter\fR part, one or more \fIbody parts\fR\&. When sending replies to a \fIZMQ_REQ\fR socket the application must include the \fIdelimiter\fR part\&. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.B Table\ \&16.\ \&Summary of ZMQ_ROUTER characteristics +.TS +tab(:); +lt lt +lt lt +lt lt +lt lt +lt lt +lt lt. +T{ +.sp +Compatible peer sockets +T}:T{ +.sp +\fIZMQ_DEALER\fR, \fIZMQ_REQ\fR, \fIZMQ_ROUTER\fR +T} +T{ +.sp +Direction +T}:T{ +.sp +Bidirectional +T} +T{ +.sp +Send/receive pattern +T}:T{ +.sp +Unrestricted +T} +T{ +.sp +Outgoing routing strategy +T}:T{ +.sp +See text +T} +T{ +.sp +Incoming routing strategy +T}:T{ +.sp +Fair\-queued +T} +T{ +.sp +Action in mute state +T}:T{ +.sp +Drop (see text) +T} +.TE +.sp 1 +.RE +.SH "RETURN VALUE" +.sp +The \fIzmq_socket()\fR function shall return an opaque handle to the newly created socket if successful\&. Otherwise, it shall return NULL and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The requested socket +\fItype\fR +is invalid\&. +.RE +.PP +\fBEFAULT\fR +.RS 4 +The provided +\fIcontext\fR +is invalid\&. +.RE +.PP +\fBEMFILE\fR +.RS 4 +The limit on the total number of open 0MQ sockets has been reached\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The context specified was terminated\&. +.RE +.SH "EXAMPLE" +.PP +\fBCreating a simple HTTP server using ZMQ_STREAM\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *ctx = zmq_ctx_new (); +assert (ctx); +/* Create ZMQ_STREAM socket */ +void *socket = zmq_socket (ctx, ZMQ_STREAM); +assert (socket); +int rc = zmq_bind (socket, "tcp://*:8080"); +assert (rc == 0); +/* Data structure to hold the ZMQ_STREAM ID */ +uint8_t id [256]; +size_t id_size = 256; +/* Data structure to hold the ZMQ_STREAM received data */ +uint8_t raw [256]; +size_t raw_size = 256; +while (1) { + /* Get HTTP request; ID frame and then request */ + id_size = zmq_recv (socket, id, 256, 0); + assert (id_size > 0); + do { + raw_size = zmq_recv (socket, raw, 256, 0); + assert (raw_size >= 0); + } while (raw_size == 256); + /* Prepares the response */ + char http_response [] = + "HTTP/1\&.0 200 OK\er\en" + "Content\-Type: text/plain\er\en" + "\er\en" + "Hello, World!"; + /* Sends the ID frame followed by the response */ + zmq_send (socket, id, id_size, ZMQ_SNDMORE); + zmq_send (socket, http_response, strlen (http_response), 0); + /* Closes the connection by sending the ID frame followed by a zero response */ + zmq_send (socket, id, id_size, ZMQ_SNDMORE); + zmq_send (socket, 0, 0, 0); +} +zmq_close (socket); +zmq_ctx_destroy (ctx); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_init\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_send\fR(3) \fBzmq_recv\fR(3) \fBzmq_inproc\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket_monitor.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket_monitor.3 new file mode 100644 index 00000000000000..26664be708ad3e --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_socket_monitor.3 @@ -0,0 +1,241 @@ +'\" t +.\" Title: zmq_socket_monitor +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_SOCKET_MONITOR" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_socket_monitor \- monitor socket events +.SH "SYNOPSIS" +.sp +\fBint zmq_socket_monitor (void \fR\fB\fI*socket\fR\fR\fB, char \fR\fB\fI*endpoint\fR\fR\fB, int \fR\fB\fIevents\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_socket_monitor()\fR method lets an application thread track socket events (like connects) on a ZeroMQ socket\&. Each call to this method creates a \fIZMQ_PAIR\fR socket and binds that to the specified inproc:// \fIendpoint\fR\&. To collect the socket events, you must create your own \fIZMQ_PAIR\fR socket, and connect that to the endpoint\&. +.sp +The \fIevents\fR argument is a bitmask of the socket events you wish to monitor, see \fISupported events\fR below\&. To monitor all events, use the event value ZMQ_EVENT_ALL\&. NOTE: as new events are added, the catch\-all value will start returning them\&. An application that relies on a strict and fixed sequence of events must not use ZMQ_EVENT_ALL in order to guarantee compatibility with future versions\&. +.sp +Each event is sent as two frames\&. The first frame contains an event number (16 bits), and an event value (32 bits) that provides additional data according to the event number\&. The second frame contains a string that specifies the affected TCP or IPC endpoint\&. +.sp +.if n \{\ +.RS 4 +.\} +.nf +The _zmq_socket_monitor()_ method supports only connection\-oriented +transports, that is, TCP, IPC, and TIPC\&. +.fi +.if n \{\ +.RE +.\} +.SH "SUPPORTED EVENTS" +.SS "ZMQ_EVENT_CONNECTED" +.sp +The socket has successfully connected to a remote peer\&. The event value is the file descriptor (FD) of the underlying network socket\&. Warning: there is no guarantee that the FD is still valid by the time your code receives this event\&. +.SS "ZMQ_EVENT_CONNECT_DELAYED" +.sp +A connect request on the socket is pending\&. The event value is unspecified\&. +.SS "ZMQ_EVENT_CONNECT_RETRIED" +.sp +A connect request failed, and is now being retried\&. The event value is the reconnect interval in milliseconds\&. Note that the reconnect interval is recalculated at each retry\&. +.SS "ZMQ_EVENT_LISTENING" +.sp +The socket was successfully bound to a network interface\&. The event value is the FD of the underlying network socket\&. Warning: there is no guarantee that the FD is still valid by the time your code receives this event\&. +.SS "ZMQ_EVENT_BIND_FAILED" +.sp +The socket could not bind to a given interface\&. The event value is the errno generated by the system bind call\&. +.SS "ZMQ_EVENT_ACCEPTED" +.sp +The socket has accepted a connection from a remote peer\&. The event value is the FD of the underlying network socket\&. Warning: there is no guarantee that the FD is still valid by the time your code receives this event\&. +.SS "ZMQ_EVENT_ACCEPT_FAILED" +.sp +The socket has rejected a connection from a remote peer\&. The event value is the errno generated by the accept call\&. +.SS "ZMQ_EVENT_CLOSED" +.sp +The socket was closed\&. The event value is the FD of the (now closed) network socket\&. +.SS "ZMQ_EVENT_CLOSE_FAILED" +.sp +The socket close failed\&. The event value is the errno returned by the system call\&. Note that this event occurs only on IPC transports\&. +.SS "ZMQ_EVENT_DISCONNECTED" +.sp +The socket was disconnected unexpectedly\&. The event value is the FD of the underlying network socket\&. Warning: this socket will be closed\&. +.SS "ZMQ_EVENT_MONITOR_STOPPED" +.sp +Monitoring on this socket ended\&. +.SS "ZMQ_EVENT_HANDSHAKE_FAILED" +.sp +The ZMTP security mechanism handshake failed\&. The event value is unspecified\&. NOTE: in DRAFT state, not yet available in stable releases\&. +.SS "ZMQ_EVENT_HANDSHAKE_SUCCEED" +.sp +The ZMTP security mechanism handshake succeeded\&. The event value is unspecified\&. NOTE: in DRAFT state, not yet available in stable releases\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_socket_monitor()\fR function returns a value of 0 or greater if successful\&. Otherwise it returns \-1 and sets \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBEPROTONOSUPPORT\fR +.RS 4 +The requested +\fItransport\fR +protocol is not supported\&. Monitor sockets are required to use the inproc:// transport\&. +.RE +.PP +\fBEINVAL\fR +.RS 4 +The endpoint supplied is invalid\&. +.RE +.SH "EXAMPLE" +.PP +\fBMonitoring client and server sockets\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Read one event off the monitor socket; return value and address +// by reference, if not null, and event number by value\&. Returns \-1 +// in case of error\&. + +static int +get_monitor_event (void *monitor, int *value, char **address) +{ + // First frame in message contains event number and value + zmq_msg_t msg; + zmq_msg_init (&msg); + if (zmq_msg_recv (&msg, monitor, 0) == \-1) + return \-1; // Interrupted, presumably + assert (zmq_msg_more (&msg)); + + uint8_t *data = (uint8_t *) zmq_msg_data (&msg); + uint16_t event = *(uint16_t *) (data); + if (value) + *value = *(uint32_t *) (data + 2); + + // Second frame in message contains event address + zmq_msg_init (&msg); + if (zmq_msg_recv (&msg, monitor, 0) == \-1) + return \-1; // Interrupted, presumably + assert (!zmq_msg_more (&msg)); + + if (address) { + uint8_t *data = (uint8_t *) zmq_msg_data (&msg); + size_t size = zmq_msg_size (&msg); + *address = (char *) malloc (size + 1); + memcpy (*address, data, size); + (*address)[size] = 0; + } + return event; +} + +int main (void) +{ + void *ctx = zmq_ctx_new (); + assert (ctx); + + // We\*(Aqll monitor these two sockets + void *client = zmq_socket (ctx, ZMQ_DEALER); + assert (client); + void *server = zmq_socket (ctx, ZMQ_DEALER); + assert (server); + + // Socket monitoring only works over inproc:// + int rc = zmq_socket_monitor (client, "tcp://127\&.0\&.0\&.1:9999", 0); + assert (rc == \-1); + assert (zmq_errno () == EPROTONOSUPPORT); + + // Monitor all events on client and server sockets + rc = zmq_socket_monitor (client, "inproc://monitor\-client", ZMQ_EVENT_ALL); + assert (rc == 0); + rc = zmq_socket_monitor (server, "inproc://monitor\-server", ZMQ_EVENT_ALL); + assert (rc == 0); + + // Create two sockets for collecting monitor events + void *client_mon = zmq_socket (ctx, ZMQ_PAIR); + assert (client_mon); + void *server_mon = zmq_socket (ctx, ZMQ_PAIR); + assert (server_mon); + + // Connect these to the inproc endpoints so they\*(Aqll get events + rc = zmq_connect (client_mon, "inproc://monitor\-client"); + assert (rc == 0); + rc = zmq_connect (server_mon, "inproc://monitor\-server"); + assert (rc == 0); + + // Now do a basic ping test + rc = zmq_bind (server, "tcp://127\&.0\&.0\&.1:9998"); + assert (rc == 0); + rc = zmq_connect (client, "tcp://127\&.0\&.0\&.1:9998"); + assert (rc == 0); + bounce (client, server); + + // Close client and server + close_zero_linger (client); + close_zero_linger (server); + + // Now collect and check events from both sockets + int event = get_monitor_event (client_mon, NULL, NULL); + if (event == ZMQ_EVENT_CONNECT_DELAYED) + event = get_monitor_event (client_mon, NULL, NULL); + assert (event == ZMQ_EVENT_CONNECTED); + event = get_monitor_event (client_mon, NULL, NULL); + assert (event == ZMQ_EVENT_MONITOR_STOPPED); + + // This is the flow of server events + event = get_monitor_event (server_mon, NULL, NULL); + assert (event == ZMQ_EVENT_LISTENING); + event = get_monitor_event (server_mon, NULL, NULL); + assert (event == ZMQ_EVENT_ACCEPTED); + event = get_monitor_event (server_mon, NULL, NULL); + assert (event == ZMQ_EVENT_CLOSED); + event = get_monitor_event (server_mon, NULL, NULL); + assert (event == ZMQ_EVENT_MONITOR_STOPPED); + + // Close down the sockets + close_zero_linger (client_mon); + close_zero_linger (server_mon); + zmq_ctx_term (ctx); + + return 0 ; +} +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_strerror.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_strerror.3 new file mode 100644 index 00000000000000..f77803861e7def --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_strerror.3 @@ -0,0 +1,67 @@ +'\" t +.\" Title: zmq_strerror +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_STRERROR" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_strerror \- get 0MQ error message string +.SH "SYNOPSIS" +.sp +\fBconst char *zmq_strerror (int \fR\fB\fIerrnum\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_strerror()\fR function shall return a pointer to an error message string corresponding to the error number specified by the \fIerrnum\fR argument\&. As 0MQ defines additional error numbers over and above those defined by the operating system, applications should use \fIzmq_strerror()\fR in preference to the standard \fIstrerror()\fR function\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_strerror()\fR function shall return a pointer to an error message string\&. +.SH "ERRORS" +.sp +No errors are defined\&. +.SH "EXAMPLE" +.PP +\fBDisplaying an error message when a 0MQ context cannot be initialised\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +void *ctx = zmq_init (1, 1, 0); +if (!ctx) { + printf ("Error occurred during zmq_init(): %s\en", zmq_strerror (errno)); + abort (); +} +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_unbind.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_unbind.3 new file mode 100644 index 00000000000000..bef9c5002bb461 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_unbind.3 @@ -0,0 +1,125 @@ +'\" t +.\" Title: zmq_unbind +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_UNBIND" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_unbind \- Stop accepting connections on a socket +.SH "SYNOPSIS" +.sp +int zmq_unbind (void \fI*socket\fR, const char \fI*endpoint\fR); +.SH "DESCRIPTION" +.sp +The \fIzmq_unbind()\fR function shall unbind a socket specified by the \fIsocket\fR argument from the endpoint specified by the \fIendpoint\fR argument\&. +.sp +The \fIendpoint\fR argument is as described in \fBzmq_bind\fR(3) +.SS "Unbinding wild\-card address from a socket" +.sp +When wild\-card * \fIendpoint\fR (described in \fBzmq_tcp\fR(7), \fBzmq_ipc\fR(7) and \fBzmq_vmci\fR(7)) was used in \fIzmq_bind()\fR, the caller should use real \fIendpoint\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_unbind()\fR function shall return zero if successful\&. Otherwise it shall return \-1 and set \fIerrno\fR to one of the values defined below\&. +.SH "ERRORS" +.PP +\fBEINVAL\fR +.RS 4 +The endpoint supplied is invalid\&. +.RE +.PP +\fBETERM\fR +.RS 4 +The 0MQ +\fIcontext\fR +associated with the specified +\fIsocket\fR +was terminated\&. +.RE +.PP +\fBENOTSOCK\fR +.RS 4 +The provided +\fIsocket\fR +was invalid\&. +.RE +.PP +\fBENOENT\fR +.RS 4 +The endpoint supplied was not previously bound\&. +.RE +.SH "EXAMPLES" +.PP +\fBUnbind a subscriber socket from a TCP transport\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Create a ZMQ_SUB socket */ +void *socket = zmq_socket (context, ZMQ_SUB); +assert (socket); +/* Connect it to the host server001, port 5555 using a TCP transport */ +rc = zmq_bind (socket, "tcp://127\&.0\&.0\&.1:5555"); +assert (rc == 0); +/* Disconnect from the previously connected endpoint */ +rc = zmq_unbind (socket, "tcp://127\&.0\&.0\&.1:5555"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.PP +\fBUnbind wild-card * binded socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +/* Create a ZMQ_SUB socket */ +void *socket = zmq_socket (context, ZMQ_SUB); +assert (socket); +/* Bind it to the system\-assigned ephemeral port using a TCP transport */ +rc = zmq_bind (socket, "tcp://127\&.0\&.0\&.1:*"); +assert (rc == 0); +/* Obtain real endpoint */ +const size_t buf_size = 32; +char buf[buf_size]; +rc = zmq_getsockopt (socket, ZMQ_LAST_ENDPOINT, buf, (size_t *)&buf_size); +assert (rc == 0); +/* Unbind socket by real endpoint */ +rc = zmq_unbind (socket, buf); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_bind\fR(3) \fBzmq_socket\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_version.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_version.3 new file mode 100644 index 00000000000000..2b0316947e6d20 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_version.3 @@ -0,0 +1,67 @@ +'\" t +.\" Title: zmq_version +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_VERSION" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_version \- report 0MQ library version +.SH "SYNOPSIS" +.sp +\fBvoid zmq_version (int \fR\fB\fI*major\fR\fR\fB, int \fR\fB\fI*minor\fR\fR\fB, int \fR\fB\fI*patch\fR\fR\fB);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_version()\fR function shall fill in the integer variables pointed to by the \fImajor\fR, \fIminor\fR and \fIpatch\fR arguments with the major, minor and patch level components of the 0MQ library version\&. +.sp +This functionality is intended for applications or language bindings dynamically linking to the 0MQ library that wish to determine the actual version of the 0MQ library they are using\&. +.SH "RETURN VALUE" +.sp +There is no return value\&. +.SH "ERRORS" +.sp +No errors are defined\&. +.SH "EXAMPLE" +.PP +\fBPrinting out the version of the 0MQ library\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +int major, minor, patch; +zmq_version (&major, &minor, &patch); +printf ("Current 0MQ version is %d\&.%d\&.%d\en", major, minor, patch); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_decode.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_decode.3 new file mode 100644 index 00000000000000..a8c054b8f3e228 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_decode.3 @@ -0,0 +1,64 @@ +'\" t +.\" Title: zmq_z85_decode +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_Z85_DECODE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_z85_decode \- decode a binary key from Z85 printable text +.SH "SYNOPSIS" +.sp +\fBuint8_t *zmq_z85_decode (uint8_t *dest, const char *string);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_z85_decode()\fR function shall decode \fIstring\fR into \fIdest\fR\&. The length of \fIstring\fR shall be divisible by 5\&. \fIdest\fR must be large enough for the decoded value (0\&.8 x strlen (string))\&. +.sp +The encoding shall follow the ZMQ RFC 32 specification\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_z85_decode()\fR function shall return \fIdest\fR if successful, else it shall return NULL\&. +.SH "EXAMPLE" +.PP +\fBDecoding a CURVE key\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +const char decoded [] = "rq:rM>}U?@Lns47E1%kR\&.o@n%FcmmsL/@{H8]yf7"; +uint8_t public_key [32]; +zmq_z85_decode (public_key, decoded); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_z85_decode\fR(3) \fBzmq_curve_keypair\fR(3) \fBzmq_curve_public\fR(3) \fBzmq_curve\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_encode.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_encode.3 new file mode 100644 index 00000000000000..442f6bb827833a --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmq_z85_encode.3 @@ -0,0 +1,69 @@ +'\" t +.\" Title: zmq_z85_encode +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_Z85_ENCODE" "3" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_z85_encode \- encode a binary key as Z85 printable text +.SH "SYNOPSIS" +.sp +\fBchar *zmq_z85_encode (char *dest, const uint8_t *data, size_t size);\fR +.SH "DESCRIPTION" +.sp +The \fIzmq_z85_encode()\fR function shall encode the binary block specified by \fIdata\fR and \fIsize\fR into a string in \fIdest\fR\&. The size of the binary block must be divisible by 4\&. The \fIdest\fR must have sufficient space for size * 1\&.25 plus 1 for a null terminator\&. A 32\-byte CURVE key is encoded as 40 ASCII characters plus a null terminator\&. +.sp +The encoding shall follow the ZMQ RFC 32 specification\&. +.SH "RETURN VALUE" +.sp +The \fIzmq_z85_encode()\fR function shall return \fIdest\fR if successful, else it shall return NULL\&. +.SH "EXAMPLE" +.PP +\fBEncoding a CURVE key\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +#include +uint8_t public_key [32]; +uint8_t secret_key [32]; +int rc = crypto_box_keypair (public_key, secret_key); +assert (rc == 0); +char encoded [41]; +zmq_z85_encode (encoded, public_key, 32); +puts (encoded); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_z85_decode\fR(3) \fBzmq_curve_keypair\fR(3) \fBzmq_curve_public\fR(3) \fBzmq_curve\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zmsg.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zmsg.3 new file mode 100644 index 00000000000000..0be48b58cf5ac0 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zmsg.3 @@ -0,0 +1,545 @@ +'\" t +.\" Title: zmsg +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZMSG" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmsg \- working with multipart messages +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// This class has draft methods, which may change over time\&. They are not +// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. +// Create a new empty message object +CZMQ_EXPORT zmsg_t * + zmsg_new (void); + +// Receive message from socket, returns zmsg_t object or NULL if the recv +// was interrupted\&. Does a blocking recv\&. If you want to not block then use +// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input +// before receiving\&. +CZMQ_EXPORT zmsg_t * + zmsg_recv (void *source); + +// Load/append an open file into new message, return the message\&. +// Returns NULL if the message could not be loaded\&. +CZMQ_EXPORT zmsg_t * + zmsg_load (FILE *file); + +// Decodes a serialized message frame created by zmsg_encode () and returns +// a new zmsg_t object\&. Returns NULL if the frame was badly formatted or +// there was insufficient memory to work\&. +CZMQ_EXPORT zmsg_t * + zmsg_decode (zframe_t *frame); + +// Generate a signal message encoding the given status\&. A signal is a short +// message carrying a 1\-byte success/failure code (by convention, 0 means +// OK)\&. Signals are encoded to be distinguishable from "normal" messages\&. +CZMQ_EXPORT zmsg_t * + zmsg_new_signal (byte status); + +// Destroy a message object and all frames it contains +CZMQ_EXPORT void + zmsg_destroy (zmsg_t **self_p); + +// Send message to destination socket, and destroy the message after sending +// it successfully\&. If the message has no frames, sends nothing but destroys +// the message anyhow\&. Nullifies the caller\*(Aqs reference to the message (as +// it is a destructor)\&. +CZMQ_EXPORT int + zmsg_send (zmsg_t **self_p, void *dest); + +// Send message to destination socket as part of a multipart sequence, and +// destroy the message after sending it successfully\&. Note that after a +// zmsg_sendm, you must call zmsg_send or another method that sends a final +// message part\&. If the message has no frames, sends nothing but destroys +// the message anyhow\&. Nullifies the caller\*(Aqs reference to the message (as +// it is a destructor)\&. +CZMQ_EXPORT int + zmsg_sendm (zmsg_t **self_p, void *dest); + +// Return size of message, i\&.e\&. number of frames (0 or more)\&. +CZMQ_EXPORT size_t + zmsg_size (zmsg_t *self); + +// Return total size of all frames in message\&. +CZMQ_EXPORT size_t + zmsg_content_size (zmsg_t *self); + +// Push frame to the front of the message, i\&.e\&. before all other frames\&. +// Message takes ownership of frame, will destroy it when message is sent\&. +// Returns 0 on success, \-1 on error\&. Deprecates zmsg_push, which did not +// nullify the caller\*(Aqs frame reference\&. +CZMQ_EXPORT int + zmsg_prepend (zmsg_t *self, zframe_t **frame_p); + +// Add frame to the end of the message, i\&.e\&. after all other frames\&. +// Message takes ownership of frame, will destroy it when message is sent\&. +// Returns 0 on success\&. Deprecates zmsg_add, which did not nullify the +// caller\*(Aqs frame reference\&. +CZMQ_EXPORT int + zmsg_append (zmsg_t *self, zframe_t **frame_p); + +// Remove first frame from message, if any\&. Returns frame, or NULL\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zframe_t * + zmsg_pop (zmsg_t *self); + +// Push block of memory to front of message, as a new frame\&. +// Returns 0 on success, \-1 on error\&. +CZMQ_EXPORT int + zmsg_pushmem (zmsg_t *self, const void *data, size_t size); + +// Add block of memory to the end of the message, as a new frame\&. +// Returns 0 on success, \-1 on error\&. +CZMQ_EXPORT int + zmsg_addmem (zmsg_t *self, const void *data, size_t size); + +// Push string as new frame to front of message\&. +// Returns 0 on success, \-1 on error\&. +CZMQ_EXPORT int + zmsg_pushstr (zmsg_t *self, const char *string); + +// Push string as new frame to end of message\&. +// Returns 0 on success, \-1 on error\&. +CZMQ_EXPORT int + zmsg_addstr (zmsg_t *self, const char *string); + +// Push formatted string as new frame to front of message\&. +// Returns 0 on success, \-1 on error\&. +CZMQ_EXPORT int + zmsg_pushstrf (zmsg_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Push formatted string as new frame to end of message\&. +// Returns 0 on success, \-1 on error\&. +CZMQ_EXPORT int + zmsg_addstrf (zmsg_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Pop frame off front of message, return as fresh string\&. If there were +// no more frames in the message, returns NULL\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zmsg_popstr (zmsg_t *self); + +// Push encoded message as a new frame\&. Message takes ownership of +// submessage, so the original is destroyed in this call\&. Returns 0 on +// success, \-1 on error\&. +CZMQ_EXPORT int + zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); + +// Remove first submessage from message, if any\&. Returns zmsg_t, or NULL if +// decoding was not successful\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zmsg_t * + zmsg_popmsg (zmsg_t *self); + +// Remove specified frame from list, if present\&. Does not destroy frame\&. +CZMQ_EXPORT void + zmsg_remove (zmsg_t *self, zframe_t *frame); + +// Set cursor to first frame in message\&. Returns frame, or NULL, if the +// message is empty\&. Use this to navigate the frames as a list\&. +CZMQ_EXPORT zframe_t * + zmsg_first (zmsg_t *self); + +// Return the next frame\&. If there are no more frames, returns NULL\&. To move +// to the first frame call zmsg_first()\&. Advances the cursor\&. +CZMQ_EXPORT zframe_t * + zmsg_next (zmsg_t *self); + +// Return the last frame\&. If there are no frames, returns NULL\&. +CZMQ_EXPORT zframe_t * + zmsg_last (zmsg_t *self); + +// Save message to an open file, return 0 if OK, else \-1\&. The message is +// saved as a series of frames, each with length and data\&. Note that the +// file is NOT guaranteed to be portable between operating systems, not +// versions of CZMQ\&. The file format is at present undocumented and liable +// to arbitrary change\&. +CZMQ_EXPORT int + zmsg_save (zmsg_t *self, FILE *file); + +// Serialize multipart message to a single message frame\&. Use this method +// to send structured messages across transports that do not support +// multipart data\&. Allocates and returns a new frame containing the +// serialized message\&. To decode a serialized message frame, use +// zmsg_decode ()\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zframe_t * + zmsg_encode (zmsg_t *self); + +// Create copy of message, as new message object\&. Returns a fresh zmsg_t +// object\&. If message is null, or memory was exhausted, returns null\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT zmsg_t * + zmsg_dup (zmsg_t *self); + +// Send message to zsys log sink (may be stdout, or system facility as +// configured by zsys_set_logstream)\&. +CZMQ_EXPORT void + zmsg_print (zmsg_t *self); + +// Return true if the two messages have the same number of frames and each +// frame in the first message is identical to the corresponding frame in the +// other message\&. As with zframe_eq, return false if either message is NULL\&. +CZMQ_EXPORT bool + zmsg_eq (zmsg_t *self, zmsg_t *other); + +// Return signal value, 0 or greater, if message is a signal, \-1 if not\&. +CZMQ_EXPORT int + zmsg_signal (zmsg_t *self); + +// Probe the supplied object, and report if it looks like a zmsg_t\&. +CZMQ_EXPORT bool + zmsg_is (void *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zmsg_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Return message routing ID, if the message came from a ZMQ_SERVER socket\&. +// Else returns zero\&. +CZMQ_EXPORT uint32_t + zmsg_routing_id (zmsg_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on message\&. This is used if/when the message is sent to a +// ZMQ_SERVER socket\&. +CZMQ_EXPORT void + zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zmsg\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zmsg class provides methods to send and receive multipart messages across 0MQ sockets\&. This class provides a list\-like container interface, with methods to work with the overall container\&. zmsg_t messages are composed of zero or more zframe_t frames\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zmsg\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zmsg_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create two PAIR sockets and connect over inproc +zsock_t *output = zsock_new_pair ("@inproc://zmsg\&.test"); +assert (output); +zsock_t *input = zsock_new_pair (">inproc://zmsg\&.test"); +assert (input); + +// Test send and receive of single\-frame message +zmsg_t *msg = zmsg_new (); +assert (msg); +zframe_t *frame = zframe_new ("Hello", 5); +assert (frame); +zmsg_prepend (msg, &frame); +assert (zmsg_size (msg) == 1); +assert (zmsg_content_size (msg) == 5); +rc = zmsg_send (&msg, output); +assert (msg == NULL); +assert (rc == 0); + +msg = zmsg_recv (input); +assert (msg); +assert (zmsg_size (msg) == 1); +assert (zmsg_content_size (msg) == 5); +zmsg_destroy (&msg); + +// Test send and receive of multi\-frame message +msg = zmsg_new (); +assert (msg); +rc = zmsg_addmem (msg, "Frame0", 6); +assert (rc == 0); +rc = zmsg_addmem (msg, "Frame1", 6); +assert (rc == 0); +rc = zmsg_addmem (msg, "Frame2", 6); +assert (rc == 0); +rc = zmsg_addmem (msg, "Frame3", 6); +assert (rc == 0); +rc = zmsg_addmem (msg, "Frame4", 6); +assert (rc == 0); +rc = zmsg_addmem (msg, "Frame5", 6); +assert (rc == 0); +rc = zmsg_addmem (msg, "Frame6", 6); +assert (rc == 0); +rc = zmsg_addmem (msg, "Frame7", 6); +assert (rc == 0); +rc = zmsg_addmem (msg, "Frame8", 6); +assert (rc == 0); +rc = zmsg_addmem (msg, "Frame9", 6); +assert (rc == 0); +zmsg_t *copy = zmsg_dup (msg); +assert (copy); +rc = zmsg_send (©, output); +assert (rc == 0); +rc = zmsg_send (&msg, output); +assert (rc == 0); + +copy = zmsg_recv (input); +assert (copy); +assert (zmsg_size (copy) == 10); +assert (zmsg_content_size (copy) == 60); +zmsg_destroy (©); + +msg = zmsg_recv (input); +assert (msg); +assert (zmsg_size (msg) == 10); +assert (zmsg_content_size (msg) == 60); + +// Save to a file, read back +FILE *file = fopen ("zmsg\&.test", "w"); +assert (file); +rc = zmsg_save (msg, file); +assert (rc == 0); +fclose (file); + +file = fopen ("zmsg\&.test", "r"); +rc = zmsg_save (msg, file); +assert (rc == \-1); +fclose (file); +zmsg_destroy (&msg); + +file = fopen ("zmsg\&.test", "r"); +msg = zmsg_load (file); +assert (msg); +fclose (file); +remove ("zmsg\&.test"); +assert (zmsg_size (msg) == 10); +assert (zmsg_content_size (msg) == 60); + +// Remove all frames except first and last +int frame_nbr; +for (frame_nbr = 0; frame_nbr < 8; frame_nbr++) { + zmsg_first (msg); + frame = zmsg_next (msg); + zmsg_remove (msg, frame); + zframe_destroy (&frame); +} +// Test message frame manipulation +assert (zmsg_size (msg) == 2); +frame = zmsg_last (msg); +assert (zframe_streq (frame, "Frame9")); +assert (zmsg_content_size (msg) == 12); +frame = zframe_new ("Address", 7); +assert (frame); +zmsg_prepend (msg, &frame); +assert (zmsg_size (msg) == 3); +rc = zmsg_addstr (msg, "Body"); +assert (rc == 0); +assert (zmsg_size (msg) == 4); +frame = zmsg_pop (msg); +zframe_destroy (&frame); +assert (zmsg_size (msg) == 3); +char *body = zmsg_popstr (msg); +assert (streq (body, "Frame0")); +free (body); +zmsg_destroy (&msg); + +// Test encoding/decoding +msg = zmsg_new (); +assert (msg); +byte *blank = (byte *) zmalloc (100000); +assert (blank); +rc = zmsg_addmem (msg, blank, 0); +assert (rc == 0); +rc = zmsg_addmem (msg, blank, 1); +assert (rc == 0); +rc = zmsg_addmem (msg, blank, 253); +assert (rc == 0); +rc = zmsg_addmem (msg, blank, 254); +assert (rc == 0); +rc = zmsg_addmem (msg, blank, 255); +assert (rc == 0); +rc = zmsg_addmem (msg, blank, 256); +assert (rc == 0); +rc = zmsg_addmem (msg, blank, 65535); +assert (rc == 0); +rc = zmsg_addmem (msg, blank, 65536); +assert (rc == 0); +rc = zmsg_addmem (msg, blank, 65537); +assert (rc == 0); +free (blank); +assert (zmsg_size (msg) == 9); +frame = zmsg_encode (msg); +zmsg_destroy (&msg); +msg = zmsg_decode (frame); +assert (msg); +zmsg_destroy (&msg); +zframe_destroy (&frame); + +// Test submessages +msg = zmsg_new (); +assert (msg); +zmsg_t *submsg = zmsg_new (); +zmsg_pushstr (msg, "matr"); +zmsg_pushstr (submsg, "joska"); +rc = zmsg_addmsg (msg, &submsg); +assert (rc == 0); +assert (submsg == NULL); +submsg = zmsg_popmsg (msg); +assert (submsg == NULL); // string "matr" is not encoded zmsg_t, so was discarded +submsg = zmsg_popmsg (msg); +assert (submsg); +body = zmsg_popstr (submsg); +assert (streq (body, "joska")); +free (body); +zmsg_destroy (&submsg); +frame = zmsg_pop (msg); +assert (frame == NULL); +zmsg_destroy (&msg); + +// Test comparison of two messages +msg = zmsg_new (); +zmsg_addstr (msg, "One"); +zmsg_addstr (msg, "Two"); +zmsg_addstr (msg, "Three"); +zmsg_t *msg_other = zmsg_new (); +zmsg_addstr (msg_other, "One"); +zmsg_addstr (msg_other, "Two"); +zmsg_addstr (msg_other, "One\-Hundred"); +zmsg_t *msg_dup = zmsg_dup (msg); +zmsg_t *empty_msg = zmsg_new (); +zmsg_t *empty_msg_2 = zmsg_new (); +assert (zmsg_eq (msg, msg_dup)); +assert (!zmsg_eq (msg, msg_other)); +assert (zmsg_eq (empty_msg, empty_msg_2)); +assert (!zmsg_eq (msg, NULL)); +assert (!zmsg_eq (NULL, empty_msg)); +assert (!zmsg_eq (NULL, NULL)); +zmsg_destroy (&msg); +zmsg_destroy (&msg_other); +zmsg_destroy (&msg_dup); +zmsg_destroy (&empty_msg); +zmsg_destroy (&empty_msg_2); + +// Test signal messages +msg = zmsg_new_signal (0); +assert (zmsg_signal (msg) == 0); +zmsg_destroy (&msg); +msg = zmsg_new_signal (\-1); +assert (zmsg_signal (msg) == 255); +zmsg_destroy (&msg); + +// Now try methods on an empty message +msg = zmsg_new (); +assert (msg); +assert (zmsg_size (msg) == 0); +assert (zmsg_unwrap (msg) == NULL); +assert (zmsg_first (msg) == NULL); +assert (zmsg_last (msg) == NULL); +assert (zmsg_next (msg) == NULL); +assert (zmsg_pop (msg) == NULL); +// Sending an empty message is valid and destroys the message +assert (zmsg_send (&msg, output) == 0); +assert (!msg); + +zsock_destroy (&input); +zsock_destroy (&output); + +#if defined (ZMQ_SERVER) +// Create server and client sockets and connect over inproc +zsock_t *server = zsock_new_server ("inproc://zmsg\-test\-routing"); +assert (server); +zsock_t *client = zsock_new_client ("inproc://zmsg\-test\-routing"); +assert (client); + +// Send request from client to server +zmsg_t *request = zmsg_new (); +assert (request); +zmsg_addstr (request, "Hello"); +rc = zmsg_send (&request, client); +assert (rc == 0); +assert (!request); + +// Read request and send reply +request = zmsg_recv (server); +assert (request); +char *string = zmsg_popstr (request); +assert (streq (string, "Hello")); +assert (zmsg_routing_id (request)); +zstr_free (&string); + +zmsg_t *reply = zmsg_new (); +assert (reply); +zmsg_addstr (reply, "World"); +zmsg_set_routing_id (reply, zmsg_routing_id (request)); +rc = zmsg_send (&reply, server); +assert (rc == 0); +zmsg_destroy (&request); + +// Read reply +reply = zmsg_recv (client); +string = zmsg_popstr (reply); +assert (streq (string, "World")); +assert (zmsg_routing_id (reply) == 0); +zmsg_destroy (&reply); +zstr_free (&string); + +// Client and server disallow multipart +msg = zmsg_new (); +zmsg_addstr (msg, "One"); +zmsg_addstr (msg, "Two"); +rc = zmsg_send (&msg, client); +assert (rc == \-1); +assert (zmsg_size (msg) == 2); +rc = zmsg_send (&msg, server); +assert (rc == \-1); +assert (zmsg_size (msg) == 2); +zmsg_destroy (&msg); + +zsock_destroy (&client); +zsock_destroy (&server); +#endif +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zpoller.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zpoller.3 new file mode 100644 index 00000000000000..33e0170d5e8a86 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zpoller.3 @@ -0,0 +1,216 @@ +'\" t +.\" Title: zpoller +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZPOLLER" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zpoller \- trivial socket poller class +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Create new poller, specifying zero or more readers\&. The list of +// readers ends in a NULL\&. Each reader can be a zsock_t instance, a +// zactor_t instance, a libzmq socket (void *), or a file handle\&. +CZMQ_EXPORT zpoller_t * + zpoller_new (void *reader, \&.\&.\&.); + +// Destroy a poller +CZMQ_EXPORT void + zpoller_destroy (zpoller_t **self_p); + +// Add a reader to be polled\&. Returns 0 if OK, \-1 on failure\&. The reader may +// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance\&. +CZMQ_EXPORT int + zpoller_add (zpoller_t *self, void *reader); + +// Remove a reader from the poller; returns 0 if OK, \-1 on failure\&. The reader +// must have been passed during construction, or in an zpoller_add () call\&. +CZMQ_EXPORT int + zpoller_remove (zpoller_t *self, void *reader); + +// By default the poller stops if the process receives a SIGINT or SIGTERM +// signal\&. This makes it impossible to shut\-down message based architectures +// like zactors\&. This method lets you switch off break handling\&. The default +// nonstop setting is off (false)\&. +CZMQ_EXPORT void + zpoller_set_nonstop (zpoller_t *self, bool nonstop); + +// Poll the registered readers for I/O, return first reader that has input\&. +// The reader will be a libzmq void * socket, or a zsock_t or zactor_t +// instance as specified in zpoller_new/zpoller_add\&. The timeout should be +// zero or greater, or \-1 to wait indefinitely\&. Socket priority is defined +// by their order in the poll list\&. If you need a balanced poll, use the low +// level zmq_poll method directly\&. If the poll call was interrupted (SIGINT), +// or the ZMQ context was destroyed, or the timeout expired, returns NULL\&. +// You can test the actual exit condition by calling zpoller_expired () and +// zpoller_terminated ()\&. The timeout is in msec\&. +CZMQ_EXPORT void * + zpoller_wait (zpoller_t *self, int timeout); + +// Return true if the last zpoller_wait () call ended because the timeout +// expired, without any error\&. +CZMQ_EXPORT bool + zpoller_expired (zpoller_t *self); + +// Return true if the last zpoller_wait () call ended because the process +// was interrupted, or the parent context was destroyed\&. +CZMQ_EXPORT bool + zpoller_terminated (zpoller_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zpoller_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zpoller\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zpoller class provides a minimalist interface to ZeroMQ\(cqs zmq_poll API, for the very common case of reading from a number of sockets\&. It does not provide polling for output, nor polling on file handles\&. If you need either of these, use the zmq_poll API directly\&. +.sp +The class implements the poller using the zmq_poller API if that exists, else does the work itself\&. +.SH "EXAMPLE" +.PP +\fBFrom zpoller_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create a few sockets +zsock_t *vent = zsock_new (ZMQ_PUSH); +assert (vent); +int port_nbr = zsock_bind (vent, "tcp://127\&.0\&.0\&.1:*"); +assert (port_nbr != \-1); +zsock_t *sink = zsock_new (ZMQ_PULL); +assert (sink); +int rc = zsock_connect (sink, "tcp://127\&.0\&.0\&.1:%d", port_nbr); +assert (rc != \-1); +zsock_t *bowl = zsock_new (ZMQ_PULL); +assert (bowl); +zsock_t *dish = zsock_new (ZMQ_PULL); +assert (dish); + +// Set up poller +zpoller_t *poller = zpoller_new (bowl, dish, NULL); +assert (poller); + +// Add a reader to the existing poller +rc = zpoller_add (poller, sink); +assert (rc == 0); + +zstr_send (vent, "Hello, World"); + +// We expect a message only on the sink +zsock_t *which = (zsock_t *) zpoller_wait (poller, \-1); +assert (which == sink); +assert (zpoller_expired (poller) == false); +assert (zpoller_terminated (poller) == false); +char *message = zstr_recv (which); +assert (streq (message, "Hello, World")); +zstr_free (&message); + +// Stop polling reader +rc = zpoller_remove (poller, sink); +assert (rc == 0); + +// Check we can poll an FD +rc = zsock_connect (bowl, "tcp://127\&.0\&.0\&.1:%d", port_nbr); +assert (rc != \-1); +SOCKET fd = zsock_fd (bowl); +rc = zpoller_add (poller, (void *) &fd); +assert (rc != \-1); +zstr_send (vent, "Hello again, world"); +assert (zpoller_wait (poller, 500) == &fd); + +// Check zpoller_set_nonstop () +zsys_interrupted = 1; +zpoller_wait (poller, 0); +assert (zpoller_terminated (poller)); +zpoller_set_nonstop (poller, true); +zpoller_wait (poller, 0); +assert (!zpoller_terminated (poller)); +zsys_interrupted = 0; + +zpoller_destroy (&poller); +zsock_destroy (&vent); +zsock_destroy (&sink); +zsock_destroy (&bowl); +zsock_destroy (&dish); + +#ifdef ZMQ_SERVER +// Check thread safe sockets +zpoller_destroy (&poller); +zsock_t *client = zsock_new (ZMQ_CLIENT); +assert (client); +zsock_t *server = zsock_new (ZMQ_SERVER); +assert (server); +poller = zpoller_new (client, server, NULL); +assert (poller); +port_nbr = zsock_bind (server, "tcp://127\&.0\&.0\&.1:*"); +assert (port_nbr != \-1); +rc = zsock_connect (client, "tcp://127\&.0\&.0\&.1:%d", port_nbr); +assert (rc != \-1); + +zstr_send (client, "Hello, World"); + +// We expect a message only on the server +which = (zsock_t *) zpoller_wait (poller, \-1); +assert (which == server); +assert (zpoller_expired (poller) == false); +assert (zpoller_terminated (poller) == false); +message = zstr_recv (which); +assert (streq (message, "Hello, World")); +zstr_free (&message); + +zpoller_destroy (&poller); +zsock_destroy (&client); +zsock_destroy (&server); +#endif +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zproc.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zproc.3 new file mode 100644 index 00000000000000..9bfcfa9c84b840 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zproc.3 @@ -0,0 +1,208 @@ +'\" t +.\" Title: zproc +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZPROC" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zproc \- process configuration and status +.SH "SYNOPSIS" +.sp +.nf +// This is a draft class, and may change without notice\&. It is disabled in +// stable builds by default\&. If you use this in applications, please ask +// for it to be pushed to stable state\&. Use \-\-enable\-drafts to enable\&. +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Returns CZMQ version as a single 6\-digit integer encoding the major +// version (x 10000), the minor version (x 100) and the patch\&. +CZMQ_EXPORT int + zproc_czmq_version (void); + +// *** Draft method, for development use, may change without warning *** +// Returns true if the process received a SIGINT or SIGTERM signal\&. +// It is good practice to use this method to exit any infinite loop +// processing messages\&. +CZMQ_EXPORT bool + zproc_interrupted (void); + +// *** Draft method, for development use, may change without warning *** +// Returns true if the underlying libzmq supports CURVE security\&. +CZMQ_EXPORT bool + zproc_has_curve (void); + +// *** Draft method, for development use, may change without warning *** +// Return current host name, for use in public tcp:// endpoints\&. +// If the host name is not resolvable, returns NULL\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zproc_hostname (void); + +// *** Draft method, for development use, may change without warning *** +// Move the current process into the background\&. The precise effect +// depends on the operating system\&. On POSIX boxes, moves to a specified +// working directory (if specified), closes all file handles, reopens +// stdin, stdout, and stderr to the null device, and sets the process to +// ignore SIGHUP\&. On Windows, does nothing\&. Returns 0 if OK, \-1 if there +// was an error\&. +CZMQ_EXPORT void + zproc_daemonize (const char *workdir); + +// *** Draft method, for development use, may change without warning *** +// Drop the process ID into the lockfile, with exclusive lock, and +// switch the process to the specified group and/or user\&. Any of the +// arguments may be null, indicating a no\-op\&. Returns 0 on success, +// \-1 on failure\&. Note if you combine this with zsys_daemonize, run +// after, not before that method, or the lockfile will hold the wrong +// process ID\&. +CZMQ_EXPORT void + zproc_run_as (const char *lockfile, const char *group, const char *user); + +// *** Draft method, for development use, may change without warning *** +// Configure the number of I/O threads that ZeroMQ will use\&. A good +// rule of thumb is one thread per gigabit of traffic in or out\&. The +// default is 1, sufficient for most applications\&. If the environment +// variable ZSYS_IO_THREADS is defined, that provides the default\&. +// Note that this method is valid only before any socket is created\&. +CZMQ_EXPORT void + zproc_set_io_threads (size_t io_threads); + +// *** Draft method, for development use, may change without warning *** +// Configure the number of sockets that ZeroMQ will allow\&. The default +// is 1024\&. The actual limit depends on the system, and you can query it +// by using zsys_socket_limit ()\&. A value of zero means "maximum"\&. +// Note that this method is valid only before any socket is created\&. +CZMQ_EXPORT void + zproc_set_max_sockets (size_t max_sockets); + +// *** Draft method, for development use, may change without warning *** +// Set network interface name to use for broadcasts, particularly zbeacon\&. +// This lets the interface be configured for test environments where required\&. +// For example, on Mac OS X, zbeacon cannot bind to 255\&.255\&.255\&.255 which is +// the default when there is no specified interface\&. If the environment +// variable ZSYS_INTERFACE is set, use that as the default interface name\&. +// Setting the interface to "*" means "use all available interfaces"\&. +CZMQ_EXPORT void + zproc_set_biface (const char *value); + +// *** Draft method, for development use, may change without warning *** +// Return network interface to use for broadcasts, or "" if none was set\&. +CZMQ_EXPORT const char * + zproc_biface (void); + +// *** Draft method, for development use, may change without warning *** +// Set log identity, which is a string that prefixes all log messages sent +// by this process\&. The log identity defaults to the environment variable +// ZSYS_LOGIDENT, if that is set\&. +CZMQ_EXPORT void + zproc_set_log_ident (const char *value); + +// *** Draft method, for development use, may change without warning *** +// Sends log output to a PUB socket bound to the specified endpoint\&. To +// collect such log output, create a SUB socket, subscribe to the traffic +// you care about, and connect to the endpoint\&. Log traffic is sent as a +// single string frame, in the same format as when sent to stdout\&. The +// log system supports a single sender; multiple calls to this method will +// bind the same sender to multiple endpoints\&. To disable the sender, call +// this method with a null argument\&. +CZMQ_EXPORT void + zproc_set_log_sender (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Enable or disable logging to the system facility (syslog on POSIX boxes, +// event log on Windows)\&. By default this is disabled\&. +CZMQ_EXPORT void + zproc_set_log_system (bool logsystem); + +// *** Draft method, for development use, may change without warning *** +// Log error condition \- highest priority +CZMQ_EXPORT void + zproc_log_error (const char *format, \&.\&.\&.) CHECK_PRINTF (1); + +// *** Draft method, for development use, may change without warning *** +// Log warning condition \- high priority +CZMQ_EXPORT void + zproc_log_warning (const char *format, \&.\&.\&.) CHECK_PRINTF (1); + +// *** Draft method, for development use, may change without warning *** +// Log normal, but significant, condition \- normal priority +CZMQ_EXPORT void + zproc_log_notice (const char *format, \&.\&.\&.) CHECK_PRINTF (1); + +// *** Draft method, for development use, may change without warning *** +// Log informational message \- low priority +CZMQ_EXPORT void + zproc_log_info (const char *format, \&.\&.\&.) CHECK_PRINTF (1); + +// *** Draft method, for development use, may change without warning *** +// Log debug\-level message \- lowest priority +CZMQ_EXPORT void + zproc_log_debug (const char *format, \&.\&.\&.) CHECK_PRINTF (1); + +// *** Draft method, for development use, may change without warning *** +// Self test of this class\&. +CZMQ_EXPORT void + zproc_test (bool verbose); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zproc\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +zproc \- process configuration and status +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zproc\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zproc_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +Please add \*(Aq@selftest\*(Aq section in \*(Aq\&./\&.\&./src/zproc\&.c\*(Aq\&. +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zproxy.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zproxy.3 new file mode 100644 index 00000000000000..037d3da6bb92bd --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zproxy.3 @@ -0,0 +1,402 @@ +'\" t +.\" Title: zproxy +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZPROXY" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zproxy \- run a steerable proxy in the background +.SH "SYNOPSIS" +.sp +.nf +// Create new zproxy actor instance\&. The proxy switches messages between +// a frontend socket and a backend socket; use the FRONTEND and BACKEND +// commands to configure these: +// +// zactor_t *proxy = zactor_new (zproxy, NULL); +// +// Destroy zproxy instance\&. This destroys the two sockets and stops any +// message flow between them: +// +// zactor_destroy (&proxy); +// +// Note that all zproxy commands are synchronous, so your application always +// waits for a signal from the actor after each command\&. +// +// Enable verbose logging of commands and activity: +// +// zstr_send (proxy, "VERBOSE"); +// zsock_wait (proxy); +// +// Specify frontend socket type \-\- see zsock_type_str () \-\- and attach to +// endpoints, see zsock_attach ()\&. Note that a proxy socket is always +// serverish: +// +// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); +// zsock_wait (proxy); +// +// Specify backend socket type \-\- see zsock_type_str () \-\- and attach to +// endpoints, see zsock_attach ()\&. Note that a proxy socket is always +// serverish: +// +// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); +// zsock_wait (proxy); +// +// Capture all proxied messages; these are delivered to the application +// via an inproc PULL socket that you have already bound to the specified +// endpoint: +// +// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); +// zsock_wait (proxy); +// +// Pause the proxy\&. A paused proxy will cease processing messages, causing +// them to be queued up and potentially hit the high\-water mark on the +// frontend or backend socket, causing messages to be dropped, or writing +// applications to block: +// +// zstr_sendx (proxy, "PAUSE", NULL); +// zsock_wait (proxy); +// +// Resume the proxy\&. Note that the proxy starts automatically as soon as it +// has a properly attached frontend and backend socket: +// +// zstr_sendx (proxy, "RESUME", NULL); +// zsock_wait (proxy); +// +// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy +// socket \-\- see zsock_set_zap_domain ()\&. Call before binding socket: +// +// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); +// zsock_wait (proxy); +// +// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy +// socket \-\- see zsock_set_plain_server ()\&. Call before binding socket: +// +// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); +// zsock_wait (proxy); +// +// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy +// socket \-\- see zsock_set_curve_server () \-\- specifying both the public and +// secret keys of a certificate as Z85 armored strings \-\- see +// zcert_public_txt () and zcert_secret_txt ()\&. Call before binding socket: +// +// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); +// zsock_wait (proxy); +// +// This is the zproxy constructor as a zactor_fn; the argument is a +// character string specifying frontend and backend socket types as two +// uppercase strings separated by a hyphen: +CZMQ_EXPORT void + zproxy (zsock_t *pipe, void *unused); + +// Selftest +CZMQ_EXPORT void + zproxy_test (bool verbose); +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zproxy\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +A zproxy actor switches messages between a frontend and a backend socket\&. It acts much like the zmq_proxy_steerable method, though it makes benefit of CZMQ\(cqs facilities, to be somewhat simpler to set\-up\&. +.sp +This class replaces zproxy_v2, and is meant for applications that use the CZMQ v3 API (meaning, zsock)\&. +.SH "EXAMPLE" +.PP +\fBFrom zproxy_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create and configure our proxy +zactor_t *proxy = zactor_new (zproxy, NULL); +assert (proxy); +if (verbose) { + zstr_sendx (proxy, "VERBOSE", NULL); + zsock_wait (proxy); +} +zstr_sendx (proxy, "FRONTEND", "PULL", "inproc://frontend", NULL); +zsock_wait (proxy); +zstr_sendx (proxy, "BACKEND", "PUSH", "inproc://backend", NULL); +zsock_wait (proxy); + +// Connect application sockets to proxy +zsock_t *faucet = zsock_new_push (">inproc://frontend"); +assert (faucet); +zsock_t *sink = zsock_new_pull (">inproc://backend"); +assert (sink); + +// Send some messages and check they arrived +char *hello, *world; +zstr_sendx (faucet, "Hello", "World", NULL); +zstr_recvx (sink, &hello, &world, NULL); +assert (streq (hello, "Hello")); +assert (streq (world, "World")); +zstr_free (&hello); +zstr_free (&world); + +// Test pause/resume functionality +zstr_sendx (proxy, "PAUSE", NULL); +zsock_wait (proxy); +zstr_sendx (faucet, "Hello", "World", NULL); +zsock_set_rcvtimeo (sink, 100); +zstr_recvx (sink, &hello, &world, NULL); +assert (!hello && !world); + +zstr_sendx (proxy, "RESUME", NULL); +zsock_wait (proxy); +zstr_recvx (sink, &hello, &world, NULL); +assert (streq (hello, "Hello")); +assert (streq (world, "World")); +zstr_free (&hello); +zstr_free (&world); + +// Test capture functionality +zsock_t *capture = zsock_new_pull ("inproc://capture"); +assert (capture); + +// Switch on capturing, check that it works +zstr_sendx (proxy, "CAPTURE", "inproc://capture", NULL); +zsock_wait (proxy); +zstr_sendx (faucet, "Hello", "World", NULL); +zstr_recvx (sink, &hello, &world, NULL); +assert (streq (hello, "Hello")); +assert (streq (world, "World")); +zstr_free (&hello); +zstr_free (&world); + +zstr_recvx (capture, &hello, &world, NULL); +assert (streq (hello, "Hello")); +assert (streq (world, "World")); +zstr_free (&hello); +zstr_free (&world); + +zsock_destroy (&faucet); +zsock_destroy (&sink); +zsock_destroy (&capture); +zactor_destroy (&proxy); + +// Test socket creation dependency +proxy = zactor_new (zproxy, NULL); +assert (proxy); + +sink = zsock_new_sub (">ipc://backend", "whatever"); +assert (sink); + +zstr_sendx (proxy, "BACKEND", "XPUB", "ipc://backend", NULL); +zsock_wait (proxy); + +zsock_destroy(&sink); +zactor_destroy(&proxy); + +#if (ZMQ_VERSION_MAJOR == 4) +// Test authentication functionality +# define TESTDIR "\&.test_zproxy" + +// Create temporary directory for test files +zsys_dir_create (TESTDIR); + +char *frontend = NULL; +char *backend = NULL; + +// Check there\*(Aqs no authentication +s_create_test_sockets (&proxy, &faucet, &sink, verbose); +s_bind_test_sockets (proxy, &frontend, &backend); +bool success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); +assert (success); + +// Install the authenticator +zactor_t *auth = zactor_new (zauth, NULL); +assert (auth); +if (verbose) { + zstr_sendx (auth, "VERBOSE", NULL); + zsock_wait (auth); +} + +// Check there\*(Aqs no authentication on a default NULL server +s_bind_test_sockets (proxy, &frontend, &backend); +success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); +assert (success); + +// When we set a domain on the server, we switch on authentication +// for NULL sockets, but with no policies, the client connection +// will be allowed\&. +zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); +zsock_wait (proxy); +s_bind_test_sockets (proxy, &frontend, &backend); +success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); +assert (success); + +// Blacklist 127\&.0\&.0\&.1, connection should fail +zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); +zsock_wait (proxy); +s_bind_test_sockets (proxy, &frontend, &backend); +zstr_sendx (auth, "DENY", "127\&.0\&.0\&.1", NULL); +zsock_wait (auth); +success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); +assert (!success); + +// Whitelist our address, which overrides the blacklist +zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); +zsock_wait (proxy); +zstr_sendx (proxy, "DOMAIN", "BACKEND", "global", NULL); +zsock_wait (proxy); +s_bind_test_sockets (proxy, &frontend, &backend); +zstr_sendx (auth, "ALLOW", "127\&.0\&.0\&.1", NULL); +zsock_wait (auth); +success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); +assert (success); + +// Try PLAIN authentication + +// Test negative case (no server\-side passwords defined) +zstr_sendx (proxy, "PLAIN", "FRONTEND", NULL); +zsock_wait (proxy); +s_bind_test_sockets (proxy, &frontend, &backend); +zsock_set_plain_username (faucet, "admin"); +zsock_set_plain_password (faucet, "Password"); +success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); +assert (!success); + +// Test positive case (server\-side passwords defined) +FILE *password = fopen (TESTDIR "/password\-file", "w"); +assert (password); +fprintf (password, "admin=Password\en"); +fclose (password); +zstr_sendx (proxy, "PLAIN", "FRONTEND", NULL); +zsock_wait (proxy); +zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); +zsock_wait (proxy); +s_bind_test_sockets (proxy, &frontend, &backend); +zsock_set_plain_username (faucet, "admin"); +zsock_set_plain_password (faucet, "Password"); +zsock_set_plain_username (sink, "admin"); +zsock_set_plain_password (sink, "Password"); +zstr_sendx (auth, "PLAIN", TESTDIR "/password\-file", NULL); +zsock_wait (auth); +success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); +assert (success); + +// Test negative case (bad client password) +zstr_sendx (proxy, "PLAIN", "FRONTEND", NULL); +zsock_wait (proxy); +s_bind_test_sockets (proxy, &frontend, &backend); +zsock_set_plain_username (faucet, "admin"); +zsock_set_plain_password (faucet, "Bogus"); +success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); +assert (!success); + +if (zsys_has_curve ()) { + // We\*(Aqll create two new certificates and save the client public + // certificate on disk + zcert_t *server_cert = zcert_new (); + assert (server_cert); + zcert_t *client_cert = zcert_new (); + assert (client_cert); + const char *public_key = zcert_public_txt (server_cert); + const char *secret_key = zcert_secret_txt (server_cert); + + // Try CURVE authentication + + // Test without setting\-up any authentication + zstr_sendx (proxy, "CURVE", "FRONTEND", public_key, secret_key, NULL); + zsock_wait (proxy); + s_bind_test_sockets (proxy, &frontend, &backend); + zcert_apply (client_cert, faucet); + zsock_set_curve_serverkey (faucet, public_key); + success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); + assert (!success); + + // Test CURVE_ALLOW_ANY + zstr_sendx (proxy, "CURVE", "FRONTEND", public_key, secret_key, NULL); + zsock_wait (proxy); + s_bind_test_sockets (proxy, &frontend, &backend); + zcert_apply (client_cert, faucet); + zsock_set_curve_serverkey (faucet, public_key); + zstr_sendx (auth, "CURVE", CURVE_ALLOW_ANY, NULL); + zsock_wait (auth); + success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); + assert (success); + + // Test with client certificate file in authentication folder + zstr_sendx (proxy, "CURVE", "FRONTEND", public_key, secret_key, NULL); + zsock_wait (proxy); + zstr_sendx (proxy, "CURVE", "BACKEND", public_key, secret_key, NULL); + zsock_wait (proxy); + s_bind_test_sockets (proxy, &frontend, &backend); + zcert_apply (client_cert, faucet); + zsock_set_curve_serverkey (faucet, public_key); + zcert_apply (client_cert, sink); + zsock_set_curve_serverkey (sink, public_key); + zcert_save_public (client_cert, TESTDIR "/mycert\&.txt"); + zstr_sendx (auth, "CURVE", TESTDIR, NULL); + zsock_wait (auth); + success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); + assert (success); + + zcert_destroy (&server_cert); + zcert_destroy (&client_cert); +} + +// Remove the authenticator and check a normal connection works +zactor_destroy (&auth); +s_bind_test_sockets (proxy, &frontend, &backend); +success = s_can_connect (&proxy, &faucet, &sink, frontend, backend, verbose); +assert (success); + +// Cleanup +zsock_destroy (&faucet); +zsock_destroy (&sink); +zactor_destroy (&proxy); +zstr_free (&frontend); +zstr_free (&backend); + +// Delete temporary directory and test files +zsys_file_delete (TESTDIR "/password\-file"); +zsys_file_delete (TESTDIR "/mycert\&.txt"); +zsys_dir_delete (TESTDIR); +#endif +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zrex.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zrex.3 new file mode 100644 index 00000000000000..99c7337d403609 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zrex.3 @@ -0,0 +1,199 @@ +'\" t +.\" Title: zrex +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZREX" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zrex \- work with regular expressions +.SH "SYNOPSIS" +.sp +.nf +// Constructor\&. Optionally, sets an expression against which we can match +// text and capture hits\&. If there is an error in the expression, reports +// zrex_valid() as false and provides the error in zrex_strerror()\&. If you +// set a pattern, you can call zrex_matches() to test it against text\&. +CZMQ_EXPORT zrex_t * + zrex_new (const char *expression); + +// Destructor +CZMQ_EXPORT void + zrex_destroy (zrex_t **self_p); + +// Return true if the expression was valid and compiled without errors\&. +CZMQ_EXPORT bool + zrex_valid (zrex_t *self); + +// Return the error message generated during compilation of the expression\&. +CZMQ_EXPORT const char * + zrex_strerror (zrex_t *self); + +// Returns true if the text matches the previously compiled expression\&. +// Use this method to compare one expression against many strings\&. +CZMQ_EXPORT bool + zrex_matches (zrex_t *self, const char *text); + +// Returns true if the text matches the supplied expression\&. Use this +// method to compare one string against several expressions\&. +CZMQ_EXPORT bool + zrex_eq (zrex_t *self, const char *text, const char *expression); + +// Returns number of hits from last zrex_matches or zrex_eq\&. If the text +// matched, returns 1 plus the number of capture groups\&. If the text did +// not match, returns zero\&. To retrieve individual capture groups, call +// zrex_hit ()\&. +CZMQ_EXPORT int + zrex_hits (zrex_t *self); + +// Returns the Nth capture group from the last expression match, where +// N is 0 to the value returned by zrex_hits()\&. Capture group 0 is the +// whole matching string\&. Sequence 1 is the first capture group, if any, +// and so on\&. +CZMQ_EXPORT const char * + zrex_hit (zrex_t *self, uint index); + +// Fetches hits into string variables provided by caller; this makes for +// nicer code than accessing hits by index\&. Caller should not modify nor +// free the returned values\&. Returns number of strings returned\&. This +// method starts at hit 1, i\&.e\&. first capture group, as hit 0 is always +// the original matched string\&. +CZMQ_EXPORT int + zrex_fetch (zrex_t *self, const char **string_p, \&.\&.\&.); + +// Self test of this class +CZMQ_EXPORT void + zrex_test (bool verbose); +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zrex\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +Wraps a very simple regular expression library (SLRE) as a CZMQ class\&. Supports this syntax: +.sp +.if n \{\ +.RS 4 +.\} +.nf +^ Match beginning of a buffer +$ Match end of a buffer +() Grouping and substring capturing +[\&.\&.\&.] Match any character from set +[^\&.\&.\&.] Match any character but ones from set +\&. Match any character +\es Match whitespace +\eS Match non\-whitespace +\ed Match decimal digit +\eD Match non decimal digit +\ea Match alphabetic character +\eA Match non\-alphabetic character +\ew Match alphanumeric character +\eW Match non\-alphanumeric character +\er Match carriage return +\en Match newline ++ Match one or more times (greedy) ++? Match one or more times (non\-greedy) +* Match zero or more times (greedy) +*? Match zero or more times (non\-greedy) +? Match zero or once +\exDD Match byte with hex value 0xDD +\emeta Match one of the meta character: ^$()\&.[*+?\e +.fi +.if n \{\ +.RE +.\} +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zrex\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zrex_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// This shows the pattern of matching many lines to a single pattern +zrex_t *rex = zrex_new ("\e\ed+\-\e\ed+\-\e\ed+"); +assert (rex); +assert (zrex_valid (rex)); +bool matches = zrex_matches (rex, "123\-456\-789"); +assert (matches); +assert (zrex_hits (rex) == 1); +assert (streq (zrex_hit (rex, 0), "123\-456\-789")); +assert (zrex_hit (rex, 1) == NULL); +zrex_destroy (&rex); + +// Here we pick out hits using capture groups +rex = zrex_new ("(\e\ed+)\-(\e\ed+)\-(\e\ed+)"); +assert (rex); +assert (zrex_valid (rex)); +matches = zrex_matches (rex, "123\-456\-ABC"); +assert (!matches); +matches = zrex_matches (rex, "123\-456\-789"); +assert (matches); +assert (zrex_hits (rex) == 4); +assert (streq (zrex_hit (rex, 0), "123\-456\-789")); +assert (streq (zrex_hit (rex, 1), "123")); +assert (streq (zrex_hit (rex, 2), "456")); +assert (streq (zrex_hit (rex, 3), "789")); +zrex_destroy (&rex); + +// This shows the pattern of matching one line against many +// patterns and then handling the case when it hits +rex = zrex_new (NULL); // No initial pattern +assert (rex); +char *input = "Mechanism: CURVE"; +matches = zrex_eq (rex, input, "Version: (\&.+)"); +assert (!matches); +assert (zrex_hits (rex) == 0); +matches = zrex_eq (rex, input, "Mechanism: (\&.+)"); +assert (matches); +assert (zrex_hits (rex) == 2); +const char *mechanism; +zrex_fetch (rex, &mechanism, NULL); +assert (streq (zrex_hit (rex, 1), "CURVE")); +assert (streq (mechanism, "CURVE")); +zrex_destroy (&rex); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zsock.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zsock.3 new file mode 100644 index 00000000000000..fc4a7e8b44c21b --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zsock.3 @@ -0,0 +1,1469 @@ +'\" t +.\" Title: zsock +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZSOCK" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zsock \- high\-level socket API that hides libzmq contexts and sockets +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// This class has draft methods, which may change over time\&. They are not +// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. +// Create a new socket\&. Returns the new socket, or NULL if the new socket +// could not be created\&. Note that the symbol zsock_new (and other +// constructors/destructors for zsock) are redirected to the *_checked +// variant, enabling intelligent socket leak detection\&. This can have +// performance implications if you use a LOT of sockets\&. To turn off this +// redirection behaviour, define ZSOCK_NOCHECK\&. +CZMQ_EXPORT zsock_t * + zsock_new (int type); + +// Create a PUB socket\&. Default action is bind\&. +CZMQ_EXPORT zsock_t * + zsock_new_pub (const char *endpoint); + +// Create a SUB socket, and optionally subscribe to some prefix string\&. Default +// action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_sub (const char *endpoint, const char *subscribe); + +// Create a REQ socket\&. Default action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_req (const char *endpoint); + +// Create a REP socket\&. Default action is bind\&. +CZMQ_EXPORT zsock_t * + zsock_new_rep (const char *endpoint); + +// Create a DEALER socket\&. Default action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_dealer (const char *endpoint); + +// Create a ROUTER socket\&. Default action is bind\&. +CZMQ_EXPORT zsock_t * + zsock_new_router (const char *endpoint); + +// Create a PUSH socket\&. Default action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_push (const char *endpoint); + +// Create a PULL socket\&. Default action is bind\&. +CZMQ_EXPORT zsock_t * + zsock_new_pull (const char *endpoint); + +// Create an XPUB socket\&. Default action is bind\&. +CZMQ_EXPORT zsock_t * + zsock_new_xpub (const char *endpoint); + +// Create an XSUB socket\&. Default action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_xsub (const char *endpoint); + +// Create a PAIR socket\&. Default action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_pair (const char *endpoint); + +// Create a STREAM socket\&. Default action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_stream (const char *endpoint); + +// Destroy the socket\&. You must use this for any socket created via the +// zsock_new method\&. +CZMQ_EXPORT void + zsock_destroy (zsock_t **self_p); + +// Bind a socket to a formatted endpoint\&. For tcp:// endpoints, supports +// ephemeral ports, if you specify the port number as "*"\&. By default +// zsock uses the IANA designated range from C000 (49152) to FFFF (65535)\&. +// To override this range, follow the "*" with "[first\-last]"\&. Either or +// both first and last may be empty\&. To bind to a random port within the +// range, use "!" in place of "*"\&. +// +// Examples: +// tcp://127\&.0\&.0\&.1:* bind to first free port from C000 up +// tcp://127\&.0\&.0\&.1:! bind to random port from C000 to FFFF +// tcp://127\&.0\&.0\&.1:*[60000\-] bind to first free port from 60000 up +// tcp://127\&.0\&.0\&.1:![\-60000] bind to random port from C000 to 60000 +// tcp://127\&.0\&.0\&.1:![55000\-55999] +// bind to random port from 55000 to 55999 +// +// On success, returns the actual port number used, for tcp:// endpoints, +// and 0 for other transports\&. On failure, returns \-1\&. Note that when using +// ephemeral ports, a port may be reused by different services without +// clients being aware\&. Protocols that run on ephemeral ports should take +// this into account\&. +CZMQ_EXPORT int + zsock_bind (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Returns last bound endpoint, if any\&. +CZMQ_EXPORT const char * + zsock_endpoint (zsock_t *self); + +// Unbind a socket from a formatted endpoint\&. +// Returns 0 if OK, \-1 if the endpoint was invalid or the function +// isn\*(Aqt supported\&. +CZMQ_EXPORT int + zsock_unbind (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Connect a socket to a formatted endpoint +// Returns 0 if OK, \-1 if the endpoint was invalid\&. +CZMQ_EXPORT int + zsock_connect (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Disconnect a socket from a formatted endpoint +// Returns 0 if OK, \-1 if the endpoint was invalid or the function +// isn\*(Aqt supported\&. +CZMQ_EXPORT int + zsock_disconnect (zsock_t *self, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Attach a socket to zero or more endpoints\&. If endpoints is not null, +// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by +// \*(Aq@\*(Aq (to bind the socket) or \*(Aq>\*(Aq (to connect the socket)\&. Returns 0 if all +// endpoints were valid, or \-1 if there was a syntax error\&. If the endpoint +// does not start with \*(Aq@\*(Aq or \*(Aq>\*(Aq, the serverish argument defines whether +// it is used to bind (serverish = true) or connect (serverish = false)\&. +CZMQ_EXPORT int + zsock_attach (zsock_t *self, const char *endpoints, bool serverish); + +// Returns socket type as printable constant string\&. +CZMQ_EXPORT const char * + zsock_type_str (zsock_t *self); + +// Send a \*(Aqpicture\*(Aq message to the socket (or actor)\&. The picture is a +// string that defines the type of each frame\&. This makes it easy to send +// a complex multiframe message in one call\&. The picture can contain any +// of these characters, each corresponding to one or two arguments: +// +// i = int (signed) +// 1 = uint8_t +// 2 = uint16_t +// 4 = uint32_t +// 8 = uint64_t +// s = char * +// b = byte *, size_t (2 arguments) +// c = zchunk_t * +// f = zframe_t * +// h = zhashx_t * +// U = zuuid_t * +// p = void * (sends the pointer value, only meaningful over inproc) +// m = zmsg_t * (sends all frames in the zmsg) +// z = sends zero\-sized frame (0 arguments) +// u = uint (deprecated) +// +// Note that s, b, c, and f are encoded the same way and the choice is +// offered as a convenience to the sender, which may or may not already +// have data in a zchunk or zframe\&. Does not change or take ownership of +// any arguments\&. Returns 0 if successful, \-1 if sending failed for any +// reason\&. +CZMQ_EXPORT int + zsock_send (void *self, const char *picture, \&.\&.\&.); + +// Send a \*(Aqpicture\*(Aq message to the socket (or actor)\&. This is a va_list +// version of zsock_send (), so please consult its documentation for the +// details\&. +CZMQ_EXPORT int + zsock_vsend (void *self, const char *picture, va_list argptr); + +// Receive a \*(Aqpicture\*(Aq message to the socket (or actor)\&. See zsock_send for +// the format and meaning of the picture\&. Returns the picture elements into +// a series of pointers as provided by the caller: +// +// i = int * (stores signed integer) +// 4 = uint32_t * (stores 32\-bit unsigned integer) +// 8 = uint64_t * (stores 64\-bit unsigned integer) +// s = char ** (allocates new string) +// b = byte **, size_t * (2 arguments) (allocates memory) +// c = zchunk_t ** (creates zchunk) +// f = zframe_t ** (creates zframe) +// U = zuuid_t * (creates a zuuid with the data) +// h = zhashx_t ** (creates zhashx) +// p = void ** (stores pointer) +// m = zmsg_t ** (creates a zmsg with the remaing frames) +// z = null, asserts empty frame (0 arguments) +// u = uint * (stores unsigned integer, deprecated) +// +// Note that zsock_recv creates the returned objects, and the caller must +// destroy them when finished with them\&. The supplied pointers do not need +// to be initialized\&. Returns 0 if successful, or \-1 if it failed to recv +// a message, in which case the pointers are not modified\&. When message +// frames are truncated (a short message), sets return values to zero/null\&. +// If an argument pointer is NULL, does not store any value (skips it)\&. +// An \*(Aqn\*(Aq picture matches an empty frame; if the message does not match, +// the method will return \-1\&. +CZMQ_EXPORT int + zsock_recv (void *self, const char *picture, \&.\&.\&.); + +// Receive a \*(Aqpicture\*(Aq message from the socket (or actor)\&. This is a +// va_list version of zsock_recv (), so please consult its documentation +// for the details\&. +CZMQ_EXPORT int + zsock_vrecv (void *self, const char *picture, va_list argptr); + +// Send a binary encoded \*(Aqpicture\*(Aq message to the socket (or actor)\&. This +// method is similar to zsock_send, except the arguments are encoded in a +// binary format that is compatible with zproto, and is designed to reduce +// memory allocations\&. The pattern argument is a string that defines the +// type of each argument\&. Supports these argument types: +// +// pattern C type zproto type: +// 1 uint8_t type = "number" size = "1" +// 2 uint16_t type = "number" size = "2" +// 4 uint32_t type = "number" size = "3" +// 8 uint64_t type = "number" size = "4" +// s char *, 0\-255 chars type = "string" +// S char *, 0\-2^32\-1 chars type = "longstr" +// c zchunk_t * type = "chunk" +// f zframe_t * type = "frame" +// u zuuid_t * type = "uuid" +// m zmsg_t * type = "msg" +// p void *, sends pointer value, only over inproc +// +// Does not change or take ownership of any arguments\&. Returns 0 if +// successful, \-1 if sending failed for any reason\&. +CZMQ_EXPORT int + zsock_bsend (void *self, const char *picture, \&.\&.\&.); + +// Receive a binary encoded \*(Aqpicture\*(Aq message from the socket (or actor)\&. +// This method is similar to zsock_recv, except the arguments are encoded +// in a binary format that is compatible with zproto, and is designed to +// reduce memory allocations\&. The pattern argument is a string that defines +// the type of each argument\&. See zsock_bsend for the supported argument +// types\&. All arguments must be pointers; this call sets them to point to +// values held on a per\-socket basis\&. +// Note that zsock_brecv creates the returned objects, and the caller must +// destroy them when finished with them\&. The supplied pointers do not need +// to be initialized\&. Returns 0 if successful, or \-1 if it failed to read +// a message\&. +CZMQ_EXPORT int + zsock_brecv (void *self, const char *picture, \&.\&.\&.); + +// Set socket to use unbounded pipes (HWM=0); use this in cases when you are +// totally certain the message volume can fit in memory\&. This method works +// across all versions of ZeroMQ\&. Takes a polymorphic socket reference\&. +CZMQ_EXPORT void + zsock_set_unbounded (void *self); + +// Send a signal over a socket\&. A signal is a short message carrying a +// success/failure code (by convention, 0 means OK)\&. Signals are encoded +// to be distinguishable from "normal" messages\&. Accepts a zsock_t or a +// zactor_t argument, and returns 0 if successful, \-1 if the signal could +// not be sent\&. Takes a polymorphic socket reference\&. +CZMQ_EXPORT int + zsock_signal (void *self, byte status); + +// Wait on a signal\&. Use this to coordinate between threads, over pipe +// pairs\&. Blocks until the signal is received\&. Returns \-1 on error, 0 or +// greater on success\&. Accepts a zsock_t or a zactor_t as argument\&. +// Takes a polymorphic socket reference\&. +CZMQ_EXPORT int + zsock_wait (void *self); + +// If there is a partial message still waiting on the socket, remove and +// discard it\&. This is useful when reading partial messages, to get specific +// message types\&. +CZMQ_EXPORT void + zsock_flush (void *self); + +// Probe the supplied object, and report if it looks like a zsock_t\&. +// Takes a polymorphic socket reference\&. +CZMQ_EXPORT bool + zsock_is (void *self); + +// Probe the supplied reference\&. If it looks like a zsock_t instance, return +// the underlying libzmq socket handle; else if it looks like a file +// descriptor, return NULL; else if it looks like a libzmq socket handle, +// return the supplied value\&. Takes a polymorphic socket reference\&. +CZMQ_EXPORT void * + zsock_resolve (void *self); + +// Get socket option `heartbeat_ivl`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_heartbeat_ivl (void *self); + +// Set socket option `heartbeat_ivl`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); + +// Get socket option `heartbeat_ttl`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_heartbeat_ttl (void *self); + +// Set socket option `heartbeat_ttl`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); + +// Get socket option `heartbeat_timeout`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_heartbeat_timeout (void *self); + +// Set socket option `heartbeat_timeout`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); + +// Get socket option `use_fd`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_use_fd (void *self); + +// Set socket option `use_fd`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_use_fd (void *self, int use_fd); + +// Set socket option `xpub_manual`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_xpub_manual (void *self, int xpub_manual); + +// Set socket option `xpub_welcome_msg`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_xpub_welcome_msg (void *self, const char *xpub_welcome_msg); + +// Set socket option `stream_notify`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_stream_notify (void *self, int stream_notify); + +// Get socket option `invert_matching`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_invert_matching (void *self); + +// Set socket option `invert_matching`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_invert_matching (void *self, int invert_matching); + +// Set socket option `xpub_verboser`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_xpub_verboser (void *self, int xpub_verboser); + +// Get socket option `connect_timeout`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_connect_timeout (void *self); + +// Set socket option `connect_timeout`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_connect_timeout (void *self, int connect_timeout); + +// Get socket option `tcp_maxrt`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_tcp_maxrt (void *self); + +// Set socket option `tcp_maxrt`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_tcp_maxrt (void *self, int tcp_maxrt); + +// Get socket option `thread_safe`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_thread_safe (void *self); + +// Get socket option `multicast_maxtpdu`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_multicast_maxtpdu (void *self); + +// Set socket option `multicast_maxtpdu`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_multicast_maxtpdu (void *self, int multicast_maxtpdu); + +// Get socket option `vmci_buffer_size`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_vmci_buffer_size (void *self); + +// Set socket option `vmci_buffer_size`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_vmci_buffer_size (void *self, int vmci_buffer_size); + +// Get socket option `vmci_buffer_min_size`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_vmci_buffer_min_size (void *self); + +// Set socket option `vmci_buffer_min_size`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_vmci_buffer_min_size (void *self, int vmci_buffer_min_size); + +// Get socket option `vmci_buffer_max_size`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_vmci_buffer_max_size (void *self); + +// Set socket option `vmci_buffer_max_size`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_vmci_buffer_max_size (void *self, int vmci_buffer_max_size); + +// Get socket option `vmci_connect_timeout`\&. +// Available from libzmq 4\&.2\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_vmci_connect_timeout (void *self); + +// Set socket option `vmci_connect_timeout`\&. +// Available from libzmq 4\&.2\&.0\&. +CZMQ_EXPORT void + zsock_set_vmci_connect_timeout (void *self, int vmci_connect_timeout); + +// Get socket option `tos`\&. +// Available from libzmq 4\&.1\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_tos (void *self); + +// Set socket option `tos`\&. +// Available from libzmq 4\&.1\&.0\&. +CZMQ_EXPORT void + zsock_set_tos (void *self, int tos); + +// Set socket option `router_handover`\&. +// Available from libzmq 4\&.1\&.0\&. +CZMQ_EXPORT void + zsock_set_router_handover (void *self, int router_handover); + +// Set socket option `connect_rid`\&. +// Available from libzmq 4\&.1\&.0\&. +CZMQ_EXPORT void + zsock_set_connect_rid (void *self, const char *connect_rid); + +// Set socket option `connect_rid` from 32\-octet binary +// Available from libzmq 4\&.1\&.0\&. +CZMQ_EXPORT void + zsock_set_connect_rid_bin (void *self, const byte *connect_rid); + +// Get socket option `handshake_ivl`\&. +// Available from libzmq 4\&.1\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_handshake_ivl (void *self); + +// Set socket option `handshake_ivl`\&. +// Available from libzmq 4\&.1\&.0\&. +CZMQ_EXPORT void + zsock_set_handshake_ivl (void *self, int handshake_ivl); + +// Get socket option `socks_proxy`\&. +// Available from libzmq 4\&.1\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_socks_proxy (void *self); + +// Set socket option `socks_proxy`\&. +// Available from libzmq 4\&.1\&.0\&. +CZMQ_EXPORT void + zsock_set_socks_proxy (void *self, const char *socks_proxy); + +// Set socket option `xpub_nodrop`\&. +// Available from libzmq 4\&.1\&.0\&. +CZMQ_EXPORT void + zsock_set_xpub_nodrop (void *self, int xpub_nodrop); + +// Set socket option `router_mandatory`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_router_mandatory (void *self, int router_mandatory); + +// Set socket option `probe_router`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_probe_router (void *self, int probe_router); + +// Set socket option `req_relaxed`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_req_relaxed (void *self, int req_relaxed); + +// Set socket option `req_correlate`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_req_correlate (void *self, int req_correlate); + +// Set socket option `conflate`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_conflate (void *self, int conflate); + +// Get socket option `zap_domain`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_zap_domain (void *self); + +// Set socket option `zap_domain`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_zap_domain (void *self, const char *zap_domain); + +// Get socket option `mechanism`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_mechanism (void *self); + +// Get socket option `plain_server`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_plain_server (void *self); + +// Set socket option `plain_server`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_plain_server (void *self, int plain_server); + +// Get socket option `plain_username`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_plain_username (void *self); + +// Set socket option `plain_username`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_plain_username (void *self, const char *plain_username); + +// Get socket option `plain_password`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_plain_password (void *self); + +// Set socket option `plain_password`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_plain_password (void *self, const char *plain_password); + +// Get socket option `curve_server`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_curve_server (void *self); + +// Set socket option `curve_server`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_curve_server (void *self, int curve_server); + +// Get socket option `curve_publickey`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_curve_publickey (void *self); + +// Set socket option `curve_publickey`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_curve_publickey (void *self, const char *curve_publickey); + +// Set socket option `curve_publickey` from 32\-octet binary +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); + +// Get socket option `curve_secretkey`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_curve_secretkey (void *self); + +// Set socket option `curve_secretkey`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_curve_secretkey (void *self, const char *curve_secretkey); + +// Set socket option `curve_secretkey` from 32\-octet binary +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); + +// Get socket option `curve_serverkey`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_curve_serverkey (void *self); + +// Set socket option `curve_serverkey`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_curve_serverkey (void *self, const char *curve_serverkey); + +// Set socket option `curve_serverkey` from 32\-octet binary +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); + +// Get socket option `gssapi_server`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_gssapi_server (void *self); + +// Set socket option `gssapi_server`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_gssapi_server (void *self, int gssapi_server); + +// Get socket option `gssapi_plaintext`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_gssapi_plaintext (void *self); + +// Set socket option `gssapi_plaintext`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); + +// Get socket option `gssapi_principal`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_gssapi_principal (void *self); + +// Set socket option `gssapi_principal`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_gssapi_principal (void *self, const char *gssapi_principal); + +// Get socket option `gssapi_service_principal`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_gssapi_service_principal (void *self); + +// Set socket option `gssapi_service_principal`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); + +// Get socket option `ipv6`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_ipv6 (void *self); + +// Set socket option `ipv6`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_ipv6 (void *self, int ipv6); + +// Get socket option `immediate`\&. +// Available from libzmq 4\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_immediate (void *self); + +// Set socket option `immediate`\&. +// Available from libzmq 4\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_immediate (void *self, int immediate); + +// Get socket option `type`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_type (void *self); + +// Get socket option `sndhwm`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_sndhwm (void *self); + +// Set socket option `sndhwm`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_sndhwm (void *self, int sndhwm); + +// Get socket option `rcvhwm`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_rcvhwm (void *self); + +// Set socket option `rcvhwm`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_rcvhwm (void *self, int rcvhwm); + +// Get socket option `affinity`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_affinity (void *self); + +// Set socket option `affinity`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_affinity (void *self, int affinity); + +// Set socket option `subscribe`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_subscribe (void *self, const char *subscribe); + +// Set socket option `unsubscribe`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_unsubscribe (void *self, const char *unsubscribe); + +// Get socket option `identity`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_identity (void *self); + +// Set socket option `identity`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_identity (void *self, const char *identity); + +// Get socket option `rate`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_rate (void *self); + +// Set socket option `rate`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_rate (void *self, int rate); + +// Get socket option `recovery_ivl`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_recovery_ivl (void *self); + +// Set socket option `recovery_ivl`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_recovery_ivl (void *self, int recovery_ivl); + +// Get socket option `sndbuf`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_sndbuf (void *self); + +// Set socket option `sndbuf`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_sndbuf (void *self, int sndbuf); + +// Get socket option `rcvbuf`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_rcvbuf (void *self); + +// Set socket option `rcvbuf`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_rcvbuf (void *self, int rcvbuf); + +// Get socket option `linger`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_linger (void *self); + +// Set socket option `linger`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_linger (void *self, int linger); + +// Get socket option `reconnect_ivl`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_reconnect_ivl (void *self); + +// Set socket option `reconnect_ivl`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_reconnect_ivl (void *self, int reconnect_ivl); + +// Get socket option `reconnect_ivl_max`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_reconnect_ivl_max (void *self); + +// Set socket option `reconnect_ivl_max`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); + +// Get socket option `backlog`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_backlog (void *self); + +// Set socket option `backlog`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_backlog (void *self, int backlog); + +// Get socket option `maxmsgsize`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_maxmsgsize (void *self); + +// Set socket option `maxmsgsize`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_maxmsgsize (void *self, int maxmsgsize); + +// Get socket option `multicast_hops`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_multicast_hops (void *self); + +// Set socket option `multicast_hops`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_multicast_hops (void *self, int multicast_hops); + +// Get socket option `rcvtimeo`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_rcvtimeo (void *self); + +// Set socket option `rcvtimeo`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_rcvtimeo (void *self, int rcvtimeo); + +// Get socket option `sndtimeo`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_sndtimeo (void *self); + +// Set socket option `sndtimeo`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_sndtimeo (void *self, int sndtimeo); + +// Set socket option `xpub_verbose`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_xpub_verbose (void *self, int xpub_verbose); + +// Get socket option `tcp_keepalive`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_tcp_keepalive (void *self); + +// Set socket option `tcp_keepalive`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_tcp_keepalive (void *self, int tcp_keepalive); + +// Get socket option `tcp_keepalive_idle`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_tcp_keepalive_idle (void *self); + +// Set socket option `tcp_keepalive_idle`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); + +// Get socket option `tcp_keepalive_cnt`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_tcp_keepalive_cnt (void *self); + +// Set socket option `tcp_keepalive_cnt`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); + +// Get socket option `tcp_keepalive_intvl`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_tcp_keepalive_intvl (void *self); + +// Set socket option `tcp_keepalive_intvl`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); + +// Get socket option `tcp_accept_filter`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_tcp_accept_filter (void *self); + +// Set socket option `tcp_accept_filter`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); + +// Get socket option `rcvmore`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_rcvmore (void *self); + +// Get socket option `fd`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT SOCKET + zsock_fd (void *self); + +// Get socket option `events`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_events (void *self); + +// Get socket option `last_endpoint`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zsock_last_endpoint (void *self); + +// Set socket option `router_raw`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_router_raw (void *self, int router_raw); + +// Get socket option `ipv4only`\&. +// Available from libzmq 3\&.0\&.0\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT int + zsock_ipv4only (void *self); + +// Set socket option `ipv4only`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_ipv4only (void *self, int ipv4only); + +// Set socket option `delay_attach_on_connect`\&. +// Available from libzmq 3\&.0\&.0\&. +CZMQ_EXPORT void + zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); + +// Self test of this class\&. +CZMQ_EXPORT void + zsock_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Create a SERVER socket\&. Default action is bind\&. +CZMQ_EXPORT zsock_t * + zsock_new_server (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a CLIENT socket\&. Default action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_client (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a RADIO socket\&. Default action is bind\&. +CZMQ_EXPORT zsock_t * + zsock_new_radio (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a DISH socket\&. Default action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_dish (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a GATHER socket\&. Default action is bind\&. +CZMQ_EXPORT zsock_t * + zsock_new_gather (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a SCATTER socket\&. Default action is connect\&. +CZMQ_EXPORT zsock_t * + zsock_new_scatter (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Return socket routing ID if any\&. This returns 0 if the socket is not +// of type ZMQ_SERVER or if no request was already received on it\&. +CZMQ_EXPORT uint32_t + zsock_routing_id (zsock_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on socket\&. The socket MUST be of type ZMQ_SERVER\&. +// This will be used when sending messages on the socket via the zsock API\&. +CZMQ_EXPORT void + zsock_set_routing_id (zsock_t *self, uint32_t routing_id); + +// *** Draft method, for development use, may change without warning *** +// Join a group for the RADIO\-DISH pattern\&. Call only on ZMQ_DISH\&. +// Returns 0 if OK, \-1 if failed\&. +CZMQ_EXPORT int + zsock_join (void *self, const char *group); + +// *** Draft method, for development use, may change without warning *** +// Leave a group for the RADIO\-DISH pattern\&. Call only on ZMQ_DISH\&. +// Returns 0 if OK, \-1 if failed\&. +CZMQ_EXPORT int + zsock_leave (void *self, const char *group); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zsock\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zsock class wraps the libzmq socket handle (a void *) with a proper structure that follows the CLASS rules for construction and destruction\&. Some zsock methods take a void * "polymorphic" reference, which can be either a zsock_t or a zactor_t reference, or a libzmq void *\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zsock\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zsock_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zsock_t *writer = zsock_new_push ("@tcp://127\&.0\&.0\&.1:5560"); +assert (writer); +assert (zsock_resolve (writer) != writer); +assert (streq (zsock_type_str (writer), "PUSH")); + +int rc; +#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (3, 2, 0)) +// Check unbind +rc = zsock_unbind (writer, "tcp://127\&.0\&.0\&.1:%d", 5560); +assert (rc == 0); + +// In some cases and especially when running under Valgrind, doing +// a bind immediately after an unbind causes an EADDRINUSE error\&. +// Even a short sleep allows the OS to release the port for reuse\&. +zclock_sleep (100); + +// Bind again +rc = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:%d", 5560); +assert (rc == 5560); +assert (streq (zsock_endpoint (writer), "tcp://127\&.0\&.0\&.1:5560")); +#endif + +zsock_t *reader = zsock_new_pull (">tcp://127\&.0\&.0\&.1:5560"); +assert (reader); +assert (zsock_resolve (reader) != reader); +assert (streq (zsock_type_str (reader), "PULL")); + +// Basic Hello, World +zstr_send (writer, "Hello, World"); +zmsg_t *msg = zmsg_recv (reader); +assert (msg); +char *string = zmsg_popstr (msg); +assert (streq (string, "Hello, World")); +free (string); +zmsg_destroy (&msg); + +// Test resolve libzmq socket +#if (ZMQ_VERSION >= ZMQ_MAKE_VERSION (3, 2, 0)) +void *zmq_ctx = zmq_ctx_new (); +#else +void *zmq_ctx = zmq_ctx_new (1); +#endif +assert (zmq_ctx); +void *zmq_sock = zmq_socket (zmq_ctx, ZMQ_PUB); +assert (zmq_sock); +assert (zsock_resolve (zmq_sock) == zmq_sock); +zmq_close (zmq_sock); +zmq_ctx_term (zmq_ctx); + +// Test resolve zsock +zsock_t *resolve = zsock_new_pub("@tcp://127\&.0\&.0\&.1:5561"); +assert (resolve); +assert (zsock_resolve (resolve) == resolve\->handle); +zsock_destroy (&resolve); + +// Test resolve FD +SOCKET fd = zsock_fd (reader); +assert (zsock_resolve ((void *) &fd) == NULL); + +// Test binding to ephemeral ports, sequential and random +int port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*"); +assert (port >= DYNAMIC_FIRST && port <= DYNAMIC_LAST); +port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*[50000\-]"); +assert (port >= 50000 && port <= DYNAMIC_LAST); +port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*[\-50001]"); +assert (port >= DYNAMIC_FIRST && port <= 50001); +port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:*[60000\-60050]"); +assert (port >= 60000 && port <= 60050); + +port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:!"); +assert (port >= DYNAMIC_FIRST && port <= DYNAMIC_LAST); +port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:![50000\-]"); +assert (port >= 50000 && port <= DYNAMIC_LAST); +port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:![\-50001]"); +assert (port >= DYNAMIC_FIRST && port <= 50001); +port = zsock_bind (writer, "tcp://127\&.0\&.0\&.1:![60000\-60050]"); +assert (port >= 60000 && port <= 60050); + +// Test zsock_attach method +zsock_t *server = zsock_new (ZMQ_DEALER); +assert (server); +rc = zsock_attach (server, "@inproc://myendpoint,tcp://127\&.0\&.0\&.1:5556,inproc://others", true); +assert (rc == 0); +rc = zsock_attach (server, "", false); +assert (rc == 0); +rc = zsock_attach (server, NULL, true); +assert (rc == 0); +rc = zsock_attach (server, ">a,@b, c,, ", false); +assert (rc == \-1); +zsock_destroy (&server); + +// Test zsock_endpoint method +rc = zsock_bind (writer, "inproc://test\&.%s", "writer"); +assert (rc == 0); +assert (streq (zsock_endpoint (writer), "inproc://test\&.writer")); + +// Test error state when connecting to an invalid socket type +// (\*(Aqtxp://\*(Aq instead of \*(Aqtcp://\*(Aq, typo intentional) +rc = zsock_connect (reader, "txp://127\&.0\&.0\&.1:5560"); +assert (rc == \-1); + +// Test signal/wait methods +rc = zsock_signal (writer, 123); +assert (rc == 0); +rc = zsock_wait (reader); +assert (rc == 123); + +// Test zsock_send/recv pictures +uint8_t number1 = 123; +uint16_t number2 = 123 * 123; +uint32_t number4 = 123 * 123; +number4 *= 123; +uint32_t number4_MAX = UINT32_MAX; +uint64_t number8 = 123 * 123; +number8 *= 123; +number8 *= 123; +uint64_t number8_MAX = UINT64_MAX; + +zchunk_t *chunk = zchunk_new ("HELLO", 5); +assert (chunk); +zframe_t *frame = zframe_new ("WORLD", 5); +assert (frame); +zhashx_t *hash = zhashx_new (); +assert (hash); +zuuid_t *uuid = zuuid_new (); +assert (uuid); +zhashx_set_destructor (hash, (zhashx_destructor_fn *) zstr_free); +zhashx_set_duplicator (hash, (zhashx_duplicator_fn *) strdup); +zhashx_insert (hash, "1", "value A"); +zhashx_insert (hash, "2", "value B"); +char *original = "pointer"; + +// Test zsock_recv into each supported type +zsock_send (writer, "i124488zsbcfUhp", + \-12345, number1, number2, number4, number4_MAX, + number8, number8_MAX, + "This is a string", "ABCDE", 5, + chunk, frame, uuid, hash, original); +char *uuid_str = strdup (zuuid_str (uuid)); +zchunk_destroy (&chunk); +zframe_destroy (&frame); +zuuid_destroy (&uuid); +zhashx_destroy (&hash); + +int integer; +byte *data; +size_t size; +char *pointer; +number8_MAX = number8 = number4_MAX = number4 = number2 = number1 = 0ULL; +rc = zsock_recv (reader, "i124488zsbcfUhp", + &integer, &number1, &number2, &number4, &number4_MAX, + &number8, &number8_MAX, &string, &data, &size, &chunk, + &frame, &uuid, &hash, &pointer); +assert (rc == 0); +assert (integer == \-12345); +assert (number1 == 123); +assert (number2 == 123 * 123); +assert (number4 == 123 * 123 * 123); +assert (number4_MAX == UINT32_MAX); +assert (number8 == 123 * 123 * 123 * 123); +assert (number8_MAX == UINT64_MAX); +assert (streq (string, "This is a string")); +assert (memcmp (data, "ABCDE", 5) == 0); +assert (size == 5); +assert (memcmp (zchunk_data (chunk), "HELLO", 5) == 0); +assert (zchunk_size (chunk) == 5); +assert (streq (uuid_str, zuuid_str (uuid))); +assert (memcmp (zframe_data (frame), "WORLD", 5) == 0); +assert (zframe_size (frame) == 5); +char *value = (char *) zhashx_lookup (hash, "1"); +assert (streq (value, "value A")); +value = (char *) zhashx_lookup (hash, "2"); +assert (streq (value, "value B")); +assert (original == pointer); +free (string); +free (data); +free (uuid_str); +zframe_destroy (&frame); +zchunk_destroy (&chunk); +zhashx_destroy (&hash); +zuuid_destroy (&uuid); + +// Test zsock_recv of short message; this lets us return a failure +// with a status code and then nothing else; the receiver will get +// the status code and NULL/zero for all other values +zsock_send (writer, "i", \-1); +zsock_recv (reader, "izsbcfp", + &integer, &string, &data, &size, &chunk, &frame, &pointer); +assert (integer == \-1); +assert (string == NULL); +assert (data == NULL); +assert (size == 0); +assert (chunk == NULL); +assert (frame == NULL); +assert (pointer == NULL); + +msg = zmsg_new (); +zmsg_addstr (msg, "frame 1"); +zmsg_addstr (msg, "frame 2"); +zsock_send (writer, "szm", "header", msg); +zmsg_destroy (&msg); + +zsock_recv (reader, "szm", &string, &msg); + +assert (streq ("header", string)); +assert (zmsg_size (msg) == 2); +assert (zframe_streq (zmsg_first (msg), "frame 1")); +assert (zframe_streq (zmsg_next (msg), "frame 2")); +zstr_free (&string); +zmsg_destroy (&msg); + +// Test zsock_recv with null arguments +chunk = zchunk_new ("HELLO", 5); +assert (chunk); +frame = zframe_new ("WORLD", 5); +assert (frame); +zsock_send (writer, "izsbcfp", + \-12345, "This is a string", "ABCDE", 5, chunk, frame, original); +zframe_destroy (&frame); +zchunk_destroy (&chunk); +zsock_recv (reader, "izsbcfp", &integer, NULL, NULL, NULL, &chunk, NULL, NULL); +assert (integer == \-12345); +assert (memcmp (zchunk_data (chunk), "HELLO", 5) == 0); +assert (zchunk_size (chunk) == 5); +zchunk_destroy (&chunk); + +// Test zsock_bsend/brecv pictures with binary encoding +frame = zframe_new ("Hello", 5); +chunk = zchunk_new ("World", 5); + +msg = zmsg_new (); +zmsg_addstr (msg, "Hello"); +zmsg_addstr (msg, "World"); + +zsock_bsend (writer, "1248sSpcfm", + number1, number2, number4, number8, + "Hello, World", + "Goodbye cruel World!", + original, + chunk, frame, msg); +zchunk_destroy (&chunk); +zframe_destroy (&frame); +zmsg_destroy (&msg); + +number8 = number4 = number2 = number1 = 0; +char *longstr; +zsock_brecv (reader, "1248sSpcfm", + &number1, &number2, &number4, &number8, + &string, &longstr, + &pointer, + &chunk, &frame, &msg); +assert (number1 == 123); +assert (number2 == 123 * 123); +assert (number4 == 123 * 123 * 123); +assert (number8 == 123 * 123 * 123 * 123); +assert (streq (string, "Hello, World")); +assert (streq (longstr, "Goodbye cruel World!")); +assert (pointer == original); +zstr_free (&longstr); +zchunk_destroy (&chunk); +zframe_destroy (&frame); +zmsg_destroy (&msg); + +#ifdef ZMQ_SERVER + +// Test zsock_bsend/brecv pictures with binary encoding on SERVER and CLIENT sockets +server = zsock_new_server ("tcp://127\&.0\&.0\&.1:5561"); +assert (server); +zsock_t* client = zsock_new_client ("tcp://127\&.0\&.0\&.1:5561"); +assert (client); + +// From client to server +chunk = zchunk_new ("World", 5); +zsock_bsend (client, "1248sSpc", + number1, number2, number4, number8, + "Hello, World", + "Goodbye cruel World!", + original, + chunk); +zchunk_destroy (&chunk); + +number8 = number4 = number2 = number1 = 0; +zsock_brecv (server, "1248sSpc", + &number1, &number2, &number4, &number8, + &string, &longstr, + &pointer, + &chunk); +assert (number1 == 123); +assert (number2 == 123 * 123); +assert (number4 == 123 * 123 * 123); +assert (number8 == 123 * 123 * 123 * 123); +assert (streq (string, "Hello, World")); +assert (streq (longstr, "Goodbye cruel World!")); +assert (pointer == original); +assert (zsock_routing_id (server)); +zstr_free (&longstr); +zchunk_destroy (&chunk); + +// From server to client +chunk = zchunk_new ("World", 5); +zsock_bsend (server, "1248sSpc", + number1, number2, number4, number8, + "Hello, World", + "Goodbye cruel World!", + original, + chunk); +zchunk_destroy (&chunk); + +number8 = number4 = number2 = number1 = 0; +zsock_brecv (client, "1248sSpc", + &number1, &number2, &number4, &number8, + &string, &longstr, + &pointer, + &chunk); +assert (number1 == 123); +assert (number2 == 123 * 123); +assert (number4 == 123 * 123 * 123); +assert (number8 == 123 * 123 * 123 * 123); +assert (streq (string, "Hello, World")); +assert (streq (longstr, "Goodbye cruel World!")); +assert (pointer == original); +assert (zsock_routing_id (client) == 0); +zstr_free (&longstr); +zchunk_destroy (&chunk); + +zsock_destroy (&client); +zsock_destroy (&server); + +#endif + +#ifdef ZMQ_SCATTER + +zsock_t* gather = zsock_new_gather ("inproc://test\-gather\-scatter"); +assert (gather); +zsock_t* scatter = zsock_new_scatter ("inproc://test\-gather\-scatter"); +assert (scatter); + +rc = zstr_send (scatter, "HELLO"); +assert (rc == 0); + +char* message; +message = zstr_recv (gather); +assert (streq(message, "HELLO")); +zstr_free (&message); + +zsock_destroy (&gather); +zsock_destroy (&scatter); + +#endif + +// Check that we can send a zproto format message +zsock_bsend (writer, "1111sS4", 0xAA, 0xA0, 0x02, 0x01, "key", "value", 1234); +zgossip_msg_t *gossip = zgossip_msg_new (); +zgossip_msg_recv (gossip, reader); +assert (zgossip_msg_id (gossip) == ZGOSSIP_MSG_PUBLISH); +zgossip_msg_destroy (&gossip); + +zsock_destroy (&reader); +zsock_destroy (&writer); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zstr.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zstr.3 new file mode 100644 index 00000000000000..c4ea4275458c67 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zstr.3 @@ -0,0 +1,242 @@ +'\" t +.\" Title: zstr +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZSTR" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zstr \- sending and receiving strings +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// This class has draft methods, which may change over time\&. They are not +// in stable releases, by default\&. Use \-\-enable\-drafts to enable\&. +// Receive C string from socket\&. Caller must free returned string using +// zstr_free()\&. Returns NULL if the context is being terminated or the +// process was interrupted\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zstr_recv (void *source); + +// Receive a series of strings (until NULL) from multipart data\&. +// Each string is allocated and filled with string data; if there +// are not enough frames, unallocated strings are set to NULL\&. +// Returns \-1 if the message could not be read, else returns the +// number of strings filled, zero or more\&. Free each returned string +// using zstr_free()\&. If not enough strings are provided, remaining +// multipart frames in the message are dropped\&. +CZMQ_EXPORT int + zstr_recvx (void *source, char **string_p, \&.\&.\&.); + +// Send a C string to a socket, as a frame\&. The string is sent without +// trailing null byte; to read this you can use zstr_recv, or a similar +// method that adds a null terminator on the received string\&. String +// may be NULL, which is sent as ""\&. +CZMQ_EXPORT int + zstr_send (void *dest, const char *string); + +// Send a C string to a socket, as zstr_send(), with a MORE flag, so that +// you can send further strings in the same multi\-part message\&. +CZMQ_EXPORT int + zstr_sendm (void *dest, const char *string); + +// Send a formatted string to a socket\&. Note that you should NOT use +// user\-supplied strings in the format (they may contain \*(Aq%\*(Aq which +// will create security holes)\&. +CZMQ_EXPORT int + zstr_sendf (void *dest, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Send a formatted string to a socket, as for zstr_sendf(), with a +// MORE flag, so that you can send further strings in the same multi\-part +// message\&. +CZMQ_EXPORT int + zstr_sendfm (void *dest, const char *format, \&.\&.\&.) CHECK_PRINTF (2); + +// Send a series of strings (until NULL) as multipart data +// Returns 0 if the strings could be sent OK, or \-1 on error\&. +CZMQ_EXPORT int + zstr_sendx (void *dest, const char *string, \&.\&.\&.); + +// Free a provided string, and nullify the parent pointer\&. Safe to call on +// a null pointer\&. +CZMQ_EXPORT void + zstr_free (char **string_p); + +// Self test of this class\&. +CZMQ_EXPORT void + zstr_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Accepts a void pointer and returns a fresh character string\&. If source +// is null, returns an empty string\&. +// Caller owns return value and must destroy it when done\&. +CZMQ_EXPORT char * + zstr_str (void *source); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zstr\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zstr class provides utility functions for sending and receiving C strings across 0MQ sockets\&. It sends strings without a terminating null, and appends a null byte on received strings\&. This class is for simple message sending\&. +.sp +.if n \{\ +.RS 4 +.\} +.nf + Memory Wire + +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +Send | S t r i n g | 0 | \-\-\-\-> | 6 | S t r i n g | + +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf + Wire Heap + +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ +Recv | 6 | S t r i n g | \-\-\-\-> | S t r i n g | 0 | + +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-+ +.fi +.if n \{\ +.RE +.\} +.SH "EXAMPLE" +.PP +\fBFrom zstr_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create two PAIR sockets and connect over inproc +zsock_t *output = zsock_new_pair ("@inproc://zstr\&.test"); +assert (output); +zsock_t *input = zsock_new_pair (">inproc://zstr\&.test"); +assert (input); + +// Send ten strings, five strings with MORE flag and then END +int string_nbr; +for (string_nbr = 0; string_nbr < 10; string_nbr++) + zstr_sendf (output, "this is string %d", string_nbr); +zstr_sendx (output, "This", "is", "almost", "the", "very", "END", NULL); + +// Read and count until we receive END +string_nbr = 0; +for (string_nbr = 0;; string_nbr++) { + char *string = zstr_recv (input); + assert (string); + if (streq (string, "END")) { + zstr_free (&string); + break; + } + zstr_free (&string); +} +assert (string_nbr == 15); + +zsock_destroy (&input); +zsock_destroy (&output); + +#if defined (ZMQ_SERVER) +// Test SERVER/CLIENT over zstr +zsock_t *server = zsock_new_server ("inproc://zstr\-test\-routing"); +zsock_t *client = zsock_new_client ("inproc://zstr\-test\-routing");; +assert (server); +assert (client); + +// Try normal ping\-pong to check reply routing ID +int rc = zstr_send (client, "Hello"); +assert (rc == 0); +char *request = zstr_recv (server); +assert (streq (request, "Hello")); +assert (zsock_routing_id (server)); +free (request); + +rc = zstr_send (server, "World"); +assert (rc == 0); +char *reply = zstr_recv (client); +assert (streq (reply, "World")); +free (reply); + +rc = zstr_sendf (server, "%s", "World"); +assert (rc == 0); +reply = zstr_recv (client); +assert (streq (reply, "World")); +free (reply); + +// Try ping\-pong using sendx and recx +rc = zstr_sendx (client, "Hello", NULL); +assert (rc == 0); +rc = zstr_recvx (server, &request, NULL); +assert (rc >= 0); +assert (streq (request, "Hello")); +free (request); + +rc = zstr_sendx (server, "World", NULL); +assert (rc == 0); +rc = zstr_recvx (client, &reply, NULL); +assert (rc >= 0); +assert (streq (reply, "World")); +free (reply); + +// Client and server disallow multipart +rc = zstr_sendm (client, "Hello"); +assert (rc == \-1); +rc = zstr_sendm (server, "World"); +assert (rc == \-1); + +zsock_destroy (&client); +zsock_destroy (&server); +#endif +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zsys.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zsys.3 new file mode 100644 index 00000000000000..2d4f5c2e45616d --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zsys.3 @@ -0,0 +1,539 @@ +'\" t +.\" Title: zsys +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZSYS" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zsys \- system\-level methods +.SH "SYNOPSIS" +.sp +.nf +#define UDP_FRAME_MAX 255 // Max size of UDP frame + +// Callback for interrupt signal handler +typedef void (zsys_handler_fn) (int signal_value); + +// Initialize CZMQ zsys layer; this happens automatically when you create +// a socket or an actor; however this call lets you force initialization +// earlier, so e\&.g\&. logging is properly set\-up before you start working\&. +// Not threadsafe, so call only from main thread\&. Safe to call multiple +// times\&. Returns global CZMQ context\&. +CZMQ_EXPORT void * + zsys_init (void); + +// Optionally shut down the CZMQ zsys layer; this normally happens automatically +// when the process exits; however this call lets you force a shutdown +// earlier, avoiding any potential problems with atexit() ordering, especially +// with Windows dlls\&. +CZMQ_EXPORT void + zsys_shutdown (void); + +// Get a new ZMQ socket, automagically creating a ZMQ context if this is +// the first time\&. Caller is responsible for destroying the ZMQ socket +// before process exits, to avoid a ZMQ deadlock\&. Note: you should not use +// this method in CZMQ apps, use zsock_new() instead\&. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void * + zsys_socket (int type, const char *filename, size_t line_nbr); + +// Destroy/close a ZMQ socket\&. You should call this for every socket you +// create using zsys_socket()\&. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_close (void *handle, const char *filename, size_t line_nbr); + +// Return ZMQ socket name for socket type +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT char * + zsys_sockname (int socktype); + +// Create a pipe, which consists of two PAIR sockets connected over inproc\&. +// The pipe is configured to use the zsys_pipehwm setting\&. Returns the +// frontend socket successful, NULL if failed\&. +CZMQ_EXPORT zsock_t * + zsys_create_pipe (zsock_t **backend_p); + +// Set interrupt handler; this saves the default handlers so that a +// zsys_handler_reset () can restore them\&. If you call this multiple times +// then the last handler will take affect\&. If handler_fn is NULL, disables +// default SIGINT/SIGTERM handling in CZMQ\&. +CZMQ_EXPORT void + zsys_handler_set (zsys_handler_fn *handler_fn); + +// Reset interrupt handler, call this at exit if needed +CZMQ_EXPORT void + zsys_handler_reset (void); + +// Set default interrupt handler, so Ctrl\-C or SIGTERM will set +// zsys_interrupted\&. Idempotent; safe to call multiple times\&. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void + zsys_catch_interrupts (void); + +// Return 1 if file exists, else zero +CZMQ_EXPORT bool + zsys_file_exists (const char *filename); + +// Return size of file, or \-1 if not found +CZMQ_EXPORT ssize_t + zsys_file_size (const char *filename); + +// Return file modification time\&. Returns 0 if the file does not exist\&. +CZMQ_EXPORT time_t + zsys_file_modified (const char *filename); + +// Return file mode; provides at least support for the POSIX S_ISREG(m) +// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes\&. +// Returns a mode_t cast to int, or \-1 in case of error\&. +CZMQ_EXPORT int + zsys_file_mode (const char *filename); + +// Delete file\&. Does not complain if the file is absent +CZMQ_EXPORT int + zsys_file_delete (const char *filename); + +// Check if file is \*(Aqstable\*(Aq +CZMQ_EXPORT bool + zsys_file_stable (const char *filename); + +// Create a file path if it doesn\*(Aqt exist\&. The file path is treated as a +// printf format\&. +CZMQ_EXPORT int + zsys_dir_create (const char *pathname, \&.\&.\&.); + +// Remove a file path if empty; the pathname is treated as printf format\&. +CZMQ_EXPORT int + zsys_dir_delete (const char *pathname, \&.\&.\&.); + +// Move to a specified working directory\&. Returns 0 if OK, \-1 if this failed\&. +CZMQ_EXPORT int + zsys_dir_change (const char *pathname); + +// Set private file creation mode; all files created from here will be +// readable/writable by the owner only\&. +CZMQ_EXPORT void + zsys_file_mode_private (void); + +// Reset default file creation mode; all files created from here will use +// process file mode defaults\&. +CZMQ_EXPORT void + zsys_file_mode_default (void); + +// Return the CZMQ version for run\-time API detection; returns version +// number into provided fields, providing reference isn\*(Aqt null in each case\&. +CZMQ_EXPORT void + zsys_version (int *major, int *minor, int *patch); + +// Format a string using printf formatting, returning a freshly allocated +// buffer\&. If there was insufficient memory, returns NULL\&. Free the returned +// string using zstr_free()\&. +CZMQ_EXPORT char * + zsys_sprintf (const char *format, \&.\&.\&.); + +// Format a string with a va_list argument, returning a freshly allocated +// buffer\&. If there was insufficient memory, returns NULL\&. Free the returned +// string using zstr_free()\&. +CZMQ_EXPORT char * + zsys_vprintf (const char *format, va_list argptr); + +// Create UDP beacon socket; if the routable option is true, uses +// multicast (not yet implemented), else uses broadcast\&. This method +// and related ones might _eventually_ be moved to a zudp class\&. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT SOCKET + zsys_udp_new (bool routable); + +// Close a UDP socket +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_udp_close (SOCKET handle); + +// Send zframe to UDP socket, return \-1 if sending failed due to +// interface having disappeared (happens easily with WiFi) +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); + +// Receive zframe from UDP socket, and set address of peer that sent it +// The peername must be a char [INET_ADDRSTRLEN] array\&. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT zframe_t * + zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); + +// Handle an I/O error on some socket operation; will report and die on +// fatal errors, and continue silently on "try again" errors\&. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void + zsys_socket_error (const char *reason); + +// Return current host name, for use in public tcp:// endpoints\&. Caller gets +// a freshly allocated string, should free it using zstr_free()\&. If the host +// name is not resolvable, returns NULL\&. +CZMQ_EXPORT char * + zsys_hostname (void); + +// Move the current process into the background\&. The precise effect depends +// on the operating system\&. On POSIX boxes, moves to a specified working +// directory (if specified), closes all file handles, reopens stdin, stdout, +// and stderr to the null device, and sets the process to ignore SIGHUP\&. On +// Windows, does nothing\&. Returns 0 if OK, \-1 if there was an error\&. +CZMQ_EXPORT int + zsys_daemonize (const char *workdir); + +// Drop the process ID into the lockfile, with exclusive lock, and switch +// the process to the specified group and/or user\&. Any of the arguments +// may be null, indicating a no\-op\&. Returns 0 on success, \-1 on failure\&. +// Note if you combine this with zsys_daemonize, run after, not before +// that method, or the lockfile will hold the wrong process ID\&. +CZMQ_EXPORT int + zsys_run_as (const char *lockfile, const char *group, const char *user); + +// Returns true if the underlying libzmq supports CURVE security\&. +// Uses a heuristic probe according to the version of libzmq being used\&. +CZMQ_EXPORT bool + zsys_has_curve (void); + +// Configure the number of I/O threads that ZeroMQ will use\&. A good +// rule of thumb is one thread per gigabit of traffic in or out\&. The +// default is 1, sufficient for most applications\&. If the environment +// variable ZSYS_IO_THREADS is defined, that provides the default\&. +// Note that this method is valid only before any socket is created\&. +CZMQ_EXPORT void + zsys_set_io_threads (size_t io_threads); + +// Configure the number of sockets that ZeroMQ will allow\&. The default +// is 1024\&. The actual limit depends on the system, and you can query it +// by using zsys_socket_limit ()\&. A value of zero means "maximum"\&. +// Note that this method is valid only before any socket is created\&. +CZMQ_EXPORT void + zsys_set_max_sockets (size_t max_sockets); + +// Return maximum number of ZeroMQ sockets that the system will support\&. +CZMQ_EXPORT size_t + zsys_socket_limit (void); + +// Configure the maximum allowed size of a message sent\&. +// The default is INT_MAX\&. +CZMQ_EXPORT void + zsys_set_max_msgsz (int max_msgsz); + +// Return maximum message size\&. +CZMQ_EXPORT int + zsys_max_msgsz (void); + +// Configure the default linger timeout in msecs for new zsock instances\&. +// You can also set this separately on each zsock_t instance\&. The default +// linger time is zero, i\&.e\&. any pending messages will be dropped\&. If the +// environment variable ZSYS_LINGER is defined, that provides the default\&. +// Note that process exit will typically be delayed by the linger time\&. +CZMQ_EXPORT void + zsys_set_linger (size_t linger); + +// Configure the default outgoing pipe limit (HWM) for new zsock instances\&. +// You can also set this separately on each zsock_t instance\&. The default +// HWM is 1,000, on all versions of ZeroMQ\&. If the environment variable +// ZSYS_SNDHWM is defined, that provides the default\&. Note that a value of +// zero means no limit, i\&.e\&. infinite memory consumption\&. +CZMQ_EXPORT void + zsys_set_sndhwm (size_t sndhwm); + +// Configure the default incoming pipe limit (HWM) for new zsock instances\&. +// You can also set this separately on each zsock_t instance\&. The default +// HWM is 1,000, on all versions of ZeroMQ\&. If the environment variable +// ZSYS_RCVHWM is defined, that provides the default\&. Note that a value of +// zero means no limit, i\&.e\&. infinite memory consumption\&. +CZMQ_EXPORT void + zsys_set_rcvhwm (size_t rcvhwm); + +// Configure the default HWM for zactor internal pipes; this is set on both +// ends of the pipe, for outgoing messages only (sndhwm)\&. The default HWM is +// 1,000, on all versions of ZeroMQ\&. If the environment var ZSYS_ACTORHWM is +// defined, that provides the default\&. Note that a value of zero means no +// limit, i\&.e\&. infinite memory consumption\&. +CZMQ_EXPORT void + zsys_set_pipehwm (size_t pipehwm); + +// Return the HWM for zactor internal pipes\&. +CZMQ_EXPORT size_t + zsys_pipehwm (void); + +// Configure use of IPv6 for new zsock instances\&. By default sockets accept +// and make only IPv4 connections\&. When you enable IPv6, sockets will accept +// and connect to both IPv4 and IPv6 peers\&. You can override the setting on +// each zsock_t instance\&. The default is IPv4 only (ipv6 set to 0)\&. If the +// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the +// default\&. Note: has no effect on ZMQ v2\&. +CZMQ_EXPORT void + zsys_set_ipv6 (int ipv6); + +// Return use of IPv6 for zsock instances\&. +CZMQ_EXPORT int + zsys_ipv6 (void); + +// Set network interface name to use for broadcasts, particularly zbeacon\&. +// This lets the interface be configured for test environments where required\&. +// For example, on Mac OS X, zbeacon cannot bind to 255\&.255\&.255\&.255 which is +// the default when there is no specified interface\&. If the environment +// variable ZSYS_INTERFACE is set, use that as the default interface name\&. +// Setting the interface to "*" means "use all available interfaces"\&. +CZMQ_EXPORT void + zsys_set_interface (const char *value); + +// Return network interface to use for broadcasts, or "" if none was set\&. +CZMQ_EXPORT const char * + zsys_interface (void); + +// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon\&. +// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses +// on a given interface\&. If the environment variable ZSYS_IPV6_ADDRESS is set, +// use that as the default IPv6 address\&. +CZMQ_EXPORT void + zsys_set_ipv6_address (const char *value); + +// Return IPv6 address to use for zbeacon reception, or "" if none was set\&. +CZMQ_EXPORT const char * + zsys_ipv6_address (void); + +// Set IPv6 milticast address to use for sending zbeacon messages\&. This needs +// to be set if IPv6 is enabled\&. If the environment variable +// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast +// address\&. +CZMQ_EXPORT void + zsys_set_ipv6_mcast_address (const char *value); + +// Return IPv6 multicast address to use for sending zbeacon, or "" if none was +// set\&. +CZMQ_EXPORT const char * + zsys_ipv6_mcast_address (void); + +// Configure the automatic use of pre\-allocated FDs when creating new sockets\&. +// If 0 (default), nothing will happen\&. Else, when a new socket is bound, the +// system API will be used to check if an existing pre\-allocated FD with a +// matching port (if TCP) or path (if IPC) exists, and if it does it will be +// set via the ZMQ_USE_FD socket option so that the library will use it +// instead of creating a new socket\&. +CZMQ_EXPORT void + zsys_set_auto_use_fd (int auto_use_fd); + +// Return use of automatic pre\-allocated FDs for zsock instances\&. +CZMQ_EXPORT int + zsys_auto_use_fd (void); + +// Set log identity, which is a string that prefixes all log messages sent +// by this process\&. The log identity defaults to the environment variable +// ZSYS_LOGIDENT, if that is set\&. +CZMQ_EXPORT void + zsys_set_logident (const char *value); + +// Set stream to receive log traffic\&. By default, log traffic is sent to +// stdout\&. If you set the stream to NULL, no stream will receive the log +// traffic (it may still be sent to the system facility)\&. +CZMQ_EXPORT void + zsys_set_logstream (FILE *stream); + +// Sends log output to a PUB socket bound to the specified endpoint\&. To +// collect such log output, create a SUB socket, subscribe to the traffic +// you care about, and connect to the endpoint\&. Log traffic is sent as a +// single string frame, in the same format as when sent to stdout\&. The +// log system supports a single sender; multiple calls to this method will +// bind the same sender to multiple endpoints\&. To disable the sender, call +// this method with a null argument\&. +CZMQ_EXPORT void + zsys_set_logsender (const char *endpoint); + +// Enable or disable logging to the system facility (syslog on POSIX boxes, +// event log on Windows)\&. By default this is disabled\&. +CZMQ_EXPORT void + zsys_set_logsystem (bool logsystem); + +// Log error condition \- highest priority +CZMQ_EXPORT void + zsys_error (const char *format, \&.\&.\&.); + +// Log warning condition \- high priority +CZMQ_EXPORT void + zsys_warning (const char *format, \&.\&.\&.); + +// Log normal, but significant, condition \- normal priority +CZMQ_EXPORT void + zsys_notice (const char *format, \&.\&.\&.); + +// Log informational message \- low priority +CZMQ_EXPORT void + zsys_info (const char *format, \&.\&.\&.); + +// Log debug\-level message \- lowest priority +CZMQ_EXPORT void + zsys_debug (const char *format, \&.\&.\&.); + +// Self test of this class +CZMQ_EXPORT void + zsys_test (bool verbose); + +// Global signal indicator, TRUE when user presses Ctrl\-C or the process +// gets a SIGTERM signal\&. +CZMQ_EXPORT extern volatile int zsys_interrupted; +// Deprecated name for this variable +CZMQ_EXPORT extern volatile int zctx_interrupted; +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zsys\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zsys class provides a portable wrapper for system calls\&. We collect them here to reduce the number of weird #ifdefs in other classes\&. As far as possible, the bulk of CZMQ classes are fully portable\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zsys\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zsys_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +zsys_catch_interrupts (); + +// Check capabilities without using the return value +int rc = zsys_has_curve (); + +if (verbose) { + char *hostname = zsys_hostname (); + zsys_info ("host name is %s", hostname); + free (hostname); + zsys_info ("system limit is %zu ZeroMQ sockets", zsys_socket_limit ()); +} +zsys_set_linger (0); +zsys_set_sndhwm (1000); +zsys_set_rcvhwm (1000); +zsys_set_pipehwm (2500); +assert (zsys_pipehwm () == 2500); +zsys_set_ipv6 (0); + +// Test pipe creation +zsock_t *pipe_back; +zsock_t *pipe_front = zsys_create_pipe (&pipe_back); +zstr_send (pipe_front, "Hello"); +char *string = zstr_recv (pipe_back); +assert (streq (string, "Hello")); +free (string); +zsock_destroy (&pipe_back); +zsock_destroy (&pipe_front); + +// Test file manipulation +rc = zsys_file_delete ("nosuchfile"); +assert (rc == \-1); + +bool rc_bool = zsys_file_exists ("nosuchfile"); +assert (rc_bool != true); + +rc = (int) zsys_file_size ("nosuchfile"); +assert (rc == \-1); + +time_t when = zsys_file_modified ("\&."); +assert (when > 0); + +int mode = zsys_file_mode ("\&."); +assert (S_ISDIR (mode)); +assert (mode & S_IRUSR); +assert (mode & S_IWUSR); + +zsys_file_mode_private (); +rc = zsys_dir_create ("%s/%s", "\&.", "\&.testsys/subdir"); +assert (rc == 0); +when = zsys_file_modified ("\&./\&.testsys/subdir"); +assert (when > 0); +assert (!zsys_file_stable ("\&./\&.testsys/subdir")); +rc = zsys_dir_delete ("%s/%s", "\&.", "\&.testsys/subdir"); +assert (rc == 0); +rc = zsys_dir_delete ("%s/%s", "\&.", "\&.testsys"); +assert (rc == 0); +zsys_file_mode_default (); +assert (zsys_dir_change ("\&.") == 0); + +int major, minor, patch; +zsys_version (&major, &minor, &patch); +assert (major == CZMQ_VERSION_MAJOR); +assert (minor == CZMQ_VERSION_MINOR); +assert (patch == CZMQ_VERSION_PATCH); + +string = zsys_sprintf ("%s %02x", "Hello", 16); +assert (streq (string, "Hello 10")); +free (string); + +char *str64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,\&."; +int num10 = 1234567890; +string = zsys_sprintf ("%s%s%s%s%d", str64, str64, str64, str64, num10); +assert (strlen (string) == (4 * 64 + 10)); +free (string); + +// Test logging system +zsys_set_logident ("czmq_selftest"); +zsys_set_logsender ("inproc://logging"); +void *logger = zsys_socket (ZMQ_SUB, NULL, 0); +assert (logger); +rc = zmq_connect (logger, "inproc://logging"); +assert (rc == 0); +rc = zmq_setsockopt (logger, ZMQ_SUBSCRIBE, "", 0); +assert (rc == 0); + +if (verbose) { + zsys_error ("This is an %s message", "error"); + zsys_warning ("This is a %s message", "warning"); + zsys_notice ("This is a %s message", "notice"); + zsys_info ("This is a %s message", "info"); + zsys_debug ("This is a %s message", "debug"); + zsys_set_logident ("hello, world"); + zsys_info ("This is a %s message", "info"); + zsys_debug ("This is a %s message", "debug"); + + // Check that logsender functionality is working + char *received = zstr_recv (logger); + assert (received); + zstr_free (&received); +} +zsys_close (logger, NULL, 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/ztimerset.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/ztimerset.3 new file mode 100644 index 00000000000000..1eaa5ab949caaf --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/ztimerset.3 @@ -0,0 +1,180 @@ +'\" t +.\" Title: ztimerset +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZTIMERSET" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +ztimerset \- timer set +.SH "SYNOPSIS" +.sp +.nf +// This is a draft class, and may change without notice\&. It is disabled in +// stable builds by default\&. If you use this in applications, please ask +// for it to be pushed to stable state\&. Use \-\-enable\-drafts to enable\&. +#ifdef CZMQ_BUILD_DRAFT_API +// Callback function for timer event\&. +typedef void (ztimerset_fn) ( + int timer_id, void *arg); + +// *** Draft method, for development use, may change without warning *** +// Create new timer set\&. +CZMQ_EXPORT ztimerset_t * + ztimerset_new (void); + +// *** Draft method, for development use, may change without warning *** +// Destroy a timer set +CZMQ_EXPORT void + ztimerset_destroy (ztimerset_t **self_p); + +// *** Draft method, for development use, may change without warning *** +// Add a timer to the set\&. Returns timer id if OK, \-1 on failure\&. +CZMQ_EXPORT int + ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); + +// *** Draft method, for development use, may change without warning *** +// Cancel a timer\&. Returns 0 if OK, \-1 on failure\&. +CZMQ_EXPORT int + ztimerset_cancel (ztimerset_t *self, int timer_id); + +// *** Draft method, for development use, may change without warning *** +// Set timer interval\&. Returns 0 if OK, \-1 on failure\&. +// This method is slow, canceling the timer and adding a new one yield better performance\&. +CZMQ_EXPORT int + ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); + +// *** Draft method, for development use, may change without warning *** +// Reset timer to start interval counting from current time\&. Returns 0 if OK, \-1 on failure\&. +// This method is slow, canceling the timer and adding a new one yield better performance\&. +CZMQ_EXPORT int + ztimerset_reset (ztimerset_t *self, int timer_id); + +// *** Draft method, for development use, may change without warning *** +// Return the time until the next interval\&. +// Should be used as timeout parameter for the zpoller wait method\&. +// The timeout is in msec\&. +CZMQ_EXPORT int + ztimerset_timeout (ztimerset_t *self); + +// *** Draft method, for development use, may change without warning *** +// Invoke callback function of all timers which their interval has elapsed\&. +// Should be call after zpoller wait method\&. +// Returns 0 if OK, \-1 on failure\&. +CZMQ_EXPORT int + ztimerset_execute (ztimerset_t *self); + +// *** Draft method, for development use, may change without warning *** +// Self test of this class\&. +CZMQ_EXPORT void + ztimerset_test (bool verbose); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/ztimerset\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +ztimerset \- timer set +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/ztimerset\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom ztimerset_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Simple create/destroy test +ztimerset_t *self = ztimerset_new (); +assert (self); + +// Adding timer +bool timer_invoked = false; +int timer_id = ztimerset_add (self, 100, handler, &timer_invoked); +assert (timer_id != \-1); +int rc = ztimerset_execute (self); +assert (rc == 0); +assert (!timer_invoked); +int timeout = ztimerset_timeout (self); +assert (timeout > 0); +zclock_sleep (timeout); +rc = ztimerset_execute (self); +assert (rc == 0); +assert (timer_invoked); + +// Cancel timer +timeout = ztimerset_timeout (self); +assert (timeout > 0); +rc = ztimerset_cancel (self, timer_id); +assert (rc == 0); +timeout = ztimerset_timeout (self); +assert(timeout == \-1); + +// Reset a timer +timer_id = ztimerset_add (self, 100, handler, &timer_invoked); +assert (timer_id != \-1); +timeout = ztimerset_timeout (self); +assert (timeout > 0); +zclock_sleep (timeout / 2); +timeout = ztimerset_timeout (self); +rc = ztimerset_reset(self, timer_id); +assert (rc == 0); +int timeout2 = ztimerset_timeout (self); +assert (timeout2 > timeout); +rc = ztimerset_cancel (self, timer_id); +assert (rc == 0); + +// Set interval +timer_id = ztimerset_add (self, 100, handler, &timer_invoked); +assert (timer_id != \-1); +timeout = ztimerset_timeout (self); +rc = ztimerset_set_interval(self, timer_id, 200); +timeout2 = ztimerset_timeout (self); +assert (timeout2 > timeout); + +ztimerset_destroy (&self); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/ztrie.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/ztrie.3 new file mode 100644 index 00000000000000..6cfb401a344658 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/ztrie.3 @@ -0,0 +1,292 @@ +'\" t +.\" Title: ztrie +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZTRIE" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +ztrie \- simple trie for tokenizable strings +.SH "SYNOPSIS" +.sp +.nf +// This is a draft class, and may change without notice\&. It is disabled in +// stable builds by default\&. If you use this in applications, please ask +// for it to be pushed to stable state\&. Use \-\-enable\-drafts to enable\&. +#ifdef CZMQ_BUILD_DRAFT_API +// Callback function for ztrie_node to destroy node data\&. +typedef void (ztrie_destroy_data_fn) ( + void **data); + +// *** Draft method, for development use, may change without warning *** +// Creates a new ztrie\&. +CZMQ_EXPORT ztrie_t * + ztrie_new (char delimiter); + +// *** Draft method, for development use, may change without warning *** +// Destroy the ztrie\&. +CZMQ_EXPORT void + ztrie_destroy (ztrie_t **self_p); + +// *** Draft method, for development use, may change without warning *** +// Inserts a new route into the tree and attaches the data\&. Returns \-1 +// if the route already exists, otherwise 0\&. This method takes ownership of +// the provided data if a destroy_data_fn is provided\&. +CZMQ_EXPORT int + ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); + +// *** Draft method, for development use, may change without warning *** +// Removes a route from the trie and destroys its data\&. Returns \-1 if the +// route does not exists, otherwise 0\&. +// the start of the list call zlist_first ()\&. Advances the cursor\&. +CZMQ_EXPORT int + ztrie_remove_route (ztrie_t *self, const char *path); + +// *** Draft method, for development use, may change without warning *** +// Returns true if the path matches a route in the tree, otherwise false\&. +CZMQ_EXPORT bool + ztrie_matches (ztrie_t *self, const char *path); + +// *** Draft method, for development use, may change without warning *** +// Returns the data of a matched route from last ztrie_matches\&. If the path +// did not match, returns NULL\&. Do not delete the data as it\*(Aqs owned by +// ztrie\&. +CZMQ_EXPORT void * + ztrie_hit_data (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Returns the count of parameters that a matched route has\&. +CZMQ_EXPORT size_t + ztrie_hit_parameter_count (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Returns the parameters of a matched route with named regexes from last +// ztrie_matches\&. If the path did not match or the route did not contain any +// named regexes, returns NULL\&. +CZMQ_EXPORT zhashx_t * + ztrie_hit_parameters (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Returns the asterisk matched part of a route, if there has been no match +// or no asterisk match, returns NULL\&. +CZMQ_EXPORT const char * + ztrie_hit_asterisk_match (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Print the trie +CZMQ_EXPORT void + ztrie_print (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Self test of this class\&. +CZMQ_EXPORT void + ztrie_test (bool verbose); + +#endif // CZMQ_BUILD_DRAFT_API +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/ztrie\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +This is a variant of a trie or prefix tree where all the descendants of a node have a common prefix of the string associated with that node\&. This implementation is specialized for strings that can be tokenized by a delimiter like a URL, URI or URN\&. Routes in the tree can be matched by regular expressions and by using capturing groups parts of a matched route can be easily obtained\&. +.sp +Note that the performance for pure string based matching is okay but on short strings zhash and zhashx are 3\-4 times faster\&. +.SH "EXAMPLE" +.PP +\fBFrom ztrie_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Create a new trie for matching strings that can be tokenized by a slash +// (e\&.g\&. URLs minus the protocol, address and port)\&. +ztrie_t *self = ztrie_new (\*(Aq/\*(Aq); +assert (self); + +int ret = 0; + +// Let\*(Aqs start by inserting a couple of routes into the trie\&. +// This one is for the route \*(Aq/foo/bar\*(Aq the slash at the beginning of the +// route is important because everything before the first delimiter will be +// discarded\&. A slash at the end of a route is optional though\&. The data +// associated with this node is passed without destroy function which means +// it must be destroyed by the caller\&. +int foo_bar_data = 10; +ret = ztrie_insert_route (self, "/foo/bar", &foo_bar_data, NULL); +assert (ret == 0); + +// Now suppose we like to match all routes with two tokens that start with +// \*(Aq/foo/\*(Aq but aren\*(Aqt \*(Aq/foo/bar\*(Aq\&. This is possible by using regular +// expressions which are enclosed in an opening and closing curly bracket\&. +// Tokens that contain regular expressions are always match after string +// based tokens\&. +// Note: There is no order in which regular expressions are sorted thus +// if you enter multiple expressions for a route you will have to make +// sure they don\*(Aqt have overlapping results\&. For example \*(Aq/foo/{[^/]+}\*(Aq +// and \*(Aq/foo/{\ed+} having could turn out badly\&. +int foo_other_data = 100; +ret = ztrie_insert_route (self, "/foo/{[^/]+}", &foo_other_data, NULL); +assert (ret == 0); + +// Regular expression are only matched against tokens of the same level\&. +// This allows us to append to are route with a regular expression as if +// it were a string\&. +ret = ztrie_insert_route (self, "/foo/{[^/]+}/gulp", NULL, NULL); +assert (ret == 0); + +// Routes are identified by their endpoint, which is the last token of the route\&. +// It is possible to insert routes for a node that already exists but isn\*(Aqt an +// endpoint yet\&. The delimiter at the end of a route is optional and has no effect\&. +ret = ztrie_insert_route (self, "/foo/", NULL, NULL); +assert (ret == 0); + +// If you try to insert a route which already exists the method will return \-1\&. +ret = ztrie_insert_route (self, "/foo", NULL, NULL); +assert (ret == \-1); + +// It is not allowed to insert routes with empty tokens\&. +ret = ztrie_insert_route (self, "//foo", NULL, NULL); +assert (ret == \-1); + +// Everything before the first delimiter is ignored so \*(Aqfoo/bar/baz\*(Aq is equivalent +// to \*(Aq/bar/baz\*(Aq\&. +ret = ztrie_insert_route (self, "foo/bar/baz", NULL, NULL); +assert (ret == 0); +ret = ztrie_insert_route (self, "/bar/baz", NULL, NULL); +assert (ret == \-1); + +// Of course you are allowed to remove routes, in case there is data associated with a +// route and a destroy data function has been supplied that data will be destroyed\&. +ret = ztrie_remove_route (self, "/foo"); +assert (ret == 0); + +// Removing a non existent route will as well return \-1\&. +ret = ztrie_remove_route (self, "/foo"); +assert (ret == \-1); + +// Removing a route with a regular expression must exactly match the entered one\&. +ret = ztrie_remove_route (self, "/foo/{[^/]+}"); +assert (ret == 0); + +// Next we like to match a path by regular expressions and also extract matched +// parts of a route\&. This can be done by naming the regular expression\&. The name of a +// regular expression is entered at the beginning of the curly brackets and separated +// by a colon from the regular expression\&. The first one in this examples is named +// \*(Aqname\*(Aq and names the expression \*(Aq[^/]\*(Aq\&. If there is no capturing group defined in +// the expression the whole matched string will be associated with this parameter\&. In +// case you don\*(Aqt like the get the whole matched string use a capturing group, like +// it has been done for the \*(Aqid\*(Aq parameter\&. This is nice but you can even match as +// many parameter for a token as you like\&. Therefore simply put the parameter names +// separated by colons in front of the regular expression and make sure to add a +// capturing group for each parameter\&. The first parameter will be associated with +// the first capturing and so on\&. +char *data = (char *) malloc (80); +sprintf (data, "%s", "Hello World!"); +ret = ztrie_insert_route (self, "/baz/{name:[^/]+}/{id:\-\-(\e\ed+)}/{street:nr:(\e\ea+)(\e\ed+)}", data, NULL); +assert (ret == 0); + +// There is a lot you can do with regular expression but matching routes +// of arbitrary length wont work\&. Therefore we make use of the asterisk +// operator\&. Just place it at the end of your route, e\&.g\&. \*(Aq/config/bar/*\*(Aq\&. +ret = ztrie_insert_route (self, "/config/bar/*", NULL, NULL); +assert (ret == 0); + +// Appending to an asterisk as you would to with a regular expression +// isn\*(Aqt valid\&. +ret = ztrie_insert_route (self, "/config/bar/*/bar", NULL, NULL); +assert (ret == \-1); + +// The asterisk operator will only work as a leaf in the tree\&. If you +// enter an asterisk in the middle of your route it will simply be +// interpreted as a string\&. +ret = ztrie_insert_route (self, "/test/*/bar", NULL, NULL); +assert (ret == 0); + +// If a parent has an asterisk as child it is not allowed to have +// other siblings\&. +ret = ztrie_insert_route (self, "/config/bar/foo/glup", NULL, NULL); +assert (ret != 0); + +// Test matches +bool hasMatch = false; + +// The route \*(Aq/bar/foo\*(Aq will fail to match as this route has never been inserted\&. +hasMatch = ztrie_matches (self, "/bar/foo"); +assert (!hasMatch); + +// The route \*(Aq/foo/bar\*(Aq will match and we can obtain the data associated with it\&. +hasMatch = ztrie_matches (self, "/foo/bar"); +assert (hasMatch); +int foo_bar_hit_data = *((int *) ztrie_hit_data (self)); +assert (foo_bar_data == foo_bar_hit_data); + +// This route is part of another but is no endpoint itself thus the matches will fail\&. +hasMatch = ztrie_matches (self, "/baz/blub"); +assert (!hasMatch); + +// This route will match our named regular expressions route\&. Thus we can extract data +// from the route by their names\&. +hasMatch = ztrie_matches (self, "/baz/blub/\-\-11/abc23"); +assert (hasMatch); +char *match_data = (char *) ztrie_hit_data (self); +assert (streq ("Hello World!", match_data)); +zhashx_t *parameters = ztrie_hit_parameters (self); +assert (zhashx_size (parameters) == 4); +assert (streq ("blub", (char *) zhashx_lookup (parameters, "name"))); +assert (streq ("11", (char *) zhashx_lookup (parameters, "id"))); +assert (streq ("abc", (char *) zhashx_lookup (parameters, "street"))); +assert (streq ("23", (char *) zhashx_lookup (parameters, "nr"))); +zhashx_destroy (¶meters); + +// This will match our asterisk route \*(Aq/config/bar/*\*(Aq\&. As the result we +// can obtain the asterisk matched part of the route\&. +hasMatch = ztrie_matches (self, "/config/bar/foo/bar"); +assert (hasMatch); +assert (streq (ztrie_hit_asterisk_match (self), "foo/bar")); + +zstr_free (&data); +ztrie_destroy (&self); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man3/zuuid.3 b/phonelibs/zmq/aarch64-linux/share/man/man3/zuuid.3 new file mode 100644 index 00000000000000..c5431245eb2de4 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man3/zuuid.3 @@ -0,0 +1,171 @@ +'\" t +.\" Title: zuuid +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "ZUUID" "3" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zuuid \- UUID support class +.SH "SYNOPSIS" +.sp +.nf +// This is a stable class, and may not change except for emergencies\&. It +// is provided in stable builds\&. +// Create a new UUID object\&. +CZMQ_EXPORT zuuid_t * + zuuid_new (void); + +// Create UUID object from supplied ZUUID_LEN\-octet value\&. +CZMQ_EXPORT zuuid_t * + zuuid_new_from (const byte *source); + +// Destroy a specified UUID object\&. +CZMQ_EXPORT void + zuuid_destroy (zuuid_t **self_p); + +// Set UUID to new supplied ZUUID_LEN\-octet value\&. +CZMQ_EXPORT void + zuuid_set (zuuid_t *self, const byte *source); + +// Set UUID to new supplied string value skipping \*(Aq\-\*(Aq and \*(Aq{\*(Aq \*(Aq}\*(Aq +// optional delimiters\&. Return 0 if OK, else returns \-1\&. +CZMQ_EXPORT int + zuuid_set_str (zuuid_t *self, const char *source); + +// Return UUID binary data\&. +CZMQ_EXPORT const byte * + zuuid_data (zuuid_t *self); + +// Return UUID binary size +CZMQ_EXPORT size_t + zuuid_size (zuuid_t *self); + +// Returns UUID as string +CZMQ_EXPORT const char * + zuuid_str (zuuid_t *self); + +// Return UUID in the canonical string format: 8\-4\-4\-4\-12, in lower +// case\&. Caller does not modify or free returned value\&. See +// http://en\&.wikipedia\&.org/wiki/Universally_unique_identifier +CZMQ_EXPORT const char * + zuuid_str_canonical (zuuid_t *self); + +// Store UUID blob in target array +CZMQ_EXPORT void + zuuid_export (zuuid_t *self, byte *target); + +// Check if UUID is same as supplied value +CZMQ_EXPORT bool + zuuid_eq (zuuid_t *self, const byte *compare); + +// Check if UUID is different from supplied value +CZMQ_EXPORT bool + zuuid_neq (zuuid_t *self, const byte *compare); + +// Make copy of UUID object; if uuid is null, or memory was exhausted, +// returns null\&. +CZMQ_EXPORT zuuid_t * + zuuid_dup (zuuid_t *self); + +// Self test of this class\&. +CZMQ_EXPORT void + zuuid_test (bool verbose); + +Please add \*(Aq@interface\*(Aq section in \*(Aq\&./\&.\&./src/zuuid\&.c\*(Aq\&. +.fi +.SH "DESCRIPTION" +.sp +The zuuid class generates UUIDs and provides methods for working with them\&. If you build CZMQ with libuuid, on Unix/Linux, it will use that library\&. On Windows it will use UuidCreate()\&. Otherwise it will use a random number generator to produce convincing imitations of UUIDs\&. +.sp +Please add \fI@discuss\fR section in \fI\&./\&.\&./src/zuuid\&.c\fR\&. +.SH "EXAMPLE" +.PP +\fBFrom zuuid_test method\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Simple create/destroy test +assert (ZUUID_LEN == 16); +assert (ZUUID_STR_LEN == 32); + +zuuid_t *uuid = zuuid_new (); +assert (uuid); +assert (zuuid_size (uuid) == ZUUID_LEN); +assert (strlen (zuuid_str (uuid)) == ZUUID_STR_LEN); +zuuid_t *copy = zuuid_dup (uuid); +assert (streq (zuuid_str (uuid), zuuid_str (copy))); + +// Check set/set_str/export methods +const char *myuuid = "8CB3E9A9649B4BEF8DE225E9C2CEBB38"; +const char *myuuid2 = "8CB3E9A9\-649B\-4BEF\-8DE2\-25E9C2CEBB38"; +const char *myuuid3 = "{8CB3E9A9\-649B\-4BEF\-8DE2\-25E9C2CEBB38}"; +const char *myuuid4 = "8CB3E9A9649B4BEF8DE225E9C2CEBB3838"; +int rc = zuuid_set_str (uuid, myuuid); +assert (rc == 0); +assert (streq (zuuid_str (uuid), myuuid)); +rc = zuuid_set_str (uuid, myuuid2); +assert (rc == 0); +assert (streq (zuuid_str (uuid), myuuid)); +rc = zuuid_set_str (uuid, myuuid3); +assert (rc == 0); +assert (streq (zuuid_str (uuid), myuuid)); +rc = zuuid_set_str (uuid, myuuid4); +assert (rc == \-1); +byte copy_uuid [ZUUID_LEN]; +zuuid_export (uuid, copy_uuid); +zuuid_set (uuid, copy_uuid); +assert (streq (zuuid_str (uuid), myuuid)); + +// Check the canonical string format +assert (streq (zuuid_str_canonical (uuid), + "8cb3e9a9\-649b\-4bef\-8de2\-25e9c2cebb38")); + +zuuid_destroy (&uuid); +zuuid_destroy (©); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/czmq.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/czmq.7 new file mode 100644 index 00000000000000..6de419cb00d516 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/czmq.7 @@ -0,0 +1,1358 @@ +'\" t +.\" Title: czmq +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 12/31/2016 +.\" Manual: CZMQ Manual +.\" Source: CZMQ 4.0.2 +.\" Language: English +.\" +.TH "CZMQ" "7" "12/31/2016" "CZMQ 4\&.0\&.2" "CZMQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +czmq \- high\-level C binding for ZeroMQ +.SH "SYNOPSIS" +.sp +.nf +#include + +cc [\*(Aqflags\*(Aq] \*(Aqfiles\*(Aq \-lzmq \-lczmq [\*(Aqlibraries\*(Aq] +.fi +.SH "DESCRIPTION" +.SS "Classes" +.sp +These classes provide the main socket and message API: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzsock\fR(3) +\- working with ZeroMQ sockets (high\-level) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzstr\fR(3) +\- sending and receiving strings +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzmsg\fR(3) +\- working with multipart messages +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzframe\fR(3) +\- working with single message frames +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzactor\fR(3) +\- Actor class (socket + thread) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzloop\fR(3) +\- event\-driven reactor +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzpoller\fR(3) +\- trivial socket poller class +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzproxy\fR(3) +\- proxy actor (like zmq_proxy_steerable) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzmonitor\fR(3) +\- monitor events on ZeroMQ sockets +.RE +.sp +These classes support authentication and encryption: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzauth\fR(3) +\- authentication actor for ZeroMQ servers +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzcert\fR(3) +\- work with CURVE security certificates +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzcertstore\fR(3) +\- work with CURVE security certificate stores +.RE +.sp +These classes provide generic containers: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzhash\fR(3) +\- simple generic hash container +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzhashx\fR(3) +\- extended generic hash container +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzlist\fR(3) +\- simple generic list container +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzlistx\fR(3) +\- extended generic list container +.RE +.sp +These classes wrap\-up non\-portable functionality: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzbeacon\fR(3) +\- LAN discovery and presence +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzclock\fR(3) +\- millisecond clocks and delays +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzdir\fR(3) +\- work with file\-system directories +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzdir_patch\fR(3) +\- work with directory differences +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzfile\fR(3) +\- work with file\-system files +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzsys\fR(3) +\- system\-level methods +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzuuid\fR(3) +\- UUID support class +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBziflist\fR(3) +\- list available network interfaces +.RE +.sp +And these utility classes add value: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzchunk\fR(3) +\- work with memory chunks +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzconfig\fR(3) +\- work with textual config files +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzrex\fR(3) +\- work with regular expressions +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzgossip\fR(3) +\- decentralized configuration management +.RE +.sp +These classes are deprecated: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzctx\fR(3) +\- working with ZeroMQ contexts +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzsocket\fR(3) +\- working with ZeroMQ sockets (low\-level) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzsockopt\fR(3) +\- get/set ZeroMQ socket options +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzthread\fR(3) +\- working with system threads +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzauth_v2\fR(3) +\- authentication for ZeroMQ servers +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzbeacon_v2\fR(3) +\- LAN discovery and presence +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzmonitor_v2\fR(3) +\- socket event monitor +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBzproxy_v2\fR(3) +\- zmq_proxy wrapper +.RE +.SS "Scope and Goals" +.sp +CZMQ has these goals: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +To wrap the \(/OMQ core API in semantics that are natural and lead to shorter, more readable applications\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +To hide the differences between versions of \(/OMQ\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +To provide a space for development of more sophisticated API semantics\&. +.RE +.SS "Ownership and License" +.sp +CZMQ is maintained by the ZeroMQ community at github\&.com/zeromq\&. Its other authors and contributors are listed in the AUTHORS file\&. +.sp +The contributors are listed in AUTHORS\&. This project uses the MPL v2 license, see LICENSE\&. +.SS "Contributing" +.sp +To submit an issue use the issue tracker at \m[blue]\fBhttp://github\&.com/zeromq/czmq/issues\fR\m[]\&. All discussion happens on the zeromq\-dev list or #zeromq IRC channel at irc\&.freenode\&.net\&. +.sp +The proper way to submit patches is to clone this repository, make your changes, and use git to create a patch or a pull request\&. See \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. All contributors are listed in AUTHORS\&. +.sp +All classes are maintained by a single person, who is the responsible editor for that class and who is named in the header as such\&. This is usually the originator of the class\&. When several people collaborate on a class, one single person is always the lead maintainer and the one to blame when it breaks\&. +.sp +The general rule is, if you contribute code to CZMQ you must be willing to maintain it as long as there are users of it\&. Code with no active maintainer will in general be deprecated and/or removed\&. +.SH "USING CZMQ" +.SS "Building and Installing" +.sp +CZMQ uses autotools for packaging\&. To build from git (all example commands are for Linux): +.sp +.if n \{\ +.RS 4 +.\} +.nf + git clone git://github\&.com/zeromq/czmq\&.git + cd czmq + sh autogen\&.sh + \&./configure + make all + sudo make install + sudo ldconfig +.fi +.if n \{\ +.RE +.\} +.sp +You will need the pkg\-config, libtool, and autoreconf packages\&. Set the LD_LIBRARY_PATH to /usr/local/libs unless you install elsewhere\&. +.sp +After building, you can run the CZMQ selftests: +.sp +.if n \{\ +.RS 4 +.\} +.nf + cd src + \&./czmq_selftest +.fi +.if n \{\ +.RE +.\} +.SS "Linking with an Application" +.sp +Include czmq\&.h in your application and link with CZMQ\&. Here is a typical gcc link command: +.sp +.if n \{\ +.RS 4 +.\} +.nf + gcc \-lczmq \-lzmq myapp\&.c \-o myapp +.fi +.if n \{\ +.RE +.\} +.sp +You should read czmq\&.h\&. This file includes zmq\&.h and the system header files that typical \(/OMQ applications will need\&. The provided \fIc\fR shell script lets you write simple portable build scripts: +.sp +.if n \{\ +.RS 4 +.\} +.nf + c \-lczmq \-lzmq \-l myapp +.fi +.if n \{\ +.RE +.\} +.SS "The Class Model" +.sp +CZMQ consists of classes, each class consisting of a \&.h and a \&.c\&. Classes may depend on other classes\&. +.sp +czmq\&.h includes all classes header files, all the time\&. For the user, CZMQ forms one single package\&. All classes start by including czmq\&.h\&. All applications that use CZMQ start by including czmq\&.h\&. czmq\&.h also defines a limited number of small, useful macros and typedefs that have proven useful for writing clearer C code\&. +.sp +All classes (with some exceptions) are based on a flat C class system and follow these rules (where \fIzclass\fR is the class name): +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Class typedef: +zclass_t +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Constructor: +zclass_new +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Destructor: +zclass_destroy +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Property methods: +zclass_property_set, +zclass_property +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Class structures are private (defined in the \&.c source but not the \&.h) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Properties are accessed only via methods named as described above\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +In the class source code the object is always called +self\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The constructor may take arbitrary arguments, and returns NULL on failure, or a new object\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The destructor takes a pointer to an object reference and nullifies it\&. +.RE +.sp +Return values for methods are: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +For methods that return an object reference, either the reference, or NULL on failure\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +For methods that signal success/failure, a return value of 0 means success, \-1 failure\&. +.RE +.sp +Private/static functions in a class are named s_functionname and are not exported via the header file\&. +.sp +All classes (with some exceptions) have a test method called zclass_test\&. +.SH "DESIGN IDEOLOGY" +.SS "The Problem with C" +.sp +C has the significant advantage of being a small language that, if we take a little care with formatting and naming, can be easily interchanged between developers\&. Every C developer will use much the same 90% of the language\&. Larger languages like C++ provide powerful abstractions like STL containers but at the cost of interchange\&. +.sp +The huge problem with C is that any realistic application needs packages of functionality to bring the language up to the levels we expect for the 21st century\&. Much can be done by using external libraries but every additional library is a dependency that makes the resulting applications harder to build and port\&. While C itself is a highly portable language (and can be made more so by careful use of the preprocessor), most C libraries consider themselves part of the operating system, and as such do not attempt to be portable\&. +.sp +The answer to this, as we learned from building enterprise\-level C applications at iMatix from 1995\-2005, is to create our own fully portable, high\-quality libraries of pre\-packaged functionality, in C\&. Doing this right solves both the requirements of richness of the language, and of portability of the final applications\&. +.SS "A Simple Class Model" +.sp +C has no standard API style\&. It is one thing to write a useful component, but something else to provide an API that is consistent and obvious across many components\&. We learned from building OpenAMQ (\m[blue]\fBhttp://www\&.openamq\&.org\fR\m[]), a messaging client and server of 0\&.5M LoC, that a consistent model for extending C makes life for the application developer much easier\&. +.sp +The general model is that of a class (the source package) that provides objects (in fact C structures)\&. The application creates objects and then works with them\&. When done, the application destroys the object\&. In C, we tend to use the same name for the object as the class, when we can, and it looks like this (to take a fictitious CZMQ class): +.sp +.if n \{\ +.RS 4 +.\} +.nf + zregexp_t *regexp = zregexp_new (regexp_string); + if (!regexp) + printf ("E: invalid regular expression: %s\en", regexp_string); + else + if (zregexp_match (regexp, input_buffer)) + printf ("I: successful match for %s\en", input buffer); + zregexp_destroy (&regexp); +.fi +.if n \{\ +.RE +.\} +.sp +As far as the C program is concerned, the object is a reference to a structure (not a void pointer)\&. We pass the object reference to all methods, since this is still C\&. We could do weird stuff like put method addresses into the structure so that we can emulate a C++ syntax but it\(cqs not worthwhile\&. The goal is not to emulate an OO system, it\(cqs simply to gain consistency\&. The constructor returns an object reference, or NULL if it fails\&. The destructor nullifies the class pointer, and is idempotent\&. +.sp +What we aim at here is the simplest possible consistent syntax\&. +.sp +No model is fully consistent, and classes can define their own rules if it helps make a better result\&. For example: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Some classes may not be opaque\&. For example, we have cases of generated serialization classes that encode and decode structures to/from binary buffers\&. It feels clumsy to have to use methods to access the properties of these classes\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +While every class has a new method that is the formal constructor, some methods may also act as constructors\&. For example, a "dup" method might take one object and return a second object\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +While every class has a destroy method that is the formal destructor, some methods may also act as destructors\&. For example, a method that sends an object may also destroy the object (so that ownership of any buffers can passed to background threads)\&. Such methods take the same "pointer to a reference" argument as the destroy method\&. +.RE +.SS "Naming Style" +.sp +CZMQ aims for short, consistent names, following the theory that names we use most often should be shortest\&. Classes get one\-word names, unless they are part of a family of classes in which case they may be two words, the first being the family name\&. Methods, similarly, get one\-word names and we aim for consistency across classes (so a method that does something semantically similar in two classes will get the same name in both)\&. So the canonical name for any method is: +.sp +.if n \{\ +.RS 4 +.\} +.nf + zclassname_methodname +.fi +.if n \{\ +.RE +.\} +.sp +And the reader can easily parse this without needing special syntax to separate the class name from the method name\&. +.SS "Containers" +.sp +After a long experiment with containers, we\(cqve decided that we need exactly two containers: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +A singly\-linked list\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +A hash table using text keys\&. +.RE +.sp +These are zlist and zhash, respectively\&. Both store void pointers, with no attempt to manage the details of contained objects\&. You can use these containers to create lists of lists, hashes of lists, hashes of hashes, etc\&. +.sp +We assume that at some point we\(cqll need to switch to a doubly\-linked list\&. +.SS "Portability" +.sp +Creating a portable C application can be rewarding in terms of maintaining a single code base across many platforms, and keeping (expensive) system\-specific knowledge separate from application developers\&. In most projects (like \(/OMQ core), there is no portability layer and application code does conditional compilation for all mixes of platforms\&. This leads to quite messy code\&. +.sp +czmq acts as a portability layer, similar to but thinner than libraries like the [Apache Portable Runtime](\m[blue]\fBhttp://apr\&.apache\&.org\fR\m[]) (APR)\&. +.sp +These are the places a C application is subject to arbitrary system differences: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Different compilers may offer slightly different variants of the C language, often lacking specific types or using neat non\-portable names\&. Windows is a big culprit here\&. We solve this by +\fIpatching\fR +the language in czmq_prelude\&.h, e\&.g\&. defining int64_t on Windows\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +System header files are inconsistent, i\&.e\&. you need to include different files depending on the OS type and version\&. We solve this by pulling in all necessary header files in czmq_prelude\&.h\&. This is a proven brute\-force approach that increases recompilation times but eliminates a major source of pain\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +System libraries are inconsistent, i\&.e\&. you need to link with different libraries depending on the OS type and version\&. We solve this with an external compilation tool, +\fIC\fR, which detects the OS type and version (at runtime) and builds the necessary link commands\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +System functions are inconsistent, i\&.e\&. you need to call different functions depending, again, on OS type and version\&. We solve this by building small abstract classes that handle specific areas of functionality, and doing conditional compilation in these\&. +.RE +.sp +An example of the last: +.sp +.if n \{\ +.RS 4 +.\} +.nf + #if (defined (__UNIX__)) + pid = GetCurrentProcessId(); + #elif (defined (__WINDOWS__)) + pid = getpid (); + #else + pid = 0; + #endif +.fi +.if n \{\ +.RE +.\} +.sp +CZMQ uses the GNU autotools system, so non\-portable code can use the macros this defines\&. It can also use macros defined by the czmq_prelude\&.h header file\&. +.SS "Technical Aspects" +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBThread safety\fR: the use of opaque structures is thread safe, though \(/OMQ applications should not share state between threads in any case\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBName spaces\fR: we prefix class names with +z, which ensures that all exported functions are globally safe\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBLibrary versioning\fR: we don\(cqt make any attempt to version the library at this stage\&. Classes are in our experience highly stable once they are built and tested, the only changes typically being added methods\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBPerformance\fR: for critical path processing, you may want to avoid creating and destroying classes\&. However on modern Linux systems the heap allocator is very fast\&. Individual classes can choose whether or not to nullify their data on allocation\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBSelf\-testing\fR: every class has a +selftest +method that runs through the methods of the class\&. In theory, calling all selftest functions of all classes does a full unit test of the library\&. The +czmq_selftest +application does this\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} + +\fBMemory management\fR: CZMQ classes do not use any special memory management techiques to detect leaks\&. We\(cqve done this in the past but it makes the code relatively complex\&. Instead, we do memory leak testing using tools like valgrind\&. +.RE +.SH "UNDER THE HOOD" +.SS "Adding a New Class" +.sp +If you define a new CZMQ class myclass you need to: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Write the +zmyclass\&.c +and +zmyclass\&.h +source files, in +src +and +include +respectively\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Add`#include ` to +include/czmq\&.h\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Add the myclass header and test call to +src/czmq_selftest\&.c\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Add a reference documentation to +\fIdoc/zmyclass\&.txt\fR\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Add myclass to \*(Aqsrc/Makefile\&.am` and +doc/Makefile\&.am\&. +.RE +.sp +The bin/newclass\&.sh shell script will automate these steps for you\&. +.SS "Coding Style" +.sp +In general the zctx class defines the style for the whole library\&. The overriding rules for coding style are consistency, clarity, and ease of maintenance\&. We use the C99 standard for syntax including principally: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The // comment style\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Variables definitions placed in or before the code that uses them\&. +.RE +.sp +So while ANSI C code might say: +.sp +.if n \{\ +.RS 4 +.\} +.nf + zblob_t *file_buffer; /* Buffer for our file */ + \&.\&.\&. (100 lines of code) + file_buffer = zblob_new (); + \&.\&.\&. +.fi +.if n \{\ +.RE +.\} +.sp +The style in CZMQ would be: +.sp +.if n \{\ +.RS 4 +.\} +.nf + zblob_t *file_buffer = zblob_new (); +.fi +.if n \{\ +.RE +.\} +.SS "Assertions" +.sp +We use assertions heavily to catch bad argument values\&. The CZMQ classes do not attempt to validate arguments and report errors; bad arguments are treated as fatal application programming errors\&. +.sp +We also use assertions heavily on calls to system functions that are never supposed to fail, where failure is to be treated as a fatal non\-recoverable error (e\&.g\&. running out of memory)\&. +.sp +Assertion code should always take this form: +.sp +.if n \{\ +.RS 4 +.\} +.nf + int rc = some_function (arguments); + assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +Rather than the side\-effect form: +.sp +.if n \{\ +.RS 4 +.\} +.nf + assert (some_function (arguments) == 0); +.fi +.if n \{\ +.RE +.\} +.sp +Since assertions may be removed by an optimizing compiler\&. +.SS "Documentation" +.sp +Man pages are generated from the class header and source files via the doc/mkman tool, and similar functionality in the gitdown tool (\m[blue]\fBhttp://github\&.com/imatix/gitdown\fR\m[])\&. The header file for a class must wrap its interface as follows (example is from include/zclock\&.h): +.sp +.if n \{\ +.RS 4 +.\} +.nf + // @interface + // Sleep for a number of milliseconds + void + zclock_sleep (int msecs); + + // Return current system clock as milliseconds + int64_t + zclock_time (void); + + // Self test of this class + int + zclock_test (Bool verbose); + // @end +.fi +.if n \{\ +.RE +.\} +.sp +The source file for a class must provide documentation as follows: +.sp +.if n \{\ +.RS 4 +.\} +.nf + /* + @header + \&.\&.\&.short explanation of class\&.\&.\&. + @discuss + \&.\&.\&.longer discussion of how it works\&.\&.\&. + @end + */ +.fi +.if n \{\ +.RE +.\} +.sp +The source file for a class then provides the self test example as follows: +.sp +.if n \{\ +.RS 4 +.\} +.nf + // @selftest + int64_t start = zclock_time (); + zclock_sleep (10); + assert ((zclock_time () \- start) >= 10); + // @end +.fi +.if n \{\ +.RE +.\} +.sp +The template for man pages is in doc/mkman\&. +.SS "Development" +.sp +CZMQ is developed through a test\-driven process that guarantees no memory violations or leaks in the code: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Modify a class or method\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Update the test method for that class\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Run the +\fIselftest\fR +script, which uses the Valgrind memcheck tool\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Repeat until perfect\&. +.RE +.SS "Porting CZMQ" +.sp +When you try CZMQ on an OS that it\(cqs not been used on (ever, or for a while), you will hit code that does not compile\&. In some cases the patches are trivial, in other cases (usually when porting to Windows), the work needed to build equivalent functionality may be quite heavy\&. In any case, the benefit is that once ported, the functionality is available to all applications\&. +.sp +Before attempting to patch code for portability, please read the czmq_prelude\&.h header file\&. There are several typical types of changes you may need to make to get functionality working on a specific operating system: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Defining typedefs which are missing on that specific compiler: do this in czmq_prelude\&.h\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Defining macros that rename exotic library functions to more conventional names: do this in czmq_prelude\&.h\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Reimplementing specific methods to use a non\-standard API: this is typically needed on Windows\&. Do this in the relevant class, using #ifdefs to properly differentiate code for different platforms\&. +.RE +.sp +The canonical \fIstandard operating system\fR for all CZMQ code is Linux, gcc, POSIX\&. +.SH "AUTHORS" +.sp +The czmq manual was written by the authors in the AUTHORS file\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fB\%\fR\m[] +.sp +Report bugs to the email <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYRIGHT" +.sp +Copyright (c) the Contributors as noted in the AUTHORS file\&. This file is part of CZMQ, the high\-level C binding for 0MQ: http://czmq\&.zeromq\&.org\&. This Source Code Form is subject to the terms of the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&. LICENSE included with the czmq distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq.7 new file mode 100644 index 00000000000000..45224c4859df39 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq.7 @@ -0,0 +1,275 @@ +'\" t +.\" Title: zmq +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq \- 0MQ lightweight messaging kernel +.SH "SYNOPSIS" +.sp +\fB#include \fR +.sp +\fBcc\fR [\fIflags\fR] \fIfiles\fR \fB\-lzmq\fR [\fIlibraries\fR] +.SH "DESCRIPTION" +.sp +The 0MQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised \fImessaging middleware\fR products\&. 0MQ sockets provide an abstraction of asynchronous \fImessage queues\fR, multiple \fImessaging patterns\fR, message filtering (\fIsubscriptions\fR), seamless access to multiple \fItransport protocols\fR and more\&. +.sp +This documentation presents an overview of 0MQ concepts, describes how 0MQ abstracts standard sockets and provides a reference manual for the functions provided by the 0MQ library\&. +.SS "Context" +.sp +The 0MQ \fIcontext\fR keeps the list of sockets and manages the async I/O thread and internal queries\&. +.sp +Before using any 0MQ library functions you must create a 0MQ \fIcontext\fR\&. When you exit your application you must destroy the \fIcontext\fR\&. These functions let you work with \fIcontexts\fR: +.PP +Create a new 0MQ context +.RS 4 +\fBzmq_ctx_new\fR(3) +.RE +.PP +Work with context properties +.RS 4 +\fBzmq_ctx_set\fR(3)\fBzmq_ctx_get\fR(3) +.RE +.PP +Destroy a 0MQ context +.RS 4 +\fBzmq_ctx_shutdown\fR(3)\fBzmq_ctx_term\fR(3) +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBThread safety\fR +.RS 4 +.sp +A 0MQ \fIcontext\fR is thread safe and may be shared among as many application threads as necessary, without any additional locking required on the part of the caller\&. +.sp +Individual 0MQ \fIsockets\fR are \fInot\fR thread safe except in the case where full memory barriers are issued when migrating a socket from one thread to another\&. In practice this means applications can create a socket in one thread with \fIzmq_socket()\fR and then pass it to a \fInewly created\fR thread as part of thread initialisation, for example via a structure passed as an argument to \fIpthread_create()\fR\&. +.RE +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBMultiple contexts\fR +.RS 4 +.sp +Multiple \fIcontexts\fR may coexist within a single application\&. Thus, an application can use 0MQ directly and at the same time make use of any number of additional libraries or components which themselves make use of 0MQ as long as the above guidelines regarding thread safety are adhered to\&. +.RE +.SS "Messages" +.sp +A 0MQ message is a discrete unit of data passed between applications or components of the same application\&. 0MQ messages have no internal structure and from the point of view of 0MQ itself they are considered to be opaque binary data\&. +.sp +The following functions are provided to work with messages: +.PP +Initialise a message +.RS 4 +\fBzmq_msg_init\fR(3)\fBzmq_msg_init_size\fR(3)\fBzmq_msg_init_data\fR(3) +.RE +.PP +Sending and receiving a message +.RS 4 +\fBzmq_msg_send\fR(3)\fBzmq_msg_recv\fR(3) +.RE +.PP +Release a message +.RS 4 +\fBzmq_msg_close\fR(3) +.RE +.PP +Access message content +.RS 4 +\fBzmq_msg_data\fR(3)\fBzmq_msg_size\fR(3)\fBzmq_msg_more\fR(3) +.RE +.PP +Work with message properties +.RS 4 +\fBzmq_msg_gets\fR(3)\fBzmq_msg_get\fR(3)\fBzmq_msg_set\fR(3) +.RE +.PP +Message manipulation +.RS 4 +\fBzmq_msg_copy\fR(3)\fBzmq_msg_move\fR(3) +.RE +.SS "Sockets" +.sp +0MQ sockets present an abstraction of a asynchronous \fImessage queue\fR, with the exact queueing semantics depending on the socket type in use\&. See \fBzmq_socket\fR(3) for the socket types provided\&. +.sp +The following functions are provided to work with sockets: +.PP +Creating a socket +.RS 4 +\fBzmq_socket\fR(3) +.RE +.PP +Closing a socket +.RS 4 +\fBzmq_close\fR(3) +.RE +.PP +Manipulating socket options +.RS 4 +\fBzmq_getsockopt\fR(3)\fBzmq_setsockopt\fR(3) +.RE +.PP +Establishing a message flow +.RS 4 +\fBzmq_bind\fR(3)\fBzmq_connect\fR(3) +.RE +.PP +Sending and receiving messages +.RS 4 +\fBzmq_msg_send\fR(3)\fBzmq_msg_recv\fR(3)\fBzmq_send\fR(3)\fBzmq_recv\fR(3)\fBzmq_send_const\fR(3) +.RE +.PP +Monitoring socket events +.RS 4 +\fBzmq_socket_monitor\fR(3) +.RE +.PP +\fBInput/output multiplexing\fR. 0MQ provides a mechanism for applications to multiplex input/output events over a set containing both 0MQ sockets and standard sockets\&. This mechanism mirrors the standard +\fIpoll()\fR +system call, and is described in detail in +\fBzmq_poll\fR(3)\&. +.SS "Transports" +.sp +A 0MQ socket can use multiple different underlying transport mechanisms\&. Each transport mechanism is suited to a particular purpose and has its own advantages and drawbacks\&. +.sp +The following transport mechanisms are provided: +.PP +Unicast transport using TCP +.RS 4 +\fBzmq_tcp\fR(7) +.RE +.PP +Reliable multicast transport using PGM +.RS 4 +\fBzmq_pgm\fR(7) +.RE +.PP +Local inter\-process communication transport +.RS 4 +\fBzmq_ipc\fR(7) +.RE +.PP +Local in\-process (inter\-thread) communication transport +.RS 4 +\fBzmq_inproc\fR(7) +.RE +.PP +Virtual Machine Communications Interface (VMC) transport +.RS 4 +\fBzmq_vmci\fR(7) +.RE +.PP +Unreliable unicast and multicast using UDP +.RS 4 +\fBzmq_udp\fR(7) +.RE +.SS "Proxies" +.sp +0MQ provides \fIproxies\fR to create fanout and fan\-in topologies\&. A proxy connects a \fIfrontend\fR socket to a \fIbackend\fR socket and switches all messages between the two sockets, opaquely\&. A proxy may optionally capture all traffic to a third socket\&. To start a proxy in an application thread, use \fBzmq_proxy\fR(3)\&. +.SS "Security" +.sp +A 0MQ socket can select a security mechanism\&. Both peers must use the same security mechanism\&. +.sp +The following security mechanisms are provided for IPC and TCP connections: +.PP +Null security +.RS 4 +\fBzmq_null\fR(7) +.RE +.PP +Plain\-text authentication using username and password +.RS 4 +\fBzmq_plain\fR(7) +.RE +.PP +Elliptic curve authentication and encryption +.RS 4 +\fBzmq_curve\fR(7) +.RE +.PP +Generate a CURVE keypair in armored text format +.RS 4 +\fBzmq_curve_keypair\fR(3) +.RE +.sp +Derive a CURVE public key from a secret key: \fBzmq_curve_public\fR(3) +.PP +Converting keys to/from armoured text strings +.RS 4 +\fBzmq_z85_decode\fR(3)\fBzmq_z85_encode\fR(3) +.RE +.SH "ERROR HANDLING" +.sp +The 0MQ library functions handle errors using the standard conventions found on POSIX systems\&. Generally, this means that upon failure a 0MQ library function shall return either a NULL value (if returning a pointer) or a negative value (if returning an integer), and the actual error code shall be stored in the \fIerrno\fR variable\&. +.sp +On non\-POSIX systems some users may experience issues with retrieving the correct value of the \fIerrno\fR variable\&. The \fIzmq_errno()\fR function is provided to assist in these cases; for details refer to \fBzmq_errno\fR(3)\&. +.sp +The \fIzmq_strerror()\fR function is provided to translate 0MQ\-specific error codes into error message strings; for details refer to \fBzmq_strerror\fR(3)\&. +.SH "UTILITY" +.sp +The following utility functions are provided: +.PP +Working with atomic counters +.RS 4 +\fBzmq_atomic_counter_new\fR(3)\fBzmq_atomic_counter_set\fR(3)\fBzmq_atomic_counter_inc\fR(3)\fBzmq_atomic_counter_dec\fR(3)\fBzmq_atomic_counter_value\fR(3)\fBzmq_atomic_counter_destroy\fR(3) +.RE +.SH "MISCELLANEOUS" +.sp +The following miscellaneous functions are provided: +.PP +Report 0MQ library version +.RS 4 +\fBzmq_version\fR(3) +.RE +.SH "LANGUAGE BINDINGS" +.sp +The 0MQ library provides interfaces suitable for calling from programs in any language; this documentation documents those interfaces as they would be used by C programmers\&. The intent is that programmers using 0MQ from other languages shall refer to this documentation alongside any documentation provided by the vendor of their language binding\&. +.sp +Language bindings (C++, Python, PHP, Ruby, Java and more) are provided by members of the 0MQ community and pointers can be found on the 0MQ website\&. +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. +.SH "RESOURCES" +.sp +Main web site: \m[blue]\fBhttp://www\&.zeromq\&.org/\fR\m[] +.sp +Report bugs to the 0MQ development mailing list: <\m[blue]\fBzeromq\-dev@lists\&.zeromq\&.org\fR\m[]\&\s-2\u[1]\d\s+2> +.SH "COPYING" +.sp +Free use of this software is granted under the terms of the GNU Lesser General Public License (LGPL)\&. For details see the files COPYING and COPYING\&.LESSER included with the 0MQ distribution\&. +.SH "NOTES" +.IP " 1." 4 +zeromq-dev@lists.zeromq.org +.RS 4 +\%mailto:zeromq-dev@lists.zeromq.org +.RE diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_curve.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_curve.7 new file mode 100644 index 00000000000000..675effc437045d --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_curve.7 @@ -0,0 +1,93 @@ +'\" t +.\" Title: zmq_curve +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_CURVE" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_curve \- secure authentication and confidentiality +.SH "SYNOPSIS" +.sp +The CURVE mechanism defines a mechanism for secure authentication and confidentiality for communications between a client and a server\&. CURVE is intended for use on public networks\&. The CURVE mechanism is defined by this document: \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:25\fR\m[]\&. +.SH "CLIENT AND SERVER ROLES" +.sp +A socket using CURVE can be either client or server, at any moment, but not both\&. The role is independent of bind/connect direction\&. +.sp +A socket can change roles at any point by setting new options\&. The role affects all zmq_connect and zmq_bind calls that follow it\&. +.sp +To become a CURVE server, the application sets the ZMQ_CURVE_SERVER option on the socket, and then sets the ZMQ_CURVE_SECRETKEY option to provide the socket with its long\-term secret key\&. The application does not provide the socket with its long\-term public key, which is used only by clients\&. +.sp +To become a CURVE client, the application sets the ZMQ_CURVE_SERVERKEY option with the long\-term public key of the server it intends to connect to, or accept connections from, next\&. The application then sets the ZMQ_CURVE_PUBLICKEY and ZMQ_CURVE_SECRETKEY options with its client long\-term key pair\&. +.sp +If the server does authentication it will be based on the client\(cqs long term public key\&. +.SH "KEY ENCODING" +.sp +The standard representation for keys in source code is either 32 bytes of base 256 (binary) data, or 40 characters of base 85 data encoded using the Z85 algorithm defined by \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:32\fR\m[]\&. +.sp +The Z85 algorithm is designed to produce printable key strings for use in configuration files, the command line, and code\&. There is a reference implementation in C at \m[blue]\fBhttps://github\&.com/zeromq/rfc/tree/master/src\fR\m[]\&. +.SH "TEST KEY VALUES" +.sp +For test cases, the client shall use this long\-term key pair (specified as hexadecimal and in Z85): +.sp +.if n \{\ +.RS 4 +.\} +.nf +public: + BB88471D65E2659B30C55A5321CEBB5AAB2B70A398645C26DCA2B2FCB43FC518 + Yne@$w\-vo}U?@Lns47E1%kR\&.o@n%FcmmsL/@{H8]yf7 + +secret: + 8E0BDD697628B91D8F245587EE95C5B04D48963F79259877B49CD9063AEAD3B7 + JTKVSB%%)wK0E\&.X)V>+}o?pNmC{O&4W4b!Ni{Lh6 +.fi +.if n \{\ +.RE +.\} +.SH "SEE ALSO" +.sp +\fBzmq_z85_encode\fR(3) \fBzmq_z85_decode\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_null\fR(7) \fBzmq_plain\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_inproc.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_inproc.7 new file mode 100644 index 00000000000000..a0b0e72d3f71d6 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_inproc.7 @@ -0,0 +1,103 @@ +'\" t +.\" Title: zmq_inproc +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_INPROC" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_inproc \- 0MQ local in\-process (inter\-thread) communication transport +.SH "SYNOPSIS" +.sp +The in\-process transport passes messages via memory directly between threads sharing a single 0MQ \fIcontext\fR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +No I/O threads are involved in passing messages using the \fIinproc\fR transport\&. Therefore, if you are using a 0MQ \fIcontext\fR for in\-process messaging only you can initialise the \fIcontext\fR with zero I/O threads\&. See \fBzmq_init\fR(3) for details\&. +.sp .5v +.RE +.SH "ADDRESSING" +.sp +A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. +.sp +For the in\-process transport, the transport is inproc, and the meaning of the \fIaddress\fR part is defined below\&. +.SS "Assigning a local address to a socket" +.sp +When assigning a local address to a \fIsocket\fR using \fIzmq_bind()\fR with the \fIinproc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIname\fR to create\&. The \fIname\fR must be unique within the 0MQ \fIcontext\fR associated with the \fIsocket\fR and may be up to 256 characters in length\&. No other restrictions are placed on the format of the \fIname\fR\&. +.SS "Connecting a socket" +.sp +When connecting a \fIsocket\fR to a peer address using \fIzmq_connect()\fR with the \fIinproc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIname\fR to connect to\&. Before version 4\&.0 he \fIname\fR must have been previously created by assigning it to at least one \fIsocket\fR within the same 0MQ \fIcontext\fR as the \fIsocket\fR being connected\&. Since version 4\&.0 the order of \fIzmq_bind()\fR and \fIzmq_connect()\fR does not matter just like for the tcp transport type\&. +.SH "EXAMPLES" +.PP +\fBAssigning a local address to a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Assign the in\-process name "#1" +rc = zmq_bind(socket, "inproc://#1"); +assert (rc == 0); +// Assign the in\-process name "my\-endpoint" +rc = zmq_bind(socket, "inproc://my\-endpoint"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.PP +\fBConnecting a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Connect to the in\-process name "#1" +rc = zmq_connect(socket, "inproc://#1"); +assert (rc == 0); +// Connect to the in\-process name "my\-endpoint" +rc = zmq_connect(socket, "inproc://my\-endpoint"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_ipc\fR(7) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_ipc.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_ipc.7 new file mode 100644 index 00000000000000..c190b6f1215f10 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_ipc.7 @@ -0,0 +1,166 @@ +'\" t +.\" Title: zmq_ipc +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_IPC" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_ipc \- 0MQ local inter\-process communication transport +.SH "SYNOPSIS" +.sp +The inter\-process transport passes messages between local processes using a system\-dependent IPC mechanism\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +The inter\-process transport is currently only implemented on operating systems that provide UNIX domain sockets\&. +.sp .5v +.RE +.SH "ADDRESSING" +.sp +A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. +.sp +For the inter\-process transport, the transport is ipc, and the meaning of the \fIaddress\fR part is defined below\&. +.SS "Binding a socket" +.sp +When binding a \fIsocket\fR to a local address using \fIzmq_bind()\fR with the \fIipc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIpathname\fR to create\&. The \fIpathname\fR must be unique within the operating system namespace used by the \fIipc\fR implementation, and must fulfill any restrictions placed by the operating system on the format and length of a \fIpathname\fR\&. +.sp +When the address is wild\-card *, \fIzmq_bind()\fR shall generate a unique temporary pathname\&. The caller should retrieve this pathname using the ZMQ_LAST_ENDPOINT socket option\&. See \fBzmq_getsockopt\fR(3) for details\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +any existing binding to the same endpoint shall be overridden\&. That is, if a second process binds to an endpoint already bound by a process, this will succeed and the first process will lose its binding\&. In this behaviour, the \fIipc\fR transport is not consistent with the \fItcp\fR or \fIinproc\fR transports\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +the endpoint pathname must be writable by the process\&. When the endpoint starts with \fI/\fR, e\&.g\&., ipc:///pathname, this will be an \fIabsolute\fR pathname\&. If the endpoint specifies a directory that does not exist, the bind shall fail\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +on Linux only, when the endpoint pathname starts with @, the abstract namespace shall be used\&. The abstract namespace is independent of the filesystem and if a process attempts to bind an endpoint already bound by a process, it will fail\&. See unix(7) for details\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +IPC pathnames have a maximum size that depends on the operating system\&. On Linux, the maximum is 113 characters including the "ipc://" prefix (107 characters for the real path name)\&. +.sp .5v +.RE +.SS "Unbinding wild\-card address from a socket" +.sp +When wild\-card * \fIendpoint\fR was used in \fIzmq_bind()\fR, the caller should use real \fIendpoint\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket using \fIzmq_unbind()\fR\&. +.SS "Connecting a socket" +.sp +When connecting a \fIsocket\fR to a peer address using \fIzmq_connect()\fR with the \fIipc\fR transport, the \fIendpoint\fR shall be interpreted as an arbitrary string identifying the \fIpathname\fR to connect to\&. The \fIpathname\fR must have been previously created within the operating system namespace by assigning it to a \fIsocket\fR with \fIzmq_bind()\fR\&. +.SH "EXAMPLES" +.PP +\fBAssigning a local address to a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Assign the pathname "/tmp/feeds/0" +rc = zmq_bind(socket, "ipc:///tmp/feeds/0"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.PP +\fBConnecting a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Connect to the pathname "/tmp/feeds/0" +rc = zmq_connect(socket, "ipc:///tmp/feeds/0"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_inproc\fR(7) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_vmci\fR(7) \fBzmq_getsockopt\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_null.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_null.7 new file mode 100644 index 00000000000000..42497a11594113 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_null.7 @@ -0,0 +1,40 @@ +'\" t +.\" Title: zmq_null +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_NULL" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_null \- no security or confidentiality +.SH "SYNOPSIS" +.sp +The NULL mechanism is defined by the ZMTP 3\&.0 specification: \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:23\fR\m[]\&. This is the default security mechanism for ZeroMQ sockets\&. +.SH "SEE ALSO" +.sp +\fBzmq_plain\fR(7) \fBzmq_curve\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_pgm.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_pgm.7 new file mode 100644 index 00000000000000..ea8ca3fc155eb9 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_pgm.7 @@ -0,0 +1,200 @@ +'\" t +.\" Title: zmq_pgm +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_PGM" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_pgm \- 0MQ reliable multicast transport using PGM +.SH "SYNOPSIS" +.sp +PGM (Pragmatic General Multicast) is a protocol for reliable multicast transport of data over IP networks\&. +.SH "DESCRIPTION" +.sp +0MQ implements two variants of PGM, the standard protocol where PGM datagrams are layered directly on top of IP datagrams as defined by RFC 3208 (the \fIpgm\fR transport) and "Encapsulated PGM" or EPGM where PGM datagrams are encapsulated inside UDP datagrams (the \fIepgm\fR transport)\&. +.sp +The \fIpgm\fR and \fIepgm\fR transports can only be used with the \fIZMQ_PUB\fR and \fIZMQ_SUB\fR socket types\&. +.sp +Further, PGM sockets are rate limited by default\&. For details, refer to the \fIZMQ_RATE\fR, and \fIZMQ_RECOVERY_IVL\fR options documented in \fBzmq_setsockopt\fR(3)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBCaution\fR +.ps -1 +.br +.sp +The \fIpgm\fR transport implementation requires access to raw IP sockets\&. Additional privileges may be required on some operating systems for this operation\&. Applications not requiring direct interoperability with other PGM implementations are encouraged to use the \fIepgm\fR transport instead which does not require any special privileges\&. +.sp .5v +.RE +.SH "ADDRESSING" +.sp +A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. +.sp +For the PGM transport, the transport is pgm, and for the EPGM protocol the transport is epgm\&. The meaning of the \fIaddress\fR part is defined below\&. +.SS "Connecting a socket" +.sp +When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fIpgm\fR or \fIepgm\fR transport, the \fIendpoint\fR shall be interpreted as an \fIinterface\fR followed by a semicolon, followed by a \fImulticast address\fR, followed by a colon and a port number\&. +.sp +An \fIinterface\fR may be specified by either of the following: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The interface name as defined by the operating system\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The primary IPv4 address assigned to the interface, in its numeric representation\&. +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +Interface names are not standardised in any way and should be assumed to be arbitrary and platform dependent\&. On Win32 platforms no short interface names exist, thus only the primary IPv4 address may be used to specify an \fIinterface\fR\&. The \fIinterface\fR part can be omitted, in that case the default one will be selected\&. +.sp .5v +.RE +.sp +A \fImulticast address\fR is specified by an IPv4 multicast address in its numeric representation\&. +.SH "WIRE FORMAT" +.sp +Consecutive PGM datagrams are interpreted by 0MQ as a single continuous stream of data where 0MQ messages are not necessarily aligned with PGM datagram boundaries and a single 0MQ message may span several PGM datagrams\&. This stream of data consists of 0MQ messages encapsulated in \fIframes\fR as described in \fBzmq_tcp\fR(7)\&. +.SS "PGM datagram payload" +.sp +The following ABNF grammar represents the payload of a single PGM datagram as used by 0MQ: +.sp +.if n \{\ +.RS 4 +.\} +.nf +datagram = (offset data) +offset = 2OCTET +data = *OCTET +.fi +.if n \{\ +.RE +.\} +.sp +In order for late joining consumers to be able to identify message boundaries, each PGM datagram payload starts with a 16\-bit unsigned integer in network byte order specifying either the offset of the first message \fIframe\fR in the datagram or containing the value 0xFFFF if the datagram contains solely an intermediate part of a larger message\&. +.sp +Note that offset specifies where the first message begins rather than the first message part\&. Thus, if there are trailing message parts at the beginning of the packet the offset ignores them and points to first initial message part in the packet\&. +.sp +The following diagram illustrates the layout of a single PGM datagram payload: +.sp +.if n \{\ +.RS 4 +.\} +.nf ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| offset (16 bits) | data | ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +.fi +.if n \{\ +.RE +.\} +.sp +The following diagram further illustrates how three example 0MQ frames are laid out in consecutive PGM datagram payloads: +.sp +.if n \{\ +.RS 4 +.\} +.nf +First datagram payload ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| Frame offset | Frame 1 | Frame 2, part 1 | +| 0x0000 | (Message 1) | (Message 2, part 1) | ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ + +Second datagram payload ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| Frame offset | Frame 2, part 2 | +| 0xFFFF | (Message 2, part 2) | ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ + +Third datagram payload ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| Frame offset | Frame 2, final 8 bytes | Frame 3 | +| 0x0008 | (Message 2, final 8 bytes) | (Message 3) | ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-+ +.fi +.if n \{\ +.RE +.\} +.SH "EXAMPLE" +.PP +\fBConnecting a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Connecting to the multicast address 239\&.192\&.1\&.1, port 5555, +// using the first Ethernet network interface on Linux +// and the Encapsulated PGM protocol +rc = zmq_connect(socket, "epgm://eth0;239\&.192\&.1\&.1:5555"); +assert (rc == 0); +// Connecting to the multicast address 239\&.192\&.1\&.1, port 5555, +// using the network interface with the address 192\&.168\&.1\&.1 +// and the standard PGM protocol +rc = zmq_connect(socket, "pgm://192\&.168\&.1\&.1;239\&.192\&.1\&.1:5555"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_connect\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_tcp\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_plain.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_plain.7 new file mode 100644 index 00000000000000..912c92d5a98bae --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_plain.7 @@ -0,0 +1,43 @@ +'\" t +.\" Title: zmq_plain +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_PLAIN" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_plain \- clear\-text authentication +.SH "SYNOPSIS" +.sp +The PLAIN mechanism defines a simple username/password mechanism that lets a server authenticate a client\&. PLAIN makes no attempt at security or confidentiality\&. It is intended for use on internal networks where security requirements are low\&. The PLAIN mechanism is defined by this document: \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:24\fR\m[]\&. +.SH "USAGE" +.sp +To use PLAIN, the server shall set the ZMQ_PLAIN_SERVER option, and the client shall set the ZMQ_PLAIN_USERNAME and ZMQ_PLAIN_PASSWORD socket options\&. Which peer binds, and which connects, is not relevant\&. +.SH "SEE ALSO" +.sp +\fBzmq_setsockopt\fR(3) \fBzmq_null\fR(7) \fBzmq_curve\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tcp.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tcp.7 new file mode 100644 index 00000000000000..e0e0e006779a55 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tcp.7 @@ -0,0 +1,188 @@ +'\" t +.\" Title: zmq_tcp +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_TCP" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_tcp \- 0MQ unicast transport using TCP +.SH "SYNOPSIS" +.sp +TCP is an ubiquitous, reliable, unicast transport\&. When connecting distributed applications over a network with 0MQ, using the TCP transport will likely be your first choice\&. +.SH "ADDRESSING" +.sp +A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. +.sp +For the TCP transport, the transport is tcp, and the meaning of the \fIaddress\fR part is defined below\&. +.SS "Assigning a local address to a socket" +.sp +When assigning a local address to a socket using \fIzmq_bind()\fR with the \fItcp\fR transport, the \fIendpoint\fR shall be interpreted as an \fIinterface\fR followed by a colon and the TCP port number to use\&. +.sp +An \fIinterface\fR may be specified by either of the following: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The wild\-card +*, meaning all available interfaces\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The primary IPv4 or IPv6 address assigned to the interface, in its numeric representation\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The non\-portable interface name as defined by the operating system\&. +.RE +.sp +The TCP port number may be specified by: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +A numeric value, usually above 1024 on POSIX systems\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The wild\-card +*, meaning a system\-assigned ephemeral port\&. +.RE +.sp +When using ephemeral ports, the caller should retrieve the actual assigned port using the ZMQ_LAST_ENDPOINT socket option\&. See \fBzmq_getsockopt\fR(3) for details\&. +.SS "Unbinding wild\-card address from a socket" +.sp +When wild\-card * \fIendpoint\fR was used in \fIzmq_bind()\fR, the caller should use real \fIendpoint\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket using \fIzmq_unbind()\fR\&. +.SS "Connecting a socket" +.sp +When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fItcp\fR transport, the \fIendpoint\fR shall be interpreted as a \fIpeer address\fR followed by a colon and the TCP port number to use\&. You can optionally specify a \fIsource_endpoint\fR which will be used as the source address for your connection; tcp://\fIsource_endpoint\fR;\*(Aqendpoint\*(Aq, see the \fIinterface\fR description above for details\&. +.sp +A \fIpeer address\fR may be specified by either of the following: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The DNS name of the peer\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The IPv4 or IPv6 address of the peer, in its numeric representation\&. +.RE +.sp +Note: A description of the ZeroMQ Message Transport Protocol (ZMTP) which is used by the TCP transport can be found at \m[blue]\fBhttp://rfc\&.zeromq\&.org/spec:15\fR\m[] +.SH "EXAMPLES" +.PP +\fBAssigning a local address to a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// TCP port 5555 on all available interfaces +rc = zmq_bind(socket, "tcp://*:5555"); +assert (rc == 0); +// TCP port 5555 on the local loop\-back interface on all platforms +rc = zmq_bind(socket, "tcp://127\&.0\&.0\&.1:5555"); +assert (rc == 0); +// TCP port 5555 on the first Ethernet network interface on Linux +rc = zmq_bind(socket, "tcp://eth0:5555"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.PP +\fBConnecting a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Connecting using an IP address +rc = zmq_connect(socket, "tcp://192\&.168\&.1\&.1:5555"); +assert (rc == 0); +// Connecting using a DNS name +rc = zmq_connect(socket, "tcp://server1:5555"); +assert (rc == 0); +// Connecting using a DNS name and bind to eth1 +rc = zmq_connect(socket, "tcp://eth1:0;server1:5555"); +assert (rc == 0); +// Connecting using a IP address and bind to an IP address +rc = zmq_connect(socket, "tcp://192\&.168\&.1\&.17:5555;192\&.168\&.1\&.1:5555"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_pgm\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tipc.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tipc.7 new file mode 100644 index 00000000000000..cef14547579f7f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_tipc.7 @@ -0,0 +1,110 @@ +'\" t +.\" Title: zmq_tipc +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_TIPC" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_tipc \- 0MQ unicast transport using TIPC +.SH "SYNOPSIS" +.sp +TIPC is a cluster IPC protocol with a location transparent addressing scheme\&. +.SH "ADDRESSING" +.sp +A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. +.sp +For the TIPC transport, the transport is tipc, and the meaning of the \fIaddress\fR part is defined below\&. +.SS "Assigning a port name to a socket" +.sp +When assigning a port name to a socket using \fIzmq_bind()\fR with the \fItipc\fR transport, the \fIendpoint\fR is defined in the form: {type, lower, upper} +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Type is the numerical (u32) ID of your service\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Lower and Upper specify a range for your service\&. +.RE +.sp +Publishing the same service with overlapping lower/upper ID\(cqs will cause connection requests to be distributed over these in a round\-robin manner\&. +.SS "Connecting a socket" +.sp +When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fItipc\fR transport, the \fIendpoint\fR shall be interpreted as a service ID, followed by a comma and the instance ID\&. +.sp +The instance ID must be within the lower/upper range of a published port name for the endpoint to be valid\&. +.SH "EXAMPLES" +.PP +\fBAssigning a local address to a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Publish TIPC service ID 5555 +rc = zmq_bind(socket, "tipc://{5555,0,0}"); +assert (rc == 0); +// Publish TIPC service ID 5555 with a service range of 0\-100 +rc = zmq_bind(socket, "tipc://{5555,0,100}"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.PP +\fBConnecting a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Connect to service 5555 instance id 50 +rc = zmq_connect(socket, "tipc://{5555,50}"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_udp.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_udp.7 new file mode 100644 index 00000000000000..cda022097f1ded --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_udp.7 @@ -0,0 +1,139 @@ +'\" t +.\" Title: zmq_udp +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_UDP" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_udp \- 0MQ UDP multicast and unicast transport +.SH "SYNOPSIS" +.sp +UDP is unreliable protocol transport of data over IP networks\&. UDP support both unicast and multicast communication\&. +.SH "DESCRIPTION" +.sp +UDP transport can only be used with the \fIZMQ_RADIO\fR and \fIZMQ_DISH\fR socket types\&. +.SH "ADDRESSING" +.sp +A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. +.sp +For the UDP transport, the transport is udp\&. The meaning of the \fIaddress\fR part is defined below\&. +.sp +Binding a socket +.sp +.if n \{\ +.RS 4 +.\} +.nf +With \*(Aqudp\*(Aq we can only bind the \*(AqZMQ_DISH\*(Aq socket type\&. +When binding a socket using _zmq_bind()_ with the \*(Aqudp\*(Aq +transport the \*(Aqendpoint\*(Aq shall be interpreted as an \*(Aqinterface\*(Aq followed by a +colon and the UDP port number to use\&. + +An \*(Aqinterface\*(Aq may be specified by either of the following: + +* The wild\-card `*`, meaning all available interfaces\&. +* The primary IPv4 address assigned to the interface, in its numeric + representation\&. +* Multicast address in its numeric representation the socket should join\&. + +The UDP port number may be specified a numeric value, usually above 1024 on POSIX systems\&. + +Connecting a socket +.fi +.if n \{\ +.RE +.\} +.sp +With \fIudp\fR we can only connect the \fIZMQ_RADIO\fR socket type\&. When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fIudp\fR transport, the \fIendpoint\fR shall be interpreted as a \fIpeer address\fR followed by a colon and the UDP port number to use\&. +.sp +A \fIpeer address\fR may be specified by either of the following: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The IPv4 or IPv6 address of the peer, in its numeric representation\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Multicast address in its numeric representation\&. +.RE +.SH "EXAMPLES" +.PP +\fBBinding a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Unicast \- UDP port 5555 on all available interfaces +rc = zmq_bind(dish, "udp://*:5555"); +assert (rc == 0); +// Unicast \- UDP port 5555 on the local loop\-back interface +rc = zmq_bind(dish, "udp://127\&.0\&.0\&.1:5555"); +assert (rc == 0); +// Multicast \- UDP port 5555 on a Multicast address +rc = zmq_bind(dish, "udp://239\&.0\&.0\&.1:5555"); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.PP +\fBConnecting a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Connecting using an Unicast IP address +rc = zmq_connect(radio, "udp://192\&.168\&.1\&.1:5555"); +assert (rc == 0); +// Connecting using a Multicast address" +rc = zmq_connect(socket, "udp://239\&.0\&.0\&.1:5555); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_connect\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_tcp\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_vmci.7 b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_vmci.7 new file mode 100644 index 00000000000000..5383060905483e --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/man/man7/zmq_vmci.7 @@ -0,0 +1,162 @@ +'\" t +.\" Title: zmq_vmci +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 02/18/2017 +.\" Manual: 0MQ Manual +.\" Source: 0MQ 4.2.2 +.\" Language: English +.\" +.TH "ZMQ_VMCI" "7" "02/18/2017" "0MQ 4\&.2\&.2" "0MQ Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +zmq_vmci \- 0MQ transport over virtual machine communicatios interface (VMCI) sockets +.SH "SYNOPSIS" +.sp +The VMCI transport passes messages between VMware virtual machines running on the same host, between virtual machine and the host and within virtual machines (inter\-process transport like ipc)\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +Communication between a virtual machine and the host is not supported on Mac OS X 10\&.9 and above\&. +.sp .5v +.RE +.SH "ADDRESSING" +.sp +A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. +.sp +For the VMCI transport, the transport is vmci, and the meaning of the \fIaddress\fR part is defined below\&. +.SS "Binding a socket" +.sp +When binding a \fIsocket\fR to a local address using \fIzmq_bind()\fR with the \fIvmci\fR transport, the \fIendpoint\fR shall be interpreted as an \fIinterface\fR followed by a colon and the TCP port number to use\&. +.sp +An \fIinterface\fR may be specified by either of the following: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The wild\-card +*, meaning all available interfaces\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +An integer returned by +VMCISock_GetLocalCID +or +@ +(ZeroMQ will call VMCISock_GetLocalCID internally)\&. +.RE +.sp +The port may be specified by: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +A numeric value, usually above 1024 on POSIX systems\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +The wild\-card +*, meaning a system\-assigned ephemeral port\&. +.RE +.SS "Unbinding wild\-card address from a socket" +.sp +When wild\-card * \fIendpoint\fR was used in \fIzmq_bind()\fR, the caller should use real \fIendpoint\fR obtained from the ZMQ_LAST_ENDPOINT socket option to unbind this \fIendpoint\fR from a socket using \fIzmq_unbind()\fR\&. +.SS "Connecting a socket" +.sp +When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fIvmci\fR transport, the \fIendpoint\fR shall be interpreted as a \fIpeer address\fR followed by a colon and the port number to use\&. +.sp +A \fIpeer address\fR must be a CID of the peer\&. +.SH "EXAMPLES" +.PP +\fBAssigning a local address to a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// VMCI port 5555 on all available interfaces +rc = zmq_bind(socket, "vmci://*:5555"); +assert (rc == 0); +// VMCI port 5555 on the local loop\-back interface on all platforms +cid = VMCISock_GetLocalCID(); +sprintf(endpoint, "vmci://%d:5555", cid); +rc = zmq_bind(socket, endpoint); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.PP +\fBConnecting a socket\fR. +.sp +.if n \{\ +.RS 4 +.\} +.nf +// Connecting using a CID +sprintf(endpoint, "vmci://%d:5555", cid); +rc = zmq_connect(socket, endpoint); +assert (rc == 0); +.fi +.if n \{\ +.RE +.\} +.sp +.SH "SEE ALSO" +.sp +\fBzmq_bind\fR(3) \fBzmq_connect\fR(3) \fBzmq_inproc\fR(7) \fBzmq_tcp\fR(7) \fBzmq_pgm\fR(7) \fBzmq_vmci\fR(7) \fBzmq_getsockopt\fR(3) \fBzmq\fR(7) +.SH "AUTHORS" +.sp +This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&. diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zactor.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zactor.api new file mode 100644 index 00000000000000..2ff128b36e61f0 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zactor.api @@ -0,0 +1,62 @@ + + + provides a simple actor framework + + + Actors get a pipe and arguments from caller + + + + + + Create a new actor passing arbitrary arguments reference. + + + + + + Destroy an actor. + + + + Send a zmsg message to the actor, take ownership of the message + and destroy when it has been sent. + + + + + + Receive a zmsg message from the actor. Returns NULL if the actor + was interrupted before the message could be received, or if there + was a timeout on the actor. + + + + + Probe the supplied object, and report if it looks like a zactor_t. + + + + + + Probe the supplied reference. If it looks like a zactor_t instance, + return the underlying libzmq actor handle; else if it looks like + a libzmq actor handle, return the supplied value. + + + + + + Return the actor's zsock handle. Use this when you absolutely need + to work with the zsock instance rather than the actor. + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zarmour.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zarmour.api new file mode 100644 index 00000000000000..887ca9ffdbc765 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zarmour.api @@ -0,0 +1,103 @@ + + + armoured text encoding and decoding + + Standard base 64 + URL and filename friendly base 64 + Standard base 32 + Extended hex base 32 + Standard base 16 + Z85 from ZeroMQ RFC 32 + + + Create a new zarmour + + + + Destroy the zarmour + + + + Encode a stream of bytes into an armoured string. Returns the armoured + string, or NULL if there was insufficient memory available to allocate + a new string. + + + + + + + Decode an armoured string into a chunk. The decoded output is + null-terminated, so it may be treated as a string, if that's what + it was prior to encoding. + + + + + + Get the mode property. + + + + + Get printable string for mode. + + + + + Set the mode property. + + + + + Return true if padding is turned on. + + + + + Turn padding on or off. Default is on. + + + + + Get the padding character. + + + + + Set the padding character. + + + + + Return if splitting output into lines is turned on. Default is off. + + + + + Turn splitting output into lines on or off. + + + + + Get the line length used for splitting lines. + + + + + Set the line length used for splitting lines. + + + + + Print properties of object + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcert.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcert.api new file mode 100644 index 00000000000000..d361ba216525e2 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcert.api @@ -0,0 +1,122 @@ + + + work with CURVE security certificates + + + Create and initialize a new certificate in memory + + + + Accepts public/secret key pair from caller + + + + + + Load certificate from file + + + + + Destroy a certificate in memory + + + + Return public part of key pair as 32-byte binary string + + + + + Return secret part of key pair as 32-byte binary string + + + + + Return public part of key pair as Z85 armored string + + + + + Return secret part of key pair as Z85 armored string + + + + + Set certificate metadata from formatted string. + + + + + + Unset certificate metadata. + + + + + Get metadata value from certificate; if the metadata value doesn't + exist, returns NULL. + + + + + + Get list of metadata fields from certificate. Caller is responsible for + destroying list. Caller should not modify the values of list items. + + + + + Save full certificate (public + secret) to file for persistent storage + This creates one public file and one secret file (filename + "_secret"). + + + + + + Save public certificate only to file for persistent storage + + + + + + Save secret certificate only to file for persistent storage + + + + + + Apply certificate to socket, i.e. use for CURVE security on socket. + If certificate was loaded from public file, the secret key will be + undefined, and this certificate will not work successfully. + + + + + Return copy of certificate; if certificate is NULL or we exhausted + heap memory, returns NULL. + + + + + Return true if two certificates have the same keys + + + + + + Print certificate contents to stdout + + + + Self test of this class + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcertstore.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcertstore.api new file mode 100644 index 00000000000000..b566fefa533f24 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zcertstore.api @@ -0,0 +1,72 @@ + + + work with CURVE security certificate stores + + + Create a new certificate store from a disk directory, loading and + indexing all certificates in that location. The directory itself may be + absent, and created later, or modified at any time. The certificate store + is automatically refreshed on any zcertstore_lookup() call. If the + location is specified as NULL, creates a pure-memory store, which you + can work with by inserting certificates at runtime. + + + + + Destroy a certificate store object in memory. Does not affect anything + stored on disk. + + + + Loaders retrieve certificates from an arbitrary source. + + + + + Destructor for loader state. + + + + + Override the default disk loader with a custom loader fn. + + + + + + + Look up certificate by public key, returns zcert_t object if found, + else returns NULL. The public key is provided in Z85 text format. + + + + + + Insert certificate into certificate store in memory. Note that this + does not save the certificate to disk. To do that, use zcert_save() + directly on the certificate. Takes ownership of zcert_t object. + + + + + Empty certificate hashtable. This wrapper exists to be friendly to bindings, + which don't usually have access to struct internals. + + + + Print list of certificates in store to logging facility + + + + Self test of this class + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zchunk.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zchunk.api new file mode 100644 index 00000000000000..25b50e95815c00 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zchunk.api @@ -0,0 +1,171 @@ + + + work with memory chunks + + + Create a new chunk of the specified size. If you specify the data, it + is copied into the chunk. If you do not specify the data, the chunk is + allocated and left empty, and you can then add data using zchunk_append. + + + + + + Destroy a chunk + + + + Resizes chunk max_size as requested; chunk_cur size is set to zero + + + + + Return chunk cur size + + + + + Return chunk max size + + + + + Return chunk data + + + + + Set chunk data from user-supplied data; truncate if too large. Data may + be null. Returns actual size of chunk + + + + + + + Fill chunk data from user-supplied octet + + + + + + + Append user-supplied data to chunk, return resulting chunk size. If the + data would exceeded the available space, it is truncated. If you want to + grow the chunk to accommodate new data, use the zchunk_extend method. + + + + + + + Append user-supplied data to chunk, return resulting chunk size. If the + data would exceeded the available space, the chunk grows in size. + + + + + + + Copy as much data from 'source' into the chunk as possible; returns the + new size of chunk. If all data from 'source' is used, returns exhausted + on the source chunk. Source can be consumed as many times as needed until + it is exhausted. If source was already exhausted, does not change chunk. + + + + + + Returns true if the chunk was exhausted by consume methods, or if the + chunk has a size of zero. + + + + + Read chunk from an open file descriptor + + + + + + + Write chunk to an open file descriptor + + + + + + Try to slurp an entire file into a chunk. Will read up to maxsize of + the file. If maxsize is 0, will attempt to read the entire file and + fail with an assertion if that cannot fit into memory. Returns a new + chunk containing the file data, or NULL if the file could not be read. + + + + + + + Create copy of chunk, as new chunk object. Returns a fresh zchunk_t + object, or null if there was not enough heap memory. If chunk is null, + returns null. + + + + + Return chunk data encoded as printable hex string. Caller must free + string when finished with it. + + + + + Return chunk data copied into freshly allocated string + Caller must free string when finished with it. + + + + + Return TRUE if chunk body is equal to string, excluding terminator + + + + + + Transform zchunk into a zframe that can be sent in a message. + + + + + Transform a zframe into a zchunk. + + + + + + Calculate SHA1 digest for chunk, using zdigest class. + + + + + Dump chunk to FILE stream, for debugging and tracing. + + + + + Dump message to stderr, for debugging and tracing. + See zchunk_fprint for details + + + + Probe the supplied object, and report if it looks like a zchunk_t. + + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zclock.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zclock.api new file mode 100644 index 00000000000000..a613180f1529cb --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zclock.api @@ -0,0 +1,43 @@ + + + millisecond clocks and delays + + + Sleep for a number of milliseconds + + + + + Return current system clock as milliseconds. Note that this clock can + jump backwards (if the system clock is changed) so is unsafe to use for + timers and time offsets. Use zclock_mono for that instead. + + + + + Return current monotonic clock in milliseconds. Use this when you compute + time offsets. The monotonic clock is not affected by system changes and + so will never be reset backwards, unlike a system clock. + + + + + Return current monotonic clock in microseconds. Use this when you compute + time offsets. The monotonic clock is not affected by system changes and + so will never be reset backwards, unlike a system clock. + + + + + Return formatted date/time as fresh string. Free using zstr_free(). + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zconfig.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zconfig.api new file mode 100644 index 00000000000000..db46751fa8d7d9 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zconfig.api @@ -0,0 +1,196 @@ + + + work with config files written in rfc.zeromq.org/spec:4/ZPL. + + + + + + + + + + Create new config item + + + + + + Destroy a config item and all its children + + + + Return name of config item + + + + + Return value of config item + + + + + Insert or update configuration key with value + + + + + + Equivalent to zconfig_put, accepting a format specifier and variable + argument list, instead of a single string value. + + + + + + Get value for config item into a string value; leading slash is optional + and ignored. + + + + + + Set config item name, name may be NULL + + + + + Set new value for config item. The new value may be a string, a printf + format, or NULL. Note that if string may possibly contain '%', or if it + comes from an insecure source, you must use '%s' as the format, followed + by the string. + + + + + Find our first child, if any + + + + + Find our first sibling, if any + + + + + Find a config item along a path; leading slash is optional and ignored. + + + + + + Locate the last config item at a specified depth + + + + + + Execute a callback for each config item in the tree; returns zero if + successful, else -1. + + + + + + + Add comment to config item before saving to disk. You can add as many + comment lines as you like. If you use a null format, all comments are + deleted. + + + + + Return comments of config item, as zlist. + + + + + Load a config tree from a specified ZPL text file; returns a zconfig_t + reference for the root, if the file exists and is readable. Returns NULL + if the file does not exist. + + + + + Save a config tree to a specified ZPL text file, where a filename + "-" means dump to standard output. + + + + + + Equivalent to zconfig_load, taking a format string instead of a fixed + filename. + + + + + Equivalent to zconfig_save, taking a format string instead of a fixed + filename. + + + + + + Report filename used during zconfig_load, or NULL if none + + + + + Reload config tree from same file that it was previously loaded from. + Returns 0 if OK, -1 if there was an error (and then does not change + existing data). + + + + + + Load a config tree from a memory chunk + + + + + + Save a config tree to a new memory chunk + + + + + Load a config tree from a null-terminated string + + + + + + Save a config tree to a new null terminated string + + + + + Return true if a configuration tree was loaded from a file and that + file has changed in since the tree was loaded. + + + + + Print the config file to open stream + + + + + Print properties of object + + + + Self test of this class + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdigest.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdigest.api new file mode 100644 index 00000000000000..83abb9b121d6d8 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdigest.api @@ -0,0 +1,45 @@ + + + provides hashing functions (SHA-1 at present) + + + Constructor - creates new digest object, which you use to build up a + digest by repeatedly calling zdigest_update() on chunks of data. + + + + Destroy a digest object + + + + Add buffer into digest calculation + + + + + + Return final digest hash data. If built without crypto support, + returns NULL. + + + + + Return final digest hash size + + + + + Return digest as printable hex string; caller should not modify nor + free this string. After calling this, you may not use zdigest_update() + on the same digest. If built without crypto support, returns NULL. + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir.api new file mode 100644 index 00000000000000..cb8283a7027e56 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir.api @@ -0,0 +1,124 @@ + + + work with file-system directories + + + Create a new directory item that loads in the full tree of the specified + path, optionally located under some parent path. If parent is "-", then + loads only the top-level directory, and does not use parent as a path. + + + + + + Destroy a directory tree and all children it contains. + + + + Return directory path + + + + + Return last modification time for directory. + + + + + Return total hierarchy size, in bytes of data contained in all files + in the directory tree. + + + + + Return directory count + + + + + Returns a sorted list of zfile objects; Each entry in the list is a pointer + to a zfile_t item already allocated in the zdir tree. Do not destroy the + original zdir tree until you are done with this list. + + + + + Remove directory, optionally including all files that it contains, at + all levels. If force is false, will only remove the directory if empty. + If force is true, will remove all files and all subdirectories. + + + + + Calculate differences between two versions of a directory tree. + Returns a list of zdir_patch_t patches. Either older or newer may + be null, indicating the directory is empty/absent. If alias is set, + generates virtual filename (minus path, plus alias). + + + + + + + + Return full contents of directory as a zdir_patch list. + + + + + + Load directory cache; returns a hash table containing the SHA-1 digests + of every file in the tree. The cache is saved between runs in .cache. + + + + + Print contents of directory to open stream + + + + + + Print contents of directory to stdout + + + + + Create a new zdir_watch actor instance: + + zactor_t *watch = zactor_new (zdir_watch, NULL); + + Destroy zdir_watch instance: + + zactor_destroy (&watch); + + Enable verbose logging of commands and activity: + + zstr_send (watch, "VERBOSE"); + + Subscribe to changes to a directory path: + + zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); + + Unsubscribe from changes to a directory path: + + zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); + + Receive directory changes: + zsock_recv (watch, "sp", &path, &patches); + + // Delete the received data. + free (path); + zlist_destroy (&patches); + + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir_patch.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir_patch.api new file mode 100644 index 00000000000000..8d102b887ae839 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zdir_patch.api @@ -0,0 +1,62 @@ + + + work with directory patches + + Creates a new file + Delete a file + + + Create new patch + + + + + + + + Destroy a patch + + + + Create copy of a patch. If the patch is null, or memory was exhausted, + returns null. + + + + + Return patch file directory path + + + + + Return patch file item + + + + + Return operation + + + + + Return patch virtual file path + + + + + Calculate hash digest for file (create only) + + + + Return hash digest for patch file + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zfile.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zfile.api new file mode 100644 index 00000000000000..f60391bfeea16f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zfile.api @@ -0,0 +1,152 @@ + + + helper functions for working with files. + + + If file exists, populates properties. CZMQ supports portable symbolic + links, which are files with the extension ".ln". A symbolic link is a + text file containing one line, the filename of a target file. Reading + data from the symbolic link actually reads from the target file. Path + may be NULL, in which case it is not used. + + + + + + Destroy a file item + + + + Duplicate a file item, returns a newly constructed item. If the file + is null, or memory was exhausted, returns null. + + + + + Return file name, remove path if provided + + + + + + Refresh file properties from disk; this is not done automatically + on access methods, otherwise it is not possible to compare directory + snapshots. + + + + Return when the file was last modified. If you want this to reflect the + current situation, call zfile_restat before checking this property. + + + + + Return the last-known size of the file. If you want this to reflect the + current situation, call zfile_restat before checking this property. + + + + + Return true if the file is a directory. If you want this to reflect + any external changes, call zfile_restat before checking this property. + + + + + Return true if the file is a regular file. If you want this to reflect + any external changes, call zfile_restat before checking this property. + + + + + Return true if the file is readable by this process. If you want this to + reflect any external changes, call zfile_restat before checking this + property. + + + + + Return true if the file is writeable by this process. If you want this + to reflect any external changes, call zfile_restat before checking this + property. + + + + + Check if file has stopped changing and can be safely processed. + Updates the file statistics from disk at every call. + + + + + Return true if the file was changed on disk since the zfile_t object + was created, or the last zfile_restat() call made on it. + + + + + Remove the file from disk + + + + Open file for reading + Returns 0 if OK, -1 if not found or not accessible + + + + + Open file for writing, creating directory if needed + File is created if necessary; chunks can be written to file at any + location. Returns 0 if OK, -1 if error. + + + + + Read chunk from file at specified position. If this was the last chunk, + sets the eof property. Returns a null chunk in case of error. + + + + + + + Returns true if zfile_read() just read the last chunk in the file. + + + + + Write chunk to file at specified position + Return 0 if OK, else -1 + + + + + + + Read next line of text from file. Returns a pointer to the text line, + or NULL if there was nothing more to read from the file. + + + + + Close file, if open + + + + Return file handle, if opened + + + + + Calculate SHA1 digest for file, using zdigest class. + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zframe.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zframe.api new file mode 100644 index 00000000000000..cf3c3219f6f6c6 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zframe.api @@ -0,0 +1,156 @@ + + + working with single message frames + + + + + + + Create a new frame. If size is not null, allocates the frame data + to the specified size. If additionally, data is not null, copies + size octets from the specified data into the frame body. + + + + + + Destroy a frame + + + + Create an empty (zero-sized) frame + + + + Create a frame with a specified string content. + + + + + Receive frame from socket, returns zframe_t object or NULL if the recv + was interrupted. Does a blocking recv, if you want to not block then use + zpoller or zloop. + + + + + Send a frame to a socket, destroy frame after sending. + Return -1 on error, 0 on success. + + + + + + + + Return number of bytes in frame data + + + + + Return address of frame data + + + + + Return meta data property for frame + Caller must free string when finished with it. + + + + + + Create a new frame that duplicates an existing frame. If frame is null, + or memory was exhausted, returns null. + + + + + Return frame data encoded as printable hex string, useful for 0MQ UUIDs. + Caller must free string when finished with it. + + + + + Return frame data copied into freshly allocated string + Caller must free string when finished with it. + + + + + Return TRUE if frame body is equal to string, excluding terminator + + + + + + Return frame MORE indicator (1 or 0), set when reading frame from socket + or by the zframe_set_more() method + + + + + Set frame MORE indicator (1 or 0). Note this is NOT used when sending + frame to socket, you have to specify flag explicitly. + + + + + Return frame routing ID, if the frame came from a ZMQ_SERVER socket. + Else returns zero. + + + + + Set routing ID on frame. This is used if/when the frame is sent to a + ZMQ_SERVER socket. + + + + + Return frame group of radio-dish pattern. + + + + + Set group on frame. This is used if/when the frame is sent to a + ZMQ_RADIO socket. + Return -1 on error, 0 on success. + + + + + + Return TRUE if two frames have identical size and data + If either frame is NULL, equality is always false. + + + + + + Set new contents for frame + + + + + + Send message to zsys log sink (may be stdout, or system facility as + configured by zsys_set_logstream). Prefix shows before frame, if not null. + + + + + Probe the supplied object, and report if it looks like a zframe_t. + + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zgossip_msg.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zgossip_msg.api new file mode 100644 index 00000000000000..0f314fab7c5bf8 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zgossip_msg.api @@ -0,0 +1,104 @@ + + + + + + + + + + Create a new empty zgossip_msg + + + + Destroy a zgossip_msg instance + + + + Receive a zgossip_msg from the socket. Returns 0 if OK, -1 if + there was an error. Blocks if there is no message waiting. + + + + + + Send the zgossip_msg to the output socket, does not destroy it + + + + + + Print contents of message to stdout + + + + Get the message routing id, as a frame + + + + + Set the message routing id from a frame + + + + + Get the zgossip_msg message id + + + + + Set the zgossip_msg message id + + + + + Get the zgossip_msg message id as printable text + + + + + Get the key field + + + + Set the key field + + + + Get the value field + + + + Set the value field + + + + Get the ttl field + + + + Set the ttl field + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhash.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhash.api new file mode 100644 index 00000000000000..36d58847af46e4 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhash.api @@ -0,0 +1,183 @@ + + + generic type-free hash container (simple) + + + Callback function for zhash_freefn method + + + + + Create a new, empty hash container + + + + Destroy a hash container and all items in it + + + + Insert item into hash table with specified key and item. + If key is already present returns -1 and leaves existing item unchanged + Returns 0 on success. + + + + + + + Update item into hash table with specified key and item. + If key is already present, destroys old item and inserts new one. + Use free_fn method to ensure deallocator is properly called on item. + + + + + + Remove an item specified by key from the hash table. If there was no such + item, this function does nothing. + + + + + Return the item at the specified key, or null + + + + + + Reindexes an item from an old key to a new key. If there was no such + item, does nothing. Returns 0 if successful, else -1. + + + + + + + Set a free function for the specified hash table item. When the item is + destroyed, the free function, if any, is called on that item. + Use this when hash items are dynamically allocated, to ensure that + you don't have memory leaks. You can pass 'free' or NULL as a free_fn. + Returns the item, or NULL if there is no such item. + + + + + + + Return the number of keys/items in the hash table + + + + + Make copy of hash table; if supplied table is null, returns null. + Does not copy items themselves. Rebuilds new table so may be slow on + very large tables. NOTE: only works with item values that are strings + since there's no other way to know how to duplicate the item value. + + + + + Return keys for items in table + + + + + Simple iterator; returns first item in hash table, in no given order, + or NULL if the table is empty. This method is simpler to use than the + foreach() method, which is deprecated. To access the key for this item + use zhash_cursor(). NOTE: do NOT modify the table while iterating. + + + + + Simple iterator; returns next item in hash table, in no given order, + or NULL if the last item was already returned. Use this together with + zhash_first() to process all items in a hash table. If you need the + items in sorted order, use zhash_keys() and then zlist_sort(). To + access the key for this item use zhash_cursor(). NOTE: do NOT modify + the table while iterating. + + + + + After a successful first/next method, returns the key for the item that + was returned. This is a constant string that you may not modify or + deallocate, and which lasts as long as the item in the hash. After an + unsuccessful first/next, returns NULL. + + + + + Add a comment to hash table before saving to disk. You can add as many + comment lines as you like. These comment lines are discarded when loading + the file. If you use a null format, all comments are deleted. + + + + + Serialize hash table to a binary frame that can be sent in a message. + The packed format is compatible with the 'dictionary' type defined in + http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: + + ; A list of name/value pairs + dictionary = dict-count *( dict-name dict-value ) + dict-count = number-4 + dict-value = longstr + dict-name = string + + ; Strings are always length + text contents + longstr = number-4 *VCHAR + string = number-1 *VCHAR + + ; Numbers are unsigned integers in network byte order + number-1 = 1OCTET + number-4 = 4OCTET + + Comments are not included in the packed data. Item values MUST be + strings. + + + + + Unpack binary frame into a new hash table. Packed data must follow format + defined by zhash_pack. Hash table is set to autofree. An empty frame + unpacks to an empty hash table. + + + + + Save hash table to a text file in name=value format. Hash values must be + printable strings; keys may not contain '=' character. Returns 0 if OK, + else -1 if a file error occurred. + + + + + + Load hash table from a text file in name=value format; hash table must + already exist. Hash values must printable strings; keys may not contain + '=' character. Returns 0 if OK, else -1 if a file was not readable. + + + + + + When a hash table was loaded from a file by zhash_load, this method will + reload the file if it has been modified since, and is "stable", i.e. not + still changing. Returns 0 if OK, -1 if there was an error reloading the + file. + + + + + Set hash for automatic value destruction + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhashx.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhashx.api new file mode 100644 index 00000000000000..22087e0fe9fcd2 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zhashx.api @@ -0,0 +1,293 @@ + + + extended generic type-free hash container + + + Destroy an item + + + + + Duplicate an item + + + + + + Compare two items, for sorting + + + + + + + compare two items, for sorting + + + + + compare two items, for sorting + + + + + + Serializes an item to a longstr. + The caller takes ownership of the newly created object. + + + + + + Deserializes a longstr into an item. + The caller takes ownership of the newly created object. + + + + + + Create a new, empty hash container + + + + Destroy a hash container and all items in it + + + + Insert item into hash table with specified key and item. + If key is already present returns -1 and leaves existing item unchanged + Returns 0 on success. + + + + + + + Update or insert item into hash table with specified key and item. If the + key is already present, destroys old item and inserts new one. If you set + a container item destructor, this is called on the old value. If the key + was not already present, inserts a new item. Sets the hash cursor to the + new item. + + + + + + Remove an item specified by key from the hash table. If there was no such + item, this function does nothing. + + + + + Delete all items from the hash table. If the key destructor is + set, calls it on every key. If the item destructor is set, calls + it on every item. + + + + Return the item at the specified key, or null + + + + + + Reindexes an item from an old key to a new key. If there was no such + item, does nothing. Returns 0 if successful, else -1. + + + + + + + Set a free function for the specified hash table item. When the item is + destroyed, the free function, if any, is called on that item. + Use this when hash items are dynamically allocated, to ensure that + you don't have memory leaks. You can pass 'free' or NULL as a free_fn. + Returns the item, or NULL if there is no such item. + + + + + + + Return the number of keys/items in the hash table + + + + + Return a zlistx_t containing the keys for the items in the + table. Uses the key_duplicator to duplicate all keys and sets the + key_destructor as destructor for the list. + + + + + Return a zlistx_t containing the values for the items in the + table. Uses the duplicator to duplicate all items and sets the + destructor as destructor for the list. + + + + + Simple iterator; returns first item in hash table, in no given order, + or NULL if the table is empty. This method is simpler to use than the + foreach() method, which is deprecated. To access the key for this item + use zhashx_cursor(). NOTE: do NOT modify the table while iterating. + + + + + Simple iterator; returns next item in hash table, in no given order, + or NULL if the last item was already returned. Use this together with + zhashx_first() to process all items in a hash table. If you need the + items in sorted order, use zhashx_keys() and then zlistx_sort(). To + access the key for this item use zhashx_cursor(). NOTE: do NOT modify + the table while iterating. + + + + + After a successful first/next method, returns the key for the item that + was returned. This is a constant string that you may not modify or + deallocate, and which lasts as long as the item in the hash. After an + unsuccessful first/next, returns NULL. + + + + + Add a comment to hash table before saving to disk. You can add as many + comment lines as you like. These comment lines are discarded when loading + the file. If you use a null format, all comments are deleted. + + + + + Save hash table to a text file in name=value format. Hash values must be + printable strings; keys may not contain '=' character. Returns 0 if OK, + else -1 if a file error occurred. + + + + + + Load hash table from a text file in name=value format; hash table must + already exist. Hash values must printable strings; keys may not contain + '=' character. Returns 0 if OK, else -1 if a file was not readable. + + + + + + When a hash table was loaded from a file by zhashx_load, this method will + reload the file if it has been modified since, and is "stable", i.e. not + still changing. Returns 0 if OK, -1 if there was an error reloading the + file. + + + + + Serialize hash table to a binary frame that can be sent in a message. + The packed format is compatible with the 'dictionary' type defined in + http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: + + ; A list of name/value pairs + dictionary = dict-count *( dict-name dict-value ) + dict-count = number-4 + dict-value = longstr + dict-name = string + + ; Strings are always length + text contents + longstr = number-4 *VCHAR + string = number-1 *VCHAR + + ; Numbers are unsigned integers in network byte order + number-1 = 1OCTET + number-4 = 4OCTET + + Comments are not included in the packed data. Item values MUST be + strings. + + + + + Same as pack but uses a user-defined serializer function to convert items + into longstr. + + + + + + Unpack binary frame into a new hash table. Packed data must follow format + defined by zhashx_pack. Hash table is set to autofree. An empty frame + unpacks to an empty hash table. + + + + + Same as unpack but uses a user-defined deserializer function to convert + a longstr back into item format. + + + + + + Make a copy of the list; items are duplicated if you set a duplicator + for the list, otherwise not. Copying a null reference returns a null + reference. Note that this method's behavior changed slightly for CZMQ + v3.x, as it does not set nor respect autofree. It does however let you + duplicate any hash table safely. The old behavior is in zhashx_dup_v2. + + + + + Set a user-defined deallocator for hash items; by default items are not + freed when the hash is destroyed. + + + + + Set a user-defined duplicator for hash items; by default items are not + copied when the hash is duplicated. + + + + + Set a user-defined deallocator for keys; by default keys are freed + when the hash is destroyed using free(). + + + + + Set a user-defined duplicator for keys; by default keys are duplicated + using strdup. + + + + + Set a user-defined comparator for keys; by default keys are + compared using strcmp. + + + + + Set a user-defined comparator for keys; by default keys are + compared using strcmp. + + + + + Make copy of hash table; if supplied table is null, returns null. + Does not copy items themselves. Rebuilds new table so may be slow on + very large tables. NOTE: only works with item values that are strings + since there's no other way to know how to duplicate the item value. + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ziflist.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ziflist.api new file mode 100644 index 00000000000000..5dc362463c0dee --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ziflist.api @@ -0,0 +1,58 @@ + + + List of network interfaces available on system + + + Get a list of network interfaces currently defined on the system + + + + Destroy a ziflist instance + + + + Reload network interfaces from system + + + + Return the number of network interfaces on system + + + + + Get first network interface, return NULL if there are none + + + + + Get next network interface, return NULL if we hit the last one + + + + + Return the current interface IP address as a printable string + + + + + Return the current interface broadcast address as a printable string + + + + + Return the current interface network mask as a printable string + + + + + Return the list of interfaces. + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlist.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlist.api new file mode 100644 index 00000000000000..67b4f01c577b5f --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlist.api @@ -0,0 +1,158 @@ + + + simple generic list container + + + Comparison function e.g. for sorting and removing. + + + + + + + Callback function for zlist_freefn method + + + + + Create a new list container + + + + Destroy a list container + + + + Return the item at the head of list. If the list is empty, returns NULL. + Leaves cursor pointing at the head item, or NULL if the list is empty. + + + + + Return the next item. If the list is empty, returns NULL. To move to + the start of the list call zlist_first (). Advances the cursor. + + + + + Return the item at the tail of list. If the list is empty, returns NULL. + Leaves cursor pointing at the tail item, or NULL if the list is empty. + + + + + Return first item in the list, or null, leaves the cursor + + + + + Return last item in the list, or null, leaves the cursor + + + + + Return the current item of list. If the list is empty, returns NULL. + Leaves cursor pointing at the current item, or NULL if the list is empty. + + + + + Append an item to the end of the list, return 0 if OK or -1 if this + failed for some reason (out of memory). Note that if a duplicator has + been set, this method will also duplicate the item. + + + + + + Push an item to the start of the list, return 0 if OK or -1 if this + failed for some reason (out of memory). Note that if a duplicator has + been set, this method will also duplicate the item. + + + + + + Pop the item off the start of the list, if any + + + + + Checks if an item already is present. Uses compare method to determine if + items are equal. If the compare method is NULL the check will only compare + pointers. Returns true if item is present else false. + + + + + + Remove the specified item from the list if present + + + + + Make a copy of list. If the list has autofree set, the copied list will + duplicate all items, which must be strings. Otherwise, the list will hold + pointers back to the items in the original list. If list is null, returns + NULL. + + + + + Purge all items from list + + + + Return number of items in the list + + + + + Sort the list. If the compare function is null, sorts the list by + ascending key value using a straight ASCII comparison. If you specify + a compare function, this decides how items are sorted. The sort is not + stable, so may reorder items with the same keys. The algorithm used is + combsort, a compromise between performance and simplicity. + + + + + Set list for automatic item destruction; item values MUST be strings. + By default a list item refers to a value held elsewhere. When you set + this, each time you append or push a list item, zlist will take a copy + of the string value. Then, when you destroy the list, it will free all + item values automatically. If you use any other technique to allocate + list values, you must free them explicitly before destroying the list. + The usual technique is to pop list items and destroy them, until the + list is empty. + + + + Sets a compare function for this list. The function compares two items. + It returns an integer less than, equal to, or greater than zero if the + first item is found, respectively, to be less than, to match, or be + greater than the second item. + This function is used for sorting, removal and exists checking. + + + + + Set a free function for the specified list item. When the item is + destroyed, the free function, if any, is called on that item. + Use this when list items are dynamically allocated, to ensure that + you don't have memory leaks. You can pass 'free' or NULL as a free_fn. + Returns the item, or NULL if there is no such item. + + + + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlistx.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlistx.api new file mode 100644 index 00000000000000..1dc95ea6374f9c --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zlistx.api @@ -0,0 +1,220 @@ + + + extended generic list container + + + Destroy an item + + + + + Duplicate an item + + + + + + Compare two items, for sorting + + + + + + + Create a new, empty list. + + + + Destroy a list. If an item destructor was specified, all items in the + list are automatically destroyed as well. + + + + Add an item to the head of the list. Calls the item duplicator, if any, + on the item. Resets cursor to list head. Returns an item handle on + success, NULL if memory was exhausted. + + + + + + Add an item to the tail of the list. Calls the item duplicator, if any, + on the item. Resets cursor to list head. Returns an item handle on + success, NULL if memory was exhausted. + + + + + + Return the number of items in the list + + + + + Return first item in the list, or null, leaves the cursor + + + + + Return last item in the list, or null, leaves the cursor + + + + + Return the item at the head of list. If the list is empty, returns NULL. + Leaves cursor pointing at the head item, or NULL if the list is empty. + + + + + Return the next item. At the end of the list (or in an empty list), + returns NULL. Use repeated zlistx_next () calls to work through the list + from zlistx_first (). First time, acts as zlistx_first(). + + + + + Return the previous item. At the start of the list (or in an empty list), + returns NULL. Use repeated zlistx_prev () calls to work through the list + backwards from zlistx_last (). First time, acts as zlistx_last(). + + + + + Return the item at the tail of list. If the list is empty, returns NULL. + Leaves cursor pointing at the tail item, or NULL if the list is empty. + + + + + Returns the value of the item at the cursor, or NULL if the cursor is + not pointing to an item. + + + + + Returns the handle of the item at the cursor, or NULL if the cursor is + not pointing to an item. + + + + + Returns the item associated with the given list handle, or NULL if passed + in handle is NULL. Asserts that the passed in handle points to a list element. + + + + + + Find an item in the list, searching from the start. Uses the item + comparator, if any, else compares item values directly. Returns the + item handle found, or NULL. Sets the cursor to the found item, if any. + + + + + + Detach an item from the list, using its handle. The item is not modified, + and the caller is responsible for destroying it if necessary. If handle is + null, detaches the first item on the list. Returns item that was detached, + or null if none was. If cursor was at item, moves cursor to previous item, + so you can detach items while iterating forwards through a list. + + + + + + Detach item at the cursor, if any, from the list. The item is not modified, + and the caller is responsible for destroying it as necessary. Returns item + that was detached, or null if none was. Moves cursor to previous item, so + you can detach items while iterating forwards through a list. + + + + + Delete an item, using its handle. Calls the item destructor is any is + set. If handle is null, deletes the first item on the list. Returns 0 + if an item was deleted, -1 if not. If cursor was at item, moves cursor + to previous item, so you can delete items while iterating forwards + through a list. + + + + + + Move an item to the start of the list, via its handle. + + + + + Move an item to the end of the list, via its handle. + + + + + Remove all items from the list, and destroy them if the item destructor + is set. + + + + Sort the list. If an item comparator was set, calls that to compare + items, otherwise compares on item value. The sort is not stable, so may + reorder equal items. + + + + Create a new node and insert it into a sorted list. Calls the item + duplicator, if any, on the item. If low_value is true, starts searching + from the start of the list, otherwise searches from the end. Use the item + comparator, if any, to find where to place the new node. Returns a handle + to the new node, or NULL if memory was exhausted. Resets the cursor to the + list head. + + + + + + + Move an item, specified by handle, into position in a sorted list. Uses + the item comparator, if any, to determine the new location. If low_value + is true, starts searching from the start of the list, otherwise searches + from the end. + + + + + + Make a copy of the list; items are duplicated if you set a duplicator + for the list, otherwise not. Copying a null reference returns a null + reference. + + + + + Set a user-defined deallocator for list items; by default items are not + freed when the list is destroyed. + + + + + Set a user-defined duplicator for list items; by default items are not + copied when the list is duplicated. + + + + + Set a user-defined comparator for zlistx_find and zlistx_sort; the method + must return -1, 0, or 1 depending on whether item1 is less than, equal to, + or greater than, item2. + + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zloop.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zloop.api new file mode 100644 index 00000000000000..429e3b517a89fc --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zloop.api @@ -0,0 +1,176 @@ + + + event-driven reactor + + + Callback function for reactor socket activity + + + + + + + + Callback function for reactor events (low-level) + + + + + + + + Callback for reactor timer events + + + + + + + + Create a new zloop reactor + + + + Destroy a reactor + + + + Register socket reader with the reactor. When the reader has messages, + the reactor will call the handler, passing the arg. Returns 0 if OK, -1 + if there was an error. If you register the same socket more than once, + each instance will invoke its corresponding handler. + + + + + + + + Cancel a socket reader from the reactor. If multiple readers exist for + same socket, cancels ALL of them. + + + + + Configure a registered reader to ignore errors. If you do not set this, + then readers that have errors are removed from the reactor silently. + + + + + Register low-level libzmq pollitem with the reactor. When the pollitem + is ready, will call the handler, passing the arg. Returns 0 if OK, -1 + if there was an error. If you register the pollitem more than once, each + instance will invoke its corresponding handler. A pollitem with + socket=NULL and fd=0 means 'poll on FD zero'. + + + + + + + + Cancel a pollitem from the reactor, specified by socket or FD. If both + are specified, uses only socket. If multiple poll items exist for same + socket/FD, cancels ALL of them. + + + + + Configure a registered poller to ignore errors. If you do not set this, + then poller that have errors are removed from the reactor silently. + + + + + Register a timer that expires after some delay and repeats some number of + times. At each expiry, will call the handler, passing the arg. To run a + timer forever, use 0 times. Returns a timer_id that is used to cancel the + timer in the future. Returns -1 if there was an error. + + + + + + + + + Cancel a specific timer identified by a specific timer_id (as returned by + zloop_timer). + + + + + + Register a ticket timer. Ticket timers are very fast in the case where + you use a lot of timers (thousands), and frequently remove and add them. + The main use case is expiry timers for servers that handle many clients, + and which reset the expiry timer for each message received from a client. + Whereas normal timers perform poorly as the number of clients grows, the + cost of ticket timers is constant, no matter the number of clients. You + must set the ticket delay using zloop_set_ticket_delay before creating a + ticket. Returns a handle to the timer that you should use in + zloop_ticket_reset and zloop_ticket_delete. + + + + + + + Reset a ticket timer, which moves it to the end of the ticket list and + resets its execution time. This is a very fast operation. + + + + + Delete a ticket timer. We do not actually delete the ticket here, as + other code may still refer to the ticket. We mark as deleted, and remove + later and safely. + + + + + Set the ticket delay, which applies to all tickets. If you lower the + delay and there are already tickets created, the results are undefined. + + + + + Set hard limit on number of timers allowed. Setting more than a small + number of timers (10-100) can have a dramatic impact on the performance + of the reactor. For high-volume cases, use ticket timers. If the hard + limit is reached, the reactor stops creating new timers and logs an + error. + + + + + Set verbose tracing of reactor on/off. The default verbose setting is + off (false). + + + + + By default the reactor stops if the process receives a SIGINT or SIGTERM + signal. This makes it impossible to shut-down message based architectures + like zactors. This method lets you switch off break handling. The default + nonstop setting is off (false). + + + + + Start the reactor. Takes control of the thread and returns when the 0MQ + context is terminated or the process is interrupted, or any event handler + returns -1. Event handlers may register new sockets and timers, and + cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zmsg.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zmsg.api new file mode 100644 index 00000000000000..6205fd02e3d50b --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zmsg.api @@ -0,0 +1,250 @@ + + + working with multipart messages + + + Create a new empty message object + + + + Destroy a message object and all frames it contains + + + + Receive message from socket, returns zmsg_t object or NULL if the recv + was interrupted. Does a blocking recv. If you want to not block then use + the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input + before receiving. + + + + + Send message to destination socket, and destroy the message after sending + it successfully. If the message has no frames, sends nothing but destroys + the message anyhow. Nullifies the caller's reference to the message (as + it is a destructor). + + + + + + + Send message to destination socket as part of a multipart sequence, and + destroy the message after sending it successfully. Note that after a + zmsg_sendm, you must call zmsg_send or another method that sends a final + message part. If the message has no frames, sends nothing but destroys + the message anyhow. Nullifies the caller's reference to the message (as + it is a destructor). + + + + + + + Return size of message, i.e. number of frames (0 or more). + + + + + Return total size of all frames in message. + + + + + Return message routing ID, if the message came from a ZMQ_SERVER socket. + Else returns zero. + + + + + Set routing ID on message. This is used if/when the message is sent to a + ZMQ_SERVER socket. + + + + + Push frame to the front of the message, i.e. before all other frames. + Message takes ownership of frame, will destroy it when message is sent. + Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not + nullify the caller's frame reference. + + + + + + Add frame to the end of the message, i.e. after all other frames. + Message takes ownership of frame, will destroy it when message is sent. + Returns 0 on success. Deprecates zmsg_add, which did not nullify the + caller's frame reference. + + + + + + Remove first frame from message, if any. Returns frame, or NULL. + + + + + Push block of memory to front of message, as a new frame. + Returns 0 on success, -1 on error. + + + + + + + Add block of memory to the end of the message, as a new frame. + Returns 0 on success, -1 on error. + + + + + + + Push string as new frame to front of message. + Returns 0 on success, -1 on error. + + + + + + Push string as new frame to end of message. + Returns 0 on success, -1 on error. + + + + + + Push formatted string as new frame to front of message. + Returns 0 on success, -1 on error. + + + + + + Push formatted string as new frame to end of message. + Returns 0 on success, -1 on error. + + + + + + Pop frame off front of message, return as fresh string. If there were + no more frames in the message, returns NULL. + + + + + Push encoded message as a new frame. Message takes ownership of + submessage, so the original is destroyed in this call. Returns 0 on + success, -1 on error. + + + + + + Remove first submessage from message, if any. Returns zmsg_t, or NULL if + decoding was not successful. + + + + + Remove specified frame from list, if present. Does not destroy frame. + + + + + Set cursor to first frame in message. Returns frame, or NULL, if the + message is empty. Use this to navigate the frames as a list. + + + + + Return the next frame. If there are no more frames, returns NULL. To move + to the first frame call zmsg_first(). Advances the cursor. + + + + + Return the last frame. If there are no frames, returns NULL. + + + + + Save message to an open file, return 0 if OK, else -1. The message is + saved as a series of frames, each with length and data. Note that the + file is NOT guaranteed to be portable between operating systems, not + versions of CZMQ. The file format is at present undocumented and liable + to arbitrary change. + + + + + + Load/append an open file into new message, return the message. + Returns NULL if the message could not be loaded. + + + + + Serialize multipart message to a single message frame. Use this method + to send structured messages across transports that do not support + multipart data. Allocates and returns a new frame containing the + serialized message. To decode a serialized message frame, use + zmsg_decode (). + + + + + Decodes a serialized message frame created by zmsg_encode () and returns + a new zmsg_t object. Returns NULL if the frame was badly formatted or + there was insufficient memory to work. + + + + + Create copy of message, as new message object. Returns a fresh zmsg_t + object. If message is null, or memory was exhausted, returns null. + + + + + Send message to zsys log sink (may be stdout, or system facility as + configured by zsys_set_logstream). + + + + Return true if the two messages have the same number of frames and each + frame in the first message is identical to the corresponding frame in the + other message. As with zframe_eq, return false if either message is NULL. + + + + + + Generate a signal message encoding the given status. A signal is a short + message carrying a 1-byte success/failure code (by convention, 0 means + OK). Signals are encoded to be distinguishable from "normal" messages. + + + + + Return signal value, 0 or greater, if message is a signal, -1 if not. + + + + + Probe the supplied object, and report if it looks like a zmsg_t. + + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zpoller.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zpoller.api new file mode 100644 index 00000000000000..fc00f6a0751a94 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zpoller.api @@ -0,0 +1,71 @@ + + + event-driven reactor + + + Create new poller, specifying zero or more readers. The list of + readers ends in a NULL. Each reader can be a zsock_t instance, a + zactor_t instance, a libzmq socket (void *), or a file handle. + + + + + Destroy a poller + + + + Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may + be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. + + + + + + Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader + must have been passed during construction, or in an zpoller_add () call. + + + + + + By default the poller stops if the process receives a SIGINT or SIGTERM + signal. This makes it impossible to shut-down message based architectures + like zactors. This method lets you switch off break handling. The default + nonstop setting is off (false). + + + + + Poll the registered readers for I/O, return first reader that has input. + The reader will be a libzmq void * socket, or a zsock_t or zactor_t + instance as specified in zpoller_new/zpoller_add. The timeout should be + zero or greater, or -1 to wait indefinitely. Socket priority is defined + by their order in the poll list. If you need a balanced poll, use the low + level zmq_poll method directly. If the poll call was interrupted (SIGINT), + or the ZMQ context was destroyed, or the timeout expired, returns NULL. + You can test the actual exit condition by calling zpoller_expired () and + zpoller_terminated (). The timeout is in msec. + + + + + + Return true if the last zpoller_wait () call ended because the timeout + expired, without any error. + + + + + Return true if the last zpoller_wait () call ended because the process + was interrupted, or the parent context was destroyed. + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zproc.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zproc.api new file mode 100644 index 00000000000000..52c1c9123ba3ee --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zproc.api @@ -0,0 +1,139 @@ + + + process configuration and status + + + Returns CZMQ version as a single 6-digit integer encoding the major + version (x 10000), the minor version (x 100) and the patch. + + + + + Returns true if the process received a SIGINT or SIGTERM signal. + It is good practice to use this method to exit any infinite loop + processing messages. + + + + + Returns true if the underlying libzmq supports CURVE security. + + + + + Return current host name, for use in public tcp:// endpoints. + If the host name is not resolvable, returns NULL. + + + + + Move the current process into the background. The precise effect + depends on the operating system. On POSIX boxes, moves to a specified + working directory (if specified), closes all file handles, reopens + stdin, stdout, and stderr to the null device, and sets the process to + ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there + was an error. + + + + + Drop the process ID into the lockfile, with exclusive lock, and + switch the process to the specified group and/or user. Any of the + arguments may be null, indicating a no-op. Returns 0 on success, + -1 on failure. Note if you combine this with zsys_daemonize, run + after, not before that method, or the lockfile will hold the wrong + process ID. + + + + + + + Configure the number of I/O threads that ZeroMQ will use. A good + rule of thumb is one thread per gigabit of traffic in or out. The + default is 1, sufficient for most applications. If the environment + variable ZSYS_IO_THREADS is defined, that provides the default. + Note that this method is valid only before any socket is created. + + + + + Configure the number of sockets that ZeroMQ will allow. The default + is 1024. The actual limit depends on the system, and you can query it + by using zsys_socket_limit (). A value of zero means "maximum". + Note that this method is valid only before any socket is created. + + + + + Set network interface name to use for broadcasts, particularly zbeacon. + This lets the interface be configured for test environments where required. + For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is + the default when there is no specified interface. If the environment + variable ZSYS_INTERFACE is set, use that as the default interface name. + Setting the interface to "*" means "use all available interfaces". + + + + + Return network interface to use for broadcasts, or "" if none was set. + + + + + Set log identity, which is a string that prefixes all log messages sent + by this process. The log identity defaults to the environment variable + ZSYS_LOGIDENT, if that is set. + + + + + Sends log output to a PUB socket bound to the specified endpoint. To + collect such log output, create a SUB socket, subscribe to the traffic + you care about, and connect to the endpoint. Log traffic is sent as a + single string frame, in the same format as when sent to stdout. The + log system supports a single sender; multiple calls to this method will + bind the same sender to multiple endpoints. To disable the sender, call + this method with a null argument. + + + + + Enable or disable logging to the system facility (syslog on POSIX boxes, + event log on Windows). By default this is disabled. + + + + + Log error condition - highest priority + + + + + Log warning condition - high priority + + + + + Log normal, but significant, condition - normal priority + + + + + Log informational message - low priority + + + + + Log debug-level message - lowest priority + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock.api new file mode 100644 index 00000000000000..26b15cf509624d --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock.api @@ -0,0 +1,406 @@ + + + high-level socket API that hides libzmq contexts and sockets + + + Create a new socket. Returns the new socket, or NULL if the new socket + could not be created. Note that the symbol zsock_new (and other + constructors/destructors for zsock) are redirected to the *_checked + variant, enabling intelligent socket leak detection. This can have + performance implications if you use a LOT of sockets. To turn off this + redirection behaviour, define ZSOCK_NOCHECK. + + + + + + + + + + + + + + + + + + + + + + + + + + Destroy the socket. You must use this for any socket created via the + zsock_new method. + + + + Create a PUB socket. Default action is bind. + + + + + Create a SUB socket, and optionally subscribe to some prefix string. Default + action is connect. + + + + + + Create a REQ socket. Default action is connect. + + + + + Create a REP socket. Default action is bind. + + + + + Create a DEALER socket. Default action is connect. + + + + + Create a ROUTER socket. Default action is bind. + + + + + Create a PUSH socket. Default action is connect. + + + + + Create a PULL socket. Default action is bind. + + + + + Create an XPUB socket. Default action is bind. + + + + + Create an XSUB socket. Default action is connect. + + + + + Create a PAIR socket. Default action is connect. + + + + + Create a STREAM socket. Default action is connect. + + + + + Create a SERVER socket. Default action is bind. + + + + + Create a CLIENT socket. Default action is connect. + + + + + Create a RADIO socket. Default action is bind. + + + + + Create a DISH socket. Default action is connect. + + + + + Create a GATHER socket. Default action is bind. + + + + + Create a SCATTER socket. Default action is connect. + + + + + Bind a socket to a formatted endpoint. For tcp:// endpoints, supports + ephemeral ports, if you specify the port number as "*". By default + zsock uses the IANA designated range from C000 (49152) to FFFF (65535). + To override this range, follow the "*" with "[first-last]". Either or + both first and last may be empty. To bind to a random port within the + range, use "!" in place of "*". + + Examples: + tcp://127.0.0.1:* bind to first free port from C000 up + tcp://127.0.0.1:! bind to random port from C000 to FFFF + tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up + tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 + tcp://127.0.0.1:![55000-55999] + bind to random port from 55000 to 55999 + + On success, returns the actual port number used, for tcp:// endpoints, + and 0 for other transports. On failure, returns -1. Note that when using + ephemeral ports, a port may be reused by different services without + clients being aware. Protocols that run on ephemeral ports should take + this into account. + + + + + + Returns last bound endpoint, if any. + + + + + Unbind a socket from a formatted endpoint. + Returns 0 if OK, -1 if the endpoint was invalid or the function + isn't supported. + + + + + + Connect a socket to a formatted endpoint + Returns 0 if OK, -1 if the endpoint was invalid. + + + + + + Disconnect a socket from a formatted endpoint + Returns 0 if OK, -1 if the endpoint was invalid or the function + isn't supported. + + + + + + Attach a socket to zero or more endpoints. If endpoints is not null, + parses as list of ZeroMQ endpoints, separated by commas, and prefixed by + '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all + endpoints were valid, or -1 if there was a syntax error. If the endpoint + does not start with '@' or '>', the serverish argument defines whether + it is used to bind (serverish = true) or connect (serverish = false). + + + + + + + Returns socket type as printable constant string. + + + + + Send a 'picture' message to the socket (or actor). The picture is a + string that defines the type of each frame. This makes it easy to send + a complex multiframe message in one call. The picture can contain any + of these characters, each corresponding to one or two arguments: + + i = int (signed) + 1 = uint8_t + 2 = uint16_t + 4 = uint32_t + 8 = uint64_t + s = char * + b = byte *, size_t (2 arguments) + c = zchunk_t * + f = zframe_t * + h = zhashx_t * + U = zuuid_t * + p = void * (sends the pointer value, only meaningful over inproc) + m = zmsg_t * (sends all frames in the zmsg) + z = sends zero-sized frame (0 arguments) + u = uint (deprecated) + + Note that s, b, c, and f are encoded the same way and the choice is + offered as a convenience to the sender, which may or may not already + have data in a zchunk or zframe. Does not change or take ownership of + any arguments. Returns 0 if successful, -1 if sending failed for any + reason. + + + + + + Send a 'picture' message to the socket (or actor). This is a va_list + version of zsock_send (), so please consult its documentation for the + details. + + + + + + + Receive a 'picture' message to the socket (or actor). See zsock_send for + the format and meaning of the picture. Returns the picture elements into + a series of pointers as provided by the caller: + + i = int * (stores signed integer) + 4 = uint32_t * (stores 32-bit unsigned integer) + 8 = uint64_t * (stores 64-bit unsigned integer) + s = char ** (allocates new string) + b = byte **, size_t * (2 arguments) (allocates memory) + c = zchunk_t ** (creates zchunk) + f = zframe_t ** (creates zframe) + U = zuuid_t * (creates a zuuid with the data) + h = zhashx_t ** (creates zhashx) + p = void ** (stores pointer) + m = zmsg_t ** (creates a zmsg with the remaing frames) + z = null, asserts empty frame (0 arguments) + u = uint * (stores unsigned integer, deprecated) + + Note that zsock_recv creates the returned objects, and the caller must + destroy them when finished with them. The supplied pointers do not need + to be initialized. Returns 0 if successful, or -1 if it failed to recv + a message, in which case the pointers are not modified. When message + frames are truncated (a short message), sets return values to zero/null. + If an argument pointer is NULL, does not store any value (skips it). + An 'n' picture matches an empty frame; if the message does not match, + the method will return -1. + + + + + + Receive a 'picture' message from the socket (or actor). This is a + va_list version of zsock_recv (), so please consult its documentation + for the details. + + + + + + + Send a binary encoded 'picture' message to the socket (or actor). This + method is similar to zsock_send, except the arguments are encoded in a + binary format that is compatible with zproto, and is designed to reduce + memory allocations. The pattern argument is a string that defines the + type of each argument. Supports these argument types: + + pattern C type zproto type: + 1 uint8_t type = "number" size = "1" + 2 uint16_t type = "number" size = "2" + 4 uint32_t type = "number" size = "3" + 8 uint64_t type = "number" size = "4" + s char *, 0-255 chars type = "string" + S char *, 0-2^32-1 chars type = "longstr" + c zchunk_t * type = "chunk" + f zframe_t * type = "frame" + u zuuid_t * type = "uuid" + m zmsg_t * type = "msg" + p void *, sends pointer value, only over inproc + + Does not change or take ownership of any arguments. Returns 0 if + successful, -1 if sending failed for any reason. + + + + + + Receive a binary encoded 'picture' message from the socket (or actor). + This method is similar to zsock_recv, except the arguments are encoded + in a binary format that is compatible with zproto, and is designed to + reduce memory allocations. The pattern argument is a string that defines + the type of each argument. See zsock_bsend for the supported argument + types. All arguments must be pointers; this call sets them to point to + values held on a per-socket basis. + Note that zsock_brecv creates the returned objects, and the caller must + destroy them when finished with them. The supplied pointers do not need + to be initialized. Returns 0 if successful, or -1 if it failed to read + a message. + + + + + + Return socket routing ID if any. This returns 0 if the socket is not + of type ZMQ_SERVER or if no request was already received on it. + + + + + Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. + This will be used when sending messages on the socket via the zsock API. + + + + + Set socket to use unbounded pipes (HWM=0); use this in cases when you are + totally certain the message volume can fit in memory. This method works + across all versions of ZeroMQ. Takes a polymorphic socket reference. + + + + Send a signal over a socket. A signal is a short message carrying a + success/failure code (by convention, 0 means OK). Signals are encoded + to be distinguishable from "normal" messages. Accepts a zsock_t or a + zactor_t argument, and returns 0 if successful, -1 if the signal could + not be sent. Takes a polymorphic socket reference. + + + + + + Wait on a signal. Use this to coordinate between threads, over pipe + pairs. Blocks until the signal is received. Returns -1 on error, 0 or + greater on success. Accepts a zsock_t or a zactor_t as argument. + Takes a polymorphic socket reference. + + + + + If there is a partial message still waiting on the socket, remove and + discard it. This is useful when reading partial messages, to get specific + message types. + + + + Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. + Returns 0 if OK, -1 if failed. + + + + + + Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. + Returns 0 if OK, -1 if failed. + + + + + + Probe the supplied object, and report if it looks like a zsock_t. + Takes a polymorphic socket reference. + + + + + + Probe the supplied reference. If it looks like a zsock_t instance, return + the underlying libzmq socket handle; else if it looks like a file + descriptor, return NULL; else if it looks like a libzmq socket handle, + return the supplied value. Takes a polymorphic socket reference. + + + + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock_option.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock_option.api new file mode 100644 index 00000000000000..c5799b027e5bab --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zsock_option.api @@ -0,0 +1,797 @@ + + + + + + Get socket option `heartbeat_ivl`. + Available from libzmq 4.2.0. + + + + + Set socket option `heartbeat_ivl`. + Available from libzmq 4.2.0. + + + + + Get socket option `heartbeat_ttl`. + Available from libzmq 4.2.0. + + + + + Set socket option `heartbeat_ttl`. + Available from libzmq 4.2.0. + + + + + Get socket option `heartbeat_timeout`. + Available from libzmq 4.2.0. + + + + + Set socket option `heartbeat_timeout`. + Available from libzmq 4.2.0. + + + + + Get socket option `use_fd`. + Available from libzmq 4.2.0. + + + + + Set socket option `use_fd`. + Available from libzmq 4.2.0. + + + + + Set socket option `xpub_manual`. + Available from libzmq 4.2.0. + + + + + Set socket option `xpub_welcome_msg`. + Available from libzmq 4.2.0. + + + + + Set socket option `stream_notify`. + Available from libzmq 4.2.0. + + + + + Get socket option `invert_matching`. + Available from libzmq 4.2.0. + + + + + Set socket option `invert_matching`. + Available from libzmq 4.2.0. + + + + + Set socket option `xpub_verboser`. + Available from libzmq 4.2.0. + + + + + Get socket option `connect_timeout`. + Available from libzmq 4.2.0. + + + + + Set socket option `connect_timeout`. + Available from libzmq 4.2.0. + + + + + Get socket option `tcp_maxrt`. + Available from libzmq 4.2.0. + + + + + Set socket option `tcp_maxrt`. + Available from libzmq 4.2.0. + + + + + Get socket option `thread_safe`. + Available from libzmq 4.2.0. + + + + + Get socket option `multicast_maxtpdu`. + Available from libzmq 4.2.0. + + + + + Set socket option `multicast_maxtpdu`. + Available from libzmq 4.2.0. + + + + + Get socket option `vmci_buffer_size`. + Available from libzmq 4.2.0. + + + + + Set socket option `vmci_buffer_size`. + Available from libzmq 4.2.0. + + + + + Get socket option `vmci_buffer_min_size`. + Available from libzmq 4.2.0. + + + + + Set socket option `vmci_buffer_min_size`. + Available from libzmq 4.2.0. + + + + + Get socket option `vmci_buffer_max_size`. + Available from libzmq 4.2.0. + + + + + Set socket option `vmci_buffer_max_size`. + Available from libzmq 4.2.0. + + + + + Get socket option `vmci_connect_timeout`. + Available from libzmq 4.2.0. + + + + + Set socket option `vmci_connect_timeout`. + Available from libzmq 4.2.0. + + + + + + + Get socket option `tos`. + Available from libzmq 4.1.0. + + + + + Set socket option `tos`. + Available from libzmq 4.1.0. + + + + + Set socket option `router_handover`. + Available from libzmq 4.1.0. + + + + + Set socket option `connect_rid`. + Available from libzmq 4.1.0. + + + + + Set socket option `connect_rid` from 32-octet binary + Available from libzmq 4.1.0. + + + + + Get socket option `handshake_ivl`. + Available from libzmq 4.1.0. + + + + + Set socket option `handshake_ivl`. + Available from libzmq 4.1.0. + + + + + Get socket option `socks_proxy`. + Available from libzmq 4.1.0. + + + + + Set socket option `socks_proxy`. + Available from libzmq 4.1.0. + + + + + Set socket option `xpub_nodrop`. + Available from libzmq 4.1.0. + + + + + + + Set socket option `router_mandatory`. + Available from libzmq 4.0.0. + + + + + Set socket option `probe_router`. + Available from libzmq 4.0.0. + + + + + Set socket option `req_relaxed`. + Available from libzmq 4.0.0. + + + + + Set socket option `req_correlate`. + Available from libzmq 4.0.0. + + + + + Set socket option `conflate`. + Available from libzmq 4.0.0. + + + + + Get socket option `zap_domain`. + Available from libzmq 4.0.0. + + + + + Set socket option `zap_domain`. + Available from libzmq 4.0.0. + + + + + Get socket option `mechanism`. + Available from libzmq 4.0.0. + + + + + Get socket option `plain_server`. + Available from libzmq 4.0.0. + + + + + Set socket option `plain_server`. + Available from libzmq 4.0.0. + + + + + Get socket option `plain_username`. + Available from libzmq 4.0.0. + + + + + Set socket option `plain_username`. + Available from libzmq 4.0.0. + + + + + Get socket option `plain_password`. + Available from libzmq 4.0.0. + + + + + Set socket option `plain_password`. + Available from libzmq 4.0.0. + + + + + Get socket option `curve_server`. + Available from libzmq 4.0.0. + + + + + Set socket option `curve_server`. + Available from libzmq 4.0.0. + + + + + Get socket option `curve_publickey`. + Available from libzmq 4.0.0. + + + + + Set socket option `curve_publickey`. + Available from libzmq 4.0.0. + + + + + Set socket option `curve_publickey` from 32-octet binary + Available from libzmq 4.0.0. + + + + + Get socket option `curve_secretkey`. + Available from libzmq 4.0.0. + + + + + Set socket option `curve_secretkey`. + Available from libzmq 4.0.0. + + + + + Set socket option `curve_secretkey` from 32-octet binary + Available from libzmq 4.0.0. + + + + + Get socket option `curve_serverkey`. + Available from libzmq 4.0.0. + + + + + Set socket option `curve_serverkey`. + Available from libzmq 4.0.0. + + + + + Set socket option `curve_serverkey` from 32-octet binary + Available from libzmq 4.0.0. + + + + + Get socket option `gssapi_server`. + Available from libzmq 4.0.0. + + + + + Set socket option `gssapi_server`. + Available from libzmq 4.0.0. + + + + + Get socket option `gssapi_plaintext`. + Available from libzmq 4.0.0. + + + + + Set socket option `gssapi_plaintext`. + Available from libzmq 4.0.0. + + + + + Get socket option `gssapi_principal`. + Available from libzmq 4.0.0. + + + + + Set socket option `gssapi_principal`. + Available from libzmq 4.0.0. + + + + + Get socket option `gssapi_service_principal`. + Available from libzmq 4.0.0. + + + + + Set socket option `gssapi_service_principal`. + Available from libzmq 4.0.0. + + + + + Get socket option `ipv6`. + Available from libzmq 4.0.0. + + + + + Set socket option `ipv6`. + Available from libzmq 4.0.0. + + + + + Get socket option `immediate`. + Available from libzmq 4.0.0. + + + + + Set socket option `immediate`. + Available from libzmq 4.0.0. + + + + + + + Get socket option `type`. + Available from libzmq 3.0.0. + + + + + Get socket option `sndhwm`. + Available from libzmq 3.0.0. + + + + + Set socket option `sndhwm`. + Available from libzmq 3.0.0. + + + + + Get socket option `rcvhwm`. + Available from libzmq 3.0.0. + + + + + Set socket option `rcvhwm`. + Available from libzmq 3.0.0. + + + + + Get socket option `affinity`. + Available from libzmq 3.0.0. + + + + + Set socket option `affinity`. + Available from libzmq 3.0.0. + + + + + Set socket option `subscribe`. + Available from libzmq 3.0.0. + + + + + Set socket option `unsubscribe`. + Available from libzmq 3.0.0. + + + + + Get socket option `identity`. + Available from libzmq 3.0.0. + + + + + Set socket option `identity`. + Available from libzmq 3.0.0. + + + + + Get socket option `rate`. + Available from libzmq 3.0.0. + + + + + Set socket option `rate`. + Available from libzmq 3.0.0. + + + + + Get socket option `recovery_ivl`. + Available from libzmq 3.0.0. + + + + + Set socket option `recovery_ivl`. + Available from libzmq 3.0.0. + + + + + Get socket option `sndbuf`. + Available from libzmq 3.0.0. + + + + + Set socket option `sndbuf`. + Available from libzmq 3.0.0. + + + + + Get socket option `rcvbuf`. + Available from libzmq 3.0.0. + + + + + Set socket option `rcvbuf`. + Available from libzmq 3.0.0. + + + + + Get socket option `linger`. + Available from libzmq 3.0.0. + + + + + Set socket option `linger`. + Available from libzmq 3.0.0. + + + + + Get socket option `reconnect_ivl`. + Available from libzmq 3.0.0. + + + + + Set socket option `reconnect_ivl`. + Available from libzmq 3.0.0. + + + + + Get socket option `reconnect_ivl_max`. + Available from libzmq 3.0.0. + + + + + Set socket option `reconnect_ivl_max`. + Available from libzmq 3.0.0. + + + + + Get socket option `backlog`. + Available from libzmq 3.0.0. + + + + + Set socket option `backlog`. + Available from libzmq 3.0.0. + + + + + Get socket option `maxmsgsize`. + Available from libzmq 3.0.0. + + + + + Set socket option `maxmsgsize`. + Available from libzmq 3.0.0. + + + + + Get socket option `multicast_hops`. + Available from libzmq 3.0.0. + + + + + Set socket option `multicast_hops`. + Available from libzmq 3.0.0. + + + + + Get socket option `rcvtimeo`. + Available from libzmq 3.0.0. + + + + + Set socket option `rcvtimeo`. + Available from libzmq 3.0.0. + + + + + Get socket option `sndtimeo`. + Available from libzmq 3.0.0. + + + + + Set socket option `sndtimeo`. + Available from libzmq 3.0.0. + + + + + Set socket option `xpub_verbose`. + Available from libzmq 3.0.0. + + + + + Get socket option `tcp_keepalive`. + Available from libzmq 3.0.0. + + + + + Set socket option `tcp_keepalive`. + Available from libzmq 3.0.0. + + + + + Get socket option `tcp_keepalive_idle`. + Available from libzmq 3.0.0. + + + + + Set socket option `tcp_keepalive_idle`. + Available from libzmq 3.0.0. + + + + + Get socket option `tcp_keepalive_cnt`. + Available from libzmq 3.0.0. + + + + + Set socket option `tcp_keepalive_cnt`. + Available from libzmq 3.0.0. + + + + + Get socket option `tcp_keepalive_intvl`. + Available from libzmq 3.0.0. + + + + + Set socket option `tcp_keepalive_intvl`. + Available from libzmq 3.0.0. + + + + + Get socket option `tcp_accept_filter`. + Available from libzmq 3.0.0. + + + + + Set socket option `tcp_accept_filter`. + Available from libzmq 3.0.0. + + + + + Get socket option `rcvmore`. + Available from libzmq 3.0.0. + + + + + Get socket option `fd`. + Available from libzmq 3.0.0. + + + + + Get socket option `events`. + Available from libzmq 3.0.0. + + + + + Get socket option `last_endpoint`. + Available from libzmq 3.0.0. + + + + + Set socket option `router_raw`. + Available from libzmq 3.0.0. + + + + + Get socket option `ipv4only`. + Available from libzmq 3.0.0. + + + + + Set socket option `ipv4only`. + Available from libzmq 3.0.0. + + + + + Set socket option `delay_attach_on_connect`. + Available from libzmq 3.0.0. + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zstr.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zstr.api new file mode 100644 index 00000000000000..b4c951e7207ab5 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zstr.api @@ -0,0 +1,90 @@ + + + sending and receiving strings + + + Receive C string from socket. Caller must free returned string using + zstr_free(). Returns NULL if the context is being terminated or the + process was interrupted. + + + + + + Receive a series of strings (until NULL) from multipart data. + Each string is allocated and filled with string data; if there + are not enough frames, unallocated strings are set to NULL. + Returns -1 if the message could not be read, else returns the + number of strings filled, zero or more. Free each returned string + using zstr_free(). If not enough strings are provided, remaining + multipart frames in the message are dropped. + + + + + + + Send a C string to a socket, as a frame. The string is sent without + trailing null byte; to read this you can use zstr_recv, or a similar + method that adds a null terminator on the received string. String + may be NULL, which is sent as "". + + + + + + + Send a C string to a socket, as zstr_send(), with a MORE flag, so that + you can send further strings in the same multi-part message. + + + + + + + Send a formatted string to a socket. Note that you should NOT use + user-supplied strings in the format (they may contain '%' which + will create security holes). + + + + + + + Send a formatted string to a socket, as for zstr_sendf(), with a + MORE flag, so that you can send further strings in the same multi-part + message. + + + + + + + Send a series of strings (until NULL) as multipart data + Returns 0 if the strings could be sent OK, or -1 on error. + + + + + + + Accepts a void pointer and returns a fresh character string. If source + is null, returns an empty string. + + + + + + Free a provided string, and nullify the parent pointer. Safe to call on + a null pointer. + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztimerset.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztimerset.api new file mode 100644 index 00000000000000..20d3ca71ad9065 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztimerset.api @@ -0,0 +1,69 @@ + + + timer set + + + Create new timer set. + + + + Destroy a timer set + + + + Callback function for timer event. + + + + + + Add a timer to the set. Returns timer id if OK, -1 on failure. + + + + + + + + Cancel a timer. Returns 0 if OK, -1 on failure. + + + + + + Set timer interval. Returns 0 if OK, -1 on failure. + This method is slow, canceling the timer and adding a new one yield better performance. + + + + + + + Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. + This method is slow, canceling the timer and adding a new one yield better performance. + + + + + + Return the time until the next interval. + Should be used as timeout parameter for the zpoller wait method. + The timeout is in msec. + + + + + Invoke callback function of all timers which their interval has elapsed. + Should be call after zpoller wait method. + Returns 0 if OK, -1 on failure. + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztrie.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztrie.api new file mode 100644 index 00000000000000..01fc3a4131e6a8 --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/ztrie.api @@ -0,0 +1,80 @@ + + + simple trie for tokenizable strings + + + Callback function for ztrie_node to destroy node data. + + + + + Creates a new ztrie. + + + + + Destroy the ztrie. + + + + Inserts a new route into the tree and attaches the data. Returns -1 + if the route already exists, otherwise 0. This method takes ownership of + the provided data if a destroy_data_fn is provided. + + + + + + + + Removes a route from the trie and destroys its data. Returns -1 if the + route does not exists, otherwise 0. + the start of the list call zlist_first (). Advances the cursor. + + + + + + Returns true if the path matches a route in the tree, otherwise false. + + + + + + Returns the data of a matched route from last ztrie_matches. If the path + did not match, returns NULL. Do not delete the data as it's owned by + ztrie. + + + + + Returns the count of parameters that a matched route has. + + + + + Returns the parameters of a matched route with named regexes from last + ztrie_matches. If the path did not match or the route did not contain any + named regexes, returns NULL. + + + + + Returns the asterisk matched part of a route, if there has been no match + or no asterisk match, returns NULL. + + + + + Print the trie + + + diff --git a/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zuuid.api b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zuuid.api new file mode 100644 index 00000000000000..1fdb9c4e060f9e --- /dev/null +++ b/phonelibs/zmq/aarch64-linux/share/zproject/czmq/zuuid.api @@ -0,0 +1,82 @@ + + + UUID support class + + + Create a new UUID object. + + + + Destroy a specified UUID object. + + + + Create UUID object from supplied ZUUID_LEN-octet value. + + + + + Set UUID to new supplied ZUUID_LEN-octet value. + + + + + Set UUID to new supplied string value skipping '-' and '{' '}' + optional delimiters. Return 0 if OK, else returns -1. + + + + + + Return UUID binary data. + + + + + Return UUID binary size + + + + + Returns UUID as string + + + + + Return UUID in the canonical string format: 8-4-4-4-12, in lower + case. Caller does not modify or free returned value. See + http://en.wikipedia.org/wiki/Universally_unique_identifier + + + + + Store UUID blob in target array + + + + + Check if UUID is same as supplied value + + + + + + Check if UUID is different from supplied value + + + + + + Make copy of UUID object; if uuid is null, or memory was exhausted, + returns null. + + + diff --git a/phonelibs/zmq/aarch64/include/czmq.h b/phonelibs/zmq/aarch64/include/czmq.h new file mode 100644 index 00000000000000..ba21aa3bd1efdd --- /dev/null +++ b/phonelibs/zmq/aarch64/include/czmq.h @@ -0,0 +1,31 @@ +/* ========================================================================= + CZMQ - a high-level binding in C for ZeroMQ + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __CZMQ_H_INCLUDED__ +#define __CZMQ_H_INCLUDED__ + +// These are signatures for handler functions that customize the +// behavior of CZMQ containers. These are shared between all CZMQ +// container types. + +// -- destroy an item +typedef void (czmq_destructor) (void **item); +// -- duplicate an item +typedef void *(czmq_duplicator) (const void *item); +// - compare two items, for sorting +typedef int (czmq_comparator) (const void *item1, const void *item2); + +// Include the project library file +#include "czmq_library.h" + +#endif diff --git a/phonelibs/zmq/aarch64/include/czmq_library.h b/phonelibs/zmq/aarch64/include/czmq_library.h new file mode 100644 index 00000000000000..be348db3e9a414 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/czmq_library.h @@ -0,0 +1,199 @@ +/* ========================================================================= + czmq - generated layer of public API + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ + ========================================================================= +*/ + +#ifndef CZMQ_LIBRARY_H_INCLUDED +#define CZMQ_LIBRARY_H_INCLUDED + +// Set up environment for the application +#include "czmq_prelude.h" + +// External dependencies +#include + +// CZMQ version macros for compile-time API detection +#define CZMQ_VERSION_MAJOR 3 +#define CZMQ_VERSION_MINOR 0 +#define CZMQ_VERSION_PATCH 3 + +#define CZMQ_MAKE_VERSION(major, minor, patch) \ + ((major) * 10000 + (minor) * 100 + (patch)) +#define CZMQ_VERSION \ + CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH) + +#if defined (__WINDOWS__) +# if defined CZMQ_STATIC +# define CZMQ_EXPORT +# elif defined CZMQ_INTERNAL_BUILD +# if defined DLL_EXPORT +# define CZMQ_EXPORT __declspec(dllexport) +# else +# define CZMQ_EXPORT +# endif +# elif defined CZMQ_EXPORTS +# define CZMQ_EXPORT __declspec(dllexport) +# else +# define CZMQ_EXPORT __declspec(dllimport) +# endif +#else +# define CZMQ_EXPORT +#endif + +// Opaque class structures to allow forward references +// These classes are stable or legacy and built in all releases +typedef struct _zactor_t zactor_t; +#define ZACTOR_T_DEFINED +typedef struct _zarmour_t zarmour_t; +#define ZARMOUR_T_DEFINED +typedef struct _zcert_t zcert_t; +#define ZCERT_T_DEFINED +typedef struct _zcertstore_t zcertstore_t; +#define ZCERTSTORE_T_DEFINED +typedef struct _zchunk_t zchunk_t; +#define ZCHUNK_T_DEFINED +typedef struct _zclock_t zclock_t; +#define ZCLOCK_T_DEFINED +typedef struct _zconfig_t zconfig_t; +#define ZCONFIG_T_DEFINED +typedef struct _zdigest_t zdigest_t; +#define ZDIGEST_T_DEFINED +typedef struct _zdir_t zdir_t; +#define ZDIR_T_DEFINED +typedef struct _zdir_patch_t zdir_patch_t; +#define ZDIR_PATCH_T_DEFINED +typedef struct _zfile_t zfile_t; +#define ZFILE_T_DEFINED +typedef struct _zframe_t zframe_t; +#define ZFRAME_T_DEFINED +typedef struct _zhash_t zhash_t; +#define ZHASH_T_DEFINED +typedef struct _zhashx_t zhashx_t; +#define ZHASHX_T_DEFINED +typedef struct _ziflist_t ziflist_t; +#define ZIFLIST_T_DEFINED +typedef struct _zlist_t zlist_t; +#define ZLIST_T_DEFINED +typedef struct _zlistx_t zlistx_t; +#define ZLISTX_T_DEFINED +typedef struct _zloop_t zloop_t; +#define ZLOOP_T_DEFINED +typedef struct _zmsg_t zmsg_t; +#define ZMSG_T_DEFINED +typedef struct _zpoller_t zpoller_t; +#define ZPOLLER_T_DEFINED +typedef struct _zsock_t zsock_t; +#define ZSOCK_T_DEFINED +typedef struct _zstr_t zstr_t; +#define ZSTR_T_DEFINED +typedef struct _zuuid_t zuuid_t; +#define ZUUID_T_DEFINED +typedef struct _zauth_t zauth_t; +#define ZAUTH_T_DEFINED +typedef struct _zbeacon_t zbeacon_t; +#define ZBEACON_T_DEFINED +typedef struct _zgossip_t zgossip_t; +#define ZGOSSIP_T_DEFINED +typedef struct _zmonitor_t zmonitor_t; +#define ZMONITOR_T_DEFINED +typedef struct _zproxy_t zproxy_t; +#define ZPROXY_T_DEFINED +typedef struct _zrex_t zrex_t; +#define ZREX_T_DEFINED +typedef struct _zsys_t zsys_t; +#define ZSYS_T_DEFINED +typedef struct _zauth_v2_t zauth_v2_t; +#define ZAUTH_V2_T_DEFINED +typedef struct _zbeacon_v2_t zbeacon_v2_t; +#define ZBEACON_V2_T_DEFINED +typedef struct _zctx_t zctx_t; +#define ZCTX_T_DEFINED +typedef struct _zmonitor_v2_t zmonitor_v2_t; +#define ZMONITOR_V2_T_DEFINED +typedef struct _zmutex_t zmutex_t; +#define ZMUTEX_T_DEFINED +typedef struct _zproxy_v2_t zproxy_v2_t; +#define ZPROXY_V2_T_DEFINED +typedef struct _zsocket_t zsocket_t; +#define ZSOCKET_T_DEFINED +typedef struct _zsockopt_t zsockopt_t; +#define ZSOCKOPT_T_DEFINED +typedef struct _zthread_t zthread_t; +#define ZTHREAD_T_DEFINED +// Draft classes are by default not built in stable releases +#ifdef CZMQ_BUILD_DRAFT_API +typedef struct _zproc_t zproc_t; +#define ZPROC_T_DEFINED +typedef struct _ztimerset_t ztimerset_t; +#define ZTIMERSET_T_DEFINED +typedef struct _ztrie_t ztrie_t; +#define ZTRIE_T_DEFINED +#endif // CZMQ_BUILD_DRAFT_API + + +// Public classes, each with its own header file +#include "zactor.h" +#include "zarmour.h" +#include "zcert.h" +#include "zcertstore.h" +#include "zchunk.h" +#include "zclock.h" +#include "zconfig.h" +#include "zdigest.h" +#include "zdir.h" +#include "zdir_patch.h" +#include "zfile.h" +#include "zframe.h" +#include "zhash.h" +#include "zhashx.h" +#include "ziflist.h" +#include "zlist.h" +#include "zlistx.h" +#include "zloop.h" +#include "zmsg.h" +#include "zpoller.h" +#include "zsock.h" +#include "zstr.h" +#include "zuuid.h" +#include "zauth.h" +#include "zbeacon.h" +#include "zgossip.h" +#include "zmonitor.h" +#include "zproxy.h" +#include "zrex.h" +#include "zsys.h" +#include "zauth_v2.h" +#include "zbeacon_v2.h" +#include "zctx.h" +#include "zmonitor_v2.h" +#include "zmutex.h" +#include "zproxy_v2.h" +#include "zsocket.h" +#include "zsockopt.h" +#include "zthread.h" +#ifdef CZMQ_BUILD_DRAFT_API +#include "zproc.h" +#include "ztimerset.h" +#include "ztrie.h" +#endif // CZMQ_BUILD_DRAFT_API + +#endif +/* +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ +*/ diff --git a/phonelibs/zmq/aarch64/include/czmq_prelude.h b/phonelibs/zmq/aarch64/include/czmq_prelude.h new file mode 100644 index 00000000000000..e9ceb691e839ef --- /dev/null +++ b/phonelibs/zmq/aarch64/include/czmq_prelude.h @@ -0,0 +1,641 @@ +/* ========================================================================= + czmq_prelude.h - CZMQ environment + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __CZMQ_PRELUDE_H_INCLUDED__ +#define __CZMQ_PRELUDE_H_INCLUDED__ + +//- Establish the compiler and computer system ------------------------------ +/* + * Defines zero or more of these symbols, for use in any non-portable + * code: + * + * __WINDOWS__ Microsoft C/C++ with Windows calls + * __MSDOS__ System is MS-DOS (set if __WINDOWS__ set) + * __VMS__ System is VAX/VMS or Alpha/OpenVMS + * __UNIX__ System is UNIX + * __OS2__ System is OS/2 + * + * __IS_32BIT__ OS/compiler is 32 bits + * __IS_64BIT__ OS/compiler is 64 bits + * + * When __UNIX__ is defined, we also define exactly one of these: + * + * __UTYPE_AUX Apple AUX + * __UTYPE_BEOS BeOS + * __UTYPE_BSDOS BSD/OS + * __UTYPE_DECALPHA Digital UNIX (Alpha) + * __UTYPE_IBMAIX IBM RS/6000 AIX + * __UTYPE_FREEBSD FreeBSD + * __UTYPE_HPUX HP/UX + * __UTYPE_ANDROID Android + * __UTYPE_LINUX Linux + * __UTYPE_GNU GNU/Hurd + * __UTYPE_MIPS MIPS (BSD 4.3/System V mixture) + * __UTYPE_NETBSD NetBSD + * __UTYPE_NEXT NeXT + * __UTYPE_OPENBSD OpenBSD + * __UTYPE_OSX Apple Macintosh OS X + * __UTYPE_IOS Apple iOS + * __UTYPE_QNX QNX + * __UTYPE_IRIX Silicon Graphics IRIX + * __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix) + * __UTYPE_SUNOS SunOS + * __UTYPE_SUNSOLARIS Sun Solaris + * __UTYPE_UNIXWARE SCO UnixWare + * ... these are the ones I know about so far. + * __UTYPE_GENERIC Any other UNIX + * + * When __VMS__ is defined, we may define one or more of these: + * + * __VMS_XOPEN Supports XOPEN functions + */ + +#if (defined (__64BIT__) || defined (__x86_64__)) +# define __IS_64BIT__ // May have 64-bit OS/compiler +#else +# define __IS_32BIT__ // Else assume 32-bit OS/compiler +#endif + +#if (defined WIN32 || defined _WIN32) +# undef __WINDOWS__ +# define __WINDOWS__ +# undef __MSDOS__ +# define __MSDOS__ +#endif + +#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__) +# undef __WINDOWS__ +# define __WINDOWS__ +# undef __MSDOS__ +# define __MSDOS__ +// Stop cheeky warnings about "deprecated" functions like fopen +# if _MSC_VER >= 1500 +# undef _CRT_SECURE_NO_DEPRECATE +# define _CRT_SECURE_NO_DEPRECATE +# pragma warning(disable: 4996) +# endif +#endif + +// MSDOS Microsoft C +// _MSC_VER Microsoft C +#if (defined (MSDOS) || defined (_MSC_VER)) +# undef __MSDOS__ +# define __MSDOS__ +# if (defined (_DEBUG) && !defined (DEBUG)) +# define DEBUG +# endif +#endif + +#if (defined (__EMX__) && defined (__i386__)) +# undef __OS2__ +# define __OS2__ +#endif + +// VMS VAX C (VAX/VMS) +// __VMS Dec C (Alpha/OpenVMS) +// __vax__ gcc +#if (defined (VMS) || defined (__VMS) || defined (__vax__)) +# undef __VMS__ +# define __VMS__ +# if (__VMS_VER >= 70000000) +# define __VMS_XOPEN +# endif +#endif + +// Try to define a __UTYPE_xxx symbol... +// unix SunOS at least +// __unix__ gcc +// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS +#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE)) +# if (!defined (__VMS__)) +# undef __UNIX__ +# define __UNIX__ +# if (defined (__alpha)) // Digital UNIX is 64-bit +# undef __IS_32BIT__ +# define __IS_64BIT__ +# define __UTYPE_DECALPHA +# endif +# endif +#endif + +#if (defined (_AUX)) +# define __UTYPE_AUX +# define __UNIX__ +#elif (defined (__BEOS__)) +# define __UTYPE_BEOS +# define __UNIX__ +#elif (defined (__hpux)) +# define __UTYPE_HPUX +# define __UNIX__ +# define _INCLUDE_HPUX_SOURCE +# define _INCLUDE_XOPEN_SOURCE +# define _INCLUDE_POSIX_SOURCE +#elif (defined (_AIX) || defined (AIX)) +# define __UTYPE_IBMAIX +# define __UNIX__ +#elif (defined (BSD) || defined (bsd)) +# define __UTYPE_BSDOS +# define __UNIX__ +#elif (defined (__ANDROID__)) +# define __UTYPE_ANDROID +# define __UNIX__ +#elif (defined (LINUX) || defined (linux) || defined (__linux__)) +# define __UTYPE_LINUX +# define __UNIX__ +# ifndef __NO_CTYPE +# define __NO_CTYPE // Suppress warnings on tolower() +# endif +# ifndef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix +# endif +#elif (defined (__GNU__)) +# define __UTYPE_GNU +# define __UNIX__ +#elif (defined (Mips)) +# define __UTYPE_MIPS +# define __UNIX__ +#elif (defined (FreeBSD) || defined (__FreeBSD__)) +# define __UTYPE_FREEBSD +# define __UNIX__ +#elif (defined (NetBSD) || defined (__NetBSD__)) +# define __UTYPE_NETBSD +# define __UNIX__ +#elif (defined (OpenBSD) || defined (__OpenBSD__)) +# define __UTYPE_OPENBSD +# define __UNIX__ +#elif (defined (APPLE) || defined (__APPLE__)) +# include +# define __UNIX__ +# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR +# define __UTYPE_IOS +# else +# define __UTYPE_OSX +# endif +#elif (defined (NeXT)) +# define __UTYPE_NEXT +# define __UNIX__ +#elif (defined (__QNX__)) +# define __UTYPE_QNX +# define __UNIX__ +#elif (defined (sgi)) +# define __UTYPE_IRIX +# define __UNIX__ +#elif (defined (sinix)) +# define __UTYPE_SINIX +# define __UNIX__ +#elif (defined (SOLARIS) || defined (__SRV4)) +# define __UTYPE_SUNSOLARIS +# define __UNIX__ +#elif (defined (SUNOS) || defined (SUN) || defined (sun)) +# define __UTYPE_SUNOS +# define __UNIX__ +#elif (defined (__USLC__) || defined (UnixWare)) +# define __UTYPE_UNIXWARE +# define __UNIX__ +#elif (defined (__CYGWIN__)) +# define __UTYPE_CYGWIN +# define __UNIX__ +#elif (defined (__UNIX__)) +# define __UTYPE_GENERIC +#endif + +//- Always include ZeroMQ headers ------------------------------------------- + +#include "zmq.h" +#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0)) +# include "zmq_utils.h" +#endif + +//- Standard ANSI include files --------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//- System-specific include files ------------------------------------------- + +#if (defined (__MSDOS__)) +# if (defined (__WINDOWS__)) +# if (_WIN32_WINNT < 0x0501) +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +# endif +# if (!defined (FD_SETSIZE)) +# define FD_SETSIZE 1024 // Max. filehandles/sockets +# endif +# include +# include +# include +# include +# include // For getnameinfo () +# include // For GetAdaptersAddresses () +# endif +# include +# include +# include +# include +# include +# include +# include +# include +#endif + +#if (defined (__UNIX__)) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include // Let CZMQ build with libzmq/3.x +# include // Must come before arpa/inet.h +# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \ + && (!defined (__UTYPE_HPUX)) +# include +# endif +# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS) +# include +# endif +# if (!defined (__UTYPE_BEOS)) +# include +# if (!defined (TCP_NODELAY)) +# include +# endif +# endif +# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX)) +# include +# endif +# if (defined (__UTYPE_BEOS)) +# include +# endif +# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \ + || (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L))) +# include +# endif +# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS)) +# include +# include // For monotonic clocks +# endif +# if (defined (__UTYPE_OSX)) +# include // For _NSGetEnviron() +# endif +# if (defined (__UTYPE_ANDROID)) +# include +# endif +# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD)) +# include +# endif +#endif + +#if (defined (__VMS__)) +# if (!defined (vaxc)) +# include // Not provided by Vax C +# endif +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif + +#if (defined (__OS2__)) +# include // Required near top +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include // Must come before arpa/inet.h +# include +# include +# if (!defined (TCP_NODELAY)) +# include +# endif +#endif + +// Add missing defines for non-POSIX systems +#ifndef S_IRUSR +# define S_IRUSR S_IREAD +#endif +#ifndef S_IWUSR +# define S_IWUSR S_IWRITE +#endif +#ifndef S_ISDIR +# define S_ISDIR(m) (((m) & S_IFDIR) != 0) +#endif +#ifndef S_ISREG +# define S_ISREG(m) (((m) & S_IFREG) != 0) +#endif + + +//- Check compiler data type sizes ------------------------------------------ + +#if (UCHAR_MAX != 0xFF) +# error "Cannot compile: must change definition of 'byte'." +#endif +#if (USHRT_MAX != 0xFFFFU) +# error "Cannot compile: must change definition of 'dbyte'." +#endif +#if (UINT_MAX != 0xFFFFFFFFU) +# error "Cannot compile: must change definition of 'qbyte'." +#endif + +//- Data types -------------------------------------------------------------- + +typedef unsigned char byte; // Single unsigned byte = 8 bits +typedef unsigned short dbyte; // Double byte = 16 bits +typedef unsigned int qbyte; // Quad byte = 32 bits +typedef struct sockaddr_in inaddr_t; // Internet socket address structure +typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure + +// Common structure to hold inaddr_t and in6addr_t with length +typedef struct { + union { + inaddr_t __addr; // IPv4 address + in6addr_t __addr6; // IPv6 address + } __inaddr_u; +#define ipv4addr __inaddr_u.__addr +#define ipv6addr __inaddr_u.__addr6 + int inaddrlen; +} inaddr_storage_t; + +//- Inevitable macros ------------------------------------------------------- + +#define streq(s1,s2) (!strcmp ((s1), (s2))) +#define strneq(s1,s2) (strcmp ((s1), (s2))) + +// Provide random number from 0..(num-1) +#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \ + || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) +# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) +#else +# define randof(num) (int) ((float) (num) * random () / (RAND_MAX + 1.0)) +#endif + +// Windows MSVS doesn't have stdbool +#if (defined (_MSC_VER)) +# if (!defined (__cplusplus) && (!defined (true))) +# define true 1 +# define false 0 + typedef char bool; +# endif +#else +# include +#endif + +//- A number of POSIX and C99 keywords and data types ----------------------- +// CZMQ uses uint for array indices; equivalent to unsigned int, but more +// convenient in code. We define it in czmq_prelude.h on systems that do +// not define it by default. + +#if (defined (__WINDOWS__)) +# if (!defined (__cplusplus) && (!defined (inline))) +# define inline __inline +# endif +# define strtoull _strtoui64 +# define atoll _atoi64 +# define srandom srand +# define TIMEZONE _timezone +# if (!defined (__MINGW32__)) +# define snprintf _snprintf +# define vsnprintf _vsnprintf +# endif + typedef unsigned long ulong; + typedef unsigned int uint; +# if (!defined (__MINGW32__)) + typedef int mode_t; +# if !defined (_SSIZE_T_DEFINED) +typedef intptr_t ssize_t; +# define _SSIZE_T_DEFINED +# endif +# endif +# if ((!defined (__MINGW32__) \ + || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ + && !defined (ZMQ_DEFINED_STDINT)) + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; +# endif + typedef uint32_t in_addr_t; +# if (!defined (PRId8)) +# define PRId8 "d" +# endif +# if (!defined (PRId16)) +# define PRId16 "d" +# endif +# if (!defined (PRId32)) +# define PRId32 "d" +# endif +# if (!defined (PRId64)) +# define PRId64 "I64d" +# endif +# if (!defined (PRIu8)) +# define PRIu8 "u" +# endif +# if (!defined (PRIu16)) +# define PRIu16 "u" +# endif +# if (!defined (PRIu32)) +# define PRIu32 "u" +# endif +# if (!defined (PRIu64)) +# define PRIu64 "I64u" +# endif +# if (!defined (va_copy)) + // MSVC does not support C99's va_copy so we use a regular assignment +# define va_copy(dest,src) (dest) = (src) +# endif +#elif (defined (__UTYPE_OSX)) + typedef unsigned long ulong; + typedef unsigned int uint; + // This fixes header-order dependence problem with some Linux versions +#elif (defined (__UTYPE_LINUX)) +# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC)) + typedef unsigned int uint; +# endif +#endif + +//- Non-portable declaration specifiers ------------------------------------- + +// For thread-local storage +#if defined (__WINDOWS__) +# define CZMQ_THREADLS __declspec(thread) +#else +# define CZMQ_THREADLS __thread +#endif + +// Replacement for malloc() which asserts if we run out of heap, and +// which zeroes the allocated block. +static inline void * +safe_malloc (size_t size, const char *file, unsigned line) +{ +// printf ("%s:%u %08d\n", file, line, (int) size); + void *mem = calloc (1, size); + if (mem == NULL) { + fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line); + fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n"); + fflush (stderr); + abort (); + } + return mem; +} + +// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace, +// otherwise all allocations will claim to come from czmq_prelude.h. For best +// results, compile all classes so you see dangling object allocations. +// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate +// out of memory condition back up the call stack. +#if defined _ZMALLOC_DEBUG || _ZMALLOC_PEDANTIC +# define zmalloc(size) calloc(1,(size)) +#else +# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__) +#endif + +// GCC supports validating format strings for functions that act like printf +#if defined (__GNUC__) && (__GNUC__ >= 2) +# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1))) +#else +# define CHECK_PRINTF(a) +#endif + +// Lets us write code that compiles both on Windows and normal platforms +#if !defined (__WINDOWS__) +typedef int SOCKET; +# define closesocket close +# define INVALID_SOCKET -1 +# define SOCKET_ERROR -1 +# define O_BINARY 0 +#endif + +//- Include non-portable header files based on platform.h ------------------- + +#if defined (HAVE_LINUX_WIRELESS_H) +# include +// This would normally come from net/if.h +unsigned int if_nametoindex (const char *ifname); +#else +# if defined (HAVE_NET_IF_H) +# include +# endif +# if defined (HAVE_NET_IF_MEDIA_H) +# include +# endif +#endif + +#if defined (__WINDOWS__) && !defined (HAVE_UUID) +# define HAVE_UUID 1 +#endif +#if defined (__UTYPE_OSX) && !defined (HAVE_UUID) +# define HAVE_UUID 1 +#endif +#if defined (HAVE_UUID) +# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD) +# include +# elif defined __UTYPE_HPUX +# include +# elif defined (__UNIX__) +# include +# endif +#endif + +// ZMQ compatibility macros + +#if ZMQ_VERSION_MAJOR == 4 +# define ZMQ_POLL_MSEC 1 // zmq_poll is msec + +#elif ZMQ_VERSION_MAJOR == 3 +# define ZMQ_POLL_MSEC 1 // zmq_poll is msec +# if ZMQ_VERSION_MINOR < 2 +# define zmq_ctx_new zmq_init +# endif +# define zmq_ctx_term zmq_term + +#elif ZMQ_VERSION_MAJOR == 2 +# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec +# define zmq_sendmsg zmq_send // Smooth out 2.x changes +# define zmq_recvmsg zmq_recv +# define zmq_ctx_new zmq_init +# define zmq_ctx_term zmq_term +# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f)) +# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f)) + // Older libzmq APIs may be missing some aspects of libzmq v3.0 +# ifndef ZMQ_ROUTER +# define ZMQ_ROUTER ZMQ_XREP +# endif +# ifndef ZMQ_DEALER +# define ZMQ_DEALER ZMQ_XREQ +# endif +# ifndef ZMQ_DONTWAIT +# define ZMQ_DONTWAIT ZMQ_NOBLOCK +# endif +# ifndef ZMQ_XSUB +# error "please upgrade your libzmq from http://zeromq.org" +# endif +# if ZMQ_VERSION_MINOR == 0 \ + || (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7) +# error "CZMQ requires at least libzmq/2.1.7 stable" +# endif +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zactor.h b/phonelibs/zmq/aarch64/include/zactor.h new file mode 100644 index 00000000000000..c865c65daf1efa --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zactor.h @@ -0,0 +1,76 @@ +/* ========================================================================= + zactor - actor + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZACTOR_H_INCLUDED__ +#define __ZACTOR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zactor.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Actors get a pipe and arguments from caller +typedef void (zactor_fn) ( + zsock_t *pipe, void *args); + +// Create a new actor passing arbitrary arguments reference. +CZMQ_EXPORT zactor_t * + zactor_new (zactor_fn task, void *args); + +// Destroy an actor. +CZMQ_EXPORT void + zactor_destroy (zactor_t **self_p); + +// Send a zmsg message to the actor, take ownership of the message +// and destroy when it has been sent. +CZMQ_EXPORT int + zactor_send (zactor_t *self, zmsg_t **msg_p); + +// Receive a zmsg message from the actor. Returns NULL if the actor +// was interrupted before the message could be received, or if there +// was a timeout on the actor. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zmsg_t * + zactor_recv (zactor_t *self); + +// Probe the supplied object, and report if it looks like a zactor_t. +CZMQ_EXPORT bool + zactor_is (void *self); + +// Probe the supplied reference. If it looks like a zactor_t instance, +// return the underlying libzmq actor handle; else if it looks like +// a libzmq actor handle, return the supplied value. +CZMQ_EXPORT void * + zactor_resolve (void *self); + +// Return the actor's zsock handle. Use this when you absolutely need +// to work with the zsock instance rather than the actor. +CZMQ_EXPORT zsock_t * + zactor_sock (zactor_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zactor_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zarmour.h b/phonelibs/zmq/aarch64/include/zarmour.h new file mode 100644 index 00000000000000..c7f299f7afe989 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zarmour.h @@ -0,0 +1,114 @@ +/* ========================================================================= + zarmour - armoured text encoding and decoding + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZARMOUR_H_INCLUDED__ +#define __ZARMOUR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zarmour.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 +#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 +#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 +#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 +#define ZARMOUR_MODE_BASE16 4 // Standard base 16 +#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 + +// Create a new zarmour +CZMQ_EXPORT zarmour_t * + zarmour_new (void); + +// Destroy the zarmour +CZMQ_EXPORT void + zarmour_destroy (zarmour_t **self_p); + +// Encode a stream of bytes into an armoured string. Returns the armoured +// string, or NULL if there was insufficient memory available to allocate +// a new string. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zarmour_encode (zarmour_t *self, const byte *data, size_t size); + +// Decode an armoured string into a chunk. The decoded output is +// null-terminated, so it may be treated as a string, if that's what +// it was prior to encoding. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zarmour_decode (zarmour_t *self, const char *data); + +// Get the mode property. +CZMQ_EXPORT int + zarmour_mode (zarmour_t *self); + +// Get printable string for mode. +CZMQ_EXPORT const char * + zarmour_mode_str (zarmour_t *self); + +// Set the mode property. +CZMQ_EXPORT void + zarmour_set_mode (zarmour_t *self, int mode); + +// Return true if padding is turned on. +CZMQ_EXPORT bool + zarmour_pad (zarmour_t *self); + +// Turn padding on or off. Default is on. +CZMQ_EXPORT void + zarmour_set_pad (zarmour_t *self, bool pad); + +// Get the padding character. +CZMQ_EXPORT char + zarmour_pad_char (zarmour_t *self); + +// Set the padding character. +CZMQ_EXPORT void + zarmour_set_pad_char (zarmour_t *self, char pad_char); + +// Return if splitting output into lines is turned on. Default is off. +CZMQ_EXPORT bool + zarmour_line_breaks (zarmour_t *self); + +// Turn splitting output into lines on or off. +CZMQ_EXPORT void + zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); + +// Get the line length used for splitting lines. +CZMQ_EXPORT size_t + zarmour_line_length (zarmour_t *self); + +// Set the line length used for splitting lines. +CZMQ_EXPORT void + zarmour_set_line_length (zarmour_t *self, size_t line_length); + +// Print properties of object +CZMQ_EXPORT void + zarmour_print (zarmour_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zarmour_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zauth.h b/phonelibs/zmq/aarch64/include/zauth.h new file mode 100644 index 00000000000000..ca6bb913c8f5aa --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zauth.h @@ -0,0 +1,100 @@ +/* ========================================================================= + zauth - authentication for ZeroMQ security mechanisms + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZAUTH_H_INCLUDED__ +#define __ZAUTH_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#define CURVE_ALLOW_ANY "*" + +// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated). +// +// Create new zauth actor instance. This installs authentication on all +// zsock sockets. Until you add policies, all incoming NULL connections are +// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections +// are denied: +// +// zactor_t *auth = zactor_new (zauth, NULL); +// +// Destroy zauth instance. This removes authentication and allows all +// connections to pass, without authentication: +// +// zactor_destroy (&auth); +// +// Note that all zauth commands are synchronous, so your application always +// waits for a signal from the actor after each command. +// +// Enable verbose logging of commands and activity. Verbose logging can help +// debug non-trivial authentication policies: +// +// zstr_send (auth, "VERBOSE"); +// zsock_wait (auth); +// +// Allow (whitelist) a list of IP addresses. For NULL, all clients from +// these addresses will be accepted. For PLAIN and CURVE, they will be +// allowed to continue with authentication. You can call this method +// multiple times to whitelist more IP addresses. If you whitelist one +// or nmore addresses, any non-whitelisted addresses are treated as +// blacklisted: +// +// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL); +// zsock_wait (auth); +// +// Deny (blacklist) a list of IP addresses. For all security mechanisms, +// this rejects the connection without any further authentication. Use +// either a whitelist, or a blacklist, not not both. If you define both +// a whitelist and a blacklist, only the whitelist takes effect: +// +// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL); +// zsock_wait (auth); +// +// Configure PLAIN authentication using a plain-text password file. You can +// modify the password file at any time; zauth will reload it automatically +// if modified externally: +// +// zstr_sendx (auth, "PLAIN", filename, NULL); +// zsock_wait (auth); +// +// Configure CURVE authentication, using a directory that holds all public +// client certificates, i.e. their public keys. The certificates must be in +// zcert_save format. You can add and remove certificates in that directory +// at any time. To allow all client keys without checking, specify +// CURVE_ALLOW_ANY for the directory name: +// +// zstr_sendx (auth, "CURVE", directory, NULL); +// zsock_wait (auth); +// +// Configure GSSAPI authentication, using an underlying mechanism (usually +// Kerberos) to establish a secure context and perform mutual authentication: +// +// zstr_sendx (auth, "GSSAPI", NULL); +// zsock_wait (auth); +// +// This is the zauth constructor as a zactor_fn: +CZMQ_EXPORT void + zauth (zsock_t *pipe, void *certstore); + +// Selftest +CZMQ_EXPORT void + zauth_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zauth_v2.h b/phonelibs/zmq/aarch64/include/zauth_v2.h new file mode 100644 index 00000000000000..bbbee86b03e62d --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zauth_v2.h @@ -0,0 +1,88 @@ +/* ========================================================================= + zauth_v2 - authentication for ZeroMQ servers (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZAUTH_V2_H_INCLUDED__ +#define __ZAUTH_V2_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#ifndef CURVE_ALLOW_ANY +# define CURVE_ALLOW_ANY "*" +#endif + +// Constructor +// Install authentication for the specified context. Returns a new zauth +// object that you can use to configure authentication. Note that until you +// add policies, all incoming NULL connections are allowed (classic ZeroMQ +// behaviour), and all PLAIN and CURVE connections are denied. If there was +// an error during initialization, returns NULL. +CZMQ_EXPORT zauth_t * + zauth_new (zctx_t *ctx); + +// Destructor +CZMQ_EXPORT void + zauth_destroy (zauth_t **self_p); + +// Allow (whitelist) a single IP address. For NULL, all clients from this +// address will be accepted. For PLAIN and CURVE, they will be allowed to +// continue with authentication. You can call this method multiple times +// to whitelist multiple IP addresses. If you whitelist a single address, +// any non-whitelisted addresses are treated as blacklisted. +CZMQ_EXPORT void + zauth_allow (zauth_t *self, const char *address); + +// Deny (blacklist) a single IP address. For all security mechanisms, this +// rejects the connection without any further authentication. Use either a +// whitelist, or a blacklist, not not both. If you define both a whitelist +// and a blacklist, only the whitelist takes effect. +CZMQ_EXPORT void + zauth_deny (zauth_t *self, const char *address); + +// Configure PLAIN authentication for a given domain. PLAIN authentication +// uses a plain-text password file. To cover all domains, use "*". You can +// modify the password file at any time; it is reloaded automatically. +CZMQ_EXPORT void + zauth_configure_plain (zauth_t *self, const char *domain, const char *filename); + +// Configure CURVE authentication for a given domain. CURVE authentication +// uses a directory that holds all public client certificates, i.e. their +// public keys. The certificates must be in zcert_save () format. To cover +// all domains, use "*". You can add and remove certificates in that +// directory at any time. To allow all client keys without checking, specify +// CURVE_ALLOW_ANY for the location. +CZMQ_EXPORT void + zauth_configure_curve (zauth_t *self, const char *domain, const char *location); + +// Configure GSSAPI authentication for a given domain. GSSAPI authentication +// uses an underlying mechanism (usually Kerberos) to establish a secure +// context and perform mutual authentication. To cover all domains, use "*". +CZMQ_EXPORT void + zauth_configure_gssapi (zauth_t *self, char *domain); + +// Enable verbose tracing of commands and activity +CZMQ_EXPORT void + zauth_set_verbose (zauth_t *self, bool verbose); + +// Selftest +CZMQ_EXPORT void + zauth_v2_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zbeacon.h b/phonelibs/zmq/aarch64/include/zbeacon.h new file mode 100644 index 00000000000000..78917e9577e40f --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zbeacon.h @@ -0,0 +1,86 @@ +/* ========================================================================= + zbeacon - LAN discovery and presence + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZBEACON_H_INCLUDED__ +#define __ZBEACON_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create new zbeacon actor instance: +// +// zactor_t *beacon = zactor_new (zbeacon, NULL); +// +// Destroy zbeacon instance: +// +// zactor_destroy (&beacon); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (beacon, "VERBOSE"); +// +// Configure beacon to run on specified UDP port, and return the name of +// the host, which can be used as endpoint for incoming connections. To +// force the beacon to operate on a given interface, set the environment +// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating +// the beacon. If the system does not support UDP broadcasts (lacking a +// workable interface), returns an empty hostname: +// +// // Pictures: 's' = C string, 'i' = int +// zsock_send (beacon, "si", "CONFIGURE", port_number); +// char *hostname = zstr_recv (beacon); +// +// Start broadcasting a beacon at a specified interval in msec. The beacon +// data can be at most UDP_FRAME_MAX bytes; this constant is defined in +// zsys.h to be 255: +// +// // Pictures: 'b' = byte * data + size_t size +// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); +// +// Stop broadcasting the beacon: +// +// zstr_sendx (beacon, "SILENCE", NULL); +// +// Start listening to beacons from peers. The filter is used to do a prefix +// match on received beacons, to remove junk. Note that any received data +// that is identical to our broadcast beacon_data is discarded in any case. +// If the filter size is zero, we get all peer beacons: +// +// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); +// +// Stop listening to other peers +// +// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); +// +// Receive next beacon from a peer. Received beacons are always a 2-frame +// message containing the ipaddress of the sender, and then the binary +// beacon data as published by the sender: +// +// zmsg_t *msg = zmsg_recv (beacon); +// +// This is the zbeacon constructor as a zactor_fn: +CZMQ_EXPORT void + zbeacon (zsock_t *pipe, void *unused); + +// Self test of this class +CZMQ_EXPORT void + zbeacon_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zbeacon_v2.h b/phonelibs/zmq/aarch64/include/zbeacon_v2.h new file mode 100644 index 00000000000000..8e8f3b4cde9967 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zbeacon_v2.h @@ -0,0 +1,75 @@ +/* ========================================================================= + zbeacon - LAN discovery and presence (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZBEACON_V2_H_INCLUDED__ +#define __ZBEACON_V2_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create a new beacon on a certain UDP port. If the system does not +// support UDP broadcasts (lacking a useful interface), returns NULL. +// To force the beacon to operate on a given port, set the environment +// variable ZSYS_INTERFACE, or call zsys_set_interface() beforehand. +// If you are using the new zsock API then pass NULL as the ctx here. +CZMQ_EXPORT zbeacon_t * + zbeacon_new (zctx_t *ctx, int port_nbr); + +// Destroy a beacon +CZMQ_EXPORT void + zbeacon_destroy (zbeacon_t **self_p); + +// Return our own IP address as printable string +CZMQ_EXPORT char * + zbeacon_hostname (zbeacon_t *self); + +// Set broadcast interval in milliseconds (default is 1000 msec) +CZMQ_EXPORT void + zbeacon_set_interval (zbeacon_t *self, int interval); + +// Filter out any beacon that looks exactly like ours +CZMQ_EXPORT void + zbeacon_noecho (zbeacon_t *self); + +// Start broadcasting beacon to peers at the specified interval +CZMQ_EXPORT void + zbeacon_publish (zbeacon_t *self, byte *transmit, size_t size); + +// Stop broadcasting beacons +CZMQ_EXPORT void + zbeacon_silence (zbeacon_t *self); + +// Start listening to other peers; zero-sized filter means get everything +CZMQ_EXPORT void + zbeacon_subscribe (zbeacon_t *self, byte *filter, size_t size); + +// Stop listening to other peers +CZMQ_EXPORT void + zbeacon_unsubscribe (zbeacon_t *self); + +// Get beacon ZeroMQ socket, for polling or receiving messages +CZMQ_EXPORT void * + zbeacon_socket (zbeacon_t *self); + +// Self test of this class +CZMQ_EXPORT void + zbeacon_v2_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zcert.h b/phonelibs/zmq/aarch64/include/zcert.h new file mode 100644 index 00000000000000..495b579cda9317 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zcert.h @@ -0,0 +1,139 @@ +/* ========================================================================= + zcert - work with CURVE security certificates + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCERT_H_INCLUDED__ +#define __ZCERT_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zcert.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// This class has legacy methods, which will be removed over time. You +// should not use them, and migrate any code that is still using them. +// Create and initialize a new certificate in memory +CZMQ_EXPORT zcert_t * + zcert_new (void); + +// Accepts public/secret key pair from caller +CZMQ_EXPORT zcert_t * + zcert_new_from (const byte *public_key, const byte *secret_key); + +// Load certificate from file +CZMQ_EXPORT zcert_t * + zcert_load (const char *filename); + +// Destroy a certificate in memory +CZMQ_EXPORT void + zcert_destroy (zcert_t **self_p); + +// Return public part of key pair as 32-byte binary string +CZMQ_EXPORT const byte * + zcert_public_key (zcert_t *self); + +// Return secret part of key pair as 32-byte binary string +CZMQ_EXPORT const byte * + zcert_secret_key (zcert_t *self); + +// Return public part of key pair as Z85 armored string +CZMQ_EXPORT const char * + zcert_public_txt (zcert_t *self); + +// Return secret part of key pair as Z85 armored string +CZMQ_EXPORT const char * + zcert_secret_txt (zcert_t *self); + +// Set certificate metadata from formatted string. +CZMQ_EXPORT void + zcert_set_meta (zcert_t *self, const char *name, const char *format, ...); + +// Get metadata value from certificate; if the metadata value doesn't +// exist, returns NULL. +CZMQ_EXPORT const char * + zcert_meta (zcert_t *self, const char *name); + +// Get list of metadata fields from certificate. Caller is responsible for +// destroying list. Caller should not modify the values of list items. +CZMQ_EXPORT zlist_t * + zcert_meta_keys (zcert_t *self); + +// Save full certificate (public + secret) to file for persistent storage +// This creates one public file and one secret file (filename + "_secret"). +CZMQ_EXPORT int + zcert_save (zcert_t *self, const char *filename); + +// Save public certificate only to file for persistent storage +CZMQ_EXPORT int + zcert_save_public (zcert_t *self, const char *filename); + +// Save secret certificate only to file for persistent storage +CZMQ_EXPORT int + zcert_save_secret (zcert_t *self, const char *filename); + +// Apply certificate to socket, i.e. use for CURVE security on socket. +// If certificate was loaded from public file, the secret key will be +// undefined, and this certificate will not work successfully. +CZMQ_EXPORT void + zcert_apply (zcert_t *self, void *socket); + +// Return copy of certificate; if certificate is NULL or we exhausted +// heap memory, returns NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zcert_t * + zcert_dup (zcert_t *self); + +// Return true if two certificates have the same keys +CZMQ_EXPORT bool + zcert_eq (zcert_t *self, zcert_t *compare); + +// Print certificate contents to stdout +CZMQ_EXPORT void + zcert_print (zcert_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Print certificate contents to open stream. This method is deprecated +// and you should use the print method. +CZMQ_EXPORT void + zcert_fprint (zcert_t *self, FILE *file); + +// Self test of this class +CZMQ_EXPORT void + zcert_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Unset certificate metadata. +CZMQ_EXPORT void + zcert_unset_meta (zcert_t *self, const char *name); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT void + zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3); +// @end + + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zcert_dump(s) zcert_print(s) + +#endif diff --git a/phonelibs/zmq/aarch64/include/zcertstore.h b/phonelibs/zmq/aarch64/include/zcertstore.h new file mode 100644 index 00000000000000..c7f93c5a7d4604 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zcertstore.h @@ -0,0 +1,100 @@ +/* ========================================================================= + zcertstore - work with CURVE security certificate stores + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCERTSTORE_H_INCLUDED__ +#define __ZCERTSTORE_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zcertstore.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// This class has legacy methods, which will be removed over time. You +// should not use them, and migrate any code that is still using them. +// Create a new certificate store from a disk directory, loading and +// indexing all certificates in that location. The directory itself may be +// absent, and created later, or modified at any time. The certificate store +// is automatically refreshed on any zcertstore_lookup() call. If the +// location is specified as NULL, creates a pure-memory store, which you +// can work with by inserting certificates at runtime. +CZMQ_EXPORT zcertstore_t * + zcertstore_new (const char *location); + +// Destroy a certificate store object in memory. Does not affect anything +// stored on disk. +CZMQ_EXPORT void + zcertstore_destroy (zcertstore_t **self_p); + +// Look up certificate by public key, returns zcert_t object if found, +// else returns NULL. The public key is provided in Z85 text format. +CZMQ_EXPORT zcert_t * + zcertstore_lookup (zcertstore_t *self, const char *public_key); + +// Insert certificate into certificate store in memory. Note that this +// does not save the certificate to disk. To do that, use zcert_save() +// directly on the certificate. Takes ownership of zcert_t object. +CZMQ_EXPORT void + zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); + +// Print list of certificates in store to logging facility +CZMQ_EXPORT void + zcertstore_print (zcertstore_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Print list of certificates in store to open stream. This method is +// deprecated, and you should use the print method. +CZMQ_EXPORT void + zcertstore_fprint (zcertstore_t *self, FILE *file); + +// Self test of this class +CZMQ_EXPORT void + zcertstore_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// Loaders retrieve certificates from an arbitrary source. +typedef void (zcertstore_loader) ( + zcertstore_t *self); + +// Destructor for loader state. +typedef void (zcertstore_destructor) ( + void **self_p); + +// *** Draft method, for development use, may change without warning *** +// Override the default disk loader with a custom loader fn. +CZMQ_EXPORT void + zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); + +// *** Draft method, for development use, may change without warning *** +// Empty certificate hashtable. This wrapper exists to be friendly to bindings, +// which don't usually have access to struct internals. +CZMQ_EXPORT void + zcertstore_empty (zcertstore_t *self); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zcertstore_dump(s) zcertstore_print(s) + +#endif diff --git a/phonelibs/zmq/aarch64/include/zchunk.h b/phonelibs/zmq/aarch64/include/zchunk.h new file mode 100644 index 00000000000000..56f29b161a37e5 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zchunk.h @@ -0,0 +1,163 @@ +/* ========================================================================= + zchunk - work with memory chunks + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCHUNK_H_INCLUDED__ +#define __ZCHUNK_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zchunk.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create a new chunk of the specified size. If you specify the data, it +// is copied into the chunk. If you do not specify the data, the chunk is +// allocated and left empty, and you can then add data using zchunk_append. +CZMQ_EXPORT zchunk_t * + zchunk_new (const void *data, size_t size); + +// Destroy a chunk +CZMQ_EXPORT void + zchunk_destroy (zchunk_t **self_p); + +// Resizes chunk max_size as requested; chunk_cur size is set to zero +CZMQ_EXPORT void + zchunk_resize (zchunk_t *self, size_t size); + +// Return chunk cur size +CZMQ_EXPORT size_t + zchunk_size (zchunk_t *self); + +// Return chunk max size +CZMQ_EXPORT size_t + zchunk_max_size (zchunk_t *self); + +// Return chunk data +CZMQ_EXPORT byte * + zchunk_data (zchunk_t *self); + +// Set chunk data from user-supplied data; truncate if too large. Data may +// be null. Returns actual size of chunk +CZMQ_EXPORT size_t + zchunk_set (zchunk_t *self, const void *data, size_t size); + +// Fill chunk data from user-supplied octet +CZMQ_EXPORT size_t + zchunk_fill (zchunk_t *self, byte filler, size_t size); + +// Append user-supplied data to chunk, return resulting chunk size. If the +// data would exceeded the available space, it is truncated. If you want to +// grow the chunk to accommodate new data, use the zchunk_extend method. +CZMQ_EXPORT size_t + zchunk_append (zchunk_t *self, const void *data, size_t size); + +// Append user-supplied data to chunk, return resulting chunk size. If the +// data would exceeded the available space, the chunk grows in size. +CZMQ_EXPORT size_t + zchunk_extend (zchunk_t *self, const void *data, size_t size); + +// Copy as much data from 'source' into the chunk as possible; returns the +// new size of chunk. If all data from 'source' is used, returns exhausted +// on the source chunk. Source can be consumed as many times as needed until +// it is exhausted. If source was already exhausted, does not change chunk. +CZMQ_EXPORT size_t + zchunk_consume (zchunk_t *self, zchunk_t *source); + +// Returns true if the chunk was exhausted by consume methods, or if the +// chunk has a size of zero. +CZMQ_EXPORT bool + zchunk_exhausted (zchunk_t *self); + +// Read chunk from an open file descriptor +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_read (FILE *handle, size_t bytes); + +// Write chunk to an open file descriptor +CZMQ_EXPORT int + zchunk_write (zchunk_t *self, FILE *handle); + +// Try to slurp an entire file into a chunk. Will read up to maxsize of +// the file. If maxsize is 0, will attempt to read the entire file and +// fail with an assertion if that cannot fit into memory. Returns a new +// chunk containing the file data, or NULL if the file could not be read. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_slurp (const char *filename, size_t maxsize); + +// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t +// object, or null if there was not enough heap memory. If chunk is null, +// returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_dup (zchunk_t *self); + +// Return chunk data encoded as printable hex string. Caller must free +// string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zchunk_strhex (zchunk_t *self); + +// Return chunk data copied into freshly allocated string +// Caller must free string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zchunk_strdup (zchunk_t *self); + +// Return TRUE if chunk body is equal to string, excluding terminator +CZMQ_EXPORT bool + zchunk_streq (zchunk_t *self, const char *string); + +// Transform zchunk into a zframe that can be sent in a message. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zchunk_pack (zchunk_t *self); + +// Transform a zframe into a zchunk. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_unpack (zframe_t *frame); + +// Calculate SHA1 digest for chunk, using zdigest class. +CZMQ_EXPORT const char * + zchunk_digest (zchunk_t *self); + +// Dump chunk to FILE stream, for debugging and tracing. +CZMQ_EXPORT void + zchunk_fprint (zchunk_t *self, FILE *file); + +// Dump message to stderr, for debugging and tracing. +// See zchunk_fprint for details +CZMQ_EXPORT void + zchunk_print (zchunk_t *self); + +// Probe the supplied object, and report if it looks like a zchunk_t. +CZMQ_EXPORT bool + zchunk_is (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zchunk_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/phonelibs/zmq/aarch64/include/zclock.h b/phonelibs/zmq/aarch64/include/zclock.h new file mode 100644 index 00000000000000..eb064162c4722a --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zclock.h @@ -0,0 +1,73 @@ +/* ========================================================================= + zclock - millisecond clocks and delays + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCLOCK_H_INCLUDED__ +#define __ZCLOCK_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zclock.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Sleep for a number of milliseconds +CZMQ_EXPORT void + zclock_sleep (int msecs); + +// Return current system clock as milliseconds. Note that this clock can +// jump backwards (if the system clock is changed) so is unsafe to use for +// timers and time offsets. Use zclock_mono for that instead. +CZMQ_EXPORT int64_t + zclock_time (void); + +// Return current monotonic clock in milliseconds. Use this when you compute +// time offsets. The monotonic clock is not affected by system changes and +// so will never be reset backwards, unlike a system clock. +CZMQ_EXPORT int64_t + zclock_mono (void); + +// Return current monotonic clock in microseconds. Use this when you compute +// time offsets. The monotonic clock is not affected by system changes and +// so will never be reset backwards, unlike a system clock. +CZMQ_EXPORT int64_t + zclock_usecs (void); + +// Return formatted date/time as fresh string. Free using zstr_free(). +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zclock_timestr (void); + +// Self test of this class. +CZMQ_EXPORT void + zclock_test (bool verbose); + +// @end + + +// DEPRECATED in favor of zsys logging, see issue #519 +// Print formatted string to stdout, prefixed by date/time and +// terminated with a newline. +CZMQ_EXPORT void + zclock_log (const char *format, ...); + +// Compiler hints +CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zconfig.h b/phonelibs/zmq/aarch64/include/zconfig.h new file mode 100644 index 00000000000000..4ec4e1c81f03e1 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zconfig.h @@ -0,0 +1,194 @@ +/* ========================================================================= + zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL. + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCONFIG_H_INCLUDED__ +#define __ZCONFIG_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zconfig.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// +typedef int (zconfig_fct) ( + zconfig_t *self, void *arg, int level); + +// Create new config item +CZMQ_EXPORT zconfig_t * + zconfig_new (const char *name, zconfig_t *parent); + +// Load a config tree from a specified ZPL text file; returns a zconfig_t +// reference for the root, if the file exists and is readable. Returns NULL +// if the file does not exist. +CZMQ_EXPORT zconfig_t * + zconfig_load (const char *filename); + +// Equivalent to zconfig_load, taking a format string instead of a fixed +// filename. +CZMQ_EXPORT zconfig_t * + zconfig_loadf (const char *format, ...); + +// Destroy a config item and all its children +CZMQ_EXPORT void + zconfig_destroy (zconfig_t **self_p); + +// Return name of config item +CZMQ_EXPORT char * + zconfig_name (zconfig_t *self); + +// Return value of config item +CZMQ_EXPORT char * + zconfig_value (zconfig_t *self); + +// Insert or update configuration key with value +CZMQ_EXPORT void + zconfig_put (zconfig_t *self, const char *path, const char *value); + +// Equivalent to zconfig_put, accepting a format specifier and variable +// argument list, instead of a single string value. +CZMQ_EXPORT void + zconfig_putf (zconfig_t *self, const char *path, const char *format, ...); + +// Get value for config item into a string value; leading slash is optional +// and ignored. +CZMQ_EXPORT char * + zconfig_get (zconfig_t *self, const char *path, const char *default_value); + +// Set config item name, name may be NULL +CZMQ_EXPORT void + zconfig_set_name (zconfig_t *self, const char *name); + +// Set new value for config item. The new value may be a string, a printf +// format, or NULL. Note that if string may possibly contain '%', or if it +// comes from an insecure source, you must use '%s' as the format, followed +// by the string. +CZMQ_EXPORT void + zconfig_set_value (zconfig_t *self, const char *format, ...); + +// Find our first child, if any +CZMQ_EXPORT zconfig_t * + zconfig_child (zconfig_t *self); + +// Find our first sibling, if any +CZMQ_EXPORT zconfig_t * + zconfig_next (zconfig_t *self); + +// Find a config item along a path; leading slash is optional and ignored. +CZMQ_EXPORT zconfig_t * + zconfig_locate (zconfig_t *self, const char *path); + +// Locate the last config item at a specified depth +CZMQ_EXPORT zconfig_t * + zconfig_at_depth (zconfig_t *self, int level); + +// Execute a callback for each config item in the tree; returns zero if +// successful, else -1. +CZMQ_EXPORT int + zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); + +// Add comment to config item before saving to disk. You can add as many +// comment lines as you like. If you use a null format, all comments are +// deleted. +CZMQ_EXPORT void + zconfig_set_comment (zconfig_t *self, const char *format, ...); + +// Return comments of config item, as zlist. +CZMQ_EXPORT zlist_t * + zconfig_comments (zconfig_t *self); + +// Save a config tree to a specified ZPL text file, where a filename +// "-" means dump to standard output. +CZMQ_EXPORT int + zconfig_save (zconfig_t *self, const char *filename); + +// Equivalent to zconfig_save, taking a format string instead of a fixed +// filename. +CZMQ_EXPORT int + zconfig_savef (zconfig_t *self, const char *format, ...); + +// Report filename used during zconfig_load, or NULL if none +CZMQ_EXPORT const char * + zconfig_filename (zconfig_t *self); + +// Reload config tree from same file that it was previously loaded from. +// Returns 0 if OK, -1 if there was an error (and then does not change +// existing data). +CZMQ_EXPORT int + zconfig_reload (zconfig_t **self_p); + +// Load a config tree from a memory chunk +CZMQ_EXPORT zconfig_t * + zconfig_chunk_load (zchunk_t *chunk); + +// Save a config tree to a new memory chunk +CZMQ_EXPORT zchunk_t * + zconfig_chunk_save (zconfig_t *self); + +// Load a config tree from a null-terminated string +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zconfig_t * + zconfig_str_load (const char *string); + +// Save a config tree to a new null terminated string +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zconfig_str_save (zconfig_t *self); + +// Return true if a configuration tree was loaded from a file and that +// file has changed in since the tree was loaded. +CZMQ_EXPORT bool + zconfig_has_changed (zconfig_t *self); + +// Print the config file to open stream +CZMQ_EXPORT void + zconfig_fprint (zconfig_t *self, FILE *file); + +// Print properties of object +CZMQ_EXPORT void + zconfig_print (zconfig_t *self); + +// Self test of this class +CZMQ_EXPORT void + zconfig_test (bool verbose); + +// @ignore +CZMQ_EXPORT void + zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3); +CZMQ_EXPORT void + zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT void + zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + +// Self test of this class +CZMQ_EXPORT void + zconfig_test (bool verbose); + +// Compiler hints +CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zconfig_dump(s) zconfig_print(s) +#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d)) + +#endif diff --git a/phonelibs/zmq/aarch64/include/zctx.h b/phonelibs/zmq/aarch64/include/zctx.h new file mode 100644 index 00000000000000..88898410dc8e99 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zctx.h @@ -0,0 +1,107 @@ +/* ========================================================================= + zctx - working with 0MQ contexts + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCTX_H_INCLUDED__ +#define __ZCTX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + + +// @interface +// Create new context, returns context object, replaces zmq_init +CZMQ_EXPORT zctx_t * + zctx_new (void); + +// Destroy context and all sockets in it, replaces zmq_term +CZMQ_EXPORT void + zctx_destroy (zctx_t **self_p); + +// Create new shadow context, returns context object +CZMQ_EXPORT zctx_t * + zctx_shadow (zctx_t *self); +// @end + +// Create a new context by shadowing a plain zmq context +CZMQ_EXPORT zctx_t * +zctx_shadow_zmq_ctx (void *zmqctx); + +// @interface +// Raise default I/O threads from 1, for crazy heavy applications +// The rule of thumb is one I/O thread per gigabyte of traffic in +// or out. Call this method before creating any sockets on the context, +// or calling zctx_shadow, or the setting will have no effect. +CZMQ_EXPORT void + zctx_set_iothreads (zctx_t *self, int iothreads); + +// Set msecs to flush sockets when closing them, see the ZMQ_LINGER +// man page section for more details. By default, set to zero, so +// any in-transit messages are discarded when you destroy a socket or +// a context. +CZMQ_EXPORT void + zctx_set_linger (zctx_t *self, int linger); + +// Set initial high-water mark for inter-thread pipe sockets. Note that +// this setting is separate from the default for normal sockets. You +// should change the default for pipe sockets *with care*. Too low values +// will cause blocked threads, and an infinite setting can cause memory +// exhaustion. The default, no matter the underlying ZeroMQ version, is +// 1,000. +CZMQ_EXPORT void + zctx_set_pipehwm (zctx_t *self, int pipehwm); + +// Set initial send HWM for all new normal sockets created in context. +// You can set this per-socket after the socket is created. +// The default, no matter the underlying ZeroMQ version, is 1,000. +CZMQ_EXPORT void + zctx_set_sndhwm (zctx_t *self, int sndhwm); + +// Set initial receive HWM for all new normal sockets created in context. +// You can set this per-socket after the socket is created. +// The default, no matter the underlying ZeroMQ version, is 1,000. +CZMQ_EXPORT void + zctx_set_rcvhwm (zctx_t *self, int rcvhwm); + +// Return low-level 0MQ context object, will be NULL before first socket +// is created. Use with care. +CZMQ_EXPORT void * + zctx_underlying (zctx_t *self); + +// Self test of this class +CZMQ_EXPORT void + zctx_test (bool verbose); +// @end + +// Create socket within this context, for CZMQ use only +void * + zctx__socket_new (zctx_t *self, int type); + +// Create pipe socket within this context, for CZMQ use only +void * + zctx__socket_pipe (zctx_t *self); + +// Destroy socket within this context, for CZMQ use only +void + zctx__socket_destroy (zctx_t *self, void *socket); + +// Initialize the low-level 0MQ context object, for CZMQ use only +void + zctx__initialize_underlying(zctx_t *self); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zdigest.h b/phonelibs/zmq/aarch64/include/zdigest.h new file mode 100644 index 00000000000000..def9e860537094 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zdigest.h @@ -0,0 +1,65 @@ +/* ========================================================================= + zdigest - provides hashing functions (SHA-1 at present) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZDIGEST_H_INCLUDED__ +#define __ZDIGEST_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zdigest.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Constructor - creates new digest object, which you use to build up a +// digest by repeatedly calling zdigest_update() on chunks of data. +CZMQ_EXPORT zdigest_t * + zdigest_new (void); + +// Destroy a digest object +CZMQ_EXPORT void + zdigest_destroy (zdigest_t **self_p); + +// Add buffer into digest calculation +CZMQ_EXPORT void + zdigest_update (zdigest_t *self, const byte *buffer, size_t length); + +// Return final digest hash data. If built without crypto support, +// returns NULL. +CZMQ_EXPORT const byte * + zdigest_data (zdigest_t *self); + +// Return final digest hash size +CZMQ_EXPORT size_t + zdigest_size (zdigest_t *self); + +// Return digest as printable hex string; caller should not modify nor +// free this string. After calling this, you may not use zdigest_update() +// on the same digest. If built without crypto support, returns NULL. +CZMQ_EXPORT char * + zdigest_string (zdigest_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zdigest_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zdir.h b/phonelibs/zmq/aarch64/include/zdir.h new file mode 100644 index 00000000000000..6c5551b57eead4 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zdir.h @@ -0,0 +1,149 @@ +/* ========================================================================= + zdir - work with file-system directories + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZDIR_H_INCLUDED__ +#define __ZDIR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zdir.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create a new directory item that loads in the full tree of the specified +// path, optionally located under some parent path. If parent is "-", then +// loads only the top-level directory, and does not use parent as a path. +CZMQ_EXPORT zdir_t * + zdir_new (const char *path, const char *parent); + +// Destroy a directory tree and all children it contains. +CZMQ_EXPORT void + zdir_destroy (zdir_t **self_p); + +// Return directory path +CZMQ_EXPORT const char * + zdir_path (zdir_t *self); + +// Return last modification time for directory. +CZMQ_EXPORT time_t + zdir_modified (zdir_t *self); + +// Return total hierarchy size, in bytes of data contained in all files +// in the directory tree. +CZMQ_EXPORT off_t + zdir_cursize (zdir_t *self); + +// Return directory count +CZMQ_EXPORT size_t + zdir_count (zdir_t *self); + +// Returns a sorted list of zfile objects; Each entry in the list is a pointer +// to a zfile_t item already allocated in the zdir tree. Do not destroy the +// original zdir tree until you are done with this list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zdir_list (zdir_t *self); + +// Remove directory, optionally including all files that it contains, at +// all levels. If force is false, will only remove the directory if empty. +// If force is true, will remove all files and all subdirectories. +CZMQ_EXPORT void + zdir_remove (zdir_t *self, bool force); + +// Calculate differences between two versions of a directory tree. +// Returns a list of zdir_patch_t patches. Either older or newer may +// be null, indicating the directory is empty/absent. If alias is set, +// generates virtual filename (minus path, plus alias). +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); + +// Return full contents of directory as a zdir_patch list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zdir_resync (zdir_t *self, const char *alias); + +// Load directory cache; returns a hash table containing the SHA-1 digests +// of every file in the tree. The cache is saved between runs in .cache. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zhash_t * + zdir_cache (zdir_t *self); + +// Print contents of directory to open stream +CZMQ_EXPORT void + zdir_fprint (zdir_t *self, FILE *file, int indent); + +// Print contents of directory to stdout +CZMQ_EXPORT void + zdir_print (zdir_t *self, int indent); + +// Create a new zdir_watch actor instance: +// +// zactor_t *watch = zactor_new (zdir_watch, NULL); +// +// Destroy zdir_watch instance: +// +// zactor_destroy (&watch); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (watch, "VERBOSE"); +// +// Subscribe to changes to a directory path: +// +// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); +// +// Unsubscribe from changes to a directory path: +// +// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); +// +// Receive directory changes: +// zsock_recv (watch, "sp", &path, &patches); +// +// // Delete the received data. +// free (path); +// zlist_destroy (&patches); +CZMQ_EXPORT void + zdir_watch (zsock_t *pipe, void *unused); + +// Self test of this class. +CZMQ_EXPORT void + zdir_test (bool verbose); + +// @end + + +// Returns a sorted array of zfile objects; returns a single block of memory, +// that you destroy by calling zstr_free(). Each entry in the array is a pointer +// to a zfile_t item already allocated in the zdir tree. The array ends with +// a null pointer. Do not destroy the original zdir tree until you are done +// with this array. +CZMQ_EXPORT zfile_t ** + zdir_flatten (zdir_t *self); + +// Free a provided string, and nullify the parent pointer. Safe to call on +// a null pointer. +CZMQ_EXPORT void + zdir_flatten_free (zfile_t ***files_p); + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zdir_dump(s,i) zdir_print(s,i) + +#endif diff --git a/phonelibs/zmq/aarch64/include/zdir_patch.h b/phonelibs/zmq/aarch64/include/zdir_patch.h new file mode 100644 index 00000000000000..8d15b9aeb40c42 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zdir_patch.h @@ -0,0 +1,82 @@ +/* ========================================================================= + zdir_patch - work with directory patches + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZDIR_PATCH_H_INCLUDED__ +#define __ZDIR_PATCH_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// un-namespaced enumeration values +#define patch_create ZDIR_PATCH_CREATE +#define patch_delete ZDIR_PATCH_DELETE + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zdir_patch.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +#define ZDIR_PATCH_CREATE 1 // Creates a new file +#define ZDIR_PATCH_DELETE 2 // Delete a file + +// Create new patch +CZMQ_EXPORT zdir_patch_t * + zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); + +// Destroy a patch +CZMQ_EXPORT void + zdir_patch_destroy (zdir_patch_t **self_p); + +// Create copy of a patch. If the patch is null, or memory was exhausted, +// returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zdir_patch_t * + zdir_patch_dup (zdir_patch_t *self); + +// Return patch file directory path +CZMQ_EXPORT const char * + zdir_patch_path (zdir_patch_t *self); + +// Return patch file item +CZMQ_EXPORT zfile_t * + zdir_patch_file (zdir_patch_t *self); + +// Return operation +CZMQ_EXPORT int + zdir_patch_op (zdir_patch_t *self); + +// Return patch virtual file path +CZMQ_EXPORT const char * + zdir_patch_vpath (zdir_patch_t *self); + +// Calculate hash digest for file (create only) +CZMQ_EXPORT void + zdir_patch_digest_set (zdir_patch_t *self); + +// Return hash digest for patch file +CZMQ_EXPORT const char * + zdir_patch_digest (zdir_patch_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zdir_patch_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zfile.h b/phonelibs/zmq/aarch64/include/zfile.h new file mode 100644 index 00000000000000..75c35774b97fd1 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zfile.h @@ -0,0 +1,177 @@ +/* ========================================================================= + zfile - helper functions for working with files. + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZFILE_H_INCLUDED__ +#define __ZFILE_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zfile.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// If file exists, populates properties. CZMQ supports portable symbolic +// links, which are files with the extension ".ln". A symbolic link is a +// text file containing one line, the filename of a target file. Reading +// data from the symbolic link actually reads from the target file. Path +// may be NULL, in which case it is not used. +CZMQ_EXPORT zfile_t * + zfile_new (const char *path, const char *name); + +// Destroy a file item +CZMQ_EXPORT void + zfile_destroy (zfile_t **self_p); + +// Duplicate a file item, returns a newly constructed item. If the file +// is null, or memory was exhausted, returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zfile_t * + zfile_dup (zfile_t *self); + +// Return file name, remove path if provided +CZMQ_EXPORT const char * + zfile_filename (zfile_t *self, const char *path); + +// Refresh file properties from disk; this is not done automatically +// on access methods, otherwise it is not possible to compare directory +// snapshots. +CZMQ_EXPORT void + zfile_restat (zfile_t *self); + +// Return when the file was last modified. If you want this to reflect the +// current situation, call zfile_restat before checking this property. +CZMQ_EXPORT time_t + zfile_modified (zfile_t *self); + +// Return the last-known size of the file. If you want this to reflect the +// current situation, call zfile_restat before checking this property. +CZMQ_EXPORT off_t + zfile_cursize (zfile_t *self); + +// Return true if the file is a directory. If you want this to reflect +// any external changes, call zfile_restat before checking this property. +CZMQ_EXPORT bool + zfile_is_directory (zfile_t *self); + +// Return true if the file is a regular file. If you want this to reflect +// any external changes, call zfile_restat before checking this property. +CZMQ_EXPORT bool + zfile_is_regular (zfile_t *self); + +// Return true if the file is readable by this process. If you want this to +// reflect any external changes, call zfile_restat before checking this +// property. +CZMQ_EXPORT bool + zfile_is_readable (zfile_t *self); + +// Return true if the file is writeable by this process. If you want this +// to reflect any external changes, call zfile_restat before checking this +// property. +CZMQ_EXPORT bool + zfile_is_writeable (zfile_t *self); + +// Check if file has stopped changing and can be safely processed. +// Updates the file statistics from disk at every call. +CZMQ_EXPORT bool + zfile_is_stable (zfile_t *self); + +// Return true if the file was changed on disk since the zfile_t object +// was created, or the last zfile_restat() call made on it. +CZMQ_EXPORT bool + zfile_has_changed (zfile_t *self); + +// Remove the file from disk +CZMQ_EXPORT void + zfile_remove (zfile_t *self); + +// Open file for reading +// Returns 0 if OK, -1 if not found or not accessible +CZMQ_EXPORT int + zfile_input (zfile_t *self); + +// Open file for writing, creating directory if needed +// File is created if necessary; chunks can be written to file at any +// location. Returns 0 if OK, -1 if error. +CZMQ_EXPORT int + zfile_output (zfile_t *self); + +// Read chunk from file at specified position. If this was the last chunk, +// sets the eof property. Returns a null chunk in case of error. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zfile_read (zfile_t *self, size_t bytes, off_t offset); + +// Returns true if zfile_read() just read the last chunk in the file. +CZMQ_EXPORT bool + zfile_eof (zfile_t *self); + +// Write chunk to file at specified position +// Return 0 if OK, else -1 +CZMQ_EXPORT int + zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); + +// Read next line of text from file. Returns a pointer to the text line, +// or NULL if there was nothing more to read from the file. +CZMQ_EXPORT const char * + zfile_readln (zfile_t *self); + +// Close file, if open +CZMQ_EXPORT void + zfile_close (zfile_t *self); + +// Return file handle, if opened +CZMQ_EXPORT FILE * + zfile_handle (zfile_t *self); + +// Calculate SHA1 digest for file, using zdigest class. +CZMQ_EXPORT const char * + zfile_digest (zfile_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zfile_test (bool verbose); + +// @end + + +// @interface +// These methods are deprecated, and now moved to zsys class. +CZMQ_EXPORT bool + zfile_exists (const char *filename); +CZMQ_EXPORT ssize_t + zfile_size (const char *filename); +CZMQ_EXPORT mode_t + zfile_mode (const char *filename); +CZMQ_EXPORT int + zfile_delete (const char *filename); +CZMQ_EXPORT bool + zfile_stable (const char *filename); +CZMQ_EXPORT int + zfile_mkdir (const char *pathname); +CZMQ_EXPORT int + zfile_rmdir (const char *pathname); +CZMQ_EXPORT void + zfile_mode_private (void); +CZMQ_EXPORT void + zfile_mode_default (void); +// @end + +#ifdef __cplusplus +} +#endif + + +#endif // __ZFILE_H_INCLUDED__ diff --git a/phonelibs/zmq/aarch64/include/zframe.h b/phonelibs/zmq/aarch64/include/zframe.h new file mode 100644 index 00000000000000..728093c36ce117 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zframe.h @@ -0,0 +1,176 @@ +/* ========================================================================= + zframe - working with single message frames + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZFRAME_H_INCLUDED__ +#define __ZFRAME_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zframe.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +#define ZFRAME_MORE 1 // +#define ZFRAME_REUSE 2 // +#define ZFRAME_DONTWAIT 4 // + +// Create a new frame. If size is not null, allocates the frame data +// to the specified size. If additionally, data is not null, copies +// size octets from the specified data into the frame body. +CZMQ_EXPORT zframe_t * + zframe_new (const void *data, size_t size); + +// Create an empty (zero-sized) frame +CZMQ_EXPORT zframe_t * + zframe_new_empty (void); + +// Create a frame with a specified string content. +CZMQ_EXPORT zframe_t * + zframe_from (const char *string); + +// Receive frame from socket, returns zframe_t object or NULL if the recv +// was interrupted. Does a blocking recv, if you want to not block then use +// zpoller or zloop. +CZMQ_EXPORT zframe_t * + zframe_recv (void *source); + +// Destroy a frame +CZMQ_EXPORT void + zframe_destroy (zframe_t **self_p); + +// Send a frame to a socket, destroy frame after sending. +// Return -1 on error, 0 on success. +CZMQ_EXPORT int + zframe_send (zframe_t **self_p, void *dest, int flags); + +// Return number of bytes in frame data +CZMQ_EXPORT size_t + zframe_size (zframe_t *self); + +// Return address of frame data +CZMQ_EXPORT byte * + zframe_data (zframe_t *self); + +// Return meta data property for frame +// Caller must free string when finished with it. +CZMQ_EXPORT const char * + zframe_meta (zframe_t *self, const char *property); + +// Create a new frame that duplicates an existing frame. If frame is null, +// or memory was exhausted, returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zframe_dup (zframe_t *self); + +// Return frame data encoded as printable hex string, useful for 0MQ UUIDs. +// Caller must free string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zframe_strhex (zframe_t *self); + +// Return frame data copied into freshly allocated string +// Caller must free string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zframe_strdup (zframe_t *self); + +// Return TRUE if frame body is equal to string, excluding terminator +CZMQ_EXPORT bool + zframe_streq (zframe_t *self, const char *string); + +// Return frame MORE indicator (1 or 0), set when reading frame from socket +// or by the zframe_set_more() method +CZMQ_EXPORT int + zframe_more (zframe_t *self); + +// Set frame MORE indicator (1 or 0). Note this is NOT used when sending +// frame to socket, you have to specify flag explicitly. +CZMQ_EXPORT void + zframe_set_more (zframe_t *self, int more); + +// Return TRUE if two frames have identical size and data +// If either frame is NULL, equality is always false. +CZMQ_EXPORT bool + zframe_eq (zframe_t *self, zframe_t *other); + +// Set new contents for frame +CZMQ_EXPORT void + zframe_reset (zframe_t *self, const void *data, size_t size); + +// Send message to zsys log sink (may be stdout, or system facility as +// configured by zsys_set_logstream). Prefix shows before frame, if not null. +CZMQ_EXPORT void + zframe_print (zframe_t *self, const char *prefix); + +// Probe the supplied object, and report if it looks like a zframe_t. +CZMQ_EXPORT bool + zframe_is (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zframe_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Return frame routing ID, if the frame came from a ZMQ_SERVER socket. +// Else returns zero. +CZMQ_EXPORT uint32_t + zframe_routing_id (zframe_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on frame. This is used if/when the frame is sent to a +// ZMQ_SERVER socket. +CZMQ_EXPORT void + zframe_set_routing_id (zframe_t *self, uint32_t routing_id); + +// *** Draft method, for development use, may change without warning *** +// Return frame group of radio-dish pattern. +CZMQ_EXPORT const char * + zframe_group (zframe_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set group on frame. This is used if/when the frame is sent to a +// ZMQ_RADIO socket. +// Return -1 on error, 0 on success. +CZMQ_EXPORT int + zframe_set_group (zframe_t *self, const char *group); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +// DEPRECATED as poor style -- callers should use zloop or zpoller +// Receive a new frame off the socket. Returns newly allocated frame, or +// NULL if there was no input waiting, or if the read was interrupted. +CZMQ_EXPORT zframe_t * + zframe_recv_nowait (void *source); + +// DEPRECATED as inconsistent; breaks principle that logging should all go +// to a single destination. +// Print contents of the frame to FILE stream. +CZMQ_EXPORT void + zframe_fprint (zframe_t *self, const char *prefix, FILE *file); + +// Deprecated method aliases +#define zframe_print_to_stream(s,p,F) zframe_fprint(s,p,F) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zgossip.h b/phonelibs/zmq/aarch64/include/zgossip.h new file mode 100644 index 00000000000000..647cb28c080731 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zgossip.h @@ -0,0 +1,95 @@ +/* ========================================================================= + zgossip - zgossip server + + ** WARNING ************************************************************* + THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose + your changes at the next build cycle. This is great for temporary printf + statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places + for commits are: + + * The XML model used for this code generation: zgossip.xml, or + * The code generation script that built this file: zproto_server_c + ************************************************************************ + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef ZGOSSIP_H_INCLUDED +#define ZGOSSIP_H_INCLUDED + +#include "czmq.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// To work with zgossip, use the CZMQ zactor API: +// +// Create new zgossip instance, passing logging prefix: +// +// zactor_t *zgossip = zactor_new (zgossip, "myname"); +// +// Destroy zgossip instance +// +// zactor_destroy (&zgossip); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (zgossip, "VERBOSE"); +// +// Bind zgossip to specified endpoint. TCP endpoints may specify +// the port number as "*" to aquire an ephemeral port: +// +// zstr_sendx (zgossip, "BIND", endpoint, NULL); +// +// Return assigned port number, specifically when BIND was done using an +// an ephemeral port: +// +// zstr_sendx (zgossip, "PORT", NULL); +// char *command, *port_str; +// zstr_recvx (zgossip, &command, &port_str, NULL); +// assert (streq (command, "PORT")); +// +// Specify configuration file to load, overwriting any previous loaded +// configuration file or options: +// +// zstr_sendx (zgossip, "LOAD", filename, NULL); +// +// Set configuration path value: +// +// zstr_sendx (zgossip, "SET", path, value, NULL); +// +// Save configuration data to config file on disk: +// +// zstr_sendx (zgossip, "SAVE", filename, NULL); +// +// Send zmsg_t instance to zgossip: +// +// zactor_send (zgossip, &msg); +// +// Receive zmsg_t instance from zgossip: +// +// zmsg_t *msg = zactor_recv (zgossip); +// +// This is the zgossip constructor as a zactor_fn: +// +CZMQ_EXPORT void + zgossip (zsock_t *pipe, void *args); + +// Self test of this class +CZMQ_EXPORT void + zgossip_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zhash.h b/phonelibs/zmq/aarch64/include/zhash.h new file mode 100644 index 00000000000000..929bc2683aec36 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zhash.h @@ -0,0 +1,198 @@ +/* ========================================================================= + zhash - generic type-free hash container (simple) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZHASH_H_INCLUDED__ +#define __ZHASH_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zhash.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has legacy methods, which will be removed over time. You +// should not use them, and migrate any code that is still using them. +// Callback function for zhash_freefn method +typedef void (zhash_free_fn) ( + void *data); + +// Callback function for zhash_foreach method. Deprecated. +typedef int (zhash_foreach_fn) ( + const char *key, void *item, void *argument); + +// Create a new, empty hash container +CZMQ_EXPORT zhash_t * + zhash_new (void); + +// Unpack binary frame into a new hash table. Packed data must follow format +// defined by zhash_pack. Hash table is set to autofree. An empty frame +// unpacks to an empty hash table. +CZMQ_EXPORT zhash_t * + zhash_unpack (zframe_t *frame); + +// Destroy a hash container and all items in it +CZMQ_EXPORT void + zhash_destroy (zhash_t **self_p); + +// Insert item into hash table with specified key and item. +// If key is already present returns -1 and leaves existing item unchanged +// Returns 0 on success. +CZMQ_EXPORT int + zhash_insert (zhash_t *self, const char *key, void *item); + +// Update item into hash table with specified key and item. +// If key is already present, destroys old item and inserts new one. +// Use free_fn method to ensure deallocator is properly called on item. +CZMQ_EXPORT void + zhash_update (zhash_t *self, const char *key, void *item); + +// Remove an item specified by key from the hash table. If there was no such +// item, this function does nothing. +CZMQ_EXPORT void + zhash_delete (zhash_t *self, const char *key); + +// Return the item at the specified key, or null +CZMQ_EXPORT void * + zhash_lookup (zhash_t *self, const char *key); + +// Reindexes an item from an old key to a new key. If there was no such +// item, does nothing. Returns 0 if successful, else -1. +CZMQ_EXPORT int + zhash_rename (zhash_t *self, const char *old_key, const char *new_key); + +// Set a free function for the specified hash table item. When the item is +// destroyed, the free function, if any, is called on that item. +// Use this when hash items are dynamically allocated, to ensure that +// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. +// Returns the item, or NULL if there is no such item. +CZMQ_EXPORT void * + zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); + +// Return the number of keys/items in the hash table +CZMQ_EXPORT size_t + zhash_size (zhash_t *self); + +// Make copy of hash table; if supplied table is null, returns null. +// Does not copy items themselves. Rebuilds new table so may be slow on +// very large tables. NOTE: only works with item values that are strings +// since there's no other way to know how to duplicate the item value. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zhash_t * + zhash_dup (zhash_t *self); + +// Return keys for items in table +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zhash_keys (zhash_t *self); + +// Simple iterator; returns first item in hash table, in no given order, +// or NULL if the table is empty. This method is simpler to use than the +// foreach() method, which is deprecated. To access the key for this item +// use zhash_cursor(). NOTE: do NOT modify the table while iterating. +CZMQ_EXPORT void * + zhash_first (zhash_t *self); + +// Simple iterator; returns next item in hash table, in no given order, +// or NULL if the last item was already returned. Use this together with +// zhash_first() to process all items in a hash table. If you need the +// items in sorted order, use zhash_keys() and then zlist_sort(). To +// access the key for this item use zhash_cursor(). NOTE: do NOT modify +// the table while iterating. +CZMQ_EXPORT void * + zhash_next (zhash_t *self); + +// After a successful first/next method, returns the key for the item that +// was returned. This is a constant string that you may not modify or +// deallocate, and which lasts as long as the item in the hash. After an +// unsuccessful first/next, returns NULL. +CZMQ_EXPORT const char * + zhash_cursor (zhash_t *self); + +// Add a comment to hash table before saving to disk. You can add as many +// comment lines as you like. These comment lines are discarded when loading +// the file. If you use a null format, all comments are deleted. +CZMQ_EXPORT void + zhash_comment (zhash_t *self, const char *format, ...); + +// Serialize hash table to a binary frame that can be sent in a message. +// The packed format is compatible with the 'dictionary' type defined in +// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: +// +// ; A list of name/value pairs +// dictionary = dict-count *( dict-name dict-value ) +// dict-count = number-4 +// dict-value = longstr +// dict-name = string +// +// ; Strings are always length + text contents +// longstr = number-4 *VCHAR +// string = number-1 *VCHAR +// +// ; Numbers are unsigned integers in network byte order +// number-1 = 1OCTET +// number-4 = 4OCTET +// +// Comments are not included in the packed data. Item values MUST be +// strings. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zhash_pack (zhash_t *self); + +// Save hash table to a text file in name=value format. Hash values must be +// printable strings; keys may not contain '=' character. Returns 0 if OK, +// else -1 if a file error occurred. +CZMQ_EXPORT int + zhash_save (zhash_t *self, const char *filename); + +// Load hash table from a text file in name=value format; hash table must +// already exist. Hash values must printable strings; keys may not contain +// '=' character. Returns 0 if OK, else -1 if a file was not readable. +CZMQ_EXPORT int + zhash_load (zhash_t *self, const char *filename); + +// When a hash table was loaded from a file by zhash_load, this method will +// reload the file if it has been modified since, and is "stable", i.e. not +// still changing. Returns 0 if OK, -1 if there was an error reloading the +// file. +CZMQ_EXPORT int + zhash_refresh (zhash_t *self); + +// Set hash for automatic value destruction +CZMQ_EXPORT void + zhash_autofree (zhash_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Apply function to each item in the hash table. Items are iterated in no +// defined order. Stops if callback function returns non-zero and returns +// final return code from callback function (zero = success). Deprecated. +CZMQ_EXPORT int + zhash_foreach (zhash_t *self, zhash_foreach_fn callback, void *argument); + +// Self test of this class. +CZMQ_EXPORT void + zhash_test (bool verbose); + +// @ignore +CZMQ_EXPORT void + zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zhashx.h b/phonelibs/zmq/aarch64/include/zhashx.h new file mode 100644 index 00000000000000..8776073156cf3c --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zhashx.h @@ -0,0 +1,301 @@ +/* ========================================================================= + zhashx - extended generic type-free hash container + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZHASHX_H_INCLUDED__ +#define __ZHASHX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zhashx.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// This class has legacy methods, which will be removed over time. You +// should not use them, and migrate any code that is still using them. +// Destroy an item +typedef void (zhashx_destructor_fn) ( + void **item); + +// Duplicate an item +typedef void * (zhashx_duplicator_fn) ( + const void *item); + +// Compare two items, for sorting +typedef int (zhashx_comparator_fn) ( + const void *item1, const void *item2); + +// compare two items, for sorting +typedef void (zhashx_free_fn) ( + void *data); + +// compare two items, for sorting +typedef size_t (zhashx_hash_fn) ( + const void *key); + +// Serializes an item to a longstr. +// The caller takes ownership of the newly created object. +typedef char * (zhashx_serializer_fn) ( + const void *item); + +// Deserializes a longstr into an item. +// The caller takes ownership of the newly created object. +typedef void * (zhashx_deserializer_fn) ( + const char *item_str); + +// Callback function for zhashx_foreach method. +// This callback is deprecated and you should use zhashx_first/_next instead. +typedef int (zhashx_foreach_fn) ( + const char *key, void *item, void *argument); + +// Create a new, empty hash container +CZMQ_EXPORT zhashx_t * + zhashx_new (void); + +// Unpack binary frame into a new hash table. Packed data must follow format +// defined by zhashx_pack. Hash table is set to autofree. An empty frame +// unpacks to an empty hash table. +CZMQ_EXPORT zhashx_t * + zhashx_unpack (zframe_t *frame); + +// Destroy a hash container and all items in it +CZMQ_EXPORT void + zhashx_destroy (zhashx_t **self_p); + +// Insert item into hash table with specified key and item. +// If key is already present returns -1 and leaves existing item unchanged +// Returns 0 on success. +CZMQ_EXPORT int + zhashx_insert (zhashx_t *self, const void *key, void *item); + +// Update or insert item into hash table with specified key and item. If the +// key is already present, destroys old item and inserts new one. If you set +// a container item destructor, this is called on the old value. If the key +// was not already present, inserts a new item. Sets the hash cursor to the +// new item. +CZMQ_EXPORT void + zhashx_update (zhashx_t *self, const void *key, void *item); + +// Remove an item specified by key from the hash table. If there was no such +// item, this function does nothing. +CZMQ_EXPORT void + zhashx_delete (zhashx_t *self, const void *key); + +// Delete all items from the hash table. If the key destructor is +// set, calls it on every key. If the item destructor is set, calls +// it on every item. +CZMQ_EXPORT void + zhashx_purge (zhashx_t *self); + +// Return the item at the specified key, or null +CZMQ_EXPORT void * + zhashx_lookup (zhashx_t *self, const void *key); + +// Reindexes an item from an old key to a new key. If there was no such +// item, does nothing. Returns 0 if successful, else -1. +CZMQ_EXPORT int + zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); + +// Set a free function for the specified hash table item. When the item is +// destroyed, the free function, if any, is called on that item. +// Use this when hash items are dynamically allocated, to ensure that +// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. +// Returns the item, or NULL if there is no such item. +CZMQ_EXPORT void * + zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); + +// Return the number of keys/items in the hash table +CZMQ_EXPORT size_t + zhashx_size (zhashx_t *self); + +// Return a zlistx_t containing the keys for the items in the +// table. Uses the key_duplicator to duplicate all keys and sets the +// key_destructor as destructor for the list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlistx_t * + zhashx_keys (zhashx_t *self); + +// Return a zlistx_t containing the values for the items in the +// table. Uses the duplicator to duplicate all items and sets the +// destructor as destructor for the list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlistx_t * + zhashx_values (zhashx_t *self); + +// Simple iterator; returns first item in hash table, in no given order, +// or NULL if the table is empty. This method is simpler to use than the +// foreach() method, which is deprecated. To access the key for this item +// use zhashx_cursor(). NOTE: do NOT modify the table while iterating. +CZMQ_EXPORT void * + zhashx_first (zhashx_t *self); + +// Simple iterator; returns next item in hash table, in no given order, +// or NULL if the last item was already returned. Use this together with +// zhashx_first() to process all items in a hash table. If you need the +// items in sorted order, use zhashx_keys() and then zlistx_sort(). To +// access the key for this item use zhashx_cursor(). NOTE: do NOT modify +// the table while iterating. +CZMQ_EXPORT void * + zhashx_next (zhashx_t *self); + +// After a successful first/next method, returns the key for the item that +// was returned. This is a constant string that you may not modify or +// deallocate, and which lasts as long as the item in the hash. After an +// unsuccessful first/next, returns NULL. +CZMQ_EXPORT const void * + zhashx_cursor (zhashx_t *self); + +// Add a comment to hash table before saving to disk. You can add as many +// comment lines as you like. These comment lines are discarded when loading +// the file. If you use a null format, all comments are deleted. +CZMQ_EXPORT void + zhashx_comment (zhashx_t *self, const char *format, ...); + +// Save hash table to a text file in name=value format. Hash values must be +// printable strings; keys may not contain '=' character. Returns 0 if OK, +// else -1 if a file error occurred. +CZMQ_EXPORT int + zhashx_save (zhashx_t *self, const char *filename); + +// Load hash table from a text file in name=value format; hash table must +// already exist. Hash values must printable strings; keys may not contain +// '=' character. Returns 0 if OK, else -1 if a file was not readable. +CZMQ_EXPORT int + zhashx_load (zhashx_t *self, const char *filename); + +// When a hash table was loaded from a file by zhashx_load, this method will +// reload the file if it has been modified since, and is "stable", i.e. not +// still changing. Returns 0 if OK, -1 if there was an error reloading the +// file. +CZMQ_EXPORT int + zhashx_refresh (zhashx_t *self); + +// Serialize hash table to a binary frame that can be sent in a message. +// The packed format is compatible with the 'dictionary' type defined in +// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: +// +// ; A list of name/value pairs +// dictionary = dict-count *( dict-name dict-value ) +// dict-count = number-4 +// dict-value = longstr +// dict-name = string +// +// ; Strings are always length + text contents +// longstr = number-4 *VCHAR +// string = number-1 *VCHAR +// +// ; Numbers are unsigned integers in network byte order +// number-1 = 1OCTET +// number-4 = 4OCTET +// +// Comments are not included in the packed data. Item values MUST be +// strings. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zhashx_pack (zhashx_t *self); + +// Make a copy of the list; items are duplicated if you set a duplicator +// for the list, otherwise not. Copying a null reference returns a null +// reference. Note that this method's behavior changed slightly for CZMQ +// v3.x, as it does not set nor respect autofree. It does however let you +// duplicate any hash table safely. The old behavior is in zhashx_dup_v2. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zhashx_t * + zhashx_dup (zhashx_t *self); + +// Set a user-defined deallocator for hash items; by default items are not +// freed when the hash is destroyed. +CZMQ_EXPORT void + zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); + +// Set a user-defined duplicator for hash items; by default items are not +// copied when the hash is duplicated. +CZMQ_EXPORT void + zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); + +// Set a user-defined deallocator for keys; by default keys are freed +// when the hash is destroyed using free(). +CZMQ_EXPORT void + zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); + +// Set a user-defined duplicator for keys; by default keys are duplicated +// using strdup. +CZMQ_EXPORT void + zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); + +// Set a user-defined comparator for keys; by default keys are +// compared using strcmp. +CZMQ_EXPORT void + zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); + +// Set a user-defined comparator for keys; by default keys are +// compared using strcmp. +CZMQ_EXPORT void + zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); + +// Make copy of hash table; if supplied table is null, returns null. +// Does not copy items themselves. Rebuilds new table so may be slow on +// very large tables. NOTE: only works with item values that are strings +// since there's no other way to know how to duplicate the item value. +CZMQ_EXPORT zhashx_t * + zhashx_dup_v2 (zhashx_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Set hash for automatic value destruction. This method is deprecated +// and you should use set_destructor instead. +CZMQ_EXPORT void + zhashx_autofree (zhashx_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Apply function to each item in the hash table. Items are iterated in no +// defined order. Stops if callback function returns non-zero and returns +// final return code from callback function (zero = success). This method +// is deprecated and you should use zhashx_first/_next instead. +CZMQ_EXPORT int + zhashx_foreach (zhashx_t *self, zhashx_foreach_fn callback, void *argument); + +// Self test of this class. +CZMQ_EXPORT void + zhashx_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Same as unpack but uses a user-defined deserializer function to convert +// a longstr back into item format. +CZMQ_EXPORT zhashx_t * + zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); + +// *** Draft method, for development use, may change without warning *** +// Same as pack but uses a user-defined serializer function to convert items +// into longstr. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT void + zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/ziflist.h b/phonelibs/zmq/aarch64/include/ziflist.h new file mode 100644 index 00000000000000..cb2b1448025f89 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/ziflist.h @@ -0,0 +1,77 @@ +/* ========================================================================= + ziflist - List of network interfaces available on system + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZIFLIST_H_INCLUDED__ +#define __ZIFLIST_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/ziflist.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Get a list of network interfaces currently defined on the system +CZMQ_EXPORT ziflist_t * + ziflist_new (void); + +// Destroy a ziflist instance +CZMQ_EXPORT void + ziflist_destroy (ziflist_t **self_p); + +// Reload network interfaces from system +CZMQ_EXPORT void + ziflist_reload (ziflist_t *self); + +// Return the number of network interfaces on system +CZMQ_EXPORT size_t + ziflist_size (ziflist_t *self); + +// Get first network interface, return NULL if there are none +CZMQ_EXPORT const char * + ziflist_first (ziflist_t *self); + +// Get next network interface, return NULL if we hit the last one +CZMQ_EXPORT const char * + ziflist_next (ziflist_t *self); + +// Return the current interface IP address as a printable string +CZMQ_EXPORT const char * + ziflist_address (ziflist_t *self); + +// Return the current interface broadcast address as a printable string +CZMQ_EXPORT const char * + ziflist_broadcast (ziflist_t *self); + +// Return the current interface network mask as a printable string +CZMQ_EXPORT const char * + ziflist_netmask (ziflist_t *self); + +// Return the list of interfaces. +CZMQ_EXPORT void + ziflist_print (ziflist_t *self); + +// Self test of this class. +CZMQ_EXPORT void + ziflist_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zlist.h b/phonelibs/zmq/aarch64/include/zlist.h new file mode 100644 index 00000000000000..1dcd39b9955c9e --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zlist.h @@ -0,0 +1,158 @@ +/* ========================================================================= + zlist - simple generic list container + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZLIST_H_INCLUDED__ +#define __ZLIST_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zlist.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Comparison function e.g. for sorting and removing. +typedef int (zlist_compare_fn) ( + void *item1, void *item2); + +// Callback function for zlist_freefn method +typedef void (zlist_free_fn) ( + void *data); + +// Create a new list container +CZMQ_EXPORT zlist_t * + zlist_new (void); + +// Destroy a list container +CZMQ_EXPORT void + zlist_destroy (zlist_t **self_p); + +// Return the item at the head of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the head item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlist_first (zlist_t *self); + +// Return the next item. If the list is empty, returns NULL. To move to +// the start of the list call zlist_first (). Advances the cursor. +CZMQ_EXPORT void * + zlist_next (zlist_t *self); + +// Return the item at the tail of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the tail item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlist_last (zlist_t *self); + +// Return first item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlist_head (zlist_t *self); + +// Return last item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlist_tail (zlist_t *self); + +// Return the current item of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the current item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlist_item (zlist_t *self); + +// Append an item to the end of the list, return 0 if OK or -1 if this +// failed for some reason (out of memory). Note that if a duplicator has +// been set, this method will also duplicate the item. +CZMQ_EXPORT int + zlist_append (zlist_t *self, void *item); + +// Push an item to the start of the list, return 0 if OK or -1 if this +// failed for some reason (out of memory). Note that if a duplicator has +// been set, this method will also duplicate the item. +CZMQ_EXPORT int + zlist_push (zlist_t *self, void *item); + +// Pop the item off the start of the list, if any +CZMQ_EXPORT void * + zlist_pop (zlist_t *self); + +// Checks if an item already is present. Uses compare method to determine if +// items are equal. If the compare method is NULL the check will only compare +// pointers. Returns true if item is present else false. +CZMQ_EXPORT bool + zlist_exists (zlist_t *self, void *item); + +// Remove the specified item from the list if present +CZMQ_EXPORT void + zlist_remove (zlist_t *self, void *item); + +// Make a copy of list. If the list has autofree set, the copied list will +// duplicate all items, which must be strings. Otherwise, the list will hold +// pointers back to the items in the original list. If list is null, returns +// NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zlist_dup (zlist_t *self); + +// Purge all items from list +CZMQ_EXPORT void + zlist_purge (zlist_t *self); + +// Return number of items in the list +CZMQ_EXPORT size_t + zlist_size (zlist_t *self); + +// Sort the list. If the compare function is null, sorts the list by +// ascending key value using a straight ASCII comparison. If you specify +// a compare function, this decides how items are sorted. The sort is not +// stable, so may reorder items with the same keys. The algorithm used is +// combsort, a compromise between performance and simplicity. +CZMQ_EXPORT void + zlist_sort (zlist_t *self, zlist_compare_fn compare); + +// Set list for automatic item destruction; item values MUST be strings. +// By default a list item refers to a value held elsewhere. When you set +// this, each time you append or push a list item, zlist will take a copy +// of the string value. Then, when you destroy the list, it will free all +// item values automatically. If you use any other technique to allocate +// list values, you must free them explicitly before destroying the list. +// The usual technique is to pop list items and destroy them, until the +// list is empty. +CZMQ_EXPORT void + zlist_autofree (zlist_t *self); + +// Sets a compare function for this list. The function compares two items. +// It returns an integer less than, equal to, or greater than zero if the +// first item is found, respectively, to be less than, to match, or be +// greater than the second item. +// This function is used for sorting, removal and exists checking. +CZMQ_EXPORT void + zlist_comparefn (zlist_t *self, zlist_compare_fn fn); + +// Set a free function for the specified list item. When the item is +// destroyed, the free function, if any, is called on that item. +// Use this when list items are dynamically allocated, to ensure that +// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. +// Returns the item, or NULL if there is no such item. +CZMQ_EXPORT void * + zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); + +// Self test of this class. +CZMQ_EXPORT void + zlist_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zlistx.h b/phonelibs/zmq/aarch64/include/zlistx.h new file mode 100644 index 00000000000000..512637cef3bff5 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zlistx.h @@ -0,0 +1,205 @@ +/* ========================================================================= + zlistx - extended generic list container + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZLISTX_H_INCLUDED__ +#define __ZLISTX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zlistx.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Destroy an item +typedef void (zlistx_destructor_fn) ( + void **item); + +// Duplicate an item +typedef void * (zlistx_duplicator_fn) ( + const void *item); + +// Compare two items, for sorting +typedef int (zlistx_comparator_fn) ( + const void *item1, const void *item2); + +// Create a new, empty list. +CZMQ_EXPORT zlistx_t * + zlistx_new (void); + +// Destroy a list. If an item destructor was specified, all items in the +// list are automatically destroyed as well. +CZMQ_EXPORT void + zlistx_destroy (zlistx_t **self_p); + +// Add an item to the head of the list. Calls the item duplicator, if any, +// on the item. Resets cursor to list head. Returns an item handle on +// success, NULL if memory was exhausted. +CZMQ_EXPORT void * + zlistx_add_start (zlistx_t *self, void *item); + +// Add an item to the tail of the list. Calls the item duplicator, if any, +// on the item. Resets cursor to list head. Returns an item handle on +// success, NULL if memory was exhausted. +CZMQ_EXPORT void * + zlistx_add_end (zlistx_t *self, void *item); + +// Return the number of items in the list +CZMQ_EXPORT size_t + zlistx_size (zlistx_t *self); + +// Return first item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlistx_head (zlistx_t *self); + +// Return last item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlistx_tail (zlistx_t *self); + +// Return the item at the head of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the head item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlistx_first (zlistx_t *self); + +// Return the next item. At the end of the list (or in an empty list), +// returns NULL. Use repeated zlistx_next () calls to work through the list +// from zlistx_first (). First time, acts as zlistx_first(). +CZMQ_EXPORT void * + zlistx_next (zlistx_t *self); + +// Return the previous item. At the start of the list (or in an empty list), +// returns NULL. Use repeated zlistx_prev () calls to work through the list +// backwards from zlistx_last (). First time, acts as zlistx_last(). +CZMQ_EXPORT void * + zlistx_prev (zlistx_t *self); + +// Return the item at the tail of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the tail item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlistx_last (zlistx_t *self); + +// Returns the value of the item at the cursor, or NULL if the cursor is +// not pointing to an item. +CZMQ_EXPORT void * + zlistx_item (zlistx_t *self); + +// Returns the handle of the item at the cursor, or NULL if the cursor is +// not pointing to an item. +CZMQ_EXPORT void * + zlistx_cursor (zlistx_t *self); + +// Returns the item associated with the given list handle, or NULL if passed +// in handle is NULL. Asserts that the passed in handle points to a list element. +CZMQ_EXPORT void * + zlistx_handle_item (void *handle); + +// Find an item in the list, searching from the start. Uses the item +// comparator, if any, else compares item values directly. Returns the +// item handle found, or NULL. Sets the cursor to the found item, if any. +CZMQ_EXPORT void * + zlistx_find (zlistx_t *self, void *item); + +// Detach an item from the list, using its handle. The item is not modified, +// and the caller is responsible for destroying it if necessary. If handle is +// null, detaches the first item on the list. Returns item that was detached, +// or null if none was. If cursor was at item, moves cursor to previous item, +// so you can detach items while iterating forwards through a list. +CZMQ_EXPORT void * + zlistx_detach (zlistx_t *self, void *handle); + +// Detach item at the cursor, if any, from the list. The item is not modified, +// and the caller is responsible for destroying it as necessary. Returns item +// that was detached, or null if none was. Moves cursor to previous item, so +// you can detach items while iterating forwards through a list. +CZMQ_EXPORT void * + zlistx_detach_cur (zlistx_t *self); + +// Delete an item, using its handle. Calls the item destructor is any is +// set. If handle is null, deletes the first item on the list. Returns 0 +// if an item was deleted, -1 if not. If cursor was at item, moves cursor +// to previous item, so you can delete items while iterating forwards +// through a list. +CZMQ_EXPORT int + zlistx_delete (zlistx_t *self, void *handle); + +// Move an item to the start of the list, via its handle. +CZMQ_EXPORT void + zlistx_move_start (zlistx_t *self, void *handle); + +// Move an item to the end of the list, via its handle. +CZMQ_EXPORT void + zlistx_move_end (zlistx_t *self, void *handle); + +// Remove all items from the list, and destroy them if the item destructor +// is set. +CZMQ_EXPORT void + zlistx_purge (zlistx_t *self); + +// Sort the list. If an item comparator was set, calls that to compare +// items, otherwise compares on item value. The sort is not stable, so may +// reorder equal items. +CZMQ_EXPORT void + zlistx_sort (zlistx_t *self); + +// Create a new node and insert it into a sorted list. Calls the item +// duplicator, if any, on the item. If low_value is true, starts searching +// from the start of the list, otherwise searches from the end. Use the item +// comparator, if any, to find where to place the new node. Returns a handle +// to the new node, or NULL if memory was exhausted. Resets the cursor to the +// list head. +CZMQ_EXPORT void * + zlistx_insert (zlistx_t *self, void *item, bool low_value); + +// Move an item, specified by handle, into position in a sorted list. Uses +// the item comparator, if any, to determine the new location. If low_value +// is true, starts searching from the start of the list, otherwise searches +// from the end. +CZMQ_EXPORT void + zlistx_reorder (zlistx_t *self, void *handle, bool low_value); + +// Make a copy of the list; items are duplicated if you set a duplicator +// for the list, otherwise not. Copying a null reference returns a null +// reference. +CZMQ_EXPORT zlistx_t * + zlistx_dup (zlistx_t *self); + +// Set a user-defined deallocator for list items; by default items are not +// freed when the list is destroyed. +CZMQ_EXPORT void + zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); + +// Set a user-defined duplicator for list items; by default items are not +// copied when the list is duplicated. +CZMQ_EXPORT void + zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); + +// Set a user-defined comparator for zlistx_find and zlistx_sort; the method +// must return -1, 0, or 1 depending on whether item1 is less than, equal to, +// or greater than, item2. +CZMQ_EXPORT void + zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); + +// Self test of this class. +CZMQ_EXPORT void + zlistx_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zloop.h b/phonelibs/zmq/aarch64/include/zloop.h new file mode 100644 index 00000000000000..bc58ea0530e7b3 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zloop.h @@ -0,0 +1,168 @@ +/* ========================================================================= + zloop - event-driven reactor + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZLOOP_H_INCLUDED__ +#define __ZLOOP_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zloop.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Callback function for reactor socket activity +typedef int (zloop_reader_fn) ( + zloop_t *loop, zsock_t *reader, void *arg); + +// Callback function for reactor events (low-level) +typedef int (zloop_fn) ( + zloop_t *loop, zmq_pollitem_t *item, void *arg); + +// Callback for reactor timer events +typedef int (zloop_timer_fn) ( + zloop_t *loop, int timer_id, void *arg); + +// Create a new zloop reactor +CZMQ_EXPORT zloop_t * + zloop_new (void); + +// Destroy a reactor +CZMQ_EXPORT void + zloop_destroy (zloop_t **self_p); + +// Register socket reader with the reactor. When the reader has messages, +// the reactor will call the handler, passing the arg. Returns 0 if OK, -1 +// if there was an error. If you register the same socket more than once, +// each instance will invoke its corresponding handler. +CZMQ_EXPORT int + zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); + +// Cancel a socket reader from the reactor. If multiple readers exist for +// same socket, cancels ALL of them. +CZMQ_EXPORT void + zloop_reader_end (zloop_t *self, zsock_t *sock); + +// Configure a registered reader to ignore errors. If you do not set this, +// then readers that have errors are removed from the reactor silently. +CZMQ_EXPORT void + zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); + +// Register low-level libzmq pollitem with the reactor. When the pollitem +// is ready, will call the handler, passing the arg. Returns 0 if OK, -1 +// if there was an error. If you register the pollitem more than once, each +// instance will invoke its corresponding handler. A pollitem with +// socket=NULL and fd=0 means 'poll on FD zero'. +CZMQ_EXPORT int + zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); + +// Cancel a pollitem from the reactor, specified by socket or FD. If both +// are specified, uses only socket. If multiple poll items exist for same +// socket/FD, cancels ALL of them. +CZMQ_EXPORT void + zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); + +// Configure a registered poller to ignore errors. If you do not set this, +// then poller that have errors are removed from the reactor silently. +CZMQ_EXPORT void + zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); + +// Register a timer that expires after some delay and repeats some number of +// times. At each expiry, will call the handler, passing the arg. To run a +// timer forever, use 0 times. Returns a timer_id that is used to cancel the +// timer in the future. Returns -1 if there was an error. +CZMQ_EXPORT int + zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); + +// Cancel a specific timer identified by a specific timer_id (as returned by +// zloop_timer). +CZMQ_EXPORT int + zloop_timer_end (zloop_t *self, int timer_id); + +// Register a ticket timer. Ticket timers are very fast in the case where +// you use a lot of timers (thousands), and frequently remove and add them. +// The main use case is expiry timers for servers that handle many clients, +// and which reset the expiry timer for each message received from a client. +// Whereas normal timers perform poorly as the number of clients grows, the +// cost of ticket timers is constant, no matter the number of clients. You +// must set the ticket delay using zloop_set_ticket_delay before creating a +// ticket. Returns a handle to the timer that you should use in +// zloop_ticket_reset and zloop_ticket_delete. +CZMQ_EXPORT void * + zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); + +// Reset a ticket timer, which moves it to the end of the ticket list and +// resets its execution time. This is a very fast operation. +CZMQ_EXPORT void + zloop_ticket_reset (zloop_t *self, void *handle); + +// Delete a ticket timer. We do not actually delete the ticket here, as +// other code may still refer to the ticket. We mark as deleted, and remove +// later and safely. +CZMQ_EXPORT void + zloop_ticket_delete (zloop_t *self, void *handle); + +// Set the ticket delay, which applies to all tickets. If you lower the +// delay and there are already tickets created, the results are undefined. +CZMQ_EXPORT void + zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); + +// Set hard limit on number of timers allowed. Setting more than a small +// number of timers (10-100) can have a dramatic impact on the performance +// of the reactor. For high-volume cases, use ticket timers. If the hard +// limit is reached, the reactor stops creating new timers and logs an +// error. +CZMQ_EXPORT void + zloop_set_max_timers (zloop_t *self, size_t max_timers); + +// Set verbose tracing of reactor on/off. The default verbose setting is +// off (false). +CZMQ_EXPORT void + zloop_set_verbose (zloop_t *self, bool verbose); + +// Start the reactor. Takes control of the thread and returns when the 0MQ +// context is terminated or the process is interrupted, or any event handler +// returns -1. Event handlers may register new sockets and timers, and +// cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. +CZMQ_EXPORT int + zloop_start (zloop_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zloop_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// By default the reactor stops if the process receives a SIGINT or SIGTERM +// signal. This makes it impossible to shut-down message based architectures +// like zactors. This method lets you switch off break handling. The default +// nonstop setting is off (false). +CZMQ_EXPORT void + zloop_set_nonstop (zloop_t *self, bool nonstop); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +// Deprecated method aliases +#define zloop_set_tolerant(s,i) zloop_poller_set_tolerant(s,i) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zmonitor.h b/phonelibs/zmq/aarch64/include/zmonitor.h new file mode 100644 index 00000000000000..b490bcb1a0dfbc --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zmonitor.h @@ -0,0 +1,73 @@ +/* ========================================================================= + zmonitor - socket event monitor + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMONITOR_H_INCLUDED__ +#define __ZMONITOR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create new zmonitor actor instance to monitor a zsock_t socket: +// +// zactor_t *monitor = zactor_new (zmonitor, mysocket); +// +// Destroy zmonitor instance. +// +// zactor_destroy (&monitor); +// +// Enable verbose logging of commands and activity. +// +// zstr_send (monitor, "VERBOSE"); +// +// Listen to monitor event type (zero or types, ending in NULL): +// zstr_sendx (monitor, "LISTEN", type, ..., NULL); +// +// Events: +// CONNECTED +// CONNECT_DELAYED +// CONNECT_RETRIED +// LISTENING +// BIND_FAILED +// ACCEPTED +// ACCEPT_FAILED +// CLOSED +// CLOSE_FAILED +// DISCONNECTED +// MONITOR_STOPPED +// ALL +// +// Start monitor; after this, any further LISTEN commands are ignored. +// +// zstr_send (monitor, "START"); +// zsock_wait (monitor); +// +// Receive next monitor event: +// +// zmsg_t *msg = zmsg_recv (monitor); +// +// This is the zmonitor constructor as a zactor_fn; the argument can be +// a zactor_t, zsock_t, or libzmq void * socket: +CZMQ_EXPORT void + zmonitor (zsock_t *pipe, void *sock); + +// Selftest +CZMQ_EXPORT void + zmonitor_test (bool verbose); +// @end +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zmonitor_v2.h b/phonelibs/zmq/aarch64/include/zmonitor_v2.h new file mode 100644 index 00000000000000..5780e0bcb785ae --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zmonitor_v2.h @@ -0,0 +1,56 @@ +/* ========================================================================= + zmonitor_v2 - socket event monitor (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMONITOR_V2_H_INCLUDED__ +#define __ZMONITOR_V2_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// This code needs backporting to work with ZMQ v3.2 +#if (ZMQ_VERSION_MAJOR == 4) + +// Create a new socket monitor +CZMQ_EXPORT zmonitor_t * + zmonitor_new (zctx_t *ctx, void *socket, int events); + +// Destroy a socket monitor +CZMQ_EXPORT void + zmonitor_destroy (zmonitor_t **self_p); + +// Receive a status message from the monitor; if no message arrives within +// 500 msec, or the call was interrupted, returns NULL. +CZMQ_EXPORT zmsg_t * + zmonitor_recv (zmonitor_t *self); + +// Get the ZeroMQ socket, for polling +CZMQ_EXPORT void * + zmonitor_socket (zmonitor_t *self); + +// Enable verbose tracing of commands and activity +CZMQ_EXPORT void + zmonitor_set_verbose (zmonitor_t *self, bool verbose); +#endif // ZeroMQ 4.0 or later + +// Self test of this class +CZMQ_EXPORT void + zmonitor_v2_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zmq.h b/phonelibs/zmq/aarch64/include/zmq.h new file mode 100644 index 00000000000000..5f35d1915fcd92 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zmq.h @@ -0,0 +1,617 @@ +/* + Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file + + This file is part of libzmq, the ZeroMQ core engine in C++. + + libzmq is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + As a special exception, the Contributors give you permission to link + this library with independent modules to produce an executable, + regardless of the license terms of these independent modules, and to + copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the + terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. + If you modify this library, you must extend this exception to your + version of the library. + + libzmq 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 program. If not, see . + + ************************************************************************* + NOTE to contributors. This file comprises the principal public contract + for ZeroMQ API users. Any change to this file supplied in a stable + release SHOULD not break existing applications. + In practice this means that the value of constants must not change, and + that old values may not be reused for new constants. + ************************************************************************* +*/ + +#ifndef __ZMQ_H_INCLUDED__ +#define __ZMQ_H_INCLUDED__ + +/* Version macros for compile-time API version detection */ +#define ZMQ_VERSION_MAJOR 4 +#define ZMQ_VERSION_MINOR 2 +#define ZMQ_VERSION_PATCH 0 + +#define ZMQ_MAKE_VERSION(major, minor, patch) \ + ((major) * 10000 + (minor) * 100 + (patch)) +#define ZMQ_VERSION \ + ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined _WIN32_WCE +#include +#endif +#include +#include +#if defined _WIN32 +// Set target version to Windows Server 2008, Windows Vista or higher. +// Windows XP (0x0501) is supported but without client & server socket types. +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif + +#ifdef __MINGW32__ +// Require Windows XP or higher with MinGW for getaddrinfo(). +#if(_WIN32_WINNT >= 0x0600) +#else +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#endif +#include +#endif + +/* Handle DSO symbol visibility */ +#if defined _WIN32 +# if defined ZMQ_STATIC +# define ZMQ_EXPORT +# elif defined DLL_EXPORT +# define ZMQ_EXPORT __declspec(dllexport) +# else +# define ZMQ_EXPORT __declspec(dllimport) +# endif +#else +# if defined __SUNPRO_C || defined __SUNPRO_CC +# define ZMQ_EXPORT __global +# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER +# define ZMQ_EXPORT __attribute__ ((visibility("default"))) +# else +# define ZMQ_EXPORT +# endif +#endif + +/* Define integer types needed for event interface */ +#define ZMQ_DEFINED_STDINT 1 +#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS +# include +#elif defined _MSC_VER && _MSC_VER < 1600 +# ifndef int32_t + typedef __int32 int32_t; +# endif +# ifndef uint16_t + typedef unsigned __int16 uint16_t; +# endif +# ifndef uint8_t + typedef unsigned __int8 uint8_t; +# endif +#else +# include +#endif + + +/******************************************************************************/ +/* 0MQ errors. */ +/******************************************************************************/ + +/* A number random enough not to collide with different errno ranges on */ +/* different OSes. The assumption is that error_t is at least 32-bit type. */ +#define ZMQ_HAUSNUMERO 156384712 + +/* On Windows platform some of the standard POSIX errnos are not defined. */ +#ifndef ENOTSUP +#define ENOTSUP (ZMQ_HAUSNUMERO + 1) +#endif +#ifndef EPROTONOSUPPORT +#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) +#endif +#ifndef ENOBUFS +#define ENOBUFS (ZMQ_HAUSNUMERO + 3) +#endif +#ifndef ENETDOWN +#define ENETDOWN (ZMQ_HAUSNUMERO + 4) +#endif +#ifndef EADDRINUSE +#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) +#endif +#ifndef EADDRNOTAVAIL +#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) +#endif +#ifndef ECONNREFUSED +#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) +#endif +#ifndef EINPROGRESS +#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) +#endif +#ifndef ENOTSOCK +#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) +#endif +#ifndef EMSGSIZE +#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) +#endif +#ifndef EAFNOSUPPORT +#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) +#endif +#ifndef ENETUNREACH +#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) +#endif +#ifndef ECONNABORTED +#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) +#endif +#ifndef ECONNRESET +#define ECONNRESET (ZMQ_HAUSNUMERO + 14) +#endif +#ifndef ENOTCONN +#define ENOTCONN (ZMQ_HAUSNUMERO + 15) +#endif +#ifndef ETIMEDOUT +#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) +#endif +#ifndef EHOSTUNREACH +#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) +#endif +#ifndef ENETRESET +#define ENETRESET (ZMQ_HAUSNUMERO + 18) +#endif + +/* Native 0MQ error codes. */ +#define EFSM (ZMQ_HAUSNUMERO + 51) +#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) +#define ETERM (ZMQ_HAUSNUMERO + 53) +#define EMTHREAD (ZMQ_HAUSNUMERO + 54) + +/* This function retrieves the errno as it is known to 0MQ library. The goal */ +/* of this function is to make the code 100% portable, including where 0MQ */ +/* compiled with certain CRT library (on Windows) is linked to an */ +/* application that uses different CRT library. */ +ZMQ_EXPORT int zmq_errno (void); + +/* Resolves system errors and 0MQ errors to human-readable string. */ +ZMQ_EXPORT const char *zmq_strerror (int errnum); + +/* Run-time API version detection */ +ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); + +/******************************************************************************/ +/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ +/******************************************************************************/ + +/* Context options */ +#define ZMQ_IO_THREADS 1 +#define ZMQ_MAX_SOCKETS 2 +#define ZMQ_SOCKET_LIMIT 3 +#define ZMQ_THREAD_PRIORITY 3 +#define ZMQ_THREAD_SCHED_POLICY 4 +#define ZMQ_MAX_MSGSZ 5 + +/* Default for new contexts */ +#define ZMQ_IO_THREADS_DFLT 1 +#define ZMQ_MAX_SOCKETS_DFLT 1023 +#define ZMQ_THREAD_PRIORITY_DFLT -1 +#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 + +ZMQ_EXPORT void *zmq_ctx_new (void); +ZMQ_EXPORT int zmq_ctx_term (void *context); +ZMQ_EXPORT int zmq_ctx_shutdown (void *context); +ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); +ZMQ_EXPORT int zmq_ctx_get (void *context, int option); + +/* Old (legacy) API */ +ZMQ_EXPORT void *zmq_init (int io_threads); +ZMQ_EXPORT int zmq_term (void *context); +ZMQ_EXPORT int zmq_ctx_destroy (void *context); + + +/******************************************************************************/ +/* 0MQ message definition. */ +/******************************************************************************/ + +/* union here ensures correct alignment on architectures that require it, e.g. + * SPARC + */ +typedef union zmq_msg_t {unsigned char _ [64]; void *p; } zmq_msg_t; + +typedef void (zmq_free_fn) (void *data, void *hint); + +ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); +ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, + size_t size, zmq_free_fn *ffn, void *hint); +ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); +ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); +ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); +ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); +ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); +ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); +ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); +ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); + +/******************************************************************************/ +/* 0MQ socket definition. */ +/******************************************************************************/ + +/* Socket types. */ +#define ZMQ_PAIR 0 +#define ZMQ_PUB 1 +#define ZMQ_SUB 2 +#define ZMQ_REQ 3 +#define ZMQ_REP 4 +#define ZMQ_DEALER 5 +#define ZMQ_ROUTER 6 +#define ZMQ_PULL 7 +#define ZMQ_PUSH 8 +#define ZMQ_XPUB 9 +#define ZMQ_XSUB 10 +#define ZMQ_STREAM 11 + +/* Deprecated aliases */ +#define ZMQ_XREQ ZMQ_DEALER +#define ZMQ_XREP ZMQ_ROUTER + +/* Socket options. */ +#define ZMQ_AFFINITY 4 +#define ZMQ_IDENTITY 5 +#define ZMQ_SUBSCRIBE 6 +#define ZMQ_UNSUBSCRIBE 7 +#define ZMQ_RATE 8 +#define ZMQ_RECOVERY_IVL 9 +#define ZMQ_SNDBUF 11 +#define ZMQ_RCVBUF 12 +#define ZMQ_RCVMORE 13 +#define ZMQ_FD 14 +#define ZMQ_EVENTS 15 +#define ZMQ_TYPE 16 +#define ZMQ_LINGER 17 +#define ZMQ_RECONNECT_IVL 18 +#define ZMQ_BACKLOG 19 +#define ZMQ_RECONNECT_IVL_MAX 21 +#define ZMQ_MAXMSGSIZE 22 +#define ZMQ_SNDHWM 23 +#define ZMQ_RCVHWM 24 +#define ZMQ_MULTICAST_HOPS 25 +#define ZMQ_RCVTIMEO 27 +#define ZMQ_SNDTIMEO 28 +#define ZMQ_LAST_ENDPOINT 32 +#define ZMQ_ROUTER_MANDATORY 33 +#define ZMQ_TCP_KEEPALIVE 34 +#define ZMQ_TCP_KEEPALIVE_CNT 35 +#define ZMQ_TCP_KEEPALIVE_IDLE 36 +#define ZMQ_TCP_KEEPALIVE_INTVL 37 +#define ZMQ_IMMEDIATE 39 +#define ZMQ_XPUB_VERBOSE 40 +#define ZMQ_ROUTER_RAW 41 +#define ZMQ_IPV6 42 +#define ZMQ_MECHANISM 43 +#define ZMQ_PLAIN_SERVER 44 +#define ZMQ_PLAIN_USERNAME 45 +#define ZMQ_PLAIN_PASSWORD 46 +#define ZMQ_CURVE_SERVER 47 +#define ZMQ_CURVE_PUBLICKEY 48 +#define ZMQ_CURVE_SECRETKEY 49 +#define ZMQ_CURVE_SERVERKEY 50 +#define ZMQ_PROBE_ROUTER 51 +#define ZMQ_REQ_CORRELATE 52 +#define ZMQ_REQ_RELAXED 53 +#define ZMQ_CONFLATE 54 +#define ZMQ_ZAP_DOMAIN 55 +#define ZMQ_ROUTER_HANDOVER 56 +#define ZMQ_TOS 57 +#define ZMQ_CONNECT_RID 61 +#define ZMQ_GSSAPI_SERVER 62 +#define ZMQ_GSSAPI_PRINCIPAL 63 +#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 +#define ZMQ_GSSAPI_PLAINTEXT 65 +#define ZMQ_HANDSHAKE_IVL 66 +#define ZMQ_SOCKS_PROXY 68 +#define ZMQ_XPUB_NODROP 69 +// All options after this is for version 4.2 and still *draft* +// Subject to arbitrary change without notice +#define ZMQ_BLOCKY 70 +#define ZMQ_XPUB_MANUAL 71 +#define ZMQ_XPUB_WELCOME_MSG 72 +#define ZMQ_STREAM_NOTIFY 73 +#define ZMQ_INVERT_MATCHING 74 +#define ZMQ_HEARTBEAT_IVL 75 +#define ZMQ_HEARTBEAT_TTL 76 +#define ZMQ_HEARTBEAT_TIMEOUT 77 +#define ZMQ_XPUB_VERBOSER 78 +#define ZMQ_CONNECT_TIMEOUT 79 +#define ZMQ_TCP_MAXRT 80 +#define ZMQ_THREAD_SAFE 81 +#define ZMQ_MULTICAST_MAXTPDU 84 +#define ZMQ_VMCI_BUFFER_SIZE 85 +#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 +#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 +#define ZMQ_VMCI_CONNECT_TIMEOUT 88 +#define ZMQ_USE_FD 89 + +/* Message options */ +#define ZMQ_MORE 1 +#define ZMQ_SHARED 3 + +/* Send/recv options. */ +#define ZMQ_DONTWAIT 1 +#define ZMQ_SNDMORE 2 + +/* Security mechanisms */ +#define ZMQ_NULL 0 +#define ZMQ_PLAIN 1 +#define ZMQ_CURVE 2 +#define ZMQ_GSSAPI 3 + +/* RADIO-DISH protocol */ +#define ZMQ_GROUP_MAX_LENGTH 15 + +/* Deprecated options and aliases */ +#define ZMQ_TCP_ACCEPT_FILTER 38 +#define ZMQ_IPC_FILTER_PID 58 +#define ZMQ_IPC_FILTER_UID 59 +#define ZMQ_IPC_FILTER_GID 60 +#define ZMQ_IPV4ONLY 31 +#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE +#define ZMQ_NOBLOCK ZMQ_DONTWAIT +#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY +#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY + +/* Deprecated Message options */ +#define ZMQ_SRCFD 2 + +/******************************************************************************/ +/* 0MQ socket events and monitoring */ +/******************************************************************************/ + +/* Socket transport events (TCP, IPC and TIPC only) */ + +#define ZMQ_EVENT_CONNECTED 0x0001 +#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 +#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 +#define ZMQ_EVENT_LISTENING 0x0008 +#define ZMQ_EVENT_BIND_FAILED 0x0010 +#define ZMQ_EVENT_ACCEPTED 0x0020 +#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 +#define ZMQ_EVENT_CLOSED 0x0080 +#define ZMQ_EVENT_CLOSE_FAILED 0x0100 +#define ZMQ_EVENT_DISCONNECTED 0x0200 +#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 +#define ZMQ_EVENT_ALL 0xFFFF + +ZMQ_EXPORT void *zmq_socket (void *, int type); +ZMQ_EXPORT int zmq_close (void *s); +ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, + size_t optvallen); +ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, + size_t *optvallen); +ZMQ_EXPORT int zmq_bind (void *s, const char *addr); +ZMQ_EXPORT int zmq_connect (void *s, const char *addr); +ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); +ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); +ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); + + +/******************************************************************************/ +/* I/O multiplexing. */ +/******************************************************************************/ + +#define ZMQ_POLLIN 1 +#define ZMQ_POLLOUT 2 +#define ZMQ_POLLERR 4 +#define ZMQ_POLLPRI 8 + +typedef struct zmq_pollitem_t +{ + void *socket; +#if defined _WIN32 + SOCKET fd; +#else + int fd; +#endif + short events; + short revents; +} zmq_pollitem_t; + +#define ZMQ_POLLITEMS_DFLT 16 + +ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); + +/******************************************************************************/ +/* Message proxying */ +/******************************************************************************/ + +ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); +ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); + +/******************************************************************************/ +/* Probe library capabilities */ +/******************************************************************************/ + +#define ZMQ_HAS_CAPABILITIES 1 +ZMQ_EXPORT int zmq_has (const char *capability); + +/* Deprecated aliases */ +#define ZMQ_STREAMER 1 +#define ZMQ_FORWARDER 2 +#define ZMQ_QUEUE 3 + +/* Deprecated methods */ +ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); +ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); +ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); +struct iovec; +ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); +ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); + +/******************************************************************************/ +/* Encryption functions */ +/******************************************************************************/ + +/* Encode data with Z85 encoding. Returns encoded data */ +ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); + +/* Decode data with Z85 encoding. Returns decoded data */ +ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); + +/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ +/* Returns 0 on success. */ +ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); + +/* Derive the z85-encoded public key from the z85-encoded secret key. */ +/* Returns 0 on success. */ +ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); + +/******************************************************************************/ +/* Atomic utility methods */ +/******************************************************************************/ + +ZMQ_EXPORT void *zmq_atomic_counter_new (void); +ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); +ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); +ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); +ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); +ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); + + +/******************************************************************************/ +/* These functions are not documented by man pages -- use at your own risk. */ +/* If you need these to be part of the formal ZMQ API, then (a) write a man */ +/* page, and (b) write a test case in tests. */ +/******************************************************************************/ + +/* Helper functions are used by perf tests so that they don't have to care */ +/* about minutiae of time-related functions on different OS platforms. */ + +/* Starts the stopwatch. Returns the handle to the watch. */ +ZMQ_EXPORT void *zmq_stopwatch_start (void); + +/* Stops the stopwatch. Returns the number of microseconds elapsed since */ +/* the stopwatch was started. */ +ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); + +/* Sleeps for specified number of seconds. */ +ZMQ_EXPORT void zmq_sleep (int seconds_); + +typedef void (zmq_thread_fn) (void*); + +/* Start a thread. Returns a handle to the thread. */ +ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); + +/* Wait for thread to complete then free up resources. */ +ZMQ_EXPORT void zmq_threadclose (void* thread); + + +/******************************************************************************/ +/* These functions are DRAFT and disabled in stable releases, and subject to */ +/* change at ANY time until declared stable. */ +/******************************************************************************/ + +#ifdef ZMQ_BUILD_DRAFT_API + +/* DRAFT Socket types. */ +#define ZMQ_SERVER 12 +#define ZMQ_CLIENT 13 +#define ZMQ_RADIO 14 +#define ZMQ_DISH 15 +#define ZMQ_GATHER 16 +#define ZMQ_SCATTER 17 +#define ZMQ_DGRAM 18 + +/* DRAFT Socket methods. */ +ZMQ_EXPORT int zmq_join (void *s, const char *group); +ZMQ_EXPORT int zmq_leave (void *s, const char *group); + +/* DRAFT Msg methods. */ +ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); +ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); +ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg); + +/******************************************************************************/ +/* Poller polling on sockets,fd and thread-safe sockets */ +/******************************************************************************/ + +#define ZMQ_HAVE_POLLER + +typedef struct zmq_poller_event_t +{ + void *socket; +#if defined _WIN32 + SOCKET fd; +#else + int fd; +#endif + void *user_data; + short events; +} zmq_poller_event_t; + +ZMQ_EXPORT void *zmq_poller_new (void); +ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); +ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); +ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); +ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); + +#if defined _WIN32 +ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); +ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); +#else +ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); +ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); +#endif + +/******************************************************************************/ +/* Scheduling timers */ +/******************************************************************************/ + +#define ZMQ_HAVE_TIMERS + +typedef void (zmq_timer_fn)(int timer_id, void *arg); + +ZMQ_EXPORT void *zmq_timers_new (void); +ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); +ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); +ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); +ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); +ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); +ZMQ_EXPORT long zmq_timers_timeout (void *timers); +ZMQ_EXPORT int zmq_timers_execute (void *timers); + +#endif // ZMQ_BUILD_DRAFT_API + + +#undef ZMQ_EXPORT + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zmq_utils.h b/phonelibs/zmq/aarch64/include/zmq_utils.h new file mode 100644 index 00000000000000..f29638d5539414 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zmq_utils.h @@ -0,0 +1,48 @@ +/* + Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file + + This file is part of libzmq, the ZeroMQ core engine in C++. + + libzmq is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + As a special exception, the Contributors give you permission to link + this library with independent modules to produce an executable, + regardless of the license terms of these independent modules, and to + copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the + terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. + If you modify this library, you must extend this exception to your + version of the library. + + libzmq 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 program. If not, see . +*/ + +/* This file is deprecated, and all its functionality provided by zmq.h */ +/* Note that -Wpedantic compilation requires GCC to avoid using its custom + extensions such as #warning, hence the trick below. Also, pragmas for + warnings or other messages are not standard, not portable, and not all + compilers even have an equivalent concept. + So in the worst case, this include file is treated as silently empty. */ + +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) +#if defined(__GNUC__) || defined(__GNUG__) +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wcpp" +#pragma GCC diagnostic ignored "-Werror" +#pragma GCC diagnostic ignored "-Wall" +#endif +#pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") +#if defined(__GNUC__) || defined(__GNUG__) +#pragma GCC diagnostic pop +#endif +#endif diff --git a/phonelibs/zmq/aarch64/include/zmsg.h b/phonelibs/zmq/aarch64/include/zmsg.h new file mode 100644 index 00000000000000..c6ab16c66e953c --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zmsg.h @@ -0,0 +1,285 @@ +/* ========================================================================= + zmsg - working with multipart messages + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMSG_H_INCLUDED__ +#define __ZMSG_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zmsg.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create a new empty message object +CZMQ_EXPORT zmsg_t * + zmsg_new (void); + +// Receive message from socket, returns zmsg_t object or NULL if the recv +// was interrupted. Does a blocking recv. If you want to not block then use +// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input +// before receiving. +CZMQ_EXPORT zmsg_t * + zmsg_recv (void *source); + +// Load/append an open file into new message, return the message. +// Returns NULL if the message could not be loaded. +CZMQ_EXPORT zmsg_t * + zmsg_load (FILE *file); + +// Decodes a serialized message frame created by zmsg_encode () and returns +// a new zmsg_t object. Returns NULL if the frame was badly formatted or +// there was insufficient memory to work. +CZMQ_EXPORT zmsg_t * + zmsg_decode (zframe_t *frame); + +// Generate a signal message encoding the given status. A signal is a short +// message carrying a 1-byte success/failure code (by convention, 0 means +// OK). Signals are encoded to be distinguishable from "normal" messages. +CZMQ_EXPORT zmsg_t * + zmsg_new_signal (byte status); + +// Destroy a message object and all frames it contains +CZMQ_EXPORT void + zmsg_destroy (zmsg_t **self_p); + +// Send message to destination socket, and destroy the message after sending +// it successfully. If the message has no frames, sends nothing but destroys +// the message anyhow. Nullifies the caller's reference to the message (as +// it is a destructor). +CZMQ_EXPORT int + zmsg_send (zmsg_t **self_p, void *dest); + +// Send message to destination socket as part of a multipart sequence, and +// destroy the message after sending it successfully. Note that after a +// zmsg_sendm, you must call zmsg_send or another method that sends a final +// message part. If the message has no frames, sends nothing but destroys +// the message anyhow. Nullifies the caller's reference to the message (as +// it is a destructor). +CZMQ_EXPORT int + zmsg_sendm (zmsg_t **self_p, void *dest); + +// Return size of message, i.e. number of frames (0 or more). +CZMQ_EXPORT size_t + zmsg_size (zmsg_t *self); + +// Return total size of all frames in message. +CZMQ_EXPORT size_t + zmsg_content_size (zmsg_t *self); + +// Push frame to the front of the message, i.e. before all other frames. +// Message takes ownership of frame, will destroy it when message is sent. +// Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not +// nullify the caller's frame reference. +CZMQ_EXPORT int + zmsg_prepend (zmsg_t *self, zframe_t **frame_p); + +// Add frame to the end of the message, i.e. after all other frames. +// Message takes ownership of frame, will destroy it when message is sent. +// Returns 0 on success. Deprecates zmsg_add, which did not nullify the +// caller's frame reference. +CZMQ_EXPORT int + zmsg_append (zmsg_t *self, zframe_t **frame_p); + +// Remove first frame from message, if any. Returns frame, or NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zmsg_pop (zmsg_t *self); + +// Push block of memory to front of message, as a new frame. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_pushmem (zmsg_t *self, const void *data, size_t size); + +// Add block of memory to the end of the message, as a new frame. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_addmem (zmsg_t *self, const void *data, size_t size); + +// Push string as new frame to front of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_pushstr (zmsg_t *self, const char *string); + +// Push string as new frame to end of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_addstr (zmsg_t *self, const char *string); + +// Push formatted string as new frame to front of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_pushstrf (zmsg_t *self, const char *format, ...); + +// Push formatted string as new frame to end of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_addstrf (zmsg_t *self, const char *format, ...); + +// Pop frame off front of message, return as fresh string. If there were +// no more frames in the message, returns NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zmsg_popstr (zmsg_t *self); + +// Push encoded message as a new frame. Message takes ownership of +// submessage, so the original is destroyed in this call. Returns 0 on +// success, -1 on error. +CZMQ_EXPORT int + zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); + +// Remove first submessage from message, if any. Returns zmsg_t, or NULL if +// decoding was not successful. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zmsg_t * + zmsg_popmsg (zmsg_t *self); + +// Remove specified frame from list, if present. Does not destroy frame. +CZMQ_EXPORT void + zmsg_remove (zmsg_t *self, zframe_t *frame); + +// Set cursor to first frame in message. Returns frame, or NULL, if the +// message is empty. Use this to navigate the frames as a list. +CZMQ_EXPORT zframe_t * + zmsg_first (zmsg_t *self); + +// Return the next frame. If there are no more frames, returns NULL. To move +// to the first frame call zmsg_first(). Advances the cursor. +CZMQ_EXPORT zframe_t * + zmsg_next (zmsg_t *self); + +// Return the last frame. If there are no frames, returns NULL. +CZMQ_EXPORT zframe_t * + zmsg_last (zmsg_t *self); + +// Save message to an open file, return 0 if OK, else -1. The message is +// saved as a series of frames, each with length and data. Note that the +// file is NOT guaranteed to be portable between operating systems, not +// versions of CZMQ. The file format is at present undocumented and liable +// to arbitrary change. +CZMQ_EXPORT int + zmsg_save (zmsg_t *self, FILE *file); + +// Serialize multipart message to a single message frame. Use this method +// to send structured messages across transports that do not support +// multipart data. Allocates and returns a new frame containing the +// serialized message. To decode a serialized message frame, use +// zmsg_decode (). +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zmsg_encode (zmsg_t *self); + +// Create copy of message, as new message object. Returns a fresh zmsg_t +// object. If message is null, or memory was exhausted, returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zmsg_t * + zmsg_dup (zmsg_t *self); + +// Send message to zsys log sink (may be stdout, or system facility as +// configured by zsys_set_logstream). +CZMQ_EXPORT void + zmsg_print (zmsg_t *self); + +// Return true if the two messages have the same number of frames and each +// frame in the first message is identical to the corresponding frame in the +// other message. As with zframe_eq, return false if either message is NULL. +CZMQ_EXPORT bool + zmsg_eq (zmsg_t *self, zmsg_t *other); + +// Return signal value, 0 or greater, if message is a signal, -1 if not. +CZMQ_EXPORT int + zmsg_signal (zmsg_t *self); + +// Probe the supplied object, and report if it looks like a zmsg_t. +CZMQ_EXPORT bool + zmsg_is (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zmsg_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Return message routing ID, if the message came from a ZMQ_SERVER socket. +// Else returns zero. +CZMQ_EXPORT uint32_t + zmsg_routing_id (zmsg_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on message. This is used if/when the message is sent to a +// ZMQ_SERVER socket. +CZMQ_EXPORT void + zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT int + zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + + +// DEPRECATED as over-engineered, poor style +// Pop frame off front of message, caller now owns frame +// If next frame is empty, pops and destroys that empty frame. +CZMQ_EXPORT zframe_t * + zmsg_unwrap (zmsg_t *self); + +// DEPRECATED as poor style -- callers should use zloop or zpoller +// Receive message from socket, returns zmsg_t object, or NULL either if +// there was no input waiting, or the recv was interrupted. +CZMQ_EXPORT zmsg_t * + zmsg_recv_nowait (void *source); + +// DEPRECATED as unsafe -- does not nullify frame reference. +// Push frame plus empty frame to front of message, before first frame. +// Message takes ownership of frame, will destroy it when message is sent. +CZMQ_EXPORT void + zmsg_wrap (zmsg_t *self, zframe_t *frame); + +// DEPRECATED - will be removed for next + 1 stable release +// Add frame to the front of the message, i.e. before all other frames. +// Message takes ownership of frame, will destroy it when message is sent. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_push (zmsg_t *self, zframe_t *frame); + +// DEPRECATED - will be removed for next stable release +CZMQ_EXPORT int + zmsg_add (zmsg_t *self, zframe_t *frame); + +// DEPRECATED as inconsistent; breaks principle that logging should all go +// to a single destination. +// Print message to open stream +// Truncates to first 10 frames, for readability. +CZMQ_EXPORT void + zmsg_fprint (zmsg_t *self, FILE *file); + +// Compiler hints +CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zmsg_dump(s) zmsg_print(s) +#define zmsg_dump_to_stream(s,F) zmsg_fprint(s,F) + +#endif diff --git a/phonelibs/zmq/aarch64/include/zmutex.h b/phonelibs/zmq/aarch64/include/zmutex.h new file mode 100644 index 00000000000000..cba315999b7598 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zmutex.h @@ -0,0 +1,55 @@ +/* ========================================================================= + zmutex - working with mutexes + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMUTEX_H_INCLUDED__ +#define __ZMUTEX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// This is a deprecated class, and will be removed over time. It is +// provided in stable builds to support old applications. You should +// stop using this class, and migrate any code that is still using it. + +// Create a new mutex container +CZMQ_EXPORT zmutex_t * + zmutex_new (void); + +// Destroy a mutex container +CZMQ_EXPORT void + zmutex_destroy (zmutex_t **self_p); + +// Lock mutex +CZMQ_EXPORT void + zmutex_lock (zmutex_t *self); + +// Unlock mutex +CZMQ_EXPORT void + zmutex_unlock (zmutex_t *self); + +// Try to lock mutex +CZMQ_EXPORT int + zmutex_try_lock (zmutex_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zmutex_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zpoller.h b/phonelibs/zmq/aarch64/include/zpoller.h new file mode 100644 index 00000000000000..3756a935a64008 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zpoller.h @@ -0,0 +1,92 @@ +/* ========================================================================= + zpoller - trivial socket poller class + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __zpoller_H_INCLUDED__ +#define __zpoller_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zpoller.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create new poller, specifying zero or more readers. The list of +// readers ends in a NULL. Each reader can be a zsock_t instance, a +// zactor_t instance, a libzmq socket (void *), or a file handle. +CZMQ_EXPORT zpoller_t * + zpoller_new (void *reader, ...); + +// Destroy a poller +CZMQ_EXPORT void + zpoller_destroy (zpoller_t **self_p); + +// Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may +// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. +CZMQ_EXPORT int + zpoller_add (zpoller_t *self, void *reader); + +// Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader +// must have been passed during construction, or in an zpoller_add () call. +CZMQ_EXPORT int + zpoller_remove (zpoller_t *self, void *reader); + +// Poll the registered readers for I/O, return first reader that has input. +// The reader will be a libzmq void * socket, or a zsock_t or zactor_t +// instance as specified in zpoller_new/zpoller_add. The timeout should be +// zero or greater, or -1 to wait indefinitely. Socket priority is defined +// by their order in the poll list. If you need a balanced poll, use the low +// level zmq_poll method directly. If the poll call was interrupted (SIGINT), +// or the ZMQ context was destroyed, or the timeout expired, returns NULL. +// You can test the actual exit condition by calling zpoller_expired () and +// zpoller_terminated (). The timeout is in msec. +CZMQ_EXPORT void * + zpoller_wait (zpoller_t *self, int timeout); + +// Return true if the last zpoller_wait () call ended because the timeout +// expired, without any error. +CZMQ_EXPORT bool + zpoller_expired (zpoller_t *self); + +// Return true if the last zpoller_wait () call ended because the process +// was interrupted, or the parent context was destroyed. +CZMQ_EXPORT bool + zpoller_terminated (zpoller_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zpoller_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// By default the poller stops if the process receives a SIGINT or SIGTERM +// signal. This makes it impossible to shut-down message based architectures +// like zactors. This method lets you switch off break handling. The default +// nonstop setting is off (false). +CZMQ_EXPORT void + zpoller_set_nonstop (zpoller_t *self, bool nonstop); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/phonelibs/zmq/aarch64/include/zproc.h b/phonelibs/zmq/aarch64/include/zproc.h new file mode 100644 index 00000000000000..a2e1b3dd9913c6 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zproc.h @@ -0,0 +1,179 @@ +/* ========================================================================= + zproc - process configuration and status + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef ZPROC_H_INCLUDED +#define ZPROC_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zproc.api" to make changes. +// @interface +// This is a draft class, and may change without notice. It is disabled in +// stable builds by default. If you use this in applications, please ask +// for it to be pushed to stable state. Use --enable-drafts to enable. +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Returns CZMQ version as a single 6-digit integer encoding the major +// version (x 10000), the minor version (x 100) and the patch. +CZMQ_EXPORT int + zproc_czmq_version (void); + +// *** Draft method, for development use, may change without warning *** +// Returns true if the process received a SIGINT or SIGTERM signal. +// It is good practice to use this method to exit any infinite loop +// processing messages. +CZMQ_EXPORT bool + zproc_interrupted (void); + +// *** Draft method, for development use, may change without warning *** +// Returns true if the underlying libzmq supports CURVE security. +CZMQ_EXPORT bool + zproc_has_curve (void); + +// *** Draft method, for development use, may change without warning *** +// Return current host name, for use in public tcp:// endpoints. +// If the host name is not resolvable, returns NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zproc_hostname (void); + +// *** Draft method, for development use, may change without warning *** +// Move the current process into the background. The precise effect +// depends on the operating system. On POSIX boxes, moves to a specified +// working directory (if specified), closes all file handles, reopens +// stdin, stdout, and stderr to the null device, and sets the process to +// ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there +// was an error. +CZMQ_EXPORT void + zproc_daemonize (const char *workdir); + +// *** Draft method, for development use, may change without warning *** +// Drop the process ID into the lockfile, with exclusive lock, and +// switch the process to the specified group and/or user. Any of the +// arguments may be null, indicating a no-op. Returns 0 on success, +// -1 on failure. Note if you combine this with zsys_daemonize, run +// after, not before that method, or the lockfile will hold the wrong +// process ID. +CZMQ_EXPORT void + zproc_run_as (const char *lockfile, const char *group, const char *user); + +// *** Draft method, for development use, may change without warning *** +// Configure the number of I/O threads that ZeroMQ will use. A good +// rule of thumb is one thread per gigabit of traffic in or out. The +// default is 1, sufficient for most applications. If the environment +// variable ZSYS_IO_THREADS is defined, that provides the default. +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zproc_set_io_threads (size_t io_threads); + +// *** Draft method, for development use, may change without warning *** +// Configure the number of sockets that ZeroMQ will allow. The default +// is 1024. The actual limit depends on the system, and you can query it +// by using zsys_socket_limit (). A value of zero means "maximum". +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zproc_set_max_sockets (size_t max_sockets); + +// *** Draft method, for development use, may change without warning *** +// Set network interface name to use for broadcasts, particularly zbeacon. +// This lets the interface be configured for test environments where required. +// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is +// the default when there is no specified interface. If the environment +// variable ZSYS_INTERFACE is set, use that as the default interface name. +// Setting the interface to "*" means "use all available interfaces". +CZMQ_EXPORT void + zproc_set_biface (const char *value); + +// *** Draft method, for development use, may change without warning *** +// Return network interface to use for broadcasts, or "" if none was set. +CZMQ_EXPORT const char * + zproc_biface (void); + +// *** Draft method, for development use, may change without warning *** +// Set log identity, which is a string that prefixes all log messages sent +// by this process. The log identity defaults to the environment variable +// ZSYS_LOGIDENT, if that is set. +CZMQ_EXPORT void + zproc_set_log_ident (const char *value); + +// *** Draft method, for development use, may change without warning *** +// Sends log output to a PUB socket bound to the specified endpoint. To +// collect such log output, create a SUB socket, subscribe to the traffic +// you care about, and connect to the endpoint. Log traffic is sent as a +// single string frame, in the same format as when sent to stdout. The +// log system supports a single sender; multiple calls to this method will +// bind the same sender to multiple endpoints. To disable the sender, call +// this method with a null argument. +CZMQ_EXPORT void + zproc_set_log_sender (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Enable or disable logging to the system facility (syslog on POSIX boxes, +// event log on Windows). By default this is disabled. +CZMQ_EXPORT void + zproc_set_log_system (bool logsystem); + +// *** Draft method, for development use, may change without warning *** +// Log error condition - highest priority +CZMQ_EXPORT void + zproc_log_error (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Log warning condition - high priority +CZMQ_EXPORT void + zproc_log_warning (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Log normal, but significant, condition - normal priority +CZMQ_EXPORT void + zproc_log_notice (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Log informational message - low priority +CZMQ_EXPORT void + zproc_log_info (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Log debug-level message - lowest priority +CZMQ_EXPORT void + zproc_log_debug (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Self test of this class. +CZMQ_EXPORT void + zproc_test (bool verbose); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT void + zproc_log_error (const char *format, ...) CHECK_PRINTF (1); +CZMQ_EXPORT void + zproc_log_warning (const char *format, ...) CHECK_PRINTF (1); +CZMQ_EXPORT void + zproc_log_notice (const char *format, ...) CHECK_PRINTF (1); +CZMQ_EXPORT void + zproc_log_info (const char *format, ...) CHECK_PRINTF (1); +CZMQ_EXPORT void + zproc_log_debug (const char *format, ...) CHECK_PRINTF (1); +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zproxy.h b/phonelibs/zmq/aarch64/include/zproxy.h new file mode 100644 index 00000000000000..f672c5e72417a5 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zproxy.h @@ -0,0 +1,111 @@ +/* ========================================================================= + zproxy - run a steerable proxy in the background + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZPROXY_H_INCLUDED__ +#define __ZPROXY_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create new zproxy actor instance. The proxy switches messages between +// a frontend socket and a backend socket; use the FRONTEND and BACKEND +// commands to configure these: +// +// zactor_t *proxy = zactor_new (zproxy, NULL); +// +// Destroy zproxy instance. This destroys the two sockets and stops any +// message flow between them: +// +// zactor_destroy (&proxy); +// +// Note that all zproxy commands are synchronous, so your application always +// waits for a signal from the actor after each command. +// +// Enable verbose logging of commands and activity: +// +// zstr_send (proxy, "VERBOSE"); +// zsock_wait (proxy); +// +// Specify frontend socket type -- see zsock_type_str () -- and attach to +// endpoints, see zsock_attach (). Note that a proxy socket is always +// serverish: +// +// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); +// zsock_wait (proxy); +// +// Specify backend socket type -- see zsock_type_str () -- and attach to +// endpoints, see zsock_attach (). Note that a proxy socket is always +// serverish: +// +// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); +// zsock_wait (proxy); +// +// Capture all proxied messages; these are delivered to the application +// via an inproc PULL socket that you have already bound to the specified +// endpoint: +// +// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); +// zsock_wait (proxy); +// +// Pause the proxy. A paused proxy will cease processing messages, causing +// them to be queued up and potentially hit the high-water mark on the +// frontend or backend socket, causing messages to be dropped, or writing +// applications to block: +// +// zstr_sendx (proxy, "PAUSE", NULL); +// zsock_wait (proxy); +// +// Resume the proxy. Note that the proxy starts automatically as soon as it +// has a properly attached frontend and backend socket: +// +// zstr_sendx (proxy, "RESUME", NULL); +// zsock_wait (proxy); +// +// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy +// socket -- see zsock_set_zap_domain (). Call before binding socket: +// +// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); +// zsock_wait (proxy); +// +// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy +// socket -- see zsock_set_plain_server (). Call before binding socket: +// +// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); +// zsock_wait (proxy); +// +// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy +// socket -- see zsock_set_curve_server () -- specifying both the public and +// secret keys of a certificate as Z85 armored strings -- see +// zcert_public_txt () and zcert_secret_txt (). Call before binding socket: +// +// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); +// zsock_wait (proxy); +// +// This is the zproxy constructor as a zactor_fn; the argument is a +// character string specifying frontend and backend socket types as two +// uppercase strings separated by a hyphen: +CZMQ_EXPORT void + zproxy (zsock_t *pipe, void *unused); + +// Selftest +CZMQ_EXPORT void + zproxy_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zproxy_v2.h b/phonelibs/zmq/aarch64/include/zproxy_v2.h new file mode 100644 index 00000000000000..4bde9515916935 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zproxy_v2.h @@ -0,0 +1,62 @@ +/* ========================================================================= + zproxy_v2 - run a steerable proxy in the background (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZPROXY_V2_H_INCLUDED__ +#define __ZPROXY_V2_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface + +// Constructor +// Create a new zproxy object. You must create the frontend and backend +// sockets, configure them, and connect or bind them, before you pass them +// to the constructor. Do NOT use the sockets again, after passing them to +// this method. +CZMQ_EXPORT zproxy_t * + zproxy_new (zctx_t *ctx, void *frontend, void *backend); + +// Destructor +// Destroy a zproxy object; note this first stops the proxy. +CZMQ_EXPORT void + zproxy_destroy (zproxy_t **self_p); + +// Copy all proxied messages to specified endpoint; if this is NULL, any +// in-progress capturing will be stopped. You must already have bound the +// endpoint to a PULL socket. +CZMQ_EXPORT void + zproxy_capture (zproxy_t *self, const char *endpoint); + +// Pauses a zproxy object; a paused proxy will cease processing messages, +// causing them to be queued up and potentially hit the high-water mark on +// the frontend socket, causing messages to be dropped, or writing +// applications to block. +CZMQ_EXPORT void + zproxy_pause (zproxy_t *self); + +// Resume a zproxy object +CZMQ_EXPORT void + zproxy_resume (zproxy_t *self); + +// Self test of this class +CZMQ_EXPORT void + zproxy_v2_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zrex.h b/phonelibs/zmq/aarch64/include/zrex.h new file mode 100644 index 00000000000000..8b50618a34837c --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zrex.h @@ -0,0 +1,82 @@ +/* ========================================================================= + zrex - work with regular expressions + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZREX_H_INCLUDED__ +#define __ZREX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Constructor. Optionally, sets an expression against which we can match +// text and capture hits. If there is an error in the expression, reports +// zrex_valid() as false and provides the error in zrex_strerror(). If you +// set a pattern, you can call zrex_matches() to test it against text. +CZMQ_EXPORT zrex_t * + zrex_new (const char *expression); + +// Destructor +CZMQ_EXPORT void + zrex_destroy (zrex_t **self_p); + +// Return true if the expression was valid and compiled without errors. +CZMQ_EXPORT bool + zrex_valid (zrex_t *self); + +// Return the error message generated during compilation of the expression. +CZMQ_EXPORT const char * + zrex_strerror (zrex_t *self); + +// Returns true if the text matches the previously compiled expression. +// Use this method to compare one expression against many strings. +CZMQ_EXPORT bool + zrex_matches (zrex_t *self, const char *text); + +// Returns true if the text matches the supplied expression. Use this +// method to compare one string against several expressions. +CZMQ_EXPORT bool + zrex_eq (zrex_t *self, const char *text, const char *expression); + +// Returns number of hits from last zrex_matches or zrex_eq. If the text +// matched, returns 1 plus the number of capture groups. If the text did +// not match, returns zero. To retrieve individual capture groups, call +// zrex_hit (). +CZMQ_EXPORT int + zrex_hits (zrex_t *self); + +// Returns the Nth capture group from the last expression match, where +// N is 0 to the value returned by zrex_hits(). Capture group 0 is the +// whole matching string. Sequence 1 is the first capture group, if any, +// and so on. +CZMQ_EXPORT const char * + zrex_hit (zrex_t *self, uint index); + +// Fetches hits into string variables provided by caller; this makes for +// nicer code than accessing hits by index. Caller should not modify nor +// free the returned values. Returns number of strings returned. This +// method starts at hit 1, i.e. first capture group, as hit 0 is always +// the original matched string. +CZMQ_EXPORT int + zrex_fetch (zrex_t *self, const char **string_p, ...); + +// Self test of this class +CZMQ_EXPORT void + zrex_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zsock.h b/phonelibs/zmq/aarch64/include/zsock.h new file mode 100644 index 00000000000000..fc5c46e45e9810 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zsock.h @@ -0,0 +1,921 @@ +/* ========================================================================= + zsock - high-level socket API that hides libzmq contexts and sockets + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSOCK_H_INCLUDED__ +#define __ZSOCK_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// This interface includes some smart constructors, which create sockets with +// additional set-up. In all of these, the endpoint is NULL, or starts with +// '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by +// commas. If endpoint does not start with '@' or '>', default action depends +// on socket type. + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zsock.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create a new socket. Returns the new socket, or NULL if the new socket +// could not be created. Note that the symbol zsock_new (and other +// constructors/destructors for zsock) are redirected to the *_checked +// variant, enabling intelligent socket leak detection. This can have +// performance implications if you use a LOT of sockets. To turn off this +// redirection behaviour, define ZSOCK_NOCHECK. +CZMQ_EXPORT zsock_t * + zsock_new (int type); + +// Create a PUB socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_pub (const char *endpoint); + +// Create a SUB socket, and optionally subscribe to some prefix string. Default +// action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_sub (const char *endpoint, const char *subscribe); + +// Create a REQ socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_req (const char *endpoint); + +// Create a REP socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_rep (const char *endpoint); + +// Create a DEALER socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_dealer (const char *endpoint); + +// Create a ROUTER socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_router (const char *endpoint); + +// Create a PUSH socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_push (const char *endpoint); + +// Create a PULL socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_pull (const char *endpoint); + +// Create an XPUB socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_xpub (const char *endpoint); + +// Create an XSUB socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_xsub (const char *endpoint); + +// Create a PAIR socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_pair (const char *endpoint); + +// Create a STREAM socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_stream (const char *endpoint); + +// Destroy the socket. You must use this for any socket created via the +// zsock_new method. +CZMQ_EXPORT void + zsock_destroy (zsock_t **self_p); + +// Bind a socket to a formatted endpoint. For tcp:// endpoints, supports +// ephemeral ports, if you specify the port number as "*". By default +// zsock uses the IANA designated range from C000 (49152) to FFFF (65535). +// To override this range, follow the "*" with "[first-last]". Either or +// both first and last may be empty. To bind to a random port within the +// range, use "!" in place of "*". +// +// Examples: +// tcp://127.0.0.1:* bind to first free port from C000 up +// tcp://127.0.0.1:! bind to random port from C000 to FFFF +// tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up +// tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 +// tcp://127.0.0.1:![55000-55999] +// bind to random port from 55000 to 55999 +// +// On success, returns the actual port number used, for tcp:// endpoints, +// and 0 for other transports. On failure, returns -1. Note that when using +// ephemeral ports, a port may be reused by different services without +// clients being aware. Protocols that run on ephemeral ports should take +// this into account. +CZMQ_EXPORT int + zsock_bind (zsock_t *self, const char *format, ...); + +// Returns last bound endpoint, if any. +CZMQ_EXPORT const char * + zsock_endpoint (zsock_t *self); + +// Unbind a socket from a formatted endpoint. +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsock_unbind (zsock_t *self, const char *format, ...); + +// Connect a socket to a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid. +CZMQ_EXPORT int + zsock_connect (zsock_t *self, const char *format, ...); + +// Disconnect a socket from a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsock_disconnect (zsock_t *self, const char *format, ...); + +// Attach a socket to zero or more endpoints. If endpoints is not null, +// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by +// '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all +// endpoints were valid, or -1 if there was a syntax error. If the endpoint +// does not start with '@' or '>', the serverish argument defines whether +// it is used to bind (serverish = true) or connect (serverish = false). +CZMQ_EXPORT int + zsock_attach (zsock_t *self, const char *endpoints, bool serverish); + +// Returns socket type as printable constant string. +CZMQ_EXPORT const char * + zsock_type_str (zsock_t *self); + +// Send a 'picture' message to the socket (or actor). The picture is a +// string that defines the type of each frame. This makes it easy to send +// a complex multiframe message in one call. The picture can contain any +// of these characters, each corresponding to one or two arguments: +// +// i = int (signed) +// 1 = uint8_t +// 2 = uint16_t +// 4 = uint32_t +// 8 = uint64_t +// s = char * +// b = byte *, size_t (2 arguments) +// c = zchunk_t * +// f = zframe_t * +// h = zhashx_t * +// U = zuuid_t * +// p = void * (sends the pointer value, only meaningful over inproc) +// m = zmsg_t * (sends all frames in the zmsg) +// z = sends zero-sized frame (0 arguments) +// u = uint (deprecated) +// +// Note that s, b, c, and f are encoded the same way and the choice is +// offered as a convenience to the sender, which may or may not already +// have data in a zchunk or zframe. Does not change or take ownership of +// any arguments. Returns 0 if successful, -1 if sending failed for any +// reason. +CZMQ_EXPORT int + zsock_send (void *self, const char *picture, ...); + +// Send a 'picture' message to the socket (or actor). This is a va_list +// version of zsock_send (), so please consult its documentation for the +// details. +CZMQ_EXPORT int + zsock_vsend (void *self, const char *picture, va_list argptr); + +// Receive a 'picture' message to the socket (or actor). See zsock_send for +// the format and meaning of the picture. Returns the picture elements into +// a series of pointers as provided by the caller: +// +// i = int * (stores signed integer) +// 4 = uint32_t * (stores 32-bit unsigned integer) +// 8 = uint64_t * (stores 64-bit unsigned integer) +// s = char ** (allocates new string) +// b = byte **, size_t * (2 arguments) (allocates memory) +// c = zchunk_t ** (creates zchunk) +// f = zframe_t ** (creates zframe) +// U = zuuid_t * (creates a zuuid with the data) +// h = zhashx_t ** (creates zhashx) +// p = void ** (stores pointer) +// m = zmsg_t ** (creates a zmsg with the remaing frames) +// z = null, asserts empty frame (0 arguments) +// u = uint * (stores unsigned integer, deprecated) +// +// Note that zsock_recv creates the returned objects, and the caller must +// destroy them when finished with them. The supplied pointers do not need +// to be initialized. Returns 0 if successful, or -1 if it failed to recv +// a message, in which case the pointers are not modified. When message +// frames are truncated (a short message), sets return values to zero/null. +// If an argument pointer is NULL, does not store any value (skips it). +// An 'n' picture matches an empty frame; if the message does not match, +// the method will return -1. +CZMQ_EXPORT int + zsock_recv (void *self, const char *picture, ...); + +// Receive a 'picture' message from the socket (or actor). This is a +// va_list version of zsock_recv (), so please consult its documentation +// for the details. +CZMQ_EXPORT int + zsock_vrecv (void *self, const char *picture, va_list argptr); + +// Send a binary encoded 'picture' message to the socket (or actor). This +// method is similar to zsock_send, except the arguments are encoded in a +// binary format that is compatible with zproto, and is designed to reduce +// memory allocations. The pattern argument is a string that defines the +// type of each argument. Supports these argument types: +// +// pattern C type zproto type: +// 1 uint8_t type = "number" size = "1" +// 2 uint16_t type = "number" size = "2" +// 4 uint32_t type = "number" size = "3" +// 8 uint64_t type = "number" size = "4" +// s char *, 0-255 chars type = "string" +// S char *, 0-2^32-1 chars type = "longstr" +// c zchunk_t * type = "chunk" +// f zframe_t * type = "frame" +// u zuuid_t * type = "uuid" +// m zmsg_t * type = "msg" +// p void *, sends pointer value, only over inproc +// +// Does not change or take ownership of any arguments. Returns 0 if +// successful, -1 if sending failed for any reason. +CZMQ_EXPORT int + zsock_bsend (void *self, const char *picture, ...); + +// Receive a binary encoded 'picture' message from the socket (or actor). +// This method is similar to zsock_recv, except the arguments are encoded +// in a binary format that is compatible with zproto, and is designed to +// reduce memory allocations. The pattern argument is a string that defines +// the type of each argument. See zsock_bsend for the supported argument +// types. All arguments must be pointers; this call sets them to point to +// values held on a per-socket basis. +// Note that zsock_brecv creates the returned objects, and the caller must +// destroy them when finished with them. The supplied pointers do not need +// to be initialized. Returns 0 if successful, or -1 if it failed to read +// a message. +CZMQ_EXPORT int + zsock_brecv (void *self, const char *picture, ...); + +// Set socket to use unbounded pipes (HWM=0); use this in cases when you are +// totally certain the message volume can fit in memory. This method works +// across all versions of ZeroMQ. Takes a polymorphic socket reference. +CZMQ_EXPORT void + zsock_set_unbounded (void *self); + +// Send a signal over a socket. A signal is a short message carrying a +// success/failure code (by convention, 0 means OK). Signals are encoded +// to be distinguishable from "normal" messages. Accepts a zsock_t or a +// zactor_t argument, and returns 0 if successful, -1 if the signal could +// not be sent. Takes a polymorphic socket reference. +CZMQ_EXPORT int + zsock_signal (void *self, byte status); + +// Wait on a signal. Use this to coordinate between threads, over pipe +// pairs. Blocks until the signal is received. Returns -1 on error, 0 or +// greater on success. Accepts a zsock_t or a zactor_t as argument. +// Takes a polymorphic socket reference. +CZMQ_EXPORT int + zsock_wait (void *self); + +// If there is a partial message still waiting on the socket, remove and +// discard it. This is useful when reading partial messages, to get specific +// message types. +CZMQ_EXPORT void + zsock_flush (void *self); + +// Probe the supplied object, and report if it looks like a zsock_t. +// Takes a polymorphic socket reference. +CZMQ_EXPORT bool + zsock_is (void *self); + +// Probe the supplied reference. If it looks like a zsock_t instance, return +// the underlying libzmq socket handle; else if it looks like a file +// descriptor, return NULL; else if it looks like a libzmq socket handle, +// return the supplied value. Takes a polymorphic socket reference. +CZMQ_EXPORT void * + zsock_resolve (void *self); + +// Get socket option `tos`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tos (void *self); + +// Set socket option `tos`. +CZMQ_EXPORT void + zsock_set_tos (void *self, int tos); + +// Set socket option `router_handover`. +CZMQ_EXPORT void + zsock_set_router_handover (void *self, int router_handover); + +// Set socket option `router_mandatory`. +CZMQ_EXPORT void + zsock_set_router_mandatory (void *self, int router_mandatory); + +// Set socket option `probe_router`. +CZMQ_EXPORT void + zsock_set_probe_router (void *self, int probe_router); + +// Set socket option `req_relaxed`. +CZMQ_EXPORT void + zsock_set_req_relaxed (void *self, int req_relaxed); + +// Set socket option `req_correlate`. +CZMQ_EXPORT void + zsock_set_req_correlate (void *self, int req_correlate); + +// Set socket option `conflate`. +CZMQ_EXPORT void + zsock_set_conflate (void *self, int conflate); + +// Get socket option `zap_domain`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_zap_domain (void *self); + +// Set socket option `zap_domain`. +CZMQ_EXPORT void + zsock_set_zap_domain (void *self, const char *zap_domain); + +// Get socket option `mechanism`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_mechanism (void *self); + +// Get socket option `plain_server`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_plain_server (void *self); + +// Set socket option `plain_server`. +CZMQ_EXPORT void + zsock_set_plain_server (void *self, int plain_server); + +// Get socket option `plain_username`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_plain_username (void *self); + +// Set socket option `plain_username`. +CZMQ_EXPORT void + zsock_set_plain_username (void *self, const char *plain_username); + +// Get socket option `plain_password`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_plain_password (void *self); + +// Set socket option `plain_password`. +CZMQ_EXPORT void + zsock_set_plain_password (void *self, const char *plain_password); + +// Get socket option `curve_server`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_curve_server (void *self); + +// Set socket option `curve_server`. +CZMQ_EXPORT void + zsock_set_curve_server (void *self, int curve_server); + +// Get socket option `curve_publickey`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_curve_publickey (void *self); + +// Set socket option `curve_publickey`. +CZMQ_EXPORT void + zsock_set_curve_publickey (void *self, const char *curve_publickey); + +// Set socket option `curve_publickey` from 32-octet binary +CZMQ_EXPORT void + zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); + +// Get socket option `curve_secretkey`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_curve_secretkey (void *self); + +// Set socket option `curve_secretkey`. +CZMQ_EXPORT void + zsock_set_curve_secretkey (void *self, const char *curve_secretkey); + +// Set socket option `curve_secretkey` from 32-octet binary +CZMQ_EXPORT void + zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); + +// Get socket option `curve_serverkey`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_curve_serverkey (void *self); + +// Set socket option `curve_serverkey`. +CZMQ_EXPORT void + zsock_set_curve_serverkey (void *self, const char *curve_serverkey); + +// Set socket option `curve_serverkey` from 32-octet binary +CZMQ_EXPORT void + zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); + +// Get socket option `gssapi_server`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_gssapi_server (void *self); + +// Set socket option `gssapi_server`. +CZMQ_EXPORT void + zsock_set_gssapi_server (void *self, int gssapi_server); + +// Get socket option `gssapi_plaintext`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_gssapi_plaintext (void *self); + +// Set socket option `gssapi_plaintext`. +CZMQ_EXPORT void + zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); + +// Get socket option `gssapi_principal`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_gssapi_principal (void *self); + +// Set socket option `gssapi_principal`. +CZMQ_EXPORT void + zsock_set_gssapi_principal (void *self, const char *gssapi_principal); + +// Get socket option `gssapi_service_principal`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_gssapi_service_principal (void *self); + +// Set socket option `gssapi_service_principal`. +CZMQ_EXPORT void + zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); + +// Get socket option `ipv6`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_ipv6 (void *self); + +// Set socket option `ipv6`. +CZMQ_EXPORT void + zsock_set_ipv6 (void *self, int ipv6); + +// Get socket option `immediate`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_immediate (void *self); + +// Set socket option `immediate`. +CZMQ_EXPORT void + zsock_set_immediate (void *self, int immediate); + +// Set socket option `router_raw`. +CZMQ_EXPORT void + zsock_set_router_raw (void *self, int router_raw); + +// Get socket option `ipv4only`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_ipv4only (void *self); + +// Set socket option `ipv4only`. +CZMQ_EXPORT void + zsock_set_ipv4only (void *self, int ipv4only); + +// Set socket option `delay_attach_on_connect`. +CZMQ_EXPORT void + zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); + +// Get socket option `type`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_type (void *self); + +// Get socket option `sndhwm`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_sndhwm (void *self); + +// Set socket option `sndhwm`. +CZMQ_EXPORT void + zsock_set_sndhwm (void *self, int sndhwm); + +// Get socket option `rcvhwm`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvhwm (void *self); + +// Set socket option `rcvhwm`. +CZMQ_EXPORT void + zsock_set_rcvhwm (void *self, int rcvhwm); + +// Get socket option `affinity`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_affinity (void *self); + +// Set socket option `affinity`. +CZMQ_EXPORT void + zsock_set_affinity (void *self, int affinity); + +// Set socket option `subscribe`. +CZMQ_EXPORT void + zsock_set_subscribe (void *self, const char *subscribe); + +// Set socket option `unsubscribe`. +CZMQ_EXPORT void + zsock_set_unsubscribe (void *self, const char *unsubscribe); + +// Get socket option `identity`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_identity (void *self); + +// Set socket option `identity`. +CZMQ_EXPORT void + zsock_set_identity (void *self, const char *identity); + +// Get socket option `rate`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rate (void *self); + +// Set socket option `rate`. +CZMQ_EXPORT void + zsock_set_rate (void *self, int rate); + +// Get socket option `recovery_ivl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_recovery_ivl (void *self); + +// Set socket option `recovery_ivl`. +CZMQ_EXPORT void + zsock_set_recovery_ivl (void *self, int recovery_ivl); + +// Get socket option `sndbuf`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_sndbuf (void *self); + +// Set socket option `sndbuf`. +CZMQ_EXPORT void + zsock_set_sndbuf (void *self, int sndbuf); + +// Get socket option `rcvbuf`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvbuf (void *self); + +// Set socket option `rcvbuf`. +CZMQ_EXPORT void + zsock_set_rcvbuf (void *self, int rcvbuf); + +// Get socket option `linger`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_linger (void *self); + +// Set socket option `linger`. +CZMQ_EXPORT void + zsock_set_linger (void *self, int linger); + +// Get socket option `reconnect_ivl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_reconnect_ivl (void *self); + +// Set socket option `reconnect_ivl`. +CZMQ_EXPORT void + zsock_set_reconnect_ivl (void *self, int reconnect_ivl); + +// Get socket option `reconnect_ivl_max`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_reconnect_ivl_max (void *self); + +// Set socket option `reconnect_ivl_max`. +CZMQ_EXPORT void + zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); + +// Get socket option `backlog`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_backlog (void *self); + +// Set socket option `backlog`. +CZMQ_EXPORT void + zsock_set_backlog (void *self, int backlog); + +// Get socket option `maxmsgsize`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_maxmsgsize (void *self); + +// Set socket option `maxmsgsize`. +CZMQ_EXPORT void + zsock_set_maxmsgsize (void *self, int maxmsgsize); + +// Get socket option `multicast_hops`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_multicast_hops (void *self); + +// Set socket option `multicast_hops`. +CZMQ_EXPORT void + zsock_set_multicast_hops (void *self, int multicast_hops); + +// Get socket option `rcvtimeo`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvtimeo (void *self); + +// Set socket option `rcvtimeo`. +CZMQ_EXPORT void + zsock_set_rcvtimeo (void *self, int rcvtimeo); + +// Get socket option `sndtimeo`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_sndtimeo (void *self); + +// Set socket option `sndtimeo`. +CZMQ_EXPORT void + zsock_set_sndtimeo (void *self, int sndtimeo); + +// Set socket option `xpub_verbose`. +CZMQ_EXPORT void + zsock_set_xpub_verbose (void *self, int xpub_verbose); + +// Get socket option `tcp_keepalive`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive (void *self); + +// Set socket option `tcp_keepalive`. +CZMQ_EXPORT void + zsock_set_tcp_keepalive (void *self, int tcp_keepalive); + +// Get socket option `tcp_keepalive_idle`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive_idle (void *self); + +// Set socket option `tcp_keepalive_idle`. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); + +// Get socket option `tcp_keepalive_cnt`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive_cnt (void *self); + +// Set socket option `tcp_keepalive_cnt`. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); + +// Get socket option `tcp_keepalive_intvl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive_intvl (void *self); + +// Set socket option `tcp_keepalive_intvl`. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); + +// Get socket option `tcp_accept_filter`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_tcp_accept_filter (void *self); + +// Set socket option `tcp_accept_filter`. +CZMQ_EXPORT void + zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); + +// Get socket option `rcvmore`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvmore (void *self); + +// Get socket option `fd`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT SOCKET + zsock_fd (void *self); + +// Get socket option `events`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_events (void *self); + +// Get socket option `last_endpoint`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_last_endpoint (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zsock_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Create a SERVER socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_server (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a CLIENT socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_client (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a RADIO socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_radio (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a DISH socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_dish (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a GATHER socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_gather (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a SCATTER socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_scatter (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Return socket routing ID if any. This returns 0 if the socket is not +// of type ZMQ_SERVER or if no request was already received on it. +CZMQ_EXPORT uint32_t + zsock_routing_id (zsock_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. +// This will be used when sending messages on the socket via the zsock API. +CZMQ_EXPORT void + zsock_set_routing_id (zsock_t *self, uint32_t routing_id); + +// *** Draft method, for development use, may change without warning *** +// Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. +// Returns 0 if OK, -1 if failed. +CZMQ_EXPORT int + zsock_join (void *self, const char *group); + +// *** Draft method, for development use, may change without warning *** +// Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. +// Returns 0 if OK, -1 if failed. +CZMQ_EXPORT int + zsock_leave (void *self, const char *group); + +// *** Draft method, for development use, may change without warning *** +// Get socket option `heartbeat_ivl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_heartbeat_ivl (void *self); + +// *** Draft method, for development use, may change without warning *** +// Set socket option `heartbeat_ivl`. +CZMQ_EXPORT void + zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); + +// *** Draft method, for development use, may change without warning *** +// Get socket option `heartbeat_ttl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_heartbeat_ttl (void *self); + +// *** Draft method, for development use, may change without warning *** +// Set socket option `heartbeat_ttl`. +CZMQ_EXPORT void + zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); + +// *** Draft method, for development use, may change without warning *** +// Get socket option `heartbeat_timeout`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_heartbeat_timeout (void *self); + +// *** Draft method, for development use, may change without warning *** +// Set socket option `heartbeat_timeout`. +CZMQ_EXPORT void + zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); + +// *** Draft method, for development use, may change without warning *** +// Get socket option `use_fd`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_use_fd (void *self); + +// *** Draft method, for development use, may change without warning *** +// Set socket option `use_fd`. +CZMQ_EXPORT void + zsock_set_use_fd (void *self, int use_fd); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT int + zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + + +// zsock leak detection - not a part of the official interface to zsock. This +// enables CZMQ to report socket leaks intelligently. +#if defined ZSOCK_NOCHECK + // no checking active - use the above interface methods directly. +#else +# define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__) +# define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__) +# define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__) +# define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__) +# define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__) +# define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__) +# define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__) +# define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__) +# define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__) +# define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__) +# define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__) +# define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__) +# define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__) +# define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__) +#endif + +CZMQ_EXPORT zsock_t * + zsock_new_checked (int type, const char *filename, size_t line_nbr); + +CZMQ_EXPORT void + zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zsocket.h b/phonelibs/zmq/aarch64/include/zsocket.h new file mode 100644 index 00000000000000..a60a0d9db3e7da --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zsocket.h @@ -0,0 +1,110 @@ +/* ========================================================================= + zsocket - working with 0MQ sockets + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSOCKET_H_INCLUDED__ +#define __ZSOCKET_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// This port range is defined by IANA for dynamic or private ports +// We use this when choosing a port for dynamic binding. +#define ZSOCKET_DYNFROM 0xc000 +#define ZSOCKET_DYNTO 0xffff + +// Callback function for zero-copy methods +typedef void (zsocket_free_fn) (void *data, void *arg); + +// Create a new socket within our CZMQ context, replaces zmq_socket. +// Use this to get automatic management of the socket at shutdown. +// Note: SUB sockets do not automatically subscribe to everything; you +// must set filters explicitly. +CZMQ_EXPORT void * + zsocket_new (zctx_t *self, int type); + +// Destroy a socket within our CZMQ context, replaces zmq_close. +CZMQ_EXPORT void + zsocket_destroy (zctx_t *ctx, void *self); + +// Bind a socket to a formatted endpoint. If the port is specified as +// '*', binds to any free port from ZSOCKET_DYNFROM to ZSOCKET_DYNTO +// and returns the actual port number used. Otherwise asserts that the +// bind succeeded with the specified port number. Always returns the +// port number if successful. +CZMQ_EXPORT int + zsocket_bind (void *self, const char *format, ...); + +// Unbind a socket from a formatted endpoint. +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsocket_unbind (void *self, const char *format, ...); + +// Connect a socket to a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid. +CZMQ_EXPORT int + zsocket_connect (void *self, const char *format, ...); + +// Disconnect a socket from a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsocket_disconnect (void *self, const char *format, ...); + +// Poll for input events on the socket. Returns TRUE if there is input +// ready on the socket, else FALSE. +CZMQ_EXPORT bool + zsocket_poll (void *self, int msecs); + +// Returns socket type as printable constant string +CZMQ_EXPORT const char * + zsocket_type_str (void *self); + +// Send data over a socket as a single message frame. +// Accepts these flags: ZFRAME_MORE and ZFRAME_DONTWAIT. +// Returns -1 on error, 0 on success +CZMQ_EXPORT int + zsocket_sendmem (void *self, const void *data, size_t size, int flags); + +// Send a signal over a socket. A signal is a zero-byte message. +// Signals are used primarily between threads, over pipe sockets. +// Returns -1 if there was an error sending the signal. +CZMQ_EXPORT int + zsocket_signal (void *self); + +// Wait on a signal. Use this to coordinate between threads, over +// pipe pairs. Returns -1 on error, 0 on success. +CZMQ_EXPORT int + zsocket_wait (void *self); + +// Self test of this class +CZMQ_EXPORT void + zsocket_test (bool verbose); +// @end + +// Compiler hints +CZMQ_EXPORT int zsocket_bind (void *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int zsocket_unbind (void *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int zsocket_connect (void *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int zsocket_disconnect (void *self, const char *format, ...) CHECK_PRINTF (2); + +// Emulation of widely-used 2.x socket options +CZMQ_EXPORT void zsocket_set_hwm (void *self, int hwm); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zsockopt.h b/phonelibs/zmq/aarch64/include/zsockopt.h new file mode 100644 index 00000000000000..5246986dd0b367 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zsockopt.h @@ -0,0 +1,256 @@ +/* ========================================================================= + zsockopt - get/set 0MQ socket options (deprecated) + + **************************************************** + * GENERATED SOURCE CODE, DO NOT EDIT!! * + * TO CHANGE THIS, EDIT src/zsockopt.gsl * + * AND RUN `gsl sockopts` in src/. * + **************************************************** + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSOCKOPT_H_INCLUDED__ +#define __ZSOCKOPT_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#if (ZMQ_VERSION_MAJOR == 4) +// Get socket options +CZMQ_EXPORT int zsocket_heartbeat_ivl (void *zocket); +CZMQ_EXPORT int zsocket_heartbeat_ttl (void *zocket); +CZMQ_EXPORT int zsocket_heartbeat_timeout (void *zocket); +CZMQ_EXPORT int zsocket_use_fd (void *zocket); +CZMQ_EXPORT int zsocket_tos (void *zocket); +CZMQ_EXPORT char * zsocket_zap_domain (void *zocket); +CZMQ_EXPORT int zsocket_mechanism (void *zocket); +CZMQ_EXPORT int zsocket_plain_server (void *zocket); +CZMQ_EXPORT char * zsocket_plain_username (void *zocket); +CZMQ_EXPORT char * zsocket_plain_password (void *zocket); +CZMQ_EXPORT int zsocket_curve_server (void *zocket); +CZMQ_EXPORT char * zsocket_curve_publickey (void *zocket); +CZMQ_EXPORT char * zsocket_curve_secretkey (void *zocket); +CZMQ_EXPORT char * zsocket_curve_serverkey (void *zocket); +CZMQ_EXPORT int zsocket_gssapi_server (void *zocket); +CZMQ_EXPORT int zsocket_gssapi_plaintext (void *zocket); +CZMQ_EXPORT char * zsocket_gssapi_principal (void *zocket); +CZMQ_EXPORT char * zsocket_gssapi_service_principal (void *zocket); +CZMQ_EXPORT int zsocket_ipv6 (void *zocket); +CZMQ_EXPORT int zsocket_immediate (void *zocket); +CZMQ_EXPORT int zsocket_ipv4only (void *zocket); +CZMQ_EXPORT int zsocket_type (void *zocket); +CZMQ_EXPORT int zsocket_sndhwm (void *zocket); +CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); +CZMQ_EXPORT int zsocket_affinity (void *zocket); +CZMQ_EXPORT char * zsocket_identity (void *zocket); +CZMQ_EXPORT int zsocket_rate (void *zocket); +CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); +CZMQ_EXPORT int zsocket_sndbuf (void *zocket); +CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); +CZMQ_EXPORT int zsocket_linger (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); +CZMQ_EXPORT int zsocket_backlog (void *zocket); +CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); +CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); +CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); +CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); +CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); +CZMQ_EXPORT int zsocket_rcvmore (void *zocket); +CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); +CZMQ_EXPORT int zsocket_events (void *zocket); +CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); + +// Set socket options +CZMQ_EXPORT void zsocket_set_heartbeat_ivl (void *zocket, int heartbeat_ivl); +CZMQ_EXPORT void zsocket_set_heartbeat_ttl (void *zocket, int heartbeat_ttl); +CZMQ_EXPORT void zsocket_set_heartbeat_timeout (void *zocket, int heartbeat_timeout); +CZMQ_EXPORT void zsocket_set_use_fd (void *zocket, int use_fd); +CZMQ_EXPORT void zsocket_set_tos (void *zocket, int tos); +CZMQ_EXPORT void zsocket_set_router_handover (void *zocket, int router_handover); +CZMQ_EXPORT void zsocket_set_router_mandatory (void *zocket, int router_mandatory); +CZMQ_EXPORT void zsocket_set_probe_router (void *zocket, int probe_router); +CZMQ_EXPORT void zsocket_set_req_relaxed (void *zocket, int req_relaxed); +CZMQ_EXPORT void zsocket_set_req_correlate (void *zocket, int req_correlate); +CZMQ_EXPORT void zsocket_set_conflate (void *zocket, int conflate); +CZMQ_EXPORT void zsocket_set_zap_domain (void *zocket, const char * zap_domain); +CZMQ_EXPORT void zsocket_set_plain_server (void *zocket, int plain_server); +CZMQ_EXPORT void zsocket_set_plain_username (void *zocket, const char * plain_username); +CZMQ_EXPORT void zsocket_set_plain_password (void *zocket, const char * plain_password); +CZMQ_EXPORT void zsocket_set_curve_server (void *zocket, int curve_server); +CZMQ_EXPORT void zsocket_set_curve_publickey (void *zocket, const char * curve_publickey); +CZMQ_EXPORT void zsocket_set_curve_publickey_bin (void *zocket, const byte *curve_publickey); +CZMQ_EXPORT void zsocket_set_curve_secretkey (void *zocket, const char * curve_secretkey); +CZMQ_EXPORT void zsocket_set_curve_secretkey_bin (void *zocket, const byte *curve_secretkey); +CZMQ_EXPORT void zsocket_set_curve_serverkey (void *zocket, const char * curve_serverkey); +CZMQ_EXPORT void zsocket_set_curve_serverkey_bin (void *zocket, const byte *curve_serverkey); +CZMQ_EXPORT void zsocket_set_gssapi_server (void *zocket, int gssapi_server); +CZMQ_EXPORT void zsocket_set_gssapi_plaintext (void *zocket, int gssapi_plaintext); +CZMQ_EXPORT void zsocket_set_gssapi_principal (void *zocket, const char * gssapi_principal); +CZMQ_EXPORT void zsocket_set_gssapi_service_principal (void *zocket, const char * gssapi_service_principal); +CZMQ_EXPORT void zsocket_set_ipv6 (void *zocket, int ipv6); +CZMQ_EXPORT void zsocket_set_immediate (void *zocket, int immediate); +CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); +CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); +CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); +CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); +CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); +CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); +CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); +CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); +CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); +CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); +CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); +CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); +CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); +CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); +CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); +CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); +CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); +CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); +CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); +CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); +CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); +CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); +CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); +CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); +#endif + +#if (ZMQ_VERSION_MAJOR == 3) +// Get socket options +CZMQ_EXPORT int zsocket_ipv4only (void *zocket); +CZMQ_EXPORT int zsocket_type (void *zocket); +CZMQ_EXPORT int zsocket_sndhwm (void *zocket); +CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); +CZMQ_EXPORT int zsocket_affinity (void *zocket); +CZMQ_EXPORT char * zsocket_identity (void *zocket); +CZMQ_EXPORT int zsocket_rate (void *zocket); +CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); +CZMQ_EXPORT int zsocket_sndbuf (void *zocket); +CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); +CZMQ_EXPORT int zsocket_linger (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); +CZMQ_EXPORT int zsocket_backlog (void *zocket); +CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); +CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); +CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); +CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); +CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); +CZMQ_EXPORT int zsocket_rcvmore (void *zocket); +CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); +CZMQ_EXPORT int zsocket_events (void *zocket); +CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); + +// Set socket options +CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); +CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); +CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); +CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); +CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); +CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); +CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); +CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); +CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); +CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); +CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); +CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); +CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); +CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); +CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); +CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); +CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); +CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); +CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); +CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); +CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); +CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); +CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); +CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); +#endif + +#if (ZMQ_VERSION_MAJOR == 2) +// Get socket options +CZMQ_EXPORT int zsocket_hwm (void *zocket); +CZMQ_EXPORT int zsocket_swap (void *zocket); +CZMQ_EXPORT int zsocket_affinity (void *zocket); +CZMQ_EXPORT char * zsocket_identity (void *zocket); +CZMQ_EXPORT int zsocket_rate (void *zocket); +CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); +CZMQ_EXPORT int zsocket_recovery_ivl_msec (void *zocket); +CZMQ_EXPORT int zsocket_mcast_loop (void *zocket); +# if (ZMQ_VERSION_MINOR == 2) +CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); +# endif +# if (ZMQ_VERSION_MINOR == 2) +CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); +# endif +CZMQ_EXPORT int zsocket_sndbuf (void *zocket); +CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); +CZMQ_EXPORT int zsocket_linger (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); +CZMQ_EXPORT int zsocket_backlog (void *zocket); +CZMQ_EXPORT int zsocket_type (void *zocket); +CZMQ_EXPORT int zsocket_rcvmore (void *zocket); +CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); +CZMQ_EXPORT int zsocket_events (void *zocket); + +// Set socket options +CZMQ_EXPORT void zsocket_set_hwm (void *zocket, int hwm); +CZMQ_EXPORT void zsocket_set_swap (void *zocket, int swap); +CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); +CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); +CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); +CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); +CZMQ_EXPORT void zsocket_set_recovery_ivl_msec (void *zocket, int recovery_ivl_msec); +CZMQ_EXPORT void zsocket_set_mcast_loop (void *zocket, int mcast_loop); +# if (ZMQ_VERSION_MINOR == 2) +CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); +# endif +# if (ZMQ_VERSION_MINOR == 2) +CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); +# endif +CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); +CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); +CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); +CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); +CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); +CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); +CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); +CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); +#endif + +// Self test of this class +CZMQ_EXPORT void zsockopt_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zstr.h b/phonelibs/zmq/aarch64/include/zstr.h new file mode 100644 index 00000000000000..3d3f1a862ad7e5 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zstr.h @@ -0,0 +1,115 @@ +/* ========================================================================= + zstr - sending and receiving strings + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSTR_H_INCLUDED__ +#define __ZSTR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zstr.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Receive C string from socket. Caller must free returned string using +// zstr_free(). Returns NULL if the context is being terminated or the +// process was interrupted. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zstr_recv (void *source); + +// Receive a series of strings (until NULL) from multipart data. +// Each string is allocated and filled with string data; if there +// are not enough frames, unallocated strings are set to NULL. +// Returns -1 if the message could not be read, else returns the +// number of strings filled, zero or more. Free each returned string +// using zstr_free(). If not enough strings are provided, remaining +// multipart frames in the message are dropped. +CZMQ_EXPORT int + zstr_recvx (void *source, char **string_p, ...); + +// Send a C string to a socket, as a frame. The string is sent without +// trailing null byte; to read this you can use zstr_recv, or a similar +// method that adds a null terminator on the received string. String +// may be NULL, which is sent as "". +CZMQ_EXPORT int + zstr_send (void *dest, const char *string); + +// Send a C string to a socket, as zstr_send(), with a MORE flag, so that +// you can send further strings in the same multi-part message. +CZMQ_EXPORT int + zstr_sendm (void *dest, const char *string); + +// Send a formatted string to a socket. Note that you should NOT use +// user-supplied strings in the format (they may contain '%' which +// will create security holes). +CZMQ_EXPORT int + zstr_sendf (void *dest, const char *format, ...); + +// Send a formatted string to a socket, as for zstr_sendf(), with a +// MORE flag, so that you can send further strings in the same multi-part +// message. +CZMQ_EXPORT int + zstr_sendfm (void *dest, const char *format, ...); + +// Send a series of strings (until NULL) as multipart data +// Returns 0 if the strings could be sent OK, or -1 on error. +CZMQ_EXPORT int + zstr_sendx (void *dest, const char *string, ...); + +// Free a provided string, and nullify the parent pointer. Safe to call on +// a null pointer. +CZMQ_EXPORT void + zstr_free (char **string_p); + +// Self test of this class. +CZMQ_EXPORT void + zstr_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Accepts a void pointer and returns a fresh character string. If source +// is null, returns an empty string. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zstr_str (void *source); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT int + zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zstr_sendfm (void *dest, const char *format, ...) CHECK_PRINTF (2); +// @end + + +// DEPRECATED as poor style -- callers should use zloop or zpoller +// Receive C string from socket, if socket had input ready. Caller must +// free returned string using zstr_free. Returns NULL if there was no input +// waiting, or if the context was terminated. Use zctx_interrupted to exit +// any loop that relies on this method. +CZMQ_EXPORT char * + zstr_recv_nowait (void *source); + +// Compiler hints +CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zsys.h b/phonelibs/zmq/aarch64/include/zsys.h new file mode 100644 index 00000000000000..97f88a9555b8e0 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zsys.h @@ -0,0 +1,386 @@ +/* ========================================================================= + zsys - system-level methods + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSYS_H_INCLUDED__ +#define __ZSYS_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#define UDP_FRAME_MAX 255 // Max size of UDP frame + +// Callback for interrupt signal handler +typedef void (zsys_handler_fn) (int signal_value); + +// Initialize CZMQ zsys layer; this happens automatically when you create +// a socket or an actor; however this call lets you force initialization +// earlier, so e.g. logging is properly set-up before you start working. +// Not threadsafe, so call only from main thread. Safe to call multiple +// times. Returns global CZMQ context. +CZMQ_EXPORT void * + zsys_init (void); + +// Optionally shut down the CZMQ zsys layer; this normally happens automatically +// when the process exits; however this call lets you force a shutdown +// earlier, avoiding any potential problems with atexit() ordering, especially +// with Windows dlls. +CZMQ_EXPORT void + zsys_shutdown (void); + +// Get a new ZMQ socket, automagically creating a ZMQ context if this is +// the first time. Caller is responsible for destroying the ZMQ socket +// before process exits, to avoid a ZMQ deadlock. Note: you should not use +// this method in CZMQ apps, use zsock_new() instead. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void * + zsys_socket (int type, const char *filename, size_t line_nbr); + +// Destroy/close a ZMQ socket. You should call this for every socket you +// create using zsys_socket(). +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_close (void *handle, const char *filename, size_t line_nbr); + +// Return ZMQ socket name for socket type +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT char * + zsys_sockname (int socktype); + +// Create a pipe, which consists of two PAIR sockets connected over inproc. +// The pipe is configured to use the zsys_pipehwm setting. Returns the +// frontend socket successful, NULL if failed. +CZMQ_EXPORT zsock_t * + zsys_create_pipe (zsock_t **backend_p); + +// Set interrupt handler; this saves the default handlers so that a +// zsys_handler_reset () can restore them. If you call this multiple times +// then the last handler will take affect. If handler_fn is NULL, disables +// default SIGINT/SIGTERM handling in CZMQ. +CZMQ_EXPORT void + zsys_handler_set (zsys_handler_fn *handler_fn); + +// Reset interrupt handler, call this at exit if needed +CZMQ_EXPORT void + zsys_handler_reset (void); + +// Set default interrupt handler, so Ctrl-C or SIGTERM will set +// zsys_interrupted. Idempotent; safe to call multiple times. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void + zsys_catch_interrupts (void); + +// Return 1 if file exists, else zero +CZMQ_EXPORT bool + zsys_file_exists (const char *filename); + +// Return size of file, or -1 if not found +CZMQ_EXPORT ssize_t + zsys_file_size (const char *filename); + +// Return file modification time. Returns 0 if the file does not exist. +CZMQ_EXPORT time_t + zsys_file_modified (const char *filename); + +// Return file mode; provides at least support for the POSIX S_ISREG(m) +// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. +// Returns a mode_t cast to int, or -1 in case of error. +CZMQ_EXPORT int + zsys_file_mode (const char *filename); + +// Delete file. Does not complain if the file is absent +CZMQ_EXPORT int + zsys_file_delete (const char *filename); + +// Check if file is 'stable' +CZMQ_EXPORT bool + zsys_file_stable (const char *filename); + +// Create a file path if it doesn't exist. The file path is treated as a +// printf format. +CZMQ_EXPORT int + zsys_dir_create (const char *pathname, ...); + +// Remove a file path if empty; the pathname is treated as printf format. +CZMQ_EXPORT int + zsys_dir_delete (const char *pathname, ...); + +// Move to a specified working directory. Returns 0 if OK, -1 if this failed. +CZMQ_EXPORT int + zsys_dir_change (const char *pathname); + +// Set private file creation mode; all files created from here will be +// readable/writable by the owner only. +CZMQ_EXPORT void + zsys_file_mode_private (void); + +// Reset default file creation mode; all files created from here will use +// process file mode defaults. +CZMQ_EXPORT void + zsys_file_mode_default (void); + +// Return the CZMQ version for run-time API detection; returns version +// number into provided fields, providing reference isn't null in each case. +CZMQ_EXPORT void + zsys_version (int *major, int *minor, int *patch); + +// Format a string using printf formatting, returning a freshly allocated +// buffer. If there was insufficient memory, returns NULL. Free the returned +// string using zstr_free(). +CZMQ_EXPORT char * + zsys_sprintf (const char *format, ...); + +// Format a string with a va_list argument, returning a freshly allocated +// buffer. If there was insufficient memory, returns NULL. Free the returned +// string using zstr_free(). +CZMQ_EXPORT char * + zsys_vprintf (const char *format, va_list argptr); + +// Create UDP beacon socket; if the routable option is true, uses +// multicast (not yet implemented), else uses broadcast. This method +// and related ones might _eventually_ be moved to a zudp class. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT SOCKET + zsys_udp_new (bool routable); + +// Close a UDP socket +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_udp_close (SOCKET handle); + +// Send zframe to UDP socket, return -1 if sending failed due to +// interface having disappeared (happens easily with WiFi) +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); + +// Receive zframe from UDP socket, and set address of peer that sent it +// The peername must be a char [INET_ADDRSTRLEN] array. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT zframe_t * + zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); + +// Handle an I/O error on some socket operation; will report and die on +// fatal errors, and continue silently on "try again" errors. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void + zsys_socket_error (const char *reason); + +// Return current host name, for use in public tcp:// endpoints. Caller gets +// a freshly allocated string, should free it using zstr_free(). If the host +// name is not resolvable, returns NULL. +CZMQ_EXPORT char * + zsys_hostname (void); + +// Move the current process into the background. The precise effect depends +// on the operating system. On POSIX boxes, moves to a specified working +// directory (if specified), closes all file handles, reopens stdin, stdout, +// and stderr to the null device, and sets the process to ignore SIGHUP. On +// Windows, does nothing. Returns 0 if OK, -1 if there was an error. +CZMQ_EXPORT int + zsys_daemonize (const char *workdir); + +// Drop the process ID into the lockfile, with exclusive lock, and switch +// the process to the specified group and/or user. Any of the arguments +// may be null, indicating a no-op. Returns 0 on success, -1 on failure. +// Note if you combine this with zsys_daemonize, run after, not before +// that method, or the lockfile will hold the wrong process ID. +CZMQ_EXPORT int + zsys_run_as (const char *lockfile, const char *group, const char *user); + +// Returns true if the underlying libzmq supports CURVE security. +// Uses a heuristic probe according to the version of libzmq being used. +CZMQ_EXPORT bool + zsys_has_curve (void); + +// Configure the number of I/O threads that ZeroMQ will use. A good +// rule of thumb is one thread per gigabit of traffic in or out. The +// default is 1, sufficient for most applications. If the environment +// variable ZSYS_IO_THREADS is defined, that provides the default. +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zsys_set_io_threads (size_t io_threads); + +// Configure the number of sockets that ZeroMQ will allow. The default +// is 1024. The actual limit depends on the system, and you can query it +// by using zsys_socket_limit (). A value of zero means "maximum". +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zsys_set_max_sockets (size_t max_sockets); + +// Return maximum number of ZeroMQ sockets that the system will support. +CZMQ_EXPORT size_t + zsys_socket_limit (void); + +// Configure the default linger timeout in msecs for new zsock instances. +// You can also set this separately on each zsock_t instance. The default +// linger time is zero, i.e. any pending messages will be dropped. If the +// environment variable ZSYS_LINGER is defined, that provides the default. +// Note that process exit will typically be delayed by the linger time. +CZMQ_EXPORT void + zsys_set_linger (size_t linger); + +// Configure the default outgoing pipe limit (HWM) for new zsock instances. +// You can also set this separately on each zsock_t instance. The default +// HWM is 1,000, on all versions of ZeroMQ. If the environment variable +// ZSYS_SNDHWM is defined, that provides the default. Note that a value of +// zero means no limit, i.e. infinite memory consumption. +CZMQ_EXPORT void + zsys_set_sndhwm (size_t sndhwm); + +// Configure the default incoming pipe limit (HWM) for new zsock instances. +// You can also set this separately on each zsock_t instance. The default +// HWM is 1,000, on all versions of ZeroMQ. If the environment variable +// ZSYS_RCVHWM is defined, that provides the default. Note that a value of +// zero means no limit, i.e. infinite memory consumption. +CZMQ_EXPORT void + zsys_set_rcvhwm (size_t rcvhwm); + +// Configure the default HWM for zactor internal pipes; this is set on both +// ends of the pipe, for outgoing messages only (sndhwm). The default HWM is +// 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is +// defined, that provides the default. Note that a value of zero means no +// limit, i.e. infinite memory consumption. +CZMQ_EXPORT void + zsys_set_pipehwm (size_t pipehwm); + +// Return the HWM for zactor internal pipes. +CZMQ_EXPORT size_t + zsys_pipehwm (void); + +// Configure use of IPv6 for new zsock instances. By default sockets accept +// and make only IPv4 connections. When you enable IPv6, sockets will accept +// and connect to both IPv4 and IPv6 peers. You can override the setting on +// each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the +// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the +// default. Note: has no effect on ZMQ v2. +CZMQ_EXPORT void + zsys_set_ipv6 (int ipv6); + +// Return use of IPv6 for zsock instances. +CZMQ_EXPORT int + zsys_ipv6 (void); + +// Set network interface name to use for broadcasts, particularly zbeacon. +// This lets the interface be configured for test environments where required. +// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is +// the default when there is no specified interface. If the environment +// variable ZSYS_INTERFACE is set, use that as the default interface name. +// Setting the interface to "*" means "use all available interfaces". +CZMQ_EXPORT void + zsys_set_interface (const char *value); + +// Return network interface to use for broadcasts, or "" if none was set. +CZMQ_EXPORT const char * + zsys_interface (void); + +// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. +// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses +// on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, +// use that as the default IPv6 address. +CZMQ_EXPORT void + zsys_set_ipv6_address (const char *value); + +// Return IPv6 address to use for zbeacon reception, or "" if none was set. +CZMQ_EXPORT const char * + zsys_ipv6_address (void); + +// Set IPv6 milticast address to use for sending zbeacon messages. This needs +// to be set if IPv6 is enabled. If the environment variable +// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast +// address. +CZMQ_EXPORT void + zsys_set_ipv6_mcast_address (const char *value); + +// Return IPv6 multicast address to use for sending zbeacon, or "" if none was +// set. +CZMQ_EXPORT const char * + zsys_ipv6_mcast_address (void); + +// Configure the automatic use of pre-allocated FDs when creating new sockets. +// If 0 (default), nothing will happen. Else, when a new socket is bound, the +// system API will be used to check if an existing pre-allocated FD with a +// matching port (if TCP) or path (if IPC) exists, and if it does it will be +// set via the ZMQ_USE_FD socket option so that the library will use it +// instead of creating a new socket. +CZMQ_EXPORT void + zsys_set_auto_use_fd (int auto_use_fd); + +// Return use of automatic pre-allocated FDs for zsock instances. +CZMQ_EXPORT int + zsys_auto_use_fd (void); + +// Set log identity, which is a string that prefixes all log messages sent +// by this process. The log identity defaults to the environment variable +// ZSYS_LOGIDENT, if that is set. +CZMQ_EXPORT void + zsys_set_logident (const char *value); + +// Set stream to receive log traffic. By default, log traffic is sent to +// stdout. If you set the stream to NULL, no stream will receive the log +// traffic (it may still be sent to the system facility). +CZMQ_EXPORT void + zsys_set_logstream (FILE *stream); + +// Sends log output to a PUB socket bound to the specified endpoint. To +// collect such log output, create a SUB socket, subscribe to the traffic +// you care about, and connect to the endpoint. Log traffic is sent as a +// single string frame, in the same format as when sent to stdout. The +// log system supports a single sender; multiple calls to this method will +// bind the same sender to multiple endpoints. To disable the sender, call +// this method with a null argument. +CZMQ_EXPORT void + zsys_set_logsender (const char *endpoint); + +// Enable or disable logging to the system facility (syslog on POSIX boxes, +// event log on Windows). By default this is disabled. +CZMQ_EXPORT void + zsys_set_logsystem (bool logsystem); + +// Log error condition - highest priority +CZMQ_EXPORT void + zsys_error (const char *format, ...); + +// Log warning condition - high priority +CZMQ_EXPORT void + zsys_warning (const char *format, ...); + +// Log normal, but significant, condition - normal priority +CZMQ_EXPORT void + zsys_notice (const char *format, ...); + +// Log informational message - low priority +CZMQ_EXPORT void + zsys_info (const char *format, ...); + +// Log debug-level message - lowest priority +CZMQ_EXPORT void + zsys_debug (const char *format, ...); + +// Self test of this class +CZMQ_EXPORT void + zsys_test (bool verbose); + +// Global signal indicator, TRUE when user presses Ctrl-C or the process +// gets a SIGTERM signal. +CZMQ_EXPORT extern volatile int zsys_interrupted; +// Deprecated name for this variable +CZMQ_EXPORT extern volatile int zctx_interrupted; +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zthread.h b/phonelibs/zmq/aarch64/include/zthread.h new file mode 100644 index 00000000000000..fc0602dd9ff483 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zthread.h @@ -0,0 +1,50 @@ +/* ========================================================================= + zthread - working with system threads (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZTHREAD_H_INCLUDED__ +#define __ZTHREAD_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Detached threads follow POSIX pthreads API +typedef void *(zthread_detached_fn) (void *args); + +// Attached threads get context and pipe from parent +typedef void (zthread_attached_fn) (void *args, zctx_t *ctx, void *pipe); + +// Create a detached thread. A detached thread operates autonomously +// and is used to simulate a separate process. It gets no ctx, and no +// pipe. +CZMQ_EXPORT int + zthread_new (zthread_detached_fn *thread_fn, void *args); + +// Create an attached thread. An attached thread gets a ctx and a PAIR +// pipe back to its parent. It must monitor its pipe, and exit if the +// pipe becomes unreadable. Do not destroy the ctx, the thread does this +// automatically when it ends. +CZMQ_EXPORT void * + zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args); + +// Self test of this class +CZMQ_EXPORT void + zthread_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/ztimerset.h b/phonelibs/zmq/aarch64/include/ztimerset.h new file mode 100644 index 00000000000000..29633fafdbdd30 --- /dev/null +++ b/phonelibs/zmq/aarch64/include/ztimerset.h @@ -0,0 +1,90 @@ +/* ========================================================================= + ztimerset - timer set + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef ZTIMERSET_H_INCLUDED +#define ZTIMERSET_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/ztimerset.api" to make changes. +// @interface +// This is a draft class, and may change without notice. It is disabled in +// stable builds by default. If you use this in applications, please ask +// for it to be pushed to stable state. Use --enable-drafts to enable. +#ifdef CZMQ_BUILD_DRAFT_API +// Callback function for timer event. +typedef void (ztimerset_fn) ( + int timer_id, void *arg); + +// *** Draft method, for development use, may change without warning *** +// Create new timer set. +CZMQ_EXPORT ztimerset_t * + ztimerset_new (void); + +// *** Draft method, for development use, may change without warning *** +// Destroy a timer set +CZMQ_EXPORT void + ztimerset_destroy (ztimerset_t **self_p); + +// *** Draft method, for development use, may change without warning *** +// Add a timer to the set. Returns timer id if OK, -1 on failure. +CZMQ_EXPORT int + ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); + +// *** Draft method, for development use, may change without warning *** +// Cancel a timer. Returns 0 if OK, -1 on failure. +CZMQ_EXPORT int + ztimerset_cancel (ztimerset_t *self, int timer_id); + +// *** Draft method, for development use, may change without warning *** +// Set timer interval. Returns 0 if OK, -1 on failure. +// This method is slow, canceling the timer and adding a new one yield better performance. +CZMQ_EXPORT int + ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); + +// *** Draft method, for development use, may change without warning *** +// Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. +// This method is slow, canceling the timer and adding a new one yield better performance. +CZMQ_EXPORT int + ztimerset_reset (ztimerset_t *self, int timer_id); + +// *** Draft method, for development use, may change without warning *** +// Return the time until the next interval. +// Should be used as timeout parameter for the zpoller wait method. +// The timeout is in msec. +CZMQ_EXPORT int + ztimerset_timeout (ztimerset_t *self); + +// *** Draft method, for development use, may change without warning *** +// Invoke callback function of all timers which their interval has elapsed. +// Should be call after zpoller wait method. +// Returns 0 if OK, -1 on failure. +CZMQ_EXPORT int + ztimerset_execute (ztimerset_t *self); + +// *** Draft method, for development use, may change without warning *** +// Self test of this class. +CZMQ_EXPORT void + ztimerset_test (bool verbose); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/ztrie.h b/phonelibs/zmq/aarch64/include/ztrie.h new file mode 100644 index 00000000000000..6fd53234b1274c --- /dev/null +++ b/phonelibs/zmq/aarch64/include/ztrie.h @@ -0,0 +1,106 @@ +/* ========================================================================= + ztrie - simple trie for tokenizable strings + + Copyright (c) 1991-2012 iMatix Corporation -- http://www.imatix.com + Copyright other contributors as noted in the AUTHORS file. + + This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef ZTRIE_H_INCLUDED +#define ZTRIE_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/ztrie.api" to make changes. +// @interface +// This is a draft class, and may change without notice. It is disabled in +// stable builds by default. If you use this in applications, please ask +// for it to be pushed to stable state. Use --enable-drafts to enable. +#ifdef CZMQ_BUILD_DRAFT_API +// Callback function for ztrie_node to destroy node data. +typedef void (ztrie_destroy_data_fn) ( + void **data); + +// *** Draft method, for development use, may change without warning *** +// Creates a new ztrie. +CZMQ_EXPORT ztrie_t * + ztrie_new (char delimiter); + +// *** Draft method, for development use, may change without warning *** +// Destroy the ztrie. +CZMQ_EXPORT void + ztrie_destroy (ztrie_t **self_p); + +// *** Draft method, for development use, may change without warning *** +// Inserts a new route into the tree and attaches the data. Returns -1 +// if the route already exists, otherwise 0. This method takes ownership of +// the provided data if a destroy_data_fn is provided. +CZMQ_EXPORT int + ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); + +// *** Draft method, for development use, may change without warning *** +// Removes a route from the trie and destroys its data. Returns -1 if the +// route does not exists, otherwise 0. +// the start of the list call zlist_first (). Advances the cursor. +CZMQ_EXPORT int + ztrie_remove_route (ztrie_t *self, const char *path); + +// *** Draft method, for development use, may change without warning *** +// Returns true if the path matches a route in the tree, otherwise false. +CZMQ_EXPORT bool + ztrie_matches (ztrie_t *self, const char *path); + +// *** Draft method, for development use, may change without warning *** +// Returns the data of a matched route from last ztrie_matches. If the path +// did not match, returns NULL. Do not delete the data as it's owned by +// ztrie. +CZMQ_EXPORT void * + ztrie_hit_data (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Returns the count of parameters that a matched route has. +CZMQ_EXPORT size_t + ztrie_hit_parameter_count (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Returns the parameters of a matched route with named regexes from last +// ztrie_matches. If the path did not match or the route did not contain any +// named regexes, returns NULL. +CZMQ_EXPORT zhashx_t * + ztrie_hit_parameters (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Returns the asterisk matched part of a route, if there has been no match +// or no asterisk match, returns NULL. +CZMQ_EXPORT const char * + ztrie_hit_asterisk_match (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Print the trie +CZMQ_EXPORT void + ztrie_print (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Self test of this class. +CZMQ_EXPORT void + ztrie_test (bool verbose); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/include/zuuid.h b/phonelibs/zmq/aarch64/include/zuuid.h new file mode 100644 index 00000000000000..afc1104fea952b --- /dev/null +++ b/phonelibs/zmq/aarch64/include/zuuid.h @@ -0,0 +1,96 @@ +/* ========================================================================= + zuuid - UUID support class + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZUUID_H_INCLUDED__ +#define __ZUUID_H_INCLUDED__ + +#define ZUUID_LEN 16 +#define ZUUID_STR_LEN (ZUUID_LEN * 2) + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zuuid.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create a new UUID object. +CZMQ_EXPORT zuuid_t * + zuuid_new (void); + +// Create UUID object from supplied ZUUID_LEN-octet value. +CZMQ_EXPORT zuuid_t * + zuuid_new_from (const byte *source); + +// Destroy a specified UUID object. +CZMQ_EXPORT void + zuuid_destroy (zuuid_t **self_p); + +// Set UUID to new supplied ZUUID_LEN-octet value. +CZMQ_EXPORT void + zuuid_set (zuuid_t *self, const byte *source); + +// Set UUID to new supplied string value skipping '-' and '{' '}' +// optional delimiters. Return 0 if OK, else returns -1. +CZMQ_EXPORT int + zuuid_set_str (zuuid_t *self, const char *source); + +// Return UUID binary data. +CZMQ_EXPORT const byte * + zuuid_data (zuuid_t *self); + +// Return UUID binary size +CZMQ_EXPORT size_t + zuuid_size (zuuid_t *self); + +// Returns UUID as string +CZMQ_EXPORT const char * + zuuid_str (zuuid_t *self); + +// Return UUID in the canonical string format: 8-4-4-4-12, in lower +// case. Caller does not modify or free returned value. See +// http://en.wikipedia.org/wiki/Universally_unique_identifier +CZMQ_EXPORT const char * + zuuid_str_canonical (zuuid_t *self); + +// Store UUID blob in target array +CZMQ_EXPORT void + zuuid_export (zuuid_t *self, byte *target); + +// Check if UUID is same as supplied value +CZMQ_EXPORT bool + zuuid_eq (zuuid_t *self, const byte *compare); + +// Check if UUID is different from supplied value +CZMQ_EXPORT bool + zuuid_neq (zuuid_t *self, const byte *compare); + +// Make copy of UUID object; if uuid is null, or memory was exhausted, +// returns null. +CZMQ_EXPORT zuuid_t * + zuuid_dup (zuuid_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zuuid_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/aarch64/lib/libczmq.a b/phonelibs/zmq/aarch64/lib/libczmq.a new file mode 100644 index 00000000000000..2d2a251c2f453e Binary files /dev/null and b/phonelibs/zmq/aarch64/lib/libczmq.a differ diff --git a/phonelibs/zmq/aarch64/lib/libczmq.la b/phonelibs/zmq/aarch64/lib/libczmq.la new file mode 100755 index 00000000000000..7eb675e692d303 --- /dev/null +++ b/phonelibs/zmq/aarch64/lib/libczmq.la @@ -0,0 +1,41 @@ +# libczmq.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.6 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libczmq.so' + +# Names of this library. +library_names='libczmq.so' + +# The name of the static archive. +old_library='libczmq.a' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -L/Users/batman/src/czmq/builds/android/prefix/aarch64-linux-android-4.9/lib -L/opt/android-ndk/platforms/android-21/arch-arm64/usr/lib -L/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a -L/Users/batman/src/libzmq/builds/android/prefix/aarch64-linux-android-4.9/lib /Users/batman/src/libzmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libzmq.la -llog -lc -lgcc -ldl -lm -lgnustl_shared' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libczmq. +current=3 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/batman/src/czmq/builds/android/prefix/aarch64-linux-android-4.9/lib' diff --git a/phonelibs/zmq/aarch64/lib/libczmq.so b/phonelibs/zmq/aarch64/lib/libczmq.so new file mode 100755 index 00000000000000..6b662a197f2c93 Binary files /dev/null and b/phonelibs/zmq/aarch64/lib/libczmq.so differ diff --git a/phonelibs/zmq/aarch64/lib/libzmq.a b/phonelibs/zmq/aarch64/lib/libzmq.a new file mode 100644 index 00000000000000..b764af7b6136e6 Binary files /dev/null and b/phonelibs/zmq/aarch64/lib/libzmq.a differ diff --git a/phonelibs/zmq/aarch64/lib/libzmq.la b/phonelibs/zmq/aarch64/lib/libzmq.la new file mode 100755 index 00000000000000..d7d420a4bd98f2 --- /dev/null +++ b/phonelibs/zmq/aarch64/lib/libzmq.la @@ -0,0 +1,41 @@ +# libzmq.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.6 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libzmq.so' + +# Names of this library. +library_names='libzmq.so' + +# The name of the static archive. +old_library='libzmq.a' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -L/Users/batman/src/libzmq/builds/android/prefix/aarch64-linux-android-4.9/lib -L/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a -lgnustl_shared' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libzmq. +current=5 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/batman/src/libzmq/builds/android/prefix/aarch64-linux-android-4.9/lib' diff --git a/phonelibs/zmq/aarch64/lib/libzmq.so b/phonelibs/zmq/aarch64/lib/libzmq.so new file mode 100755 index 00000000000000..909c7f43a6a5f3 Binary files /dev/null and b/phonelibs/zmq/aarch64/lib/libzmq.so differ diff --git a/phonelibs/zmq/arm/include/czmq.h b/phonelibs/zmq/arm/include/czmq.h new file mode 100644 index 00000000000000..ba21aa3bd1efdd --- /dev/null +++ b/phonelibs/zmq/arm/include/czmq.h @@ -0,0 +1,31 @@ +/* ========================================================================= + CZMQ - a high-level binding in C for ZeroMQ + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __CZMQ_H_INCLUDED__ +#define __CZMQ_H_INCLUDED__ + +// These are signatures for handler functions that customize the +// behavior of CZMQ containers. These are shared between all CZMQ +// container types. + +// -- destroy an item +typedef void (czmq_destructor) (void **item); +// -- duplicate an item +typedef void *(czmq_duplicator) (const void *item); +// - compare two items, for sorting +typedef int (czmq_comparator) (const void *item1, const void *item2); + +// Include the project library file +#include "czmq_library.h" + +#endif diff --git a/phonelibs/zmq/arm/include/czmq_library.h b/phonelibs/zmq/arm/include/czmq_library.h new file mode 100644 index 00000000000000..be348db3e9a414 --- /dev/null +++ b/phonelibs/zmq/arm/include/czmq_library.h @@ -0,0 +1,199 @@ +/* ========================================================================= + czmq - generated layer of public API + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ + ========================================================================= +*/ + +#ifndef CZMQ_LIBRARY_H_INCLUDED +#define CZMQ_LIBRARY_H_INCLUDED + +// Set up environment for the application +#include "czmq_prelude.h" + +// External dependencies +#include + +// CZMQ version macros for compile-time API detection +#define CZMQ_VERSION_MAJOR 3 +#define CZMQ_VERSION_MINOR 0 +#define CZMQ_VERSION_PATCH 3 + +#define CZMQ_MAKE_VERSION(major, minor, patch) \ + ((major) * 10000 + (minor) * 100 + (patch)) +#define CZMQ_VERSION \ + CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH) + +#if defined (__WINDOWS__) +# if defined CZMQ_STATIC +# define CZMQ_EXPORT +# elif defined CZMQ_INTERNAL_BUILD +# if defined DLL_EXPORT +# define CZMQ_EXPORT __declspec(dllexport) +# else +# define CZMQ_EXPORT +# endif +# elif defined CZMQ_EXPORTS +# define CZMQ_EXPORT __declspec(dllexport) +# else +# define CZMQ_EXPORT __declspec(dllimport) +# endif +#else +# define CZMQ_EXPORT +#endif + +// Opaque class structures to allow forward references +// These classes are stable or legacy and built in all releases +typedef struct _zactor_t zactor_t; +#define ZACTOR_T_DEFINED +typedef struct _zarmour_t zarmour_t; +#define ZARMOUR_T_DEFINED +typedef struct _zcert_t zcert_t; +#define ZCERT_T_DEFINED +typedef struct _zcertstore_t zcertstore_t; +#define ZCERTSTORE_T_DEFINED +typedef struct _zchunk_t zchunk_t; +#define ZCHUNK_T_DEFINED +typedef struct _zclock_t zclock_t; +#define ZCLOCK_T_DEFINED +typedef struct _zconfig_t zconfig_t; +#define ZCONFIG_T_DEFINED +typedef struct _zdigest_t zdigest_t; +#define ZDIGEST_T_DEFINED +typedef struct _zdir_t zdir_t; +#define ZDIR_T_DEFINED +typedef struct _zdir_patch_t zdir_patch_t; +#define ZDIR_PATCH_T_DEFINED +typedef struct _zfile_t zfile_t; +#define ZFILE_T_DEFINED +typedef struct _zframe_t zframe_t; +#define ZFRAME_T_DEFINED +typedef struct _zhash_t zhash_t; +#define ZHASH_T_DEFINED +typedef struct _zhashx_t zhashx_t; +#define ZHASHX_T_DEFINED +typedef struct _ziflist_t ziflist_t; +#define ZIFLIST_T_DEFINED +typedef struct _zlist_t zlist_t; +#define ZLIST_T_DEFINED +typedef struct _zlistx_t zlistx_t; +#define ZLISTX_T_DEFINED +typedef struct _zloop_t zloop_t; +#define ZLOOP_T_DEFINED +typedef struct _zmsg_t zmsg_t; +#define ZMSG_T_DEFINED +typedef struct _zpoller_t zpoller_t; +#define ZPOLLER_T_DEFINED +typedef struct _zsock_t zsock_t; +#define ZSOCK_T_DEFINED +typedef struct _zstr_t zstr_t; +#define ZSTR_T_DEFINED +typedef struct _zuuid_t zuuid_t; +#define ZUUID_T_DEFINED +typedef struct _zauth_t zauth_t; +#define ZAUTH_T_DEFINED +typedef struct _zbeacon_t zbeacon_t; +#define ZBEACON_T_DEFINED +typedef struct _zgossip_t zgossip_t; +#define ZGOSSIP_T_DEFINED +typedef struct _zmonitor_t zmonitor_t; +#define ZMONITOR_T_DEFINED +typedef struct _zproxy_t zproxy_t; +#define ZPROXY_T_DEFINED +typedef struct _zrex_t zrex_t; +#define ZREX_T_DEFINED +typedef struct _zsys_t zsys_t; +#define ZSYS_T_DEFINED +typedef struct _zauth_v2_t zauth_v2_t; +#define ZAUTH_V2_T_DEFINED +typedef struct _zbeacon_v2_t zbeacon_v2_t; +#define ZBEACON_V2_T_DEFINED +typedef struct _zctx_t zctx_t; +#define ZCTX_T_DEFINED +typedef struct _zmonitor_v2_t zmonitor_v2_t; +#define ZMONITOR_V2_T_DEFINED +typedef struct _zmutex_t zmutex_t; +#define ZMUTEX_T_DEFINED +typedef struct _zproxy_v2_t zproxy_v2_t; +#define ZPROXY_V2_T_DEFINED +typedef struct _zsocket_t zsocket_t; +#define ZSOCKET_T_DEFINED +typedef struct _zsockopt_t zsockopt_t; +#define ZSOCKOPT_T_DEFINED +typedef struct _zthread_t zthread_t; +#define ZTHREAD_T_DEFINED +// Draft classes are by default not built in stable releases +#ifdef CZMQ_BUILD_DRAFT_API +typedef struct _zproc_t zproc_t; +#define ZPROC_T_DEFINED +typedef struct _ztimerset_t ztimerset_t; +#define ZTIMERSET_T_DEFINED +typedef struct _ztrie_t ztrie_t; +#define ZTRIE_T_DEFINED +#endif // CZMQ_BUILD_DRAFT_API + + +// Public classes, each with its own header file +#include "zactor.h" +#include "zarmour.h" +#include "zcert.h" +#include "zcertstore.h" +#include "zchunk.h" +#include "zclock.h" +#include "zconfig.h" +#include "zdigest.h" +#include "zdir.h" +#include "zdir_patch.h" +#include "zfile.h" +#include "zframe.h" +#include "zhash.h" +#include "zhashx.h" +#include "ziflist.h" +#include "zlist.h" +#include "zlistx.h" +#include "zloop.h" +#include "zmsg.h" +#include "zpoller.h" +#include "zsock.h" +#include "zstr.h" +#include "zuuid.h" +#include "zauth.h" +#include "zbeacon.h" +#include "zgossip.h" +#include "zmonitor.h" +#include "zproxy.h" +#include "zrex.h" +#include "zsys.h" +#include "zauth_v2.h" +#include "zbeacon_v2.h" +#include "zctx.h" +#include "zmonitor_v2.h" +#include "zmutex.h" +#include "zproxy_v2.h" +#include "zsocket.h" +#include "zsockopt.h" +#include "zthread.h" +#ifdef CZMQ_BUILD_DRAFT_API +#include "zproc.h" +#include "ztimerset.h" +#include "ztrie.h" +#endif // CZMQ_BUILD_DRAFT_API + +#endif +/* +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ +*/ diff --git a/phonelibs/zmq/arm/include/czmq_prelude.h b/phonelibs/zmq/arm/include/czmq_prelude.h new file mode 100644 index 00000000000000..e9ceb691e839ef --- /dev/null +++ b/phonelibs/zmq/arm/include/czmq_prelude.h @@ -0,0 +1,641 @@ +/* ========================================================================= + czmq_prelude.h - CZMQ environment + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __CZMQ_PRELUDE_H_INCLUDED__ +#define __CZMQ_PRELUDE_H_INCLUDED__ + +//- Establish the compiler and computer system ------------------------------ +/* + * Defines zero or more of these symbols, for use in any non-portable + * code: + * + * __WINDOWS__ Microsoft C/C++ with Windows calls + * __MSDOS__ System is MS-DOS (set if __WINDOWS__ set) + * __VMS__ System is VAX/VMS or Alpha/OpenVMS + * __UNIX__ System is UNIX + * __OS2__ System is OS/2 + * + * __IS_32BIT__ OS/compiler is 32 bits + * __IS_64BIT__ OS/compiler is 64 bits + * + * When __UNIX__ is defined, we also define exactly one of these: + * + * __UTYPE_AUX Apple AUX + * __UTYPE_BEOS BeOS + * __UTYPE_BSDOS BSD/OS + * __UTYPE_DECALPHA Digital UNIX (Alpha) + * __UTYPE_IBMAIX IBM RS/6000 AIX + * __UTYPE_FREEBSD FreeBSD + * __UTYPE_HPUX HP/UX + * __UTYPE_ANDROID Android + * __UTYPE_LINUX Linux + * __UTYPE_GNU GNU/Hurd + * __UTYPE_MIPS MIPS (BSD 4.3/System V mixture) + * __UTYPE_NETBSD NetBSD + * __UTYPE_NEXT NeXT + * __UTYPE_OPENBSD OpenBSD + * __UTYPE_OSX Apple Macintosh OS X + * __UTYPE_IOS Apple iOS + * __UTYPE_QNX QNX + * __UTYPE_IRIX Silicon Graphics IRIX + * __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix) + * __UTYPE_SUNOS SunOS + * __UTYPE_SUNSOLARIS Sun Solaris + * __UTYPE_UNIXWARE SCO UnixWare + * ... these are the ones I know about so far. + * __UTYPE_GENERIC Any other UNIX + * + * When __VMS__ is defined, we may define one or more of these: + * + * __VMS_XOPEN Supports XOPEN functions + */ + +#if (defined (__64BIT__) || defined (__x86_64__)) +# define __IS_64BIT__ // May have 64-bit OS/compiler +#else +# define __IS_32BIT__ // Else assume 32-bit OS/compiler +#endif + +#if (defined WIN32 || defined _WIN32) +# undef __WINDOWS__ +# define __WINDOWS__ +# undef __MSDOS__ +# define __MSDOS__ +#endif + +#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__) +# undef __WINDOWS__ +# define __WINDOWS__ +# undef __MSDOS__ +# define __MSDOS__ +// Stop cheeky warnings about "deprecated" functions like fopen +# if _MSC_VER >= 1500 +# undef _CRT_SECURE_NO_DEPRECATE +# define _CRT_SECURE_NO_DEPRECATE +# pragma warning(disable: 4996) +# endif +#endif + +// MSDOS Microsoft C +// _MSC_VER Microsoft C +#if (defined (MSDOS) || defined (_MSC_VER)) +# undef __MSDOS__ +# define __MSDOS__ +# if (defined (_DEBUG) && !defined (DEBUG)) +# define DEBUG +# endif +#endif + +#if (defined (__EMX__) && defined (__i386__)) +# undef __OS2__ +# define __OS2__ +#endif + +// VMS VAX C (VAX/VMS) +// __VMS Dec C (Alpha/OpenVMS) +// __vax__ gcc +#if (defined (VMS) || defined (__VMS) || defined (__vax__)) +# undef __VMS__ +# define __VMS__ +# if (__VMS_VER >= 70000000) +# define __VMS_XOPEN +# endif +#endif + +// Try to define a __UTYPE_xxx symbol... +// unix SunOS at least +// __unix__ gcc +// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS +#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE)) +# if (!defined (__VMS__)) +# undef __UNIX__ +# define __UNIX__ +# if (defined (__alpha)) // Digital UNIX is 64-bit +# undef __IS_32BIT__ +# define __IS_64BIT__ +# define __UTYPE_DECALPHA +# endif +# endif +#endif + +#if (defined (_AUX)) +# define __UTYPE_AUX +# define __UNIX__ +#elif (defined (__BEOS__)) +# define __UTYPE_BEOS +# define __UNIX__ +#elif (defined (__hpux)) +# define __UTYPE_HPUX +# define __UNIX__ +# define _INCLUDE_HPUX_SOURCE +# define _INCLUDE_XOPEN_SOURCE +# define _INCLUDE_POSIX_SOURCE +#elif (defined (_AIX) || defined (AIX)) +# define __UTYPE_IBMAIX +# define __UNIX__ +#elif (defined (BSD) || defined (bsd)) +# define __UTYPE_BSDOS +# define __UNIX__ +#elif (defined (__ANDROID__)) +# define __UTYPE_ANDROID +# define __UNIX__ +#elif (defined (LINUX) || defined (linux) || defined (__linux__)) +# define __UTYPE_LINUX +# define __UNIX__ +# ifndef __NO_CTYPE +# define __NO_CTYPE // Suppress warnings on tolower() +# endif +# ifndef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix +# endif +#elif (defined (__GNU__)) +# define __UTYPE_GNU +# define __UNIX__ +#elif (defined (Mips)) +# define __UTYPE_MIPS +# define __UNIX__ +#elif (defined (FreeBSD) || defined (__FreeBSD__)) +# define __UTYPE_FREEBSD +# define __UNIX__ +#elif (defined (NetBSD) || defined (__NetBSD__)) +# define __UTYPE_NETBSD +# define __UNIX__ +#elif (defined (OpenBSD) || defined (__OpenBSD__)) +# define __UTYPE_OPENBSD +# define __UNIX__ +#elif (defined (APPLE) || defined (__APPLE__)) +# include +# define __UNIX__ +# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR +# define __UTYPE_IOS +# else +# define __UTYPE_OSX +# endif +#elif (defined (NeXT)) +# define __UTYPE_NEXT +# define __UNIX__ +#elif (defined (__QNX__)) +# define __UTYPE_QNX +# define __UNIX__ +#elif (defined (sgi)) +# define __UTYPE_IRIX +# define __UNIX__ +#elif (defined (sinix)) +# define __UTYPE_SINIX +# define __UNIX__ +#elif (defined (SOLARIS) || defined (__SRV4)) +# define __UTYPE_SUNSOLARIS +# define __UNIX__ +#elif (defined (SUNOS) || defined (SUN) || defined (sun)) +# define __UTYPE_SUNOS +# define __UNIX__ +#elif (defined (__USLC__) || defined (UnixWare)) +# define __UTYPE_UNIXWARE +# define __UNIX__ +#elif (defined (__CYGWIN__)) +# define __UTYPE_CYGWIN +# define __UNIX__ +#elif (defined (__UNIX__)) +# define __UTYPE_GENERIC +#endif + +//- Always include ZeroMQ headers ------------------------------------------- + +#include "zmq.h" +#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0)) +# include "zmq_utils.h" +#endif + +//- Standard ANSI include files --------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//- System-specific include files ------------------------------------------- + +#if (defined (__MSDOS__)) +# if (defined (__WINDOWS__)) +# if (_WIN32_WINNT < 0x0501) +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +# endif +# if (!defined (FD_SETSIZE)) +# define FD_SETSIZE 1024 // Max. filehandles/sockets +# endif +# include +# include +# include +# include +# include // For getnameinfo () +# include // For GetAdaptersAddresses () +# endif +# include +# include +# include +# include +# include +# include +# include +# include +#endif + +#if (defined (__UNIX__)) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include // Let CZMQ build with libzmq/3.x +# include // Must come before arpa/inet.h +# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \ + && (!defined (__UTYPE_HPUX)) +# include +# endif +# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS) +# include +# endif +# if (!defined (__UTYPE_BEOS)) +# include +# if (!defined (TCP_NODELAY)) +# include +# endif +# endif +# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX)) +# include +# endif +# if (defined (__UTYPE_BEOS)) +# include +# endif +# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \ + || (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L))) +# include +# endif +# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS)) +# include +# include // For monotonic clocks +# endif +# if (defined (__UTYPE_OSX)) +# include // For _NSGetEnviron() +# endif +# if (defined (__UTYPE_ANDROID)) +# include +# endif +# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD)) +# include +# endif +#endif + +#if (defined (__VMS__)) +# if (!defined (vaxc)) +# include // Not provided by Vax C +# endif +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif + +#if (defined (__OS2__)) +# include // Required near top +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include // Must come before arpa/inet.h +# include +# include +# if (!defined (TCP_NODELAY)) +# include +# endif +#endif + +// Add missing defines for non-POSIX systems +#ifndef S_IRUSR +# define S_IRUSR S_IREAD +#endif +#ifndef S_IWUSR +# define S_IWUSR S_IWRITE +#endif +#ifndef S_ISDIR +# define S_ISDIR(m) (((m) & S_IFDIR) != 0) +#endif +#ifndef S_ISREG +# define S_ISREG(m) (((m) & S_IFREG) != 0) +#endif + + +//- Check compiler data type sizes ------------------------------------------ + +#if (UCHAR_MAX != 0xFF) +# error "Cannot compile: must change definition of 'byte'." +#endif +#if (USHRT_MAX != 0xFFFFU) +# error "Cannot compile: must change definition of 'dbyte'." +#endif +#if (UINT_MAX != 0xFFFFFFFFU) +# error "Cannot compile: must change definition of 'qbyte'." +#endif + +//- Data types -------------------------------------------------------------- + +typedef unsigned char byte; // Single unsigned byte = 8 bits +typedef unsigned short dbyte; // Double byte = 16 bits +typedef unsigned int qbyte; // Quad byte = 32 bits +typedef struct sockaddr_in inaddr_t; // Internet socket address structure +typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure + +// Common structure to hold inaddr_t and in6addr_t with length +typedef struct { + union { + inaddr_t __addr; // IPv4 address + in6addr_t __addr6; // IPv6 address + } __inaddr_u; +#define ipv4addr __inaddr_u.__addr +#define ipv6addr __inaddr_u.__addr6 + int inaddrlen; +} inaddr_storage_t; + +//- Inevitable macros ------------------------------------------------------- + +#define streq(s1,s2) (!strcmp ((s1), (s2))) +#define strneq(s1,s2) (strcmp ((s1), (s2))) + +// Provide random number from 0..(num-1) +#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \ + || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) +# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) +#else +# define randof(num) (int) ((float) (num) * random () / (RAND_MAX + 1.0)) +#endif + +// Windows MSVS doesn't have stdbool +#if (defined (_MSC_VER)) +# if (!defined (__cplusplus) && (!defined (true))) +# define true 1 +# define false 0 + typedef char bool; +# endif +#else +# include +#endif + +//- A number of POSIX and C99 keywords and data types ----------------------- +// CZMQ uses uint for array indices; equivalent to unsigned int, but more +// convenient in code. We define it in czmq_prelude.h on systems that do +// not define it by default. + +#if (defined (__WINDOWS__)) +# if (!defined (__cplusplus) && (!defined (inline))) +# define inline __inline +# endif +# define strtoull _strtoui64 +# define atoll _atoi64 +# define srandom srand +# define TIMEZONE _timezone +# if (!defined (__MINGW32__)) +# define snprintf _snprintf +# define vsnprintf _vsnprintf +# endif + typedef unsigned long ulong; + typedef unsigned int uint; +# if (!defined (__MINGW32__)) + typedef int mode_t; +# if !defined (_SSIZE_T_DEFINED) +typedef intptr_t ssize_t; +# define _SSIZE_T_DEFINED +# endif +# endif +# if ((!defined (__MINGW32__) \ + || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ + && !defined (ZMQ_DEFINED_STDINT)) + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; +# endif + typedef uint32_t in_addr_t; +# if (!defined (PRId8)) +# define PRId8 "d" +# endif +# if (!defined (PRId16)) +# define PRId16 "d" +# endif +# if (!defined (PRId32)) +# define PRId32 "d" +# endif +# if (!defined (PRId64)) +# define PRId64 "I64d" +# endif +# if (!defined (PRIu8)) +# define PRIu8 "u" +# endif +# if (!defined (PRIu16)) +# define PRIu16 "u" +# endif +# if (!defined (PRIu32)) +# define PRIu32 "u" +# endif +# if (!defined (PRIu64)) +# define PRIu64 "I64u" +# endif +# if (!defined (va_copy)) + // MSVC does not support C99's va_copy so we use a regular assignment +# define va_copy(dest,src) (dest) = (src) +# endif +#elif (defined (__UTYPE_OSX)) + typedef unsigned long ulong; + typedef unsigned int uint; + // This fixes header-order dependence problem with some Linux versions +#elif (defined (__UTYPE_LINUX)) +# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC)) + typedef unsigned int uint; +# endif +#endif + +//- Non-portable declaration specifiers ------------------------------------- + +// For thread-local storage +#if defined (__WINDOWS__) +# define CZMQ_THREADLS __declspec(thread) +#else +# define CZMQ_THREADLS __thread +#endif + +// Replacement for malloc() which asserts if we run out of heap, and +// which zeroes the allocated block. +static inline void * +safe_malloc (size_t size, const char *file, unsigned line) +{ +// printf ("%s:%u %08d\n", file, line, (int) size); + void *mem = calloc (1, size); + if (mem == NULL) { + fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line); + fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n"); + fflush (stderr); + abort (); + } + return mem; +} + +// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace, +// otherwise all allocations will claim to come from czmq_prelude.h. For best +// results, compile all classes so you see dangling object allocations. +// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate +// out of memory condition back up the call stack. +#if defined _ZMALLOC_DEBUG || _ZMALLOC_PEDANTIC +# define zmalloc(size) calloc(1,(size)) +#else +# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__) +#endif + +// GCC supports validating format strings for functions that act like printf +#if defined (__GNUC__) && (__GNUC__ >= 2) +# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1))) +#else +# define CHECK_PRINTF(a) +#endif + +// Lets us write code that compiles both on Windows and normal platforms +#if !defined (__WINDOWS__) +typedef int SOCKET; +# define closesocket close +# define INVALID_SOCKET -1 +# define SOCKET_ERROR -1 +# define O_BINARY 0 +#endif + +//- Include non-portable header files based on platform.h ------------------- + +#if defined (HAVE_LINUX_WIRELESS_H) +# include +// This would normally come from net/if.h +unsigned int if_nametoindex (const char *ifname); +#else +# if defined (HAVE_NET_IF_H) +# include +# endif +# if defined (HAVE_NET_IF_MEDIA_H) +# include +# endif +#endif + +#if defined (__WINDOWS__) && !defined (HAVE_UUID) +# define HAVE_UUID 1 +#endif +#if defined (__UTYPE_OSX) && !defined (HAVE_UUID) +# define HAVE_UUID 1 +#endif +#if defined (HAVE_UUID) +# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD) +# include +# elif defined __UTYPE_HPUX +# include +# elif defined (__UNIX__) +# include +# endif +#endif + +// ZMQ compatibility macros + +#if ZMQ_VERSION_MAJOR == 4 +# define ZMQ_POLL_MSEC 1 // zmq_poll is msec + +#elif ZMQ_VERSION_MAJOR == 3 +# define ZMQ_POLL_MSEC 1 // zmq_poll is msec +# if ZMQ_VERSION_MINOR < 2 +# define zmq_ctx_new zmq_init +# endif +# define zmq_ctx_term zmq_term + +#elif ZMQ_VERSION_MAJOR == 2 +# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec +# define zmq_sendmsg zmq_send // Smooth out 2.x changes +# define zmq_recvmsg zmq_recv +# define zmq_ctx_new zmq_init +# define zmq_ctx_term zmq_term +# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f)) +# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f)) + // Older libzmq APIs may be missing some aspects of libzmq v3.0 +# ifndef ZMQ_ROUTER +# define ZMQ_ROUTER ZMQ_XREP +# endif +# ifndef ZMQ_DEALER +# define ZMQ_DEALER ZMQ_XREQ +# endif +# ifndef ZMQ_DONTWAIT +# define ZMQ_DONTWAIT ZMQ_NOBLOCK +# endif +# ifndef ZMQ_XSUB +# error "please upgrade your libzmq from http://zeromq.org" +# endif +# if ZMQ_VERSION_MINOR == 0 \ + || (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7) +# error "CZMQ requires at least libzmq/2.1.7 stable" +# endif +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zactor.h b/phonelibs/zmq/arm/include/zactor.h new file mode 100644 index 00000000000000..c865c65daf1efa --- /dev/null +++ b/phonelibs/zmq/arm/include/zactor.h @@ -0,0 +1,76 @@ +/* ========================================================================= + zactor - actor + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZACTOR_H_INCLUDED__ +#define __ZACTOR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zactor.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Actors get a pipe and arguments from caller +typedef void (zactor_fn) ( + zsock_t *pipe, void *args); + +// Create a new actor passing arbitrary arguments reference. +CZMQ_EXPORT zactor_t * + zactor_new (zactor_fn task, void *args); + +// Destroy an actor. +CZMQ_EXPORT void + zactor_destroy (zactor_t **self_p); + +// Send a zmsg message to the actor, take ownership of the message +// and destroy when it has been sent. +CZMQ_EXPORT int + zactor_send (zactor_t *self, zmsg_t **msg_p); + +// Receive a zmsg message from the actor. Returns NULL if the actor +// was interrupted before the message could be received, or if there +// was a timeout on the actor. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zmsg_t * + zactor_recv (zactor_t *self); + +// Probe the supplied object, and report if it looks like a zactor_t. +CZMQ_EXPORT bool + zactor_is (void *self); + +// Probe the supplied reference. If it looks like a zactor_t instance, +// return the underlying libzmq actor handle; else if it looks like +// a libzmq actor handle, return the supplied value. +CZMQ_EXPORT void * + zactor_resolve (void *self); + +// Return the actor's zsock handle. Use this when you absolutely need +// to work with the zsock instance rather than the actor. +CZMQ_EXPORT zsock_t * + zactor_sock (zactor_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zactor_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zarmour.h b/phonelibs/zmq/arm/include/zarmour.h new file mode 100644 index 00000000000000..c7f299f7afe989 --- /dev/null +++ b/phonelibs/zmq/arm/include/zarmour.h @@ -0,0 +1,114 @@ +/* ========================================================================= + zarmour - armoured text encoding and decoding + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZARMOUR_H_INCLUDED__ +#define __ZARMOUR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zarmour.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 +#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 +#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 +#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 +#define ZARMOUR_MODE_BASE16 4 // Standard base 16 +#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 + +// Create a new zarmour +CZMQ_EXPORT zarmour_t * + zarmour_new (void); + +// Destroy the zarmour +CZMQ_EXPORT void + zarmour_destroy (zarmour_t **self_p); + +// Encode a stream of bytes into an armoured string. Returns the armoured +// string, or NULL if there was insufficient memory available to allocate +// a new string. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zarmour_encode (zarmour_t *self, const byte *data, size_t size); + +// Decode an armoured string into a chunk. The decoded output is +// null-terminated, so it may be treated as a string, if that's what +// it was prior to encoding. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zarmour_decode (zarmour_t *self, const char *data); + +// Get the mode property. +CZMQ_EXPORT int + zarmour_mode (zarmour_t *self); + +// Get printable string for mode. +CZMQ_EXPORT const char * + zarmour_mode_str (zarmour_t *self); + +// Set the mode property. +CZMQ_EXPORT void + zarmour_set_mode (zarmour_t *self, int mode); + +// Return true if padding is turned on. +CZMQ_EXPORT bool + zarmour_pad (zarmour_t *self); + +// Turn padding on or off. Default is on. +CZMQ_EXPORT void + zarmour_set_pad (zarmour_t *self, bool pad); + +// Get the padding character. +CZMQ_EXPORT char + zarmour_pad_char (zarmour_t *self); + +// Set the padding character. +CZMQ_EXPORT void + zarmour_set_pad_char (zarmour_t *self, char pad_char); + +// Return if splitting output into lines is turned on. Default is off. +CZMQ_EXPORT bool + zarmour_line_breaks (zarmour_t *self); + +// Turn splitting output into lines on or off. +CZMQ_EXPORT void + zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); + +// Get the line length used for splitting lines. +CZMQ_EXPORT size_t + zarmour_line_length (zarmour_t *self); + +// Set the line length used for splitting lines. +CZMQ_EXPORT void + zarmour_set_line_length (zarmour_t *self, size_t line_length); + +// Print properties of object +CZMQ_EXPORT void + zarmour_print (zarmour_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zarmour_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zauth.h b/phonelibs/zmq/arm/include/zauth.h new file mode 100644 index 00000000000000..ca6bb913c8f5aa --- /dev/null +++ b/phonelibs/zmq/arm/include/zauth.h @@ -0,0 +1,100 @@ +/* ========================================================================= + zauth - authentication for ZeroMQ security mechanisms + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZAUTH_H_INCLUDED__ +#define __ZAUTH_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#define CURVE_ALLOW_ANY "*" + +// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated). +// +// Create new zauth actor instance. This installs authentication on all +// zsock sockets. Until you add policies, all incoming NULL connections are +// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections +// are denied: +// +// zactor_t *auth = zactor_new (zauth, NULL); +// +// Destroy zauth instance. This removes authentication and allows all +// connections to pass, without authentication: +// +// zactor_destroy (&auth); +// +// Note that all zauth commands are synchronous, so your application always +// waits for a signal from the actor after each command. +// +// Enable verbose logging of commands and activity. Verbose logging can help +// debug non-trivial authentication policies: +// +// zstr_send (auth, "VERBOSE"); +// zsock_wait (auth); +// +// Allow (whitelist) a list of IP addresses. For NULL, all clients from +// these addresses will be accepted. For PLAIN and CURVE, they will be +// allowed to continue with authentication. You can call this method +// multiple times to whitelist more IP addresses. If you whitelist one +// or nmore addresses, any non-whitelisted addresses are treated as +// blacklisted: +// +// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL); +// zsock_wait (auth); +// +// Deny (blacklist) a list of IP addresses. For all security mechanisms, +// this rejects the connection without any further authentication. Use +// either a whitelist, or a blacklist, not not both. If you define both +// a whitelist and a blacklist, only the whitelist takes effect: +// +// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL); +// zsock_wait (auth); +// +// Configure PLAIN authentication using a plain-text password file. You can +// modify the password file at any time; zauth will reload it automatically +// if modified externally: +// +// zstr_sendx (auth, "PLAIN", filename, NULL); +// zsock_wait (auth); +// +// Configure CURVE authentication, using a directory that holds all public +// client certificates, i.e. their public keys. The certificates must be in +// zcert_save format. You can add and remove certificates in that directory +// at any time. To allow all client keys without checking, specify +// CURVE_ALLOW_ANY for the directory name: +// +// zstr_sendx (auth, "CURVE", directory, NULL); +// zsock_wait (auth); +// +// Configure GSSAPI authentication, using an underlying mechanism (usually +// Kerberos) to establish a secure context and perform mutual authentication: +// +// zstr_sendx (auth, "GSSAPI", NULL); +// zsock_wait (auth); +// +// This is the zauth constructor as a zactor_fn: +CZMQ_EXPORT void + zauth (zsock_t *pipe, void *certstore); + +// Selftest +CZMQ_EXPORT void + zauth_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zauth_v2.h b/phonelibs/zmq/arm/include/zauth_v2.h new file mode 100644 index 00000000000000..bbbee86b03e62d --- /dev/null +++ b/phonelibs/zmq/arm/include/zauth_v2.h @@ -0,0 +1,88 @@ +/* ========================================================================= + zauth_v2 - authentication for ZeroMQ servers (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZAUTH_V2_H_INCLUDED__ +#define __ZAUTH_V2_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#ifndef CURVE_ALLOW_ANY +# define CURVE_ALLOW_ANY "*" +#endif + +// Constructor +// Install authentication for the specified context. Returns a new zauth +// object that you can use to configure authentication. Note that until you +// add policies, all incoming NULL connections are allowed (classic ZeroMQ +// behaviour), and all PLAIN and CURVE connections are denied. If there was +// an error during initialization, returns NULL. +CZMQ_EXPORT zauth_t * + zauth_new (zctx_t *ctx); + +// Destructor +CZMQ_EXPORT void + zauth_destroy (zauth_t **self_p); + +// Allow (whitelist) a single IP address. For NULL, all clients from this +// address will be accepted. For PLAIN and CURVE, they will be allowed to +// continue with authentication. You can call this method multiple times +// to whitelist multiple IP addresses. If you whitelist a single address, +// any non-whitelisted addresses are treated as blacklisted. +CZMQ_EXPORT void + zauth_allow (zauth_t *self, const char *address); + +// Deny (blacklist) a single IP address. For all security mechanisms, this +// rejects the connection without any further authentication. Use either a +// whitelist, or a blacklist, not not both. If you define both a whitelist +// and a blacklist, only the whitelist takes effect. +CZMQ_EXPORT void + zauth_deny (zauth_t *self, const char *address); + +// Configure PLAIN authentication for a given domain. PLAIN authentication +// uses a plain-text password file. To cover all domains, use "*". You can +// modify the password file at any time; it is reloaded automatically. +CZMQ_EXPORT void + zauth_configure_plain (zauth_t *self, const char *domain, const char *filename); + +// Configure CURVE authentication for a given domain. CURVE authentication +// uses a directory that holds all public client certificates, i.e. their +// public keys. The certificates must be in zcert_save () format. To cover +// all domains, use "*". You can add and remove certificates in that +// directory at any time. To allow all client keys without checking, specify +// CURVE_ALLOW_ANY for the location. +CZMQ_EXPORT void + zauth_configure_curve (zauth_t *self, const char *domain, const char *location); + +// Configure GSSAPI authentication for a given domain. GSSAPI authentication +// uses an underlying mechanism (usually Kerberos) to establish a secure +// context and perform mutual authentication. To cover all domains, use "*". +CZMQ_EXPORT void + zauth_configure_gssapi (zauth_t *self, char *domain); + +// Enable verbose tracing of commands and activity +CZMQ_EXPORT void + zauth_set_verbose (zauth_t *self, bool verbose); + +// Selftest +CZMQ_EXPORT void + zauth_v2_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zbeacon.h b/phonelibs/zmq/arm/include/zbeacon.h new file mode 100644 index 00000000000000..78917e9577e40f --- /dev/null +++ b/phonelibs/zmq/arm/include/zbeacon.h @@ -0,0 +1,86 @@ +/* ========================================================================= + zbeacon - LAN discovery and presence + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZBEACON_H_INCLUDED__ +#define __ZBEACON_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create new zbeacon actor instance: +// +// zactor_t *beacon = zactor_new (zbeacon, NULL); +// +// Destroy zbeacon instance: +// +// zactor_destroy (&beacon); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (beacon, "VERBOSE"); +// +// Configure beacon to run on specified UDP port, and return the name of +// the host, which can be used as endpoint for incoming connections. To +// force the beacon to operate on a given interface, set the environment +// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating +// the beacon. If the system does not support UDP broadcasts (lacking a +// workable interface), returns an empty hostname: +// +// // Pictures: 's' = C string, 'i' = int +// zsock_send (beacon, "si", "CONFIGURE", port_number); +// char *hostname = zstr_recv (beacon); +// +// Start broadcasting a beacon at a specified interval in msec. The beacon +// data can be at most UDP_FRAME_MAX bytes; this constant is defined in +// zsys.h to be 255: +// +// // Pictures: 'b' = byte * data + size_t size +// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); +// +// Stop broadcasting the beacon: +// +// zstr_sendx (beacon, "SILENCE", NULL); +// +// Start listening to beacons from peers. The filter is used to do a prefix +// match on received beacons, to remove junk. Note that any received data +// that is identical to our broadcast beacon_data is discarded in any case. +// If the filter size is zero, we get all peer beacons: +// +// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); +// +// Stop listening to other peers +// +// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); +// +// Receive next beacon from a peer. Received beacons are always a 2-frame +// message containing the ipaddress of the sender, and then the binary +// beacon data as published by the sender: +// +// zmsg_t *msg = zmsg_recv (beacon); +// +// This is the zbeacon constructor as a zactor_fn: +CZMQ_EXPORT void + zbeacon (zsock_t *pipe, void *unused); + +// Self test of this class +CZMQ_EXPORT void + zbeacon_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zbeacon_v2.h b/phonelibs/zmq/arm/include/zbeacon_v2.h new file mode 100644 index 00000000000000..8e8f3b4cde9967 --- /dev/null +++ b/phonelibs/zmq/arm/include/zbeacon_v2.h @@ -0,0 +1,75 @@ +/* ========================================================================= + zbeacon - LAN discovery and presence (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZBEACON_V2_H_INCLUDED__ +#define __ZBEACON_V2_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create a new beacon on a certain UDP port. If the system does not +// support UDP broadcasts (lacking a useful interface), returns NULL. +// To force the beacon to operate on a given port, set the environment +// variable ZSYS_INTERFACE, or call zsys_set_interface() beforehand. +// If you are using the new zsock API then pass NULL as the ctx here. +CZMQ_EXPORT zbeacon_t * + zbeacon_new (zctx_t *ctx, int port_nbr); + +// Destroy a beacon +CZMQ_EXPORT void + zbeacon_destroy (zbeacon_t **self_p); + +// Return our own IP address as printable string +CZMQ_EXPORT char * + zbeacon_hostname (zbeacon_t *self); + +// Set broadcast interval in milliseconds (default is 1000 msec) +CZMQ_EXPORT void + zbeacon_set_interval (zbeacon_t *self, int interval); + +// Filter out any beacon that looks exactly like ours +CZMQ_EXPORT void + zbeacon_noecho (zbeacon_t *self); + +// Start broadcasting beacon to peers at the specified interval +CZMQ_EXPORT void + zbeacon_publish (zbeacon_t *self, byte *transmit, size_t size); + +// Stop broadcasting beacons +CZMQ_EXPORT void + zbeacon_silence (zbeacon_t *self); + +// Start listening to other peers; zero-sized filter means get everything +CZMQ_EXPORT void + zbeacon_subscribe (zbeacon_t *self, byte *filter, size_t size); + +// Stop listening to other peers +CZMQ_EXPORT void + zbeacon_unsubscribe (zbeacon_t *self); + +// Get beacon ZeroMQ socket, for polling or receiving messages +CZMQ_EXPORT void * + zbeacon_socket (zbeacon_t *self); + +// Self test of this class +CZMQ_EXPORT void + zbeacon_v2_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zcert.h b/phonelibs/zmq/arm/include/zcert.h new file mode 100644 index 00000000000000..495b579cda9317 --- /dev/null +++ b/phonelibs/zmq/arm/include/zcert.h @@ -0,0 +1,139 @@ +/* ========================================================================= + zcert - work with CURVE security certificates + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCERT_H_INCLUDED__ +#define __ZCERT_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zcert.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// This class has legacy methods, which will be removed over time. You +// should not use them, and migrate any code that is still using them. +// Create and initialize a new certificate in memory +CZMQ_EXPORT zcert_t * + zcert_new (void); + +// Accepts public/secret key pair from caller +CZMQ_EXPORT zcert_t * + zcert_new_from (const byte *public_key, const byte *secret_key); + +// Load certificate from file +CZMQ_EXPORT zcert_t * + zcert_load (const char *filename); + +// Destroy a certificate in memory +CZMQ_EXPORT void + zcert_destroy (zcert_t **self_p); + +// Return public part of key pair as 32-byte binary string +CZMQ_EXPORT const byte * + zcert_public_key (zcert_t *self); + +// Return secret part of key pair as 32-byte binary string +CZMQ_EXPORT const byte * + zcert_secret_key (zcert_t *self); + +// Return public part of key pair as Z85 armored string +CZMQ_EXPORT const char * + zcert_public_txt (zcert_t *self); + +// Return secret part of key pair as Z85 armored string +CZMQ_EXPORT const char * + zcert_secret_txt (zcert_t *self); + +// Set certificate metadata from formatted string. +CZMQ_EXPORT void + zcert_set_meta (zcert_t *self, const char *name, const char *format, ...); + +// Get metadata value from certificate; if the metadata value doesn't +// exist, returns NULL. +CZMQ_EXPORT const char * + zcert_meta (zcert_t *self, const char *name); + +// Get list of metadata fields from certificate. Caller is responsible for +// destroying list. Caller should not modify the values of list items. +CZMQ_EXPORT zlist_t * + zcert_meta_keys (zcert_t *self); + +// Save full certificate (public + secret) to file for persistent storage +// This creates one public file and one secret file (filename + "_secret"). +CZMQ_EXPORT int + zcert_save (zcert_t *self, const char *filename); + +// Save public certificate only to file for persistent storage +CZMQ_EXPORT int + zcert_save_public (zcert_t *self, const char *filename); + +// Save secret certificate only to file for persistent storage +CZMQ_EXPORT int + zcert_save_secret (zcert_t *self, const char *filename); + +// Apply certificate to socket, i.e. use for CURVE security on socket. +// If certificate was loaded from public file, the secret key will be +// undefined, and this certificate will not work successfully. +CZMQ_EXPORT void + zcert_apply (zcert_t *self, void *socket); + +// Return copy of certificate; if certificate is NULL or we exhausted +// heap memory, returns NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zcert_t * + zcert_dup (zcert_t *self); + +// Return true if two certificates have the same keys +CZMQ_EXPORT bool + zcert_eq (zcert_t *self, zcert_t *compare); + +// Print certificate contents to stdout +CZMQ_EXPORT void + zcert_print (zcert_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Print certificate contents to open stream. This method is deprecated +// and you should use the print method. +CZMQ_EXPORT void + zcert_fprint (zcert_t *self, FILE *file); + +// Self test of this class +CZMQ_EXPORT void + zcert_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Unset certificate metadata. +CZMQ_EXPORT void + zcert_unset_meta (zcert_t *self, const char *name); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT void + zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3); +// @end + + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zcert_dump(s) zcert_print(s) + +#endif diff --git a/phonelibs/zmq/arm/include/zcertstore.h b/phonelibs/zmq/arm/include/zcertstore.h new file mode 100644 index 00000000000000..c7f93c5a7d4604 --- /dev/null +++ b/phonelibs/zmq/arm/include/zcertstore.h @@ -0,0 +1,100 @@ +/* ========================================================================= + zcertstore - work with CURVE security certificate stores + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCERTSTORE_H_INCLUDED__ +#define __ZCERTSTORE_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zcertstore.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// This class has legacy methods, which will be removed over time. You +// should not use them, and migrate any code that is still using them. +// Create a new certificate store from a disk directory, loading and +// indexing all certificates in that location. The directory itself may be +// absent, and created later, or modified at any time. The certificate store +// is automatically refreshed on any zcertstore_lookup() call. If the +// location is specified as NULL, creates a pure-memory store, which you +// can work with by inserting certificates at runtime. +CZMQ_EXPORT zcertstore_t * + zcertstore_new (const char *location); + +// Destroy a certificate store object in memory. Does not affect anything +// stored on disk. +CZMQ_EXPORT void + zcertstore_destroy (zcertstore_t **self_p); + +// Look up certificate by public key, returns zcert_t object if found, +// else returns NULL. The public key is provided in Z85 text format. +CZMQ_EXPORT zcert_t * + zcertstore_lookup (zcertstore_t *self, const char *public_key); + +// Insert certificate into certificate store in memory. Note that this +// does not save the certificate to disk. To do that, use zcert_save() +// directly on the certificate. Takes ownership of zcert_t object. +CZMQ_EXPORT void + zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); + +// Print list of certificates in store to logging facility +CZMQ_EXPORT void + zcertstore_print (zcertstore_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Print list of certificates in store to open stream. This method is +// deprecated, and you should use the print method. +CZMQ_EXPORT void + zcertstore_fprint (zcertstore_t *self, FILE *file); + +// Self test of this class +CZMQ_EXPORT void + zcertstore_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// Loaders retrieve certificates from an arbitrary source. +typedef void (zcertstore_loader) ( + zcertstore_t *self); + +// Destructor for loader state. +typedef void (zcertstore_destructor) ( + void **self_p); + +// *** Draft method, for development use, may change without warning *** +// Override the default disk loader with a custom loader fn. +CZMQ_EXPORT void + zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); + +// *** Draft method, for development use, may change without warning *** +// Empty certificate hashtable. This wrapper exists to be friendly to bindings, +// which don't usually have access to struct internals. +CZMQ_EXPORT void + zcertstore_empty (zcertstore_t *self); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zcertstore_dump(s) zcertstore_print(s) + +#endif diff --git a/phonelibs/zmq/arm/include/zchunk.h b/phonelibs/zmq/arm/include/zchunk.h new file mode 100644 index 00000000000000..56f29b161a37e5 --- /dev/null +++ b/phonelibs/zmq/arm/include/zchunk.h @@ -0,0 +1,163 @@ +/* ========================================================================= + zchunk - work with memory chunks + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCHUNK_H_INCLUDED__ +#define __ZCHUNK_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zchunk.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create a new chunk of the specified size. If you specify the data, it +// is copied into the chunk. If you do not specify the data, the chunk is +// allocated and left empty, and you can then add data using zchunk_append. +CZMQ_EXPORT zchunk_t * + zchunk_new (const void *data, size_t size); + +// Destroy a chunk +CZMQ_EXPORT void + zchunk_destroy (zchunk_t **self_p); + +// Resizes chunk max_size as requested; chunk_cur size is set to zero +CZMQ_EXPORT void + zchunk_resize (zchunk_t *self, size_t size); + +// Return chunk cur size +CZMQ_EXPORT size_t + zchunk_size (zchunk_t *self); + +// Return chunk max size +CZMQ_EXPORT size_t + zchunk_max_size (zchunk_t *self); + +// Return chunk data +CZMQ_EXPORT byte * + zchunk_data (zchunk_t *self); + +// Set chunk data from user-supplied data; truncate if too large. Data may +// be null. Returns actual size of chunk +CZMQ_EXPORT size_t + zchunk_set (zchunk_t *self, const void *data, size_t size); + +// Fill chunk data from user-supplied octet +CZMQ_EXPORT size_t + zchunk_fill (zchunk_t *self, byte filler, size_t size); + +// Append user-supplied data to chunk, return resulting chunk size. If the +// data would exceeded the available space, it is truncated. If you want to +// grow the chunk to accommodate new data, use the zchunk_extend method. +CZMQ_EXPORT size_t + zchunk_append (zchunk_t *self, const void *data, size_t size); + +// Append user-supplied data to chunk, return resulting chunk size. If the +// data would exceeded the available space, the chunk grows in size. +CZMQ_EXPORT size_t + zchunk_extend (zchunk_t *self, const void *data, size_t size); + +// Copy as much data from 'source' into the chunk as possible; returns the +// new size of chunk. If all data from 'source' is used, returns exhausted +// on the source chunk. Source can be consumed as many times as needed until +// it is exhausted. If source was already exhausted, does not change chunk. +CZMQ_EXPORT size_t + zchunk_consume (zchunk_t *self, zchunk_t *source); + +// Returns true if the chunk was exhausted by consume methods, or if the +// chunk has a size of zero. +CZMQ_EXPORT bool + zchunk_exhausted (zchunk_t *self); + +// Read chunk from an open file descriptor +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_read (FILE *handle, size_t bytes); + +// Write chunk to an open file descriptor +CZMQ_EXPORT int + zchunk_write (zchunk_t *self, FILE *handle); + +// Try to slurp an entire file into a chunk. Will read up to maxsize of +// the file. If maxsize is 0, will attempt to read the entire file and +// fail with an assertion if that cannot fit into memory. Returns a new +// chunk containing the file data, or NULL if the file could not be read. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_slurp (const char *filename, size_t maxsize); + +// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t +// object, or null if there was not enough heap memory. If chunk is null, +// returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_dup (zchunk_t *self); + +// Return chunk data encoded as printable hex string. Caller must free +// string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zchunk_strhex (zchunk_t *self); + +// Return chunk data copied into freshly allocated string +// Caller must free string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zchunk_strdup (zchunk_t *self); + +// Return TRUE if chunk body is equal to string, excluding terminator +CZMQ_EXPORT bool + zchunk_streq (zchunk_t *self, const char *string); + +// Transform zchunk into a zframe that can be sent in a message. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zchunk_pack (zchunk_t *self); + +// Transform a zframe into a zchunk. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zchunk_unpack (zframe_t *frame); + +// Calculate SHA1 digest for chunk, using zdigest class. +CZMQ_EXPORT const char * + zchunk_digest (zchunk_t *self); + +// Dump chunk to FILE stream, for debugging and tracing. +CZMQ_EXPORT void + zchunk_fprint (zchunk_t *self, FILE *file); + +// Dump message to stderr, for debugging and tracing. +// See zchunk_fprint for details +CZMQ_EXPORT void + zchunk_print (zchunk_t *self); + +// Probe the supplied object, and report if it looks like a zchunk_t. +CZMQ_EXPORT bool + zchunk_is (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zchunk_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/phonelibs/zmq/arm/include/zclock.h b/phonelibs/zmq/arm/include/zclock.h new file mode 100644 index 00000000000000..eb064162c4722a --- /dev/null +++ b/phonelibs/zmq/arm/include/zclock.h @@ -0,0 +1,73 @@ +/* ========================================================================= + zclock - millisecond clocks and delays + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCLOCK_H_INCLUDED__ +#define __ZCLOCK_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zclock.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Sleep for a number of milliseconds +CZMQ_EXPORT void + zclock_sleep (int msecs); + +// Return current system clock as milliseconds. Note that this clock can +// jump backwards (if the system clock is changed) so is unsafe to use for +// timers and time offsets. Use zclock_mono for that instead. +CZMQ_EXPORT int64_t + zclock_time (void); + +// Return current monotonic clock in milliseconds. Use this when you compute +// time offsets. The monotonic clock is not affected by system changes and +// so will never be reset backwards, unlike a system clock. +CZMQ_EXPORT int64_t + zclock_mono (void); + +// Return current monotonic clock in microseconds. Use this when you compute +// time offsets. The monotonic clock is not affected by system changes and +// so will never be reset backwards, unlike a system clock. +CZMQ_EXPORT int64_t + zclock_usecs (void); + +// Return formatted date/time as fresh string. Free using zstr_free(). +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zclock_timestr (void); + +// Self test of this class. +CZMQ_EXPORT void + zclock_test (bool verbose); + +// @end + + +// DEPRECATED in favor of zsys logging, see issue #519 +// Print formatted string to stdout, prefixed by date/time and +// terminated with a newline. +CZMQ_EXPORT void + zclock_log (const char *format, ...); + +// Compiler hints +CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zconfig.h b/phonelibs/zmq/arm/include/zconfig.h new file mode 100644 index 00000000000000..4ec4e1c81f03e1 --- /dev/null +++ b/phonelibs/zmq/arm/include/zconfig.h @@ -0,0 +1,194 @@ +/* ========================================================================= + zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL. + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCONFIG_H_INCLUDED__ +#define __ZCONFIG_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zconfig.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// +typedef int (zconfig_fct) ( + zconfig_t *self, void *arg, int level); + +// Create new config item +CZMQ_EXPORT zconfig_t * + zconfig_new (const char *name, zconfig_t *parent); + +// Load a config tree from a specified ZPL text file; returns a zconfig_t +// reference for the root, if the file exists and is readable. Returns NULL +// if the file does not exist. +CZMQ_EXPORT zconfig_t * + zconfig_load (const char *filename); + +// Equivalent to zconfig_load, taking a format string instead of a fixed +// filename. +CZMQ_EXPORT zconfig_t * + zconfig_loadf (const char *format, ...); + +// Destroy a config item and all its children +CZMQ_EXPORT void + zconfig_destroy (zconfig_t **self_p); + +// Return name of config item +CZMQ_EXPORT char * + zconfig_name (zconfig_t *self); + +// Return value of config item +CZMQ_EXPORT char * + zconfig_value (zconfig_t *self); + +// Insert or update configuration key with value +CZMQ_EXPORT void + zconfig_put (zconfig_t *self, const char *path, const char *value); + +// Equivalent to zconfig_put, accepting a format specifier and variable +// argument list, instead of a single string value. +CZMQ_EXPORT void + zconfig_putf (zconfig_t *self, const char *path, const char *format, ...); + +// Get value for config item into a string value; leading slash is optional +// and ignored. +CZMQ_EXPORT char * + zconfig_get (zconfig_t *self, const char *path, const char *default_value); + +// Set config item name, name may be NULL +CZMQ_EXPORT void + zconfig_set_name (zconfig_t *self, const char *name); + +// Set new value for config item. The new value may be a string, a printf +// format, or NULL. Note that if string may possibly contain '%', or if it +// comes from an insecure source, you must use '%s' as the format, followed +// by the string. +CZMQ_EXPORT void + zconfig_set_value (zconfig_t *self, const char *format, ...); + +// Find our first child, if any +CZMQ_EXPORT zconfig_t * + zconfig_child (zconfig_t *self); + +// Find our first sibling, if any +CZMQ_EXPORT zconfig_t * + zconfig_next (zconfig_t *self); + +// Find a config item along a path; leading slash is optional and ignored. +CZMQ_EXPORT zconfig_t * + zconfig_locate (zconfig_t *self, const char *path); + +// Locate the last config item at a specified depth +CZMQ_EXPORT zconfig_t * + zconfig_at_depth (zconfig_t *self, int level); + +// Execute a callback for each config item in the tree; returns zero if +// successful, else -1. +CZMQ_EXPORT int + zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); + +// Add comment to config item before saving to disk. You can add as many +// comment lines as you like. If you use a null format, all comments are +// deleted. +CZMQ_EXPORT void + zconfig_set_comment (zconfig_t *self, const char *format, ...); + +// Return comments of config item, as zlist. +CZMQ_EXPORT zlist_t * + zconfig_comments (zconfig_t *self); + +// Save a config tree to a specified ZPL text file, where a filename +// "-" means dump to standard output. +CZMQ_EXPORT int + zconfig_save (zconfig_t *self, const char *filename); + +// Equivalent to zconfig_save, taking a format string instead of a fixed +// filename. +CZMQ_EXPORT int + zconfig_savef (zconfig_t *self, const char *format, ...); + +// Report filename used during zconfig_load, or NULL if none +CZMQ_EXPORT const char * + zconfig_filename (zconfig_t *self); + +// Reload config tree from same file that it was previously loaded from. +// Returns 0 if OK, -1 if there was an error (and then does not change +// existing data). +CZMQ_EXPORT int + zconfig_reload (zconfig_t **self_p); + +// Load a config tree from a memory chunk +CZMQ_EXPORT zconfig_t * + zconfig_chunk_load (zchunk_t *chunk); + +// Save a config tree to a new memory chunk +CZMQ_EXPORT zchunk_t * + zconfig_chunk_save (zconfig_t *self); + +// Load a config tree from a null-terminated string +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zconfig_t * + zconfig_str_load (const char *string); + +// Save a config tree to a new null terminated string +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zconfig_str_save (zconfig_t *self); + +// Return true if a configuration tree was loaded from a file and that +// file has changed in since the tree was loaded. +CZMQ_EXPORT bool + zconfig_has_changed (zconfig_t *self); + +// Print the config file to open stream +CZMQ_EXPORT void + zconfig_fprint (zconfig_t *self, FILE *file); + +// Print properties of object +CZMQ_EXPORT void + zconfig_print (zconfig_t *self); + +// Self test of this class +CZMQ_EXPORT void + zconfig_test (bool verbose); + +// @ignore +CZMQ_EXPORT void + zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3); +CZMQ_EXPORT void + zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT void + zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + +// Self test of this class +CZMQ_EXPORT void + zconfig_test (bool verbose); + +// Compiler hints +CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zconfig_dump(s) zconfig_print(s) +#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d)) + +#endif diff --git a/phonelibs/zmq/arm/include/zctx.h b/phonelibs/zmq/arm/include/zctx.h new file mode 100644 index 00000000000000..88898410dc8e99 --- /dev/null +++ b/phonelibs/zmq/arm/include/zctx.h @@ -0,0 +1,107 @@ +/* ========================================================================= + zctx - working with 0MQ contexts + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZCTX_H_INCLUDED__ +#define __ZCTX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + + +// @interface +// Create new context, returns context object, replaces zmq_init +CZMQ_EXPORT zctx_t * + zctx_new (void); + +// Destroy context and all sockets in it, replaces zmq_term +CZMQ_EXPORT void + zctx_destroy (zctx_t **self_p); + +// Create new shadow context, returns context object +CZMQ_EXPORT zctx_t * + zctx_shadow (zctx_t *self); +// @end + +// Create a new context by shadowing a plain zmq context +CZMQ_EXPORT zctx_t * +zctx_shadow_zmq_ctx (void *zmqctx); + +// @interface +// Raise default I/O threads from 1, for crazy heavy applications +// The rule of thumb is one I/O thread per gigabyte of traffic in +// or out. Call this method before creating any sockets on the context, +// or calling zctx_shadow, or the setting will have no effect. +CZMQ_EXPORT void + zctx_set_iothreads (zctx_t *self, int iothreads); + +// Set msecs to flush sockets when closing them, see the ZMQ_LINGER +// man page section for more details. By default, set to zero, so +// any in-transit messages are discarded when you destroy a socket or +// a context. +CZMQ_EXPORT void + zctx_set_linger (zctx_t *self, int linger); + +// Set initial high-water mark for inter-thread pipe sockets. Note that +// this setting is separate from the default for normal sockets. You +// should change the default for pipe sockets *with care*. Too low values +// will cause blocked threads, and an infinite setting can cause memory +// exhaustion. The default, no matter the underlying ZeroMQ version, is +// 1,000. +CZMQ_EXPORT void + zctx_set_pipehwm (zctx_t *self, int pipehwm); + +// Set initial send HWM for all new normal sockets created in context. +// You can set this per-socket after the socket is created. +// The default, no matter the underlying ZeroMQ version, is 1,000. +CZMQ_EXPORT void + zctx_set_sndhwm (zctx_t *self, int sndhwm); + +// Set initial receive HWM for all new normal sockets created in context. +// You can set this per-socket after the socket is created. +// The default, no matter the underlying ZeroMQ version, is 1,000. +CZMQ_EXPORT void + zctx_set_rcvhwm (zctx_t *self, int rcvhwm); + +// Return low-level 0MQ context object, will be NULL before first socket +// is created. Use with care. +CZMQ_EXPORT void * + zctx_underlying (zctx_t *self); + +// Self test of this class +CZMQ_EXPORT void + zctx_test (bool verbose); +// @end + +// Create socket within this context, for CZMQ use only +void * + zctx__socket_new (zctx_t *self, int type); + +// Create pipe socket within this context, for CZMQ use only +void * + zctx__socket_pipe (zctx_t *self); + +// Destroy socket within this context, for CZMQ use only +void + zctx__socket_destroy (zctx_t *self, void *socket); + +// Initialize the low-level 0MQ context object, for CZMQ use only +void + zctx__initialize_underlying(zctx_t *self); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zdigest.h b/phonelibs/zmq/arm/include/zdigest.h new file mode 100644 index 00000000000000..def9e860537094 --- /dev/null +++ b/phonelibs/zmq/arm/include/zdigest.h @@ -0,0 +1,65 @@ +/* ========================================================================= + zdigest - provides hashing functions (SHA-1 at present) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZDIGEST_H_INCLUDED__ +#define __ZDIGEST_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zdigest.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Constructor - creates new digest object, which you use to build up a +// digest by repeatedly calling zdigest_update() on chunks of data. +CZMQ_EXPORT zdigest_t * + zdigest_new (void); + +// Destroy a digest object +CZMQ_EXPORT void + zdigest_destroy (zdigest_t **self_p); + +// Add buffer into digest calculation +CZMQ_EXPORT void + zdigest_update (zdigest_t *self, const byte *buffer, size_t length); + +// Return final digest hash data. If built without crypto support, +// returns NULL. +CZMQ_EXPORT const byte * + zdigest_data (zdigest_t *self); + +// Return final digest hash size +CZMQ_EXPORT size_t + zdigest_size (zdigest_t *self); + +// Return digest as printable hex string; caller should not modify nor +// free this string. After calling this, you may not use zdigest_update() +// on the same digest. If built without crypto support, returns NULL. +CZMQ_EXPORT char * + zdigest_string (zdigest_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zdigest_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zdir.h b/phonelibs/zmq/arm/include/zdir.h new file mode 100644 index 00000000000000..6c5551b57eead4 --- /dev/null +++ b/phonelibs/zmq/arm/include/zdir.h @@ -0,0 +1,149 @@ +/* ========================================================================= + zdir - work with file-system directories + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZDIR_H_INCLUDED__ +#define __ZDIR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zdir.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create a new directory item that loads in the full tree of the specified +// path, optionally located under some parent path. If parent is "-", then +// loads only the top-level directory, and does not use parent as a path. +CZMQ_EXPORT zdir_t * + zdir_new (const char *path, const char *parent); + +// Destroy a directory tree and all children it contains. +CZMQ_EXPORT void + zdir_destroy (zdir_t **self_p); + +// Return directory path +CZMQ_EXPORT const char * + zdir_path (zdir_t *self); + +// Return last modification time for directory. +CZMQ_EXPORT time_t + zdir_modified (zdir_t *self); + +// Return total hierarchy size, in bytes of data contained in all files +// in the directory tree. +CZMQ_EXPORT off_t + zdir_cursize (zdir_t *self); + +// Return directory count +CZMQ_EXPORT size_t + zdir_count (zdir_t *self); + +// Returns a sorted list of zfile objects; Each entry in the list is a pointer +// to a zfile_t item already allocated in the zdir tree. Do not destroy the +// original zdir tree until you are done with this list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zdir_list (zdir_t *self); + +// Remove directory, optionally including all files that it contains, at +// all levels. If force is false, will only remove the directory if empty. +// If force is true, will remove all files and all subdirectories. +CZMQ_EXPORT void + zdir_remove (zdir_t *self, bool force); + +// Calculate differences between two versions of a directory tree. +// Returns a list of zdir_patch_t patches. Either older or newer may +// be null, indicating the directory is empty/absent. If alias is set, +// generates virtual filename (minus path, plus alias). +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); + +// Return full contents of directory as a zdir_patch list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zdir_resync (zdir_t *self, const char *alias); + +// Load directory cache; returns a hash table containing the SHA-1 digests +// of every file in the tree. The cache is saved between runs in .cache. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zhash_t * + zdir_cache (zdir_t *self); + +// Print contents of directory to open stream +CZMQ_EXPORT void + zdir_fprint (zdir_t *self, FILE *file, int indent); + +// Print contents of directory to stdout +CZMQ_EXPORT void + zdir_print (zdir_t *self, int indent); + +// Create a new zdir_watch actor instance: +// +// zactor_t *watch = zactor_new (zdir_watch, NULL); +// +// Destroy zdir_watch instance: +// +// zactor_destroy (&watch); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (watch, "VERBOSE"); +// +// Subscribe to changes to a directory path: +// +// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); +// +// Unsubscribe from changes to a directory path: +// +// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); +// +// Receive directory changes: +// zsock_recv (watch, "sp", &path, &patches); +// +// // Delete the received data. +// free (path); +// zlist_destroy (&patches); +CZMQ_EXPORT void + zdir_watch (zsock_t *pipe, void *unused); + +// Self test of this class. +CZMQ_EXPORT void + zdir_test (bool verbose); + +// @end + + +// Returns a sorted array of zfile objects; returns a single block of memory, +// that you destroy by calling zstr_free(). Each entry in the array is a pointer +// to a zfile_t item already allocated in the zdir tree. The array ends with +// a null pointer. Do not destroy the original zdir tree until you are done +// with this array. +CZMQ_EXPORT zfile_t ** + zdir_flatten (zdir_t *self); + +// Free a provided string, and nullify the parent pointer. Safe to call on +// a null pointer. +CZMQ_EXPORT void + zdir_flatten_free (zfile_t ***files_p); + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zdir_dump(s,i) zdir_print(s,i) + +#endif diff --git a/phonelibs/zmq/arm/include/zdir_patch.h b/phonelibs/zmq/arm/include/zdir_patch.h new file mode 100644 index 00000000000000..8d15b9aeb40c42 --- /dev/null +++ b/phonelibs/zmq/arm/include/zdir_patch.h @@ -0,0 +1,82 @@ +/* ========================================================================= + zdir_patch - work with directory patches + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZDIR_PATCH_H_INCLUDED__ +#define __ZDIR_PATCH_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// un-namespaced enumeration values +#define patch_create ZDIR_PATCH_CREATE +#define patch_delete ZDIR_PATCH_DELETE + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zdir_patch.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +#define ZDIR_PATCH_CREATE 1 // Creates a new file +#define ZDIR_PATCH_DELETE 2 // Delete a file + +// Create new patch +CZMQ_EXPORT zdir_patch_t * + zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); + +// Destroy a patch +CZMQ_EXPORT void + zdir_patch_destroy (zdir_patch_t **self_p); + +// Create copy of a patch. If the patch is null, or memory was exhausted, +// returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zdir_patch_t * + zdir_patch_dup (zdir_patch_t *self); + +// Return patch file directory path +CZMQ_EXPORT const char * + zdir_patch_path (zdir_patch_t *self); + +// Return patch file item +CZMQ_EXPORT zfile_t * + zdir_patch_file (zdir_patch_t *self); + +// Return operation +CZMQ_EXPORT int + zdir_patch_op (zdir_patch_t *self); + +// Return patch virtual file path +CZMQ_EXPORT const char * + zdir_patch_vpath (zdir_patch_t *self); + +// Calculate hash digest for file (create only) +CZMQ_EXPORT void + zdir_patch_digest_set (zdir_patch_t *self); + +// Return hash digest for patch file +CZMQ_EXPORT const char * + zdir_patch_digest (zdir_patch_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zdir_patch_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zfile.h b/phonelibs/zmq/arm/include/zfile.h new file mode 100644 index 00000000000000..75c35774b97fd1 --- /dev/null +++ b/phonelibs/zmq/arm/include/zfile.h @@ -0,0 +1,177 @@ +/* ========================================================================= + zfile - helper functions for working with files. + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZFILE_H_INCLUDED__ +#define __ZFILE_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zfile.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// If file exists, populates properties. CZMQ supports portable symbolic +// links, which are files with the extension ".ln". A symbolic link is a +// text file containing one line, the filename of a target file. Reading +// data from the symbolic link actually reads from the target file. Path +// may be NULL, in which case it is not used. +CZMQ_EXPORT zfile_t * + zfile_new (const char *path, const char *name); + +// Destroy a file item +CZMQ_EXPORT void + zfile_destroy (zfile_t **self_p); + +// Duplicate a file item, returns a newly constructed item. If the file +// is null, or memory was exhausted, returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zfile_t * + zfile_dup (zfile_t *self); + +// Return file name, remove path if provided +CZMQ_EXPORT const char * + zfile_filename (zfile_t *self, const char *path); + +// Refresh file properties from disk; this is not done automatically +// on access methods, otherwise it is not possible to compare directory +// snapshots. +CZMQ_EXPORT void + zfile_restat (zfile_t *self); + +// Return when the file was last modified. If you want this to reflect the +// current situation, call zfile_restat before checking this property. +CZMQ_EXPORT time_t + zfile_modified (zfile_t *self); + +// Return the last-known size of the file. If you want this to reflect the +// current situation, call zfile_restat before checking this property. +CZMQ_EXPORT off_t + zfile_cursize (zfile_t *self); + +// Return true if the file is a directory. If you want this to reflect +// any external changes, call zfile_restat before checking this property. +CZMQ_EXPORT bool + zfile_is_directory (zfile_t *self); + +// Return true if the file is a regular file. If you want this to reflect +// any external changes, call zfile_restat before checking this property. +CZMQ_EXPORT bool + zfile_is_regular (zfile_t *self); + +// Return true if the file is readable by this process. If you want this to +// reflect any external changes, call zfile_restat before checking this +// property. +CZMQ_EXPORT bool + zfile_is_readable (zfile_t *self); + +// Return true if the file is writeable by this process. If you want this +// to reflect any external changes, call zfile_restat before checking this +// property. +CZMQ_EXPORT bool + zfile_is_writeable (zfile_t *self); + +// Check if file has stopped changing and can be safely processed. +// Updates the file statistics from disk at every call. +CZMQ_EXPORT bool + zfile_is_stable (zfile_t *self); + +// Return true if the file was changed on disk since the zfile_t object +// was created, or the last zfile_restat() call made on it. +CZMQ_EXPORT bool + zfile_has_changed (zfile_t *self); + +// Remove the file from disk +CZMQ_EXPORT void + zfile_remove (zfile_t *self); + +// Open file for reading +// Returns 0 if OK, -1 if not found or not accessible +CZMQ_EXPORT int + zfile_input (zfile_t *self); + +// Open file for writing, creating directory if needed +// File is created if necessary; chunks can be written to file at any +// location. Returns 0 if OK, -1 if error. +CZMQ_EXPORT int + zfile_output (zfile_t *self); + +// Read chunk from file at specified position. If this was the last chunk, +// sets the eof property. Returns a null chunk in case of error. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zchunk_t * + zfile_read (zfile_t *self, size_t bytes, off_t offset); + +// Returns true if zfile_read() just read the last chunk in the file. +CZMQ_EXPORT bool + zfile_eof (zfile_t *self); + +// Write chunk to file at specified position +// Return 0 if OK, else -1 +CZMQ_EXPORT int + zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); + +// Read next line of text from file. Returns a pointer to the text line, +// or NULL if there was nothing more to read from the file. +CZMQ_EXPORT const char * + zfile_readln (zfile_t *self); + +// Close file, if open +CZMQ_EXPORT void + zfile_close (zfile_t *self); + +// Return file handle, if opened +CZMQ_EXPORT FILE * + zfile_handle (zfile_t *self); + +// Calculate SHA1 digest for file, using zdigest class. +CZMQ_EXPORT const char * + zfile_digest (zfile_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zfile_test (bool verbose); + +// @end + + +// @interface +// These methods are deprecated, and now moved to zsys class. +CZMQ_EXPORT bool + zfile_exists (const char *filename); +CZMQ_EXPORT ssize_t + zfile_size (const char *filename); +CZMQ_EXPORT mode_t + zfile_mode (const char *filename); +CZMQ_EXPORT int + zfile_delete (const char *filename); +CZMQ_EXPORT bool + zfile_stable (const char *filename); +CZMQ_EXPORT int + zfile_mkdir (const char *pathname); +CZMQ_EXPORT int + zfile_rmdir (const char *pathname); +CZMQ_EXPORT void + zfile_mode_private (void); +CZMQ_EXPORT void + zfile_mode_default (void); +// @end + +#ifdef __cplusplus +} +#endif + + +#endif // __ZFILE_H_INCLUDED__ diff --git a/phonelibs/zmq/arm/include/zframe.h b/phonelibs/zmq/arm/include/zframe.h new file mode 100644 index 00000000000000..728093c36ce117 --- /dev/null +++ b/phonelibs/zmq/arm/include/zframe.h @@ -0,0 +1,176 @@ +/* ========================================================================= + zframe - working with single message frames + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZFRAME_H_INCLUDED__ +#define __ZFRAME_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zframe.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +#define ZFRAME_MORE 1 // +#define ZFRAME_REUSE 2 // +#define ZFRAME_DONTWAIT 4 // + +// Create a new frame. If size is not null, allocates the frame data +// to the specified size. If additionally, data is not null, copies +// size octets from the specified data into the frame body. +CZMQ_EXPORT zframe_t * + zframe_new (const void *data, size_t size); + +// Create an empty (zero-sized) frame +CZMQ_EXPORT zframe_t * + zframe_new_empty (void); + +// Create a frame with a specified string content. +CZMQ_EXPORT zframe_t * + zframe_from (const char *string); + +// Receive frame from socket, returns zframe_t object or NULL if the recv +// was interrupted. Does a blocking recv, if you want to not block then use +// zpoller or zloop. +CZMQ_EXPORT zframe_t * + zframe_recv (void *source); + +// Destroy a frame +CZMQ_EXPORT void + zframe_destroy (zframe_t **self_p); + +// Send a frame to a socket, destroy frame after sending. +// Return -1 on error, 0 on success. +CZMQ_EXPORT int + zframe_send (zframe_t **self_p, void *dest, int flags); + +// Return number of bytes in frame data +CZMQ_EXPORT size_t + zframe_size (zframe_t *self); + +// Return address of frame data +CZMQ_EXPORT byte * + zframe_data (zframe_t *self); + +// Return meta data property for frame +// Caller must free string when finished with it. +CZMQ_EXPORT const char * + zframe_meta (zframe_t *self, const char *property); + +// Create a new frame that duplicates an existing frame. If frame is null, +// or memory was exhausted, returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zframe_dup (zframe_t *self); + +// Return frame data encoded as printable hex string, useful for 0MQ UUIDs. +// Caller must free string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zframe_strhex (zframe_t *self); + +// Return frame data copied into freshly allocated string +// Caller must free string when finished with it. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zframe_strdup (zframe_t *self); + +// Return TRUE if frame body is equal to string, excluding terminator +CZMQ_EXPORT bool + zframe_streq (zframe_t *self, const char *string); + +// Return frame MORE indicator (1 or 0), set when reading frame from socket +// or by the zframe_set_more() method +CZMQ_EXPORT int + zframe_more (zframe_t *self); + +// Set frame MORE indicator (1 or 0). Note this is NOT used when sending +// frame to socket, you have to specify flag explicitly. +CZMQ_EXPORT void + zframe_set_more (zframe_t *self, int more); + +// Return TRUE if two frames have identical size and data +// If either frame is NULL, equality is always false. +CZMQ_EXPORT bool + zframe_eq (zframe_t *self, zframe_t *other); + +// Set new contents for frame +CZMQ_EXPORT void + zframe_reset (zframe_t *self, const void *data, size_t size); + +// Send message to zsys log sink (may be stdout, or system facility as +// configured by zsys_set_logstream). Prefix shows before frame, if not null. +CZMQ_EXPORT void + zframe_print (zframe_t *self, const char *prefix); + +// Probe the supplied object, and report if it looks like a zframe_t. +CZMQ_EXPORT bool + zframe_is (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zframe_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Return frame routing ID, if the frame came from a ZMQ_SERVER socket. +// Else returns zero. +CZMQ_EXPORT uint32_t + zframe_routing_id (zframe_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on frame. This is used if/when the frame is sent to a +// ZMQ_SERVER socket. +CZMQ_EXPORT void + zframe_set_routing_id (zframe_t *self, uint32_t routing_id); + +// *** Draft method, for development use, may change without warning *** +// Return frame group of radio-dish pattern. +CZMQ_EXPORT const char * + zframe_group (zframe_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set group on frame. This is used if/when the frame is sent to a +// ZMQ_RADIO socket. +// Return -1 on error, 0 on success. +CZMQ_EXPORT int + zframe_set_group (zframe_t *self, const char *group); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +// DEPRECATED as poor style -- callers should use zloop or zpoller +// Receive a new frame off the socket. Returns newly allocated frame, or +// NULL if there was no input waiting, or if the read was interrupted. +CZMQ_EXPORT zframe_t * + zframe_recv_nowait (void *source); + +// DEPRECATED as inconsistent; breaks principle that logging should all go +// to a single destination. +// Print contents of the frame to FILE stream. +CZMQ_EXPORT void + zframe_fprint (zframe_t *self, const char *prefix, FILE *file); + +// Deprecated method aliases +#define zframe_print_to_stream(s,p,F) zframe_fprint(s,p,F) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zgossip.h b/phonelibs/zmq/arm/include/zgossip.h new file mode 100644 index 00000000000000..647cb28c080731 --- /dev/null +++ b/phonelibs/zmq/arm/include/zgossip.h @@ -0,0 +1,95 @@ +/* ========================================================================= + zgossip - zgossip server + + ** WARNING ************************************************************* + THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose + your changes at the next build cycle. This is great for temporary printf + statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places + for commits are: + + * The XML model used for this code generation: zgossip.xml, or + * The code generation script that built this file: zproto_server_c + ************************************************************************ + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef ZGOSSIP_H_INCLUDED +#define ZGOSSIP_H_INCLUDED + +#include "czmq.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// To work with zgossip, use the CZMQ zactor API: +// +// Create new zgossip instance, passing logging prefix: +// +// zactor_t *zgossip = zactor_new (zgossip, "myname"); +// +// Destroy zgossip instance +// +// zactor_destroy (&zgossip); +// +// Enable verbose logging of commands and activity: +// +// zstr_send (zgossip, "VERBOSE"); +// +// Bind zgossip to specified endpoint. TCP endpoints may specify +// the port number as "*" to aquire an ephemeral port: +// +// zstr_sendx (zgossip, "BIND", endpoint, NULL); +// +// Return assigned port number, specifically when BIND was done using an +// an ephemeral port: +// +// zstr_sendx (zgossip, "PORT", NULL); +// char *command, *port_str; +// zstr_recvx (zgossip, &command, &port_str, NULL); +// assert (streq (command, "PORT")); +// +// Specify configuration file to load, overwriting any previous loaded +// configuration file or options: +// +// zstr_sendx (zgossip, "LOAD", filename, NULL); +// +// Set configuration path value: +// +// zstr_sendx (zgossip, "SET", path, value, NULL); +// +// Save configuration data to config file on disk: +// +// zstr_sendx (zgossip, "SAVE", filename, NULL); +// +// Send zmsg_t instance to zgossip: +// +// zactor_send (zgossip, &msg); +// +// Receive zmsg_t instance from zgossip: +// +// zmsg_t *msg = zactor_recv (zgossip); +// +// This is the zgossip constructor as a zactor_fn: +// +CZMQ_EXPORT void + zgossip (zsock_t *pipe, void *args); + +// Self test of this class +CZMQ_EXPORT void + zgossip_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zhash.h b/phonelibs/zmq/arm/include/zhash.h new file mode 100644 index 00000000000000..929bc2683aec36 --- /dev/null +++ b/phonelibs/zmq/arm/include/zhash.h @@ -0,0 +1,198 @@ +/* ========================================================================= + zhash - generic type-free hash container (simple) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZHASH_H_INCLUDED__ +#define __ZHASH_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zhash.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has legacy methods, which will be removed over time. You +// should not use them, and migrate any code that is still using them. +// Callback function for zhash_freefn method +typedef void (zhash_free_fn) ( + void *data); + +// Callback function for zhash_foreach method. Deprecated. +typedef int (zhash_foreach_fn) ( + const char *key, void *item, void *argument); + +// Create a new, empty hash container +CZMQ_EXPORT zhash_t * + zhash_new (void); + +// Unpack binary frame into a new hash table. Packed data must follow format +// defined by zhash_pack. Hash table is set to autofree. An empty frame +// unpacks to an empty hash table. +CZMQ_EXPORT zhash_t * + zhash_unpack (zframe_t *frame); + +// Destroy a hash container and all items in it +CZMQ_EXPORT void + zhash_destroy (zhash_t **self_p); + +// Insert item into hash table with specified key and item. +// If key is already present returns -1 and leaves existing item unchanged +// Returns 0 on success. +CZMQ_EXPORT int + zhash_insert (zhash_t *self, const char *key, void *item); + +// Update item into hash table with specified key and item. +// If key is already present, destroys old item and inserts new one. +// Use free_fn method to ensure deallocator is properly called on item. +CZMQ_EXPORT void + zhash_update (zhash_t *self, const char *key, void *item); + +// Remove an item specified by key from the hash table. If there was no such +// item, this function does nothing. +CZMQ_EXPORT void + zhash_delete (zhash_t *self, const char *key); + +// Return the item at the specified key, or null +CZMQ_EXPORT void * + zhash_lookup (zhash_t *self, const char *key); + +// Reindexes an item from an old key to a new key. If there was no such +// item, does nothing. Returns 0 if successful, else -1. +CZMQ_EXPORT int + zhash_rename (zhash_t *self, const char *old_key, const char *new_key); + +// Set a free function for the specified hash table item. When the item is +// destroyed, the free function, if any, is called on that item. +// Use this when hash items are dynamically allocated, to ensure that +// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. +// Returns the item, or NULL if there is no such item. +CZMQ_EXPORT void * + zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); + +// Return the number of keys/items in the hash table +CZMQ_EXPORT size_t + zhash_size (zhash_t *self); + +// Make copy of hash table; if supplied table is null, returns null. +// Does not copy items themselves. Rebuilds new table so may be slow on +// very large tables. NOTE: only works with item values that are strings +// since there's no other way to know how to duplicate the item value. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zhash_t * + zhash_dup (zhash_t *self); + +// Return keys for items in table +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zhash_keys (zhash_t *self); + +// Simple iterator; returns first item in hash table, in no given order, +// or NULL if the table is empty. This method is simpler to use than the +// foreach() method, which is deprecated. To access the key for this item +// use zhash_cursor(). NOTE: do NOT modify the table while iterating. +CZMQ_EXPORT void * + zhash_first (zhash_t *self); + +// Simple iterator; returns next item in hash table, in no given order, +// or NULL if the last item was already returned. Use this together with +// zhash_first() to process all items in a hash table. If you need the +// items in sorted order, use zhash_keys() and then zlist_sort(). To +// access the key for this item use zhash_cursor(). NOTE: do NOT modify +// the table while iterating. +CZMQ_EXPORT void * + zhash_next (zhash_t *self); + +// After a successful first/next method, returns the key for the item that +// was returned. This is a constant string that you may not modify or +// deallocate, and which lasts as long as the item in the hash. After an +// unsuccessful first/next, returns NULL. +CZMQ_EXPORT const char * + zhash_cursor (zhash_t *self); + +// Add a comment to hash table before saving to disk. You can add as many +// comment lines as you like. These comment lines are discarded when loading +// the file. If you use a null format, all comments are deleted. +CZMQ_EXPORT void + zhash_comment (zhash_t *self, const char *format, ...); + +// Serialize hash table to a binary frame that can be sent in a message. +// The packed format is compatible with the 'dictionary' type defined in +// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: +// +// ; A list of name/value pairs +// dictionary = dict-count *( dict-name dict-value ) +// dict-count = number-4 +// dict-value = longstr +// dict-name = string +// +// ; Strings are always length + text contents +// longstr = number-4 *VCHAR +// string = number-1 *VCHAR +// +// ; Numbers are unsigned integers in network byte order +// number-1 = 1OCTET +// number-4 = 4OCTET +// +// Comments are not included in the packed data. Item values MUST be +// strings. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zhash_pack (zhash_t *self); + +// Save hash table to a text file in name=value format. Hash values must be +// printable strings; keys may not contain '=' character. Returns 0 if OK, +// else -1 if a file error occurred. +CZMQ_EXPORT int + zhash_save (zhash_t *self, const char *filename); + +// Load hash table from a text file in name=value format; hash table must +// already exist. Hash values must printable strings; keys may not contain +// '=' character. Returns 0 if OK, else -1 if a file was not readable. +CZMQ_EXPORT int + zhash_load (zhash_t *self, const char *filename); + +// When a hash table was loaded from a file by zhash_load, this method will +// reload the file if it has been modified since, and is "stable", i.e. not +// still changing. Returns 0 if OK, -1 if there was an error reloading the +// file. +CZMQ_EXPORT int + zhash_refresh (zhash_t *self); + +// Set hash for automatic value destruction +CZMQ_EXPORT void + zhash_autofree (zhash_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Apply function to each item in the hash table. Items are iterated in no +// defined order. Stops if callback function returns non-zero and returns +// final return code from callback function (zero = success). Deprecated. +CZMQ_EXPORT int + zhash_foreach (zhash_t *self, zhash_foreach_fn callback, void *argument); + +// Self test of this class. +CZMQ_EXPORT void + zhash_test (bool verbose); + +// @ignore +CZMQ_EXPORT void + zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zhashx.h b/phonelibs/zmq/arm/include/zhashx.h new file mode 100644 index 00000000000000..8776073156cf3c --- /dev/null +++ b/phonelibs/zmq/arm/include/zhashx.h @@ -0,0 +1,301 @@ +/* ========================================================================= + zhashx - extended generic type-free hash container + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZHASHX_H_INCLUDED__ +#define __ZHASHX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zhashx.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// This class has legacy methods, which will be removed over time. You +// should not use them, and migrate any code that is still using them. +// Destroy an item +typedef void (zhashx_destructor_fn) ( + void **item); + +// Duplicate an item +typedef void * (zhashx_duplicator_fn) ( + const void *item); + +// Compare two items, for sorting +typedef int (zhashx_comparator_fn) ( + const void *item1, const void *item2); + +// compare two items, for sorting +typedef void (zhashx_free_fn) ( + void *data); + +// compare two items, for sorting +typedef size_t (zhashx_hash_fn) ( + const void *key); + +// Serializes an item to a longstr. +// The caller takes ownership of the newly created object. +typedef char * (zhashx_serializer_fn) ( + const void *item); + +// Deserializes a longstr into an item. +// The caller takes ownership of the newly created object. +typedef void * (zhashx_deserializer_fn) ( + const char *item_str); + +// Callback function for zhashx_foreach method. +// This callback is deprecated and you should use zhashx_first/_next instead. +typedef int (zhashx_foreach_fn) ( + const char *key, void *item, void *argument); + +// Create a new, empty hash container +CZMQ_EXPORT zhashx_t * + zhashx_new (void); + +// Unpack binary frame into a new hash table. Packed data must follow format +// defined by zhashx_pack. Hash table is set to autofree. An empty frame +// unpacks to an empty hash table. +CZMQ_EXPORT zhashx_t * + zhashx_unpack (zframe_t *frame); + +// Destroy a hash container and all items in it +CZMQ_EXPORT void + zhashx_destroy (zhashx_t **self_p); + +// Insert item into hash table with specified key and item. +// If key is already present returns -1 and leaves existing item unchanged +// Returns 0 on success. +CZMQ_EXPORT int + zhashx_insert (zhashx_t *self, const void *key, void *item); + +// Update or insert item into hash table with specified key and item. If the +// key is already present, destroys old item and inserts new one. If you set +// a container item destructor, this is called on the old value. If the key +// was not already present, inserts a new item. Sets the hash cursor to the +// new item. +CZMQ_EXPORT void + zhashx_update (zhashx_t *self, const void *key, void *item); + +// Remove an item specified by key from the hash table. If there was no such +// item, this function does nothing. +CZMQ_EXPORT void + zhashx_delete (zhashx_t *self, const void *key); + +// Delete all items from the hash table. If the key destructor is +// set, calls it on every key. If the item destructor is set, calls +// it on every item. +CZMQ_EXPORT void + zhashx_purge (zhashx_t *self); + +// Return the item at the specified key, or null +CZMQ_EXPORT void * + zhashx_lookup (zhashx_t *self, const void *key); + +// Reindexes an item from an old key to a new key. If there was no such +// item, does nothing. Returns 0 if successful, else -1. +CZMQ_EXPORT int + zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); + +// Set a free function for the specified hash table item. When the item is +// destroyed, the free function, if any, is called on that item. +// Use this when hash items are dynamically allocated, to ensure that +// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. +// Returns the item, or NULL if there is no such item. +CZMQ_EXPORT void * + zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); + +// Return the number of keys/items in the hash table +CZMQ_EXPORT size_t + zhashx_size (zhashx_t *self); + +// Return a zlistx_t containing the keys for the items in the +// table. Uses the key_duplicator to duplicate all keys and sets the +// key_destructor as destructor for the list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlistx_t * + zhashx_keys (zhashx_t *self); + +// Return a zlistx_t containing the values for the items in the +// table. Uses the duplicator to duplicate all items and sets the +// destructor as destructor for the list. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlistx_t * + zhashx_values (zhashx_t *self); + +// Simple iterator; returns first item in hash table, in no given order, +// or NULL if the table is empty. This method is simpler to use than the +// foreach() method, which is deprecated. To access the key for this item +// use zhashx_cursor(). NOTE: do NOT modify the table while iterating. +CZMQ_EXPORT void * + zhashx_first (zhashx_t *self); + +// Simple iterator; returns next item in hash table, in no given order, +// or NULL if the last item was already returned. Use this together with +// zhashx_first() to process all items in a hash table. If you need the +// items in sorted order, use zhashx_keys() and then zlistx_sort(). To +// access the key for this item use zhashx_cursor(). NOTE: do NOT modify +// the table while iterating. +CZMQ_EXPORT void * + zhashx_next (zhashx_t *self); + +// After a successful first/next method, returns the key for the item that +// was returned. This is a constant string that you may not modify or +// deallocate, and which lasts as long as the item in the hash. After an +// unsuccessful first/next, returns NULL. +CZMQ_EXPORT const void * + zhashx_cursor (zhashx_t *self); + +// Add a comment to hash table before saving to disk. You can add as many +// comment lines as you like. These comment lines are discarded when loading +// the file. If you use a null format, all comments are deleted. +CZMQ_EXPORT void + zhashx_comment (zhashx_t *self, const char *format, ...); + +// Save hash table to a text file in name=value format. Hash values must be +// printable strings; keys may not contain '=' character. Returns 0 if OK, +// else -1 if a file error occurred. +CZMQ_EXPORT int + zhashx_save (zhashx_t *self, const char *filename); + +// Load hash table from a text file in name=value format; hash table must +// already exist. Hash values must printable strings; keys may not contain +// '=' character. Returns 0 if OK, else -1 if a file was not readable. +CZMQ_EXPORT int + zhashx_load (zhashx_t *self, const char *filename); + +// When a hash table was loaded from a file by zhashx_load, this method will +// reload the file if it has been modified since, and is "stable", i.e. not +// still changing. Returns 0 if OK, -1 if there was an error reloading the +// file. +CZMQ_EXPORT int + zhashx_refresh (zhashx_t *self); + +// Serialize hash table to a binary frame that can be sent in a message. +// The packed format is compatible with the 'dictionary' type defined in +// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: +// +// ; A list of name/value pairs +// dictionary = dict-count *( dict-name dict-value ) +// dict-count = number-4 +// dict-value = longstr +// dict-name = string +// +// ; Strings are always length + text contents +// longstr = number-4 *VCHAR +// string = number-1 *VCHAR +// +// ; Numbers are unsigned integers in network byte order +// number-1 = 1OCTET +// number-4 = 4OCTET +// +// Comments are not included in the packed data. Item values MUST be +// strings. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zhashx_pack (zhashx_t *self); + +// Make a copy of the list; items are duplicated if you set a duplicator +// for the list, otherwise not. Copying a null reference returns a null +// reference. Note that this method's behavior changed slightly for CZMQ +// v3.x, as it does not set nor respect autofree. It does however let you +// duplicate any hash table safely. The old behavior is in zhashx_dup_v2. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zhashx_t * + zhashx_dup (zhashx_t *self); + +// Set a user-defined deallocator for hash items; by default items are not +// freed when the hash is destroyed. +CZMQ_EXPORT void + zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); + +// Set a user-defined duplicator for hash items; by default items are not +// copied when the hash is duplicated. +CZMQ_EXPORT void + zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); + +// Set a user-defined deallocator for keys; by default keys are freed +// when the hash is destroyed using free(). +CZMQ_EXPORT void + zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); + +// Set a user-defined duplicator for keys; by default keys are duplicated +// using strdup. +CZMQ_EXPORT void + zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); + +// Set a user-defined comparator for keys; by default keys are +// compared using strcmp. +CZMQ_EXPORT void + zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); + +// Set a user-defined comparator for keys; by default keys are +// compared using strcmp. +CZMQ_EXPORT void + zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); + +// Make copy of hash table; if supplied table is null, returns null. +// Does not copy items themselves. Rebuilds new table so may be slow on +// very large tables. NOTE: only works with item values that are strings +// since there's no other way to know how to duplicate the item value. +CZMQ_EXPORT zhashx_t * + zhashx_dup_v2 (zhashx_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Set hash for automatic value destruction. This method is deprecated +// and you should use set_destructor instead. +CZMQ_EXPORT void + zhashx_autofree (zhashx_t *self); + +// *** Deprecated method, slated for removal: avoid using it *** +// Apply function to each item in the hash table. Items are iterated in no +// defined order. Stops if callback function returns non-zero and returns +// final return code from callback function (zero = success). This method +// is deprecated and you should use zhashx_first/_next instead. +CZMQ_EXPORT int + zhashx_foreach (zhashx_t *self, zhashx_foreach_fn callback, void *argument); + +// Self test of this class. +CZMQ_EXPORT void + zhashx_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Same as unpack but uses a user-defined deserializer function to convert +// a longstr back into item format. +CZMQ_EXPORT zhashx_t * + zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); + +// *** Draft method, for development use, may change without warning *** +// Same as pack but uses a user-defined serializer function to convert items +// into longstr. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT void + zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/ziflist.h b/phonelibs/zmq/arm/include/ziflist.h new file mode 100644 index 00000000000000..cb2b1448025f89 --- /dev/null +++ b/phonelibs/zmq/arm/include/ziflist.h @@ -0,0 +1,77 @@ +/* ========================================================================= + ziflist - List of network interfaces available on system + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZIFLIST_H_INCLUDED__ +#define __ZIFLIST_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/ziflist.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Get a list of network interfaces currently defined on the system +CZMQ_EXPORT ziflist_t * + ziflist_new (void); + +// Destroy a ziflist instance +CZMQ_EXPORT void + ziflist_destroy (ziflist_t **self_p); + +// Reload network interfaces from system +CZMQ_EXPORT void + ziflist_reload (ziflist_t *self); + +// Return the number of network interfaces on system +CZMQ_EXPORT size_t + ziflist_size (ziflist_t *self); + +// Get first network interface, return NULL if there are none +CZMQ_EXPORT const char * + ziflist_first (ziflist_t *self); + +// Get next network interface, return NULL if we hit the last one +CZMQ_EXPORT const char * + ziflist_next (ziflist_t *self); + +// Return the current interface IP address as a printable string +CZMQ_EXPORT const char * + ziflist_address (ziflist_t *self); + +// Return the current interface broadcast address as a printable string +CZMQ_EXPORT const char * + ziflist_broadcast (ziflist_t *self); + +// Return the current interface network mask as a printable string +CZMQ_EXPORT const char * + ziflist_netmask (ziflist_t *self); + +// Return the list of interfaces. +CZMQ_EXPORT void + ziflist_print (ziflist_t *self); + +// Self test of this class. +CZMQ_EXPORT void + ziflist_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zlist.h b/phonelibs/zmq/arm/include/zlist.h new file mode 100644 index 00000000000000..1dcd39b9955c9e --- /dev/null +++ b/phonelibs/zmq/arm/include/zlist.h @@ -0,0 +1,158 @@ +/* ========================================================================= + zlist - simple generic list container + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZLIST_H_INCLUDED__ +#define __ZLIST_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zlist.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Comparison function e.g. for sorting and removing. +typedef int (zlist_compare_fn) ( + void *item1, void *item2); + +// Callback function for zlist_freefn method +typedef void (zlist_free_fn) ( + void *data); + +// Create a new list container +CZMQ_EXPORT zlist_t * + zlist_new (void); + +// Destroy a list container +CZMQ_EXPORT void + zlist_destroy (zlist_t **self_p); + +// Return the item at the head of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the head item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlist_first (zlist_t *self); + +// Return the next item. If the list is empty, returns NULL. To move to +// the start of the list call zlist_first (). Advances the cursor. +CZMQ_EXPORT void * + zlist_next (zlist_t *self); + +// Return the item at the tail of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the tail item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlist_last (zlist_t *self); + +// Return first item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlist_head (zlist_t *self); + +// Return last item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlist_tail (zlist_t *self); + +// Return the current item of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the current item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlist_item (zlist_t *self); + +// Append an item to the end of the list, return 0 if OK or -1 if this +// failed for some reason (out of memory). Note that if a duplicator has +// been set, this method will also duplicate the item. +CZMQ_EXPORT int + zlist_append (zlist_t *self, void *item); + +// Push an item to the start of the list, return 0 if OK or -1 if this +// failed for some reason (out of memory). Note that if a duplicator has +// been set, this method will also duplicate the item. +CZMQ_EXPORT int + zlist_push (zlist_t *self, void *item); + +// Pop the item off the start of the list, if any +CZMQ_EXPORT void * + zlist_pop (zlist_t *self); + +// Checks if an item already is present. Uses compare method to determine if +// items are equal. If the compare method is NULL the check will only compare +// pointers. Returns true if item is present else false. +CZMQ_EXPORT bool + zlist_exists (zlist_t *self, void *item); + +// Remove the specified item from the list if present +CZMQ_EXPORT void + zlist_remove (zlist_t *self, void *item); + +// Make a copy of list. If the list has autofree set, the copied list will +// duplicate all items, which must be strings. Otherwise, the list will hold +// pointers back to the items in the original list. If list is null, returns +// NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zlist_t * + zlist_dup (zlist_t *self); + +// Purge all items from list +CZMQ_EXPORT void + zlist_purge (zlist_t *self); + +// Return number of items in the list +CZMQ_EXPORT size_t + zlist_size (zlist_t *self); + +// Sort the list. If the compare function is null, sorts the list by +// ascending key value using a straight ASCII comparison. If you specify +// a compare function, this decides how items are sorted. The sort is not +// stable, so may reorder items with the same keys. The algorithm used is +// combsort, a compromise between performance and simplicity. +CZMQ_EXPORT void + zlist_sort (zlist_t *self, zlist_compare_fn compare); + +// Set list for automatic item destruction; item values MUST be strings. +// By default a list item refers to a value held elsewhere. When you set +// this, each time you append or push a list item, zlist will take a copy +// of the string value. Then, when you destroy the list, it will free all +// item values automatically. If you use any other technique to allocate +// list values, you must free them explicitly before destroying the list. +// The usual technique is to pop list items and destroy them, until the +// list is empty. +CZMQ_EXPORT void + zlist_autofree (zlist_t *self); + +// Sets a compare function for this list. The function compares two items. +// It returns an integer less than, equal to, or greater than zero if the +// first item is found, respectively, to be less than, to match, or be +// greater than the second item. +// This function is used for sorting, removal and exists checking. +CZMQ_EXPORT void + zlist_comparefn (zlist_t *self, zlist_compare_fn fn); + +// Set a free function for the specified list item. When the item is +// destroyed, the free function, if any, is called on that item. +// Use this when list items are dynamically allocated, to ensure that +// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. +// Returns the item, or NULL if there is no such item. +CZMQ_EXPORT void * + zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); + +// Self test of this class. +CZMQ_EXPORT void + zlist_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zlistx.h b/phonelibs/zmq/arm/include/zlistx.h new file mode 100644 index 00000000000000..512637cef3bff5 --- /dev/null +++ b/phonelibs/zmq/arm/include/zlistx.h @@ -0,0 +1,205 @@ +/* ========================================================================= + zlistx - extended generic list container + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZLISTX_H_INCLUDED__ +#define __ZLISTX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zlistx.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Destroy an item +typedef void (zlistx_destructor_fn) ( + void **item); + +// Duplicate an item +typedef void * (zlistx_duplicator_fn) ( + const void *item); + +// Compare two items, for sorting +typedef int (zlistx_comparator_fn) ( + const void *item1, const void *item2); + +// Create a new, empty list. +CZMQ_EXPORT zlistx_t * + zlistx_new (void); + +// Destroy a list. If an item destructor was specified, all items in the +// list are automatically destroyed as well. +CZMQ_EXPORT void + zlistx_destroy (zlistx_t **self_p); + +// Add an item to the head of the list. Calls the item duplicator, if any, +// on the item. Resets cursor to list head. Returns an item handle on +// success, NULL if memory was exhausted. +CZMQ_EXPORT void * + zlistx_add_start (zlistx_t *self, void *item); + +// Add an item to the tail of the list. Calls the item duplicator, if any, +// on the item. Resets cursor to list head. Returns an item handle on +// success, NULL if memory was exhausted. +CZMQ_EXPORT void * + zlistx_add_end (zlistx_t *self, void *item); + +// Return the number of items in the list +CZMQ_EXPORT size_t + zlistx_size (zlistx_t *self); + +// Return first item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlistx_head (zlistx_t *self); + +// Return last item in the list, or null, leaves the cursor +CZMQ_EXPORT void * + zlistx_tail (zlistx_t *self); + +// Return the item at the head of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the head item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlistx_first (zlistx_t *self); + +// Return the next item. At the end of the list (or in an empty list), +// returns NULL. Use repeated zlistx_next () calls to work through the list +// from zlistx_first (). First time, acts as zlistx_first(). +CZMQ_EXPORT void * + zlistx_next (zlistx_t *self); + +// Return the previous item. At the start of the list (or in an empty list), +// returns NULL. Use repeated zlistx_prev () calls to work through the list +// backwards from zlistx_last (). First time, acts as zlistx_last(). +CZMQ_EXPORT void * + zlistx_prev (zlistx_t *self); + +// Return the item at the tail of list. If the list is empty, returns NULL. +// Leaves cursor pointing at the tail item, or NULL if the list is empty. +CZMQ_EXPORT void * + zlistx_last (zlistx_t *self); + +// Returns the value of the item at the cursor, or NULL if the cursor is +// not pointing to an item. +CZMQ_EXPORT void * + zlistx_item (zlistx_t *self); + +// Returns the handle of the item at the cursor, or NULL if the cursor is +// not pointing to an item. +CZMQ_EXPORT void * + zlistx_cursor (zlistx_t *self); + +// Returns the item associated with the given list handle, or NULL if passed +// in handle is NULL. Asserts that the passed in handle points to a list element. +CZMQ_EXPORT void * + zlistx_handle_item (void *handle); + +// Find an item in the list, searching from the start. Uses the item +// comparator, if any, else compares item values directly. Returns the +// item handle found, or NULL. Sets the cursor to the found item, if any. +CZMQ_EXPORT void * + zlistx_find (zlistx_t *self, void *item); + +// Detach an item from the list, using its handle. The item is not modified, +// and the caller is responsible for destroying it if necessary. If handle is +// null, detaches the first item on the list. Returns item that was detached, +// or null if none was. If cursor was at item, moves cursor to previous item, +// so you can detach items while iterating forwards through a list. +CZMQ_EXPORT void * + zlistx_detach (zlistx_t *self, void *handle); + +// Detach item at the cursor, if any, from the list. The item is not modified, +// and the caller is responsible for destroying it as necessary. Returns item +// that was detached, or null if none was. Moves cursor to previous item, so +// you can detach items while iterating forwards through a list. +CZMQ_EXPORT void * + zlistx_detach_cur (zlistx_t *self); + +// Delete an item, using its handle. Calls the item destructor is any is +// set. If handle is null, deletes the first item on the list. Returns 0 +// if an item was deleted, -1 if not. If cursor was at item, moves cursor +// to previous item, so you can delete items while iterating forwards +// through a list. +CZMQ_EXPORT int + zlistx_delete (zlistx_t *self, void *handle); + +// Move an item to the start of the list, via its handle. +CZMQ_EXPORT void + zlistx_move_start (zlistx_t *self, void *handle); + +// Move an item to the end of the list, via its handle. +CZMQ_EXPORT void + zlistx_move_end (zlistx_t *self, void *handle); + +// Remove all items from the list, and destroy them if the item destructor +// is set. +CZMQ_EXPORT void + zlistx_purge (zlistx_t *self); + +// Sort the list. If an item comparator was set, calls that to compare +// items, otherwise compares on item value. The sort is not stable, so may +// reorder equal items. +CZMQ_EXPORT void + zlistx_sort (zlistx_t *self); + +// Create a new node and insert it into a sorted list. Calls the item +// duplicator, if any, on the item. If low_value is true, starts searching +// from the start of the list, otherwise searches from the end. Use the item +// comparator, if any, to find where to place the new node. Returns a handle +// to the new node, or NULL if memory was exhausted. Resets the cursor to the +// list head. +CZMQ_EXPORT void * + zlistx_insert (zlistx_t *self, void *item, bool low_value); + +// Move an item, specified by handle, into position in a sorted list. Uses +// the item comparator, if any, to determine the new location. If low_value +// is true, starts searching from the start of the list, otherwise searches +// from the end. +CZMQ_EXPORT void + zlistx_reorder (zlistx_t *self, void *handle, bool low_value); + +// Make a copy of the list; items are duplicated if you set a duplicator +// for the list, otherwise not. Copying a null reference returns a null +// reference. +CZMQ_EXPORT zlistx_t * + zlistx_dup (zlistx_t *self); + +// Set a user-defined deallocator for list items; by default items are not +// freed when the list is destroyed. +CZMQ_EXPORT void + zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); + +// Set a user-defined duplicator for list items; by default items are not +// copied when the list is duplicated. +CZMQ_EXPORT void + zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); + +// Set a user-defined comparator for zlistx_find and zlistx_sort; the method +// must return -1, 0, or 1 depending on whether item1 is less than, equal to, +// or greater than, item2. +CZMQ_EXPORT void + zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); + +// Self test of this class. +CZMQ_EXPORT void + zlistx_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zloop.h b/phonelibs/zmq/arm/include/zloop.h new file mode 100644 index 00000000000000..bc58ea0530e7b3 --- /dev/null +++ b/phonelibs/zmq/arm/include/zloop.h @@ -0,0 +1,168 @@ +/* ========================================================================= + zloop - event-driven reactor + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZLOOP_H_INCLUDED__ +#define __ZLOOP_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zloop.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Callback function for reactor socket activity +typedef int (zloop_reader_fn) ( + zloop_t *loop, zsock_t *reader, void *arg); + +// Callback function for reactor events (low-level) +typedef int (zloop_fn) ( + zloop_t *loop, zmq_pollitem_t *item, void *arg); + +// Callback for reactor timer events +typedef int (zloop_timer_fn) ( + zloop_t *loop, int timer_id, void *arg); + +// Create a new zloop reactor +CZMQ_EXPORT zloop_t * + zloop_new (void); + +// Destroy a reactor +CZMQ_EXPORT void + zloop_destroy (zloop_t **self_p); + +// Register socket reader with the reactor. When the reader has messages, +// the reactor will call the handler, passing the arg. Returns 0 if OK, -1 +// if there was an error. If you register the same socket more than once, +// each instance will invoke its corresponding handler. +CZMQ_EXPORT int + zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); + +// Cancel a socket reader from the reactor. If multiple readers exist for +// same socket, cancels ALL of them. +CZMQ_EXPORT void + zloop_reader_end (zloop_t *self, zsock_t *sock); + +// Configure a registered reader to ignore errors. If you do not set this, +// then readers that have errors are removed from the reactor silently. +CZMQ_EXPORT void + zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); + +// Register low-level libzmq pollitem with the reactor. When the pollitem +// is ready, will call the handler, passing the arg. Returns 0 if OK, -1 +// if there was an error. If you register the pollitem more than once, each +// instance will invoke its corresponding handler. A pollitem with +// socket=NULL and fd=0 means 'poll on FD zero'. +CZMQ_EXPORT int + zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); + +// Cancel a pollitem from the reactor, specified by socket or FD. If both +// are specified, uses only socket. If multiple poll items exist for same +// socket/FD, cancels ALL of them. +CZMQ_EXPORT void + zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); + +// Configure a registered poller to ignore errors. If you do not set this, +// then poller that have errors are removed from the reactor silently. +CZMQ_EXPORT void + zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); + +// Register a timer that expires after some delay and repeats some number of +// times. At each expiry, will call the handler, passing the arg. To run a +// timer forever, use 0 times. Returns a timer_id that is used to cancel the +// timer in the future. Returns -1 if there was an error. +CZMQ_EXPORT int + zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); + +// Cancel a specific timer identified by a specific timer_id (as returned by +// zloop_timer). +CZMQ_EXPORT int + zloop_timer_end (zloop_t *self, int timer_id); + +// Register a ticket timer. Ticket timers are very fast in the case where +// you use a lot of timers (thousands), and frequently remove and add them. +// The main use case is expiry timers for servers that handle many clients, +// and which reset the expiry timer for each message received from a client. +// Whereas normal timers perform poorly as the number of clients grows, the +// cost of ticket timers is constant, no matter the number of clients. You +// must set the ticket delay using zloop_set_ticket_delay before creating a +// ticket. Returns a handle to the timer that you should use in +// zloop_ticket_reset and zloop_ticket_delete. +CZMQ_EXPORT void * + zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); + +// Reset a ticket timer, which moves it to the end of the ticket list and +// resets its execution time. This is a very fast operation. +CZMQ_EXPORT void + zloop_ticket_reset (zloop_t *self, void *handle); + +// Delete a ticket timer. We do not actually delete the ticket here, as +// other code may still refer to the ticket. We mark as deleted, and remove +// later and safely. +CZMQ_EXPORT void + zloop_ticket_delete (zloop_t *self, void *handle); + +// Set the ticket delay, which applies to all tickets. If you lower the +// delay and there are already tickets created, the results are undefined. +CZMQ_EXPORT void + zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); + +// Set hard limit on number of timers allowed. Setting more than a small +// number of timers (10-100) can have a dramatic impact on the performance +// of the reactor. For high-volume cases, use ticket timers. If the hard +// limit is reached, the reactor stops creating new timers and logs an +// error. +CZMQ_EXPORT void + zloop_set_max_timers (zloop_t *self, size_t max_timers); + +// Set verbose tracing of reactor on/off. The default verbose setting is +// off (false). +CZMQ_EXPORT void + zloop_set_verbose (zloop_t *self, bool verbose); + +// Start the reactor. Takes control of the thread and returns when the 0MQ +// context is terminated or the process is interrupted, or any event handler +// returns -1. Event handlers may register new sockets and timers, and +// cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. +CZMQ_EXPORT int + zloop_start (zloop_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zloop_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// By default the reactor stops if the process receives a SIGINT or SIGTERM +// signal. This makes it impossible to shut-down message based architectures +// like zactors. This method lets you switch off break handling. The default +// nonstop setting is off (false). +CZMQ_EXPORT void + zloop_set_nonstop (zloop_t *self, bool nonstop); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +// Deprecated method aliases +#define zloop_set_tolerant(s,i) zloop_poller_set_tolerant(s,i) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zmonitor.h b/phonelibs/zmq/arm/include/zmonitor.h new file mode 100644 index 00000000000000..b490bcb1a0dfbc --- /dev/null +++ b/phonelibs/zmq/arm/include/zmonitor.h @@ -0,0 +1,73 @@ +/* ========================================================================= + zmonitor - socket event monitor + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMONITOR_H_INCLUDED__ +#define __ZMONITOR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create new zmonitor actor instance to monitor a zsock_t socket: +// +// zactor_t *monitor = zactor_new (zmonitor, mysocket); +// +// Destroy zmonitor instance. +// +// zactor_destroy (&monitor); +// +// Enable verbose logging of commands and activity. +// +// zstr_send (monitor, "VERBOSE"); +// +// Listen to monitor event type (zero or types, ending in NULL): +// zstr_sendx (monitor, "LISTEN", type, ..., NULL); +// +// Events: +// CONNECTED +// CONNECT_DELAYED +// CONNECT_RETRIED +// LISTENING +// BIND_FAILED +// ACCEPTED +// ACCEPT_FAILED +// CLOSED +// CLOSE_FAILED +// DISCONNECTED +// MONITOR_STOPPED +// ALL +// +// Start monitor; after this, any further LISTEN commands are ignored. +// +// zstr_send (monitor, "START"); +// zsock_wait (monitor); +// +// Receive next monitor event: +// +// zmsg_t *msg = zmsg_recv (monitor); +// +// This is the zmonitor constructor as a zactor_fn; the argument can be +// a zactor_t, zsock_t, or libzmq void * socket: +CZMQ_EXPORT void + zmonitor (zsock_t *pipe, void *sock); + +// Selftest +CZMQ_EXPORT void + zmonitor_test (bool verbose); +// @end +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zmonitor_v2.h b/phonelibs/zmq/arm/include/zmonitor_v2.h new file mode 100644 index 00000000000000..5780e0bcb785ae --- /dev/null +++ b/phonelibs/zmq/arm/include/zmonitor_v2.h @@ -0,0 +1,56 @@ +/* ========================================================================= + zmonitor_v2 - socket event monitor (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMONITOR_V2_H_INCLUDED__ +#define __ZMONITOR_V2_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// This code needs backporting to work with ZMQ v3.2 +#if (ZMQ_VERSION_MAJOR == 4) + +// Create a new socket monitor +CZMQ_EXPORT zmonitor_t * + zmonitor_new (zctx_t *ctx, void *socket, int events); + +// Destroy a socket monitor +CZMQ_EXPORT void + zmonitor_destroy (zmonitor_t **self_p); + +// Receive a status message from the monitor; if no message arrives within +// 500 msec, or the call was interrupted, returns NULL. +CZMQ_EXPORT zmsg_t * + zmonitor_recv (zmonitor_t *self); + +// Get the ZeroMQ socket, for polling +CZMQ_EXPORT void * + zmonitor_socket (zmonitor_t *self); + +// Enable verbose tracing of commands and activity +CZMQ_EXPORT void + zmonitor_set_verbose (zmonitor_t *self, bool verbose); +#endif // ZeroMQ 4.0 or later + +// Self test of this class +CZMQ_EXPORT void + zmonitor_v2_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zmq.h b/phonelibs/zmq/arm/include/zmq.h new file mode 100644 index 00000000000000..5f35d1915fcd92 --- /dev/null +++ b/phonelibs/zmq/arm/include/zmq.h @@ -0,0 +1,617 @@ +/* + Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file + + This file is part of libzmq, the ZeroMQ core engine in C++. + + libzmq is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + As a special exception, the Contributors give you permission to link + this library with independent modules to produce an executable, + regardless of the license terms of these independent modules, and to + copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the + terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. + If you modify this library, you must extend this exception to your + version of the library. + + libzmq 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 program. If not, see . + + ************************************************************************* + NOTE to contributors. This file comprises the principal public contract + for ZeroMQ API users. Any change to this file supplied in a stable + release SHOULD not break existing applications. + In practice this means that the value of constants must not change, and + that old values may not be reused for new constants. + ************************************************************************* +*/ + +#ifndef __ZMQ_H_INCLUDED__ +#define __ZMQ_H_INCLUDED__ + +/* Version macros for compile-time API version detection */ +#define ZMQ_VERSION_MAJOR 4 +#define ZMQ_VERSION_MINOR 2 +#define ZMQ_VERSION_PATCH 0 + +#define ZMQ_MAKE_VERSION(major, minor, patch) \ + ((major) * 10000 + (minor) * 100 + (patch)) +#define ZMQ_VERSION \ + ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined _WIN32_WCE +#include +#endif +#include +#include +#if defined _WIN32 +// Set target version to Windows Server 2008, Windows Vista or higher. +// Windows XP (0x0501) is supported but without client & server socket types. +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif + +#ifdef __MINGW32__ +// Require Windows XP or higher with MinGW for getaddrinfo(). +#if(_WIN32_WINNT >= 0x0600) +#else +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif +#endif +#include +#endif + +/* Handle DSO symbol visibility */ +#if defined _WIN32 +# if defined ZMQ_STATIC +# define ZMQ_EXPORT +# elif defined DLL_EXPORT +# define ZMQ_EXPORT __declspec(dllexport) +# else +# define ZMQ_EXPORT __declspec(dllimport) +# endif +#else +# if defined __SUNPRO_C || defined __SUNPRO_CC +# define ZMQ_EXPORT __global +# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER +# define ZMQ_EXPORT __attribute__ ((visibility("default"))) +# else +# define ZMQ_EXPORT +# endif +#endif + +/* Define integer types needed for event interface */ +#define ZMQ_DEFINED_STDINT 1 +#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS +# include +#elif defined _MSC_VER && _MSC_VER < 1600 +# ifndef int32_t + typedef __int32 int32_t; +# endif +# ifndef uint16_t + typedef unsigned __int16 uint16_t; +# endif +# ifndef uint8_t + typedef unsigned __int8 uint8_t; +# endif +#else +# include +#endif + + +/******************************************************************************/ +/* 0MQ errors. */ +/******************************************************************************/ + +/* A number random enough not to collide with different errno ranges on */ +/* different OSes. The assumption is that error_t is at least 32-bit type. */ +#define ZMQ_HAUSNUMERO 156384712 + +/* On Windows platform some of the standard POSIX errnos are not defined. */ +#ifndef ENOTSUP +#define ENOTSUP (ZMQ_HAUSNUMERO + 1) +#endif +#ifndef EPROTONOSUPPORT +#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) +#endif +#ifndef ENOBUFS +#define ENOBUFS (ZMQ_HAUSNUMERO + 3) +#endif +#ifndef ENETDOWN +#define ENETDOWN (ZMQ_HAUSNUMERO + 4) +#endif +#ifndef EADDRINUSE +#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) +#endif +#ifndef EADDRNOTAVAIL +#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) +#endif +#ifndef ECONNREFUSED +#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) +#endif +#ifndef EINPROGRESS +#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) +#endif +#ifndef ENOTSOCK +#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) +#endif +#ifndef EMSGSIZE +#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) +#endif +#ifndef EAFNOSUPPORT +#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) +#endif +#ifndef ENETUNREACH +#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) +#endif +#ifndef ECONNABORTED +#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) +#endif +#ifndef ECONNRESET +#define ECONNRESET (ZMQ_HAUSNUMERO + 14) +#endif +#ifndef ENOTCONN +#define ENOTCONN (ZMQ_HAUSNUMERO + 15) +#endif +#ifndef ETIMEDOUT +#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) +#endif +#ifndef EHOSTUNREACH +#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) +#endif +#ifndef ENETRESET +#define ENETRESET (ZMQ_HAUSNUMERO + 18) +#endif + +/* Native 0MQ error codes. */ +#define EFSM (ZMQ_HAUSNUMERO + 51) +#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) +#define ETERM (ZMQ_HAUSNUMERO + 53) +#define EMTHREAD (ZMQ_HAUSNUMERO + 54) + +/* This function retrieves the errno as it is known to 0MQ library. The goal */ +/* of this function is to make the code 100% portable, including where 0MQ */ +/* compiled with certain CRT library (on Windows) is linked to an */ +/* application that uses different CRT library. */ +ZMQ_EXPORT int zmq_errno (void); + +/* Resolves system errors and 0MQ errors to human-readable string. */ +ZMQ_EXPORT const char *zmq_strerror (int errnum); + +/* Run-time API version detection */ +ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); + +/******************************************************************************/ +/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ +/******************************************************************************/ + +/* Context options */ +#define ZMQ_IO_THREADS 1 +#define ZMQ_MAX_SOCKETS 2 +#define ZMQ_SOCKET_LIMIT 3 +#define ZMQ_THREAD_PRIORITY 3 +#define ZMQ_THREAD_SCHED_POLICY 4 +#define ZMQ_MAX_MSGSZ 5 + +/* Default for new contexts */ +#define ZMQ_IO_THREADS_DFLT 1 +#define ZMQ_MAX_SOCKETS_DFLT 1023 +#define ZMQ_THREAD_PRIORITY_DFLT -1 +#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 + +ZMQ_EXPORT void *zmq_ctx_new (void); +ZMQ_EXPORT int zmq_ctx_term (void *context); +ZMQ_EXPORT int zmq_ctx_shutdown (void *context); +ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); +ZMQ_EXPORT int zmq_ctx_get (void *context, int option); + +/* Old (legacy) API */ +ZMQ_EXPORT void *zmq_init (int io_threads); +ZMQ_EXPORT int zmq_term (void *context); +ZMQ_EXPORT int zmq_ctx_destroy (void *context); + + +/******************************************************************************/ +/* 0MQ message definition. */ +/******************************************************************************/ + +/* union here ensures correct alignment on architectures that require it, e.g. + * SPARC + */ +typedef union zmq_msg_t {unsigned char _ [64]; void *p; } zmq_msg_t; + +typedef void (zmq_free_fn) (void *data, void *hint); + +ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); +ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, + size_t size, zmq_free_fn *ffn, void *hint); +ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); +ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); +ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); +ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); +ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); +ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); +ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); +ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); + +/******************************************************************************/ +/* 0MQ socket definition. */ +/******************************************************************************/ + +/* Socket types. */ +#define ZMQ_PAIR 0 +#define ZMQ_PUB 1 +#define ZMQ_SUB 2 +#define ZMQ_REQ 3 +#define ZMQ_REP 4 +#define ZMQ_DEALER 5 +#define ZMQ_ROUTER 6 +#define ZMQ_PULL 7 +#define ZMQ_PUSH 8 +#define ZMQ_XPUB 9 +#define ZMQ_XSUB 10 +#define ZMQ_STREAM 11 + +/* Deprecated aliases */ +#define ZMQ_XREQ ZMQ_DEALER +#define ZMQ_XREP ZMQ_ROUTER + +/* Socket options. */ +#define ZMQ_AFFINITY 4 +#define ZMQ_IDENTITY 5 +#define ZMQ_SUBSCRIBE 6 +#define ZMQ_UNSUBSCRIBE 7 +#define ZMQ_RATE 8 +#define ZMQ_RECOVERY_IVL 9 +#define ZMQ_SNDBUF 11 +#define ZMQ_RCVBUF 12 +#define ZMQ_RCVMORE 13 +#define ZMQ_FD 14 +#define ZMQ_EVENTS 15 +#define ZMQ_TYPE 16 +#define ZMQ_LINGER 17 +#define ZMQ_RECONNECT_IVL 18 +#define ZMQ_BACKLOG 19 +#define ZMQ_RECONNECT_IVL_MAX 21 +#define ZMQ_MAXMSGSIZE 22 +#define ZMQ_SNDHWM 23 +#define ZMQ_RCVHWM 24 +#define ZMQ_MULTICAST_HOPS 25 +#define ZMQ_RCVTIMEO 27 +#define ZMQ_SNDTIMEO 28 +#define ZMQ_LAST_ENDPOINT 32 +#define ZMQ_ROUTER_MANDATORY 33 +#define ZMQ_TCP_KEEPALIVE 34 +#define ZMQ_TCP_KEEPALIVE_CNT 35 +#define ZMQ_TCP_KEEPALIVE_IDLE 36 +#define ZMQ_TCP_KEEPALIVE_INTVL 37 +#define ZMQ_IMMEDIATE 39 +#define ZMQ_XPUB_VERBOSE 40 +#define ZMQ_ROUTER_RAW 41 +#define ZMQ_IPV6 42 +#define ZMQ_MECHANISM 43 +#define ZMQ_PLAIN_SERVER 44 +#define ZMQ_PLAIN_USERNAME 45 +#define ZMQ_PLAIN_PASSWORD 46 +#define ZMQ_CURVE_SERVER 47 +#define ZMQ_CURVE_PUBLICKEY 48 +#define ZMQ_CURVE_SECRETKEY 49 +#define ZMQ_CURVE_SERVERKEY 50 +#define ZMQ_PROBE_ROUTER 51 +#define ZMQ_REQ_CORRELATE 52 +#define ZMQ_REQ_RELAXED 53 +#define ZMQ_CONFLATE 54 +#define ZMQ_ZAP_DOMAIN 55 +#define ZMQ_ROUTER_HANDOVER 56 +#define ZMQ_TOS 57 +#define ZMQ_CONNECT_RID 61 +#define ZMQ_GSSAPI_SERVER 62 +#define ZMQ_GSSAPI_PRINCIPAL 63 +#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 +#define ZMQ_GSSAPI_PLAINTEXT 65 +#define ZMQ_HANDSHAKE_IVL 66 +#define ZMQ_SOCKS_PROXY 68 +#define ZMQ_XPUB_NODROP 69 +// All options after this is for version 4.2 and still *draft* +// Subject to arbitrary change without notice +#define ZMQ_BLOCKY 70 +#define ZMQ_XPUB_MANUAL 71 +#define ZMQ_XPUB_WELCOME_MSG 72 +#define ZMQ_STREAM_NOTIFY 73 +#define ZMQ_INVERT_MATCHING 74 +#define ZMQ_HEARTBEAT_IVL 75 +#define ZMQ_HEARTBEAT_TTL 76 +#define ZMQ_HEARTBEAT_TIMEOUT 77 +#define ZMQ_XPUB_VERBOSER 78 +#define ZMQ_CONNECT_TIMEOUT 79 +#define ZMQ_TCP_MAXRT 80 +#define ZMQ_THREAD_SAFE 81 +#define ZMQ_MULTICAST_MAXTPDU 84 +#define ZMQ_VMCI_BUFFER_SIZE 85 +#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 +#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 +#define ZMQ_VMCI_CONNECT_TIMEOUT 88 +#define ZMQ_USE_FD 89 + +/* Message options */ +#define ZMQ_MORE 1 +#define ZMQ_SHARED 3 + +/* Send/recv options. */ +#define ZMQ_DONTWAIT 1 +#define ZMQ_SNDMORE 2 + +/* Security mechanisms */ +#define ZMQ_NULL 0 +#define ZMQ_PLAIN 1 +#define ZMQ_CURVE 2 +#define ZMQ_GSSAPI 3 + +/* RADIO-DISH protocol */ +#define ZMQ_GROUP_MAX_LENGTH 15 + +/* Deprecated options and aliases */ +#define ZMQ_TCP_ACCEPT_FILTER 38 +#define ZMQ_IPC_FILTER_PID 58 +#define ZMQ_IPC_FILTER_UID 59 +#define ZMQ_IPC_FILTER_GID 60 +#define ZMQ_IPV4ONLY 31 +#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE +#define ZMQ_NOBLOCK ZMQ_DONTWAIT +#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY +#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY + +/* Deprecated Message options */ +#define ZMQ_SRCFD 2 + +/******************************************************************************/ +/* 0MQ socket events and monitoring */ +/******************************************************************************/ + +/* Socket transport events (TCP, IPC and TIPC only) */ + +#define ZMQ_EVENT_CONNECTED 0x0001 +#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 +#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 +#define ZMQ_EVENT_LISTENING 0x0008 +#define ZMQ_EVENT_BIND_FAILED 0x0010 +#define ZMQ_EVENT_ACCEPTED 0x0020 +#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 +#define ZMQ_EVENT_CLOSED 0x0080 +#define ZMQ_EVENT_CLOSE_FAILED 0x0100 +#define ZMQ_EVENT_DISCONNECTED 0x0200 +#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 +#define ZMQ_EVENT_ALL 0xFFFF + +ZMQ_EXPORT void *zmq_socket (void *, int type); +ZMQ_EXPORT int zmq_close (void *s); +ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, + size_t optvallen); +ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, + size_t *optvallen); +ZMQ_EXPORT int zmq_bind (void *s, const char *addr); +ZMQ_EXPORT int zmq_connect (void *s, const char *addr); +ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); +ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); +ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); +ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); + + +/******************************************************************************/ +/* I/O multiplexing. */ +/******************************************************************************/ + +#define ZMQ_POLLIN 1 +#define ZMQ_POLLOUT 2 +#define ZMQ_POLLERR 4 +#define ZMQ_POLLPRI 8 + +typedef struct zmq_pollitem_t +{ + void *socket; +#if defined _WIN32 + SOCKET fd; +#else + int fd; +#endif + short events; + short revents; +} zmq_pollitem_t; + +#define ZMQ_POLLITEMS_DFLT 16 + +ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); + +/******************************************************************************/ +/* Message proxying */ +/******************************************************************************/ + +ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); +ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); + +/******************************************************************************/ +/* Probe library capabilities */ +/******************************************************************************/ + +#define ZMQ_HAS_CAPABILITIES 1 +ZMQ_EXPORT int zmq_has (const char *capability); + +/* Deprecated aliases */ +#define ZMQ_STREAMER 1 +#define ZMQ_FORWARDER 2 +#define ZMQ_QUEUE 3 + +/* Deprecated methods */ +ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); +ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); +ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); +struct iovec; +ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); +ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); + +/******************************************************************************/ +/* Encryption functions */ +/******************************************************************************/ + +/* Encode data with Z85 encoding. Returns encoded data */ +ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); + +/* Decode data with Z85 encoding. Returns decoded data */ +ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); + +/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ +/* Returns 0 on success. */ +ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); + +/* Derive the z85-encoded public key from the z85-encoded secret key. */ +/* Returns 0 on success. */ +ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); + +/******************************************************************************/ +/* Atomic utility methods */ +/******************************************************************************/ + +ZMQ_EXPORT void *zmq_atomic_counter_new (void); +ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); +ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); +ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); +ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); +ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); + + +/******************************************************************************/ +/* These functions are not documented by man pages -- use at your own risk. */ +/* If you need these to be part of the formal ZMQ API, then (a) write a man */ +/* page, and (b) write a test case in tests. */ +/******************************************************************************/ + +/* Helper functions are used by perf tests so that they don't have to care */ +/* about minutiae of time-related functions on different OS platforms. */ + +/* Starts the stopwatch. Returns the handle to the watch. */ +ZMQ_EXPORT void *zmq_stopwatch_start (void); + +/* Stops the stopwatch. Returns the number of microseconds elapsed since */ +/* the stopwatch was started. */ +ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); + +/* Sleeps for specified number of seconds. */ +ZMQ_EXPORT void zmq_sleep (int seconds_); + +typedef void (zmq_thread_fn) (void*); + +/* Start a thread. Returns a handle to the thread. */ +ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); + +/* Wait for thread to complete then free up resources. */ +ZMQ_EXPORT void zmq_threadclose (void* thread); + + +/******************************************************************************/ +/* These functions are DRAFT and disabled in stable releases, and subject to */ +/* change at ANY time until declared stable. */ +/******************************************************************************/ + +#ifdef ZMQ_BUILD_DRAFT_API + +/* DRAFT Socket types. */ +#define ZMQ_SERVER 12 +#define ZMQ_CLIENT 13 +#define ZMQ_RADIO 14 +#define ZMQ_DISH 15 +#define ZMQ_GATHER 16 +#define ZMQ_SCATTER 17 +#define ZMQ_DGRAM 18 + +/* DRAFT Socket methods. */ +ZMQ_EXPORT int zmq_join (void *s, const char *group); +ZMQ_EXPORT int zmq_leave (void *s, const char *group); + +/* DRAFT Msg methods. */ +ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); +ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); +ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); +ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg); + +/******************************************************************************/ +/* Poller polling on sockets,fd and thread-safe sockets */ +/******************************************************************************/ + +#define ZMQ_HAVE_POLLER + +typedef struct zmq_poller_event_t +{ + void *socket; +#if defined _WIN32 + SOCKET fd; +#else + int fd; +#endif + void *user_data; + short events; +} zmq_poller_event_t; + +ZMQ_EXPORT void *zmq_poller_new (void); +ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); +ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); +ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); +ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); + +#if defined _WIN32 +ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); +ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); +#else +ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); +ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); +ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); +#endif + +/******************************************************************************/ +/* Scheduling timers */ +/******************************************************************************/ + +#define ZMQ_HAVE_TIMERS + +typedef void (zmq_timer_fn)(int timer_id, void *arg); + +ZMQ_EXPORT void *zmq_timers_new (void); +ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); +ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); +ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); +ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); +ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); +ZMQ_EXPORT long zmq_timers_timeout (void *timers); +ZMQ_EXPORT int zmq_timers_execute (void *timers); + +#endif // ZMQ_BUILD_DRAFT_API + + +#undef ZMQ_EXPORT + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zmq_utils.h b/phonelibs/zmq/arm/include/zmq_utils.h new file mode 100644 index 00000000000000..f29638d5539414 --- /dev/null +++ b/phonelibs/zmq/arm/include/zmq_utils.h @@ -0,0 +1,48 @@ +/* + Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file + + This file is part of libzmq, the ZeroMQ core engine in C++. + + libzmq is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + As a special exception, the Contributors give you permission to link + this library with independent modules to produce an executable, + regardless of the license terms of these independent modules, and to + copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the + terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. + If you modify this library, you must extend this exception to your + version of the library. + + libzmq 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 program. If not, see . +*/ + +/* This file is deprecated, and all its functionality provided by zmq.h */ +/* Note that -Wpedantic compilation requires GCC to avoid using its custom + extensions such as #warning, hence the trick below. Also, pragmas for + warnings or other messages are not standard, not portable, and not all + compilers even have an equivalent concept. + So in the worst case, this include file is treated as silently empty. */ + +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) +#if defined(__GNUC__) || defined(__GNUG__) +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wcpp" +#pragma GCC diagnostic ignored "-Werror" +#pragma GCC diagnostic ignored "-Wall" +#endif +#pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") +#if defined(__GNUC__) || defined(__GNUG__) +#pragma GCC diagnostic pop +#endif +#endif diff --git a/phonelibs/zmq/arm/include/zmsg.h b/phonelibs/zmq/arm/include/zmsg.h new file mode 100644 index 00000000000000..c6ab16c66e953c --- /dev/null +++ b/phonelibs/zmq/arm/include/zmsg.h @@ -0,0 +1,285 @@ +/* ========================================================================= + zmsg - working with multipart messages + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMSG_H_INCLUDED__ +#define __ZMSG_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zmsg.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create a new empty message object +CZMQ_EXPORT zmsg_t * + zmsg_new (void); + +// Receive message from socket, returns zmsg_t object or NULL if the recv +// was interrupted. Does a blocking recv. If you want to not block then use +// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input +// before receiving. +CZMQ_EXPORT zmsg_t * + zmsg_recv (void *source); + +// Load/append an open file into new message, return the message. +// Returns NULL if the message could not be loaded. +CZMQ_EXPORT zmsg_t * + zmsg_load (FILE *file); + +// Decodes a serialized message frame created by zmsg_encode () and returns +// a new zmsg_t object. Returns NULL if the frame was badly formatted or +// there was insufficient memory to work. +CZMQ_EXPORT zmsg_t * + zmsg_decode (zframe_t *frame); + +// Generate a signal message encoding the given status. A signal is a short +// message carrying a 1-byte success/failure code (by convention, 0 means +// OK). Signals are encoded to be distinguishable from "normal" messages. +CZMQ_EXPORT zmsg_t * + zmsg_new_signal (byte status); + +// Destroy a message object and all frames it contains +CZMQ_EXPORT void + zmsg_destroy (zmsg_t **self_p); + +// Send message to destination socket, and destroy the message after sending +// it successfully. If the message has no frames, sends nothing but destroys +// the message anyhow. Nullifies the caller's reference to the message (as +// it is a destructor). +CZMQ_EXPORT int + zmsg_send (zmsg_t **self_p, void *dest); + +// Send message to destination socket as part of a multipart sequence, and +// destroy the message after sending it successfully. Note that after a +// zmsg_sendm, you must call zmsg_send or another method that sends a final +// message part. If the message has no frames, sends nothing but destroys +// the message anyhow. Nullifies the caller's reference to the message (as +// it is a destructor). +CZMQ_EXPORT int + zmsg_sendm (zmsg_t **self_p, void *dest); + +// Return size of message, i.e. number of frames (0 or more). +CZMQ_EXPORT size_t + zmsg_size (zmsg_t *self); + +// Return total size of all frames in message. +CZMQ_EXPORT size_t + zmsg_content_size (zmsg_t *self); + +// Push frame to the front of the message, i.e. before all other frames. +// Message takes ownership of frame, will destroy it when message is sent. +// Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not +// nullify the caller's frame reference. +CZMQ_EXPORT int + zmsg_prepend (zmsg_t *self, zframe_t **frame_p); + +// Add frame to the end of the message, i.e. after all other frames. +// Message takes ownership of frame, will destroy it when message is sent. +// Returns 0 on success. Deprecates zmsg_add, which did not nullify the +// caller's frame reference. +CZMQ_EXPORT int + zmsg_append (zmsg_t *self, zframe_t **frame_p); + +// Remove first frame from message, if any. Returns frame, or NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zmsg_pop (zmsg_t *self); + +// Push block of memory to front of message, as a new frame. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_pushmem (zmsg_t *self, const void *data, size_t size); + +// Add block of memory to the end of the message, as a new frame. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_addmem (zmsg_t *self, const void *data, size_t size); + +// Push string as new frame to front of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_pushstr (zmsg_t *self, const char *string); + +// Push string as new frame to end of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_addstr (zmsg_t *self, const char *string); + +// Push formatted string as new frame to front of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_pushstrf (zmsg_t *self, const char *format, ...); + +// Push formatted string as new frame to end of message. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_addstrf (zmsg_t *self, const char *format, ...); + +// Pop frame off front of message, return as fresh string. If there were +// no more frames in the message, returns NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zmsg_popstr (zmsg_t *self); + +// Push encoded message as a new frame. Message takes ownership of +// submessage, so the original is destroyed in this call. Returns 0 on +// success, -1 on error. +CZMQ_EXPORT int + zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); + +// Remove first submessage from message, if any. Returns zmsg_t, or NULL if +// decoding was not successful. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zmsg_t * + zmsg_popmsg (zmsg_t *self); + +// Remove specified frame from list, if present. Does not destroy frame. +CZMQ_EXPORT void + zmsg_remove (zmsg_t *self, zframe_t *frame); + +// Set cursor to first frame in message. Returns frame, or NULL, if the +// message is empty. Use this to navigate the frames as a list. +CZMQ_EXPORT zframe_t * + zmsg_first (zmsg_t *self); + +// Return the next frame. If there are no more frames, returns NULL. To move +// to the first frame call zmsg_first(). Advances the cursor. +CZMQ_EXPORT zframe_t * + zmsg_next (zmsg_t *self); + +// Return the last frame. If there are no frames, returns NULL. +CZMQ_EXPORT zframe_t * + zmsg_last (zmsg_t *self); + +// Save message to an open file, return 0 if OK, else -1. The message is +// saved as a series of frames, each with length and data. Note that the +// file is NOT guaranteed to be portable between operating systems, not +// versions of CZMQ. The file format is at present undocumented and liable +// to arbitrary change. +CZMQ_EXPORT int + zmsg_save (zmsg_t *self, FILE *file); + +// Serialize multipart message to a single message frame. Use this method +// to send structured messages across transports that do not support +// multipart data. Allocates and returns a new frame containing the +// serialized message. To decode a serialized message frame, use +// zmsg_decode (). +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zframe_t * + zmsg_encode (zmsg_t *self); + +// Create copy of message, as new message object. Returns a fresh zmsg_t +// object. If message is null, or memory was exhausted, returns null. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT zmsg_t * + zmsg_dup (zmsg_t *self); + +// Send message to zsys log sink (may be stdout, or system facility as +// configured by zsys_set_logstream). +CZMQ_EXPORT void + zmsg_print (zmsg_t *self); + +// Return true if the two messages have the same number of frames and each +// frame in the first message is identical to the corresponding frame in the +// other message. As with zframe_eq, return false if either message is NULL. +CZMQ_EXPORT bool + zmsg_eq (zmsg_t *self, zmsg_t *other); + +// Return signal value, 0 or greater, if message is a signal, -1 if not. +CZMQ_EXPORT int + zmsg_signal (zmsg_t *self); + +// Probe the supplied object, and report if it looks like a zmsg_t. +CZMQ_EXPORT bool + zmsg_is (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zmsg_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Return message routing ID, if the message came from a ZMQ_SERVER socket. +// Else returns zero. +CZMQ_EXPORT uint32_t + zmsg_routing_id (zmsg_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on message. This is used if/when the message is sent to a +// ZMQ_SERVER socket. +CZMQ_EXPORT void + zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT int + zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + + +// DEPRECATED as over-engineered, poor style +// Pop frame off front of message, caller now owns frame +// If next frame is empty, pops and destroys that empty frame. +CZMQ_EXPORT zframe_t * + zmsg_unwrap (zmsg_t *self); + +// DEPRECATED as poor style -- callers should use zloop or zpoller +// Receive message from socket, returns zmsg_t object, or NULL either if +// there was no input waiting, or the recv was interrupted. +CZMQ_EXPORT zmsg_t * + zmsg_recv_nowait (void *source); + +// DEPRECATED as unsafe -- does not nullify frame reference. +// Push frame plus empty frame to front of message, before first frame. +// Message takes ownership of frame, will destroy it when message is sent. +CZMQ_EXPORT void + zmsg_wrap (zmsg_t *self, zframe_t *frame); + +// DEPRECATED - will be removed for next + 1 stable release +// Add frame to the front of the message, i.e. before all other frames. +// Message takes ownership of frame, will destroy it when message is sent. +// Returns 0 on success, -1 on error. +CZMQ_EXPORT int + zmsg_push (zmsg_t *self, zframe_t *frame); + +// DEPRECATED - will be removed for next stable release +CZMQ_EXPORT int + zmsg_add (zmsg_t *self, zframe_t *frame); + +// DEPRECATED as inconsistent; breaks principle that logging should all go +// to a single destination. +// Print message to open stream +// Truncates to first 10 frames, for readability. +CZMQ_EXPORT void + zmsg_fprint (zmsg_t *self, FILE *file); + +// Compiler hints +CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); + +#ifdef __cplusplus +} +#endif + +// Deprecated method aliases +#define zmsg_dump(s) zmsg_print(s) +#define zmsg_dump_to_stream(s,F) zmsg_fprint(s,F) + +#endif diff --git a/phonelibs/zmq/arm/include/zmutex.h b/phonelibs/zmq/arm/include/zmutex.h new file mode 100644 index 00000000000000..cba315999b7598 --- /dev/null +++ b/phonelibs/zmq/arm/include/zmutex.h @@ -0,0 +1,55 @@ +/* ========================================================================= + zmutex - working with mutexes + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZMUTEX_H_INCLUDED__ +#define __ZMUTEX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// This is a deprecated class, and will be removed over time. It is +// provided in stable builds to support old applications. You should +// stop using this class, and migrate any code that is still using it. + +// Create a new mutex container +CZMQ_EXPORT zmutex_t * + zmutex_new (void); + +// Destroy a mutex container +CZMQ_EXPORT void + zmutex_destroy (zmutex_t **self_p); + +// Lock mutex +CZMQ_EXPORT void + zmutex_lock (zmutex_t *self); + +// Unlock mutex +CZMQ_EXPORT void + zmutex_unlock (zmutex_t *self); + +// Try to lock mutex +CZMQ_EXPORT int + zmutex_try_lock (zmutex_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zmutex_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zpoller.h b/phonelibs/zmq/arm/include/zpoller.h new file mode 100644 index 00000000000000..3756a935a64008 --- /dev/null +++ b/phonelibs/zmq/arm/include/zpoller.h @@ -0,0 +1,92 @@ +/* ========================================================================= + zpoller - trivial socket poller class + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __zpoller_H_INCLUDED__ +#define __zpoller_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zpoller.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create new poller, specifying zero or more readers. The list of +// readers ends in a NULL. Each reader can be a zsock_t instance, a +// zactor_t instance, a libzmq socket (void *), or a file handle. +CZMQ_EXPORT zpoller_t * + zpoller_new (void *reader, ...); + +// Destroy a poller +CZMQ_EXPORT void + zpoller_destroy (zpoller_t **self_p); + +// Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may +// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. +CZMQ_EXPORT int + zpoller_add (zpoller_t *self, void *reader); + +// Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader +// must have been passed during construction, or in an zpoller_add () call. +CZMQ_EXPORT int + zpoller_remove (zpoller_t *self, void *reader); + +// Poll the registered readers for I/O, return first reader that has input. +// The reader will be a libzmq void * socket, or a zsock_t or zactor_t +// instance as specified in zpoller_new/zpoller_add. The timeout should be +// zero or greater, or -1 to wait indefinitely. Socket priority is defined +// by their order in the poll list. If you need a balanced poll, use the low +// level zmq_poll method directly. If the poll call was interrupted (SIGINT), +// or the ZMQ context was destroyed, or the timeout expired, returns NULL. +// You can test the actual exit condition by calling zpoller_expired () and +// zpoller_terminated (). The timeout is in msec. +CZMQ_EXPORT void * + zpoller_wait (zpoller_t *self, int timeout); + +// Return true if the last zpoller_wait () call ended because the timeout +// expired, without any error. +CZMQ_EXPORT bool + zpoller_expired (zpoller_t *self); + +// Return true if the last zpoller_wait () call ended because the process +// was interrupted, or the parent context was destroyed. +CZMQ_EXPORT bool + zpoller_terminated (zpoller_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zpoller_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// By default the poller stops if the process receives a SIGINT or SIGTERM +// signal. This makes it impossible to shut-down message based architectures +// like zactors. This method lets you switch off break handling. The default +// nonstop setting is off (false). +CZMQ_EXPORT void + zpoller_set_nonstop (zpoller_t *self, bool nonstop); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/phonelibs/zmq/arm/include/zproc.h b/phonelibs/zmq/arm/include/zproc.h new file mode 100644 index 00000000000000..a2e1b3dd9913c6 --- /dev/null +++ b/phonelibs/zmq/arm/include/zproc.h @@ -0,0 +1,179 @@ +/* ========================================================================= + zproc - process configuration and status + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef ZPROC_H_INCLUDED +#define ZPROC_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zproc.api" to make changes. +// @interface +// This is a draft class, and may change without notice. It is disabled in +// stable builds by default. If you use this in applications, please ask +// for it to be pushed to stable state. Use --enable-drafts to enable. +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Returns CZMQ version as a single 6-digit integer encoding the major +// version (x 10000), the minor version (x 100) and the patch. +CZMQ_EXPORT int + zproc_czmq_version (void); + +// *** Draft method, for development use, may change without warning *** +// Returns true if the process received a SIGINT or SIGTERM signal. +// It is good practice to use this method to exit any infinite loop +// processing messages. +CZMQ_EXPORT bool + zproc_interrupted (void); + +// *** Draft method, for development use, may change without warning *** +// Returns true if the underlying libzmq supports CURVE security. +CZMQ_EXPORT bool + zproc_has_curve (void); + +// *** Draft method, for development use, may change without warning *** +// Return current host name, for use in public tcp:// endpoints. +// If the host name is not resolvable, returns NULL. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zproc_hostname (void); + +// *** Draft method, for development use, may change without warning *** +// Move the current process into the background. The precise effect +// depends on the operating system. On POSIX boxes, moves to a specified +// working directory (if specified), closes all file handles, reopens +// stdin, stdout, and stderr to the null device, and sets the process to +// ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there +// was an error. +CZMQ_EXPORT void + zproc_daemonize (const char *workdir); + +// *** Draft method, for development use, may change without warning *** +// Drop the process ID into the lockfile, with exclusive lock, and +// switch the process to the specified group and/or user. Any of the +// arguments may be null, indicating a no-op. Returns 0 on success, +// -1 on failure. Note if you combine this with zsys_daemonize, run +// after, not before that method, or the lockfile will hold the wrong +// process ID. +CZMQ_EXPORT void + zproc_run_as (const char *lockfile, const char *group, const char *user); + +// *** Draft method, for development use, may change without warning *** +// Configure the number of I/O threads that ZeroMQ will use. A good +// rule of thumb is one thread per gigabit of traffic in or out. The +// default is 1, sufficient for most applications. If the environment +// variable ZSYS_IO_THREADS is defined, that provides the default. +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zproc_set_io_threads (size_t io_threads); + +// *** Draft method, for development use, may change without warning *** +// Configure the number of sockets that ZeroMQ will allow. The default +// is 1024. The actual limit depends on the system, and you can query it +// by using zsys_socket_limit (). A value of zero means "maximum". +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zproc_set_max_sockets (size_t max_sockets); + +// *** Draft method, for development use, may change without warning *** +// Set network interface name to use for broadcasts, particularly zbeacon. +// This lets the interface be configured for test environments where required. +// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is +// the default when there is no specified interface. If the environment +// variable ZSYS_INTERFACE is set, use that as the default interface name. +// Setting the interface to "*" means "use all available interfaces". +CZMQ_EXPORT void + zproc_set_biface (const char *value); + +// *** Draft method, for development use, may change without warning *** +// Return network interface to use for broadcasts, or "" if none was set. +CZMQ_EXPORT const char * + zproc_biface (void); + +// *** Draft method, for development use, may change without warning *** +// Set log identity, which is a string that prefixes all log messages sent +// by this process. The log identity defaults to the environment variable +// ZSYS_LOGIDENT, if that is set. +CZMQ_EXPORT void + zproc_set_log_ident (const char *value); + +// *** Draft method, for development use, may change without warning *** +// Sends log output to a PUB socket bound to the specified endpoint. To +// collect such log output, create a SUB socket, subscribe to the traffic +// you care about, and connect to the endpoint. Log traffic is sent as a +// single string frame, in the same format as when sent to stdout. The +// log system supports a single sender; multiple calls to this method will +// bind the same sender to multiple endpoints. To disable the sender, call +// this method with a null argument. +CZMQ_EXPORT void + zproc_set_log_sender (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Enable or disable logging to the system facility (syslog on POSIX boxes, +// event log on Windows). By default this is disabled. +CZMQ_EXPORT void + zproc_set_log_system (bool logsystem); + +// *** Draft method, for development use, may change without warning *** +// Log error condition - highest priority +CZMQ_EXPORT void + zproc_log_error (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Log warning condition - high priority +CZMQ_EXPORT void + zproc_log_warning (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Log normal, but significant, condition - normal priority +CZMQ_EXPORT void + zproc_log_notice (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Log informational message - low priority +CZMQ_EXPORT void + zproc_log_info (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Log debug-level message - lowest priority +CZMQ_EXPORT void + zproc_log_debug (const char *format, ...); + +// *** Draft method, for development use, may change without warning *** +// Self test of this class. +CZMQ_EXPORT void + zproc_test (bool verbose); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT void + zproc_log_error (const char *format, ...) CHECK_PRINTF (1); +CZMQ_EXPORT void + zproc_log_warning (const char *format, ...) CHECK_PRINTF (1); +CZMQ_EXPORT void + zproc_log_notice (const char *format, ...) CHECK_PRINTF (1); +CZMQ_EXPORT void + zproc_log_info (const char *format, ...) CHECK_PRINTF (1); +CZMQ_EXPORT void + zproc_log_debug (const char *format, ...) CHECK_PRINTF (1); +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zproxy.h b/phonelibs/zmq/arm/include/zproxy.h new file mode 100644 index 00000000000000..f672c5e72417a5 --- /dev/null +++ b/phonelibs/zmq/arm/include/zproxy.h @@ -0,0 +1,111 @@ +/* ========================================================================= + zproxy - run a steerable proxy in the background + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZPROXY_H_INCLUDED__ +#define __ZPROXY_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Create new zproxy actor instance. The proxy switches messages between +// a frontend socket and a backend socket; use the FRONTEND and BACKEND +// commands to configure these: +// +// zactor_t *proxy = zactor_new (zproxy, NULL); +// +// Destroy zproxy instance. This destroys the two sockets and stops any +// message flow between them: +// +// zactor_destroy (&proxy); +// +// Note that all zproxy commands are synchronous, so your application always +// waits for a signal from the actor after each command. +// +// Enable verbose logging of commands and activity: +// +// zstr_send (proxy, "VERBOSE"); +// zsock_wait (proxy); +// +// Specify frontend socket type -- see zsock_type_str () -- and attach to +// endpoints, see zsock_attach (). Note that a proxy socket is always +// serverish: +// +// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); +// zsock_wait (proxy); +// +// Specify backend socket type -- see zsock_type_str () -- and attach to +// endpoints, see zsock_attach (). Note that a proxy socket is always +// serverish: +// +// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); +// zsock_wait (proxy); +// +// Capture all proxied messages; these are delivered to the application +// via an inproc PULL socket that you have already bound to the specified +// endpoint: +// +// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); +// zsock_wait (proxy); +// +// Pause the proxy. A paused proxy will cease processing messages, causing +// them to be queued up and potentially hit the high-water mark on the +// frontend or backend socket, causing messages to be dropped, or writing +// applications to block: +// +// zstr_sendx (proxy, "PAUSE", NULL); +// zsock_wait (proxy); +// +// Resume the proxy. Note that the proxy starts automatically as soon as it +// has a properly attached frontend and backend socket: +// +// zstr_sendx (proxy, "RESUME", NULL); +// zsock_wait (proxy); +// +// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy +// socket -- see zsock_set_zap_domain (). Call before binding socket: +// +// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); +// zsock_wait (proxy); +// +// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy +// socket -- see zsock_set_plain_server (). Call before binding socket: +// +// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); +// zsock_wait (proxy); +// +// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy +// socket -- see zsock_set_curve_server () -- specifying both the public and +// secret keys of a certificate as Z85 armored strings -- see +// zcert_public_txt () and zcert_secret_txt (). Call before binding socket: +// +// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); +// zsock_wait (proxy); +// +// This is the zproxy constructor as a zactor_fn; the argument is a +// character string specifying frontend and backend socket types as two +// uppercase strings separated by a hyphen: +CZMQ_EXPORT void + zproxy (zsock_t *pipe, void *unused); + +// Selftest +CZMQ_EXPORT void + zproxy_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zproxy_v2.h b/phonelibs/zmq/arm/include/zproxy_v2.h new file mode 100644 index 00000000000000..4bde9515916935 --- /dev/null +++ b/phonelibs/zmq/arm/include/zproxy_v2.h @@ -0,0 +1,62 @@ +/* ========================================================================= + zproxy_v2 - run a steerable proxy in the background (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZPROXY_V2_H_INCLUDED__ +#define __ZPROXY_V2_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface + +// Constructor +// Create a new zproxy object. You must create the frontend and backend +// sockets, configure them, and connect or bind them, before you pass them +// to the constructor. Do NOT use the sockets again, after passing them to +// this method. +CZMQ_EXPORT zproxy_t * + zproxy_new (zctx_t *ctx, void *frontend, void *backend); + +// Destructor +// Destroy a zproxy object; note this first stops the proxy. +CZMQ_EXPORT void + zproxy_destroy (zproxy_t **self_p); + +// Copy all proxied messages to specified endpoint; if this is NULL, any +// in-progress capturing will be stopped. You must already have bound the +// endpoint to a PULL socket. +CZMQ_EXPORT void + zproxy_capture (zproxy_t *self, const char *endpoint); + +// Pauses a zproxy object; a paused proxy will cease processing messages, +// causing them to be queued up and potentially hit the high-water mark on +// the frontend socket, causing messages to be dropped, or writing +// applications to block. +CZMQ_EXPORT void + zproxy_pause (zproxy_t *self); + +// Resume a zproxy object +CZMQ_EXPORT void + zproxy_resume (zproxy_t *self); + +// Self test of this class +CZMQ_EXPORT void + zproxy_v2_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zrex.h b/phonelibs/zmq/arm/include/zrex.h new file mode 100644 index 00000000000000..8b50618a34837c --- /dev/null +++ b/phonelibs/zmq/arm/include/zrex.h @@ -0,0 +1,82 @@ +/* ========================================================================= + zrex - work with regular expressions + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZREX_H_INCLUDED__ +#define __ZREX_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Constructor. Optionally, sets an expression against which we can match +// text and capture hits. If there is an error in the expression, reports +// zrex_valid() as false and provides the error in zrex_strerror(). If you +// set a pattern, you can call zrex_matches() to test it against text. +CZMQ_EXPORT zrex_t * + zrex_new (const char *expression); + +// Destructor +CZMQ_EXPORT void + zrex_destroy (zrex_t **self_p); + +// Return true if the expression was valid and compiled without errors. +CZMQ_EXPORT bool + zrex_valid (zrex_t *self); + +// Return the error message generated during compilation of the expression. +CZMQ_EXPORT const char * + zrex_strerror (zrex_t *self); + +// Returns true if the text matches the previously compiled expression. +// Use this method to compare one expression against many strings. +CZMQ_EXPORT bool + zrex_matches (zrex_t *self, const char *text); + +// Returns true if the text matches the supplied expression. Use this +// method to compare one string against several expressions. +CZMQ_EXPORT bool + zrex_eq (zrex_t *self, const char *text, const char *expression); + +// Returns number of hits from last zrex_matches or zrex_eq. If the text +// matched, returns 1 plus the number of capture groups. If the text did +// not match, returns zero. To retrieve individual capture groups, call +// zrex_hit (). +CZMQ_EXPORT int + zrex_hits (zrex_t *self); + +// Returns the Nth capture group from the last expression match, where +// N is 0 to the value returned by zrex_hits(). Capture group 0 is the +// whole matching string. Sequence 1 is the first capture group, if any, +// and so on. +CZMQ_EXPORT const char * + zrex_hit (zrex_t *self, uint index); + +// Fetches hits into string variables provided by caller; this makes for +// nicer code than accessing hits by index. Caller should not modify nor +// free the returned values. Returns number of strings returned. This +// method starts at hit 1, i.e. first capture group, as hit 0 is always +// the original matched string. +CZMQ_EXPORT int + zrex_fetch (zrex_t *self, const char **string_p, ...); + +// Self test of this class +CZMQ_EXPORT void + zrex_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zsock.h b/phonelibs/zmq/arm/include/zsock.h new file mode 100644 index 00000000000000..fc5c46e45e9810 --- /dev/null +++ b/phonelibs/zmq/arm/include/zsock.h @@ -0,0 +1,921 @@ +/* ========================================================================= + zsock - high-level socket API that hides libzmq contexts and sockets + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSOCK_H_INCLUDED__ +#define __ZSOCK_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// This interface includes some smart constructors, which create sockets with +// additional set-up. In all of these, the endpoint is NULL, or starts with +// '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by +// commas. If endpoint does not start with '@' or '>', default action depends +// on socket type. + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zsock.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Create a new socket. Returns the new socket, or NULL if the new socket +// could not be created. Note that the symbol zsock_new (and other +// constructors/destructors for zsock) are redirected to the *_checked +// variant, enabling intelligent socket leak detection. This can have +// performance implications if you use a LOT of sockets. To turn off this +// redirection behaviour, define ZSOCK_NOCHECK. +CZMQ_EXPORT zsock_t * + zsock_new (int type); + +// Create a PUB socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_pub (const char *endpoint); + +// Create a SUB socket, and optionally subscribe to some prefix string. Default +// action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_sub (const char *endpoint, const char *subscribe); + +// Create a REQ socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_req (const char *endpoint); + +// Create a REP socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_rep (const char *endpoint); + +// Create a DEALER socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_dealer (const char *endpoint); + +// Create a ROUTER socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_router (const char *endpoint); + +// Create a PUSH socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_push (const char *endpoint); + +// Create a PULL socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_pull (const char *endpoint); + +// Create an XPUB socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_xpub (const char *endpoint); + +// Create an XSUB socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_xsub (const char *endpoint); + +// Create a PAIR socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_pair (const char *endpoint); + +// Create a STREAM socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_stream (const char *endpoint); + +// Destroy the socket. You must use this for any socket created via the +// zsock_new method. +CZMQ_EXPORT void + zsock_destroy (zsock_t **self_p); + +// Bind a socket to a formatted endpoint. For tcp:// endpoints, supports +// ephemeral ports, if you specify the port number as "*". By default +// zsock uses the IANA designated range from C000 (49152) to FFFF (65535). +// To override this range, follow the "*" with "[first-last]". Either or +// both first and last may be empty. To bind to a random port within the +// range, use "!" in place of "*". +// +// Examples: +// tcp://127.0.0.1:* bind to first free port from C000 up +// tcp://127.0.0.1:! bind to random port from C000 to FFFF +// tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up +// tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 +// tcp://127.0.0.1:![55000-55999] +// bind to random port from 55000 to 55999 +// +// On success, returns the actual port number used, for tcp:// endpoints, +// and 0 for other transports. On failure, returns -1. Note that when using +// ephemeral ports, a port may be reused by different services without +// clients being aware. Protocols that run on ephemeral ports should take +// this into account. +CZMQ_EXPORT int + zsock_bind (zsock_t *self, const char *format, ...); + +// Returns last bound endpoint, if any. +CZMQ_EXPORT const char * + zsock_endpoint (zsock_t *self); + +// Unbind a socket from a formatted endpoint. +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsock_unbind (zsock_t *self, const char *format, ...); + +// Connect a socket to a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid. +CZMQ_EXPORT int + zsock_connect (zsock_t *self, const char *format, ...); + +// Disconnect a socket from a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsock_disconnect (zsock_t *self, const char *format, ...); + +// Attach a socket to zero or more endpoints. If endpoints is not null, +// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by +// '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all +// endpoints were valid, or -1 if there was a syntax error. If the endpoint +// does not start with '@' or '>', the serverish argument defines whether +// it is used to bind (serverish = true) or connect (serverish = false). +CZMQ_EXPORT int + zsock_attach (zsock_t *self, const char *endpoints, bool serverish); + +// Returns socket type as printable constant string. +CZMQ_EXPORT const char * + zsock_type_str (zsock_t *self); + +// Send a 'picture' message to the socket (or actor). The picture is a +// string that defines the type of each frame. This makes it easy to send +// a complex multiframe message in one call. The picture can contain any +// of these characters, each corresponding to one or two arguments: +// +// i = int (signed) +// 1 = uint8_t +// 2 = uint16_t +// 4 = uint32_t +// 8 = uint64_t +// s = char * +// b = byte *, size_t (2 arguments) +// c = zchunk_t * +// f = zframe_t * +// h = zhashx_t * +// U = zuuid_t * +// p = void * (sends the pointer value, only meaningful over inproc) +// m = zmsg_t * (sends all frames in the zmsg) +// z = sends zero-sized frame (0 arguments) +// u = uint (deprecated) +// +// Note that s, b, c, and f are encoded the same way and the choice is +// offered as a convenience to the sender, which may or may not already +// have data in a zchunk or zframe. Does not change or take ownership of +// any arguments. Returns 0 if successful, -1 if sending failed for any +// reason. +CZMQ_EXPORT int + zsock_send (void *self, const char *picture, ...); + +// Send a 'picture' message to the socket (or actor). This is a va_list +// version of zsock_send (), so please consult its documentation for the +// details. +CZMQ_EXPORT int + zsock_vsend (void *self, const char *picture, va_list argptr); + +// Receive a 'picture' message to the socket (or actor). See zsock_send for +// the format and meaning of the picture. Returns the picture elements into +// a series of pointers as provided by the caller: +// +// i = int * (stores signed integer) +// 4 = uint32_t * (stores 32-bit unsigned integer) +// 8 = uint64_t * (stores 64-bit unsigned integer) +// s = char ** (allocates new string) +// b = byte **, size_t * (2 arguments) (allocates memory) +// c = zchunk_t ** (creates zchunk) +// f = zframe_t ** (creates zframe) +// U = zuuid_t * (creates a zuuid with the data) +// h = zhashx_t ** (creates zhashx) +// p = void ** (stores pointer) +// m = zmsg_t ** (creates a zmsg with the remaing frames) +// z = null, asserts empty frame (0 arguments) +// u = uint * (stores unsigned integer, deprecated) +// +// Note that zsock_recv creates the returned objects, and the caller must +// destroy them when finished with them. The supplied pointers do not need +// to be initialized. Returns 0 if successful, or -1 if it failed to recv +// a message, in which case the pointers are not modified. When message +// frames are truncated (a short message), sets return values to zero/null. +// If an argument pointer is NULL, does not store any value (skips it). +// An 'n' picture matches an empty frame; if the message does not match, +// the method will return -1. +CZMQ_EXPORT int + zsock_recv (void *self, const char *picture, ...); + +// Receive a 'picture' message from the socket (or actor). This is a +// va_list version of zsock_recv (), so please consult its documentation +// for the details. +CZMQ_EXPORT int + zsock_vrecv (void *self, const char *picture, va_list argptr); + +// Send a binary encoded 'picture' message to the socket (or actor). This +// method is similar to zsock_send, except the arguments are encoded in a +// binary format that is compatible with zproto, and is designed to reduce +// memory allocations. The pattern argument is a string that defines the +// type of each argument. Supports these argument types: +// +// pattern C type zproto type: +// 1 uint8_t type = "number" size = "1" +// 2 uint16_t type = "number" size = "2" +// 4 uint32_t type = "number" size = "3" +// 8 uint64_t type = "number" size = "4" +// s char *, 0-255 chars type = "string" +// S char *, 0-2^32-1 chars type = "longstr" +// c zchunk_t * type = "chunk" +// f zframe_t * type = "frame" +// u zuuid_t * type = "uuid" +// m zmsg_t * type = "msg" +// p void *, sends pointer value, only over inproc +// +// Does not change or take ownership of any arguments. Returns 0 if +// successful, -1 if sending failed for any reason. +CZMQ_EXPORT int + zsock_bsend (void *self, const char *picture, ...); + +// Receive a binary encoded 'picture' message from the socket (or actor). +// This method is similar to zsock_recv, except the arguments are encoded +// in a binary format that is compatible with zproto, and is designed to +// reduce memory allocations. The pattern argument is a string that defines +// the type of each argument. See zsock_bsend for the supported argument +// types. All arguments must be pointers; this call sets them to point to +// values held on a per-socket basis. +// Note that zsock_brecv creates the returned objects, and the caller must +// destroy them when finished with them. The supplied pointers do not need +// to be initialized. Returns 0 if successful, or -1 if it failed to read +// a message. +CZMQ_EXPORT int + zsock_brecv (void *self, const char *picture, ...); + +// Set socket to use unbounded pipes (HWM=0); use this in cases when you are +// totally certain the message volume can fit in memory. This method works +// across all versions of ZeroMQ. Takes a polymorphic socket reference. +CZMQ_EXPORT void + zsock_set_unbounded (void *self); + +// Send a signal over a socket. A signal is a short message carrying a +// success/failure code (by convention, 0 means OK). Signals are encoded +// to be distinguishable from "normal" messages. Accepts a zsock_t or a +// zactor_t argument, and returns 0 if successful, -1 if the signal could +// not be sent. Takes a polymorphic socket reference. +CZMQ_EXPORT int + zsock_signal (void *self, byte status); + +// Wait on a signal. Use this to coordinate between threads, over pipe +// pairs. Blocks until the signal is received. Returns -1 on error, 0 or +// greater on success. Accepts a zsock_t or a zactor_t as argument. +// Takes a polymorphic socket reference. +CZMQ_EXPORT int + zsock_wait (void *self); + +// If there is a partial message still waiting on the socket, remove and +// discard it. This is useful when reading partial messages, to get specific +// message types. +CZMQ_EXPORT void + zsock_flush (void *self); + +// Probe the supplied object, and report if it looks like a zsock_t. +// Takes a polymorphic socket reference. +CZMQ_EXPORT bool + zsock_is (void *self); + +// Probe the supplied reference. If it looks like a zsock_t instance, return +// the underlying libzmq socket handle; else if it looks like a file +// descriptor, return NULL; else if it looks like a libzmq socket handle, +// return the supplied value. Takes a polymorphic socket reference. +CZMQ_EXPORT void * + zsock_resolve (void *self); + +// Get socket option `tos`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tos (void *self); + +// Set socket option `tos`. +CZMQ_EXPORT void + zsock_set_tos (void *self, int tos); + +// Set socket option `router_handover`. +CZMQ_EXPORT void + zsock_set_router_handover (void *self, int router_handover); + +// Set socket option `router_mandatory`. +CZMQ_EXPORT void + zsock_set_router_mandatory (void *self, int router_mandatory); + +// Set socket option `probe_router`. +CZMQ_EXPORT void + zsock_set_probe_router (void *self, int probe_router); + +// Set socket option `req_relaxed`. +CZMQ_EXPORT void + zsock_set_req_relaxed (void *self, int req_relaxed); + +// Set socket option `req_correlate`. +CZMQ_EXPORT void + zsock_set_req_correlate (void *self, int req_correlate); + +// Set socket option `conflate`. +CZMQ_EXPORT void + zsock_set_conflate (void *self, int conflate); + +// Get socket option `zap_domain`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_zap_domain (void *self); + +// Set socket option `zap_domain`. +CZMQ_EXPORT void + zsock_set_zap_domain (void *self, const char *zap_domain); + +// Get socket option `mechanism`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_mechanism (void *self); + +// Get socket option `plain_server`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_plain_server (void *self); + +// Set socket option `plain_server`. +CZMQ_EXPORT void + zsock_set_plain_server (void *self, int plain_server); + +// Get socket option `plain_username`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_plain_username (void *self); + +// Set socket option `plain_username`. +CZMQ_EXPORT void + zsock_set_plain_username (void *self, const char *plain_username); + +// Get socket option `plain_password`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_plain_password (void *self); + +// Set socket option `plain_password`. +CZMQ_EXPORT void + zsock_set_plain_password (void *self, const char *plain_password); + +// Get socket option `curve_server`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_curve_server (void *self); + +// Set socket option `curve_server`. +CZMQ_EXPORT void + zsock_set_curve_server (void *self, int curve_server); + +// Get socket option `curve_publickey`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_curve_publickey (void *self); + +// Set socket option `curve_publickey`. +CZMQ_EXPORT void + zsock_set_curve_publickey (void *self, const char *curve_publickey); + +// Set socket option `curve_publickey` from 32-octet binary +CZMQ_EXPORT void + zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); + +// Get socket option `curve_secretkey`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_curve_secretkey (void *self); + +// Set socket option `curve_secretkey`. +CZMQ_EXPORT void + zsock_set_curve_secretkey (void *self, const char *curve_secretkey); + +// Set socket option `curve_secretkey` from 32-octet binary +CZMQ_EXPORT void + zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); + +// Get socket option `curve_serverkey`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_curve_serverkey (void *self); + +// Set socket option `curve_serverkey`. +CZMQ_EXPORT void + zsock_set_curve_serverkey (void *self, const char *curve_serverkey); + +// Set socket option `curve_serverkey` from 32-octet binary +CZMQ_EXPORT void + zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); + +// Get socket option `gssapi_server`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_gssapi_server (void *self); + +// Set socket option `gssapi_server`. +CZMQ_EXPORT void + zsock_set_gssapi_server (void *self, int gssapi_server); + +// Get socket option `gssapi_plaintext`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_gssapi_plaintext (void *self); + +// Set socket option `gssapi_plaintext`. +CZMQ_EXPORT void + zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); + +// Get socket option `gssapi_principal`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_gssapi_principal (void *self); + +// Set socket option `gssapi_principal`. +CZMQ_EXPORT void + zsock_set_gssapi_principal (void *self, const char *gssapi_principal); + +// Get socket option `gssapi_service_principal`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_gssapi_service_principal (void *self); + +// Set socket option `gssapi_service_principal`. +CZMQ_EXPORT void + zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); + +// Get socket option `ipv6`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_ipv6 (void *self); + +// Set socket option `ipv6`. +CZMQ_EXPORT void + zsock_set_ipv6 (void *self, int ipv6); + +// Get socket option `immediate`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_immediate (void *self); + +// Set socket option `immediate`. +CZMQ_EXPORT void + zsock_set_immediate (void *self, int immediate); + +// Set socket option `router_raw`. +CZMQ_EXPORT void + zsock_set_router_raw (void *self, int router_raw); + +// Get socket option `ipv4only`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_ipv4only (void *self); + +// Set socket option `ipv4only`. +CZMQ_EXPORT void + zsock_set_ipv4only (void *self, int ipv4only); + +// Set socket option `delay_attach_on_connect`. +CZMQ_EXPORT void + zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); + +// Get socket option `type`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_type (void *self); + +// Get socket option `sndhwm`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_sndhwm (void *self); + +// Set socket option `sndhwm`. +CZMQ_EXPORT void + zsock_set_sndhwm (void *self, int sndhwm); + +// Get socket option `rcvhwm`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvhwm (void *self); + +// Set socket option `rcvhwm`. +CZMQ_EXPORT void + zsock_set_rcvhwm (void *self, int rcvhwm); + +// Get socket option `affinity`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_affinity (void *self); + +// Set socket option `affinity`. +CZMQ_EXPORT void + zsock_set_affinity (void *self, int affinity); + +// Set socket option `subscribe`. +CZMQ_EXPORT void + zsock_set_subscribe (void *self, const char *subscribe); + +// Set socket option `unsubscribe`. +CZMQ_EXPORT void + zsock_set_unsubscribe (void *self, const char *unsubscribe); + +// Get socket option `identity`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_identity (void *self); + +// Set socket option `identity`. +CZMQ_EXPORT void + zsock_set_identity (void *self, const char *identity); + +// Get socket option `rate`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rate (void *self); + +// Set socket option `rate`. +CZMQ_EXPORT void + zsock_set_rate (void *self, int rate); + +// Get socket option `recovery_ivl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_recovery_ivl (void *self); + +// Set socket option `recovery_ivl`. +CZMQ_EXPORT void + zsock_set_recovery_ivl (void *self, int recovery_ivl); + +// Get socket option `sndbuf`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_sndbuf (void *self); + +// Set socket option `sndbuf`. +CZMQ_EXPORT void + zsock_set_sndbuf (void *self, int sndbuf); + +// Get socket option `rcvbuf`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvbuf (void *self); + +// Set socket option `rcvbuf`. +CZMQ_EXPORT void + zsock_set_rcvbuf (void *self, int rcvbuf); + +// Get socket option `linger`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_linger (void *self); + +// Set socket option `linger`. +CZMQ_EXPORT void + zsock_set_linger (void *self, int linger); + +// Get socket option `reconnect_ivl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_reconnect_ivl (void *self); + +// Set socket option `reconnect_ivl`. +CZMQ_EXPORT void + zsock_set_reconnect_ivl (void *self, int reconnect_ivl); + +// Get socket option `reconnect_ivl_max`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_reconnect_ivl_max (void *self); + +// Set socket option `reconnect_ivl_max`. +CZMQ_EXPORT void + zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); + +// Get socket option `backlog`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_backlog (void *self); + +// Set socket option `backlog`. +CZMQ_EXPORT void + zsock_set_backlog (void *self, int backlog); + +// Get socket option `maxmsgsize`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_maxmsgsize (void *self); + +// Set socket option `maxmsgsize`. +CZMQ_EXPORT void + zsock_set_maxmsgsize (void *self, int maxmsgsize); + +// Get socket option `multicast_hops`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_multicast_hops (void *self); + +// Set socket option `multicast_hops`. +CZMQ_EXPORT void + zsock_set_multicast_hops (void *self, int multicast_hops); + +// Get socket option `rcvtimeo`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvtimeo (void *self); + +// Set socket option `rcvtimeo`. +CZMQ_EXPORT void + zsock_set_rcvtimeo (void *self, int rcvtimeo); + +// Get socket option `sndtimeo`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_sndtimeo (void *self); + +// Set socket option `sndtimeo`. +CZMQ_EXPORT void + zsock_set_sndtimeo (void *self, int sndtimeo); + +// Set socket option `xpub_verbose`. +CZMQ_EXPORT void + zsock_set_xpub_verbose (void *self, int xpub_verbose); + +// Get socket option `tcp_keepalive`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive (void *self); + +// Set socket option `tcp_keepalive`. +CZMQ_EXPORT void + zsock_set_tcp_keepalive (void *self, int tcp_keepalive); + +// Get socket option `tcp_keepalive_idle`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive_idle (void *self); + +// Set socket option `tcp_keepalive_idle`. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); + +// Get socket option `tcp_keepalive_cnt`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive_cnt (void *self); + +// Set socket option `tcp_keepalive_cnt`. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); + +// Get socket option `tcp_keepalive_intvl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_tcp_keepalive_intvl (void *self); + +// Set socket option `tcp_keepalive_intvl`. +CZMQ_EXPORT void + zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); + +// Get socket option `tcp_accept_filter`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_tcp_accept_filter (void *self); + +// Set socket option `tcp_accept_filter`. +CZMQ_EXPORT void + zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); + +// Get socket option `rcvmore`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_rcvmore (void *self); + +// Get socket option `fd`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT SOCKET + zsock_fd (void *self); + +// Get socket option `events`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_events (void *self); + +// Get socket option `last_endpoint`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zsock_last_endpoint (void *self); + +// Self test of this class. +CZMQ_EXPORT void + zsock_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Create a SERVER socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_server (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a CLIENT socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_client (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a RADIO socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_radio (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a DISH socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_dish (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a GATHER socket. Default action is bind. +CZMQ_EXPORT zsock_t * + zsock_new_gather (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Create a SCATTER socket. Default action is connect. +CZMQ_EXPORT zsock_t * + zsock_new_scatter (const char *endpoint); + +// *** Draft method, for development use, may change without warning *** +// Return socket routing ID if any. This returns 0 if the socket is not +// of type ZMQ_SERVER or if no request was already received on it. +CZMQ_EXPORT uint32_t + zsock_routing_id (zsock_t *self); + +// *** Draft method, for development use, may change without warning *** +// Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. +// This will be used when sending messages on the socket via the zsock API. +CZMQ_EXPORT void + zsock_set_routing_id (zsock_t *self, uint32_t routing_id); + +// *** Draft method, for development use, may change without warning *** +// Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. +// Returns 0 if OK, -1 if failed. +CZMQ_EXPORT int + zsock_join (void *self, const char *group); + +// *** Draft method, for development use, may change without warning *** +// Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. +// Returns 0 if OK, -1 if failed. +CZMQ_EXPORT int + zsock_leave (void *self, const char *group); + +// *** Draft method, for development use, may change without warning *** +// Get socket option `heartbeat_ivl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_heartbeat_ivl (void *self); + +// *** Draft method, for development use, may change without warning *** +// Set socket option `heartbeat_ivl`. +CZMQ_EXPORT void + zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); + +// *** Draft method, for development use, may change without warning *** +// Get socket option `heartbeat_ttl`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_heartbeat_ttl (void *self); + +// *** Draft method, for development use, may change without warning *** +// Set socket option `heartbeat_ttl`. +CZMQ_EXPORT void + zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); + +// *** Draft method, for development use, may change without warning *** +// Get socket option `heartbeat_timeout`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_heartbeat_timeout (void *self); + +// *** Draft method, for development use, may change without warning *** +// Set socket option `heartbeat_timeout`. +CZMQ_EXPORT void + zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); + +// *** Draft method, for development use, may change without warning *** +// Get socket option `use_fd`. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT int + zsock_use_fd (void *self); + +// *** Draft method, for development use, may change without warning *** +// Set socket option `use_fd`. +CZMQ_EXPORT void + zsock_set_use_fd (void *self, int use_fd); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT int + zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); +// @end + + +// zsock leak detection - not a part of the official interface to zsock. This +// enables CZMQ to report socket leaks intelligently. +#if defined ZSOCK_NOCHECK + // no checking active - use the above interface methods directly. +#else +# define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__) +# define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__) +# define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__) +# define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__) +# define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__) +# define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__) +# define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__) +# define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__) +# define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__) +# define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__) +# define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__) +# define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__) +# define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__) +# define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__) +#endif + +CZMQ_EXPORT zsock_t * + zsock_new_checked (int type, const char *filename, size_t line_nbr); + +CZMQ_EXPORT void + zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr); + +CZMQ_EXPORT zsock_t * + zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zsocket.h b/phonelibs/zmq/arm/include/zsocket.h new file mode 100644 index 00000000000000..a60a0d9db3e7da --- /dev/null +++ b/phonelibs/zmq/arm/include/zsocket.h @@ -0,0 +1,110 @@ +/* ========================================================================= + zsocket - working with 0MQ sockets + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSOCKET_H_INCLUDED__ +#define __ZSOCKET_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// This port range is defined by IANA for dynamic or private ports +// We use this when choosing a port for dynamic binding. +#define ZSOCKET_DYNFROM 0xc000 +#define ZSOCKET_DYNTO 0xffff + +// Callback function for zero-copy methods +typedef void (zsocket_free_fn) (void *data, void *arg); + +// Create a new socket within our CZMQ context, replaces zmq_socket. +// Use this to get automatic management of the socket at shutdown. +// Note: SUB sockets do not automatically subscribe to everything; you +// must set filters explicitly. +CZMQ_EXPORT void * + zsocket_new (zctx_t *self, int type); + +// Destroy a socket within our CZMQ context, replaces zmq_close. +CZMQ_EXPORT void + zsocket_destroy (zctx_t *ctx, void *self); + +// Bind a socket to a formatted endpoint. If the port is specified as +// '*', binds to any free port from ZSOCKET_DYNFROM to ZSOCKET_DYNTO +// and returns the actual port number used. Otherwise asserts that the +// bind succeeded with the specified port number. Always returns the +// port number if successful. +CZMQ_EXPORT int + zsocket_bind (void *self, const char *format, ...); + +// Unbind a socket from a formatted endpoint. +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsocket_unbind (void *self, const char *format, ...); + +// Connect a socket to a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid. +CZMQ_EXPORT int + zsocket_connect (void *self, const char *format, ...); + +// Disconnect a socket from a formatted endpoint +// Returns 0 if OK, -1 if the endpoint was invalid or the function +// isn't supported. +CZMQ_EXPORT int + zsocket_disconnect (void *self, const char *format, ...); + +// Poll for input events on the socket. Returns TRUE if there is input +// ready on the socket, else FALSE. +CZMQ_EXPORT bool + zsocket_poll (void *self, int msecs); + +// Returns socket type as printable constant string +CZMQ_EXPORT const char * + zsocket_type_str (void *self); + +// Send data over a socket as a single message frame. +// Accepts these flags: ZFRAME_MORE and ZFRAME_DONTWAIT. +// Returns -1 on error, 0 on success +CZMQ_EXPORT int + zsocket_sendmem (void *self, const void *data, size_t size, int flags); + +// Send a signal over a socket. A signal is a zero-byte message. +// Signals are used primarily between threads, over pipe sockets. +// Returns -1 if there was an error sending the signal. +CZMQ_EXPORT int + zsocket_signal (void *self); + +// Wait on a signal. Use this to coordinate between threads, over +// pipe pairs. Returns -1 on error, 0 on success. +CZMQ_EXPORT int + zsocket_wait (void *self); + +// Self test of this class +CZMQ_EXPORT void + zsocket_test (bool verbose); +// @end + +// Compiler hints +CZMQ_EXPORT int zsocket_bind (void *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int zsocket_unbind (void *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int zsocket_connect (void *self, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int zsocket_disconnect (void *self, const char *format, ...) CHECK_PRINTF (2); + +// Emulation of widely-used 2.x socket options +CZMQ_EXPORT void zsocket_set_hwm (void *self, int hwm); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zsockopt.h b/phonelibs/zmq/arm/include/zsockopt.h new file mode 100644 index 00000000000000..5246986dd0b367 --- /dev/null +++ b/phonelibs/zmq/arm/include/zsockopt.h @@ -0,0 +1,256 @@ +/* ========================================================================= + zsockopt - get/set 0MQ socket options (deprecated) + + **************************************************** + * GENERATED SOURCE CODE, DO NOT EDIT!! * + * TO CHANGE THIS, EDIT src/zsockopt.gsl * + * AND RUN `gsl sockopts` in src/. * + **************************************************** + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSOCKOPT_H_INCLUDED__ +#define __ZSOCKOPT_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#if (ZMQ_VERSION_MAJOR == 4) +// Get socket options +CZMQ_EXPORT int zsocket_heartbeat_ivl (void *zocket); +CZMQ_EXPORT int zsocket_heartbeat_ttl (void *zocket); +CZMQ_EXPORT int zsocket_heartbeat_timeout (void *zocket); +CZMQ_EXPORT int zsocket_use_fd (void *zocket); +CZMQ_EXPORT int zsocket_tos (void *zocket); +CZMQ_EXPORT char * zsocket_zap_domain (void *zocket); +CZMQ_EXPORT int zsocket_mechanism (void *zocket); +CZMQ_EXPORT int zsocket_plain_server (void *zocket); +CZMQ_EXPORT char * zsocket_plain_username (void *zocket); +CZMQ_EXPORT char * zsocket_plain_password (void *zocket); +CZMQ_EXPORT int zsocket_curve_server (void *zocket); +CZMQ_EXPORT char * zsocket_curve_publickey (void *zocket); +CZMQ_EXPORT char * zsocket_curve_secretkey (void *zocket); +CZMQ_EXPORT char * zsocket_curve_serverkey (void *zocket); +CZMQ_EXPORT int zsocket_gssapi_server (void *zocket); +CZMQ_EXPORT int zsocket_gssapi_plaintext (void *zocket); +CZMQ_EXPORT char * zsocket_gssapi_principal (void *zocket); +CZMQ_EXPORT char * zsocket_gssapi_service_principal (void *zocket); +CZMQ_EXPORT int zsocket_ipv6 (void *zocket); +CZMQ_EXPORT int zsocket_immediate (void *zocket); +CZMQ_EXPORT int zsocket_ipv4only (void *zocket); +CZMQ_EXPORT int zsocket_type (void *zocket); +CZMQ_EXPORT int zsocket_sndhwm (void *zocket); +CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); +CZMQ_EXPORT int zsocket_affinity (void *zocket); +CZMQ_EXPORT char * zsocket_identity (void *zocket); +CZMQ_EXPORT int zsocket_rate (void *zocket); +CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); +CZMQ_EXPORT int zsocket_sndbuf (void *zocket); +CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); +CZMQ_EXPORT int zsocket_linger (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); +CZMQ_EXPORT int zsocket_backlog (void *zocket); +CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); +CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); +CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); +CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); +CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); +CZMQ_EXPORT int zsocket_rcvmore (void *zocket); +CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); +CZMQ_EXPORT int zsocket_events (void *zocket); +CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); + +// Set socket options +CZMQ_EXPORT void zsocket_set_heartbeat_ivl (void *zocket, int heartbeat_ivl); +CZMQ_EXPORT void zsocket_set_heartbeat_ttl (void *zocket, int heartbeat_ttl); +CZMQ_EXPORT void zsocket_set_heartbeat_timeout (void *zocket, int heartbeat_timeout); +CZMQ_EXPORT void zsocket_set_use_fd (void *zocket, int use_fd); +CZMQ_EXPORT void zsocket_set_tos (void *zocket, int tos); +CZMQ_EXPORT void zsocket_set_router_handover (void *zocket, int router_handover); +CZMQ_EXPORT void zsocket_set_router_mandatory (void *zocket, int router_mandatory); +CZMQ_EXPORT void zsocket_set_probe_router (void *zocket, int probe_router); +CZMQ_EXPORT void zsocket_set_req_relaxed (void *zocket, int req_relaxed); +CZMQ_EXPORT void zsocket_set_req_correlate (void *zocket, int req_correlate); +CZMQ_EXPORT void zsocket_set_conflate (void *zocket, int conflate); +CZMQ_EXPORT void zsocket_set_zap_domain (void *zocket, const char * zap_domain); +CZMQ_EXPORT void zsocket_set_plain_server (void *zocket, int plain_server); +CZMQ_EXPORT void zsocket_set_plain_username (void *zocket, const char * plain_username); +CZMQ_EXPORT void zsocket_set_plain_password (void *zocket, const char * plain_password); +CZMQ_EXPORT void zsocket_set_curve_server (void *zocket, int curve_server); +CZMQ_EXPORT void zsocket_set_curve_publickey (void *zocket, const char * curve_publickey); +CZMQ_EXPORT void zsocket_set_curve_publickey_bin (void *zocket, const byte *curve_publickey); +CZMQ_EXPORT void zsocket_set_curve_secretkey (void *zocket, const char * curve_secretkey); +CZMQ_EXPORT void zsocket_set_curve_secretkey_bin (void *zocket, const byte *curve_secretkey); +CZMQ_EXPORT void zsocket_set_curve_serverkey (void *zocket, const char * curve_serverkey); +CZMQ_EXPORT void zsocket_set_curve_serverkey_bin (void *zocket, const byte *curve_serverkey); +CZMQ_EXPORT void zsocket_set_gssapi_server (void *zocket, int gssapi_server); +CZMQ_EXPORT void zsocket_set_gssapi_plaintext (void *zocket, int gssapi_plaintext); +CZMQ_EXPORT void zsocket_set_gssapi_principal (void *zocket, const char * gssapi_principal); +CZMQ_EXPORT void zsocket_set_gssapi_service_principal (void *zocket, const char * gssapi_service_principal); +CZMQ_EXPORT void zsocket_set_ipv6 (void *zocket, int ipv6); +CZMQ_EXPORT void zsocket_set_immediate (void *zocket, int immediate); +CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); +CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); +CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); +CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); +CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); +CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); +CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); +CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); +CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); +CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); +CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); +CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); +CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); +CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); +CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); +CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); +CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); +CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); +CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); +CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); +CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); +CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); +CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); +CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); +#endif + +#if (ZMQ_VERSION_MAJOR == 3) +// Get socket options +CZMQ_EXPORT int zsocket_ipv4only (void *zocket); +CZMQ_EXPORT int zsocket_type (void *zocket); +CZMQ_EXPORT int zsocket_sndhwm (void *zocket); +CZMQ_EXPORT int zsocket_rcvhwm (void *zocket); +CZMQ_EXPORT int zsocket_affinity (void *zocket); +CZMQ_EXPORT char * zsocket_identity (void *zocket); +CZMQ_EXPORT int zsocket_rate (void *zocket); +CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); +CZMQ_EXPORT int zsocket_sndbuf (void *zocket); +CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); +CZMQ_EXPORT int zsocket_linger (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); +CZMQ_EXPORT int zsocket_backlog (void *zocket); +CZMQ_EXPORT int zsocket_maxmsgsize (void *zocket); +CZMQ_EXPORT int zsocket_multicast_hops (void *zocket); +CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); +CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_idle (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_cnt (void *zocket); +CZMQ_EXPORT int zsocket_tcp_keepalive_intvl (void *zocket); +CZMQ_EXPORT char * zsocket_tcp_accept_filter (void *zocket); +CZMQ_EXPORT int zsocket_rcvmore (void *zocket); +CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); +CZMQ_EXPORT int zsocket_events (void *zocket); +CZMQ_EXPORT char * zsocket_last_endpoint (void *zocket); + +// Set socket options +CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw); +CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only); +CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect); +CZMQ_EXPORT void zsocket_set_sndhwm (void *zocket, int sndhwm); +CZMQ_EXPORT void zsocket_set_rcvhwm (void *zocket, int rcvhwm); +CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); +CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); +CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); +CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); +CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); +CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); +CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); +CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); +CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); +CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); +CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); +CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); +CZMQ_EXPORT void zsocket_set_maxmsgsize (void *zocket, int maxmsgsize); +CZMQ_EXPORT void zsocket_set_multicast_hops (void *zocket, int multicast_hops); +CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); +CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); +CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose); +CZMQ_EXPORT void zsocket_set_tcp_keepalive (void *zocket, int tcp_keepalive); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_idle (void *zocket, int tcp_keepalive_idle); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_cnt (void *zocket, int tcp_keepalive_cnt); +CZMQ_EXPORT void zsocket_set_tcp_keepalive_intvl (void *zocket, int tcp_keepalive_intvl); +CZMQ_EXPORT void zsocket_set_tcp_accept_filter (void *zocket, const char * tcp_accept_filter); +#endif + +#if (ZMQ_VERSION_MAJOR == 2) +// Get socket options +CZMQ_EXPORT int zsocket_hwm (void *zocket); +CZMQ_EXPORT int zsocket_swap (void *zocket); +CZMQ_EXPORT int zsocket_affinity (void *zocket); +CZMQ_EXPORT char * zsocket_identity (void *zocket); +CZMQ_EXPORT int zsocket_rate (void *zocket); +CZMQ_EXPORT int zsocket_recovery_ivl (void *zocket); +CZMQ_EXPORT int zsocket_recovery_ivl_msec (void *zocket); +CZMQ_EXPORT int zsocket_mcast_loop (void *zocket); +# if (ZMQ_VERSION_MINOR == 2) +CZMQ_EXPORT int zsocket_rcvtimeo (void *zocket); +# endif +# if (ZMQ_VERSION_MINOR == 2) +CZMQ_EXPORT int zsocket_sndtimeo (void *zocket); +# endif +CZMQ_EXPORT int zsocket_sndbuf (void *zocket); +CZMQ_EXPORT int zsocket_rcvbuf (void *zocket); +CZMQ_EXPORT int zsocket_linger (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl (void *zocket); +CZMQ_EXPORT int zsocket_reconnect_ivl_max (void *zocket); +CZMQ_EXPORT int zsocket_backlog (void *zocket); +CZMQ_EXPORT int zsocket_type (void *zocket); +CZMQ_EXPORT int zsocket_rcvmore (void *zocket); +CZMQ_EXPORT SOCKET zsocket_fd (void *zocket); +CZMQ_EXPORT int zsocket_events (void *zocket); + +// Set socket options +CZMQ_EXPORT void zsocket_set_hwm (void *zocket, int hwm); +CZMQ_EXPORT void zsocket_set_swap (void *zocket, int swap); +CZMQ_EXPORT void zsocket_set_affinity (void *zocket, int affinity); +CZMQ_EXPORT void zsocket_set_identity (void *zocket, const char * identity); +CZMQ_EXPORT void zsocket_set_rate (void *zocket, int rate); +CZMQ_EXPORT void zsocket_set_recovery_ivl (void *zocket, int recovery_ivl); +CZMQ_EXPORT void zsocket_set_recovery_ivl_msec (void *zocket, int recovery_ivl_msec); +CZMQ_EXPORT void zsocket_set_mcast_loop (void *zocket, int mcast_loop); +# if (ZMQ_VERSION_MINOR == 2) +CZMQ_EXPORT void zsocket_set_rcvtimeo (void *zocket, int rcvtimeo); +# endif +# if (ZMQ_VERSION_MINOR == 2) +CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo); +# endif +CZMQ_EXPORT void zsocket_set_sndbuf (void *zocket, int sndbuf); +CZMQ_EXPORT void zsocket_set_rcvbuf (void *zocket, int rcvbuf); +CZMQ_EXPORT void zsocket_set_linger (void *zocket, int linger); +CZMQ_EXPORT void zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl); +CZMQ_EXPORT void zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max); +CZMQ_EXPORT void zsocket_set_backlog (void *zocket, int backlog); +CZMQ_EXPORT void zsocket_set_subscribe (void *zocket, const char * subscribe); +CZMQ_EXPORT void zsocket_set_unsubscribe (void *zocket, const char * unsubscribe); +#endif + +// Self test of this class +CZMQ_EXPORT void zsockopt_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zstr.h b/phonelibs/zmq/arm/include/zstr.h new file mode 100644 index 00000000000000..3d3f1a862ad7e5 --- /dev/null +++ b/phonelibs/zmq/arm/include/zstr.h @@ -0,0 +1,115 @@ +/* ========================================================================= + zstr - sending and receiving strings + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSTR_H_INCLUDED__ +#define __ZSTR_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zstr.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// This class has draft methods, which may change over time. They are not +// in stable releases, by default. Use --enable-drafts to enable. +// Receive C string from socket. Caller must free returned string using +// zstr_free(). Returns NULL if the context is being terminated or the +// process was interrupted. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zstr_recv (void *source); + +// Receive a series of strings (until NULL) from multipart data. +// Each string is allocated and filled with string data; if there +// are not enough frames, unallocated strings are set to NULL. +// Returns -1 if the message could not be read, else returns the +// number of strings filled, zero or more. Free each returned string +// using zstr_free(). If not enough strings are provided, remaining +// multipart frames in the message are dropped. +CZMQ_EXPORT int + zstr_recvx (void *source, char **string_p, ...); + +// Send a C string to a socket, as a frame. The string is sent without +// trailing null byte; to read this you can use zstr_recv, or a similar +// method that adds a null terminator on the received string. String +// may be NULL, which is sent as "". +CZMQ_EXPORT int + zstr_send (void *dest, const char *string); + +// Send a C string to a socket, as zstr_send(), with a MORE flag, so that +// you can send further strings in the same multi-part message. +CZMQ_EXPORT int + zstr_sendm (void *dest, const char *string); + +// Send a formatted string to a socket. Note that you should NOT use +// user-supplied strings in the format (they may contain '%' which +// will create security holes). +CZMQ_EXPORT int + zstr_sendf (void *dest, const char *format, ...); + +// Send a formatted string to a socket, as for zstr_sendf(), with a +// MORE flag, so that you can send further strings in the same multi-part +// message. +CZMQ_EXPORT int + zstr_sendfm (void *dest, const char *format, ...); + +// Send a series of strings (until NULL) as multipart data +// Returns 0 if the strings could be sent OK, or -1 on error. +CZMQ_EXPORT int + zstr_sendx (void *dest, const char *string, ...); + +// Free a provided string, and nullify the parent pointer. Safe to call on +// a null pointer. +CZMQ_EXPORT void + zstr_free (char **string_p); + +// Self test of this class. +CZMQ_EXPORT void + zstr_test (bool verbose); + +#ifdef CZMQ_BUILD_DRAFT_API +// *** Draft method, for development use, may change without warning *** +// Accepts a void pointer and returns a fresh character string. If source +// is null, returns an empty string. +// Caller owns return value and must destroy it when done. +CZMQ_EXPORT char * + zstr_str (void *source); + +#endif // CZMQ_BUILD_DRAFT_API +// @ignore +CZMQ_EXPORT int + zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); +CZMQ_EXPORT int + zstr_sendfm (void *dest, const char *format, ...) CHECK_PRINTF (2); +// @end + + +// DEPRECATED as poor style -- callers should use zloop or zpoller +// Receive C string from socket, if socket had input ready. Caller must +// free returned string using zstr_free. Returns NULL if there was no input +// waiting, or if the context was terminated. Use zctx_interrupted to exit +// any loop that relies on this method. +CZMQ_EXPORT char * + zstr_recv_nowait (void *source); + +// Compiler hints +CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zsys.h b/phonelibs/zmq/arm/include/zsys.h new file mode 100644 index 00000000000000..97f88a9555b8e0 --- /dev/null +++ b/phonelibs/zmq/arm/include/zsys.h @@ -0,0 +1,386 @@ +/* ========================================================================= + zsys - system-level methods + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZSYS_H_INCLUDED__ +#define __ZSYS_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +#define UDP_FRAME_MAX 255 // Max size of UDP frame + +// Callback for interrupt signal handler +typedef void (zsys_handler_fn) (int signal_value); + +// Initialize CZMQ zsys layer; this happens automatically when you create +// a socket or an actor; however this call lets you force initialization +// earlier, so e.g. logging is properly set-up before you start working. +// Not threadsafe, so call only from main thread. Safe to call multiple +// times. Returns global CZMQ context. +CZMQ_EXPORT void * + zsys_init (void); + +// Optionally shut down the CZMQ zsys layer; this normally happens automatically +// when the process exits; however this call lets you force a shutdown +// earlier, avoiding any potential problems with atexit() ordering, especially +// with Windows dlls. +CZMQ_EXPORT void + zsys_shutdown (void); + +// Get a new ZMQ socket, automagically creating a ZMQ context if this is +// the first time. Caller is responsible for destroying the ZMQ socket +// before process exits, to avoid a ZMQ deadlock. Note: you should not use +// this method in CZMQ apps, use zsock_new() instead. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void * + zsys_socket (int type, const char *filename, size_t line_nbr); + +// Destroy/close a ZMQ socket. You should call this for every socket you +// create using zsys_socket(). +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_close (void *handle, const char *filename, size_t line_nbr); + +// Return ZMQ socket name for socket type +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT char * + zsys_sockname (int socktype); + +// Create a pipe, which consists of two PAIR sockets connected over inproc. +// The pipe is configured to use the zsys_pipehwm setting. Returns the +// frontend socket successful, NULL if failed. +CZMQ_EXPORT zsock_t * + zsys_create_pipe (zsock_t **backend_p); + +// Set interrupt handler; this saves the default handlers so that a +// zsys_handler_reset () can restore them. If you call this multiple times +// then the last handler will take affect. If handler_fn is NULL, disables +// default SIGINT/SIGTERM handling in CZMQ. +CZMQ_EXPORT void + zsys_handler_set (zsys_handler_fn *handler_fn); + +// Reset interrupt handler, call this at exit if needed +CZMQ_EXPORT void + zsys_handler_reset (void); + +// Set default interrupt handler, so Ctrl-C or SIGTERM will set +// zsys_interrupted. Idempotent; safe to call multiple times. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void + zsys_catch_interrupts (void); + +// Return 1 if file exists, else zero +CZMQ_EXPORT bool + zsys_file_exists (const char *filename); + +// Return size of file, or -1 if not found +CZMQ_EXPORT ssize_t + zsys_file_size (const char *filename); + +// Return file modification time. Returns 0 if the file does not exist. +CZMQ_EXPORT time_t + zsys_file_modified (const char *filename); + +// Return file mode; provides at least support for the POSIX S_ISREG(m) +// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. +// Returns a mode_t cast to int, or -1 in case of error. +CZMQ_EXPORT int + zsys_file_mode (const char *filename); + +// Delete file. Does not complain if the file is absent +CZMQ_EXPORT int + zsys_file_delete (const char *filename); + +// Check if file is 'stable' +CZMQ_EXPORT bool + zsys_file_stable (const char *filename); + +// Create a file path if it doesn't exist. The file path is treated as a +// printf format. +CZMQ_EXPORT int + zsys_dir_create (const char *pathname, ...); + +// Remove a file path if empty; the pathname is treated as printf format. +CZMQ_EXPORT int + zsys_dir_delete (const char *pathname, ...); + +// Move to a specified working directory. Returns 0 if OK, -1 if this failed. +CZMQ_EXPORT int + zsys_dir_change (const char *pathname); + +// Set private file creation mode; all files created from here will be +// readable/writable by the owner only. +CZMQ_EXPORT void + zsys_file_mode_private (void); + +// Reset default file creation mode; all files created from here will use +// process file mode defaults. +CZMQ_EXPORT void + zsys_file_mode_default (void); + +// Return the CZMQ version for run-time API detection; returns version +// number into provided fields, providing reference isn't null in each case. +CZMQ_EXPORT void + zsys_version (int *major, int *minor, int *patch); + +// Format a string using printf formatting, returning a freshly allocated +// buffer. If there was insufficient memory, returns NULL. Free the returned +// string using zstr_free(). +CZMQ_EXPORT char * + zsys_sprintf (const char *format, ...); + +// Format a string with a va_list argument, returning a freshly allocated +// buffer. If there was insufficient memory, returns NULL. Free the returned +// string using zstr_free(). +CZMQ_EXPORT char * + zsys_vprintf (const char *format, va_list argptr); + +// Create UDP beacon socket; if the routable option is true, uses +// multicast (not yet implemented), else uses broadcast. This method +// and related ones might _eventually_ be moved to a zudp class. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT SOCKET + zsys_udp_new (bool routable); + +// Close a UDP socket +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_udp_close (SOCKET handle); + +// Send zframe to UDP socket, return -1 if sending failed due to +// interface having disappeared (happens easily with WiFi) +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT int + zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); + +// Receive zframe from UDP socket, and set address of peer that sent it +// The peername must be a char [INET_ADDRSTRLEN] array. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT zframe_t * + zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); + +// Handle an I/O error on some socket operation; will report and die on +// fatal errors, and continue silently on "try again" errors. +// *** This is for CZMQ internal use only and may change arbitrarily *** +CZMQ_EXPORT void + zsys_socket_error (const char *reason); + +// Return current host name, for use in public tcp:// endpoints. Caller gets +// a freshly allocated string, should free it using zstr_free(). If the host +// name is not resolvable, returns NULL. +CZMQ_EXPORT char * + zsys_hostname (void); + +// Move the current process into the background. The precise effect depends +// on the operating system. On POSIX boxes, moves to a specified working +// directory (if specified), closes all file handles, reopens stdin, stdout, +// and stderr to the null device, and sets the process to ignore SIGHUP. On +// Windows, does nothing. Returns 0 if OK, -1 if there was an error. +CZMQ_EXPORT int + zsys_daemonize (const char *workdir); + +// Drop the process ID into the lockfile, with exclusive lock, and switch +// the process to the specified group and/or user. Any of the arguments +// may be null, indicating a no-op. Returns 0 on success, -1 on failure. +// Note if you combine this with zsys_daemonize, run after, not before +// that method, or the lockfile will hold the wrong process ID. +CZMQ_EXPORT int + zsys_run_as (const char *lockfile, const char *group, const char *user); + +// Returns true if the underlying libzmq supports CURVE security. +// Uses a heuristic probe according to the version of libzmq being used. +CZMQ_EXPORT bool + zsys_has_curve (void); + +// Configure the number of I/O threads that ZeroMQ will use. A good +// rule of thumb is one thread per gigabit of traffic in or out. The +// default is 1, sufficient for most applications. If the environment +// variable ZSYS_IO_THREADS is defined, that provides the default. +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zsys_set_io_threads (size_t io_threads); + +// Configure the number of sockets that ZeroMQ will allow. The default +// is 1024. The actual limit depends on the system, and you can query it +// by using zsys_socket_limit (). A value of zero means "maximum". +// Note that this method is valid only before any socket is created. +CZMQ_EXPORT void + zsys_set_max_sockets (size_t max_sockets); + +// Return maximum number of ZeroMQ sockets that the system will support. +CZMQ_EXPORT size_t + zsys_socket_limit (void); + +// Configure the default linger timeout in msecs for new zsock instances. +// You can also set this separately on each zsock_t instance. The default +// linger time is zero, i.e. any pending messages will be dropped. If the +// environment variable ZSYS_LINGER is defined, that provides the default. +// Note that process exit will typically be delayed by the linger time. +CZMQ_EXPORT void + zsys_set_linger (size_t linger); + +// Configure the default outgoing pipe limit (HWM) for new zsock instances. +// You can also set this separately on each zsock_t instance. The default +// HWM is 1,000, on all versions of ZeroMQ. If the environment variable +// ZSYS_SNDHWM is defined, that provides the default. Note that a value of +// zero means no limit, i.e. infinite memory consumption. +CZMQ_EXPORT void + zsys_set_sndhwm (size_t sndhwm); + +// Configure the default incoming pipe limit (HWM) for new zsock instances. +// You can also set this separately on each zsock_t instance. The default +// HWM is 1,000, on all versions of ZeroMQ. If the environment variable +// ZSYS_RCVHWM is defined, that provides the default. Note that a value of +// zero means no limit, i.e. infinite memory consumption. +CZMQ_EXPORT void + zsys_set_rcvhwm (size_t rcvhwm); + +// Configure the default HWM for zactor internal pipes; this is set on both +// ends of the pipe, for outgoing messages only (sndhwm). The default HWM is +// 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is +// defined, that provides the default. Note that a value of zero means no +// limit, i.e. infinite memory consumption. +CZMQ_EXPORT void + zsys_set_pipehwm (size_t pipehwm); + +// Return the HWM for zactor internal pipes. +CZMQ_EXPORT size_t + zsys_pipehwm (void); + +// Configure use of IPv6 for new zsock instances. By default sockets accept +// and make only IPv4 connections. When you enable IPv6, sockets will accept +// and connect to both IPv4 and IPv6 peers. You can override the setting on +// each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the +// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the +// default. Note: has no effect on ZMQ v2. +CZMQ_EXPORT void + zsys_set_ipv6 (int ipv6); + +// Return use of IPv6 for zsock instances. +CZMQ_EXPORT int + zsys_ipv6 (void); + +// Set network interface name to use for broadcasts, particularly zbeacon. +// This lets the interface be configured for test environments where required. +// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is +// the default when there is no specified interface. If the environment +// variable ZSYS_INTERFACE is set, use that as the default interface name. +// Setting the interface to "*" means "use all available interfaces". +CZMQ_EXPORT void + zsys_set_interface (const char *value); + +// Return network interface to use for broadcasts, or "" if none was set. +CZMQ_EXPORT const char * + zsys_interface (void); + +// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. +// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses +// on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, +// use that as the default IPv6 address. +CZMQ_EXPORT void + zsys_set_ipv6_address (const char *value); + +// Return IPv6 address to use for zbeacon reception, or "" if none was set. +CZMQ_EXPORT const char * + zsys_ipv6_address (void); + +// Set IPv6 milticast address to use for sending zbeacon messages. This needs +// to be set if IPv6 is enabled. If the environment variable +// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast +// address. +CZMQ_EXPORT void + zsys_set_ipv6_mcast_address (const char *value); + +// Return IPv6 multicast address to use for sending zbeacon, or "" if none was +// set. +CZMQ_EXPORT const char * + zsys_ipv6_mcast_address (void); + +// Configure the automatic use of pre-allocated FDs when creating new sockets. +// If 0 (default), nothing will happen. Else, when a new socket is bound, the +// system API will be used to check if an existing pre-allocated FD with a +// matching port (if TCP) or path (if IPC) exists, and if it does it will be +// set via the ZMQ_USE_FD socket option so that the library will use it +// instead of creating a new socket. +CZMQ_EXPORT void + zsys_set_auto_use_fd (int auto_use_fd); + +// Return use of automatic pre-allocated FDs for zsock instances. +CZMQ_EXPORT int + zsys_auto_use_fd (void); + +// Set log identity, which is a string that prefixes all log messages sent +// by this process. The log identity defaults to the environment variable +// ZSYS_LOGIDENT, if that is set. +CZMQ_EXPORT void + zsys_set_logident (const char *value); + +// Set stream to receive log traffic. By default, log traffic is sent to +// stdout. If you set the stream to NULL, no stream will receive the log +// traffic (it may still be sent to the system facility). +CZMQ_EXPORT void + zsys_set_logstream (FILE *stream); + +// Sends log output to a PUB socket bound to the specified endpoint. To +// collect such log output, create a SUB socket, subscribe to the traffic +// you care about, and connect to the endpoint. Log traffic is sent as a +// single string frame, in the same format as when sent to stdout. The +// log system supports a single sender; multiple calls to this method will +// bind the same sender to multiple endpoints. To disable the sender, call +// this method with a null argument. +CZMQ_EXPORT void + zsys_set_logsender (const char *endpoint); + +// Enable or disable logging to the system facility (syslog on POSIX boxes, +// event log on Windows). By default this is disabled. +CZMQ_EXPORT void + zsys_set_logsystem (bool logsystem); + +// Log error condition - highest priority +CZMQ_EXPORT void + zsys_error (const char *format, ...); + +// Log warning condition - high priority +CZMQ_EXPORT void + zsys_warning (const char *format, ...); + +// Log normal, but significant, condition - normal priority +CZMQ_EXPORT void + zsys_notice (const char *format, ...); + +// Log informational message - low priority +CZMQ_EXPORT void + zsys_info (const char *format, ...); + +// Log debug-level message - lowest priority +CZMQ_EXPORT void + zsys_debug (const char *format, ...); + +// Self test of this class +CZMQ_EXPORT void + zsys_test (bool verbose); + +// Global signal indicator, TRUE when user presses Ctrl-C or the process +// gets a SIGTERM signal. +CZMQ_EXPORT extern volatile int zsys_interrupted; +// Deprecated name for this variable +CZMQ_EXPORT extern volatile int zctx_interrupted; +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zthread.h b/phonelibs/zmq/arm/include/zthread.h new file mode 100644 index 00000000000000..fc0602dd9ff483 --- /dev/null +++ b/phonelibs/zmq/arm/include/zthread.h @@ -0,0 +1,50 @@ +/* ========================================================================= + zthread - working with system threads (deprecated) + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZTHREAD_H_INCLUDED__ +#define __ZTHREAD_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// @interface +// Detached threads follow POSIX pthreads API +typedef void *(zthread_detached_fn) (void *args); + +// Attached threads get context and pipe from parent +typedef void (zthread_attached_fn) (void *args, zctx_t *ctx, void *pipe); + +// Create a detached thread. A detached thread operates autonomously +// and is used to simulate a separate process. It gets no ctx, and no +// pipe. +CZMQ_EXPORT int + zthread_new (zthread_detached_fn *thread_fn, void *args); + +// Create an attached thread. An attached thread gets a ctx and a PAIR +// pipe back to its parent. It must monitor its pipe, and exit if the +// pipe becomes unreadable. Do not destroy the ctx, the thread does this +// automatically when it ends. +CZMQ_EXPORT void * + zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args); + +// Self test of this class +CZMQ_EXPORT void + zthread_test (bool verbose); +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/ztimerset.h b/phonelibs/zmq/arm/include/ztimerset.h new file mode 100644 index 00000000000000..29633fafdbdd30 --- /dev/null +++ b/phonelibs/zmq/arm/include/ztimerset.h @@ -0,0 +1,90 @@ +/* ========================================================================= + ztimerset - timer set + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef ZTIMERSET_H_INCLUDED +#define ZTIMERSET_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/ztimerset.api" to make changes. +// @interface +// This is a draft class, and may change without notice. It is disabled in +// stable builds by default. If you use this in applications, please ask +// for it to be pushed to stable state. Use --enable-drafts to enable. +#ifdef CZMQ_BUILD_DRAFT_API +// Callback function for timer event. +typedef void (ztimerset_fn) ( + int timer_id, void *arg); + +// *** Draft method, for development use, may change without warning *** +// Create new timer set. +CZMQ_EXPORT ztimerset_t * + ztimerset_new (void); + +// *** Draft method, for development use, may change without warning *** +// Destroy a timer set +CZMQ_EXPORT void + ztimerset_destroy (ztimerset_t **self_p); + +// *** Draft method, for development use, may change without warning *** +// Add a timer to the set. Returns timer id if OK, -1 on failure. +CZMQ_EXPORT int + ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); + +// *** Draft method, for development use, may change without warning *** +// Cancel a timer. Returns 0 if OK, -1 on failure. +CZMQ_EXPORT int + ztimerset_cancel (ztimerset_t *self, int timer_id); + +// *** Draft method, for development use, may change without warning *** +// Set timer interval. Returns 0 if OK, -1 on failure. +// This method is slow, canceling the timer and adding a new one yield better performance. +CZMQ_EXPORT int + ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); + +// *** Draft method, for development use, may change without warning *** +// Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. +// This method is slow, canceling the timer and adding a new one yield better performance. +CZMQ_EXPORT int + ztimerset_reset (ztimerset_t *self, int timer_id); + +// *** Draft method, for development use, may change without warning *** +// Return the time until the next interval. +// Should be used as timeout parameter for the zpoller wait method. +// The timeout is in msec. +CZMQ_EXPORT int + ztimerset_timeout (ztimerset_t *self); + +// *** Draft method, for development use, may change without warning *** +// Invoke callback function of all timers which their interval has elapsed. +// Should be call after zpoller wait method. +// Returns 0 if OK, -1 on failure. +CZMQ_EXPORT int + ztimerset_execute (ztimerset_t *self); + +// *** Draft method, for development use, may change without warning *** +// Self test of this class. +CZMQ_EXPORT void + ztimerset_test (bool verbose); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/ztrie.h b/phonelibs/zmq/arm/include/ztrie.h new file mode 100644 index 00000000000000..6fd53234b1274c --- /dev/null +++ b/phonelibs/zmq/arm/include/ztrie.h @@ -0,0 +1,106 @@ +/* ========================================================================= + ztrie - simple trie for tokenizable strings + + Copyright (c) 1991-2012 iMatix Corporation -- http://www.imatix.com + Copyright other contributors as noted in the AUTHORS file. + + This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef ZTRIE_H_INCLUDED +#define ZTRIE_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/ztrie.api" to make changes. +// @interface +// This is a draft class, and may change without notice. It is disabled in +// stable builds by default. If you use this in applications, please ask +// for it to be pushed to stable state. Use --enable-drafts to enable. +#ifdef CZMQ_BUILD_DRAFT_API +// Callback function for ztrie_node to destroy node data. +typedef void (ztrie_destroy_data_fn) ( + void **data); + +// *** Draft method, for development use, may change without warning *** +// Creates a new ztrie. +CZMQ_EXPORT ztrie_t * + ztrie_new (char delimiter); + +// *** Draft method, for development use, may change without warning *** +// Destroy the ztrie. +CZMQ_EXPORT void + ztrie_destroy (ztrie_t **self_p); + +// *** Draft method, for development use, may change without warning *** +// Inserts a new route into the tree and attaches the data. Returns -1 +// if the route already exists, otherwise 0. This method takes ownership of +// the provided data if a destroy_data_fn is provided. +CZMQ_EXPORT int + ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); + +// *** Draft method, for development use, may change without warning *** +// Removes a route from the trie and destroys its data. Returns -1 if the +// route does not exists, otherwise 0. +// the start of the list call zlist_first (). Advances the cursor. +CZMQ_EXPORT int + ztrie_remove_route (ztrie_t *self, const char *path); + +// *** Draft method, for development use, may change without warning *** +// Returns true if the path matches a route in the tree, otherwise false. +CZMQ_EXPORT bool + ztrie_matches (ztrie_t *self, const char *path); + +// *** Draft method, for development use, may change without warning *** +// Returns the data of a matched route from last ztrie_matches. If the path +// did not match, returns NULL. Do not delete the data as it's owned by +// ztrie. +CZMQ_EXPORT void * + ztrie_hit_data (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Returns the count of parameters that a matched route has. +CZMQ_EXPORT size_t + ztrie_hit_parameter_count (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Returns the parameters of a matched route with named regexes from last +// ztrie_matches. If the path did not match or the route did not contain any +// named regexes, returns NULL. +CZMQ_EXPORT zhashx_t * + ztrie_hit_parameters (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Returns the asterisk matched part of a route, if there has been no match +// or no asterisk match, returns NULL. +CZMQ_EXPORT const char * + ztrie_hit_asterisk_match (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Print the trie +CZMQ_EXPORT void + ztrie_print (ztrie_t *self); + +// *** Draft method, for development use, may change without warning *** +// Self test of this class. +CZMQ_EXPORT void + ztrie_test (bool verbose); + +#endif // CZMQ_BUILD_DRAFT_API +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/include/zuuid.h b/phonelibs/zmq/arm/include/zuuid.h new file mode 100644 index 00000000000000..afc1104fea952b --- /dev/null +++ b/phonelibs/zmq/arm/include/zuuid.h @@ -0,0 +1,96 @@ +/* ========================================================================= + zuuid - UUID support class + + Copyright (c) the Contributors as noted in the AUTHORS file. + This file is part of CZMQ, the high-level C binding for 0MQ: + http://czmq.zeromq.org. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + ========================================================================= +*/ + +#ifndef __ZUUID_H_INCLUDED__ +#define __ZUUID_H_INCLUDED__ + +#define ZUUID_LEN 16 +#define ZUUID_STR_LEN (ZUUID_LEN * 2) + +#ifdef __cplusplus +extern "C" { +#endif + +// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT +// @warning Please edit the model at "api/zuuid.api" to make changes. +// @interface +// This is a stable class, and may not change except for emergencies. It +// is provided in stable builds. +// Create a new UUID object. +CZMQ_EXPORT zuuid_t * + zuuid_new (void); + +// Create UUID object from supplied ZUUID_LEN-octet value. +CZMQ_EXPORT zuuid_t * + zuuid_new_from (const byte *source); + +// Destroy a specified UUID object. +CZMQ_EXPORT void + zuuid_destroy (zuuid_t **self_p); + +// Set UUID to new supplied ZUUID_LEN-octet value. +CZMQ_EXPORT void + zuuid_set (zuuid_t *self, const byte *source); + +// Set UUID to new supplied string value skipping '-' and '{' '}' +// optional delimiters. Return 0 if OK, else returns -1. +CZMQ_EXPORT int + zuuid_set_str (zuuid_t *self, const char *source); + +// Return UUID binary data. +CZMQ_EXPORT const byte * + zuuid_data (zuuid_t *self); + +// Return UUID binary size +CZMQ_EXPORT size_t + zuuid_size (zuuid_t *self); + +// Returns UUID as string +CZMQ_EXPORT const char * + zuuid_str (zuuid_t *self); + +// Return UUID in the canonical string format: 8-4-4-4-12, in lower +// case. Caller does not modify or free returned value. See +// http://en.wikipedia.org/wiki/Universally_unique_identifier +CZMQ_EXPORT const char * + zuuid_str_canonical (zuuid_t *self); + +// Store UUID blob in target array +CZMQ_EXPORT void + zuuid_export (zuuid_t *self, byte *target); + +// Check if UUID is same as supplied value +CZMQ_EXPORT bool + zuuid_eq (zuuid_t *self, const byte *compare); + +// Check if UUID is different from supplied value +CZMQ_EXPORT bool + zuuid_neq (zuuid_t *self, const byte *compare); + +// Make copy of UUID object; if uuid is null, or memory was exhausted, +// returns null. +CZMQ_EXPORT zuuid_t * + zuuid_dup (zuuid_t *self); + +// Self test of this class. +CZMQ_EXPORT void + zuuid_test (bool verbose); + +// @end + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/phonelibs/zmq/arm/lib/libczmq.a b/phonelibs/zmq/arm/lib/libczmq.a new file mode 100644 index 00000000000000..cb78e4b8296463 Binary files /dev/null and b/phonelibs/zmq/arm/lib/libczmq.a differ diff --git a/phonelibs/zmq/arm/lib/libczmq.so b/phonelibs/zmq/arm/lib/libczmq.so new file mode 100755 index 00000000000000..87ee937f72ae09 Binary files /dev/null and b/phonelibs/zmq/arm/lib/libczmq.so differ diff --git a/phonelibs/zmq/arm/lib/libzmq.a b/phonelibs/zmq/arm/lib/libzmq.a new file mode 100644 index 00000000000000..cd523cd73e6ab5 Binary files /dev/null and b/phonelibs/zmq/arm/lib/libzmq.a differ diff --git a/phonelibs/zmq/arm/lib/libzmq.so b/phonelibs/zmq/arm/lib/libzmq.so new file mode 100755 index 00000000000000..27ec72d7bc815e Binary files /dev/null and b/phonelibs/zmq/arm/lib/libzmq.so differ diff --git a/phonelibs/zmq/build.sh b/phonelibs/zmq/build.sh new file mode 100755 index 00000000000000..8c4d9a50f1f4af --- /dev/null +++ b/phonelibs/zmq/build.sh @@ -0,0 +1,60 @@ +#!/bin/sh +set -e + +# aarch64 is actually built natively and copied in... + +SED=gsed + +git clone --depth 1 -b v4.2.2 git://github.com/zeromq/libzmq.git libzmq +git clone --depth 1 -b v4.0.2 git://github.com/zeromq/czmq.git czmq + +$SED -i 's/defined .HAVE_GETIFADDRS./0/' czmq/src/ziflist.c + +LIBZMQ_ROOT=$HOME/one/phonelibs/zmq/libzmq + +export ANDROID_NDK_ROOT=/opt/android-ndk + +export ANDROID_BUILD_EXTRA_CFLAGS='-std=gnu99 -O2' +export ANDROID_BUILD_EXTRA_CXXFLAGS='-O2' + +######## arm + +export TOOLCHAIN_PATH=${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin +export TOOLCHAIN_NAME=arm-linux-androideabi-4.9 +export TOOLCHAIN_HOST=arm-linux-androideabi +export TOOLCHAIN_ARCH=arm +cd czmq/builds/android +./build.sh +cd ../../../ +cp czmq/builds/android/prefix/arm-linux-androideabi-4.9/lib/libczmq.a \ + czmq/builds/android/prefix/arm-linux-androideabi-4.9/lib/libczmq.so \ + czmq/builds/android/prefix/arm-linux-androideabi-4.9/lib/libzmq.a \ + czmq/builds/android/prefix/arm-linux-androideabi-4.9/lib/libzmq.so ./arm/lib/ +cp czmq/builds/android/prefix/arm-linux-androideabi-4.9/include/*.h ./arm/include/ + + +######## aarch64 + +(cd libzmq && patch -p0 <../build_aarch64.patch) +(cd czmq && patch -p0 <../build_aarch64.patch) + +# android-9 lacks aarch64. +$SED -i 's/android-9/android-24/' *zmq/builds/android/android_build_helper.sh +# For some reason gcc doesn't work for aarch64, but g++ does. +$SED -i 's/-lgnustl_shared/-l:libgnustl_static.a/' *zmq/builds/android/android_build_helper.sh + +export TOOLCHAIN_PATH=${ANDROID_NDK_ROOT}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin +export TOOLCHAIN_NAME=aarch64-linux-android-4.9 +export TOOLCHAIN_HOST=aarch64-linux-android +export TOOLCHAIN_ARCH=arm64 +cd czmq/builds/android +./build.sh +cd ../../../ +cp czmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libczmq.a \ + czmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libczmq.so \ + czmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libzmq.a \ + czmq/builds/android/prefix/aarch64-linux-android-4.9/lib/libzmq.so ./aarch64/lib/ +cp czmq/builds/android/prefix/aarch64-linux-android-4.9/include/*.h ./aarch64/include/ + +# rm -rf czmq +echo SUCCESS diff --git a/phonelibs/zmq/build_aarch64.patch b/phonelibs/zmq/build_aarch64.patch new file mode 100644 index 00000000000000..d689b99c51a4c6 --- /dev/null +++ b/phonelibs/zmq/build_aarch64.patch @@ -0,0 +1,15 @@ +diff --git builds/android/android_build_helper.sh builds/android/android_build_helper.sh +index 6263f70..d0b24c3 100755 +--- builds/android/android_build_helper.sh ++++ builds/android/android_build_helper.sh +@@ -202,6 +202,10 @@ function _android_build_opts_process_cxx_stl { + LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips" + CPPFLAGS+=" -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips/include" + ;; ++ arm64) ++ LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a" ++ CPPFLAGS+=" -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include" ++ ;; + *) + ANDROID_BUILD_FAIL+=("Unknown combination for ANDROID_BUILD_CXXSTL and TOOLCHAIN_ARCH") + ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_CXXSTL}") diff --git a/phonelibs/zmq/build_linux.txt b/phonelibs/zmq/build_linux.txt new file mode 100644 index 00000000000000..54e3b2a340f33b --- /dev/null +++ b/phonelibs/zmq/build_linux.txt @@ -0,0 +1,7 @@ +https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz +./configure --prefix="this_thingy" +make -j4 +make install + +czmq +see ~/one/external/zmq/build_czmq.sh diff --git a/phonelibs/zmq/mac/lib/libczmq.a b/phonelibs/zmq/mac/lib/libczmq.a new file mode 100644 index 00000000000000..061f2afabd4937 Binary files /dev/null and b/phonelibs/zmq/mac/lib/libczmq.a differ diff --git a/phonelibs/zmq/mac/lib/libczmq.dylib b/phonelibs/zmq/mac/lib/libczmq.dylib new file mode 100644 index 00000000000000..50d2167e9cb8ec Binary files /dev/null and b/phonelibs/zmq/mac/lib/libczmq.dylib differ diff --git a/phonelibs/zmq/mac/lib/libzmq.a b/phonelibs/zmq/mac/lib/libzmq.a new file mode 100644 index 00000000000000..3365d42e87733d Binary files /dev/null and b/phonelibs/zmq/mac/lib/libzmq.a differ diff --git a/phonelibs/zmq/mac/lib/libzmq.dylib b/phonelibs/zmq/mac/lib/libzmq.dylib new file mode 100755 index 00000000000000..19b751496071c6 Binary files /dev/null and b/phonelibs/zmq/mac/lib/libzmq.dylib differ diff --git a/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/PKG-INFO b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/PKG-INFO new file mode 100644 index 00000000000000..035a98f8ce0f24 --- /dev/null +++ b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/PKG-INFO @@ -0,0 +1,89 @@ +Metadata-Version: 1.1 +Name: backports.ssl-match-hostname +Version: 3.7.0.1 +Summary: The ssl.match_hostname() function from Python 3.5 +Home-page: http://bitbucket.org/brandon/backports.ssl_match_hostname +Author: Toshio Kuratomi +Author-email: toshio@fedoraproject.org +License: Python Software Foundation License +Description: + The ssl.match_hostname() function from Python 3.7 + ================================================= + + The Secure Sockets Layer is only actually *secure* + if you check the hostname in the certificate returned + by the server to which you are connecting, + and verify that it matches to hostname + that you are trying to reach. + + But the matching logic, defined in `RFC2818`_, + can be a bit tricky to implement on your own. + So the ``ssl`` package in the Standard Library of Python 3.2 + and greater now includes a ``match_hostname()`` function + for performing this check instead of requiring every application + to implement the check separately. + + This backport brings ``match_hostname()`` to users + of earlier versions of Python. + Simply make this distribution a dependency of your package, + and then use it like this:: + + from backports.ssl_match_hostname import match_hostname, CertificateError + [...] + sslsock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_SSLv23, + cert_reqs=ssl.CERT_REQUIRED, ca_certs=...) + try: + match_hostname(sslsock.getpeercert(), hostname) + except CertificateError, ce: + ... + + Brandon Craig Rhodes is merely the packager of this distribution; + the actual code inside comes from Python 3.7 with small changes for + portability. + + + Requirements + ------------ + + * If you need to use this on Python versions earlier than 2.6 you will need to + install the `ssl module`_. From Python 2.6 upwards ``ssl`` is included in + the Python Standard Library so you do not need to install it separately. + + .. _`ssl module`:: https://pypi.python.org/pypi/ssl + + History + ------- + + * This function was introduced in python-3.2 + * It was updated for python-3.4a1 for a CVE + (backports-ssl_match_hostname-3.4.0.1) + * It was updated from RFC2818 to RFC 6125 compliance in order to fix another + security flaw for python-3.3.3 and python-3.4a5 + (backports-ssl_match_hostname-3.4.0.2) + * It was updated in python-3.5 to handle IPAddresses in ServerAltName fields + (something that backports.ssl_match_hostname will do if you also install the + ipaddress library from pypi). + * It was updated in python-3.7 to handle IPAddresses without the ipaddress library and dropped + support for partial wildcards + + .. _`ipaddress module`:: https://pypi.python.org/pypi/ipaddress + + .. _RFC2818: http://tools.ietf.org/html/rfc2818.html + +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: License :: OSI Approved :: Python Software Foundation License +Classifier: Programming Language :: Python :: 2.4 +Classifier: Programming Language :: Python :: 2.5 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.0 +Classifier: Programming Language :: Python :: 3.1 +Classifier: Programming Language :: Python :: 3.2 +Classifier: Programming Language :: Python :: 3.3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Topic :: Security :: Cryptography diff --git a/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/SOURCES.txt b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/SOURCES.txt new file mode 100644 index 00000000000000..95b96160996935 --- /dev/null +++ b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/SOURCES.txt @@ -0,0 +1,8 @@ +README.txt +setup.cfg +backports/__init__.py +backports.ssl_match_hostname.egg-info/PKG-INFO +backports.ssl_match_hostname.egg-info/SOURCES.txt +backports.ssl_match_hostname.egg-info/dependency_links.txt +backports.ssl_match_hostname.egg-info/top_level.txt +backports/ssl_match_hostname/__init__.py \ No newline at end of file diff --git a/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/dependency_links.txt b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/dependency_links.txt new file mode 100644 index 00000000000000..8b137891791fe9 --- /dev/null +++ b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/installed-files.txt b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/installed-files.txt new file mode 100644 index 00000000000000..fd1aae3671ef18 --- /dev/null +++ b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/installed-files.txt @@ -0,0 +1,8 @@ +../backports/__init__.py +../backports/__init__.pyc +../backports/ssl_match_hostname/__init__.py +../backports/ssl_match_hostname/__init__.pyc +PKG-INFO +SOURCES.txt +dependency_links.txt +top_level.txt diff --git a/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/top_level.txt b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/top_level.txt new file mode 100644 index 00000000000000..99d2be5b64d7dc --- /dev/null +++ b/pyextra/backports.ssl_match_hostname-3.7.0.1-py2.7.egg-info/top_level.txt @@ -0,0 +1 @@ +backports diff --git a/pyextra/backports/__init__.py b/pyextra/backports/__init__.py new file mode 100644 index 00000000000000..612d32836bb638 --- /dev/null +++ b/pyextra/backports/__init__.py @@ -0,0 +1,3 @@ +# This is a Python "namespace package" http://www.python.org/dev/peps/pep-0382/ +from pkgutil import extend_path +__path__ = extend_path(__path__, __name__) diff --git a/pyextra/backports/ssl_match_hostname/__init__.py b/pyextra/backports/ssl_match_hostname/__init__.py new file mode 100644 index 00000000000000..cdfef013dec186 --- /dev/null +++ b/pyextra/backports/ssl_match_hostname/__init__.py @@ -0,0 +1,204 @@ +"""The match_hostname() function from Python 3.7.0, essential when using SSL.""" + +import sys +import socket as _socket + +try: + # Divergence: Python-3.7+'s _ssl has this exception type but older Pythons do not + from _ssl import SSLCertVerificationError + CertificateError = SSLCertVerificationError +except: + class CertificateError(ValueError): + pass + + +__version__ = '3.7.0.1' + + +# Divergence: Added to deal with ipaddess as bytes on python2 +def _to_text(obj): + if isinstance(obj, str) and sys.version_info < (3,): + obj = unicode(obj, encoding='ascii', errors='strict') + elif sys.version_info >= (3,) and isinstance(obj, bytes): + obj = str(obj, encoding='ascii', errors='strict') + return obj + + +def _to_bytes(obj): + if isinstance(obj, str) and sys.version_info >= (3,): + obj = bytes(obj, encoding='ascii', errors='strict') + elif sys.version_info < (3,) and isinstance(obj, unicode): + obj = obj.encode('ascii', 'strict') + return obj + + +def _dnsname_match(dn, hostname): + """Matching according to RFC 6125, section 6.4.3 + + - Hostnames are compared lower case. + - For IDNA, both dn and hostname must be encoded as IDN A-label (ACE). + - Partial wildcards like 'www*.example.org', multiple wildcards, sole + wildcard or wildcards in labels other then the left-most label are not + supported and a CertificateError is raised. + - A wildcard must match at least one character. + """ + if not dn: + return False + + wildcards = dn.count('*') + # speed up common case w/o wildcards + if not wildcards: + return dn.lower() == hostname.lower() + + if wildcards > 1: + # Divergence .format() to percent formatting for Python < 2.6 + raise CertificateError( + "too many wildcards in certificate DNS name: %s" % repr(dn)) + + dn_leftmost, sep, dn_remainder = dn.partition('.') + + if '*' in dn_remainder: + # Only match wildcard in leftmost segment. + # Divergence .format() to percent formatting for Python < 2.6 + raise CertificateError( + "wildcard can only be present in the leftmost label: " + "%s." % repr(dn)) + + if not sep: + # no right side + # Divergence .format() to percent formatting for Python < 2.6 + raise CertificateError( + "sole wildcard without additional labels are not support: " + "%s." % repr(dn)) + + if dn_leftmost != '*': + # no partial wildcard matching + # Divergence .format() to percent formatting for Python < 2.6 + raise CertificateError( + "partial wildcards in leftmost label are not supported: " + "%s." % repr(dn)) + + hostname_leftmost, sep, hostname_remainder = hostname.partition('.') + if not hostname_leftmost or not sep: + # wildcard must match at least one char + return False + return dn_remainder.lower() == hostname_remainder.lower() + + +def _inet_paton(ipname): + """Try to convert an IP address to packed binary form + + Supports IPv4 addresses on all platforms and IPv6 on platforms with IPv6 + support. + """ + # inet_aton() also accepts strings like '1' + # Divergence: We make sure we have native string type for all python versions + try: + b_ipname = _to_bytes(ipname) + except UnicodeError: + raise ValueError("%s must be an all-ascii string." % repr(ipname)) + + # Set ipname in native string format + if sys.version_info < (3,): + n_ipname = b_ipname + else: + n_ipname = ipname + + if n_ipname.count('.') == 3: + try: + return _socket.inet_aton(n_ipname) + # Divergence: OSError on late python3. socket.error earlier. + # Null bytes generate ValueError on python3(we want to raise + # ValueError anyway), TypeError # earlier + except (OSError, _socket.error, TypeError): + pass + + try: + return _socket.inet_pton(_socket.AF_INET6, n_ipname) + # Divergence: OSError on late python3. socket.error earlier. + # Null bytes generate ValueError on python3(we want to raise + # ValueError anyway), TypeError # earlier + except (OSError, _socket.error, TypeError): + # Divergence .format() to percent formatting for Python < 2.6 + raise ValueError("%s is neither an IPv4 nor an IP6 " + "address." % repr(ipname)) + except AttributeError: + # AF_INET6 not available + pass + + # Divergence .format() to percent formatting for Python < 2.6 + raise ValueError("%s is not an IPv4 address." % repr(ipname)) + + +def _ipaddress_match(ipname, host_ip): + """Exact matching of IP addresses. + + RFC 6125 explicitly doesn't define an algorithm for this + (section 1.7.2 - "Out of Scope"). + """ + # OpenSSL may add a trailing newline to a subjectAltName's IP address + ip = _inet_paton(ipname.rstrip()) + return ip == host_ip + + +def match_hostname(cert, hostname): + """Verify that *cert* (in decoded format as returned by + SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 + rules are followed. + + The function matches IP addresses rather than dNSNames if hostname is a + valid ipaddress string. IPv4 addresses are supported on all platforms. + IPv6 addresses are supported on platforms with IPv6 support (AF_INET6 + and inet_pton). + + CertificateError is raised on failure. On success, the function + returns nothing. + """ + if not cert: + raise ValueError("empty or no certificate, match_hostname needs a " + "SSL socket or SSL context with either " + "CERT_OPTIONAL or CERT_REQUIRED") + try: + # Divergence: Deal with hostname as bytes + host_ip = _inet_paton(_to_text(hostname)) + except ValueError: + # Not an IP address (common case) + host_ip = None + except UnicodeError: + # Divergence: Deal with hostname as byte strings. + # IP addresses should be all ascii, so we consider it not + # an IP address if this fails + host_ip = None + dnsnames = [] + san = cert.get('subjectAltName', ()) + for key, value in san: + if key == 'DNS': + if host_ip is None and _dnsname_match(value, hostname): + return + dnsnames.append(value) + elif key == 'IP Address': + if host_ip is not None and _ipaddress_match(value, host_ip): + return + dnsnames.append(value) + if not dnsnames: + # The subject is only checked when there is no dNSName entry + # in subjectAltName + for sub in cert.get('subject', ()): + for key, value in sub: + # XXX according to RFC 2818, the most specific Common Name + # must be used. + if key == 'commonName': + if _dnsname_match(value, hostname): + return + dnsnames.append(value) + if len(dnsnames) > 1: + raise CertificateError("hostname %r " + "doesn't match either of %s" + % (hostname, ', '.join(map(repr, dnsnames)))) + elif len(dnsnames) == 1: + raise CertificateError("hostname %r " + "doesn't match %r" + % (hostname, dnsnames[0])) + else: + raise CertificateError("no appropriate commonName or " + "subjectAltName fields were found") diff --git a/pyextra/bin/wsdump.py b/pyextra/bin/wsdump.py new file mode 100755 index 00000000000000..246d15050c34ed --- /dev/null +++ b/pyextra/bin/wsdump.py @@ -0,0 +1,201 @@ +#!/usr/local/bin/python + +import argparse +import code +import sys +import threading +import time +import ssl + +import six +from six.moves.urllib.parse import urlparse + +import websocket + +try: + import readline +except ImportError: + pass + + +def get_encoding(): + encoding = getattr(sys.stdin, "encoding", "") + if not encoding: + return "utf-8" + else: + return encoding.lower() + + +OPCODE_DATA = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY) +ENCODING = get_encoding() + + +class VAction(argparse.Action): + + def __call__(self, parser, args, values, option_string=None): + if values is None: + values = "1" + try: + values = int(values) + except ValueError: + values = values.count("v") + 1 + setattr(args, self.dest, values) + + +def parse_args(): + parser = argparse.ArgumentParser(description="WebSocket Simple Dump Tool") + parser.add_argument("url", metavar="ws_url", + help="websocket url. ex. ws://echo.websocket.org/") + parser.add_argument("-p", "--proxy", + help="proxy url. ex. http://127.0.0.1:8080") + parser.add_argument("-v", "--verbose", default=0, nargs='?', action=VAction, + dest="verbose", + help="set verbose mode. If set to 1, show opcode. " + "If set to 2, enable to trace websocket module") + parser.add_argument("-n", "--nocert", action='store_true', + help="Ignore invalid SSL cert") + parser.add_argument("-r", "--raw", action="store_true", + help="raw output") + parser.add_argument("-s", "--subprotocols", nargs='*', + help="Set subprotocols") + parser.add_argument("-o", "--origin", + help="Set origin") + parser.add_argument("--eof-wait", default=0, type=int, + help="wait time(second) after 'EOF' received.") + parser.add_argument("-t", "--text", + help="Send initial text") + parser.add_argument("--timings", action="store_true", + help="Print timings in seconds") + parser.add_argument("--headers", + help="Set custom headers. Use ',' as separator") + + return parser.parse_args() + + +class RawInput: + + def raw_input(self, prompt): + if six.PY3: + line = input(prompt) + else: + line = raw_input(prompt) + + if ENCODING and ENCODING != "utf-8" and not isinstance(line, six.text_type): + line = line.decode(ENCODING).encode("utf-8") + elif isinstance(line, six.text_type): + line = line.encode("utf-8") + + return line + + +class InteractiveConsole(RawInput, code.InteractiveConsole): + + def write(self, data): + sys.stdout.write("\033[2K\033[E") + # sys.stdout.write("\n") + sys.stdout.write("\033[34m< " + data + "\033[39m") + sys.stdout.write("\n> ") + sys.stdout.flush() + + def read(self): + return self.raw_input("> ") + + +class NonInteractive(RawInput): + + def write(self, data): + sys.stdout.write(data) + sys.stdout.write("\n") + sys.stdout.flush() + + def read(self): + return self.raw_input("") + + +def main(): + start_time = time.time() + args = parse_args() + if args.verbose > 1: + websocket.enableTrace(True) + options = {} + if args.proxy: + p = urlparse(args.proxy) + options["http_proxy_host"] = p.hostname + options["http_proxy_port"] = p.port + if args.origin: + options["origin"] = args.origin + if args.subprotocols: + options["subprotocols"] = args.subprotocols + opts = {} + if args.nocert: + opts = {"cert_reqs": ssl.CERT_NONE, "check_hostname": False} + if args.headers: + options['header'] = map(str.strip, args.headers.split(',')) + ws = websocket.create_connection(args.url, sslopt=opts, **options) + if args.raw: + console = NonInteractive() + else: + console = InteractiveConsole() + print("Press Ctrl+C to quit") + + def recv(): + try: + frame = ws.recv_frame() + except websocket.WebSocketException: + return websocket.ABNF.OPCODE_CLOSE, None + if not frame: + raise websocket.WebSocketException("Not a valid frame %s" % frame) + elif frame.opcode in OPCODE_DATA: + return frame.opcode, frame.data + elif frame.opcode == websocket.ABNF.OPCODE_CLOSE: + ws.send_close() + return frame.opcode, None + elif frame.opcode == websocket.ABNF.OPCODE_PING: + ws.pong(frame.data) + return frame.opcode, frame.data + + return frame.opcode, frame.data + + def recv_ws(): + while True: + opcode, data = recv() + msg = None + if six.PY3 and opcode == websocket.ABNF.OPCODE_TEXT and isinstance(data, bytes): + data = str(data, "utf-8") + if not args.verbose and opcode in OPCODE_DATA: + msg = data + elif args.verbose: + msg = "%s: %s" % (websocket.ABNF.OPCODE_MAP.get(opcode), data) + + if msg is not None: + if args.timings: + console.write(str(time.time() - start_time) + ": " + msg) + else: + console.write(msg) + + if opcode == websocket.ABNF.OPCODE_CLOSE: + break + + thread = threading.Thread(target=recv_ws) + thread.daemon = True + thread.start() + + if args.text: + ws.send(args.text) + + while True: + try: + message = console.read() + ws.send(message) + except KeyboardInterrupt: + return + except EOFError: + time.sleep(args.eof_wait) + return + + +if __name__ == "__main__": + try: + main() + except Exception as e: + print(e) diff --git a/pyextra/json_rpc-1.12.1-py2.7.egg-info/PKG-INFO b/pyextra/json_rpc-1.12.1-py2.7.egg-info/PKG-INFO new file mode 100644 index 00000000000000..c185d0b73ca4ff --- /dev/null +++ b/pyextra/json_rpc-1.12.1-py2.7.egg-info/PKG-INFO @@ -0,0 +1,187 @@ +Metadata-Version: 1.1 +Name: json-rpc +Version: 1.12.1 +Summary: JSON-RPC transport implementation +Home-page: https://github.com/pavlov99/json-rpc +Author: Kirill Pavlov +Author-email: k@p99.io +License: MIT +Description: json-rpc + ======== + + .. image:: https://circleci.com/gh/pavlov99/json-rpc/tree/master.svg?style=svg + :target: https://circleci.com/gh/pavlov99/json-rpc/tree/master + :alt: Build Status + + .. image:: https://codecov.io/gh/pavlov99/json-rpc/branch/master/graph/badge.svg + :target: https://codecov.io/gh/pavlov99/json-rpc + :alt: Coverage Status + + .. image:: https://readthedocs.org/projects/json-rpc/badge/?version=latest + :target: http://json-rpc.readthedocs.io/en/latest/?badge=latest + + .. image:: https://img.shields.io/pypi/v/json-rpc.svg + :target: https://pypi.org/project/json-rpc/ + :alt: Latest PyPI version + + .. image:: https://img.shields.io/pypi/pyversions/json-rpc.svg + :target: https://pypi.org/project/json-rpc/ + :alt: Supported Python versions + + .. image:: https://badges.gitter.im/pavlov99/json-rpc.svg + :target: https://gitter.im/pavlov99/json-rpc + :alt: Gitter + + + .. image:: https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=backer&color=brightgreen + :target: https://opencollective.com/json-rpc + :alt: Bakers + + .. image:: https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=sponsor&color=brightgreen + :target: https://opencollective.com/json-rpc + :alt: Sponsors + + `JSON-RPC2.0 `_ and `JSON-RPC1.0 `_ transport specification implementation. + Supports Python 2.6+, Python 3.3+, PyPy. Has optional Django and Flask support. 200+ tests. + + Features + -------- + + This implementation does not have any transport functionality realization, only protocol. + Any client or server implementation is easy based on current code, but requires transport libraries, such as requests, gevent or zmq, see `examples `_. + + - Vanilla Python, no dependencies. + - 200+ tests for multiple edge cases. + - Optional backend support for Django, Flask. + - json-rpc 1.1 and 2.0 support. + + Install + ------- + + .. code-block:: python + + pip install json-rpc + + Tests + ----- + + Quickstart + ^^^^^^^^^^ + This is an essential part of the library as there are a lot of edge cases in JSON-RPC standard. To manage a variety of supported python versions as well as optional backends json-rpc uses `tox`: + + .. code-block:: bash + + tox + + .. TIP:: + During local development use your python version with tox runner. For example, if your are using Python 3.6 run `tox -e py36`. It is easier to develop functionality for specific version first and then expands it to all of the supported versions. + + Continuous integration + ^^^^^^^^^^^^^^^^^^^^^^ + This project uses `CircleCI `_ for continuous integration. All of the python supported versions are managed via `tox.ini` and `.circleci/config.yml` files. Master branch test status is displayed on the badge in the beginning of this document. + + Test matrix + ^^^^^^^^^^^ + json-rpc supports multiple python versions: 2.6+, 3.3+, pypy. This introduces difficulties with testing libraries and optional dependencies management. For example, python before version 3.3 does not support `mock` and there is a limited support for `unittest2`. Every dependency translates into *if-then* blocks in the source code and adds complexity to it. Hence, while cross-python support is a core feature of this library, cross-Django or cross-Flask support is limited. In general, json-rpc uses latest stable release which supports current python version. For example, python 2.6 is compatible with Django 1.6 and not compatible with any future versions. + + Below is a testing matrix: + + +--------+-------+-----------+--------+--------+ + | Python | mock | unittest | Django | Flask | + +========+=======+===========+========+========+ + | 2.6 | 2.0.0 | unittest2 | 1.6 | 0.12.2 | + +--------+-------+-----------+--------+--------+ + | 2.7 | 2.0.0 | | 1.11 | 0.12.2 | + +--------+-------+-----------+--------+--------+ + | 3.3 | | | 1.11 | 0.12.2 | + +--------+-------+-----------+--------+--------+ + | 3.4 | | | 1.11 | 0.12.2 | + +--------+-------+-----------+--------+--------+ + | 3.5 | | | 1.11 | 0.12.2 | + +--------+-------+-----------+--------+--------+ + | 3.6 | | | 1.11 | 0.12.2 | + +--------+-------+-----------+--------+--------+ + | pypy | 2.0.0 | | 1.11 | 0.12.2 | + +--------+-------+-----------+--------+--------+ + | pypy3 | | | 1.11 | 0.12.2 | + +--------+-------+-----------+--------+--------+ + + Quickstart + ---------- + Server (uses `Werkzeug `_) + + .. code-block:: python + + from werkzeug.wrappers import Request, Response + from werkzeug.serving import run_simple + + from jsonrpc import JSONRPCResponseManager, dispatcher + + + @dispatcher.add_method + def foobar(**kwargs): + return kwargs["foo"] + kwargs["bar"] + + + @Request.application + def application(request): + # Dispatcher is dictionary {: callable} + dispatcher["echo"] = lambda s: s + dispatcher["add"] = lambda a, b: a + b + + response = JSONRPCResponseManager.handle( + request.data, dispatcher) + return Response(response.json, mimetype='application/json') + + + if __name__ == '__main__': + run_simple('localhost', 4000, application) + + Client (uses `requests `_) + + .. code-block:: python + + import requests + import json + + + def main(): + url = "http://localhost:4000/jsonrpc" + headers = {'content-type': 'application/json'} + + # Example echo method + payload = { + "method": "echo", + "params": ["echome!"], + "jsonrpc": "2.0", + "id": 0, + } + response = requests.post( + url, data=json.dumps(payload), headers=headers).json() + + assert response["result"] == "echome!" + assert response["jsonrpc"] + assert response["id"] == 0 + + if __name__ == "__main__": + main() + + Competitors + ----------- + There are `several libraries `_ implementing JSON-RPC protocol. List below represents python libraries, none of the supports python3. tinyrpc looks better than others. + +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: License :: OSI Approved :: MIT License +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3.3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Software Development :: Libraries :: Python Modules diff --git a/pyextra/json_rpc-1.12.1-py2.7.egg-info/SOURCES.txt b/pyextra/json_rpc-1.12.1-py2.7.egg-info/SOURCES.txt new file mode 100644 index 00000000000000..87d35af6230421 --- /dev/null +++ b/pyextra/json_rpc-1.12.1-py2.7.egg-info/SOURCES.txt @@ -0,0 +1,42 @@ +LICENSE.txt +MANIFEST.in +README.rst +get-pip.py +setup.cfg +setup.py +json_rpc.egg-info/PKG-INFO +json_rpc.egg-info/SOURCES.txt +json_rpc.egg-info/dependency_links.txt +json_rpc.egg-info/top_level.txt +jsonrpc/__init__.py +jsonrpc/base.py +jsonrpc/dispatcher.py +jsonrpc/exceptions.py +jsonrpc/jsonrpc.py +jsonrpc/jsonrpc1.py +jsonrpc/jsonrpc2.py +jsonrpc/manager.py +jsonrpc/six.py +jsonrpc/utils.py +jsonrpc/backend/__init__.py +jsonrpc/backend/django.py +jsonrpc/backend/flask.py +jsonrpc/tests/__init__.py +jsonrpc/tests/py35_utils.py +jsonrpc/tests/test_base.py +jsonrpc/tests/test_bug29.py +jsonrpc/tests/test_dispatcher.py +jsonrpc/tests/test_examples20.py +jsonrpc/tests/test_jsonrpc.py +jsonrpc/tests/test_jsonrpc1.py +jsonrpc/tests/test_jsonrpc2.py +jsonrpc/tests/test_jsonrpc_errors.py +jsonrpc/tests/test_manager.py +jsonrpc/tests/test_pep3107.py +jsonrpc/tests/test_utils.py +jsonrpc/tests/test_backend_django/__init__.py +jsonrpc/tests/test_backend_django/settings.py +jsonrpc/tests/test_backend_django/tests.py +jsonrpc/tests/test_backend_django/urls.py +jsonrpc/tests/test_backend_flask/__init__.py +jsonrpc/tests/test_backend_flask/tests.py \ No newline at end of file diff --git a/pyextra/json_rpc-1.12.1-py2.7.egg-info/dependency_links.txt b/pyextra/json_rpc-1.12.1-py2.7.egg-info/dependency_links.txt new file mode 100644 index 00000000000000..8b137891791fe9 --- /dev/null +++ b/pyextra/json_rpc-1.12.1-py2.7.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/pyextra/json_rpc-1.12.1-py2.7.egg-info/installed-files.txt b/pyextra/json_rpc-1.12.1-py2.7.egg-info/installed-files.txt new file mode 100644 index 00000000000000..e0a921633f32f6 --- /dev/null +++ b/pyextra/json_rpc-1.12.1-py2.7.egg-info/installed-files.txt @@ -0,0 +1,68 @@ +../jsonrpc/__init__.py +../jsonrpc/__init__.pyc +../jsonrpc/backend/__init__.py +../jsonrpc/backend/__init__.pyc +../jsonrpc/backend/django.py +../jsonrpc/backend/django.pyc +../jsonrpc/backend/flask.py +../jsonrpc/backend/flask.pyc +../jsonrpc/base.py +../jsonrpc/base.pyc +../jsonrpc/dispatcher.py +../jsonrpc/dispatcher.pyc +../jsonrpc/exceptions.py +../jsonrpc/exceptions.pyc +../jsonrpc/jsonrpc.py +../jsonrpc/jsonrpc.pyc +../jsonrpc/jsonrpc1.py +../jsonrpc/jsonrpc1.pyc +../jsonrpc/jsonrpc2.py +../jsonrpc/jsonrpc2.pyc +../jsonrpc/manager.py +../jsonrpc/manager.pyc +../jsonrpc/six.py +../jsonrpc/six.pyc +../jsonrpc/tests/__init__.py +../jsonrpc/tests/__init__.pyc +../jsonrpc/tests/py35_utils.py +../jsonrpc/tests/py35_utils.pyc +../jsonrpc/tests/test_backend_django/__init__.py +../jsonrpc/tests/test_backend_django/__init__.pyc +../jsonrpc/tests/test_backend_django/settings.py +../jsonrpc/tests/test_backend_django/settings.pyc +../jsonrpc/tests/test_backend_django/tests.py +../jsonrpc/tests/test_backend_django/tests.pyc +../jsonrpc/tests/test_backend_django/urls.py +../jsonrpc/tests/test_backend_django/urls.pyc +../jsonrpc/tests/test_backend_flask/__init__.py +../jsonrpc/tests/test_backend_flask/__init__.pyc +../jsonrpc/tests/test_backend_flask/tests.py +../jsonrpc/tests/test_backend_flask/tests.pyc +../jsonrpc/tests/test_base.py +../jsonrpc/tests/test_base.pyc +../jsonrpc/tests/test_bug29.py +../jsonrpc/tests/test_bug29.pyc +../jsonrpc/tests/test_dispatcher.py +../jsonrpc/tests/test_dispatcher.pyc +../jsonrpc/tests/test_examples20.py +../jsonrpc/tests/test_examples20.pyc +../jsonrpc/tests/test_jsonrpc.py +../jsonrpc/tests/test_jsonrpc.pyc +../jsonrpc/tests/test_jsonrpc1.py +../jsonrpc/tests/test_jsonrpc1.pyc +../jsonrpc/tests/test_jsonrpc2.py +../jsonrpc/tests/test_jsonrpc2.pyc +../jsonrpc/tests/test_jsonrpc_errors.py +../jsonrpc/tests/test_jsonrpc_errors.pyc +../jsonrpc/tests/test_manager.py +../jsonrpc/tests/test_manager.pyc +../jsonrpc/tests/test_pep3107.py +../jsonrpc/tests/test_pep3107.pyc +../jsonrpc/tests/test_utils.py +../jsonrpc/tests/test_utils.pyc +../jsonrpc/utils.py +../jsonrpc/utils.pyc +PKG-INFO +SOURCES.txt +dependency_links.txt +top_level.txt diff --git a/pyextra/json_rpc-1.12.1-py2.7.egg-info/top_level.txt b/pyextra/json_rpc-1.12.1-py2.7.egg-info/top_level.txt new file mode 100644 index 00000000000000..1d0ccdd1d0194d --- /dev/null +++ b/pyextra/json_rpc-1.12.1-py2.7.egg-info/top_level.txt @@ -0,0 +1 @@ +jsonrpc diff --git a/pyextra/jsonrpc/__init__.py b/pyextra/jsonrpc/__init__.py new file mode 100644 index 00000000000000..a4095b933f4a12 --- /dev/null +++ b/pyextra/jsonrpc/__init__.py @@ -0,0 +1,11 @@ +from .manager import JSONRPCResponseManager +from .dispatcher import Dispatcher + +__version = (1, 12, 1) + +__version__ = version = '.'.join(map(str, __version)) +__project__ = PROJECT = __name__ + +dispatcher = Dispatcher() + +# lint_ignore=W0611,W0401 diff --git a/pyextra/jsonrpc/backend/__init__.py b/pyextra/jsonrpc/backend/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/pyextra/jsonrpc/backend/django.py b/pyextra/jsonrpc/backend/django.py new file mode 100644 index 00000000000000..5357fb0031925e --- /dev/null +++ b/pyextra/jsonrpc/backend/django.py @@ -0,0 +1,89 @@ +from __future__ import absolute_import + +from django.views.decorators.csrf import csrf_exempt +from django.conf.urls import url +from django.conf import settings +from django.http import HttpResponse, HttpResponseNotAllowed +import copy +import json +import logging +import time + +from ..exceptions import JSONRPCInvalidRequestException +from ..jsonrpc import JSONRPCRequest +from ..manager import JSONRPCResponseManager +from ..utils import DatetimeDecimalEncoder +from ..dispatcher import Dispatcher + + +logger = logging.getLogger(__name__) + + +def response_serialize(obj): + """ Serializes response's data object to JSON. """ + return json.dumps(obj, cls=DatetimeDecimalEncoder) + + +class JSONRPCAPI(object): + def __init__(self, dispatcher=None): + self.dispatcher = dispatcher if dispatcher is not None \ + else Dispatcher() + + @property + def urls(self): + urls = [ + url(r'^$', self.jsonrpc, name='endpoint'), + ] + + if getattr(settings, 'JSONRPC_MAP_VIEW_ENABLED', settings.DEBUG): + urls.append( + url(r'^map$', self.jsonrpc_map, name='map') + ) + + return urls + + @csrf_exempt + def jsonrpc(self, request): + """ JSON-RPC 2.0 handler.""" + if request.method != "POST": + return HttpResponseNotAllowed(["POST"]) + + request_str = request.body.decode('utf8') + try: + jsonrpc_request = JSONRPCRequest.from_json(request_str) + except (TypeError, ValueError, JSONRPCInvalidRequestException): + response = JSONRPCResponseManager.handle( + request_str, self.dispatcher) + else: + jsonrpc_request.params = jsonrpc_request.params or {} + jsonrpc_request_params = copy.copy(jsonrpc_request.params) + if isinstance(jsonrpc_request.params, dict): + jsonrpc_request.params.update(request=request) + + t1 = time.time() + response = JSONRPCResponseManager.handle_request( + jsonrpc_request, self.dispatcher) + t2 = time.time() + logger.info('{0}({1}) {2:.2f} sec'.format( + jsonrpc_request.method, jsonrpc_request_params, t2 - t1)) + + if response: + response.serialize = response_serialize + response = response.json + + return HttpResponse(response, content_type="application/json") + + def jsonrpc_map(self, request): + """ Map of json-rpc available calls. + + :return str: + + """ + result = "

JSON-RPC map

{0}
".format("\n\n".join([ + "{0}: {1}".format(fname, f.__doc__) + for fname, f in self.dispatcher.items() + ])) + return HttpResponse(result) + + +api = JSONRPCAPI() diff --git a/pyextra/jsonrpc/backend/flask.py b/pyextra/jsonrpc/backend/flask.py new file mode 100644 index 00000000000000..133752ceb1bdc2 --- /dev/null +++ b/pyextra/jsonrpc/backend/flask.py @@ -0,0 +1,85 @@ +from __future__ import absolute_import + +import copy +import json +import logging +import time +from uuid import uuid4 + +from flask import Blueprint, request, Response + +from ..exceptions import JSONRPCInvalidRequestException +from ..jsonrpc import JSONRPCRequest +from ..manager import JSONRPCResponseManager +from ..utils import DatetimeDecimalEncoder +from ..dispatcher import Dispatcher + + +logger = logging.getLogger(__name__) + + +class JSONRPCAPI(object): + def __init__(self, dispatcher=None, check_content_type=True): + """ + + :param dispatcher: methods dispatcher + :param check_content_type: if True - content-type must be + "application/json" + :return: + + """ + self.dispatcher = dispatcher if dispatcher is not None \ + else Dispatcher() + self.check_content_type = check_content_type + + def as_blueprint(self, name=None): + blueprint = Blueprint(name if name else str(uuid4()), __name__) + blueprint.add_url_rule( + '/', view_func=self.jsonrpc, methods=['POST']) + blueprint.add_url_rule( + '/map', view_func=self.jsonrpc_map, methods=['GET']) + return blueprint + + def as_view(self): + return self.jsonrpc + + def jsonrpc(self): + request_str = self._get_request_str() + try: + jsonrpc_request = JSONRPCRequest.from_json(request_str) + except (TypeError, ValueError, JSONRPCInvalidRequestException): + response = JSONRPCResponseManager.handle( + request_str, self.dispatcher) + else: + response = JSONRPCResponseManager.handle_request( + jsonrpc_request, self.dispatcher) + + if response: + response.serialize = self._serialize + response = response.json + + return Response(response, content_type="application/json") + + def jsonrpc_map(self): + """ Map of json-rpc available calls. + + :return str: + + """ + result = "

JSON-RPC map

{0}
".format("\n\n".join([ + "{0}: {1}".format(fname, f.__doc__) + for fname, f in self.dispatcher.items() + ])) + return Response(result) + + def _get_request_str(self): + if self.check_content_type or request.data: + return request.data + return list(request.form.keys())[0] + + @staticmethod + def _serialize(s): + return json.dumps(s, cls=DatetimeDecimalEncoder) + + +api = JSONRPCAPI() diff --git a/pyextra/jsonrpc/base.py b/pyextra/jsonrpc/base.py new file mode 100644 index 00000000000000..f9d4196739ec59 --- /dev/null +++ b/pyextra/jsonrpc/base.py @@ -0,0 +1,87 @@ +from .utils import JSONSerializable + + +class JSONRPCBaseRequest(JSONSerializable): + + """ Base class for JSON-RPC 1.0 and JSON-RPC 2.0 requests.""" + + def __init__(self, method=None, params=None, _id=None, + is_notification=None): + self.data = dict() + self.method = method + self.params = params + self._id = _id + self.is_notification = is_notification + + @property + def data(self): + return self._data + + @data.setter + def data(self, value): + if not isinstance(value, dict): + raise ValueError("data should be dict") + + self._data = value + + @property + def args(self): + """ Method position arguments. + + :return tuple args: method position arguments. + + """ + return tuple(self.params) if isinstance(self.params, list) else () + + @property + def kwargs(self): + """ Method named arguments. + + :return dict kwargs: method named arguments. + + """ + return self.params if isinstance(self.params, dict) else {} + + @property + def json(self): + return self.serialize(self.data) + + +class JSONRPCBaseResponse(JSONSerializable): + + """ Base class for JSON-RPC 1.0 and JSON-RPC 2.0 responses.""" + + def __init__(self, **kwargs): + self.data = dict() + + try: + self.result = kwargs['result'] + except KeyError: + pass + + try: + self.error = kwargs['error'] + except KeyError: + pass + + self._id = kwargs.get('_id') + + if 'result' not in kwargs and 'error' not in kwargs: + raise ValueError("Either result or error should be used") + + self.request = None # type: JSONRPCBaseRequest + + @property + def data(self): + return self._data + + @data.setter + def data(self, value): + if not isinstance(value, dict): + raise ValueError("data should be dict") + + self._data = value + + @property + def json(self): + return self.serialize(self.data) diff --git a/pyextra/jsonrpc/dispatcher.py b/pyextra/jsonrpc/dispatcher.py new file mode 100644 index 00000000000000..94e7635e9df047 --- /dev/null +++ b/pyextra/jsonrpc/dispatcher.py @@ -0,0 +1,132 @@ +""" Dispatcher is used to add methods (functions) to the server. + +For usage examples see :meth:`Dispatcher.add_method` + +""" +import functools +import collections + + +class Dispatcher(collections.MutableMapping): + + """ Dictionary like object which maps method_name to method.""" + + def __init__(self, prototype=None): + """ Build method dispatcher. + + Parameters + ---------- + prototype : object or dict, optional + Initial method mapping. + + Examples + -------- + + Init object with method dictionary. + + >>> Dispatcher({"sum": lambda a, b: a + b}) + None + + """ + self.method_map = dict() + + if prototype is not None: + self.build_method_map(prototype) + + def __getitem__(self, key): + return self.method_map[key] + + def __setitem__(self, key, value): + self.method_map[key] = value + + def __delitem__(self, key): + del self.method_map[key] + + def __len__(self): + return len(self.method_map) + + def __iter__(self): + return iter(self.method_map) + + def __repr__(self): + return repr(self.method_map) + + def add_class(self, cls): + prefix = cls.__name__.lower() + '.' + self.build_method_map(cls(), prefix) + + def add_object(self, obj): + prefix = obj.__class__.__name__.lower() + '.' + self.build_method_map(obj, prefix) + + def add_dict(self, dict, prefix=''): + if prefix: + prefix += '.' + self.build_method_map(dict, prefix) + + def add_method(self, f=None, name=None): + """ Add a method to the dispatcher. + + Parameters + ---------- + f : callable + Callable to be added. + name : str, optional + Name to register (the default is function **f** name) + + Notes + ----- + When used as a decorator keeps callable object unmodified. + + Examples + -------- + + Use as method + + >>> d = Dispatcher() + >>> d.add_method(lambda a, b: a + b, name="sum") + > + + Or use as decorator + + >>> d = Dispatcher() + >>> @d.add_method + def mymethod(*args, **kwargs): + print(args, kwargs) + + Or use as a decorator with a different function name + >>> d = Dispatcher() + >>> @d.add_method(name="my.method") + def mymethod(*args, **kwargs): + print(args, kwargs) + + """ + if name and not f: + return functools.partial(self.add_method, name=name) + + self.method_map[name or f.__name__] = f + return f + + def build_method_map(self, prototype, prefix=''): + """ Add prototype methods to the dispatcher. + + Parameters + ---------- + prototype : object or dict + Initial method mapping. + If given prototype is a dictionary then all callable objects will + be added to dispatcher. + If given prototype is an object then all public methods will + be used. + prefix: string, optional + Prefix of methods + + """ + if not isinstance(prototype, dict): + prototype = dict((method, getattr(prototype, method)) + for method in dir(prototype) + if not method.startswith('_')) + + for attr, method in prototype.items(): + if callable(method): + self[prefix + attr] = method diff --git a/pyextra/jsonrpc/exceptions.py b/pyextra/jsonrpc/exceptions.py new file mode 100644 index 00000000000000..175ba924807618 --- /dev/null +++ b/pyextra/jsonrpc/exceptions.py @@ -0,0 +1,185 @@ +""" JSON-RPC Exceptions.""" +from . import six +import json + + +class JSONRPCError(object): + + """ Error for JSON-RPC communication. + + When a rpc call encounters an error, the Response Object MUST contain the + error member with a value that is a Object with the following members: + + Parameters + ---------- + code: int + A Number that indicates the error type that occurred. + This MUST be an integer. + The error codes from and including -32768 to -32000 are reserved for + pre-defined errors. Any code within this range, but not defined + explicitly below is reserved for future use. The error codes are nearly + the same as those suggested for XML-RPC at the following + url: http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php + + message: str + A String providing a short description of the error. + The message SHOULD be limited to a concise single sentence. + + data: int or str or dict or list, optional + A Primitive or Structured value that contains additional + information about the error. + This may be omitted. + The value of this member is defined by the Server (e.g. detailed error + information, nested errors etc.). + + """ + + serialize = staticmethod(json.dumps) + deserialize = staticmethod(json.loads) + + def __init__(self, code=None, message=None, data=None): + self._data = dict() + self.code = getattr(self.__class__, "CODE", code) + self.message = getattr(self.__class__, "MESSAGE", message) + self.data = data + + def __get_code(self): + return self._data["code"] + + def __set_code(self, value): + if not isinstance(value, six.integer_types): + raise ValueError("Error code should be integer") + + self._data["code"] = value + + code = property(__get_code, __set_code) + + def __get_message(self): + return self._data["message"] + + def __set_message(self, value): + if not isinstance(value, six.string_types): + raise ValueError("Error message should be string") + + self._data["message"] = value + + message = property(__get_message, __set_message) + + def __get_data(self): + return self._data.get("data") + + def __set_data(self, value): + if value is not None: + self._data["data"] = value + + data = property(__get_data, __set_data) + + @classmethod + def from_json(cls, json_str): + data = cls.deserialize(json_str) + return cls( + code=data["code"], message=data["message"], data=data.get("data")) + + @property + def json(self): + return self.serialize(self._data) + + +class JSONRPCParseError(JSONRPCError): + + """ Parse Error. + + Invalid JSON was received by the server. + An error occurred on the server while parsing the JSON text. + + """ + + CODE = -32700 + MESSAGE = "Parse error" + + +class JSONRPCInvalidRequest(JSONRPCError): + + """ Invalid Request. + + The JSON sent is not a valid Request object. + + """ + + CODE = -32600 + MESSAGE = "Invalid Request" + + +class JSONRPCMethodNotFound(JSONRPCError): + + """ Method not found. + + The method does not exist / is not available. + + """ + + CODE = -32601 + MESSAGE = "Method not found" + + +class JSONRPCInvalidParams(JSONRPCError): + + """ Invalid params. + + Invalid method parameter(s). + + """ + + CODE = -32602 + MESSAGE = "Invalid params" + + +class JSONRPCInternalError(JSONRPCError): + + """ Internal error. + + Internal JSON-RPC error. + + """ + + CODE = -32603 + MESSAGE = "Internal error" + + +class JSONRPCServerError(JSONRPCError): + + """ Server error. + + Reserved for implementation-defined server-errors. + + """ + + CODE = -32000 + MESSAGE = "Server error" + + +class JSONRPCException(Exception): + + """ JSON-RPC Exception.""" + + pass + + +class JSONRPCInvalidRequestException(JSONRPCException): + + """ Request is not valid.""" + + pass + + +class JSONRPCDispatchException(JSONRPCException): + + """ JSON-RPC Dispatch Exception. + + Should be thrown in dispatch methods. + + """ + + def __init__(self, code=None, message=None, data=None, *args, **kwargs): + super(JSONRPCDispatchException, self).__init__(args, kwargs) + self.error = JSONRPCError(code=code, data=data, message=message) diff --git a/pyextra/jsonrpc/jsonrpc.py b/pyextra/jsonrpc/jsonrpc.py new file mode 100644 index 00000000000000..f02126e2fe0278 --- /dev/null +++ b/pyextra/jsonrpc/jsonrpc.py @@ -0,0 +1,28 @@ +""" JSON-RPC wrappers for version 1.0 and 2.0. + +Objects diring init operation try to choose JSON-RPC 2.0 and in case of error +JSON-RPC 1.0. +from_json methods could decide what format is it by presence of 'jsonrpc' +attribute. + +""" +from .utils import JSONSerializable +from .jsonrpc1 import JSONRPC10Request +from .jsonrpc2 import JSONRPC20Request + + +class JSONRPCRequest(JSONSerializable): + + """ JSONRPC Request.""" + + @classmethod + def from_json(cls, json_str): + data = cls.deserialize(json_str) + return cls.from_data(data) + + @classmethod + def from_data(cls, data): + if isinstance(data, dict) and "jsonrpc" not in data: + return JSONRPC10Request.from_data(data) + else: + return JSONRPC20Request.from_data(data) diff --git a/pyextra/jsonrpc/jsonrpc1.py b/pyextra/jsonrpc/jsonrpc1.py new file mode 100644 index 00000000000000..3fcbe9bf60436e --- /dev/null +++ b/pyextra/jsonrpc/jsonrpc1.py @@ -0,0 +1,151 @@ +from . import six + +from .base import JSONRPCBaseRequest, JSONRPCBaseResponse +from .exceptions import JSONRPCInvalidRequestException, JSONRPCError + + +class JSONRPC10Request(JSONRPCBaseRequest): + + """ JSON-RPC 1.0 Request. + + A remote method is invoked by sending a request to a remote service. + The request is a single object serialized using json. + + :param str method: The name of the method to be invoked. + :param list params: An Array of objects to pass as arguments to the method. + :param _id: This can be of any type. It is used to match the response with + the request that it is replying to. + :param bool is_notification: whether request notification or not. + + """ + + JSONRPC_VERSION = "1.0" + REQUIRED_FIELDS = set(["method", "params", "id"]) + POSSIBLE_FIELDS = set(["method", "params", "id"]) + + @property + def data(self): + data = dict((k, v) for k, v in self._data.items()) + data["id"] = None if self.is_notification else data["id"] + return data + + @data.setter + def data(self, value): + if not isinstance(value, dict): + raise ValueError("data should be dict") + + self._data = value + + @property + def method(self): + return self._data.get("method") + + @method.setter + def method(self, value): + if not isinstance(value, six.string_types): + raise ValueError("Method should be string") + + self._data["method"] = str(value) + + @property + def params(self): + return self._data.get("params") + + @params.setter + def params(self, value): + if not isinstance(value, (list, tuple)): + raise ValueError("Incorrect params {0}".format(value)) + + self._data["params"] = list(value) + + @property + def _id(self): + return self._data.get("id") + + @_id.setter + def _id(self, value): + self._data["id"] = value + + @property + def is_notification(self): + return self._data["id"] is None or self._is_notification + + @is_notification.setter + def is_notification(self, value): + if value is None: + value = self._id is None + + if self._id is None and not value: + raise ValueError("Can not set attribute is_notification. " + + "Request id should not be None") + + self._is_notification = value + + @classmethod + def from_json(cls, json_str): + data = cls.deserialize(json_str) + return cls.from_data(data) + + @classmethod + def from_data(cls, data): + if not isinstance(data, dict): + raise ValueError("data should be dict") + + if cls.REQUIRED_FIELDS <= set(data.keys()) <= cls.POSSIBLE_FIELDS: + return cls( + method=data["method"], params=data["params"], _id=data["id"] + ) + else: + extra = set(data.keys()) - cls.POSSIBLE_FIELDS + missed = cls.REQUIRED_FIELDS - set(data.keys()) + msg = "Invalid request. Extra fields: {0}, Missed fields: {1}" + raise JSONRPCInvalidRequestException(msg.format(extra, missed)) + + +class JSONRPC10Response(JSONRPCBaseResponse): + + JSONRPC_VERSION = "1.0" + + @property + def data(self): + data = dict((k, v) for k, v in self._data.items()) + return data + + @data.setter + def data(self, value): + if not isinstance(value, dict): + raise ValueError("data should be dict") + + self._data = value + + @property + def result(self): + return self._data.get("result") + + @result.setter + def result(self, value): + if self.error: + raise ValueError("Either result or error should be used") + self._data["result"] = value + + @property + def error(self): + return self._data.get("error") + + @error.setter + def error(self, value): + self._data.pop('value', None) + if value: + self._data["error"] = value + # Test error + JSONRPCError(**value) + + @property + def _id(self): + return self._data.get("id") + + @_id.setter + def _id(self, value): + if value is None: + raise ValueError("id could not be null for JSON-RPC1.0 Response") + self._data["id"] = value diff --git a/pyextra/jsonrpc/jsonrpc2.py b/pyextra/jsonrpc/jsonrpc2.py new file mode 100644 index 00000000000000..66ca451258b279 --- /dev/null +++ b/pyextra/jsonrpc/jsonrpc2.py @@ -0,0 +1,267 @@ +from . import six +import json + +from .exceptions import JSONRPCError, JSONRPCInvalidRequestException +from .base import JSONRPCBaseRequest, JSONRPCBaseResponse + + +class JSONRPC20Request(JSONRPCBaseRequest): + + """ A rpc call is represented by sending a Request object to a Server. + + :param str method: A String containing the name of the method to be + invoked. Method names that begin with the word rpc followed by a + period character (U+002E or ASCII 46) are reserved for rpc-internal + methods and extensions and MUST NOT be used for anything else. + + :param params: A Structured value that holds the parameter values to be + used during the invocation of the method. This member MAY be omitted. + :type params: iterable or dict + + :param _id: An identifier established by the Client that MUST contain a + String, Number, or NULL value if included. If it is not included it is + assumed to be a notification. The value SHOULD normally not be Null + [1] and Numbers SHOULD NOT contain fractional parts [2]. + :type _id: str or int or None + + :param bool is_notification: Whether request is notification or not. If + value is True, _id is not included to request. It allows to create + requests with id = null. + + The Server MUST reply with the same value in the Response object if + included. This member is used to correlate the context between the two + objects. + + [1] The use of Null as a value for the id member in a Request object is + discouraged, because this specification uses a value of Null for Responses + with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null + for Notifications this could cause confusion in handling. + + [2] Fractional parts may be problematic, since many decimal fractions + cannot be represented exactly as binary fractions. + + """ + + JSONRPC_VERSION = "2.0" + REQUIRED_FIELDS = set(["jsonrpc", "method"]) + POSSIBLE_FIELDS = set(["jsonrpc", "method", "params", "id"]) + + @property + def data(self): + data = dict( + (k, v) for k, v in self._data.items() + if not (k == "id" and self.is_notification) + ) + data["jsonrpc"] = self.JSONRPC_VERSION + return data + + @data.setter + def data(self, value): + if not isinstance(value, dict): + raise ValueError("data should be dict") + + self._data = value + + @property + def method(self): + return self._data.get("method") + + @method.setter + def method(self, value): + if not isinstance(value, six.string_types): + raise ValueError("Method should be string") + + if value.startswith("rpc."): + raise ValueError( + "Method names that begin with the word rpc followed by a " + + "period character (U+002E or ASCII 46) are reserved for " + + "rpc-internal methods and extensions and MUST NOT be used " + + "for anything else.") + + self._data["method"] = str(value) + + @property + def params(self): + return self._data.get("params") + + @params.setter + def params(self, value): + if value is not None and not isinstance(value, (list, tuple, dict)): + raise ValueError("Incorrect params {0}".format(value)) + + value = list(value) if isinstance(value, tuple) else value + + if value is not None: + self._data["params"] = value + + @property + def _id(self): + return self._data.get("id") + + @_id.setter + def _id(self, value): + if value is not None and \ + not isinstance(value, six.string_types + six.integer_types): + raise ValueError("id should be string or integer") + + self._data["id"] = value + + @classmethod + def from_json(cls, json_str): + data = cls.deserialize(json_str) + return cls.from_data(data) + + @classmethod + def from_data(cls, data): + is_batch = isinstance(data, list) + data = data if is_batch else [data] + + if not data: + raise JSONRPCInvalidRequestException("[] value is not accepted") + + if not all(isinstance(d, dict) for d in data): + raise JSONRPCInvalidRequestException( + "Each request should be an object (dict)") + + result = [] + for d in data: + if not cls.REQUIRED_FIELDS <= set(d.keys()) <= cls.POSSIBLE_FIELDS: + extra = set(d.keys()) - cls.POSSIBLE_FIELDS + missed = cls.REQUIRED_FIELDS - set(d.keys()) + msg = "Invalid request. Extra fields: {0}, Missed fields: {1}" + raise JSONRPCInvalidRequestException(msg.format(extra, missed)) + + try: + result.append(JSONRPC20Request( + method=d["method"], params=d.get("params"), + _id=d.get("id"), is_notification="id" not in d, + )) + except ValueError as e: + raise JSONRPCInvalidRequestException(str(e)) + + return JSONRPC20BatchRequest(*result) if is_batch else result[0] + + +class JSONRPC20BatchRequest(object): + + """ Batch JSON-RPC 2.0 Request. + + :param JSONRPC20Request *requests: requests + + """ + + JSONRPC_VERSION = "2.0" + + def __init__(self, *requests): + self.requests = requests + + @classmethod + def from_json(cls, json_str): + return JSONRPC20Request.from_json(json_str) + + @property + def json(self): + return json.dumps([r.data for r in self.requests]) + + def __iter__(self): + return iter(self.requests) + + +class JSONRPC20Response(JSONRPCBaseResponse): + + """ JSON-RPC response object to JSONRPC20Request. + + When a rpc call is made, the Server MUST reply with a Response, except for + in the case of Notifications. The Response is expressed as a single JSON + Object, with the following members: + + :param str jsonrpc: A String specifying the version of the JSON-RPC + protocol. MUST be exactly "2.0". + + :param result: This member is REQUIRED on success. + This member MUST NOT exist if there was an error invoking the method. + The value of this member is determined by the method invoked on the + Server. + + :param dict error: This member is REQUIRED on error. + This member MUST NOT exist if there was no error triggered during + invocation. The value for this member MUST be an Object. + + :param id: This member is REQUIRED. + It MUST be the same as the value of the id member in the Request + Object. If there was an error in detecting the id in the Request + object (e.g. Parse error/Invalid Request), it MUST be Null. + :type id: str or int or None + + Either the result member or error member MUST be included, but both + members MUST NOT be included. + + """ + + JSONRPC_VERSION = "2.0" + + @property + def data(self): + data = dict((k, v) for k, v in self._data.items()) + data["jsonrpc"] = self.JSONRPC_VERSION + return data + + @data.setter + def data(self, value): + if not isinstance(value, dict): + raise ValueError("data should be dict") + self._data = value + + @property + def result(self): + return self._data.get("result") + + @result.setter + def result(self, value): + if self.error: + raise ValueError("Either result or error should be used") + self._data["result"] = value + + @property + def error(self): + return self._data.get("error") + + @error.setter + def error(self, value): + self._data.pop('value', None) + if value: + self._data["error"] = value + # Test error + JSONRPCError(**value) + + @property + def _id(self): + return self._data.get("id") + + @_id.setter + def _id(self, value): + if value is not None and \ + not isinstance(value, six.string_types + six.integer_types): + raise ValueError("id should be string or integer") + + self._data["id"] = value + + +class JSONRPC20BatchResponse(object): + + JSONRPC_VERSION = "2.0" + + def __init__(self, *responses): + self.responses = responses + self.request = None # type: JSONRPC20BatchRequest + + @property + def data(self): + return [r.data for r in self.responses] + + @property + def json(self): + return json.dumps(self.data) + + def __iter__(self): + return iter(self.responses) diff --git a/pyextra/jsonrpc/manager.py b/pyextra/jsonrpc/manager.py new file mode 100644 index 00000000000000..cdb8689afa12a2 --- /dev/null +++ b/pyextra/jsonrpc/manager.py @@ -0,0 +1,136 @@ +import json +import logging +from .utils import is_invalid_params +from .exceptions import ( + JSONRPCInvalidParams, + JSONRPCInvalidRequest, + JSONRPCInvalidRequestException, + JSONRPCMethodNotFound, + JSONRPCParseError, + JSONRPCServerError, + JSONRPCDispatchException, +) +from .jsonrpc1 import JSONRPC10Response +from .jsonrpc2 import ( + JSONRPC20BatchRequest, + JSONRPC20BatchResponse, + JSONRPC20Response, +) +from .jsonrpc import JSONRPCRequest + +logger = logging.getLogger(__name__) + + +class JSONRPCResponseManager(object): + + """ JSON-RPC response manager. + + Method brings syntactic sugar into library. Given dispatcher it handles + request (both single and batch) and handles errors. + Request could be handled in parallel, it is server responsibility. + + :param str request_str: json string. Will be converted into + JSONRPC20Request, JSONRPC20BatchRequest or JSONRPC10Request + + :param dict dispather: dict. + + """ + + RESPONSE_CLASS_MAP = { + "1.0": JSONRPC10Response, + "2.0": JSONRPC20Response, + } + + @classmethod + def handle(cls, request_str, dispatcher): + if isinstance(request_str, bytes): + request_str = request_str.decode("utf-8") + + try: + data = json.loads(request_str) + except (TypeError, ValueError): + return JSONRPC20Response(error=JSONRPCParseError()._data) + + try: + request = JSONRPCRequest.from_data(data) + except JSONRPCInvalidRequestException: + return JSONRPC20Response(error=JSONRPCInvalidRequest()._data) + + return cls.handle_request(request, dispatcher) + + @classmethod + def handle_request(cls, request, dispatcher): + """ Handle request data. + + At this moment request has correct jsonrpc format. + + :param dict request: data parsed from request_str. + :param jsonrpc.dispatcher.Dispatcher dispatcher: + + .. versionadded: 1.8.0 + + """ + rs = request if isinstance(request, JSONRPC20BatchRequest) \ + else [request] + responses = [r for r in cls._get_responses(rs, dispatcher) + if r is not None] + + # notifications + if not responses: + return + + if isinstance(request, JSONRPC20BatchRequest): + response = JSONRPC20BatchResponse(*responses) + response.request = request + return response + else: + return responses[0] + + @classmethod + def _get_responses(cls, requests, dispatcher): + """ Response to each single JSON-RPC Request. + + :return iterator(JSONRPC20Response): + + .. versionadded: 1.9.0 + TypeError inside the function is distinguished from Invalid Params. + + """ + for request in requests: + def make_response(**kwargs): + response = cls.RESPONSE_CLASS_MAP[request.JSONRPC_VERSION]( + _id=request._id, **kwargs) + response.request = request + return response + + output = None + try: + method = dispatcher[request.method] + except KeyError: + output = make_response(error=JSONRPCMethodNotFound()._data) + else: + try: + result = method(*request.args, **request.kwargs) + except JSONRPCDispatchException as e: + output = make_response(error=e.error._data) + except Exception as e: + data = { + "type": e.__class__.__name__, + "args": e.args, + "message": str(e), + } + + logger.exception("API Exception: {0}".format(data)) + + if isinstance(e, TypeError) and is_invalid_params( + method, *request.args, **request.kwargs): + output = make_response( + error=JSONRPCInvalidParams(data=data)._data) + else: + output = make_response( + error=JSONRPCServerError(data=data)._data) + else: + output = make_response(result=result) + finally: + if not request.is_notification: + yield output diff --git a/pyextra/jsonrpc/six.py b/pyextra/jsonrpc/six.py new file mode 100644 index 00000000000000..59145fed2c2ab3 --- /dev/null +++ b/pyextra/jsonrpc/six.py @@ -0,0 +1,584 @@ +"""Utilities for writing code that runs on Python 2 and 3""" + +# Copyright (c) 2010-2013 Benjamin Peterson +# +# 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. + +import operator +import sys +import types + +__author__ = "Benjamin Peterson " +__version__ = "1.4.1" + + +# Useful for very coarse version differentiation. +PY2 = sys.version_info[0] == 2 +PY3 = sys.version_info[0] == 3 + +if PY3: + string_types = str, + integer_types = int, + class_types = type, + text_type = str + binary_type = bytes + + MAXSIZE = sys.maxsize +else: + string_types = basestring, + integer_types = (int, long) + class_types = (type, types.ClassType) + text_type = unicode + binary_type = str + + if sys.platform.startswith("java"): + # Jython always uses 32 bits. + MAXSIZE = int((1 << 31) - 1) + else: + # It's possible to have sizeof(long) != sizeof(Py_ssize_t). + class X(object): + def __len__(self): + return 1 << 31 + try: + len(X()) + except OverflowError: + # 32-bit + MAXSIZE = int((1 << 31) - 1) + else: + # 64-bit + MAXSIZE = int((1 << 63) - 1) + del X + + +def _add_doc(func, doc): + """Add documentation to a function.""" + func.__doc__ = doc + + +def _import_module(name): + """Import module, returning the module after the last dot.""" + __import__(name) + return sys.modules[name] + + +class _LazyDescr(object): + + def __init__(self, name): + self.name = name + + def __get__(self, obj, tp): + result = self._resolve() + setattr(obj, self.name, result) + # This is a bit ugly, but it avoids running this again. + delattr(tp, self.name) + return result + + +class MovedModule(_LazyDescr): + + def __init__(self, name, old, new=None): + super(MovedModule, self).__init__(name) + if PY3: + if new is None: + new = name + self.mod = new + else: + self.mod = old + + def _resolve(self): + return _import_module(self.mod) + + +class MovedAttribute(_LazyDescr): + + def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): + super(MovedAttribute, self).__init__(name) + if PY3: + if new_mod is None: + new_mod = name + self.mod = new_mod + if new_attr is None: + if old_attr is None: + new_attr = name + else: + new_attr = old_attr + self.attr = new_attr + else: + self.mod = old_mod + if old_attr is None: + old_attr = name + self.attr = old_attr + + def _resolve(self): + module = _import_module(self.mod) + return getattr(module, self.attr) + + + +class _MovedItems(types.ModuleType): + """Lazy loading of moved objects""" + + +_moved_attributes = [ + MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), + MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), + MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"), + MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), + MovedAttribute("map", "itertools", "builtins", "imap", "map"), + MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), + MovedAttribute("reload_module", "__builtin__", "imp", "reload"), + MovedAttribute("reduce", "__builtin__", "functools"), + MovedAttribute("StringIO", "StringIO", "io"), + MovedAttribute("UserString", "UserString", "collections"), + MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), + MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), + MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"), + + MovedModule("builtins", "__builtin__"), + MovedModule("configparser", "ConfigParser"), + MovedModule("copyreg", "copy_reg"), + MovedModule("dbm_gnu", "gdbm", "dbm.gnu"), + MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), + MovedModule("http_cookies", "Cookie", "http.cookies"), + MovedModule("html_entities", "htmlentitydefs", "html.entities"), + MovedModule("html_parser", "HTMLParser", "html.parser"), + MovedModule("http_client", "httplib", "http.client"), + MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), + MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), + MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), + MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), + MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), + MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), + MovedModule("cPickle", "cPickle", "pickle"), + MovedModule("queue", "Queue"), + MovedModule("reprlib", "repr"), + MovedModule("socketserver", "SocketServer"), + MovedModule("_thread", "thread", "_thread"), + MovedModule("tkinter", "Tkinter"), + MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), + MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), + MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), + MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), + MovedModule("tkinter_tix", "Tix", "tkinter.tix"), + MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), + MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), + MovedModule("tkinter_colorchooser", "tkColorChooser", + "tkinter.colorchooser"), + MovedModule("tkinter_commondialog", "tkCommonDialog", + "tkinter.commondialog"), + MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), + MovedModule("tkinter_font", "tkFont", "tkinter.font"), + MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), + MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", + "tkinter.simpledialog"), + MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"), + MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"), + MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"), + MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), + MovedModule("winreg", "_winreg"), +] +for attr in _moved_attributes: + setattr(_MovedItems, attr.name, attr) +del attr + +moves = sys.modules[__name__ + ".moves"] = _MovedItems(__name__ + ".moves") + + + +class Module_six_moves_urllib_parse(types.ModuleType): + """Lazy loading of moved objects in six.moves.urllib_parse""" + + +_urllib_parse_moved_attributes = [ + MovedAttribute("ParseResult", "urlparse", "urllib.parse"), + MovedAttribute("parse_qs", "urlparse", "urllib.parse"), + MovedAttribute("parse_qsl", "urlparse", "urllib.parse"), + MovedAttribute("urldefrag", "urlparse", "urllib.parse"), + MovedAttribute("urljoin", "urlparse", "urllib.parse"), + MovedAttribute("urlparse", "urlparse", "urllib.parse"), + MovedAttribute("urlsplit", "urlparse", "urllib.parse"), + MovedAttribute("urlunparse", "urlparse", "urllib.parse"), + MovedAttribute("urlunsplit", "urlparse", "urllib.parse"), + MovedAttribute("quote", "urllib", "urllib.parse"), + MovedAttribute("quote_plus", "urllib", "urllib.parse"), + MovedAttribute("unquote", "urllib", "urllib.parse"), + MovedAttribute("unquote_plus", "urllib", "urllib.parse"), + MovedAttribute("urlencode", "urllib", "urllib.parse"), +] +for attr in _urllib_parse_moved_attributes: + setattr(Module_six_moves_urllib_parse, attr.name, attr) +del attr + +sys.modules[__name__ + ".moves.urllib_parse"] = Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse") +sys.modules[__name__ + ".moves.urllib.parse"] = Module_six_moves_urllib_parse(__name__ + ".moves.urllib.parse") + + +class Module_six_moves_urllib_error(types.ModuleType): + """Lazy loading of moved objects in six.moves.urllib_error""" + + +_urllib_error_moved_attributes = [ + MovedAttribute("URLError", "urllib2", "urllib.error"), + MovedAttribute("HTTPError", "urllib2", "urllib.error"), + MovedAttribute("ContentTooShortError", "urllib", "urllib.error"), +] +for attr in _urllib_error_moved_attributes: + setattr(Module_six_moves_urllib_error, attr.name, attr) +del attr + +sys.modules[__name__ + ".moves.urllib_error"] = Module_six_moves_urllib_error(__name__ + ".moves.urllib_error") +sys.modules[__name__ + ".moves.urllib.error"] = Module_six_moves_urllib_error(__name__ + ".moves.urllib.error") + + +class Module_six_moves_urllib_request(types.ModuleType): + """Lazy loading of moved objects in six.moves.urllib_request""" + + +_urllib_request_moved_attributes = [ + MovedAttribute("urlopen", "urllib2", "urllib.request"), + MovedAttribute("install_opener", "urllib2", "urllib.request"), + MovedAttribute("build_opener", "urllib2", "urllib.request"), + MovedAttribute("pathname2url", "urllib", "urllib.request"), + MovedAttribute("url2pathname", "urllib", "urllib.request"), + MovedAttribute("getproxies", "urllib", "urllib.request"), + MovedAttribute("Request", "urllib2", "urllib.request"), + MovedAttribute("OpenerDirector", "urllib2", "urllib.request"), + MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"), + MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"), + MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"), + MovedAttribute("ProxyHandler", "urllib2", "urllib.request"), + MovedAttribute("BaseHandler", "urllib2", "urllib.request"), + MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"), + MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"), + MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"), + MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"), + MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"), + MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"), + MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"), + MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"), + MovedAttribute("HTTPHandler", "urllib2", "urllib.request"), + MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"), + MovedAttribute("FileHandler", "urllib2", "urllib.request"), + MovedAttribute("FTPHandler", "urllib2", "urllib.request"), + MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"), + MovedAttribute("UnknownHandler", "urllib2", "urllib.request"), + MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"), + MovedAttribute("urlretrieve", "urllib", "urllib.request"), + MovedAttribute("urlcleanup", "urllib", "urllib.request"), + MovedAttribute("URLopener", "urllib", "urllib.request"), + MovedAttribute("FancyURLopener", "urllib", "urllib.request"), +] +for attr in _urllib_request_moved_attributes: + setattr(Module_six_moves_urllib_request, attr.name, attr) +del attr + +sys.modules[__name__ + ".moves.urllib_request"] = Module_six_moves_urllib_request(__name__ + ".moves.urllib_request") +sys.modules[__name__ + ".moves.urllib.request"] = Module_six_moves_urllib_request(__name__ + ".moves.urllib.request") + + +class Module_six_moves_urllib_response(types.ModuleType): + """Lazy loading of moved objects in six.moves.urllib_response""" + + +_urllib_response_moved_attributes = [ + MovedAttribute("addbase", "urllib", "urllib.response"), + MovedAttribute("addclosehook", "urllib", "urllib.response"), + MovedAttribute("addinfo", "urllib", "urllib.response"), + MovedAttribute("addinfourl", "urllib", "urllib.response"), +] +for attr in _urllib_response_moved_attributes: + setattr(Module_six_moves_urllib_response, attr.name, attr) +del attr + +sys.modules[__name__ + ".moves.urllib_response"] = Module_six_moves_urllib_response(__name__ + ".moves.urllib_response") +sys.modules[__name__ + ".moves.urllib.response"] = Module_six_moves_urllib_response(__name__ + ".moves.urllib.response") + + +class Module_six_moves_urllib_robotparser(types.ModuleType): + """Lazy loading of moved objects in six.moves.urllib_robotparser""" + + +_urllib_robotparser_moved_attributes = [ + MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"), +] +for attr in _urllib_robotparser_moved_attributes: + setattr(Module_six_moves_urllib_robotparser, attr.name, attr) +del attr + +sys.modules[__name__ + ".moves.urllib_robotparser"] = Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib_robotparser") +sys.modules[__name__ + ".moves.urllib.robotparser"] = Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser") + + +class Module_six_moves_urllib(types.ModuleType): + """Create a six.moves.urllib namespace that resembles the Python 3 namespace""" + parse = sys.modules[__name__ + ".moves.urllib_parse"] + error = sys.modules[__name__ + ".moves.urllib_error"] + request = sys.modules[__name__ + ".moves.urllib_request"] + response = sys.modules[__name__ + ".moves.urllib_response"] + robotparser = sys.modules[__name__ + ".moves.urllib_robotparser"] + + +sys.modules[__name__ + ".moves.urllib"] = Module_six_moves_urllib(__name__ + ".moves.urllib") + + +def add_move(move): + """Add an item to six.moves.""" + setattr(_MovedItems, move.name, move) + + +def remove_move(name): + """Remove item from six.moves.""" + try: + delattr(_MovedItems, name) + except AttributeError: + try: + del moves.__dict__[name] + except KeyError: + raise AttributeError("no such move, %r" % (name,)) + + +if PY3: + _meth_func = "__func__" + _meth_self = "__self__" + + _func_closure = "__closure__" + _func_code = "__code__" + _func_defaults = "__defaults__" + _func_globals = "__globals__" + + _iterkeys = "keys" + _itervalues = "values" + _iteritems = "items" + _iterlists = "lists" +else: + _meth_func = "im_func" + _meth_self = "im_self" + + _func_closure = "func_closure" + _func_code = "func_code" + _func_defaults = "func_defaults" + _func_globals = "func_globals" + + _iterkeys = "iterkeys" + _itervalues = "itervalues" + _iteritems = "iteritems" + _iterlists = "iterlists" + + +try: + advance_iterator = next +except NameError: + def advance_iterator(it): + return it.next() +next = advance_iterator + + +try: + callable = callable +except NameError: + def callable(obj): + return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) + + +if PY3: + def get_unbound_function(unbound): + return unbound + + create_bound_method = types.MethodType + + Iterator = object +else: + def get_unbound_function(unbound): + return unbound.im_func + + def create_bound_method(func, obj): + return types.MethodType(func, obj, obj.__class__) + + class Iterator(object): + + def next(self): + return type(self).__next__(self) + + callable = callable +_add_doc(get_unbound_function, + """Get the function out of a possibly unbound function""") + + +get_method_function = operator.attrgetter(_meth_func) +get_method_self = operator.attrgetter(_meth_self) +get_function_closure = operator.attrgetter(_func_closure) +get_function_code = operator.attrgetter(_func_code) +get_function_defaults = operator.attrgetter(_func_defaults) +get_function_globals = operator.attrgetter(_func_globals) + + +def iterkeys(d, **kw): + """Return an iterator over the keys of a dictionary.""" + return iter(getattr(d, _iterkeys)(**kw)) + +def itervalues(d, **kw): + """Return an iterator over the values of a dictionary.""" + return iter(getattr(d, _itervalues)(**kw)) + +def iteritems(d, **kw): + """Return an iterator over the (key, value) pairs of a dictionary.""" + return iter(getattr(d, _iteritems)(**kw)) + +def iterlists(d, **kw): + """Return an iterator over the (key, [values]) pairs of a dictionary.""" + return iter(getattr(d, _iterlists)(**kw)) + + +if PY3: + def b(s): + return s.encode("latin-1") + def u(s): + return s + unichr = chr + if sys.version_info[1] <= 1: + def int2byte(i): + return bytes((i,)) + else: + # This is about 2x faster than the implementation above on 3.2+ + int2byte = operator.methodcaller("to_bytes", 1, "big") + byte2int = operator.itemgetter(0) + indexbytes = operator.getitem + iterbytes = iter + import io + StringIO = io.StringIO + BytesIO = io.BytesIO +else: + def b(s): + return s + def u(s): + return unicode(s, "unicode_escape") + unichr = unichr + int2byte = chr + def byte2int(bs): + return ord(bs[0]) + def indexbytes(buf, i): + return ord(buf[i]) + def iterbytes(buf): + return (ord(byte) for byte in buf) + import StringIO + StringIO = BytesIO = StringIO.StringIO +_add_doc(b, """Byte literal""") +_add_doc(u, """Text literal""") + + +if PY3: + exec_ = getattr(moves.builtins, "exec") + + + def reraise(tp, value, tb=None): + if value.__traceback__ is not tb: + raise value.with_traceback(tb) + raise value + +else: + def exec_(_code_, _globs_=None, _locs_=None): + """Execute code in a namespace.""" + if _globs_ is None: + frame = sys._getframe(1) + _globs_ = frame.f_globals + if _locs_ is None: + _locs_ = frame.f_locals + del frame + elif _locs_ is None: + _locs_ = _globs_ + exec("""exec _code_ in _globs_, _locs_""") + + + exec_("""def reraise(tp, value, tb=None): + raise tp, value, tb +""") + + +print_ = getattr(moves.builtins, "print", None) +if print_ is None: + def print_(*args, **kwargs): + """The new-style print function for Python 2.4 and 2.5.""" + fp = kwargs.pop("file", sys.stdout) + if fp is None: + return + def write(data): + if not isinstance(data, basestring): + data = str(data) + # If the file has an encoding, encode unicode with it. + if (isinstance(fp, file) and + isinstance(data, unicode) and + fp.encoding is not None): + errors = getattr(fp, "errors", None) + if errors is None: + errors = "strict" + data = data.encode(fp.encoding, errors) + fp.write(data) + want_unicode = False + sep = kwargs.pop("sep", None) + if sep is not None: + if isinstance(sep, unicode): + want_unicode = True + elif not isinstance(sep, str): + raise TypeError("sep must be None or a string") + end = kwargs.pop("end", None) + if end is not None: + if isinstance(end, unicode): + want_unicode = True + elif not isinstance(end, str): + raise TypeError("end must be None or a string") + if kwargs: + raise TypeError("invalid keyword arguments to print()") + if not want_unicode: + for arg in args: + if isinstance(arg, unicode): + want_unicode = True + break + if want_unicode: + newline = unicode("\n") + space = unicode(" ") + else: + newline = "\n" + space = " " + if sep is None: + sep = space + if end is None: + end = newline + for i, arg in enumerate(args): + if i: + write(sep) + write(arg) + write(end) + +_add_doc(reraise, """Reraise an exception.""") + + +def with_metaclass(meta, *bases): + """Create a base class with a metaclass.""" + return meta("NewBase", bases, {}) + +def add_metaclass(metaclass): + """Class decorator for creating a class with a metaclass.""" + def wrapper(cls): + orig_vars = cls.__dict__.copy() + orig_vars.pop('__dict__', None) + orig_vars.pop('__weakref__', None) + for slots_var in orig_vars.get('__slots__', ()): + orig_vars.pop(slots_var) + return metaclass(cls.__name__, cls.__bases__, orig_vars) + return wrapper \ No newline at end of file diff --git a/pyextra/jsonrpc/tests/__init__.py b/pyextra/jsonrpc/tests/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/pyextra/jsonrpc/tests/py35_utils.py b/pyextra/jsonrpc/tests/py35_utils.py new file mode 100644 index 00000000000000..e880150be2e554 --- /dev/null +++ b/pyextra/jsonrpc/tests/py35_utils.py @@ -0,0 +1,7 @@ +# Python3.5+ code. +# This won't even parse in earlier versions, so it's kept in a separate file +# and imported when needed. + + +def distance(a: float, b: float) -> float: + return (a ** 2 + b ** 2) ** 0.5 diff --git a/pyextra/jsonrpc/tests/test_backend_django/__init__.py b/pyextra/jsonrpc/tests/test_backend_django/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/pyextra/jsonrpc/tests/test_backend_django/settings.py b/pyextra/jsonrpc/tests/test_backend_django/settings.py new file mode 100644 index 00000000000000..987139e1b312f9 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_backend_django/settings.py @@ -0,0 +1,11 @@ +SECRET_KEY = 'secret' +ROOT_URLCONF = 'jsonrpc.tests.test_backend_django.urls' +ALLOWED_HOSTS = ['testserver'] +DATABASE_ENGINE = 'django.db.backends.sqlite3' +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': ':memory:', + } +} +JSONRPC_MAP_VIEW_ENABLED = True diff --git a/pyextra/jsonrpc/tests/test_backend_django/tests.py b/pyextra/jsonrpc/tests/test_backend_django/tests.py new file mode 100644 index 00000000000000..9a30fa0b6c4b15 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_backend_django/tests.py @@ -0,0 +1,89 @@ +""" Test Django Backend.""" +from __future__ import absolute_import +import os + +try: + from django.core.urlresolvers import RegexURLPattern + from django.test import TestCase +except ImportError: + import unittest + raise unittest.SkipTest('Django not found for testing') + +from ...backend.django import JSONRPCAPI, api +import json + + +class TestDjangoBackend(TestCase): + @classmethod + def setUpClass(cls): + os.environ['DJANGO_SETTINGS_MODULE'] = \ + 'jsonrpc.tests.test_backend_django.settings' + super(TestDjangoBackend, cls).setUpClass() + + def test_urls(self): + self.assertTrue(isinstance(api.urls, list)) + for api_url in api.urls: + self.assertTrue(isinstance(api_url, RegexURLPattern)) + + def test_client(self): + @api.dispatcher.add_method + def dummy(request): + return "" + + json_data = { + "id": "0", + "jsonrpc": "2.0", + "method": "dummy", + } + response = self.client.post( + '', + json.dumps(json_data), + content_type='application/json', + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.content.decode('utf8')) + self.assertEqual(data['result'], '') + + def test_method_not_allowed(self): + response = self.client.get( + '', + content_type='application/json', + ) + self.assertEqual(response.status_code, 405, "Should allow only POST") + + def test_invalid_request(self): + response = self.client.post( + '', + '{', + content_type='application/json', + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.content.decode('utf8')) + self.assertEqual(data['error']['code'], -32700) + self.assertEqual(data['error']['message'], 'Parse error') + + def test_resource_map(self): + response = self.client.get('/map') + self.assertEqual(response.status_code, 200) + data = response.content.decode('utf8') + self.assertIn("JSON-RPC map", data) + + def test_method_not_allowed_prefix(self): + response = self.client.get( + '/prefix/', + content_type='application/json', + ) + self.assertEqual(response.status_code, 405) + + def test_resource_map_prefix(self): + response = self.client.get('/prefix/map') + self.assertEqual(response.status_code, 200) + + def test_empty_initial_dispatcher(self): + class SubDispatcher(type(api.dispatcher)): + pass + + custom_dispatcher = SubDispatcher() + custom_api = JSONRPCAPI(custom_dispatcher) + self.assertEqual(type(custom_api.dispatcher), SubDispatcher) + self.assertEqual(id(custom_api.dispatcher), id(custom_dispatcher)) diff --git a/pyextra/jsonrpc/tests/test_backend_django/urls.py b/pyextra/jsonrpc/tests/test_backend_django/urls.py new file mode 100644 index 00000000000000..c0a22465e05273 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_backend_django/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import url, include +from jsonrpc.backend.django import api + +urlpatterns = [ + url(r'', include(api.urls)), + url(r'^prefix/', include(api.urls)), +] diff --git a/pyextra/jsonrpc/tests/test_backend_flask/__init__.py b/pyextra/jsonrpc/tests/test_backend_flask/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/pyextra/jsonrpc/tests/test_backend_flask/tests.py b/pyextra/jsonrpc/tests/test_backend_flask/tests.py new file mode 100644 index 00000000000000..fdb86234855dac --- /dev/null +++ b/pyextra/jsonrpc/tests/test_backend_flask/tests.py @@ -0,0 +1,182 @@ +import json +import sys + +if sys.version_info < (3, 3): + from mock import patch +else: + from unittest.mock import patch + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + +# Flask is supported only for python2 and python3.3+ +if sys.version_info < (3, 0) or sys.version_info >= (3, 3): + try: + from flask import Flask + except ImportError: + raise unittest.SkipTest('Flask not found for testing') + + from ...backend.flask import JSONRPCAPI, api + + @api.dispatcher.add_method + def dummy(): + return "" + + +@unittest.skipIf((3, 0) <= sys.version_info < (3, 3), + 'Flask does not support python 3.0 - 3.2') +class TestFlaskBackend(unittest.TestCase): + REQUEST = json.dumps({ + "id": "0", + "jsonrpc": "2.0", + "method": "dummy", + }) + + def setUp(self): + self.client = self._get_test_client(JSONRPCAPI()) + + def _get_test_client(self, api): + @api.dispatcher.add_method + def dummy(): + return "" + + app = Flask(__name__) + app.config["TESTING"] = True + app.register_blueprint(api.as_blueprint()) + return app.test_client() + + def test_client(self): + response = self.client.post( + '/', + data=self.REQUEST, + content_type='application/json', + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.data.decode('utf8')) + self.assertEqual(data['result'], '') + + def test_method_not_allowed(self): + response = self.client.get( + '/', + content_type='application/json', + ) + self.assertEqual(response.status_code, 405, "Should allow only POST") + + def test_parse_error(self): + response = self.client.post( + '/', + data='{', + content_type='application/json', + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.data.decode('utf8')) + self.assertEqual(data['error']['code'], -32700) + self.assertEqual(data['error']['message'], 'Parse error') + + def test_wrong_content_type(self): + response = self.client.post( + '/', + data=self.REQUEST, + content_type='application/x-www-form-urlencoded', + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.data.decode('utf8')) + self.assertEqual(data['error']['code'], -32700) + self.assertEqual(data['error']['message'], 'Parse error') + + def test_invalid_request(self): + response = self.client.post( + '/', + data='{"method": "dummy", "id": 1}', + content_type='application/json', + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.data.decode('utf8')) + self.assertEqual(data['error']['code'], -32600) + self.assertEqual(data['error']['message'], 'Invalid Request') + + def test_method_not_found(self): + data = { + "jsonrpc": "2.0", + "method": "dummy2", + "id": 1 + } + response = self.client.post( + '/', + data=json.dumps(data), + content_type='application/json', + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.data.decode('utf8')) + self.assertEqual(data['error']['code'], -32601) + self.assertEqual(data['error']['message'], 'Method not found') + + def test_invalid_parameters(self): + data = { + "jsonrpc": "2.0", + "method": "dummy", + "params": [42], + "id": 1 + } + response = self.client.post( + '/', + data=json.dumps(data), + content_type='application/json', + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.data.decode('utf8')) + self.assertEqual(data['error']['code'], -32602) + self.assertEqual(data['error']['message'], 'Invalid params') + + def test_resource_map(self): + response = self.client.get('/map') + self.assertEqual(response.status_code, 200) + self.assertTrue("JSON-RPC map" in response.data.decode('utf8')) + + def test_method_not_allowed_prefix(self): + response = self.client.get( + '/', + content_type='application/json', + ) + self.assertEqual(response.status_code, 405) + + def test_resource_map_prefix(self): + response = self.client.get('/map') + self.assertEqual(response.status_code, 200) + + def test_as_view(self): + api = JSONRPCAPI() + with patch.object(api, 'jsonrpc') as mock_jsonrpc: + self.assertIs(api.as_view(), mock_jsonrpc) + + def test_not_check_content_type(self): + client = self._get_test_client(JSONRPCAPI(check_content_type=False)) + response = client.post( + '/', + data=self.REQUEST, + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.data.decode('utf8')) + self.assertEqual(data['result'], '') + + def test_check_content_type(self): + client = self._get_test_client(JSONRPCAPI(check_content_type=False)) + response = client.post( + '/', + data=self.REQUEST, + content_type="application/x-www-form-urlencoded" + ) + self.assertEqual(response.status_code, 200) + data = json.loads(response.data.decode('utf8')) + self.assertEqual(data['result'], '') + + def test_empty_initial_dispatcher(self): + class SubDispatcher(type(api.dispatcher)): + pass + + custom_dispatcher = SubDispatcher() + custom_api = JSONRPCAPI(custom_dispatcher) + self.assertEqual(type(custom_api.dispatcher), SubDispatcher) + self.assertEqual(id(custom_api.dispatcher), id(custom_dispatcher)) diff --git a/pyextra/jsonrpc/tests/test_base.py b/pyextra/jsonrpc/tests/test_base.py new file mode 100644 index 00000000000000..6a0ff85b058219 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_base.py @@ -0,0 +1,39 @@ +""" Test base JSON-RPC classes.""" +import sys + +from ..base import JSONRPCBaseRequest, JSONRPCBaseResponse + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +class TestJSONRPCBaseRequest(unittest.TestCase): + + """ Test JSONRPCBaseRequest functionality.""" + + def test_data(self): + request = JSONRPCBaseRequest() + self.assertEqual(request.data, {}) + + with self.assertRaises(ValueError): + request.data = [] + + with self.assertRaises(ValueError): + request.data = None + + +class TestJSONRPCBaseResponse(unittest.TestCase): + + """ Test JSONRPCBaseResponse functionality.""" + + def test_data(self): + response = JSONRPCBaseResponse(result="") + self.assertEqual(response.data, {}) + + with self.assertRaises(ValueError): + response.data = [] + + with self.assertRaises(ValueError): + response.data = None diff --git a/pyextra/jsonrpc/tests/test_bug29.py b/pyextra/jsonrpc/tests/test_bug29.py new file mode 100644 index 00000000000000..7019bce3ba87af --- /dev/null +++ b/pyextra/jsonrpc/tests/test_bug29.py @@ -0,0 +1,34 @@ +""" Exmples of usage with tests. + +Tests in this file represent examples taken from JSON-RPC specification. +http://www.jsonrpc.org/specification#examples + +""" +import sys +import json + +from ..manager import JSONRPCResponseManager + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +def isjsonequal(json1, json2): + return json.loads(json1) == json.loads(json2) + + +class TestJSONRPCExamples(unittest.TestCase): + def setUp(self): + self.dispatcher = { + "return_none": lambda: None, + } + + def test_none_as_result(self): + req = '{"jsonrpc": "2.0", "method": "return_none", "id": 0}' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "result": null, "id": 0}' + )) diff --git a/pyextra/jsonrpc/tests/test_dispatcher.py b/pyextra/jsonrpc/tests/test_dispatcher.py new file mode 100644 index 00000000000000..888526ff601920 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_dispatcher.py @@ -0,0 +1,142 @@ +from ..dispatcher import Dispatcher +import sys +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +class Math: + + def sum(self, a, b): + return a + b + + def diff(self, a, b): + return a - b + + +class TestDispatcher(unittest.TestCase): + + """ Test Dispatcher functionality.""" + + def test_getter(self): + d = Dispatcher() + + with self.assertRaises(KeyError): + d["method"] + + d["add"] = lambda *args: sum(args) + self.assertEqual(d["add"](1, 1), 2) + + def test_in(self): + d = Dispatcher() + d["method"] = lambda: "" + self.assertIn("method", d) + + def test_add_method(self): + d = Dispatcher() + + @d.add_method + def add(x, y): + return x + y + + self.assertIn("add", d) + self.assertEqual(d["add"](1, 1), 2) + + def test_add_method_with_name(self): + d = Dispatcher() + + @d.add_method(name="this.add") + def add(x, y): + return x + y + + self.assertNotIn("add", d) + self.assertIn("this.add", d) + self.assertEqual(d["this.add"](1, 1), 2) + + def test_add_class(self): + d = Dispatcher() + d.add_class(Math) + + self.assertIn("math.sum", d) + self.assertIn("math.diff", d) + self.assertEqual(d["math.sum"](3, 8), 11) + self.assertEqual(d["math.diff"](6, 9), -3) + + def test_add_object(self): + d = Dispatcher() + d.add_object(Math()) + + self.assertIn("math.sum", d) + self.assertIn("math.diff", d) + self.assertEqual(d["math.sum"](5, 2), 7) + self.assertEqual(d["math.diff"](15, 9), 6) + + def test_add_dict(self): + d = Dispatcher() + d.add_dict({"sum": lambda *args: sum(args)}, "util") + + self.assertIn("util.sum", d) + self.assertEqual(d["util.sum"](13, -2), 11) + + def test_add_method_keep_function_definitions(self): + + d = Dispatcher() + + @d.add_method + def one(x): + return x + + self.assertIsNotNone(one) + + def test_del_method(self): + d = Dispatcher() + d["method"] = lambda: "" + self.assertIn("method", d) + + del d["method"] + self.assertNotIn("method", d) + + def test_to_dict(self): + d = Dispatcher() + + def func(): + return "" + + d["method"] = func + self.assertEqual(dict(d), {"method": func}) + + def test_init_from_object_instance(self): + + class Dummy(): + + def one(self): + pass + + def two(self): + pass + + dummy = Dummy() + + d = Dispatcher(dummy) + + self.assertIn("one", d) + self.assertIn("two", d) + self.assertNotIn("__class__", d) + + def test_init_from_dictionary(self): + + dummy = { + 'one': lambda x: x, + 'two': lambda x: x, + } + + d = Dispatcher(dummy) + + self.assertIn("one", d) + self.assertIn("two", d) + + def test_dispatcher_representation(self): + + d = Dispatcher() + self.assertEqual('{}', repr(d)) diff --git a/pyextra/jsonrpc/tests/test_examples20.py b/pyextra/jsonrpc/tests/test_examples20.py new file mode 100644 index 00000000000000..42d10fd91c6e72 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_examples20.py @@ -0,0 +1,206 @@ +""" Exmples of usage with tests. + +Tests in this file represent examples taken from JSON-RPC specification. +http://www.jsonrpc.org/specification#examples + +""" +import sys +import json + +from ..manager import JSONRPCResponseManager +from ..jsonrpc2 import JSONRPC20Request, JSONRPC20BatchRequest + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +def isjsonequal(json1, json2): + return json.loads(json1) == json.loads(json2) + + +class TestJSONRPCExamples(unittest.TestCase): + def setUp(self): + self.dispatcher = { + "subtract": lambda a, b: a - b, + } + + def test_rpc_call_with_positional_parameters(self): + req = '{"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1}' # noqa + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "result": 19, "id": 1}' + )) + + req = '{"jsonrpc": "2.0", "method": "subtract", "params": [23, 42], "id": 2}' # noqa + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "result": -19, "id": 2}' + )) + + def test_rpc_call_with_named_parameters(self): + def subtract(minuend=None, subtrahend=None): + return minuend - subtrahend + + dispatcher = { + "subtract": subtract, + "sum": lambda *args: sum(args), + "get_data": lambda: ["hello", 5], + } + + req = '{"jsonrpc": "2.0", "method": "subtract", "params": {"subtrahend": 23, "minuend": 42}, "id": 3}' # noqa + response = JSONRPCResponseManager.handle(req, dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "result": 19, "id": 3}' + )) + + req = '{"jsonrpc": "2.0", "method": "subtract", "params": {"minuend": 42, "subtrahend": 23}, "id": 4}' # noqa + response = JSONRPCResponseManager.handle(req, dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "result": 19, "id": 4}', + )) + + def test_notification(self): + req = '{"jsonrpc": "2.0", "method": "update", "params": [1,2,3,4,5]}' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertEqual(response, None) + + req = '{"jsonrpc": "2.0", "method": "foobar"}' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertEqual(response, None) + + def test_rpc_call_of_non_existent_method(self): + req = '{"jsonrpc": "2.0", "method": "foobar", "id": "1"}' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found"}, "id": "1"}' # noqa + )) + + def test_rpc_call_with_invalid_json(self): + req = '{"jsonrpc": "2.0", "method": "foobar, "params": "bar", "baz]' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null}' # noqa + )) + + def test_rpc_call_with_invalid_request_object(self): + req = '{"jsonrpc": "2.0", "method": 1, "params": "bar"}' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}' # noqa + )) + + def test_rpc_call_batch_invalid_json(self): + req = """[ + {"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"}, + {"jsonrpc": "2.0", "method" + ]""" + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null}' # noqa + )) + + def test_rpc_call_with_an_empty_array(self): + req = '[]' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}' # noqa + )) + + def test_rpc_call_with_rpc_call_with_an_invalid_batch_but_not_empty(self): + req = '[1]' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isjsonequal( + response.json, + '{"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}' # noqa + )) + + def test_rpc_call_with_invalid_batch(self): + req = '[1,2,3]' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue( + response, + json.loads("""[ + {"jsonrpc": "2.0", "error": {"code": -32600, + "message": "Invalid Request"}, "id": null}, + {"jsonrpc": "2.0", "error": {"code": -32600, + "message": "Invalid Request"}, "id": null}, + {"jsonrpc": "2.0", "error": {"code": -32600, + "message": "Invalid Request"}, "id": null} + ]""") + ) + + def test_rpc_call_batch(self): + req = """[ + {"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"}, + {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]}, + {"jsonrpc": "2.0", "method": "subtract", + "params": [42,23], "id": "2"}, + {"foo": "boo"}, + {"jsonrpc": "2.0", "method": "foo.get", + "params": {"name": "myself"}, "id": "5"}, + {"jsonrpc": "2.0", "method": "get_data", "id": "9"} + ]""" + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue( + response, + json.loads("""[ + {"jsonrpc": "2.0", "result": 7, "id": "1"}, + {"jsonrpc": "2.0", "result": 19, "id": "2"}, + {"jsonrpc": "2.0", "error": {"code": -32600, + "message": "Invalid Request"}, "id": null}, + {"jsonrpc": "2.0", "error": {"code": -32601, + "message": "Method not found"}, "id": "5"}, + {"jsonrpc": "2.0", "result": ["hello", 5], "id": "9"} + ]""") + ) + + def test_rpc_call_batch_all_notifications(self): + req = """[ + {"jsonrpc": "2.0", "method": "notify_sum", "params": [1,2,4]}, + {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]} + ]""" + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertEqual(response, None) + + def test_rpc_call_response_request(self): + req = '{"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1}' # noqa + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isinstance( + response.request, + JSONRPC20Request + )) + self.assertTrue(isjsonequal( + response.request.json, + req + )) + + def test_rpc_call_response_request_batch(self): + req = """[ + {"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"}, + {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]}, + {"jsonrpc": "2.0", "method": "subtract", + "params": [42,23], "id": "2"}, + {"jsonrpc": "2.0", "method": "foo.get", + "params": {"name": "myself"}, "id": "5"}, + {"jsonrpc": "2.0", "method": "get_data", "id": "9"} + ]""" + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isinstance( + response.request, + JSONRPC20BatchRequest + )) + self.assertTrue(isjsonequal( + response.request.json, + req + )) diff --git a/pyextra/jsonrpc/tests/test_jsonrpc.py b/pyextra/jsonrpc/tests/test_jsonrpc.py new file mode 100644 index 00000000000000..820ee3111f5129 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_jsonrpc.py @@ -0,0 +1 @@ +""" Tets base JSON-RPC structures.""" diff --git a/pyextra/jsonrpc/tests/test_jsonrpc1.py b/pyextra/jsonrpc/tests/test_jsonrpc1.py new file mode 100644 index 00000000000000..c66f045451a717 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_jsonrpc1.py @@ -0,0 +1,429 @@ +import json +import sys + +from ..exceptions import JSONRPCInvalidRequestException +from ..jsonrpc1 import ( + JSONRPC10Request, + JSONRPC10Response, +) + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +class TestJSONRPC10Request(unittest.TestCase): + + """ Test JSONRPC10Request functionality.""" + + def setUp(self): + self.request_params = { + "method": "add", + "params": [1, 2], + "_id": 1, + } + + def test_correct_init(self): + """ Test object is created.""" + JSONRPC10Request(**self.request_params) + + def test_validation_incorrect_no_parameters(self): + with self.assertRaises(ValueError): + JSONRPC10Request() + + def test_method_validation_str(self): + self.request_params.update({"method": "add"}) + JSONRPC10Request(**self.request_params) + + def test_method_validation_not_str(self): + self.request_params.update({"method": []}) + with self.assertRaises(ValueError): + JSONRPC10Request(**self.request_params) + + self.request_params.update({"method": {}}) + with self.assertRaises(ValueError): + JSONRPC10Request(**self.request_params) + + self.request_params.update({"method": None}) + with self.assertRaises(ValueError): + JSONRPC10Request(**self.request_params) + + def test_params_validation_list(self): + self.request_params.update({"params": []}) + JSONRPC10Request(**self.request_params) + + self.request_params.update({"params": [0]}) + JSONRPC10Request(**self.request_params) + + def test_params_validation_tuple(self): + self.request_params.update({"params": ()}) + JSONRPC10Request(**self.request_params) + + self.request_params.update({"params": tuple([0])}) + JSONRPC10Request(**self.request_params) + + def test_params_validation_dict(self): + self.request_params.update({"params": {}}) + with self.assertRaises(ValueError): + JSONRPC10Request(**self.request_params) + + self.request_params.update({"params": {"a": 0}}) + with self.assertRaises(ValueError): + JSONRPC10Request(**self.request_params) + + def test_params_validation_none(self): + self.request_params.update({"params": None}) + with self.assertRaises(ValueError): + JSONRPC10Request(**self.request_params) + + def test_params_validation_incorrect(self): + self.request_params.update({"params": "str"}) + with self.assertRaises(ValueError): + JSONRPC10Request(**self.request_params) + + def test_request_args(self): + self.assertEqual(JSONRPC10Request("add", []).args, ()) + self.assertEqual(JSONRPC10Request("add", [1, 2]).args, (1, 2)) + + def test_id_validation_string(self): + self.request_params.update({"_id": "id"}) + JSONRPC10Request(**self.request_params) + + def test_id_validation_int(self): + self.request_params.update({"_id": 0}) + JSONRPC10Request(**self.request_params) + + def test_id_validation_null(self): + self.request_params.update({"_id": "null"}) + JSONRPC10Request(**self.request_params) + + def test_id_validation_none(self): + self.request_params.update({"_id": None}) + JSONRPC10Request(**self.request_params) + + def test_id_validation_float(self): + self.request_params.update({"_id": 0.1}) + JSONRPC10Request(**self.request_params) + + def test_id_validation_list_tuple(self): + self.request_params.update({"_id": []}) + JSONRPC10Request(**self.request_params) + + self.request_params.update({"_id": ()}) + JSONRPC10Request(**self.request_params) + + def test_id_validation_default_id_none(self): + del self.request_params["_id"] + JSONRPC10Request(**self.request_params) + + def test_data_method_1(self): + r = JSONRPC10Request("add", []) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": None, + }) + + def test_data_method_2(self): + r = JSONRPC10Request(method="add", params=[]) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": None, + }) + + def test_data_params_1(self): + r = JSONRPC10Request("add", params=[], _id=None) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": None, + }) + + def test_data_params_2(self): + r = JSONRPC10Request("add", ()) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": None, + }) + + def test_data_params_3(self): + r = JSONRPC10Request("add", (1, 2)) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [1, 2], + "id": None, + }) + + def test_data_id_1(self): + r = JSONRPC10Request("add", [], _id="null") + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": "null", + }) + + def test_data_id_1_notification(self): + r = JSONRPC10Request("add", [], _id="null", is_notification=True) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": None, + }) + + def test_data_id_2(self): + r = JSONRPC10Request("add", [], _id=None) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": None, + }) + + def test_data_id_2_notification(self): + r = JSONRPC10Request("add", [], _id=None, is_notification=True) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": None, + }) + + def test_data_id_3(self): + r = JSONRPC10Request("add", [], _id="id") + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": "id", + }) + + def test_data_id_3_notification(self): + r = JSONRPC10Request("add", [], _id="id", is_notification=True) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": None, + }) + + def test_data_id_4(self): + r = JSONRPC10Request("add", [], _id=0) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": 0, + }) + + def test_data_id_4_notification(self): + r = JSONRPC10Request("add", [], _id=0, is_notification=True) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "method": "add", + "params": [], + "id": None, + }) + + def test_is_notification(self): + r = JSONRPC10Request("add", []) + self.assertTrue(r.is_notification) + + r = JSONRPC10Request("add", [], _id=None) + self.assertTrue(r.is_notification) + + r = JSONRPC10Request("add", [], _id="null") + self.assertFalse(r.is_notification) + + r = JSONRPC10Request("add", [], _id=0) + self.assertFalse(r.is_notification) + + r = JSONRPC10Request("add", [], is_notification=True) + self.assertTrue(r.is_notification) + + r = JSONRPC10Request("add", [], is_notification=True, _id=None) + self.assertTrue(r.is_notification) + + r = JSONRPC10Request("add", [], is_notification=True, _id=0) + self.assertTrue(r.is_notification) + + def test_set_unset_notification_keep_id(self): + r = JSONRPC10Request("add", [], is_notification=True, _id=0) + self.assertTrue(r.is_notification) + self.assertEqual(r.data["id"], None) + + r.is_notification = False + self.assertFalse(r.is_notification) + self.assertEqual(r.data["id"], 0) + + def test_error_if_notification_true_but_id_none(self): + r = JSONRPC10Request("add", [], is_notification=True, _id=None) + with self.assertRaises(ValueError): + r.is_notification = False + + def test_from_json_invalid_request_method(self): + str_json = json.dumps({ + "params": [1, 2], + "id": 0, + }) + + with self.assertRaises(JSONRPCInvalidRequestException): + JSONRPC10Request.from_json(str_json) + + def test_from_json_invalid_request_params(self): + str_json = json.dumps({ + "method": "add", + "id": 0, + }) + + with self.assertRaises(JSONRPCInvalidRequestException): + JSONRPC10Request.from_json(str_json) + + def test_from_json_invalid_request_id(self): + str_json = json.dumps({ + "method": "add", + "params": [1, 2], + }) + + with self.assertRaises(JSONRPCInvalidRequestException): + JSONRPC10Request.from_json(str_json) + + def test_from_json_invalid_request_extra_data(self): + str_json = json.dumps({ + "method": "add", + "params": [1, 2], + "id": 0, + "is_notification": True, + }) + + with self.assertRaises(JSONRPCInvalidRequestException): + JSONRPC10Request.from_json(str_json) + + def test_from_json_request(self): + str_json = json.dumps({ + "method": "add", + "params": [1, 2], + "id": 0, + }) + + request = JSONRPC10Request.from_json(str_json) + self.assertTrue(isinstance(request, JSONRPC10Request)) + self.assertEqual(request.method, "add") + self.assertEqual(request.params, [1, 2]) + self.assertEqual(request._id, 0) + self.assertFalse(request.is_notification) + + def test_from_json_request_notification(self): + str_json = json.dumps({ + "method": "add", + "params": [1, 2], + "id": None, + }) + + request = JSONRPC10Request.from_json(str_json) + self.assertTrue(isinstance(request, JSONRPC10Request)) + self.assertEqual(request.method, "add") + self.assertEqual(request.params, [1, 2]) + self.assertEqual(request._id, None) + self.assertTrue(request.is_notification) + + def test_from_json_string_not_dict(self): + with self.assertRaises(ValueError): + JSONRPC10Request.from_json("[]") + + with self.assertRaises(ValueError): + JSONRPC10Request.from_json("0") + + def test_data_setter(self): + request = JSONRPC10Request(**self.request_params) + with self.assertRaises(ValueError): + request.data = [] + + with self.assertRaises(ValueError): + request.data = "" + + with self.assertRaises(ValueError): + request.data = None + + +class TestJSONRPC10Response(unittest.TestCase): + + """ Test JSONRPC10Response functionality.""" + + def setUp(self): + self.response_success_params = { + "result": "", + "error": None, + "_id": 1, + } + self.response_error_params = { + "result": None, + "error": { + "code": 1, + "message": "error", + }, + "_id": 1, + } + + def test_correct_init(self): + """ Test object is created.""" + JSONRPC10Response(**self.response_success_params) + JSONRPC10Response(**self.response_error_params) + + def test_validation_incorrect_no_parameters(self): + with self.assertRaises(ValueError): + JSONRPC10Response() + + def test_validation_success_incorrect(self): + wrong_params = self.response_success_params + del wrong_params["_id"] + with self.assertRaises(ValueError): + JSONRPC10Response(**wrong_params) + + def test_validation_error_incorrect(self): + wrong_params = self.response_error_params + del wrong_params["_id"] + with self.assertRaises(ValueError): + JSONRPC10Response(**wrong_params) + + def _test_validation_incorrect_result_and_error(self): + # @todo: remove + # It is OK because result is an mepty string, it is still result + with self.assertRaises(ValueError): + JSONRPC10Response(result="", error="", _id=0) + + response = JSONRPC10Response(error="", _id=0) + with self.assertRaises(ValueError): + response.result = "" + + def test_data(self): + r = JSONRPC10Response(result="", _id=0) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "result": "", + "id": 0, + }) + + def test_data_setter(self): + response = JSONRPC10Response(**self.response_success_params) + with self.assertRaises(ValueError): + response.data = [] + + with self.assertRaises(ValueError): + response.data = "" + + with self.assertRaises(ValueError): + response.data = None + + def test_validation_id(self): + response = JSONRPC10Response(**self.response_success_params) + self.assertEqual(response._id, self.response_success_params["_id"]) diff --git a/pyextra/jsonrpc/tests/test_jsonrpc2.py b/pyextra/jsonrpc/tests/test_jsonrpc2.py new file mode 100644 index 00000000000000..32c1639ab334f0 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_jsonrpc2.py @@ -0,0 +1,728 @@ +import json +import sys + +from ..exceptions import JSONRPCInvalidRequestException +from ..jsonrpc2 import ( + JSONRPC20Request, + JSONRPC20BatchRequest, + JSONRPC20Response, + JSONRPC20BatchResponse, +) + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +class TestJSONRPC20Request(unittest.TestCase): + + """ Test JSONRPC20Request functionality.""" + + def setUp(self): + self.request_params = { + "method": "add", + "params": [1, 2], + "_id": 1, + } + + def test_correct_init(self): + """ Test object is created.""" + JSONRPC20Request(**self.request_params) + + def test_validation_incorrect_no_parameters(self): + with self.assertRaises(ValueError): + JSONRPC20Request() + + def test_method_validation_str(self): + self.request_params.update({"method": "add"}) + JSONRPC20Request(**self.request_params) + + def test_method_validation_not_str(self): + self.request_params.update({"method": []}) + with self.assertRaises(ValueError): + JSONRPC20Request(**self.request_params) + + self.request_params.update({"method": {}}) + with self.assertRaises(ValueError): + JSONRPC20Request(**self.request_params) + + def test_method_validation_str_rpc_prefix(self): + """ Test method SHOULD NOT starts with rpc. """ + self.request_params.update({"method": "rpc."}) + with self.assertRaises(ValueError): + JSONRPC20Request(**self.request_params) + + self.request_params.update({"method": "rpc.test"}) + with self.assertRaises(ValueError): + JSONRPC20Request(**self.request_params) + + self.request_params.update({"method": "rpccorrect"}) + JSONRPC20Request(**self.request_params) + + self.request_params.update({"method": "rpc"}) + JSONRPC20Request(**self.request_params) + + def test_params_validation_list(self): + self.request_params.update({"params": []}) + JSONRPC20Request(**self.request_params) + + self.request_params.update({"params": [0]}) + JSONRPC20Request(**self.request_params) + + def test_params_validation_tuple(self): + self.request_params.update({"params": ()}) + JSONRPC20Request(**self.request_params) + + self.request_params.update({"params": tuple([0])}) + JSONRPC20Request(**self.request_params) + + def test_params_validation_dict(self): + self.request_params.update({"params": {}}) + JSONRPC20Request(**self.request_params) + + self.request_params.update({"params": {"a": 0}}) + JSONRPC20Request(**self.request_params) + + def test_params_validation_none(self): + self.request_params.update({"params": None}) + JSONRPC20Request(**self.request_params) + + def test_params_validation_incorrect(self): + self.request_params.update({"params": "str"}) + with self.assertRaises(ValueError): + JSONRPC20Request(**self.request_params) + + def test_request_args(self): + self.assertEqual(JSONRPC20Request("add").args, ()) + self.assertEqual(JSONRPC20Request("add", []).args, ()) + self.assertEqual(JSONRPC20Request("add", {"a": 1}).args, ()) + self.assertEqual(JSONRPC20Request("add", [1, 2]).args, (1, 2)) + + def test_request_kwargs(self): + self.assertEqual(JSONRPC20Request("add").kwargs, {}) + self.assertEqual(JSONRPC20Request("add", [1, 2]).kwargs, {}) + self.assertEqual(JSONRPC20Request("add", {}).kwargs, {}) + self.assertEqual(JSONRPC20Request("add", {"a": 1}).kwargs, {"a": 1}) + + def test_id_validation_string(self): + self.request_params.update({"_id": "id"}) + JSONRPC20Request(**self.request_params) + + def test_id_validation_int(self): + self.request_params.update({"_id": 0}) + JSONRPC20Request(**self.request_params) + + def test_id_validation_null(self): + self.request_params.update({"_id": "null"}) + JSONRPC20Request(**self.request_params) + + def test_id_validation_none(self): + self.request_params.update({"_id": None}) + JSONRPC20Request(**self.request_params) + + def test_id_validation_float(self): + self.request_params.update({"_id": 0.1}) + with self.assertRaises(ValueError): + JSONRPC20Request(**self.request_params) + + def test_id_validation_incorrect(self): + self.request_params.update({"_id": []}) + with self.assertRaises(ValueError): + JSONRPC20Request(**self.request_params) + + self.request_params.update({"_id": ()}) + with self.assertRaises(ValueError): + JSONRPC20Request(**self.request_params) + + def test_data_method_1(self): + r = JSONRPC20Request("add") + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "id": None, + }) + + def test_data_method_2(self): + r = JSONRPC20Request(method="add") + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "id": None, + }) + + def test_data_method_3(self): + r = JSONRPC20Request("add", None) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "id": None, + }) + + def test_data_params_1(self): + r = JSONRPC20Request("add", params=None, _id=None) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "id": None, + }) + + def test_data_params_2(self): + r = JSONRPC20Request("add", []) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "params": [], + "id": None, + }) + + def test_data_params_3(self): + r = JSONRPC20Request("add", ()) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "params": [], + "id": None, + }) + + def test_data_params_4(self): + r = JSONRPC20Request("add", (1, 2)) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "params": [1, 2], + "id": None, + }) + + def test_data_params_5(self): + r = JSONRPC20Request("add", {"a": 0}) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "params": {"a": 0}, + "id": None, + }) + + def test_data_id_1(self): + r = JSONRPC20Request("add", _id="null") + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "id": "null", + }) + + def test_data_id_1_notification(self): + r = JSONRPC20Request("add", _id="null", is_notification=True) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + }) + + def test_data_id_2(self): + r = JSONRPC20Request("add", _id=None) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "id": None, + }) + + def test_data_id_2_notification(self): + r = JSONRPC20Request("add", _id=None, is_notification=True) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + }) + + def test_data_id_3(self): + r = JSONRPC20Request("add", _id="id") + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "id": "id", + }) + + def test_data_id_3_notification(self): + r = JSONRPC20Request("add", _id="id", is_notification=True) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + }) + + def test_data_id_4(self): + r = JSONRPC20Request("add", _id=0) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + "id": 0, + }) + + def test_data_id_4_notification(self): + r = JSONRPC20Request("add", _id=0, is_notification=True) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "method": "add", + }) + + def test_is_notification(self): + r = JSONRPC20Request("add") + self.assertFalse(r.is_notification) + + r = JSONRPC20Request("add", _id=None) + self.assertFalse(r.is_notification) + + r = JSONRPC20Request("add", _id="null") + self.assertFalse(r.is_notification) + + r = JSONRPC20Request("add", _id=0) + self.assertFalse(r.is_notification) + + r = JSONRPC20Request("add", is_notification=True) + self.assertTrue(r.is_notification) + + r = JSONRPC20Request("add", is_notification=True, _id=None) + self.assertTrue(r.is_notification) + self.assertNotIn("id", r.data) + + r = JSONRPC20Request("add", is_notification=True, _id=0) + self.assertTrue(r.is_notification) + self.assertNotIn("id", r.data) + + def test_set_unset_notification_keep_id(self): + r = JSONRPC20Request("add", is_notification=True, _id=0) + self.assertTrue(r.is_notification) + self.assertFalse("id" in r.data) + + r.is_notification = False + self.assertFalse(r.is_notification) + self.assertTrue("id" in r.data) + self.assertEqual(r.data["id"], 0) + + def test_serialize_method_1(self): + r = JSONRPC20Request("add") + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "id": None, + }, json.loads(r.json)) + + def test_serialize_method_2(self): + r = JSONRPC20Request(method="add") + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "id": None, + }, json.loads(r.json)) + + def test_serialize_method_3(self): + r = JSONRPC20Request("add", None) + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "id": None, + }, json.loads(r.json)) + + def test_serialize_params_1(self): + r = JSONRPC20Request("add", params=None, _id=None) + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "id": None, + }, json.loads(r.json)) + + def test_serialize_params_2(self): + r = JSONRPC20Request("add", []) + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "params": [], + "id": None, + }, json.loads(r.json)) + + def test_serialize_params_3(self): + r = JSONRPC20Request("add", ()) + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "params": [], + "id": None, + }, json.loads(r.json)) + + def test_serialize_params_4(self): + r = JSONRPC20Request("add", (1, 2)) + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "params": [1, 2], + "id": None, + }, json.loads(r.json)) + + def test_serialize_params_5(self): + r = JSONRPC20Request("add", {"a": 0}) + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "params": {"a": 0}, + "id": None, + }, json.loads(r.json)) + + def test_serialize_id_1(self): + r = JSONRPC20Request("add", _id="null") + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "id": "null", + }, json.loads(r.json)) + + def test_serialize_id_2(self): + r = JSONRPC20Request("add", _id=None) + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "id": None, + }, json.loads(r.json)) + + def test_serialize_id_3(self): + r = JSONRPC20Request("add", _id="id") + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "id": "id", + }, json.loads(r.json)) + + def test_serialize_id_4(self): + r = JSONRPC20Request("add", _id=0) + self.assertTrue({ + "jsonrpc": "2.0", + "method": "add", + "id": 0, + }, json.loads(r.json)) + + def test_from_json_request_no_id(self): + str_json = json.dumps({ + "method": "add", + "params": [1, 2], + "jsonrpc": "2.0", + }) + + request = JSONRPC20Request.from_json(str_json) + self.assertTrue(isinstance(request, JSONRPC20Request)) + self.assertEqual(request.method, "add") + self.assertEqual(request.params, [1, 2]) + self.assertEqual(request._id, None) + self.assertTrue(request.is_notification) + + def test_from_json_request_no_params(self): + str_json = json.dumps({ + "method": "add", + "jsonrpc": "2.0", + }) + + request = JSONRPC20Request.from_json(str_json) + self.assertTrue(isinstance(request, JSONRPC20Request)) + self.assertEqual(request.method, "add") + self.assertEqual(request.params, None) + self.assertEqual(request._id, None) + self.assertTrue(request.is_notification) + + def test_from_json_request_null_id(self): + str_json = json.dumps({ + "method": "add", + "jsonrpc": "2.0", + "id": None, + }) + + request = JSONRPC20Request.from_json(str_json) + self.assertTrue(isinstance(request, JSONRPC20Request)) + self.assertEqual(request.method, "add") + self.assertEqual(request.params, None) + self.assertEqual(request._id, None) + self.assertFalse(request.is_notification) + + def test_from_json_request(self): + str_json = json.dumps({ + "method": "add", + "params": [0, 1], + "jsonrpc": "2.0", + "id": "id", + }) + + request = JSONRPC20Request.from_json(str_json) + self.assertTrue(isinstance(request, JSONRPC20Request)) + self.assertEqual(request.method, "add") + self.assertEqual(request.params, [0, 1]) + self.assertEqual(request._id, "id") + self.assertFalse(request.is_notification) + + def test_from_json_invalid_request_jsonrpc(self): + str_json = json.dumps({ + "method": "add", + }) + + with self.assertRaises(JSONRPCInvalidRequestException): + JSONRPC20Request.from_json(str_json) + + def test_from_json_invalid_request_method(self): + str_json = json.dumps({ + "jsonrpc": "2.0", + }) + + with self.assertRaises(JSONRPCInvalidRequestException): + JSONRPC20Request.from_json(str_json) + + def test_from_json_invalid_request_extra_data(self): + str_json = json.dumps({ + "jsonrpc": "2.0", + "method": "add", + "is_notification": True, + }) + + with self.assertRaises(JSONRPCInvalidRequestException): + JSONRPC20Request.from_json(str_json) + + def test_data_setter(self): + request = JSONRPC20Request(**self.request_params) + with self.assertRaises(ValueError): + request.data = [] + + with self.assertRaises(ValueError): + request.data = "" + + with self.assertRaises(ValueError): + request.data = None + + +class TestJSONRPC20BatchRequest(unittest.TestCase): + + """ Test JSONRPC20BatchRequest functionality.""" + + def test_batch_request(self): + request = JSONRPC20BatchRequest( + JSONRPC20Request("devide", {"num": 1, "denom": 2}, _id=1), + JSONRPC20Request("devide", {"num": 3, "denom": 2}, _id=2), + ) + self.assertEqual(json.loads(request.json), [ + {"method": "devide", "params": {"num": 1, "denom": 2}, "id": 1, + "jsonrpc": "2.0"}, + {"method": "devide", "params": {"num": 3, "denom": 2}, "id": 2, + "jsonrpc": "2.0"}, + ]) + + def test_from_json_batch(self): + str_json = json.dumps([ + {"method": "add", "params": [1, 2], "jsonrpc": "2.0"}, + {"method": "mul", "params": [1, 2], "jsonrpc": "2.0"}, + ]) + + requests = JSONRPC20BatchRequest.from_json(str_json) + self.assertTrue(isinstance(requests, JSONRPC20BatchRequest)) + for r in requests: + self.assertTrue(isinstance(r, JSONRPC20Request)) + self.assertTrue(r.method in ["add", "mul"]) + self.assertEqual(r.params, [1, 2]) + self.assertEqual(r._id, None) + self.assertTrue(r.is_notification) + + def test_from_json_batch_one(self): + str_json = json.dumps([ + {"method": "add", "params": [1, 2], "jsonrpc": "2.0", "id": None}, + ]) + + requests = JSONRPC20Request.from_json(str_json) + self.assertTrue(isinstance(requests, JSONRPC20BatchRequest)) + requests = list(requests) + self.assertEqual(len(requests), 1) + r = requests[0] + self.assertTrue(isinstance(r, JSONRPC20Request)) + self.assertEqual(r.method, "add") + self.assertEqual(r.params, [1, 2]) + self.assertEqual(r._id, None) + self.assertFalse(r.is_notification) + + def test_response_iterator(self): + requests = JSONRPC20BatchRequest( + JSONRPC20Request("devide", {"num": 1, "denom": 2}, _id=1), + JSONRPC20Request("devide", {"num": 3, "denom": 2}, _id=2), + ) + for request in requests: + self.assertTrue(isinstance(request, JSONRPC20Request)) + self.assertEqual(request.method, "devide") + + +class TestJSONRPC20Response(unittest.TestCase): + + """ Test JSONRPC20Response functionality.""" + + def setUp(self): + self.response_success_params = { + "result": "", + "_id": 1, + } + self.response_error_params = { + "error": { + "code": 1, + "message": "error", + }, + "_id": 1, + } + + def test_correct_init(self): + """ Test object is created.""" + JSONRPC20Response(**self.response_success_params) + + def test_validation_incorrect_no_parameters(self): + with self.assertRaises(ValueError): + JSONRPC20Response() + + def test_validation_incorrect_result_and_error(self): + response = JSONRPC20Response(error={"code": 1, "message": ""}) + with self.assertRaises(ValueError): + response.result = "" + + def test_validation_error_correct(self): + JSONRPC20Response(**self.response_error_params) + + def test_validation_error_incorrect(self): + self.response_error_params["error"].update({"code": "str"}) + with self.assertRaises(ValueError): + JSONRPC20Response(**self.response_error_params) + + def test_validation_error_incorrect_no_code(self): + del self.response_error_params["error"]["code"] + with self.assertRaises(ValueError): + JSONRPC20Response(**self.response_error_params) + + def test_validation_error_incorrect_no_message(self): + del self.response_error_params["error"]["message"] + with self.assertRaises(ValueError): + JSONRPC20Response(**self.response_error_params) + + def test_validation_error_incorrect_message_not_str(self): + self.response_error_params["error"].update({"message": 0}) + with self.assertRaises(ValueError): + JSONRPC20Response(**self.response_error_params) + + def test_validation_id(self): + response = JSONRPC20Response(**self.response_success_params) + self.assertEqual(response._id, self.response_success_params["_id"]) + + def test_validation_id_incorrect_type(self): + response = JSONRPC20Response(**self.response_success_params) + + with self.assertRaises(ValueError): + response._id = [] + + with self.assertRaises(ValueError): + response._id = {} + + with self.assertRaises(ValueError): + response._id = 0.1 + + def test_data_result(self): + r = JSONRPC20Response(result="") + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "result": "", + "id": None, + }) + + def test_data_result_id_none(self): + r = JSONRPC20Response(result="", _id=None) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "result": "", + "id": None, + }) + + def test_data_result_id(self): + r = JSONRPC20Response(result="", _id=0) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "result": "", + "id": 0, + }) + + def test_data_error(self): + r = JSONRPC20Response(error={"code": 0, "message": ""}) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "error": { + "code": 0, + "message": "", + }, + "id": None, + }) + + def test_data_error_id_none(self): + r = JSONRPC20Response(error={"code": 0, "message": ""}, _id=None) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "error": { + "code": 0, + "message": "", + }, + "id": None, + }) + + def test_data_error_id(self): + r = JSONRPC20Response(error={"code": 0, "message": ""}, _id=0) + self.assertEqual(json.loads(r.json), r.data) + self.assertEqual(r.data, { + "jsonrpc": "2.0", + "error": { + "code": 0, + "message": "", + }, + "id": 0, + }) + + def test_data_setter(self): + response = JSONRPC20Response(**self.response_success_params) + with self.assertRaises(ValueError): + response.data = [] + + with self.assertRaises(ValueError): + response.data = "" + + with self.assertRaises(ValueError): + response.data = None + + +class TestJSONRPC20BatchResponse(unittest.TestCase): + + """ Test JSONRPC20BatchResponse functionality.""" + + def test_batch_response(self): + response = JSONRPC20BatchResponse( + JSONRPC20Response(result="result", _id=1), + JSONRPC20Response(error={"code": 0, "message": ""}, _id=2), + ) + self.assertEqual(json.loads(response.json), [ + {"result": "result", "id": 1, "jsonrpc": "2.0"}, + {"error": {"code": 0, "message": ""}, "id": 2, "jsonrpc": "2.0"}, + ]) + + def test_response_iterator(self): + responses = JSONRPC20BatchResponse( + JSONRPC20Response(result="result", _id=1), + JSONRPC20Response(result="result", _id=2), + ) + for response in responses: + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.result, "result") + + def test_batch_response_data(self): + response = JSONRPC20BatchResponse( + JSONRPC20Response(result="result", _id=1), + JSONRPC20Response(result="result", _id=2), + JSONRPC20Response(result="result"), + ) + self.assertEqual(response.data, [ + {"id": 1, "jsonrpc": "2.0", "result": "result"}, + {"id": 2, "jsonrpc": "2.0", "result": "result"}, + {"id": None, "jsonrpc": "2.0", "result": "result"}, + ]) diff --git a/pyextra/jsonrpc/tests/test_jsonrpc_errors.py b/pyextra/jsonrpc/tests/test_jsonrpc_errors.py new file mode 100644 index 00000000000000..abc559fe0328d1 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_jsonrpc_errors.py @@ -0,0 +1,150 @@ +import json +import sys + +from ..exceptions import ( + JSONRPCError, + JSONRPCInternalError, + JSONRPCInvalidParams, + JSONRPCInvalidRequest, + JSONRPCMethodNotFound, + JSONRPCParseError, + JSONRPCServerError, + JSONRPCDispatchException, +) + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +class TestJSONRPCError(unittest.TestCase): + def setUp(self): + self.error_params = { + "code": 0, + "message": "", + } + + def test_correct_init(self): + """ Test object is created.""" + JSONRPCError(**self.error_params) + + def test_validation_incorrect_no_parameters(self): + with self.assertRaises(ValueError): + JSONRPCError() + + def test_code_validation_int(self): + self.error_params.update({"code": 32000}) + JSONRPCError(**self.error_params) + + def test_code_validation_no_code(self): + del self.error_params["code"] + with self.assertRaises(ValueError): + JSONRPCError(**self.error_params) + + def test_code_validation_str(self): + self.error_params.update({"code": "0"}) + with self.assertRaises(ValueError): + JSONRPCError(**self.error_params) + + def test_message_validation_str(self): + self.error_params.update({"message": ""}) + JSONRPCError(**self.error_params) + + def test_message_validation_none(self): + del self.error_params["message"] + with self.assertRaises(ValueError): + JSONRPCError(**self.error_params) + + def test_message_validation_int(self): + self.error_params.update({"message": 0}) + with self.assertRaises(ValueError): + JSONRPCError(**self.error_params) + + def test_data_validation_none(self): + self.error_params.update({"data": None}) + JSONRPCError(**self.error_params) + + def test_data_validation(self): + self.error_params.update({"data": {}}) + JSONRPCError(**self.error_params) + + self.error_params.update({"data": ""}) + JSONRPCError(**self.error_params) + + def test_json(self): + error = JSONRPCError(**self.error_params) + self.assertEqual( + json.loads(error.json), + self.error_params, + ) + + def test_from_json(self): + str_json = json.dumps({ + "code": 0, + "message": "", + "data": {}, + }) + + request = JSONRPCError.from_json(str_json) + self.assertTrue(isinstance(request, JSONRPCError)) + self.assertEqual(request.code, 0) + self.assertEqual(request.message, "") + self.assertEqual(request.data, {}) + + +class TestJSONRPCParseError(unittest.TestCase): + def test_code_message(self): + error = JSONRPCParseError() + self.assertEqual(error.code, -32700) + self.assertEqual(error.message, "Parse error") + self.assertEqual(error.data, None) + + +class TestJSONRPCServerError(unittest.TestCase): + def test_code_message(self): + error = JSONRPCServerError() + self.assertEqual(error.code, -32000) + self.assertEqual(error.message, "Server error") + self.assertEqual(error.data, None) + + +class TestJSONRPCInternalError(unittest.TestCase): + def test_code_message(self): + error = JSONRPCInternalError() + self.assertEqual(error.code, -32603) + self.assertEqual(error.message, "Internal error") + self.assertEqual(error.data, None) + + +class TestJSONRPCInvalidParams(unittest.TestCase): + def test_code_message(self): + error = JSONRPCInvalidParams() + self.assertEqual(error.code, -32602) + self.assertEqual(error.message, "Invalid params") + self.assertEqual(error.data, None) + + +class TestJSONRPCInvalidRequest(unittest.TestCase): + def test_code_message(self): + error = JSONRPCInvalidRequest() + self.assertEqual(error.code, -32600) + self.assertEqual(error.message, "Invalid Request") + self.assertEqual(error.data, None) + + +class TestJSONRPCMethodNotFound(unittest.TestCase): + def test_code_message(self): + error = JSONRPCMethodNotFound() + self.assertEqual(error.code, -32601) + self.assertEqual(error.message, "Method not found") + self.assertEqual(error.data, None) + + +class TestJSONRPCDispatchException(unittest.TestCase): + def test_code_message(self): + error = JSONRPCDispatchException(message="message", + code=400, data={"param": 1}) + self.assertEqual(error.error.code, 400) + self.assertEqual(error.error.message, "message") + self.assertEqual(error.error.data, {"param": 1}) diff --git a/pyextra/jsonrpc/tests/test_manager.py b/pyextra/jsonrpc/tests/test_manager.py new file mode 100644 index 00000000000000..bda108e1c21694 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_manager.py @@ -0,0 +1,175 @@ +import sys + +from ..manager import JSONRPCResponseManager +from ..jsonrpc2 import ( + JSONRPC20BatchRequest, + JSONRPC20BatchResponse, + JSONRPC20Request, + JSONRPC20Response, +) +from ..jsonrpc1 import JSONRPC10Request, JSONRPC10Response +from ..exceptions import JSONRPCDispatchException + +if sys.version_info < (3, 3): + from mock import MagicMock +else: + from unittest.mock import MagicMock + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +class TestJSONRPCResponseManager(unittest.TestCase): + def setUp(self): + def raise_(e): + raise e + + self.long_time_method = MagicMock() + self.dispatcher = { + "add": sum, + "multiply": lambda a, b: a * b, + "list_len": len, + "101_base": lambda **kwargs: int("101", **kwargs), + "error": lambda: raise_(KeyError("error_explanation")), + "type_error": lambda: raise_(TypeError("TypeError inside method")), + "long_time_method": self.long_time_method, + "dispatch_error": lambda x: raise_( + JSONRPCDispatchException(code=4000, message="error", + data={"param": 1})), + } + + def test_dispatch_error(self): + request = JSONRPC20Request("dispatch_error", ["test"], _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "error") + self.assertEqual(response.error["code"], 4000) + self.assertEqual(response.error["data"], {"param": 1}) + + def test_returned_type_response(self): + request = JSONRPC20Request("add", [[]], _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + + def test_returned_type_butch_response(self): + request = JSONRPC20BatchRequest( + JSONRPC20Request("add", [[]], _id=0)) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20BatchResponse)) + + def test_returned_type_response_rpc10(self): + request = JSONRPC10Request("add", [[]], _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC10Response)) + + def test_parse_error(self): + req = '{"jsonrpc": "2.0", "method": "foobar, "params": "bar", "baz]' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Parse error") + self.assertEqual(response.error["code"], -32700) + + def test_invalid_request(self): + req = '{"jsonrpc": "2.0", "method": 1, "params": "bar"}' + response = JSONRPCResponseManager.handle(req, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Invalid Request") + self.assertEqual(response.error["code"], -32600) + + def test_method_not_found(self): + request = JSONRPC20Request("does_not_exist", [[]], _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Method not found") + self.assertEqual(response.error["code"], -32601) + + def test_invalid_params(self): + request = JSONRPC20Request("add", {"a": 0}, _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Invalid params") + self.assertEqual(response.error["code"], -32602) + self.assertIn(response.error["data"]["message"], [ + 'sum() takes no keyword arguments', + "sum() got an unexpected keyword argument 'a'", + ]) + + def test_invalid_params_custom_function(self): + request = JSONRPC20Request("multiply", [0], _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Invalid params") + self.assertEqual(response.error["code"], -32602) + + request = JSONRPC20Request("multiply", [0, 1, 2], _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Invalid params") + self.assertEqual(response.error["code"], -32602) + + request = JSONRPC20Request("multiply", {"a": 1}, _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Invalid params") + self.assertEqual(response.error["code"], -32602) + + request = JSONRPC20Request("multiply", {"a": 1, "b": 2, "c": 3}, _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Invalid params") + self.assertEqual(response.error["code"], -32602) + + def test_server_error(self): + request = JSONRPC20Request("error", _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Server error") + self.assertEqual(response.error["code"], -32000) + self.assertEqual(response.error["data"]['type'], "KeyError") + self.assertEqual( + response.error["data"]['args'], ('error_explanation',)) + self.assertEqual( + response.error["data"]['message'], "'error_explanation'") + + def test_notification_calls_method(self): + request = JSONRPC20Request("long_time_method", is_notification=True) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertEqual(response, None) + self.long_time_method.assert_called_once_with() + + def test_notification_does_not_return_error_does_not_exist(self): + request = JSONRPC20Request("does_not_exist", is_notification=True) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertEqual(response, None) + + def test_notification_does_not_return_error_invalid_params(self): + request = JSONRPC20Request("add", {"a": 0}, is_notification=True) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertEqual(response, None) + + def test_notification_does_not_return_error(self): + request = JSONRPC20Request("error", is_notification=True) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertEqual(response, None) + + def test_type_error_inside_method(self): + request = JSONRPC20Request("type_error", _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Server error") + self.assertEqual(response.error["code"], -32000) + self.assertEqual(response.error["data"]['type'], "TypeError") + self.assertEqual( + response.error["data"]['args'], ('TypeError inside method',)) + self.assertEqual( + response.error["data"]['message'], 'TypeError inside method') + + def test_invalid_params_before_dispatcher_error(self): + request = JSONRPC20Request( + "dispatch_error", ["invalid", "params"], _id=0) + response = JSONRPCResponseManager.handle(request.json, self.dispatcher) + self.assertTrue(isinstance(response, JSONRPC20Response)) + self.assertEqual(response.error["message"], "Invalid params") + self.assertEqual(response.error["code"], -32602) diff --git a/pyextra/jsonrpc/tests/test_pep3107.py b/pyextra/jsonrpc/tests/test_pep3107.py new file mode 100644 index 00000000000000..6af14b72960ba2 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_pep3107.py @@ -0,0 +1,28 @@ +from ..manager import JSONRPCResponseManager + +import sys + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +class TestJSONRPCResponseManager(unittest.TestCase): + @unittest.skipIf(sys.version_info < (3, 5), "Test Py3.5+ functionality") + def test_typeerror_with_annotations(self): + """If a function has Python3 annotations and is called with improper + arguments, make sure the framework doesn't fail with inspect.getargspec + """ + from .py35_utils import distance + + dispatcher = { + "distance": distance, + } + + req = '{"jsonrpc": "2.0", "method": "distance", "params": [], "id": 1}' + result = JSONRPCResponseManager.handle(req, dispatcher) + + # Make sure this returns JSONRPCInvalidParams rather than raising + # UnboundLocalError + self.assertEqual(result.error['code'], -32602) diff --git a/pyextra/jsonrpc/tests/test_utils.py b/pyextra/jsonrpc/tests/test_utils.py new file mode 100644 index 00000000000000..9d0c76d8103902 --- /dev/null +++ b/pyextra/jsonrpc/tests/test_utils.py @@ -0,0 +1,130 @@ +""" Test utility functionality.""" +from ..utils import JSONSerializable, DatetimeDecimalEncoder, is_invalid_params + +import datetime +import decimal +import json +import sys + +if sys.version_info < (3, 3): + from mock import patch +else: + from unittest.mock import patch + +if sys.version_info < (2, 7): + import unittest2 as unittest +else: + import unittest + + +class TestJSONSerializable(unittest.TestCase): + + """ Test JSONSerializable functionality.""" + + def setUp(self): + class A(JSONSerializable): + @property + def json(self): + pass + + self._class = A + + def test_abstract_class(self): + with self.assertRaises(TypeError): + JSONSerializable() + + self._class() + + def test_definse_serialize_deserialize(self): + """ Test classmethods of inherited class.""" + self.assertEqual(self._class.serialize({}), "{}") + self.assertEqual(self._class.deserialize("{}"), {}) + + def test_from_json(self): + self.assertTrue(isinstance(self._class.from_json('{}'), self._class)) + + def test_from_json_incorrect(self): + with self.assertRaises(ValueError): + self._class.from_json('[]') + + +class TestDatetimeDecimalEncoder(unittest.TestCase): + + """ Test DatetimeDecimalEncoder functionality.""" + + def test_date_encoder(self): + obj = datetime.date.today() + + with self.assertRaises(TypeError): + json.dumps(obj) + + self.assertEqual( + json.dumps(obj, cls=DatetimeDecimalEncoder), + '"{0}"'.format(obj.isoformat()), + ) + + def test_datetime_encoder(self): + obj = datetime.datetime.now() + + with self.assertRaises(TypeError): + json.dumps(obj) + + self.assertEqual( + json.dumps(obj, cls=DatetimeDecimalEncoder), + '"{0}"'.format(obj.isoformat()), + ) + + def test_decimal_encoder(self): + obj = decimal.Decimal('0.1') + + with self.assertRaises(TypeError): + json.dumps(obj) + + result = json.dumps(obj, cls=DatetimeDecimalEncoder) + self.assertTrue(isinstance(result, str)) + self.assertEqual(float(result), float(0.1)) + + def test_default(self): + encoder = DatetimeDecimalEncoder() + with patch.object(json.JSONEncoder, 'default') as json_default: + encoder.default("") + + self.assertEqual(json_default.call_count, 1) + + +class TestUtils(unittest.TestCase): + + """ Test utils functions.""" + + def test_is_invalid_params_builtin(self): + self.assertTrue(is_invalid_params(sum, 0, 0)) + # NOTE: builtin functions could not be recognized by inspect.isfunction + # It would raise TypeError if parameters are incorrect already. + # self.assertFalse(is_invalid_params(sum, [0, 0])) # <- fails + + def test_is_invalid_params_args(self): + self.assertTrue(is_invalid_params(lambda a, b: None, 0)) + self.assertTrue(is_invalid_params(lambda a, b: None, 0, 1, 2)) + + def test_is_invalid_params_kwargs(self): + self.assertTrue(is_invalid_params(lambda a: None, **{})) + self.assertTrue(is_invalid_params(lambda a: None, **{"a": 0, "b": 1})) + + def test_invalid_params_correct(self): + self.assertFalse(is_invalid_params(lambda: None)) + self.assertFalse(is_invalid_params(lambda a: None, 0)) + self.assertFalse(is_invalid_params(lambda a, b=0: None, 0)) + self.assertFalse(is_invalid_params(lambda a, b=0: None, 0, 0)) + + def test_is_invalid_params_mixed(self): + self.assertFalse(is_invalid_params(lambda a, b: None, 0, **{"b": 1})) + self.assertFalse(is_invalid_params( + lambda a, b, c=0: None, 0, **{"b": 1})) + + def test_is_invalid_params_py2(self): + with patch('jsonrpc.utils.sys') as mock_sys: + mock_sys.version_info = (2, 7) + with patch('jsonrpc.utils.is_invalid_params_py2') as mock_func: + is_invalid_params(lambda a: None, 0) + + assert mock_func.call_count == 1 diff --git a/pyextra/jsonrpc/utils.py b/pyextra/jsonrpc/utils.py new file mode 100644 index 00000000000000..cdac317b2c218e --- /dev/null +++ b/pyextra/jsonrpc/utils.py @@ -0,0 +1,135 @@ +""" Utility functions for package.""" +from abc import ABCMeta, abstractmethod +import datetime +import decimal +import inspect +import json +import sys + +from . import six + + +class JSONSerializable(six.with_metaclass(ABCMeta, object)): + + """ Common functionality for json serializable objects.""" + + serialize = staticmethod(json.dumps) + deserialize = staticmethod(json.loads) + + @abstractmethod + def json(self): + raise NotImplementedError() + + @classmethod + def from_json(cls, json_str): + data = cls.deserialize(json_str) + + if not isinstance(data, dict): + raise ValueError("data should be dict") + + return cls(**data) + + +class DatetimeDecimalEncoder(json.JSONEncoder): + + """ Encoder for datetime and decimal serialization. + + Usage: json.dumps(object, cls=DatetimeDecimalEncoder) + NOTE: _iterencode does not work + + """ + + def default(self, o): + """ Encode JSON. + + :return str: A JSON encoded string + + """ + if isinstance(o, decimal.Decimal): + return float(o) + + if isinstance(o, (datetime.datetime, datetime.date)): + return o.isoformat() + + return json.JSONEncoder.default(self, o) + + +def is_invalid_params_py2(func, *args, **kwargs): + """ Check, whether function 'func' accepts parameters 'args', 'kwargs'. + + NOTE: Method is called after funct(*args, **kwargs) generated TypeError, + it is aimed to destinguish TypeError because of invalid parameters from + TypeError from inside the function. + + .. versionadded: 1.9.0 + + """ + funcargs, varargs, varkwargs, defaults = inspect.getargspec(func) + + unexpected = set(kwargs.keys()) - set(funcargs) + if len(unexpected) > 0: + return True + + params = [funcarg for funcarg in funcargs if funcarg not in kwargs] + funcargs_required = funcargs[:-len(defaults)] \ + if defaults is not None \ + else funcargs + params_required = [ + funcarg for funcarg in funcargs_required + if funcarg not in kwargs + ] + + return not (len(params_required) <= len(args) <= len(params)) + + +def is_invalid_params_py3(func, *args, **kwargs): + """ + Use inspect.signature instead of inspect.getargspec or + inspect.getfullargspec (based on inspect.signature itself) as it provides + more information about function parameters. + + .. versionadded: 1.11.2 + + """ + signature = inspect.signature(func) + parameters = signature.parameters + + unexpected = set(kwargs.keys()) - set(parameters.keys()) + if len(unexpected) > 0: + return True + + params = [ + parameter for name, parameter in parameters.items() + if name not in kwargs + ] + params_required = [ + param for param in params + if param.default is param.empty + ] + + return not (len(params_required) <= len(args) <= len(params)) + + +def is_invalid_params(func, *args, **kwargs): + """ + Method: + Validate pre-defined criteria, if any is True - function is invalid + 0. func should be callable + 1. kwargs should not have unexpected keywords + 2. remove kwargs.keys from func.parameters + 3. number of args should be <= remaining func.parameters + 4. number of args should be >= remaining func.parameters less default + """ + # For builtin functions inspect.getargspec(funct) return error. If builtin + # function generates TypeError, it is because of wrong parameters. + if not inspect.isfunction(func): + return True + + if sys.version_info >= (3, 3): + return is_invalid_params_py3(func, *args, **kwargs) + else: + # NOTE: use Python2 method for Python 3.2 as well. Starting from Python + # 3.3 it is recommended to use inspect.signature instead. + # In Python 3.0 - 3.2 inspect.getfullargspec is preferred but these + # versions are almost not supported. Users should consider upgrading. + return is_invalid_params_py2(func, *args, **kwargs) diff --git a/pyextra/overpy/__about__.py b/pyextra/overpy/__about__.py new file mode 100644 index 00000000000000..33c6c493c8aef6 --- /dev/null +++ b/pyextra/overpy/__about__.py @@ -0,0 +1,22 @@ +__all__ = [ + "__author__", + "__copyright__", + "__email__", + "__license__", + "__summary__", + "__title__", + "__uri__", + "__version__", +] + +__title__ = "overpy" +__summary__ = "Python Wrapper to access the OpenStreepMap Overpass API" +__uri__ = "https://github.com/DinoTools/python-overpy" + +__version__ = "0.4" + +__author__ = "PhiBo (DinoTools)" +__email__ = "" + +__license__ = "MIT" +__copyright__ = "Copyright 2014-2016 %s" % __author__ diff --git a/pyextra/overpy/__init__.py b/pyextra/overpy/__init__.py new file mode 100644 index 00000000000000..2836080ab7d017 --- /dev/null +++ b/pyextra/overpy/__init__.py @@ -0,0 +1,1619 @@ +from collections import OrderedDict +from datetime import datetime +from decimal import Decimal +from xml.sax import handler, make_parser +import json +import re +import sys +import time +import requests + +from overpy import exception +from overpy.__about__ import ( + __author__, __copyright__, __email__, __license__, __summary__, __title__, + __uri__, __version__ +) + +PY2 = sys.version_info[0] == 2 +PY3 = sys.version_info[0] == 3 + +XML_PARSER_DOM = 1 +XML_PARSER_SAX = 2 + +# Try to convert some common attributes +# http://wiki.openstreetmap.org/wiki/Elements#Common_attributes +GLOBAL_ATTRIBUTE_MODIFIERS = { + "changeset": int, + "timestamp": lambda ts: datetime.strptime(ts, "%Y-%m-%dT%H:%M:%SZ"), + "uid": int, + "version": int, + "visible": lambda v: v.lower() == "true" +} + + +def is_valid_type(element, cls): + """ + Test if an element is of a given type. + + :param Element() element: The element instance to test + :param Element cls: The element class to test + :return: False or True + :rtype: Boolean + """ + return isinstance(element, cls) and element.id is not None + + +class Overpass(object): + """ + Class to access the Overpass API + + :cvar default_max_retry_count: Global max number of retries (Default: 0) + :cvar default_retry_timeout: Global time to wait between tries (Default: 1.0s) + """ + default_max_retry_count = 0 + default_read_chunk_size = 4096 + default_retry_timeout = 1.0 + default_url = "http://overpass-api.de/api/interpreter" + + def __init__(self, read_chunk_size=None, url=None, xml_parser=XML_PARSER_SAX, max_retry_count=None, retry_timeout=None, timeout=5.0, headers=None): + """ + :param read_chunk_size: Max size of each chunk read from the server response + :type read_chunk_size: Integer + :param url: Optional URL of the Overpass server. Defaults to http://overpass-api.de/api/interpreter + :type url: str + :param xml_parser: The xml parser to use + :type xml_parser: Integer + :param max_retry_count: Max number of retries (Default: default_max_retry_count) + :type max_retry_count: Integer + :param retry_timeout: Time to wait between tries (Default: default_retry_timeout) + :type retry_timeout: float + :param timeout: HTTP request timeout + :type timeout: float + :param headers: HTTP request headers + :type headers: dict + """ + self.url = self.default_url + if url is not None: + self.url = url + + self._regex_extract_error_msg = re.compile(b"\(?P\") + self._regex_remove_tag = re.compile(b"<[^>]*?>") + if read_chunk_size is None: + read_chunk_size = self.default_read_chunk_size + self.read_chunk_size = read_chunk_size + + if max_retry_count is None: + max_retry_count = self.default_max_retry_count + self.max_retry_count = max_retry_count + + if retry_timeout is None: + retry_timeout = self.default_retry_timeout + self.retry_timeout = retry_timeout + + self.xml_parser = xml_parser + self.timeout = timeout + self.headers = headers + + def _handle_remark_msg(self, msg): + """ + Try to parse the message provided with the remark tag or element. + + :param str msg: The message + :raises overpy.exception.OverpassRuntimeError: If message starts with 'runtime error:' + :raises overpy.exception.OverpassRuntimeRemark: If message starts with 'runtime remark:' + :raises overpy.exception.OverpassUnknownError: If we are unable to identify the error + """ + msg = msg.strip() + if msg.startswith("runtime error:"): + raise exception.OverpassRuntimeError(msg=msg) + elif msg.startswith("runtime remark:"): + raise exception.OverpassRuntimeRemark(msg=msg) + raise exception.OverpassUnknownError(msg=msg) + + def query(self, query): + """ + Query the Overpass API + + :param String|Bytes query: The query string in Overpass QL + :return: The parsed result + :rtype: overpy.Result + """ + if not isinstance(query, bytes): + query = query.encode("utf-8") + + retry_num = 0 + retry_exceptions = [] + do_retry = True if self.max_retry_count > 0 else False + while retry_num <= self.max_retry_count: + if retry_num > 0: + time.sleep(self.retry_timeout) + retry_num += 1 + + try: + if self.headers is not None: + r = requests.post(self.url, query, timeout=self.timeout, headers=self.headers) + else: + r = requests.post(self.url, query, timeout=self.timeout) + response = r.content + except (requests.exceptions.BaseHTTPError, requests.exceptions.RequestException) as e: + if not do_retry: + raise e + retry_exceptions.append(e) + continue + + if r.status_code == 200: + content_type = r.headers["Content-Type"] + + if content_type == "application/json": + return self.parse_json(response) + + if content_type == "application/osm3s+xml": + return self.parse_xml(response) + + e = exception.OverpassUnknownContentType(content_type) + if not do_retry: + raise e + retry_exceptions.append(e) + continue + elif r.status_code == 400: + msgs = [] + for msg in self._regex_extract_error_msg.finditer(response): + tmp = self._regex_remove_tag.sub(b"", msg.group("msg")) + try: + tmp = tmp.decode("utf-8") + except UnicodeDecodeError: + tmp = repr(tmp) + msgs.append(tmp) + + e = exception.OverpassBadRequest( + query, + msgs=msgs + ) + if not do_retry: + raise e + retry_exceptions.append(e) + continue + elif r.status_code == 429: + e = exception.OverpassTooManyRequests + if not do_retry: + raise e + retry_exceptions.append(e) + continue + elif r.status_code == 504: + e = exception.OverpassGatewayTimeout + if not do_retry: + raise e + retry_exceptions.append(e) + continue + + # No valid response code + e = exception.OverpassUnknownHTTPStatusCode(r.status_code) + if not do_retry: + raise e + retry_exceptions.append(e) + continue + + raise exception.MaxRetriesReached(retry_count=retry_num, exceptions=retry_exceptions) + + def parse_json(self, data, encoding="utf-8"): + """ + Parse raw response from Overpass service. + + :param data: Raw JSON Data + :type data: String or Bytes + :param encoding: Encoding to decode byte string + :type encoding: String + :return: Result object + :rtype: overpy.Result + """ + if isinstance(data, bytes): + data = data.decode(encoding) + + data = json.loads(data, parse_float=Decimal) + if "remark" in data: + self._handle_remark_msg(msg=data.get("remark")) + return Result.from_json(data, api=self) + + def parse_xml(self, data, encoding="utf-8", parser=None): + """ + + :param data: Raw XML Data + :type data: String or Bytes + :param encoding: Encoding to decode byte string + :type encoding: String + :return: Result object + :rtype: overpy.Result + """ + if parser is None: + parser = self.xml_parser + if isinstance(data, bytes): + data = data.decode(encoding) + if PY2 and not isinstance(data, str): + # Python 2.x: Convert unicode strings + data = data.encode(encoding) + + m = re.compile("(?P[^<>]*)").search(data) + if m: + self._handle_remark_msg(m.group("msg")) + + return Result.from_xml(data, api=self, parser=parser) + + +class Result(object): + """ + Class to handle the result. + """ + + def __init__(self, elements=None, api=None): + """ + + :param List elements: + :param api: + :type api: overpy.Overpass + """ + if elements is None: + elements = [] + self._areas = OrderedDict((element.id, element) for element in elements if is_valid_type(element, Area)) + self._nodes = OrderedDict((element.id, element) for element in elements if is_valid_type(element, Node)) + self._ways = OrderedDict((element.id, element) for element in elements if is_valid_type(element, Way)) + self._relations = OrderedDict((element.id, element) + for element in elements if is_valid_type(element, Relation)) + self._class_collection_map = {Node: self._nodes, Way: self._ways, Relation: self._relations, Area: self._areas} + self.api = api + + def expand(self, other): + """ + Add all elements from an other result to the list of elements of this result object. + + It is used by the auto resolve feature. + + :param other: Expand the result with the elements from this result. + :type other: overpy.Result + :raises ValueError: If provided parameter is not instance of :class:`overpy.Result` + """ + if not isinstance(other, Result): + raise ValueError("Provided argument has to be instance of overpy:Result()") + + other_collection_map = {Node: other.nodes, Way: other.ways, Relation: other.relations, Area: other.areas} + for element_type, own_collection in self._class_collection_map.items(): + for element in other_collection_map[element_type]: + if is_valid_type(element, element_type) and element.id not in own_collection: + own_collection[element.id] = element + + def append(self, element): + """ + Append a new element to the result. + + :param element: The element to append + :type element: overpy.Element + """ + if is_valid_type(element, Element): + self._class_collection_map[element.__class__].setdefault(element.id, element) + + def get_elements(self, filter_cls, elem_id=None): + """ + Get a list of elements from the result and filter the element type by a class. + + :param filter_cls: + :param elem_id: ID of the object + :type elem_id: Integer + :return: List of available elements + :rtype: List + """ + result = [] + if elem_id is not None: + try: + result = [self._class_collection_map[filter_cls][elem_id]] + except KeyError: + result = [] + else: + for e in self._class_collection_map[filter_cls].values(): + result.append(e) + return result + + def get_ids(self, filter_cls): + """ + + :param filter_cls: + :return: + """ + return list(self._class_collection_map[filter_cls].keys()) + + def get_node_ids(self): + return self.get_ids(filter_cls=Node) + + def get_way_ids(self): + return self.get_ids(filter_cls=Way) + + def get_relation_ids(self): + return self.get_ids(filter_cls=Relation) + + def get_area_ids(self): + return self.get_ids(filter_cls=Area) + + @classmethod + def from_json(cls, data, api=None): + """ + Create a new instance and load data from json object. + + :param data: JSON data returned by the Overpass API + :type data: Dict + :param api: + :type api: overpy.Overpass + :return: New instance of Result object + :rtype: overpy.Result + """ + result = cls(api=api) + for elem_cls in [Node, Way, Relation, Area]: + for element in data.get("elements", []): + e_type = element.get("type") + if hasattr(e_type, "lower") and e_type.lower() == elem_cls._type_value: + result.append(elem_cls.from_json(element, result=result)) + + return result + + @classmethod + def from_xml(cls, data, api=None, parser=None): + """ + Create a new instance and load data from xml data or object. + + .. note:: + If parser is set to None, the functions tries to find the best parse. + By default the SAX parser is chosen if a string is provided as data. + The parser is set to DOM if an xml.etree.ElementTree.Element is provided as data value. + + :param data: Root element + :type data: str | xml.etree.ElementTree.Element + :param api: The instance to query additional information if required. + :type api: Overpass + :param parser: Specify the parser to use(DOM or SAX)(Default: None = autodetect, defaults to SAX) + :type parser: Integer | None + :return: New instance of Result object + :rtype: Result + """ + if parser is None: + if isinstance(data, str): + parser = XML_PARSER_SAX + else: + parser = XML_PARSER_DOM + + result = cls(api=api) + if parser == XML_PARSER_DOM: + import xml.etree.ElementTree as ET + if isinstance(data, str): + root = ET.fromstring(data) + elif isinstance(data, ET.Element): + root = data + else: + raise exception.OverPyException("Unable to detect data type.") + + for elem_cls in [Node, Way, Relation, Area]: + for child in root: + if child.tag.lower() == elem_cls._type_value: + result.append(elem_cls.from_xml(child, result=result)) + + elif parser == XML_PARSER_SAX: + if PY2: + from StringIO import StringIO + else: + from io import StringIO + source = StringIO(data) + sax_handler = OSMSAXHandler(result) + parser = make_parser() + parser.setContentHandler(sax_handler) + parser.parse(source) + else: + # ToDo: better exception + raise Exception("Unknown XML parser") + return result + + def get_area(self, area_id, resolve_missing=False): + """ + Get an area by its ID. + + :param area_id: The area ID + :type area_id: Integer + :param resolve_missing: Query the Overpass API if the area is missing in the result set. + :return: The area + :rtype: overpy.Area + :raises overpy.exception.DataIncomplete: The requested way is not available in the result cache. + :raises overpy.exception.DataIncomplete: If resolve_missing is True and the area can't be resolved. + """ + areas = self.get_areas(area_id=area_id) + if len(areas) == 0: + if resolve_missing is False: + raise exception.DataIncomplete("Resolve missing area is disabled") + + query = ("\n" + "[out:json];\n" + "area({area_id});\n" + "out body;\n" + ) + query = query.format( + area_id=area_id + ) + tmp_result = self.api.query(query) + self.expand(tmp_result) + + areas = self.get_areas(area_id=area_id) + + if len(areas) == 0: + raise exception.DataIncomplete("Unable to resolve requested areas") + + return areas[0] + + def get_areas(self, area_id=None, **kwargs): + """ + Alias for get_elements() but filter the result by Area + + :param area_id: The Id of the area + :type area_id: Integer + :return: List of elements + """ + return self.get_elements(Area, elem_id=area_id, **kwargs) + + def get_node(self, node_id, resolve_missing=False): + """ + Get a node by its ID. + + :param node_id: The node ID + :type node_id: Integer + :param resolve_missing: Query the Overpass API if the node is missing in the result set. + :return: The node + :rtype: overpy.Node + :raises overpy.exception.DataIncomplete: At least one referenced node is not available in the result cache. + :raises overpy.exception.DataIncomplete: If resolve_missing is True and at least one node can't be resolved. + """ + nodes = self.get_nodes(node_id=node_id) + if len(nodes) == 0: + if not resolve_missing: + raise exception.DataIncomplete("Resolve missing nodes is disabled") + + query = ("\n" + "[out:json];\n" + "node({node_id});\n" + "out body;\n" + ) + query = query.format( + node_id=node_id + ) + tmp_result = self.api.query(query) + self.expand(tmp_result) + + nodes = self.get_nodes(node_id=node_id) + + if len(nodes) == 0: + raise exception.DataIncomplete("Unable to resolve all nodes") + + return nodes[0] + + def get_nodes(self, node_id=None, **kwargs): + """ + Alias for get_elements() but filter the result by Node() + + :param node_id: The Id of the node + :type node_id: Integer + :return: List of elements + """ + return self.get_elements(Node, elem_id=node_id, **kwargs) + + def get_relation(self, rel_id, resolve_missing=False): + """ + Get a relation by its ID. + + :param rel_id: The relation ID + :type rel_id: Integer + :param resolve_missing: Query the Overpass API if the relation is missing in the result set. + :return: The relation + :rtype: overpy.Relation + :raises overpy.exception.DataIncomplete: The requested relation is not available in the result cache. + :raises overpy.exception.DataIncomplete: If resolve_missing is True and the relation can't be resolved. + """ + relations = self.get_relations(rel_id=rel_id) + if len(relations) == 0: + if resolve_missing is False: + raise exception.DataIncomplete("Resolve missing relations is disabled") + + query = ("\n" + "[out:json];\n" + "relation({relation_id});\n" + "out body;\n" + ) + query = query.format( + relation_id=rel_id + ) + tmp_result = self.api.query(query) + self.expand(tmp_result) + + relations = self.get_relations(rel_id=rel_id) + + if len(relations) == 0: + raise exception.DataIncomplete("Unable to resolve requested reference") + + return relations[0] + + def get_relations(self, rel_id=None, **kwargs): + """ + Alias for get_elements() but filter the result by Relation + + :param rel_id: Id of the relation + :type rel_id: Integer + :return: List of elements + """ + return self.get_elements(Relation, elem_id=rel_id, **kwargs) + + def get_way(self, way_id, resolve_missing=False): + """ + Get a way by its ID. + + :param way_id: The way ID + :type way_id: Integer + :param resolve_missing: Query the Overpass API if the way is missing in the result set. + :return: The way + :rtype: overpy.Way + :raises overpy.exception.DataIncomplete: The requested way is not available in the result cache. + :raises overpy.exception.DataIncomplete: If resolve_missing is True and the way can't be resolved. + """ + ways = self.get_ways(way_id=way_id) + if len(ways) == 0: + if resolve_missing is False: + raise exception.DataIncomplete("Resolve missing way is disabled") + + query = ("\n" + "[out:json];\n" + "way({way_id});\n" + "out body;\n" + ) + query = query.format( + way_id=way_id + ) + tmp_result = self.api.query(query) + self.expand(tmp_result) + + ways = self.get_ways(way_id=way_id) + + if len(ways) == 0: + raise exception.DataIncomplete("Unable to resolve requested way") + + return ways[0] + + def get_ways(self, way_id=None, **kwargs): + """ + Alias for get_elements() but filter the result by Way + + :param way_id: The Id of the way + :type way_id: Integer + :return: List of elements + """ + return self.get_elements(Way, elem_id=way_id, **kwargs) + + area_ids = property(get_area_ids) + areas = property(get_areas) + node_ids = property(get_node_ids) + nodes = property(get_nodes) + relation_ids = property(get_relation_ids) + relations = property(get_relations) + way_ids = property(get_way_ids) + ways = property(get_ways) + + +class Element(object): + """ + Base element + """ + + def __init__(self, attributes=None, result=None, tags=None): + """ + :param attributes: Additional attributes + :type attributes: Dict + :param result: The result object this element belongs to + :param tags: List of tags + :type tags: Dict + """ + + self._result = result + self.attributes = attributes + # ToDo: Add option to modify attribute modifiers + attribute_modifiers = dict(GLOBAL_ATTRIBUTE_MODIFIERS.items()) + for n, m in attribute_modifiers.items(): + if n in self.attributes: + self.attributes[n] = m(self.attributes[n]) + self.id = None + self.tags = tags + + @classmethod + def get_center_from_json(cls, data): + """ + Get center information from json data + + :param data: json data + :return: tuple with two elements: lat and lon + :rtype: tuple + """ + center_lat = None + center_lon = None + center = data.get("center") + if isinstance(center, dict): + center_lat = center.get("lat") + center_lon = center.get("lon") + if center_lat is None or center_lon is None: + raise ValueError("Unable to get lat or lon of way center.") + center_lat = Decimal(center_lat) + center_lon = Decimal(center_lon) + return (center_lat, center_lon) + + @classmethod + def get_center_from_xml_dom(cls, sub_child): + center_lat = sub_child.attrib.get("lat") + center_lon = sub_child.attrib.get("lon") + if center_lat is None or center_lon is None: + raise ValueError("Unable to get lat or lon of way center.") + center_lat = Decimal(center_lat) + center_lon = Decimal(center_lon) + return center_lat, center_lon + + +class Area(Element): + """ + Class to represent an element of type area + """ + + _type_value = "area" + + def __init__(self, area_id=None, **kwargs): + """ + :param area_id: Id of the area element + :type area_id: Integer + :param kwargs: Additional arguments are passed directly to the parent class + + """ + + Element.__init__(self, **kwargs) + #: The id of the way + self.id = area_id + + def __repr__(self): + return "".format(self.id) + + @classmethod + def from_json(cls, data, result=None): + """ + Create new Area element from JSON data + + :param data: Element data from JSON + :type data: Dict + :param result: The result this element belongs to + :type result: overpy.Result + :return: New instance of Way + :rtype: overpy.Area + :raises overpy.exception.ElementDataWrongType: If type value of the passed JSON data does not match. + """ + if data.get("type") != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=data.get("type") + ) + + tags = data.get("tags", {}) + + area_id = data.get("id") + + attributes = {} + ignore = ["id", "tags", "type"] + for n, v in data.items(): + if n in ignore: + continue + attributes[n] = v + + return cls(area_id=area_id, attributes=attributes, tags=tags, result=result) + + @classmethod + def from_xml(cls, child, result=None): + """ + Create new way element from XML data + + :param child: XML node to be parsed + :type child: xml.etree.ElementTree.Element + :param result: The result this node belongs to + :type result: overpy.Result + :return: New Way oject + :rtype: overpy.Way + :raises overpy.exception.ElementDataWrongType: If name of the xml child node doesn't match + :raises ValueError: If the ref attribute of the xml node is not provided + :raises ValueError: If a tag doesn't have a name + """ + if child.tag.lower() != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=child.tag.lower() + ) + + tags = {} + + for sub_child in child: + if sub_child.tag.lower() == "tag": + name = sub_child.attrib.get("k") + if name is None: + raise ValueError("Tag without name/key.") + value = sub_child.attrib.get("v") + tags[name] = value + + area_id = child.attrib.get("id") + if area_id is not None: + area_id = int(area_id) + + attributes = {} + ignore = ["id"] + for n, v in child.attrib.items(): + if n in ignore: + continue + attributes[n] = v + + return cls(area_id=area_id, attributes=attributes, tags=tags, result=result) + + +class Node(Element): + """ + Class to represent an element of type node + """ + + _type_value = "node" + + def __init__(self, node_id=None, lat=None, lon=None, **kwargs): + """ + :param lat: Latitude + :type lat: Decimal or Float + :param lon: Longitude + :type long: Decimal or Float + :param node_id: Id of the node element + :type node_id: Integer + :param kwargs: Additional arguments are passed directly to the parent class + """ + + Element.__init__(self, **kwargs) + self.id = node_id + self.lat = lat + self.lon = lon + + def __repr__(self): + return "".format(self.id, self.lat, self.lon) + + @classmethod + def from_json(cls, data, result=None): + """ + Create new Node element from JSON data + + :param data: Element data from JSON + :type data: Dict + :param result: The result this element belongs to + :type result: overpy.Result + :return: New instance of Node + :rtype: overpy.Node + :raises overpy.exception.ElementDataWrongType: If type value of the passed JSON data does not match. + """ + if data.get("type") != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=data.get("type") + ) + + tags = data.get("tags", {}) + + node_id = data.get("id") + lat = data.get("lat") + lon = data.get("lon") + + attributes = {} + ignore = ["type", "id", "lat", "lon", "tags"] + for n, v in data.items(): + if n in ignore: + continue + attributes[n] = v + + return cls(node_id=node_id, lat=lat, lon=lon, tags=tags, attributes=attributes, result=result) + + @classmethod + def from_xml(cls, child, result=None): + """ + Create new way element from XML data + + :param child: XML node to be parsed + :type child: xml.etree.ElementTree.Element + :param result: The result this node belongs to + :type result: overpy.Result + :return: New Way oject + :rtype: overpy.Node + :raises overpy.exception.ElementDataWrongType: If name of the xml child node doesn't match + :raises ValueError: If a tag doesn't have a name + """ + if child.tag.lower() != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=child.tag.lower() + ) + + tags = {} + + for sub_child in child: + if sub_child.tag.lower() == "tag": + name = sub_child.attrib.get("k") + if name is None: + raise ValueError("Tag without name/key.") + value = sub_child.attrib.get("v") + tags[name] = value + + node_id = child.attrib.get("id") + if node_id is not None: + node_id = int(node_id) + lat = child.attrib.get("lat") + if lat is not None: + lat = Decimal(lat) + lon = child.attrib.get("lon") + if lon is not None: + lon = Decimal(lon) + + attributes = {} + ignore = ["id", "lat", "lon"] + for n, v in child.attrib.items(): + if n in ignore: + continue + attributes[n] = v + + return cls(node_id=node_id, lat=lat, lon=lon, tags=tags, attributes=attributes, result=result) + + +class Way(Element): + """ + Class to represent an element of type way + """ + + _type_value = "way" + + def __init__(self, way_id=None, center_lat=None, center_lon=None, node_ids=None, **kwargs): + """ + :param node_ids: List of node IDs + :type node_ids: List or Tuple + :param way_id: Id of the way element + :type way_id: Integer + :param kwargs: Additional arguments are passed directly to the parent class + + """ + + Element.__init__(self, **kwargs) + #: The id of the way + self.id = way_id + + #: List of Ids of the associated nodes + self._node_ids = node_ids + + #: The lat/lon of the center of the way (optional depending on query) + self.center_lat = center_lat + self.center_lon = center_lon + + def __repr__(self): + return "".format(self.id, self._node_ids) + + @property + def nodes(self): + """ + List of nodes associated with the way. + """ + return self.get_nodes() + + def get_nodes(self, resolve_missing=False): + """ + Get the nodes defining the geometry of the way + + :param resolve_missing: Try to resolve missing nodes. + :type resolve_missing: Boolean + :return: List of nodes + :rtype: List of overpy.Node + :raises overpy.exception.DataIncomplete: At least one referenced node is not available in the result cache. + :raises overpy.exception.DataIncomplete: If resolve_missing is True and at least one node can't be resolved. + """ + result = [] + resolved = False + + for node_id in self._node_ids: + try: + node = self._result.get_node(node_id) + except exception.DataIncomplete: + node = None + + if node is not None: + result.append(node) + continue + + if not resolve_missing: + raise exception.DataIncomplete("Resolve missing nodes is disabled") + + # We tried to resolve the data but some nodes are still missing + if resolved: + raise exception.DataIncomplete("Unable to resolve all nodes") + + query = ("\n" + "[out:json];\n" + "way({way_id});\n" + "node(w);\n" + "out body;\n" + ) + query = query.format( + way_id=self.id + ) + tmp_result = self._result.api.query(query) + self._result.expand(tmp_result) + resolved = True + + try: + node = self._result.get_node(node_id) + except exception.DataIncomplete: + node = None + + if node is None: + raise exception.DataIncomplete("Unable to resolve all nodes") + + result.append(node) + + return result + + @classmethod + def from_json(cls, data, result=None): + """ + Create new Way element from JSON data + + :param data: Element data from JSON + :type data: Dict + :param result: The result this element belongs to + :type result: overpy.Result + :return: New instance of Way + :rtype: overpy.Way + :raises overpy.exception.ElementDataWrongType: If type value of the passed JSON data does not match. + """ + if data.get("type") != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=data.get("type") + ) + + tags = data.get("tags", {}) + + way_id = data.get("id") + node_ids = data.get("nodes") + (center_lat, center_lon) = cls.get_center_from_json(data=data) + + attributes = {} + ignore = ["center", "id", "nodes", "tags", "type"] + for n, v in data.items(): + if n in ignore: + continue + attributes[n] = v + + return cls( + attributes=attributes, + center_lat=center_lat, + center_lon=center_lon, + node_ids=node_ids, + tags=tags, + result=result, + way_id=way_id + ) + + @classmethod + def from_xml(cls, child, result=None): + """ + Create new way element from XML data + + :param child: XML node to be parsed + :type child: xml.etree.ElementTree.Element + :param result: The result this node belongs to + :type result: overpy.Result + :return: New Way oject + :rtype: overpy.Way + :raises overpy.exception.ElementDataWrongType: If name of the xml child node doesn't match + :raises ValueError: If the ref attribute of the xml node is not provided + :raises ValueError: If a tag doesn't have a name + """ + if child.tag.lower() != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=child.tag.lower() + ) + + tags = {} + node_ids = [] + center_lat = None + center_lon = None + + for sub_child in child: + if sub_child.tag.lower() == "tag": + name = sub_child.attrib.get("k") + if name is None: + raise ValueError("Tag without name/key.") + value = sub_child.attrib.get("v") + tags[name] = value + if sub_child.tag.lower() == "nd": + ref_id = sub_child.attrib.get("ref") + if ref_id is None: + raise ValueError("Unable to find required ref value.") + ref_id = int(ref_id) + node_ids.append(ref_id) + if sub_child.tag.lower() == "center": + (center_lat, center_lon) = cls.get_center_from_xml_dom(sub_child=sub_child) + + way_id = child.attrib.get("id") + if way_id is not None: + way_id = int(way_id) + + attributes = {} + ignore = ["id"] + for n, v in child.attrib.items(): + if n in ignore: + continue + attributes[n] = v + + return cls(way_id=way_id, center_lat=center_lat, center_lon=center_lon, + attributes=attributes, node_ids=node_ids, tags=tags, result=result) + + +class Relation(Element): + """ + Class to represent an element of type relation + """ + + _type_value = "relation" + + def __init__(self, rel_id=None, center_lat=None, center_lon=None, members=None, **kwargs): + """ + :param members: + :param rel_id: Id of the relation element + :type rel_id: Integer + :param kwargs: + :return: + """ + + Element.__init__(self, **kwargs) + self.id = rel_id + self.members = members + + #: The lat/lon of the center of the way (optional depending on query) + self.center_lat = center_lat + self.center_lon = center_lon + + def __repr__(self): + return "".format(self.id) + + @classmethod + def from_json(cls, data, result=None): + """ + Create new Relation element from JSON data + + :param data: Element data from JSON + :type data: Dict + :param result: The result this element belongs to + :type result: overpy.Result + :return: New instance of Relation + :rtype: overpy.Relation + :raises overpy.exception.ElementDataWrongType: If type value of the passed JSON data does not match. + """ + if data.get("type") != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=data.get("type") + ) + + tags = data.get("tags", {}) + + rel_id = data.get("id") + (center_lat, center_lon) = cls.get_center_from_json(data=data) + + members = [] + + supported_members = [RelationNode, RelationWay, RelationRelation] + for member in data.get("members", []): + type_value = member.get("type") + for member_cls in supported_members: + if member_cls._type_value == type_value: + members.append( + member_cls.from_json( + member, + result=result + ) + ) + + attributes = {} + ignore = ["id", "members", "tags", "type"] + for n, v in data.items(): + if n in ignore: + continue + attributes[n] = v + + return cls( + rel_id=rel_id, + attributes=attributes, + center_lat=center_lat, + center_lon=center_lon, + members=members, + tags=tags, + result=result + ) + + @classmethod + def from_xml(cls, child, result=None): + """ + Create new way element from XML data + + :param child: XML node to be parsed + :type child: xml.etree.ElementTree.Element + :param result: The result this node belongs to + :type result: overpy.Result + :return: New Way oject + :rtype: overpy.Relation + :raises overpy.exception.ElementDataWrongType: If name of the xml child node doesn't match + :raises ValueError: If a tag doesn't have a name + """ + if child.tag.lower() != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=child.tag.lower() + ) + + tags = {} + members = [] + center_lat = None + center_lon = None + + supported_members = [RelationNode, RelationWay, RelationRelation, RelationArea] + for sub_child in child: + if sub_child.tag.lower() == "tag": + name = sub_child.attrib.get("k") + if name is None: + raise ValueError("Tag without name/key.") + value = sub_child.attrib.get("v") + tags[name] = value + if sub_child.tag.lower() == "member": + type_value = sub_child.attrib.get("type") + for member_cls in supported_members: + if member_cls._type_value == type_value: + members.append( + member_cls.from_xml( + sub_child, + result=result + ) + ) + if sub_child.tag.lower() == "center": + (center_lat, center_lon) = cls.get_center_from_xml_dom(sub_child=sub_child) + + rel_id = child.attrib.get("id") + if rel_id is not None: + rel_id = int(rel_id) + + attributes = {} + ignore = ["id"] + for n, v in child.attrib.items(): + if n in ignore: + continue + attributes[n] = v + + return cls( + rel_id=rel_id, + attributes=attributes, + center_lat=center_lat, + center_lon=center_lon, + members=members, + tags=tags, + result=result + ) + + +class RelationMember(object): + """ + Base class to represent a member of a relation. + """ + + def __init__(self, attributes=None, geometry=None, ref=None, role=None, result=None): + """ + :param ref: Reference Id + :type ref: Integer + :param role: The role of the relation member + :type role: String + :param result: + """ + self.ref = ref + self._result = result + self.role = role + self.attributes = attributes + self.geometry = geometry + + @classmethod + def from_json(cls, data, result=None): + """ + Create new RelationMember element from JSON data + + :param child: Element data from JSON + :type child: Dict + :param result: The result this element belongs to + :type result: overpy.Result + :return: New instance of RelationMember + :rtype: overpy.RelationMember + :raises overpy.exception.ElementDataWrongType: If type value of the passed JSON data does not match. + """ + if data.get("type") != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=data.get("type") + ) + + ref = data.get("ref") + role = data.get("role") + + attributes = {} + ignore = ["geometry", "type", "ref", "role"] + for n, v in data.items(): + if n in ignore: + continue + attributes[n] = v + + geometry = data.get("geometry") + if isinstance(geometry, list): + geometry_orig = geometry + geometry = [] + for v in geometry_orig: + geometry.append( + RelationWayGeometryValue( + lat=v.get("lat"), + lon=v.get("lon") + ) + ) + else: + geometry = None + + return cls( + attributes=attributes, + geometry=geometry, + ref=ref, + role=role, + result=result + ) + + @classmethod + def from_xml(cls, child, result=None): + """ + Create new RelationMember from XML data + + :param child: XML node to be parsed + :type child: xml.etree.ElementTree.Element + :param result: The result this element belongs to + :type result: overpy.Result + :return: New relation member oject + :rtype: overpy.RelationMember + :raises overpy.exception.ElementDataWrongType: If name of the xml child node doesn't match + """ + if child.attrib.get("type") != cls._type_value: + raise exception.ElementDataWrongType( + type_expected=cls._type_value, + type_provided=child.tag.lower() + ) + + ref = child.attrib.get("ref") + if ref is not None: + ref = int(ref) + role = child.attrib.get("role") + + attributes = {} + ignore = ["geometry", "ref", "role", "type"] + for n, v in child.attrib.items(): + if n in ignore: + continue + attributes[n] = v + + geometry = None + for sub_child in child: + if sub_child.tag.lower() == "nd": + if geometry is None: + geometry = [] + geometry.append( + RelationWayGeometryValue( + lat=Decimal(sub_child.attrib["lat"]), + lon=Decimal(sub_child.attrib["lon"]) + ) + ) + + return cls( + attributes=attributes, + geometry=geometry, + ref=ref, + role=role, + result=result + ) + + +class RelationNode(RelationMember): + _type_value = "node" + + def resolve(self, resolve_missing=False): + return self._result.get_node(self.ref, resolve_missing=resolve_missing) + + def __repr__(self): + return "".format(self.ref, self.role) + + +class RelationWay(RelationMember): + _type_value = "way" + + def resolve(self, resolve_missing=False): + return self._result.get_way(self.ref, resolve_missing=resolve_missing) + + def __repr__(self): + return "".format(self.ref, self.role) + + +class RelationWayGeometryValue(object): + def __init__(self, lat, lon): + self.lat = lat + self.lon = lon + + def __repr__(self): + return "".format(self.lat, self.lon) + + +class RelationRelation(RelationMember): + _type_value = "relation" + + def resolve(self, resolve_missing=False): + return self._result.get_relation(self.ref, resolve_missing=resolve_missing) + + def __repr__(self): + return "".format(self.ref, self.role) + + +class RelationArea(RelationMember): + _type_value = "area" + + def resolve(self, resolve_missing=False): + return self._result.get_area(self.ref, resolve_missing=resolve_missing) + + def __repr__(self): + return "".format(self.ref, self.role) + + +class OSMSAXHandler(handler.ContentHandler): + """ + SAX parser for Overpass XML response. + """ + #: Tuple of opening elements to ignore + ignore_start = ('osm', 'meta', 'note', 'bounds', 'remark') + #: Tuple of closing elements to ignore + ignore_end = ('osm', 'meta', 'note', 'bounds', 'remark', 'tag', 'nd', 'center') + + def __init__(self, result): + """ + :param result: Append results to this result set. + :type result: overpy.Result + """ + handler.ContentHandler.__init__(self) + self._result = result + self._curr = {} + #: Current relation member object + self.cur_relation_member = None + + def startElement(self, name, attrs): + """ + Handle opening elements. + + :param name: Name of the element + :type name: String + :param attrs: Attributes of the element + :type attrs: Dict + """ + if name in self.ignore_start: + return + try: + handler = getattr(self, '_handle_start_%s' % name) + except AttributeError: + raise KeyError("Unknown element start '%s'" % name) + handler(attrs) + + def endElement(self, name): + """ + Handle closing elements + + :param name: Name of the element + :type name: String + """ + if name in self.ignore_end: + return + try: + handler = getattr(self, '_handle_end_%s' % name) + except AttributeError: + raise KeyError("Unknown element end '%s'" % name) + handler() + + def _handle_start_center(self, attrs): + """ + Handle opening center element + + :param attrs: Attributes of the element + :type attrs: Dict + """ + center_lat = attrs.get("lat") + center_lon = attrs.get("lon") + if center_lat is None or center_lon is None: + raise ValueError("Unable to get lat or lon of way center.") + self._curr["center_lat"] = Decimal(center_lat) + self._curr["center_lon"] = Decimal(center_lon) + + def _handle_start_tag(self, attrs): + """ + Handle opening tag element + + :param attrs: Attributes of the element + :type attrs: Dict + """ + try: + tag_key = attrs['k'] + except KeyError: + raise ValueError("Tag without name/key.") + self._curr['tags'][tag_key] = attrs.get('v') + + def _handle_start_node(self, attrs): + """ + Handle opening node element + + :param attrs: Attributes of the element + :type attrs: Dict + """ + self._curr = { + 'attributes': dict(attrs), + 'lat': None, + 'lon': None, + 'node_id': None, + 'tags': {} + } + if attrs.get('id', None) is not None: + self._curr['node_id'] = int(attrs['id']) + del self._curr['attributes']['id'] + if attrs.get('lat', None) is not None: + self._curr['lat'] = Decimal(attrs['lat']) + del self._curr['attributes']['lat'] + if attrs.get('lon', None) is not None: + self._curr['lon'] = Decimal(attrs['lon']) + del self._curr['attributes']['lon'] + + def _handle_end_node(self): + """ + Handle closing node element + """ + self._result.append(Node(result=self._result, **self._curr)) + self._curr = {} + + def _handle_start_way(self, attrs): + """ + Handle opening way element + + :param attrs: Attributes of the element + :type attrs: Dict + """ + self._curr = { + 'center_lat': None, + 'center_lon': None, + 'attributes': dict(attrs), + 'node_ids': [], + 'tags': {}, + 'way_id': None + } + if attrs.get('id', None) is not None: + self._curr['way_id'] = int(attrs['id']) + del self._curr['attributes']['id'] + + def _handle_end_way(self): + """ + Handle closing way element + """ + self._result.append(Way(result=self._result, **self._curr)) + self._curr = {} + + def _handle_start_area(self, attrs): + """ + Handle opening area element + + :param attrs: Attributes of the element + :type attrs: Dict + """ + self._curr = { + 'attributes': dict(attrs), + 'tags': {}, + 'area_id': None + } + if attrs.get('id', None) is not None: + self._curr['area_id'] = int(attrs['id']) + del self._curr['attributes']['id'] + + def _handle_end_area(self): + """ + Handle closing area element + """ + self._result.append(Area(result=self._result, **self._curr)) + self._curr = {} + + def _handle_start_nd(self, attrs): + """ + Handle opening nd element + + :param attrs: Attributes of the element + :type attrs: Dict + """ + if isinstance(self.cur_relation_member, RelationWay): + if self.cur_relation_member.geometry is None: + self.cur_relation_member.geometry = [] + self.cur_relation_member.geometry.append( + RelationWayGeometryValue( + lat=Decimal(attrs["lat"]), + lon=Decimal(attrs["lon"]) + ) + ) + else: + try: + node_ref = attrs['ref'] + except KeyError: + raise ValueError("Unable to find required ref value.") + self._curr['node_ids'].append(int(node_ref)) + + def _handle_start_relation(self, attrs): + """ + Handle opening relation element + + :param attrs: Attributes of the element + :type attrs: Dict + """ + self._curr = { + 'attributes': dict(attrs), + 'members': [], + 'rel_id': None, + 'tags': {} + } + if attrs.get('id', None) is not None: + self._curr['rel_id'] = int(attrs['id']) + del self._curr['attributes']['id'] + + def _handle_end_relation(self): + """ + Handle closing relation element + """ + self._result.append(Relation(result=self._result, **self._curr)) + self._curr = {} + + def _handle_start_member(self, attrs): + """ + Handle opening member element + + :param attrs: Attributes of the element + :type attrs: Dict + """ + + params = { + # ToDo: Parse attributes + 'attributes': {}, + 'ref': None, + 'result': self._result, + 'role': None + } + if attrs.get('ref', None): + params['ref'] = int(attrs['ref']) + if attrs.get('role', None): + params['role'] = attrs['role'] + + cls_map = { + "area": RelationArea, + "node": RelationNode, + "relation": RelationRelation, + "way": RelationWay + } + cls = cls_map.get(attrs["type"]) + if cls is None: + raise ValueError("Undefined type for member: '%s'" % attrs['type']) + + self.cur_relation_member = cls(**params) + self._curr['members'].append(self.cur_relation_member) + + def _handle_end_member(self): + self.cur_relation_member = None diff --git a/pyextra/overpy/exception.py b/pyextra/overpy/exception.py new file mode 100644 index 00000000000000..3d8416a1257ef1 --- /dev/null +++ b/pyextra/overpy/exception.py @@ -0,0 +1,166 @@ +class OverPyException(BaseException): + """OverPy base exception""" + pass + + +class DataIncomplete(OverPyException): + """ + Raised if the requested data isn't available in the result. + Try to improve the query or to resolve the missing data. + """ + def __init__(self, *args, **kwargs): + OverPyException.__init__( + self, + "Data incomplete try to improve the query to resolve the missing data", + *args, + **kwargs + ) + + +class ElementDataWrongType(OverPyException): + """ + Raised if the provided element does not match the expected type. + + :param type_expected: The expected element type + :type type_expected: String + :param type_provided: The provided element type + :type type_provided: String|None + """ + def __init__(self, type_expected, type_provided=None): + self.type_expected = type_expected + self.type_provided = type_provided + + def __str__(self): + return "Type expected '%s' but '%s' provided" % ( + self.type_expected, + str(self.type_provided) + ) + + +class MaxRetriesReached(OverPyException): + """ + Raised if max retries reached and the Overpass server didn't respond with a result. + """ + def __init__(self, retry_count, exceptions): + self.exceptions = exceptions + self.retry_count = retry_count + + def __str__(self): + return "Unable get any result from the Overpass API server after %d retries." % self.retry_count + + +class OverpassBadRequest(OverPyException): + """ + Raised if the Overpass API service returns a syntax error. + + :param query: The encoded query how it was send to the server + :type query: Bytes + :param msgs: List of error messages + :type msgs: List + """ + def __init__(self, query, msgs=None): + self.query = query + if msgs is None: + msgs = [] + self.msgs = msgs + + def __str__(self): + tmp_msgs = [] + for tmp_msg in self.msgs: + if not isinstance(tmp_msg, str): + tmp_msg = str(tmp_msg) + tmp_msgs.append(tmp_msg) + + return "\n".join(tmp_msgs) + + +class OverpassError(OverPyException): + """ + Base exception to report errors if the response returns a remark tag or element. + + .. note:: + If you are not sure which of the subexceptions you should use, use this one and try to parse the message. + + For more information have a look at https://github.com/DinoTools/python-overpy/issues/62 + + :param str msg: The message from the remark tag or element + """ + def __init__(self, msg=None): + #: The message from the remark tag or element + self.msg = msg + + def __str__(self): + if self.msg is None: + return "No error message provided" + if not isinstance(self.msg, str): + return str(self.msg) + return self.msg + + +class OverpassGatewayTimeout(OverPyException): + """ + Raised if load of the Overpass API service is too high and it can't handle the request. + """ + def __init__(self): + OverPyException.__init__(self, "Server load too high") + + +class OverpassRuntimeError(OverpassError): + """ + Raised if the server returns a remark-tag(xml) or remark element(json) with a message starting with + 'runtime error:'. + """ + pass + + +class OverpassRuntimeRemark(OverpassError): + """ + Raised if the server returns a remark-tag(xml) or remark element(json) with a message starting with + 'runtime remark:'. + """ + pass + + +class OverpassTooManyRequests(OverPyException): + """ + Raised if the Overpass API service returns a 429 status code. + """ + def __init__(self): + OverPyException.__init__(self, "Too many requests") + + +class OverpassUnknownContentType(OverPyException): + """ + Raised if the reported content type isn't handled by OverPy. + + :param content_type: The reported content type + :type content_type: None or String + """ + def __init__(self, content_type): + self.content_type = content_type + + def __str__(self): + if self.content_type is None: + return "No content type returned" + return "Unknown content type: %s" % self.content_type + + +class OverpassUnknownError(OverpassError): + """ + Raised if the server returns a remark-tag(xml) or remark element(json) and we are unable to find any reason. + """ + pass + + +class OverpassUnknownHTTPStatusCode(OverPyException): + """ + Raised if the returned HTTP status code isn't handled by OverPy. + + :param code: The HTTP status code + :type code: Integer + """ + def __init__(self, code): + self.code = code + + def __str__(self): + return "Unknown/Unhandled status code: %d" % self.code \ No newline at end of file diff --git a/pyextra/overpy/helper.py b/pyextra/overpy/helper.py new file mode 100644 index 00000000000000..e3ac0170bcb882 --- /dev/null +++ b/pyextra/overpy/helper.py @@ -0,0 +1,64 @@ +__author__ = 'mjob' + +import overpy + + +def get_street(street, areacode, api=None): + """ + Retrieve streets in a given bounding area + + :param overpy.Overpass api: First street of intersection + :param String street: Name of street + :param String areacode: The OSM id of the bounding area + :return: Parsed result + :raises overpy.exception.OverPyException: If something bad happens. + """ + if api is None: + api = overpy.Overpass() + + query = """ + area(%s)->.location; + ( + way[highway][name="%s"](area.location); + - ( + way[highway=service](area.location); + way[highway=track](area.location); + ); + ); + out body; + >; + out skel qt; + """ + + data = api.query(query % (areacode, street)) + + return data + + +def get_intersection(street1, street2, areacode, api=None): + """ + Retrieve intersection of two streets in a given bounding area + + :param overpy.Overpass api: First street of intersection + :param String street1: Name of first street of intersection + :param String street2: Name of second street of intersection + :param String areacode: The OSM id of the bounding area + :return: List of intersections + :raises overpy.exception.OverPyException: If something bad happens. + """ + if api is None: + api = overpy.Overpass() + + query = """ + area(%s)->.location; + ( + way[highway][name="%s"](area.location); node(w)->.n1; + way[highway][name="%s"](area.location); node(w)->.n2; + ); + node.n1.n2; + out meta; + """ + + data = api.query(query % (areacode, street1, street2)) + + return data.get_nodes() diff --git a/pyextra/websocket/__init__.py b/pyextra/websocket/__init__.py new file mode 100644 index 00000000000000..7c3154da262fec --- /dev/null +++ b/pyextra/websocket/__init__.py @@ -0,0 +1,29 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" +from ._abnf import * +from ._app import WebSocketApp +from ._core import * +from ._exceptions import * +from ._logging import * +from ._socket import * + +__version__ = "0.55.0" diff --git a/pyextra/websocket/_abnf.py b/pyextra/websocket/_abnf.py new file mode 100644 index 00000000000000..a0000fa1c94f64 --- /dev/null +++ b/pyextra/websocket/_abnf.py @@ -0,0 +1,447 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" +import array +import os +import struct + +import six + +from ._exceptions import * +from ._utils import validate_utf8 +from threading import Lock + +try: + if six.PY3: + import numpy + else: + numpy = None +except ImportError: + numpy = None + +try: + # If wsaccel is available we use compiled routines to mask data. + if not numpy: + from wsaccel.xormask import XorMaskerSimple + + def _mask(_m, _d): + return XorMaskerSimple(_m).process(_d) +except ImportError: + # wsaccel is not available, we rely on python implementations. + def _mask(_m, _d): + for i in range(len(_d)): + _d[i] ^= _m[i % 4] + + if six.PY3: + return _d.tobytes() + else: + return _d.tostring() + + +__all__ = [ + 'ABNF', 'continuous_frame', 'frame_buffer', + 'STATUS_NORMAL', + 'STATUS_GOING_AWAY', + 'STATUS_PROTOCOL_ERROR', + 'STATUS_UNSUPPORTED_DATA_TYPE', + 'STATUS_STATUS_NOT_AVAILABLE', + 'STATUS_ABNORMAL_CLOSED', + 'STATUS_INVALID_PAYLOAD', + 'STATUS_POLICY_VIOLATION', + 'STATUS_MESSAGE_TOO_BIG', + 'STATUS_INVALID_EXTENSION', + 'STATUS_UNEXPECTED_CONDITION', + 'STATUS_BAD_GATEWAY', + 'STATUS_TLS_HANDSHAKE_ERROR', +] + +# closing frame status codes. +STATUS_NORMAL = 1000 +STATUS_GOING_AWAY = 1001 +STATUS_PROTOCOL_ERROR = 1002 +STATUS_UNSUPPORTED_DATA_TYPE = 1003 +STATUS_STATUS_NOT_AVAILABLE = 1005 +STATUS_ABNORMAL_CLOSED = 1006 +STATUS_INVALID_PAYLOAD = 1007 +STATUS_POLICY_VIOLATION = 1008 +STATUS_MESSAGE_TOO_BIG = 1009 +STATUS_INVALID_EXTENSION = 1010 +STATUS_UNEXPECTED_CONDITION = 1011 +STATUS_BAD_GATEWAY = 1014 +STATUS_TLS_HANDSHAKE_ERROR = 1015 + +VALID_CLOSE_STATUS = ( + STATUS_NORMAL, + STATUS_GOING_AWAY, + STATUS_PROTOCOL_ERROR, + STATUS_UNSUPPORTED_DATA_TYPE, + STATUS_INVALID_PAYLOAD, + STATUS_POLICY_VIOLATION, + STATUS_MESSAGE_TOO_BIG, + STATUS_INVALID_EXTENSION, + STATUS_UNEXPECTED_CONDITION, + STATUS_BAD_GATEWAY, +) + + +class ABNF(object): + """ + ABNF frame class. + see http://tools.ietf.org/html/rfc5234 + and http://tools.ietf.org/html/rfc6455#section-5.2 + """ + + # operation code values. + OPCODE_CONT = 0x0 + OPCODE_TEXT = 0x1 + OPCODE_BINARY = 0x2 + OPCODE_CLOSE = 0x8 + OPCODE_PING = 0x9 + OPCODE_PONG = 0xa + + # available operation code value tuple + OPCODES = (OPCODE_CONT, OPCODE_TEXT, OPCODE_BINARY, OPCODE_CLOSE, + OPCODE_PING, OPCODE_PONG) + + # opcode human readable string + OPCODE_MAP = { + OPCODE_CONT: "cont", + OPCODE_TEXT: "text", + OPCODE_BINARY: "binary", + OPCODE_CLOSE: "close", + OPCODE_PING: "ping", + OPCODE_PONG: "pong" + } + + # data length threshold. + LENGTH_7 = 0x7e + LENGTH_16 = 1 << 16 + LENGTH_63 = 1 << 63 + + def __init__(self, fin=0, rsv1=0, rsv2=0, rsv3=0, + opcode=OPCODE_TEXT, mask=1, data=""): + """ + Constructor for ABNF. + please check RFC for arguments. + """ + self.fin = fin + self.rsv1 = rsv1 + self.rsv2 = rsv2 + self.rsv3 = rsv3 + self.opcode = opcode + self.mask = mask + if data is None: + data = "" + self.data = data + self.get_mask_key = os.urandom + + def validate(self, skip_utf8_validation=False): + """ + validate the ABNF frame. + skip_utf8_validation: skip utf8 validation. + """ + if self.rsv1 or self.rsv2 or self.rsv3: + raise WebSocketProtocolException("rsv is not implemented, yet") + + if self.opcode not in ABNF.OPCODES: + raise WebSocketProtocolException("Invalid opcode %r", self.opcode) + + if self.opcode == ABNF.OPCODE_PING and not self.fin: + raise WebSocketProtocolException("Invalid ping frame.") + + if self.opcode == ABNF.OPCODE_CLOSE: + l = len(self.data) + if not l: + return + if l == 1 or l >= 126: + raise WebSocketProtocolException("Invalid close frame.") + if l > 2 and not skip_utf8_validation and not validate_utf8(self.data[2:]): + raise WebSocketProtocolException("Invalid close frame.") + + code = 256 * \ + six.byte2int(self.data[0:1]) + six.byte2int(self.data[1:2]) + if not self._is_valid_close_status(code): + raise WebSocketProtocolException("Invalid close opcode.") + + @staticmethod + def _is_valid_close_status(code): + return code in VALID_CLOSE_STATUS or (3000 <= code < 5000) + + def __str__(self): + return "fin=" + str(self.fin) \ + + " opcode=" + str(self.opcode) \ + + " data=" + str(self.data) + + @staticmethod + def create_frame(data, opcode, fin=1): + """ + create frame to send text, binary and other data. + + data: data to send. This is string value(byte array). + if opcode is OPCODE_TEXT and this value is unicode, + data value is converted into unicode string, automatically. + + opcode: operation code. please see OPCODE_XXX. + + fin: fin flag. if set to 0, create continue fragmentation. + """ + if opcode == ABNF.OPCODE_TEXT and isinstance(data, six.text_type): + data = data.encode("utf-8") + # mask must be set if send data from client + return ABNF(fin, 0, 0, 0, opcode, 1, data) + + def format(self): + """ + format this object to string(byte array) to send data to server. + """ + if any(x not in (0, 1) for x in [self.fin, self.rsv1, self.rsv2, self.rsv3]): + raise ValueError("not 0 or 1") + if self.opcode not in ABNF.OPCODES: + raise ValueError("Invalid OPCODE") + length = len(self.data) + if length >= ABNF.LENGTH_63: + raise ValueError("data is too long") + + frame_header = chr(self.fin << 7 + | self.rsv1 << 6 | self.rsv2 << 5 | self.rsv3 << 4 + | self.opcode) + if length < ABNF.LENGTH_7: + frame_header += chr(self.mask << 7 | length) + frame_header = six.b(frame_header) + elif length < ABNF.LENGTH_16: + frame_header += chr(self.mask << 7 | 0x7e) + frame_header = six.b(frame_header) + frame_header += struct.pack("!H", length) + else: + frame_header += chr(self.mask << 7 | 0x7f) + frame_header = six.b(frame_header) + frame_header += struct.pack("!Q", length) + + if not self.mask: + return frame_header + self.data + else: + mask_key = self.get_mask_key(4) + return frame_header + self._get_masked(mask_key) + + def _get_masked(self, mask_key): + s = ABNF.mask(mask_key, self.data) + + if isinstance(mask_key, six.text_type): + mask_key = mask_key.encode('utf-8') + + return mask_key + s + + @staticmethod + def mask(mask_key, data): + """ + mask or unmask data. Just do xor for each byte + + mask_key: 4 byte string(byte). + + data: data to mask/unmask. + """ + if data is None: + data = "" + + if isinstance(mask_key, six.text_type): + mask_key = six.b(mask_key) + + if isinstance(data, six.text_type): + data = six.b(data) + + if numpy: + origlen = len(data) + _mask_key = mask_key[3] << 24 | mask_key[2] << 16 | mask_key[1] << 8 | mask_key[0] + + # We need data to be a multiple of four... + data += bytes(" " * (4 - (len(data) % 4)), "us-ascii") + a = numpy.frombuffer(data, dtype="uint32") + masked = numpy.bitwise_xor(a, [_mask_key]).astype("uint32") + if len(data) > origlen: + return masked.tobytes()[:origlen] + return masked.tobytes() + else: + _m = array.array("B", mask_key) + _d = array.array("B", data) + return _mask(_m, _d) + + +class frame_buffer(object): + _HEADER_MASK_INDEX = 5 + _HEADER_LENGTH_INDEX = 6 + + def __init__(self, recv_fn, skip_utf8_validation): + self.recv = recv_fn + self.skip_utf8_validation = skip_utf8_validation + # Buffers over the packets from the layer beneath until desired amount + # bytes of bytes are received. + self.recv_buffer = [] + self.clear() + self.lock = Lock() + + def clear(self): + self.header = None + self.length = None + self.mask = None + + def has_received_header(self): + return self.header is None + + def recv_header(self): + header = self.recv_strict(2) + b1 = header[0] + + if six.PY2: + b1 = ord(b1) + + fin = b1 >> 7 & 1 + rsv1 = b1 >> 6 & 1 + rsv2 = b1 >> 5 & 1 + rsv3 = b1 >> 4 & 1 + opcode = b1 & 0xf + b2 = header[1] + + if six.PY2: + b2 = ord(b2) + + has_mask = b2 >> 7 & 1 + length_bits = b2 & 0x7f + + self.header = (fin, rsv1, rsv2, rsv3, opcode, has_mask, length_bits) + + def has_mask(self): + if not self.header: + return False + return self.header[frame_buffer._HEADER_MASK_INDEX] + + def has_received_length(self): + return self.length is None + + def recv_length(self): + bits = self.header[frame_buffer._HEADER_LENGTH_INDEX] + length_bits = bits & 0x7f + if length_bits == 0x7e: + v = self.recv_strict(2) + self.length = struct.unpack("!H", v)[0] + elif length_bits == 0x7f: + v = self.recv_strict(8) + self.length = struct.unpack("!Q", v)[0] + else: + self.length = length_bits + + def has_received_mask(self): + return self.mask is None + + def recv_mask(self): + self.mask = self.recv_strict(4) if self.has_mask() else "" + + def recv_frame(self): + + with self.lock: + # Header + if self.has_received_header(): + self.recv_header() + (fin, rsv1, rsv2, rsv3, opcode, has_mask, _) = self.header + + # Frame length + if self.has_received_length(): + self.recv_length() + length = self.length + + # Mask + if self.has_received_mask(): + self.recv_mask() + mask = self.mask + + # Payload + payload = self.recv_strict(length) + if has_mask: + payload = ABNF.mask(mask, payload) + + # Reset for next frame + self.clear() + + frame = ABNF(fin, rsv1, rsv2, rsv3, opcode, has_mask, payload) + frame.validate(self.skip_utf8_validation) + + return frame + + def recv_strict(self, bufsize): + shortage = bufsize - sum(len(x) for x in self.recv_buffer) + while shortage > 0: + # Limit buffer size that we pass to socket.recv() to avoid + # fragmenting the heap -- the number of bytes recv() actually + # reads is limited by socket buffer and is relatively small, + # yet passing large numbers repeatedly causes lots of large + # buffers allocated and then shrunk, which results in + # fragmentation. + bytes_ = self.recv(min(16384, shortage)) + self.recv_buffer.append(bytes_) + shortage -= len(bytes_) + + unified = six.b("").join(self.recv_buffer) + + if shortage == 0: + self.recv_buffer = [] + return unified + else: + self.recv_buffer = [unified[bufsize:]] + return unified[:bufsize] + + +class continuous_frame(object): + + def __init__(self, fire_cont_frame, skip_utf8_validation): + self.fire_cont_frame = fire_cont_frame + self.skip_utf8_validation = skip_utf8_validation + self.cont_data = None + self.recving_frames = None + + def validate(self, frame): + if not self.recving_frames and frame.opcode == ABNF.OPCODE_CONT: + raise WebSocketProtocolException("Illegal frame") + if self.recving_frames and \ + frame.opcode in (ABNF.OPCODE_TEXT, ABNF.OPCODE_BINARY): + raise WebSocketProtocolException("Illegal frame") + + def add(self, frame): + if self.cont_data: + self.cont_data[1] += frame.data + else: + if frame.opcode in (ABNF.OPCODE_TEXT, ABNF.OPCODE_BINARY): + self.recving_frames = frame.opcode + self.cont_data = [frame.opcode, frame.data] + + if frame.fin: + self.recving_frames = None + + def is_fire(self, frame): + return frame.fin or self.fire_cont_frame + + def extract(self, frame): + data = self.cont_data + self.cont_data = None + frame.data = data[1] + if not self.fire_cont_frame and data[0] == ABNF.OPCODE_TEXT and not self.skip_utf8_validation and not validate_utf8(frame.data): + raise WebSocketPayloadException( + "cannot decode: " + repr(frame.data)) + + return [data[0], frame] diff --git a/pyextra/websocket/_app.py b/pyextra/websocket/_app.py new file mode 100644 index 00000000000000..81aa1fcd976b5e --- /dev/null +++ b/pyextra/websocket/_app.py @@ -0,0 +1,351 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" + +""" +WebSocketApp provides higher level APIs. +""" +import inspect +import select +import sys +import threading +import time +import traceback + +import six + +from ._abnf import ABNF +from ._core import WebSocket, getdefaulttimeout +from ._exceptions import * +from . import _logging + + +__all__ = ["WebSocketApp"] + +class Dispatcher: + def __init__(self, app, ping_timeout): + self.app = app + self.ping_timeout = ping_timeout + + def read(self, sock, read_callback, check_callback): + while self.app.sock.connected: + r, w, e = select.select( + (self.app.sock.sock, ), (), (), self.ping_timeout) + if r: + if not read_callback(): + break + check_callback() + +class SSLDispacther: + def __init__(self, app, ping_timeout): + self.app = app + self.ping_timeout = ping_timeout + + def read(self, sock, read_callback, check_callback): + while self.app.sock.connected: + r = self.select() + if r: + if not read_callback(): + break + check_callback() + + def select(self): + sock = self.app.sock.sock + if sock.pending(): + return [sock,] + + r, w, e = select.select((sock, ), (), (), self.ping_timeout) + return r + +class WebSocketApp(object): + """ + Higher level of APIs are provided. + The interface is like JavaScript WebSocket object. + """ + + def __init__(self, url, header=None, + on_open=None, on_message=None, on_error=None, + on_close=None, on_ping=None, on_pong=None, + on_cont_message=None, + keep_running=True, get_mask_key=None, cookie=None, + subprotocols=None, + on_data=None): + """ + url: websocket url. + header: custom header for websocket handshake. + on_open: callable object which is called at opening websocket. + this function has one argument. The argument is this class object. + on_message: callable object which is called when received data. + on_message has 2 arguments. + The 1st argument is this class object. + The 2nd argument is utf-8 string which we get from the server. + on_error: callable object which is called when we get error. + on_error has 2 arguments. + The 1st argument is this class object. + The 2nd argument is exception object. + on_close: callable object which is called when closed the connection. + this function has one argument. The argument is this class object. + on_cont_message: callback object which is called when receive continued + frame data. + on_cont_message has 3 arguments. + The 1st argument is this class object. + The 2nd argument is utf-8 string which we get from the server. + The 3rd argument is continue flag. if 0, the data continue + to next frame data + on_data: callback object which is called when a message received. + This is called before on_message or on_cont_message, + and then on_message or on_cont_message is called. + on_data has 4 argument. + The 1st argument is this class object. + The 2nd argument is utf-8 string which we get from the server. + The 3rd argument is data type. ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY will be came. + The 4th argument is continue flag. if 0, the data continue + keep_running: this parameter is obsolete and ignored. + get_mask_key: a callable to produce new mask keys, + see the WebSocket.set_mask_key's docstring for more information + subprotocols: array of available sub protocols. default is None. + """ + self.url = url + self.header = header if header is not None else [] + self.cookie = cookie + + self.on_open = on_open + self.on_message = on_message + self.on_data = on_data + self.on_error = on_error + self.on_close = on_close + self.on_ping = on_ping + self.on_pong = on_pong + self.on_cont_message = on_cont_message + self.keep_running = False + self.get_mask_key = get_mask_key + self.sock = None + self.last_ping_tm = 0 + self.last_pong_tm = 0 + self.subprotocols = subprotocols + + def send(self, data, opcode=ABNF.OPCODE_TEXT): + """ + send message. + data: message to send. If you set opcode to OPCODE_TEXT, + data must be utf-8 string or unicode. + opcode: operation code of data. default is OPCODE_TEXT. + """ + + if not self.sock or self.sock.send(data, opcode) == 0: + raise WebSocketConnectionClosedException( + "Connection is already closed.") + + def close(self, **kwargs): + """ + close websocket connection. + """ + self.keep_running = False + if self.sock: + self.sock.close(**kwargs) + self.sock = None + + def _send_ping(self, interval, event): + while not event.wait(interval): + self.last_ping_tm = time.time() + if self.sock: + try: + self.sock.ping() + except Exception as ex: + _logging.warning("send_ping routine terminated: {}".format(ex)) + break + + def run_forever(self, sockopt=None, sslopt=None, + ping_interval=0, ping_timeout=None, + http_proxy_host=None, http_proxy_port=None, + http_no_proxy=None, http_proxy_auth=None, + skip_utf8_validation=False, + host=None, origin=None, dispatcher=None, + suppress_origin = False, proxy_type=None): + """ + run event loop for WebSocket framework. + This loop is infinite loop and is alive during websocket is available. + sockopt: values for socket.setsockopt. + sockopt must be tuple + and each element is argument of sock.setsockopt. + sslopt: ssl socket optional dict. + ping_interval: automatically send "ping" command + every specified period(second) + if set to 0, not send automatically. + ping_timeout: timeout(second) if the pong message is not received. + http_proxy_host: http proxy host name. + http_proxy_port: http proxy port. If not set, set to 80. + http_no_proxy: host names, which doesn't use proxy. + skip_utf8_validation: skip utf8 validation. + host: update host header. + origin: update origin header. + dispatcher: customize reading data from socket. + suppress_origin: suppress outputting origin header. + + Returns + ------- + False if caught KeyboardInterrupt + True if other exception was raised during a loop + """ + + if ping_timeout is not None and ping_timeout <= 0: + ping_timeout = None + if ping_timeout and ping_interval and ping_interval <= ping_timeout: + raise WebSocketException("Ensure ping_interval > ping_timeout") + if not sockopt: + sockopt = [] + if not sslopt: + sslopt = {} + if self.sock: + raise WebSocketException("socket is already opened") + thread = None + self.keep_running = True + self.last_ping_tm = 0 + self.last_pong_tm = 0 + + def teardown(close_frame=None): + """ + Tears down the connection. + If close_frame is set, we will invoke the on_close handler with the + statusCode and reason from there. + """ + if thread and thread.isAlive(): + event.set() + thread.join() + self.keep_running = False + if self.sock: + self.sock.close() + close_args = self._get_close_args( + close_frame.data if close_frame else None) + self._callback(self.on_close, *close_args) + self.sock = None + + try: + self.sock = WebSocket( + self.get_mask_key, sockopt=sockopt, sslopt=sslopt, + fire_cont_frame=self.on_cont_message is not None, + skip_utf8_validation=skip_utf8_validation, + enable_multithread=True if ping_interval else False) + self.sock.settimeout(getdefaulttimeout()) + self.sock.connect( + self.url, header=self.header, cookie=self.cookie, + http_proxy_host=http_proxy_host, + http_proxy_port=http_proxy_port, http_no_proxy=http_no_proxy, + http_proxy_auth=http_proxy_auth, subprotocols=self.subprotocols, + host=host, origin=origin, suppress_origin=suppress_origin, + proxy_type=proxy_type) + if not dispatcher: + dispatcher = self.create_dispatcher(ping_timeout) + + self._callback(self.on_open) + + if ping_interval: + event = threading.Event() + thread = threading.Thread( + target=self._send_ping, args=(ping_interval, event)) + thread.setDaemon(True) + thread.start() + + def read(): + if not self.keep_running: + return teardown() + + op_code, frame = self.sock.recv_data_frame(True) + if op_code == ABNF.OPCODE_CLOSE: + return teardown(frame) + elif op_code == ABNF.OPCODE_PING: + self._callback(self.on_ping, frame.data) + elif op_code == ABNF.OPCODE_PONG: + self.last_pong_tm = time.time() + self._callback(self.on_pong, frame.data) + elif op_code == ABNF.OPCODE_CONT and self.on_cont_message: + self._callback(self.on_data, frame.data, + frame.opcode, frame.fin) + self._callback(self.on_cont_message, + frame.data, frame.fin) + else: + data = frame.data + if six.PY3 and op_code == ABNF.OPCODE_TEXT: + data = data.decode("utf-8") + self._callback(self.on_data, data, frame.opcode, True) + self._callback(self.on_message, data) + + return True + + def check(): + if (ping_timeout): + has_timeout_expired = time.time() - self.last_ping_tm > ping_timeout + has_pong_not_arrived_after_last_ping = self.last_pong_tm - self.last_ping_tm < 0 + has_pong_arrived_too_late = self.last_pong_tm - self.last_ping_tm > ping_timeout + + if (self.last_ping_tm + and has_timeout_expired + and (has_pong_not_arrived_after_last_ping or has_pong_arrived_too_late)): + raise WebSocketTimeoutException("ping/pong timed out") + return True + + dispatcher.read(self.sock.sock, read, check) + except (Exception, KeyboardInterrupt, SystemExit) as e: + self._callback(self.on_error, e) + if isinstance(e, SystemExit): + # propagate SystemExit further + raise + teardown() + return not isinstance(e, KeyboardInterrupt) + + def create_dispatcher(self, ping_timeout): + timeout = ping_timeout or 10 + if self.sock.is_ssl(): + return SSLDispacther(self, timeout) + + return Dispatcher(self, timeout) + + def _get_close_args(self, data): + """ this functions extracts the code, reason from the close body + if they exists, and if the self.on_close except three arguments """ + # if the on_close callback is "old", just return empty list + if sys.version_info < (3, 0): + if not self.on_close or len(inspect.getargspec(self.on_close).args) != 3: + return [] + else: + if not self.on_close or len(inspect.getfullargspec(self.on_close).args) != 3: + return [] + + if data and len(data) >= 2: + code = 256 * six.byte2int(data[0:1]) + six.byte2int(data[1:2]) + reason = data[2:].decode('utf-8') + return [code, reason] + + return [None, None] + + def _callback(self, callback, *args): + if callback: + try: + if inspect.ismethod(callback): + callback(*args) + else: + callback(self, *args) + + except Exception as e: + _logging.error("error from callback {}: {}".format(callback, e)) + if _logging.isEnabledForDebug(): + _, _, tb = sys.exc_info() + traceback.print_tb(tb) diff --git a/pyextra/websocket/_cookiejar.py b/pyextra/websocket/_cookiejar.py new file mode 100644 index 00000000000000..3efeb0fd2ff26f --- /dev/null +++ b/pyextra/websocket/_cookiejar.py @@ -0,0 +1,52 @@ +try: + import Cookie +except: + import http.cookies as Cookie + + +class SimpleCookieJar(object): + def __init__(self): + self.jar = dict() + + def add(self, set_cookie): + if set_cookie: + try: + simpleCookie = Cookie.SimpleCookie(set_cookie) + except: + simpleCookie = Cookie.SimpleCookie(set_cookie.encode('ascii', 'ignore')) + + for k, v in simpleCookie.items(): + domain = v.get("domain") + if domain: + if not domain.startswith("."): + domain = "." + domain + cookie = self.jar.get(domain) if self.jar.get(domain) else Cookie.SimpleCookie() + cookie.update(simpleCookie) + self.jar[domain.lower()] = cookie + + def set(self, set_cookie): + if set_cookie: + try: + simpleCookie = Cookie.SimpleCookie(set_cookie) + except: + simpleCookie = Cookie.SimpleCookie(set_cookie.encode('ascii', 'ignore')) + + for k, v in simpleCookie.items(): + domain = v.get("domain") + if domain: + if not domain.startswith("."): + domain = "." + domain + self.jar[domain.lower()] = simpleCookie + + def get(self, host): + if not host: + return "" + + cookies = [] + for domain, simpleCookie in self.jar.items(): + host = host.lower() + if host.endswith(domain) or host == domain[1:]: + cookies.append(self.jar.get(domain)) + + return "; ".join(filter(None, ["%s=%s" % (k, v.value) for cookie in filter(None, sorted(cookies)) for k, v in + sorted(cookie.items())])) diff --git a/pyextra/websocket/_core.py b/pyextra/websocket/_core.py new file mode 100644 index 00000000000000..0f914c21e89e8b --- /dev/null +++ b/pyextra/websocket/_core.py @@ -0,0 +1,515 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" +from __future__ import print_function + +import socket +import struct +import threading +import time + +import six + +# websocket modules +from ._abnf import * +from ._exceptions import * +from ._handshake import * +from ._http import * +from ._logging import * +from ._socket import * +from ._ssl_compat import * +from ._utils import * + +__all__ = ['WebSocket', 'create_connection'] + +""" +websocket python client. +========================= + +This version support only hybi-13. +Please see http://tools.ietf.org/html/rfc6455 for protocol. +""" + + +class WebSocket(object): + """ + Low level WebSocket interface. + This class is based on + The WebSocket protocol draft-hixie-thewebsocketprotocol-76 + http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76 + + We can connect to the websocket server and send/receive data. + The following example is an echo client. + + >>> import websocket + >>> ws = websocket.WebSocket() + >>> ws.connect("ws://echo.websocket.org") + >>> ws.send("Hello, Server") + >>> ws.recv() + 'Hello, Server' + >>> ws.close() + + get_mask_key: a callable to produce new mask keys, see the set_mask_key + function's docstring for more details + sockopt: values for socket.setsockopt. + sockopt must be tuple and each element is argument of sock.setsockopt. + sslopt: dict object for ssl socket option. + fire_cont_frame: fire recv event for each cont frame. default is False + enable_multithread: if set to True, lock send method. + skip_utf8_validation: skip utf8 validation. + """ + + def __init__(self, get_mask_key=None, sockopt=None, sslopt=None, + fire_cont_frame=False, enable_multithread=False, + skip_utf8_validation=False, **_): + """ + Initialize WebSocket object. + """ + self.sock_opt = sock_opt(sockopt, sslopt) + self.handshake_response = None + self.sock = None + + self.connected = False + self.get_mask_key = get_mask_key + # These buffer over the build-up of a single frame. + self.frame_buffer = frame_buffer(self._recv, skip_utf8_validation) + self.cont_frame = continuous_frame( + fire_cont_frame, skip_utf8_validation) + + if enable_multithread: + self.lock = threading.Lock() + self.readlock = threading.Lock() + else: + self.lock = NoLock() + self.readlock = NoLock() + + def __iter__(self): + """ + Allow iteration over websocket, implying sequential `recv` executions. + """ + while True: + yield self.recv() + + def __next__(self): + return self.recv() + + def next(self): + return self.__next__() + + def fileno(self): + return self.sock.fileno() + + def set_mask_key(self, func): + """ + set function to create musk key. You can customize mask key generator. + Mainly, this is for testing purpose. + + func: callable object. the func takes 1 argument as integer. + The argument means length of mask key. + This func must return string(byte array), + which length is argument specified. + """ + self.get_mask_key = func + + def gettimeout(self): + """ + Get the websocket timeout(second). + """ + return self.sock_opt.timeout + + def settimeout(self, timeout): + """ + Set the timeout to the websocket. + + timeout: timeout time(second). + """ + self.sock_opt.timeout = timeout + if self.sock: + self.sock.settimeout(timeout) + + timeout = property(gettimeout, settimeout) + + def getsubprotocol(self): + """ + get subprotocol + """ + if self.handshake_response: + return self.handshake_response.subprotocol + else: + return None + + subprotocol = property(getsubprotocol) + + def getstatus(self): + """ + get handshake status + """ + if self.handshake_response: + return self.handshake_response.status + else: + return None + + status = property(getstatus) + + def getheaders(self): + """ + get handshake response header + """ + if self.handshake_response: + return self.handshake_response.headers + else: + return None + + def is_ssl(self): + return isinstance(self.sock, ssl.SSLSocket) + + headers = property(getheaders) + + def connect(self, url, **options): + """ + Connect to url. url is websocket url scheme. + ie. ws://host:port/resource + You can customize using 'options'. + If you set "header" list object, you can set your own custom header. + + >>> ws = WebSocket() + >>> ws.connect("ws://echo.websocket.org/", + ... header=["User-Agent: MyProgram", + ... "x-custom: header"]) + + timeout: socket timeout time. This value is integer. + if you set None for this value, + it means "use default_timeout value" + + options: "header" -> custom http header list or dict. + "cookie" -> cookie value. + "origin" -> custom origin url. + "suppress_origin" -> suppress outputting origin header. + "host" -> custom host header string. + "http_proxy_host" - http proxy host name. + "http_proxy_port" - http proxy port. If not set, set to 80. + "http_no_proxy" - host names, which doesn't use proxy. + "http_proxy_auth" - http proxy auth information. + tuple of username and password. + default is None + "redirect_limit" -> number of redirects to follow. + "subprotocols" - array of available sub protocols. + default is None. + "socket" - pre-initialized stream socket. + + """ + # FIXME: "subprotocols" are getting lost, not passed down + # FIXME: "header", "cookie", "origin" and "host" too + self.sock_opt.timeout = options.get('timeout', self.sock_opt.timeout) + self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options), + options.pop('socket', None)) + + try: + self.handshake_response = handshake(self.sock, *addrs, **options) + for attempt in range(options.pop('redirect_limit', 3)): + if self.handshake_response.status in SUPPORTED_REDIRECT_STATUSES: + url = self.handshake_response.headers['location'] + self.sock.close() + self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options), + options.pop('socket', None)) + self.handshake_response = handshake(self.sock, *addrs, **options) + self.connected = True + except: + if self.sock: + self.sock.close() + self.sock = None + raise + + def send(self, payload, opcode=ABNF.OPCODE_TEXT): + """ + Send the data as string. + + payload: Payload must be utf-8 string or unicode, + if the opcode is OPCODE_TEXT. + Otherwise, it must be string(byte array) + + opcode: operation code to send. Please see OPCODE_XXX. + """ + + frame = ABNF.create_frame(payload, opcode) + return self.send_frame(frame) + + def send_frame(self, frame): + """ + Send the data frame. + + frame: frame data created by ABNF.create_frame + + >>> ws = create_connection("ws://echo.websocket.org/") + >>> frame = ABNF.create_frame("Hello", ABNF.OPCODE_TEXT) + >>> ws.send_frame(frame) + >>> cont_frame = ABNF.create_frame("My name is ", ABNF.OPCODE_CONT, 0) + >>> ws.send_frame(frame) + >>> cont_frame = ABNF.create_frame("Foo Bar", ABNF.OPCODE_CONT, 1) + >>> ws.send_frame(frame) + + """ + if self.get_mask_key: + frame.get_mask_key = self.get_mask_key + data = frame.format() + length = len(data) + trace("send: " + repr(data)) + + with self.lock: + while data: + l = self._send(data) + data = data[l:] + + return length + + def send_binary(self, payload): + return self.send(payload, ABNF.OPCODE_BINARY) + + def ping(self, payload=""): + """ + send ping data. + + payload: data payload to send server. + """ + if isinstance(payload, six.text_type): + payload = payload.encode("utf-8") + self.send(payload, ABNF.OPCODE_PING) + + def pong(self, payload): + """ + send pong data. + + payload: data payload to send server. + """ + if isinstance(payload, six.text_type): + payload = payload.encode("utf-8") + self.send(payload, ABNF.OPCODE_PONG) + + def recv(self): + """ + Receive string data(byte array) from the server. + + return value: string(byte array) value. + """ + with self.readlock: + opcode, data = self.recv_data() + if six.PY3 and opcode == ABNF.OPCODE_TEXT: + return data.decode("utf-8") + elif opcode == ABNF.OPCODE_TEXT or opcode == ABNF.OPCODE_BINARY: + return data + else: + return '' + + def recv_data(self, control_frame=False): + """ + Receive data with operation code. + + control_frame: a boolean flag indicating whether to return control frame + data, defaults to False + + return value: tuple of operation code and string(byte array) value. + """ + opcode, frame = self.recv_data_frame(control_frame) + return opcode, frame.data + + def recv_data_frame(self, control_frame=False): + """ + Receive data with operation code. + + control_frame: a boolean flag indicating whether to return control frame + data, defaults to False + + return value: tuple of operation code and string(byte array) value. + """ + while True: + frame = self.recv_frame() + if not frame: + # handle error: + # 'NoneType' object has no attribute 'opcode' + raise WebSocketProtocolException( + "Not a valid frame %s" % frame) + elif frame.opcode in (ABNF.OPCODE_TEXT, ABNF.OPCODE_BINARY, ABNF.OPCODE_CONT): + self.cont_frame.validate(frame) + self.cont_frame.add(frame) + + if self.cont_frame.is_fire(frame): + return self.cont_frame.extract(frame) + + elif frame.opcode == ABNF.OPCODE_CLOSE: + self.send_close() + return frame.opcode, frame + elif frame.opcode == ABNF.OPCODE_PING: + if len(frame.data) < 126: + self.pong(frame.data) + else: + raise WebSocketProtocolException( + "Ping message is too long") + if control_frame: + return frame.opcode, frame + elif frame.opcode == ABNF.OPCODE_PONG: + if control_frame: + return frame.opcode, frame + + def recv_frame(self): + """ + receive data as frame from server. + + return value: ABNF frame object. + """ + return self.frame_buffer.recv_frame() + + def send_close(self, status=STATUS_NORMAL, reason=six.b("")): + """ + send close data to the server. + + status: status code to send. see STATUS_XXX. + + reason: the reason to close. This must be string or bytes. + """ + if status < 0 or status >= ABNF.LENGTH_16: + raise ValueError("code is invalid range") + self.connected = False + self.send(struct.pack('!H', status) + reason, ABNF.OPCODE_CLOSE) + + def close(self, status=STATUS_NORMAL, reason=six.b(""), timeout=3): + """ + Close Websocket object + + status: status code to send. see STATUS_XXX. + + reason: the reason to close. This must be string. + + timeout: timeout until receive a close frame. + If None, it will wait forever until receive a close frame. + """ + if self.connected: + if status < 0 or status >= ABNF.LENGTH_16: + raise ValueError("code is invalid range") + + try: + self.connected = False + self.send(struct.pack('!H', status) + + reason, ABNF.OPCODE_CLOSE) + sock_timeout = self.sock.gettimeout() + self.sock.settimeout(timeout) + start_time = time.time() + while timeout is None or time.time() - start_time < timeout: + try: + frame = self.recv_frame() + if frame.opcode != ABNF.OPCODE_CLOSE: + continue + if isEnabledForError(): + recv_status = struct.unpack("!H", frame.data[0:2])[0] + if recv_status != STATUS_NORMAL: + error("close status: " + repr(recv_status)) + break + except: + break + self.sock.settimeout(sock_timeout) + self.sock.shutdown(socket.SHUT_RDWR) + except: + pass + + self.shutdown() + + def abort(self): + """ + Low-level asynchronous abort, wakes up other threads that are waiting in recv_* + """ + if self.connected: + self.sock.shutdown(socket.SHUT_RDWR) + + def shutdown(self): + """close socket, immediately.""" + if self.sock: + self.sock.close() + self.sock = None + self.connected = False + + def _send(self, data): + return send(self.sock, data) + + def _recv(self, bufsize): + try: + return recv(self.sock, bufsize) + except WebSocketConnectionClosedException: + if self.sock: + self.sock.close() + self.sock = None + self.connected = False + raise + + +def create_connection(url, timeout=None, class_=WebSocket, **options): + """ + connect to url and return websocket object. + + Connect to url and return the WebSocket object. + Passing optional timeout parameter will set the timeout on the socket. + If no timeout is supplied, + the global default timeout setting returned by getdefauttimeout() is used. + You can customize using 'options'. + If you set "header" list object, you can set your own custom header. + + >>> conn = create_connection("ws://echo.websocket.org/", + ... header=["User-Agent: MyProgram", + ... "x-custom: header"]) + + + timeout: socket timeout time. This value is integer. + if you set None for this value, + it means "use default_timeout value" + + class_: class to instantiate when creating the connection. It has to implement + settimeout and connect. It's __init__ should be compatible with + WebSocket.__init__, i.e. accept all of it's kwargs. + options: "header" -> custom http header list or dict. + "cookie" -> cookie value. + "origin" -> custom origin url. + "suppress_origin" -> suppress outputting origin header. + "host" -> custom host header string. + "http_proxy_host" - http proxy host name. + "http_proxy_port" - http proxy port. If not set, set to 80. + "http_no_proxy" - host names, which doesn't use proxy. + "http_proxy_auth" - http proxy auth information. + tuple of username and password. + default is None + "enable_multithread" -> enable lock for multithread. + "redirect_limit" -> number of redirects to follow. + "sockopt" -> socket options + "sslopt" -> ssl option + "subprotocols" - array of available sub protocols. + default is None. + "skip_utf8_validation" - skip utf8 validation. + "socket" - pre-initialized stream socket. + """ + sockopt = options.pop("sockopt", []) + sslopt = options.pop("sslopt", {}) + fire_cont_frame = options.pop("fire_cont_frame", False) + enable_multithread = options.pop("enable_multithread", False) + skip_utf8_validation = options.pop("skip_utf8_validation", False) + websock = class_(sockopt=sockopt, sslopt=sslopt, + fire_cont_frame=fire_cont_frame, + enable_multithread=enable_multithread, + skip_utf8_validation=skip_utf8_validation, **options) + websock.settimeout(timeout if timeout is not None else getdefaulttimeout()) + websock.connect(url, **options) + return websock diff --git a/pyextra/websocket/_exceptions.py b/pyextra/websocket/_exceptions.py new file mode 100644 index 00000000000000..b7a61d3f636000 --- /dev/null +++ b/pyextra/websocket/_exceptions.py @@ -0,0 +1,87 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" + + +""" +define websocket exceptions +""" + + +class WebSocketException(Exception): + """ + websocket exception class. + """ + pass + + +class WebSocketProtocolException(WebSocketException): + """ + If the websocket protocol is invalid, this exception will be raised. + """ + pass + + +class WebSocketPayloadException(WebSocketException): + """ + If the websocket payload is invalid, this exception will be raised. + """ + pass + + +class WebSocketConnectionClosedException(WebSocketException): + """ + If remote host closed the connection or some network error happened, + this exception will be raised. + """ + pass + + +class WebSocketTimeoutException(WebSocketException): + """ + WebSocketTimeoutException will be raised at socket timeout during read/write data. + """ + pass + + +class WebSocketProxyException(WebSocketException): + """ + WebSocketProxyException will be raised when proxy error occurred. + """ + pass + + +class WebSocketBadStatusException(WebSocketException): + """ + WebSocketBadStatusException will be raised when we get bad handshake status code. + """ + + def __init__(self, message, status_code, status_message=None, resp_headers=None): + msg = message % (status_code, status_message) + super(WebSocketBadStatusException, self).__init__(msg) + self.status_code = status_code + self.resp_headers = resp_headers + +class WebSocketAddressException(WebSocketException): + """ + If the websocket address info cannot be found, this exception will be raised. + """ + pass diff --git a/pyextra/websocket/_handshake.py b/pyextra/websocket/_handshake.py new file mode 100644 index 00000000000000..809a8c989486d9 --- /dev/null +++ b/pyextra/websocket/_handshake.py @@ -0,0 +1,205 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" +import hashlib +import hmac +import os + +import six + +from ._cookiejar import SimpleCookieJar +from ._exceptions import * +from ._http import * +from ._logging import * +from ._socket import * + +if six.PY3: + from base64 import encodebytes as base64encode +else: + from base64 import encodestring as base64encode + +if six.PY3: + if six.PY34: + from http import client as HTTPStatus + else: + from http import HTTPStatus +else: + import httplib as HTTPStatus + +__all__ = ["handshake_response", "handshake", "SUPPORTED_REDIRECT_STATUSES"] + +if hasattr(hmac, "compare_digest"): + compare_digest = hmac.compare_digest +else: + def compare_digest(s1, s2): + return s1 == s2 + +# websocket supported version. +VERSION = 13 + +SUPPORTED_REDIRECT_STATUSES = [HTTPStatus.MOVED_PERMANENTLY, HTTPStatus.FOUND, HTTPStatus.SEE_OTHER] + +CookieJar = SimpleCookieJar() + + +class handshake_response(object): + + def __init__(self, status, headers, subprotocol): + self.status = status + self.headers = headers + self.subprotocol = subprotocol + CookieJar.add(headers.get("set-cookie")) + + +def handshake(sock, hostname, port, resource, **options): + headers, key = _get_handshake_headers(resource, hostname, port, options) + + header_str = "\r\n".join(headers) + send(sock, header_str) + dump("request header", header_str) + + status, resp = _get_resp_headers(sock) + if status in SUPPORTED_REDIRECT_STATUSES: + return handshake_response(status, resp, None) + success, subproto = _validate(resp, key, options.get("subprotocols")) + if not success: + raise WebSocketException("Invalid WebSocket Header") + + return handshake_response(status, resp, subproto) + +def _pack_hostname(hostname): + # IPv6 address + if ':' in hostname: + return '[' + hostname + ']' + + return hostname + +def _get_handshake_headers(resource, host, port, options): + headers = [ + "GET %s HTTP/1.1" % resource, + "Upgrade: websocket", + "Connection: Upgrade" + ] + if port == 80 or port == 443: + hostport = _pack_hostname(host) + else: + hostport = "%s:%d" % (_pack_hostname(host), port) + + if "host" in options and options["host"] is not None: + headers.append("Host: %s" % options["host"]) + else: + headers.append("Host: %s" % hostport) + + if "suppress_origin" not in options or not options["suppress_origin"]: + if "origin" in options and options["origin"] is not None: + headers.append("Origin: %s" % options["origin"]) + else: + headers.append("Origin: http://%s" % hostport) + + key = _create_sec_websocket_key() + + # Append Sec-WebSocket-Key & Sec-WebSocket-Version if not manually specified + if not 'header' in options or 'Sec-WebSocket-Key' not in options['header']: + key = _create_sec_websocket_key() + headers.append("Sec-WebSocket-Key: %s" % key) + else: + key = options['header']['Sec-WebSocket-Key'] + + if not 'header' in options or 'Sec-WebSocket-Version' not in options['header']: + headers.append("Sec-WebSocket-Version: %s" % VERSION) + + subprotocols = options.get("subprotocols") + if subprotocols: + headers.append("Sec-WebSocket-Protocol: %s" % ",".join(subprotocols)) + + if "header" in options: + header = options["header"] + if isinstance(header, dict): + header = [ + ": ".join([k, v]) + for k, v in header.items() + if v is not None + ] + headers.extend(header) + + server_cookie = CookieJar.get(host) + client_cookie = options.get("cookie", None) + + cookie = "; ".join(filter(None, [server_cookie, client_cookie])) + + if cookie: + headers.append("Cookie: %s" % cookie) + + headers.append("") + headers.append("") + + return headers, key + + +def _get_resp_headers(sock, success_statuses=(101, 301, 302, 303)): + status, resp_headers, status_message = read_headers(sock) + if status not in success_statuses: + raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers) + return status, resp_headers + +_HEADERS_TO_CHECK = { + "upgrade": "websocket", + "connection": "upgrade", +} + + +def _validate(headers, key, subprotocols): + subproto = None + for k, v in _HEADERS_TO_CHECK.items(): + r = headers.get(k, None) + if not r: + return False, None + r = r.lower() + if v != r: + return False, None + + if subprotocols: + subproto = headers.get("sec-websocket-protocol", None).lower() + if not subproto or subproto not in [s.lower() for s in subprotocols]: + error("Invalid subprotocol: " + str(subprotocols)) + return False, None + + result = headers.get("sec-websocket-accept", None) + if not result: + return False, None + result = result.lower() + + if isinstance(result, six.text_type): + result = result.encode('utf-8') + + value = (key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11").encode('utf-8') + hashed = base64encode(hashlib.sha1(value).digest()).strip().lower() + success = compare_digest(hashed, result) + + if success: + return True, subproto + else: + return False, None + + +def _create_sec_websocket_key(): + randomness = os.urandom(16) + return base64encode(randomness).decode('utf-8').strip() diff --git a/pyextra/websocket/_http.py b/pyextra/websocket/_http.py new file mode 100644 index 00000000000000..818068746405cd --- /dev/null +++ b/pyextra/websocket/_http.py @@ -0,0 +1,328 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" +import errno +import os +import socket +import sys + +import six + +from ._exceptions import * +from ._logging import * +from ._socket import* +from ._ssl_compat import * +from ._url import * + +if six.PY3: + from base64 import encodebytes as base64encode +else: + from base64 import encodestring as base64encode + +__all__ = ["proxy_info", "connect", "read_headers"] + +try: + import socks + ProxyConnectionError = socks.ProxyConnectionError + HAS_PYSOCKS = True +except: + class ProxyConnectionError(BaseException): + pass + HAS_PYSOCKS = False + +class proxy_info(object): + + def __init__(self, **options): + self.type = options.get("proxy_type") or "http" + if not(self.type in ['http', 'socks4', 'socks5', 'socks5h']): + raise ValueError("proxy_type must be 'http', 'socks4', 'socks5' or 'socks5h'") + self.host = options.get("http_proxy_host", None) + if self.host: + self.port = options.get("http_proxy_port", 0) + self.auth = options.get("http_proxy_auth", None) + self.no_proxy = options.get("http_no_proxy", None) + else: + self.port = 0 + self.auth = None + self.no_proxy = None + +def _open_proxied_socket(url, options, proxy): + hostname, port, resource, is_secure = parse_url(url) + + if not HAS_PYSOCKS: + raise WebSocketException("PySocks module not found.") + + ptype = socks.SOCKS5 + rdns = False + if proxy.type == "socks4": + ptype = socks.SOCKS4 + if proxy.type == "http": + ptype = socks.HTTP + if proxy.type[-1] == "h": + rdns = True + + sock = socks.create_connection( + (hostname, port), + proxy_type = ptype, + proxy_addr = proxy.host, + proxy_port = proxy.port, + proxy_rdns = rdns, + proxy_username = proxy.auth[0] if proxy.auth else None, + proxy_password = proxy.auth[1] if proxy.auth else None, + timeout = options.timeout, + socket_options = DEFAULT_SOCKET_OPTION + options.sockopt + ) + + if is_secure: + if HAVE_SSL: + sock = _ssl_socket(sock, options.sslopt, hostname) + else: + raise WebSocketException("SSL not available.") + + return sock, (hostname, port, resource) + + +def connect(url, options, proxy, socket): + if proxy.host and not socket and not (proxy.type == 'http'): + return _open_proxied_socket(url, options, proxy) + + hostname, port, resource, is_secure = parse_url(url) + + if socket: + return socket, (hostname, port, resource) + + addrinfo_list, need_tunnel, auth = _get_addrinfo_list( + hostname, port, is_secure, proxy) + if not addrinfo_list: + raise WebSocketException( + "Host not found.: " + hostname + ":" + str(port)) + + sock = None + try: + sock = _open_socket(addrinfo_list, options.sockopt, options.timeout) + if need_tunnel: + sock = _tunnel(sock, hostname, port, auth) + + if is_secure: + if HAVE_SSL: + sock = _ssl_socket(sock, options.sslopt, hostname) + else: + raise WebSocketException("SSL not available.") + + return sock, (hostname, port, resource) + except: + if sock: + sock.close() + raise + + +def _get_addrinfo_list(hostname, port, is_secure, proxy): + phost, pport, pauth = get_proxy_info( + hostname, is_secure, proxy.host, proxy.port, proxy.auth, proxy.no_proxy) + try: + if not phost: + addrinfo_list = [ai for ai in socket.getaddrinfo( + hostname, port, 0, 0, socket.SOL_TCP) + if (ai[0] == socket.AF_INET6 and socket.has_ipv6) or ai[0] != socket.AF_INET6 + ] + return addrinfo_list, False, None + else: + pport = pport and pport or 80 + # when running on windows 10, the getaddrinfo used above + # returns a socktype 0. This generates an error exception: + #_on_error: exception Socket type must be stream or datagram, not 0 + # Force the socket type to SOCK_STREAM + addrinfo_list = socket.getaddrinfo(phost, pport, 0, socket.SOCK_STREAM, socket.SOL_TCP) + return addrinfo_list, True, pauth + except socket.gaierror as e: + raise WebSocketAddressException(e) + + +def _open_socket(addrinfo_list, sockopt, timeout): + err = None + for addrinfo in addrinfo_list: + family, socktype, proto = addrinfo[:3] + sock = socket.socket(family, socktype, proto) + sock.settimeout(timeout) + for opts in DEFAULT_SOCKET_OPTION: + sock.setsockopt(*opts) + for opts in sockopt: + sock.setsockopt(*opts) + + address = addrinfo[4] + err = None + while not err: + try: + sock.connect(address) + except ProxyConnectionError as error: + err = WebSocketProxyException(str(error)) + err.remote_ip = str(address[0]) + continue + except socket.error as error: + error.remote_ip = str(address[0]) + try: + eConnRefused = (errno.ECONNREFUSED, errno.WSAECONNREFUSED) + except: + eConnRefused = (errno.ECONNREFUSED, ) + if error.errno == errno.EINTR: + continue + elif error.errno in eConnRefused: + err = error + continue + else: + raise error + else: + break + else: + continue + break + else: + if err: + raise err + + return sock + + +def _can_use_sni(): + return six.PY2 and sys.version_info >= (2, 7, 9) or sys.version_info >= (3, 2) + + +def _wrap_sni_socket(sock, sslopt, hostname, check_hostname): + context = ssl.SSLContext(sslopt.get('ssl_version', ssl.PROTOCOL_SSLv23)) + + if sslopt.get('cert_reqs', ssl.CERT_NONE) != ssl.CERT_NONE: + cafile = sslopt.get('ca_certs', None) + capath = sslopt.get('ca_cert_path', None) + if cafile or capath: + context.load_verify_locations(cafile=cafile, capath=capath) + elif hasattr(context, 'load_default_certs'): + context.load_default_certs(ssl.Purpose.SERVER_AUTH) + if sslopt.get('certfile', None): + context.load_cert_chain( + sslopt['certfile'], + sslopt.get('keyfile', None), + sslopt.get('password', None), + ) + # see + # https://github.com/liris/websocket-client/commit/b96a2e8fa765753e82eea531adb19716b52ca3ca#commitcomment-10803153 + context.verify_mode = sslopt['cert_reqs'] + if HAVE_CONTEXT_CHECK_HOSTNAME: + context.check_hostname = check_hostname + if 'ciphers' in sslopt: + context.set_ciphers(sslopt['ciphers']) + if 'cert_chain' in sslopt: + certfile, keyfile, password = sslopt['cert_chain'] + context.load_cert_chain(certfile, keyfile, password) + if 'ecdh_curve' in sslopt: + context.set_ecdh_curve(sslopt['ecdh_curve']) + + return context.wrap_socket( + sock, + do_handshake_on_connect=sslopt.get('do_handshake_on_connect', True), + suppress_ragged_eofs=sslopt.get('suppress_ragged_eofs', True), + server_hostname=hostname, + ) + + +def _ssl_socket(sock, user_sslopt, hostname): + sslopt = dict(cert_reqs=ssl.CERT_REQUIRED) + sslopt.update(user_sslopt) + + certPath = os.environ.get('WEBSOCKET_CLIENT_CA_BUNDLE') + if certPath and os.path.isfile(certPath) \ + and user_sslopt.get('ca_certs', None) is None \ + and user_sslopt.get('ca_cert', None) is None: + sslopt['ca_certs'] = certPath + elif certPath and os.path.isdir(certPath) \ + and user_sslopt.get('ca_cert_path', None) is None: + sslopt['ca_cert_path'] = certPath + + check_hostname = sslopt["cert_reqs"] != ssl.CERT_NONE and sslopt.pop( + 'check_hostname', True) + + if _can_use_sni(): + sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname) + else: + sslopt.pop('check_hostname', True) + sock = ssl.wrap_socket(sock, **sslopt) + + if not HAVE_CONTEXT_CHECK_HOSTNAME and check_hostname: + match_hostname(sock.getpeercert(), hostname) + + return sock + + +def _tunnel(sock, host, port, auth): + debug("Connecting proxy...") + connect_header = "CONNECT %s:%d HTTP/1.0\r\n" % (host, port) + # TODO: support digest auth. + if auth and auth[0]: + auth_str = auth[0] + if auth[1]: + auth_str += ":" + auth[1] + encoded_str = base64encode(auth_str.encode()).strip().decode() + connect_header += "Proxy-Authorization: Basic %s\r\n" % encoded_str + connect_header += "\r\n" + dump("request header", connect_header) + + send(sock, connect_header) + + try: + status, resp_headers, status_message = read_headers(sock) + except Exception as e: + raise WebSocketProxyException(str(e)) + + if status != 200: + raise WebSocketProxyException( + "failed CONNECT via proxy status: %r" % status) + + return sock + + +def read_headers(sock): + status = None + status_message = None + headers = {} + trace("--- response header ---") + + while True: + line = recv_line(sock) + line = line.decode('utf-8').strip() + if not line: + break + trace(line) + if not status: + + status_info = line.split(" ", 2) + status = int(status_info[1]) + if len(status_info) > 2: + status_message = status_info[2] + else: + kv = line.split(":", 1) + if len(kv) == 2: + key, value = kv + headers[key.lower()] = value.strip() + else: + raise WebSocketException("Invalid header") + + trace("-----------------------") + + return status, headers, status_message diff --git a/pyextra/websocket/_logging.py b/pyextra/websocket/_logging.py new file mode 100644 index 00000000000000..70a6271d922393 --- /dev/null +++ b/pyextra/websocket/_logging.py @@ -0,0 +1,82 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" +import logging + +_logger = logging.getLogger('websocket') +try: + from logging import NullHandler +except ImportError: + class NullHandler(logging.Handler): + def emit(self, record): + pass + +_logger.addHandler(NullHandler()) + +_traceEnabled = False + +__all__ = ["enableTrace", "dump", "error", "warning", "debug", "trace", + "isEnabledForError", "isEnabledForDebug"] + + +def enableTrace(traceable, handler = logging.StreamHandler()): + """ + turn on/off the traceability. + + traceable: boolean value. if set True, traceability is enabled. + """ + global _traceEnabled + _traceEnabled = traceable + if traceable: + _logger.addHandler(handler) + _logger.setLevel(logging.DEBUG) + + +def dump(title, message): + if _traceEnabled: + _logger.debug("--- " + title + " ---") + _logger.debug(message) + _logger.debug("-----------------------") + + +def error(msg): + _logger.error(msg) + + +def warning(msg): + _logger.warning(msg) + + +def debug(msg): + _logger.debug(msg) + + +def trace(msg): + if _traceEnabled: + _logger.debug(msg) + + +def isEnabledForError(): + return _logger.isEnabledFor(logging.ERROR) + + +def isEnabledForDebug(): + return _logger.isEnabledFor(logging.DEBUG) diff --git a/pyextra/websocket/_socket.py b/pyextra/websocket/_socket.py new file mode 100644 index 00000000000000..d811c21d95540f --- /dev/null +++ b/pyextra/websocket/_socket.py @@ -0,0 +1,160 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" +import errno +import select +import socket + +import six +import sys + +from ._exceptions import * +from ._ssl_compat import * +from ._utils import * + +DEFAULT_SOCKET_OPTION = [(socket.SOL_TCP, socket.TCP_NODELAY, 1)] +if hasattr(socket, "SO_KEEPALIVE"): + DEFAULT_SOCKET_OPTION.append((socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)) +if hasattr(socket, "TCP_KEEPIDLE"): + DEFAULT_SOCKET_OPTION.append((socket.SOL_TCP, socket.TCP_KEEPIDLE, 30)) +if hasattr(socket, "TCP_KEEPINTVL"): + DEFAULT_SOCKET_OPTION.append((socket.SOL_TCP, socket.TCP_KEEPINTVL, 10)) +if hasattr(socket, "TCP_KEEPCNT"): + DEFAULT_SOCKET_OPTION.append((socket.SOL_TCP, socket.TCP_KEEPCNT, 3)) + +_default_timeout = None + +__all__ = ["DEFAULT_SOCKET_OPTION", "sock_opt", "setdefaulttimeout", "getdefaulttimeout", + "recv", "recv_line", "send"] + + +class sock_opt(object): + + def __init__(self, sockopt, sslopt): + if sockopt is None: + sockopt = [] + if sslopt is None: + sslopt = {} + self.sockopt = sockopt + self.sslopt = sslopt + self.timeout = None + + +def setdefaulttimeout(timeout): + """ + Set the global timeout setting to connect. + + timeout: default socket timeout time. This value is second. + """ + global _default_timeout + _default_timeout = timeout + + +def getdefaulttimeout(): + """ + Return the global timeout setting(second) to connect. + """ + return _default_timeout + + +def recv(sock, bufsize): + if not sock: + raise WebSocketConnectionClosedException("socket is already closed.") + + def _recv(): + try: + return sock.recv(bufsize) + except SSLWantReadError: + pass + except socket.error as exc: + error_code = extract_error_code(exc) + if error_code is None: + raise + if error_code != errno.EAGAIN or error_code != errno.EWOULDBLOCK: + raise + + r, w, e = select.select((sock, ), (), (), sock.gettimeout()) + if r: + return sock.recv(bufsize) + + try: + bytes_ = _recv() + except socket.timeout as e: + message = extract_err_message(e) + raise WebSocketTimeoutException(message) + except SSLError as e: + message = extract_err_message(e) + if isinstance(message, str) and 'timed out' in message: + raise WebSocketTimeoutException(message) + else: + raise + + if not bytes_: + raise WebSocketConnectionClosedException( + "Connection is already closed.") + + return bytes_ + + +def recv_line(sock): + line = [] + while True: + c = recv(sock, 1) + line.append(c) + if c == six.b("\n"): + break + return six.b("").join(line) + + +def send(sock, data): + if isinstance(data, six.text_type): + data = data.encode('utf-8') + + if not sock: + raise WebSocketConnectionClosedException("socket is already closed.") + + def _send(): + try: + return sock.send(data) + except SSLWantWriteError: + pass + except socket.error as exc: + error_code = extract_error_code(exc) + if error_code is None: + raise + if error_code != errno.EAGAIN or error_code != errno.EWOULDBLOCK: + raise + + r, w, e = select.select((), (sock, ), (), sock.gettimeout()) + if w: + return sock.send(data) + + try: + return _send() + except socket.timeout as e: + message = extract_err_message(e) + raise WebSocketTimeoutException(message) + except Exception as e: + message = extract_err_message(e) + if isinstance(message, str) and "timed out" in message: + raise WebSocketTimeoutException(message) + else: + raise diff --git a/pyextra/websocket/_ssl_compat.py b/pyextra/websocket/_ssl_compat.py new file mode 100644 index 00000000000000..5b3c413c84ce0c --- /dev/null +++ b/pyextra/websocket/_ssl_compat.py @@ -0,0 +1,52 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" +__all__ = ["HAVE_SSL", "ssl", "SSLError", "SSLWantReadError", "SSLWantWriteError"] + +try: + import ssl + from ssl import SSLError + from ssl import SSLWantReadError + from ssl import SSLWantWriteError + if hasattr(ssl, 'SSLContext') and hasattr(ssl.SSLContext, 'check_hostname'): + HAVE_CONTEXT_CHECK_HOSTNAME = True + else: + HAVE_CONTEXT_CHECK_HOSTNAME = False + if hasattr(ssl, "match_hostname"): + from ssl import match_hostname + else: + from backports.ssl_match_hostname import match_hostname + __all__.append("match_hostname") + __all__.append("HAVE_CONTEXT_CHECK_HOSTNAME") + + HAVE_SSL = True +except ImportError: + # dummy class of SSLError for ssl none-support environment. + class SSLError(Exception): + pass + + class SSLWantReadError(Exception): + pass + + class SSLWantWriteError(Exception): + pass + + HAVE_SSL = False diff --git a/pyextra/websocket/_url.py b/pyextra/websocket/_url.py new file mode 100644 index 00000000000000..ae46d6c40b21ef --- /dev/null +++ b/pyextra/websocket/_url.py @@ -0,0 +1,163 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" + +import os +import socket +import struct + +from six.moves.urllib.parse import urlparse + + +__all__ = ["parse_url", "get_proxy_info"] + + +def parse_url(url): + """ + parse url and the result is tuple of + (hostname, port, resource path and the flag of secure mode) + + url: url string. + """ + if ":" not in url: + raise ValueError("url is invalid") + + scheme, url = url.split(":", 1) + + parsed = urlparse(url, scheme="ws") + if parsed.hostname: + hostname = parsed.hostname + else: + raise ValueError("hostname is invalid") + port = 0 + if parsed.port: + port = parsed.port + + is_secure = False + if scheme == "ws": + if not port: + port = 80 + elif scheme == "wss": + is_secure = True + if not port: + port = 443 + else: + raise ValueError("scheme %s is invalid" % scheme) + + if parsed.path: + resource = parsed.path + else: + resource = "/" + + if parsed.query: + resource += "?" + parsed.query + + return hostname, port, resource, is_secure + + +DEFAULT_NO_PROXY_HOST = ["localhost", "127.0.0.1"] + + +def _is_ip_address(addr): + try: + socket.inet_aton(addr) + except socket.error: + return False + else: + return True + + +def _is_subnet_address(hostname): + try: + addr, netmask = hostname.split("/") + return _is_ip_address(addr) and 0 <= int(netmask) < 32 + except ValueError: + return False + + +def _is_address_in_network(ip, net): + ipaddr = struct.unpack('I', socket.inet_aton(ip))[0] + netaddr, bits = net.split('/') + netmask = struct.unpack('I', socket.inet_aton(netaddr))[0] & ((2 << int(bits) - 1) - 1) + return ipaddr & netmask == netmask + + +def _is_no_proxy_host(hostname, no_proxy): + if not no_proxy: + v = os.environ.get("no_proxy", "").replace(" ", "") + no_proxy = v.split(",") + if not no_proxy: + no_proxy = DEFAULT_NO_PROXY_HOST + + if hostname in no_proxy: + return True + elif _is_ip_address(hostname): + return any([_is_address_in_network(hostname, subnet) for subnet in no_proxy if _is_subnet_address(subnet)]) + + return False + + +def get_proxy_info( + hostname, is_secure, proxy_host=None, proxy_port=0, proxy_auth=None, + no_proxy=None, proxy_type='http'): + """ + try to retrieve proxy host and port from environment + if not provided in options. + result is (proxy_host, proxy_port, proxy_auth). + proxy_auth is tuple of username and password + of proxy authentication information. + + hostname: websocket server name. + + is_secure: is the connection secure? (wss) + looks for "https_proxy" in env + before falling back to "http_proxy" + + options: "http_proxy_host" - http proxy host name. + "http_proxy_port" - http proxy port. + "http_no_proxy" - host names, which doesn't use proxy. + "http_proxy_auth" - http proxy auth information. + tuple of username and password. + default is None + "proxy_type" - if set to "socks5" PySocks wrapper + will be used in place of a http proxy. + default is "http" + """ + if _is_no_proxy_host(hostname, no_proxy): + return None, 0, None + + if proxy_host: + port = proxy_port + auth = proxy_auth + return proxy_host, port, auth + + env_keys = ["http_proxy"] + if is_secure: + env_keys.insert(0, "https_proxy") + + for key in env_keys: + value = os.environ.get(key, None) + if value: + proxy = urlparse(value) + auth = (proxy.username, proxy.password) if proxy.username else None + return proxy.hostname, proxy.port, auth + + return None, 0, None diff --git a/pyextra/websocket/_utils.py b/pyextra/websocket/_utils.py new file mode 100644 index 00000000000000..8eddabf9c5bb93 --- /dev/null +++ b/pyextra/websocket/_utils.py @@ -0,0 +1,110 @@ +""" +websocket - WebSocket client library for Python + +Copyright (C) 2010 Hiroki Ohtani(liris) + + This library 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-1335 USA + +""" +import six + +__all__ = ["NoLock", "validate_utf8", "extract_err_message", "extract_error_code"] + + +class NoLock(object): + + def __enter__(self): + pass + + def __exit__(self, exc_type, exc_value, traceback): + pass + +try: + # If wsaccel is available we use compiled routines to validate UTF-8 + # strings. + from wsaccel.utf8validator import Utf8Validator + + def _validate_utf8(utfbytes): + return Utf8Validator().validate(utfbytes)[0] + +except ImportError: + # UTF-8 validator + # python implementation of http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ + + _UTF8_ACCEPT = 0 + _UTF8_REJECT = 12 + + _UTF8D = [ + # The first part of the table maps bytes to character classes that + # to reduce the size of the transition table and create bitmasks. + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8, + + # The second part is a transition table that maps a combination + # of a state of the automaton and a character class to a state. + 0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12, + 12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12, + 12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12, + 12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12, + 12,36,12,12,12,12,12,12,12,12,12,12, ] + + def _decode(state, codep, ch): + tp = _UTF8D[ch] + + codep = (ch & 0x3f) | (codep << 6) if ( + state != _UTF8_ACCEPT) else (0xff >> tp) & ch + state = _UTF8D[256 + state + tp] + + return state, codep + + def _validate_utf8(utfbytes): + state = _UTF8_ACCEPT + codep = 0 + for i in utfbytes: + if six.PY2: + i = ord(i) + state, codep = _decode(state, codep, i) + if state == _UTF8_REJECT: + return False + + return True + + +def validate_utf8(utfbytes): + """ + validate utf8 byte string. + utfbytes: utf byte string to check. + return value: if valid utf8 string, return true. Otherwise, return false. + """ + return _validate_utf8(utfbytes) + + +def extract_err_message(exception): + if exception.args: + return exception.args[0] + else: + return None + + +def extract_error_code(exception): + if exception.args and len(exception.args) > 1: + return exception.args[0] if isinstance(exception.args[0], int) else None diff --git a/pyextra/websocket/tests/__init__.py b/pyextra/websocket/tests/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/pyextra/websocket/tests/data/header01.txt b/pyextra/websocket/tests/data/header01.txt new file mode 100644 index 00000000000000..3142b43b303e36 --- /dev/null +++ b/pyextra/websocket/tests/data/header01.txt @@ -0,0 +1,6 @@ +HTTP/1.1 101 WebSocket Protocol Handshake +Connection: Upgrade +Upgrade: WebSocket +Sec-WebSocket-Accept: Kxep+hNu9n51529fGidYu7a3wO0= +some_header: something + diff --git a/pyextra/websocket/tests/data/header02.txt b/pyextra/websocket/tests/data/header02.txt new file mode 100644 index 00000000000000..a9dd2ce3e397bf --- /dev/null +++ b/pyextra/websocket/tests/data/header02.txt @@ -0,0 +1,6 @@ +HTTP/1.1 101 WebSocket Protocol Handshake +Connection: Upgrade +Upgrade WebSocket +Sec-WebSocket-Accept: Kxep+hNu9n51529fGidYu7a3wO0= +some_header: something + diff --git a/pyextra/websocket/tests/test_cookiejar.py b/pyextra/websocket/tests/test_cookiejar.py new file mode 100644 index 00000000000000..c40a00bd2cdd4e --- /dev/null +++ b/pyextra/websocket/tests/test_cookiejar.py @@ -0,0 +1,98 @@ +import unittest + +from websocket._cookiejar import SimpleCookieJar + +try: + import Cookie +except: + import http.cookies as Cookie + + +class CookieJarTest(unittest.TestCase): + def testAdd(self): + cookie_jar = SimpleCookieJar() + cookie_jar.add("") + self.assertFalse(cookie_jar.jar, "Cookie with no domain should not be added to the jar") + + cookie_jar = SimpleCookieJar() + cookie_jar.add("a=b") + self.assertFalse(cookie_jar.jar, "Cookie with no domain should not be added to the jar") + + cookie_jar = SimpleCookieJar() + cookie_jar.add("a=b; domain=.abc") + self.assertTrue(".abc" in cookie_jar.jar) + + cookie_jar = SimpleCookieJar() + cookie_jar.add("a=b; domain=abc") + self.assertTrue(".abc" in cookie_jar.jar) + self.assertTrue("abc" not in cookie_jar.jar) + + cookie_jar = SimpleCookieJar() + cookie_jar.add("a=b; c=d; domain=abc") + self.assertEquals(cookie_jar.get("abc"), "a=b; c=d") + + cookie_jar = SimpleCookieJar() + cookie_jar.add("a=b; c=d; domain=abc") + cookie_jar.add("e=f; domain=abc") + self.assertEquals(cookie_jar.get("abc"), "a=b; c=d; e=f") + + cookie_jar = SimpleCookieJar() + cookie_jar.add("a=b; c=d; domain=abc") + cookie_jar.add("e=f; domain=.abc") + self.assertEquals(cookie_jar.get("abc"), "a=b; c=d; e=f") + + cookie_jar = SimpleCookieJar() + cookie_jar.add("a=b; c=d; domain=abc") + cookie_jar.add("e=f; domain=xyz") + self.assertEquals(cookie_jar.get("abc"), "a=b; c=d") + self.assertEquals(cookie_jar.get("xyz"), "e=f") + self.assertEquals(cookie_jar.get("something"), "") + + def testSet(self): + cookie_jar = SimpleCookieJar() + cookie_jar.set("a=b") + self.assertFalse(cookie_jar.jar, "Cookie with no domain should not be added to the jar") + + cookie_jar = SimpleCookieJar() + cookie_jar.set("a=b; domain=.abc") + self.assertTrue(".abc" in cookie_jar.jar) + + cookie_jar = SimpleCookieJar() + cookie_jar.set("a=b; domain=abc") + self.assertTrue(".abc" in cookie_jar.jar) + self.assertTrue("abc" not in cookie_jar.jar) + + cookie_jar = SimpleCookieJar() + cookie_jar.set("a=b; c=d; domain=abc") + self.assertEquals(cookie_jar.get("abc"), "a=b; c=d") + + cookie_jar = SimpleCookieJar() + cookie_jar.set("a=b; c=d; domain=abc") + cookie_jar.set("e=f; domain=abc") + self.assertEquals(cookie_jar.get("abc"), "e=f") + + cookie_jar = SimpleCookieJar() + cookie_jar.set("a=b; c=d; domain=abc") + cookie_jar.set("e=f; domain=.abc") + self.assertEquals(cookie_jar.get("abc"), "e=f") + + cookie_jar = SimpleCookieJar() + cookie_jar.set("a=b; c=d; domain=abc") + cookie_jar.set("e=f; domain=xyz") + self.assertEquals(cookie_jar.get("abc"), "a=b; c=d") + self.assertEquals(cookie_jar.get("xyz"), "e=f") + self.assertEquals(cookie_jar.get("something"), "") + + def testGet(self): + cookie_jar = SimpleCookieJar() + cookie_jar.set("a=b; c=d; domain=abc.com") + self.assertEquals(cookie_jar.get("abc.com"), "a=b; c=d") + self.assertEquals(cookie_jar.get("x.abc.com"), "a=b; c=d") + self.assertEquals(cookie_jar.get("abc.com.es"), "") + self.assertEquals(cookie_jar.get("xabc.com"), "") + + cookie_jar.set("a=b; c=d; domain=.abc.com") + self.assertEquals(cookie_jar.get("abc.com"), "a=b; c=d") + self.assertEquals(cookie_jar.get("x.abc.com"), "a=b; c=d") + self.assertEquals(cookie_jar.get("abc.com.es"), "") + self.assertEquals(cookie_jar.get("xabc.com"), "") diff --git a/pyextra/websocket/tests/test_websocket.py b/pyextra/websocket/tests/test_websocket.py new file mode 100644 index 00000000000000..f49a89398bc944 --- /dev/null +++ b/pyextra/websocket/tests/test_websocket.py @@ -0,0 +1,662 @@ +# -*- coding: utf-8 -*- +# + +import sys +sys.path[0:0] = [""] + +import os +import os.path +import socket + +import six + +# websocket-client +import websocket as ws +from websocket._handshake import _create_sec_websocket_key, \ + _validate as _validate_header +from websocket._http import read_headers +from websocket._url import get_proxy_info, parse_url +from websocket._utils import validate_utf8 + +if six.PY3: + from base64 import decodebytes as base64decode +else: + from base64 import decodestring as base64decode + +if sys.version_info[0] == 2 and sys.version_info[1] < 7: + import unittest2 as unittest +else: + import unittest + +try: + from ssl import SSLError +except ImportError: + # dummy class of SSLError for ssl none-support environment. + class SSLError(Exception): + pass + +# Skip test to access the internet. +TEST_WITH_INTERNET = os.environ.get('TEST_WITH_INTERNET', '0') == '1' + +# Skip Secure WebSocket test. +TEST_SECURE_WS = True +TRACEABLE = True + + +def create_mask_key(_): + return "abcd" + + +class SockMock(object): + def __init__(self): + self.data = [] + self.sent = [] + + def add_packet(self, data): + self.data.append(data) + + def recv(self, bufsize): + if self.data: + e = self.data.pop(0) + if isinstance(e, Exception): + raise e + if len(e) > bufsize: + self.data.insert(0, e[bufsize:]) + return e[:bufsize] + + def send(self, data): + self.sent.append(data) + return len(data) + + def close(self): + pass + + +class HeaderSockMock(SockMock): + + def __init__(self, fname): + SockMock.__init__(self) + path = os.path.join(os.path.dirname(__file__), fname) + with open(path, "rb") as f: + self.add_packet(f.read()) + + +class WebSocketTest(unittest.TestCase): + def setUp(self): + ws.enableTrace(TRACEABLE) + + def tearDown(self): + pass + + def testDefaultTimeout(self): + self.assertEqual(ws.getdefaulttimeout(), None) + ws.setdefaulttimeout(10) + self.assertEqual(ws.getdefaulttimeout(), 10) + ws.setdefaulttimeout(None) + + def testParseUrl(self): + p = parse_url("ws://www.example.com/r") + self.assertEqual(p[0], "www.example.com") + self.assertEqual(p[1], 80) + self.assertEqual(p[2], "/r") + self.assertEqual(p[3], False) + + p = parse_url("ws://www.example.com/r/") + self.assertEqual(p[0], "www.example.com") + self.assertEqual(p[1], 80) + self.assertEqual(p[2], "/r/") + self.assertEqual(p[3], False) + + p = parse_url("ws://www.example.com/") + self.assertEqual(p[0], "www.example.com") + self.assertEqual(p[1], 80) + self.assertEqual(p[2], "/") + self.assertEqual(p[3], False) + + p = parse_url("ws://www.example.com") + self.assertEqual(p[0], "www.example.com") + self.assertEqual(p[1], 80) + self.assertEqual(p[2], "/") + self.assertEqual(p[3], False) + + p = parse_url("ws://www.example.com:8080/r") + self.assertEqual(p[0], "www.example.com") + self.assertEqual(p[1], 8080) + self.assertEqual(p[2], "/r") + self.assertEqual(p[3], False) + + p = parse_url("ws://www.example.com:8080/") + self.assertEqual(p[0], "www.example.com") + self.assertEqual(p[1], 8080) + self.assertEqual(p[2], "/") + self.assertEqual(p[3], False) + + p = parse_url("ws://www.example.com:8080") + self.assertEqual(p[0], "www.example.com") + self.assertEqual(p[1], 8080) + self.assertEqual(p[2], "/") + self.assertEqual(p[3], False) + + p = parse_url("wss://www.example.com:8080/r") + self.assertEqual(p[0], "www.example.com") + self.assertEqual(p[1], 8080) + self.assertEqual(p[2], "/r") + self.assertEqual(p[3], True) + + p = parse_url("wss://www.example.com:8080/r?key=value") + self.assertEqual(p[0], "www.example.com") + self.assertEqual(p[1], 8080) + self.assertEqual(p[2], "/r?key=value") + self.assertEqual(p[3], True) + + self.assertRaises(ValueError, parse_url, "http://www.example.com/r") + + if sys.version_info[0] == 2 and sys.version_info[1] < 7: + return + + p = parse_url("ws://[2a03:4000:123:83::3]/r") + self.assertEqual(p[0], "2a03:4000:123:83::3") + self.assertEqual(p[1], 80) + self.assertEqual(p[2], "/r") + self.assertEqual(p[3], False) + + p = parse_url("ws://[2a03:4000:123:83::3]:8080/r") + self.assertEqual(p[0], "2a03:4000:123:83::3") + self.assertEqual(p[1], 8080) + self.assertEqual(p[2], "/r") + self.assertEqual(p[3], False) + + p = parse_url("wss://[2a03:4000:123:83::3]/r") + self.assertEqual(p[0], "2a03:4000:123:83::3") + self.assertEqual(p[1], 443) + self.assertEqual(p[2], "/r") + self.assertEqual(p[3], True) + + p = parse_url("wss://[2a03:4000:123:83::3]:8080/r") + self.assertEqual(p[0], "2a03:4000:123:83::3") + self.assertEqual(p[1], 8080) + self.assertEqual(p[2], "/r") + self.assertEqual(p[3], True) + + def testWSKey(self): + key = _create_sec_websocket_key() + self.assertTrue(key != 24) + self.assertTrue(six.u("¥n") not in key) + + def testWsUtils(self): + key = "c6b8hTg4EeGb2gQMztV1/g==" + required_header = { + "upgrade": "websocket", + "connection": "upgrade", + "sec-websocket-accept": "Kxep+hNu9n51529fGidYu7a3wO0=", + } + self.assertEqual(_validate_header(required_header, key, None), (True, None)) + + header = required_header.copy() + header["upgrade"] = "http" + self.assertEqual(_validate_header(header, key, None), (False, None)) + del header["upgrade"] + self.assertEqual(_validate_header(header, key, None), (False, None)) + + header = required_header.copy() + header["connection"] = "something" + self.assertEqual(_validate_header(header, key, None), (False, None)) + del header["connection"] + self.assertEqual(_validate_header(header, key, None), (False, None)) + + header = required_header.copy() + header["sec-websocket-accept"] = "something" + self.assertEqual(_validate_header(header, key, None), (False, None)) + del header["sec-websocket-accept"] + self.assertEqual(_validate_header(header, key, None), (False, None)) + + header = required_header.copy() + header["sec-websocket-protocol"] = "sub1" + self.assertEqual(_validate_header(header, key, ["sub1", "sub2"]), (True, "sub1")) + self.assertEqual(_validate_header(header, key, ["sub2", "sub3"]), (False, None)) + + header = required_header.copy() + header["sec-websocket-protocol"] = "sUb1" + self.assertEqual(_validate_header(header, key, ["Sub1", "suB2"]), (True, "sub1")) + + + def testReadHeader(self): + status, header, status_message = read_headers(HeaderSockMock("data/header01.txt")) + self.assertEqual(status, 101) + self.assertEqual(header["connection"], "Upgrade") + + HeaderSockMock("data/header02.txt") + self.assertRaises(ws.WebSocketException, read_headers, HeaderSockMock("data/header02.txt")) + + def testSend(self): + # TODO: add longer frame data + sock = ws.WebSocket() + sock.set_mask_key(create_mask_key) + s = sock.sock = HeaderSockMock("data/header01.txt") + sock.send("Hello") + self.assertEqual(s.sent[0], six.b("\x81\x85abcd)\x07\x0f\x08\x0e")) + + sock.send("こんにちは") + self.assertEqual(s.sent[1], six.b("\x81\x8fabcd\x82\xe3\xf0\x87\xe3\xf1\x80\xe5\xca\x81\xe2\xc5\x82\xe3\xcc")) + + sock.send(u"こんにちは") + self.assertEqual(s.sent[1], six.b("\x81\x8fabcd\x82\xe3\xf0\x87\xe3\xf1\x80\xe5\xca\x81\xe2\xc5\x82\xe3\xcc")) + + sock.send("x" * 127) + + def testRecv(self): + # TODO: add longer frame data + sock = ws.WebSocket() + s = sock.sock = SockMock() + something = six.b("\x81\x8fabcd\x82\xe3\xf0\x87\xe3\xf1\x80\xe5\xca\x81\xe2\xc5\x82\xe3\xcc") + s.add_packet(something) + data = sock.recv() + self.assertEqual(data, "こんにちは") + + s.add_packet(six.b("\x81\x85abcd)\x07\x0f\x08\x0e")) + data = sock.recv() + self.assertEqual(data, "Hello") + + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + def testIter(self): + count = 2 + for _ in ws.create_connection('ws://stream.meetup.com/2/rsvps'): + count -= 1 + if count == 0: + break + + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + def testNext(self): + sock = ws.create_connection('ws://stream.meetup.com/2/rsvps') + self.assertEqual(str, type(next(sock))) + + def testInternalRecvStrict(self): + sock = ws.WebSocket() + s = sock.sock = SockMock() + s.add_packet(six.b("foo")) + s.add_packet(socket.timeout()) + s.add_packet(six.b("bar")) + # s.add_packet(SSLError("The read operation timed out")) + s.add_packet(six.b("baz")) + with self.assertRaises(ws.WebSocketTimeoutException): + sock.frame_buffer.recv_strict(9) + # if six.PY2: + # with self.assertRaises(ws.WebSocketTimeoutException): + # data = sock._recv_strict(9) + # else: + # with self.assertRaises(SSLError): + # data = sock._recv_strict(9) + data = sock.frame_buffer.recv_strict(9) + self.assertEqual(data, six.b("foobarbaz")) + with self.assertRaises(ws.WebSocketConnectionClosedException): + sock.frame_buffer.recv_strict(1) + + def testRecvTimeout(self): + sock = ws.WebSocket() + s = sock.sock = SockMock() + s.add_packet(six.b("\x81")) + s.add_packet(socket.timeout()) + s.add_packet(six.b("\x8dabcd\x29\x07\x0f\x08\x0e")) + s.add_packet(socket.timeout()) + s.add_packet(six.b("\x4e\x43\x33\x0e\x10\x0f\x00\x40")) + with self.assertRaises(ws.WebSocketTimeoutException): + sock.recv() + with self.assertRaises(ws.WebSocketTimeoutException): + sock.recv() + data = sock.recv() + self.assertEqual(data, "Hello, World!") + with self.assertRaises(ws.WebSocketConnectionClosedException): + sock.recv() + + def testRecvWithSimpleFragmentation(self): + sock = ws.WebSocket() + s = sock.sock = SockMock() + # OPCODE=TEXT, FIN=0, MSG="Brevity is " + s.add_packet(six.b("\x01\x8babcd#\x10\x06\x12\x08\x16\x1aD\x08\x11C")) + # OPCODE=CONT, FIN=1, MSG="the soul of wit" + s.add_packet(six.b("\x80\x8fabcd\x15\n\x06D\x12\r\x16\x08A\r\x05D\x16\x0b\x17")) + data = sock.recv() + self.assertEqual(data, "Brevity is the soul of wit") + with self.assertRaises(ws.WebSocketConnectionClosedException): + sock.recv() + + def testRecvWithFireEventOfFragmentation(self): + sock = ws.WebSocket(fire_cont_frame=True) + s = sock.sock = SockMock() + # OPCODE=TEXT, FIN=0, MSG="Brevity is " + s.add_packet(six.b("\x01\x8babcd#\x10\x06\x12\x08\x16\x1aD\x08\x11C")) + # OPCODE=CONT, FIN=0, MSG="Brevity is " + s.add_packet(six.b("\x00\x8babcd#\x10\x06\x12\x08\x16\x1aD\x08\x11C")) + # OPCODE=CONT, FIN=1, MSG="the soul of wit" + s.add_packet(six.b("\x80\x8fabcd\x15\n\x06D\x12\r\x16\x08A\r\x05D\x16\x0b\x17")) + + _, data = sock.recv_data() + self.assertEqual(data, six.b("Brevity is ")) + _, data = sock.recv_data() + self.assertEqual(data, six.b("Brevity is ")) + _, data = sock.recv_data() + self.assertEqual(data, six.b("the soul of wit")) + + # OPCODE=CONT, FIN=0, MSG="Brevity is " + s.add_packet(six.b("\x80\x8babcd#\x10\x06\x12\x08\x16\x1aD\x08\x11C")) + + with self.assertRaises(ws.WebSocketException): + sock.recv_data() + + with self.assertRaises(ws.WebSocketConnectionClosedException): + sock.recv() + + def testClose(self): + sock = ws.WebSocket() + sock.sock = SockMock() + sock.connected = True + sock.close() + self.assertEqual(sock.connected, False) + + sock = ws.WebSocket() + s = sock.sock = SockMock() + sock.connected = True + s.add_packet(six.b('\x88\x80\x17\x98p\x84')) + sock.recv() + self.assertEqual(sock.connected, False) + + def testRecvContFragmentation(self): + sock = ws.WebSocket() + s = sock.sock = SockMock() + # OPCODE=CONT, FIN=1, MSG="the soul of wit" + s.add_packet(six.b("\x80\x8fabcd\x15\n\x06D\x12\r\x16\x08A\r\x05D\x16\x0b\x17")) + self.assertRaises(ws.WebSocketException, sock.recv) + + def testRecvWithProlongedFragmentation(self): + sock = ws.WebSocket() + s = sock.sock = SockMock() + # OPCODE=TEXT, FIN=0, MSG="Once more unto the breach, " + s.add_packet(six.b("\x01\x9babcd.\x0c\x00\x01A\x0f\x0c\x16\x04B\x16\n\x15" + "\rC\x10\t\x07C\x06\x13\x07\x02\x07\tNC")) + # OPCODE=CONT, FIN=0, MSG="dear friends, " + s.add_packet(six.b("\x00\x8eabcd\x05\x07\x02\x16A\x04\x11\r\x04\x0c\x07" + "\x17MB")) + # OPCODE=CONT, FIN=1, MSG="once more" + s.add_packet(six.b("\x80\x89abcd\x0e\x0c\x00\x01A\x0f\x0c\x16\x04")) + data = sock.recv() + self.assertEqual( + data, + "Once more unto the breach, dear friends, once more") + with self.assertRaises(ws.WebSocketConnectionClosedException): + sock.recv() + + def testRecvWithFragmentationAndControlFrame(self): + sock = ws.WebSocket() + sock.set_mask_key(create_mask_key) + s = sock.sock = SockMock() + # OPCODE=TEXT, FIN=0, MSG="Too much " + s.add_packet(six.b("\x01\x89abcd5\r\x0cD\x0c\x17\x00\x0cA")) + # OPCODE=PING, FIN=1, MSG="Please PONG this" + s.add_packet(six.b("\x89\x90abcd1\x0e\x06\x05\x12\x07C4.,$D\x15\n\n\x17")) + # OPCODE=CONT, FIN=1, MSG="of a good thing" + s.add_packet(six.b("\x80\x8fabcd\x0e\x04C\x05A\x05\x0c\x0b\x05B\x17\x0c" + "\x08\x0c\x04")) + data = sock.recv() + self.assertEqual(data, "Too much of a good thing") + with self.assertRaises(ws.WebSocketConnectionClosedException): + sock.recv() + self.assertEqual( + s.sent[0], + six.b("\x8a\x90abcd1\x0e\x06\x05\x12\x07C4.,$D\x15\n\n\x17")) + + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + def testWebSocket(self): + s = ws.create_connection("ws://echo.websocket.org/") + self.assertNotEqual(s, None) + s.send("Hello, World") + result = s.recv() + self.assertEqual(result, "Hello, World") + + s.send(u"こにゃにゃちは、世界") + result = s.recv() + self.assertEqual(result, "こにゃにゃちは、世界") + s.close() + + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + def testPingPong(self): + s = ws.create_connection("ws://echo.websocket.org/") + self.assertNotEqual(s, None) + s.ping("Hello") + s.pong("Hi") + s.close() + + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + @unittest.skipUnless(TEST_SECURE_WS, "wss://echo.websocket.org doesn't work well.") + def testSecureWebSocket(self): + if 1: + import ssl + s = ws.create_connection("wss://echo.websocket.org/") + self.assertNotEqual(s, None) + self.assertTrue(isinstance(s.sock, ssl.SSLSocket)) + s.send("Hello, World") + result = s.recv() + self.assertEqual(result, "Hello, World") + s.send(u"こにゃにゃちは、世界") + result = s.recv() + self.assertEqual(result, "こにゃにゃちは、世界") + s.close() + #except: + # pass + + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + def testWebSocketWihtCustomHeader(self): + s = ws.create_connection("ws://echo.websocket.org/", + headers={"User-Agent": "PythonWebsocketClient"}) + self.assertNotEqual(s, None) + s.send("Hello, World") + result = s.recv() + self.assertEqual(result, "Hello, World") + s.close() + + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + def testAfterClose(self): + s = ws.create_connection("ws://echo.websocket.org/") + self.assertNotEqual(s, None) + s.close() + self.assertRaises(ws.WebSocketConnectionClosedException, s.send, "Hello") + self.assertRaises(ws.WebSocketConnectionClosedException, s.recv) + + def testNonce(self): + """ WebSocket key should be a random 16-byte nonce. + """ + key = _create_sec_websocket_key() + nonce = base64decode(key.encode("utf-8")) + self.assertEqual(16, len(nonce)) + + +class WebSocketAppTest(unittest.TestCase): + + class NotSetYet(object): + """ A marker class for signalling that a value hasn't been set yet. + """ + + def setUp(self): + ws.enableTrace(TRACEABLE) + + WebSocketAppTest.keep_running_open = WebSocketAppTest.NotSetYet() + WebSocketAppTest.keep_running_close = WebSocketAppTest.NotSetYet() + WebSocketAppTest.get_mask_key_id = WebSocketAppTest.NotSetYet() + + def tearDown(self): + WebSocketAppTest.keep_running_open = WebSocketAppTest.NotSetYet() + WebSocketAppTest.keep_running_close = WebSocketAppTest.NotSetYet() + WebSocketAppTest.get_mask_key_id = WebSocketAppTest.NotSetYet() + + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + def testKeepRunning(self): + """ A WebSocketApp should keep running as long as its self.keep_running + is not False (in the boolean context). + """ + + def on_open(self, *args, **kwargs): + """ Set the keep_running flag for later inspection and immediately + close the connection. + """ + WebSocketAppTest.keep_running_open = self.keep_running + + self.close() + + def on_close(self, *args, **kwargs): + """ Set the keep_running flag for the test to use. + """ + WebSocketAppTest.keep_running_close = self.keep_running + + app = ws.WebSocketApp('ws://echo.websocket.org/', on_open=on_open, on_close=on_close) + app.run_forever() + + # if numpy is installed, this assertion fail + # self.assertFalse(isinstance(WebSocketAppTest.keep_running_open, + # WebSocketAppTest.NotSetYet)) + + # self.assertFalse(isinstance(WebSocketAppTest.keep_running_close, + # WebSocketAppTest.NotSetYet)) + + # self.assertEqual(True, WebSocketAppTest.keep_running_open) + # self.assertEqual(False, WebSocketAppTest.keep_running_close) + + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + def testSockMaskKey(self): + """ A WebSocketApp should forward the received mask_key function down + to the actual socket. + """ + + def my_mask_key_func(): + pass + + def on_open(self, *args, **kwargs): + """ Set the value so the test can use it later on and immediately + close the connection. + """ + WebSocketAppTest.get_mask_key_id = id(self.get_mask_key) + self.close() + + app = ws.WebSocketApp('ws://echo.websocket.org/', on_open=on_open, get_mask_key=my_mask_key_func) + app.run_forever() + + # if numpu is installed, this assertion fail + # Note: We can't use 'is' for comparing the functions directly, need to use 'id'. + # self.assertEqual(WebSocketAppTest.get_mask_key_id, id(my_mask_key_func)) + + +class SockOptTest(unittest.TestCase): + @unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled") + def testSockOpt(self): + sockopt = ((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),) + s = ws.create_connection("ws://echo.websocket.org", sockopt=sockopt) + self.assertNotEqual(s.sock.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY), 0) + s.close() + + +class UtilsTest(unittest.TestCase): + def testUtf8Validator(self): + state = validate_utf8(six.b('\xf0\x90\x80\x80')) + self.assertEqual(state, True) + state = validate_utf8(six.b('\xce\xba\xe1\xbd\xb9\xcf\x83\xce\xbc\xce\xb5\xed\xa0\x80edited')) + self.assertEqual(state, False) + state = validate_utf8(six.b('')) + self.assertEqual(state, True) + + +class ProxyInfoTest(unittest.TestCase): + def setUp(self): + self.http_proxy = os.environ.get("http_proxy", None) + self.https_proxy = os.environ.get("https_proxy", None) + if "http_proxy" in os.environ: + del os.environ["http_proxy"] + if "https_proxy" in os.environ: + del os.environ["https_proxy"] + + def tearDown(self): + if self.http_proxy: + os.environ["http_proxy"] = self.http_proxy + elif "http_proxy" in os.environ: + del os.environ["http_proxy"] + + if self.https_proxy: + os.environ["https_proxy"] = self.https_proxy + elif "https_proxy" in os.environ: + del os.environ["https_proxy"] + + def testProxyFromArgs(self): + self.assertEqual(get_proxy_info("echo.websocket.org", False, proxy_host="localhost"), ("localhost", 0, None)) + self.assertEqual(get_proxy_info("echo.websocket.org", False, proxy_host="localhost", proxy_port=3128), ("localhost", 3128, None)) + self.assertEqual(get_proxy_info("echo.websocket.org", True, proxy_host="localhost"), ("localhost", 0, None)) + self.assertEqual(get_proxy_info("echo.websocket.org", True, proxy_host="localhost", proxy_port=3128), ("localhost", 3128, None)) + + self.assertEqual(get_proxy_info("echo.websocket.org", False, proxy_host="localhost", proxy_auth=("a", "b")), + ("localhost", 0, ("a", "b"))) + self.assertEqual(get_proxy_info("echo.websocket.org", False, proxy_host="localhost", proxy_port=3128, proxy_auth=("a", "b")), + ("localhost", 3128, ("a", "b"))) + self.assertEqual(get_proxy_info("echo.websocket.org", True, proxy_host="localhost", proxy_auth=("a", "b")), + ("localhost", 0, ("a", "b"))) + self.assertEqual(get_proxy_info("echo.websocket.org", True, proxy_host="localhost", proxy_port=3128, proxy_auth=("a", "b")), + ("localhost", 3128, ("a", "b"))) + + self.assertEqual(get_proxy_info("echo.websocket.org", True, proxy_host="localhost", proxy_port=3128, no_proxy=["example.com"], proxy_auth=("a", "b")), + ("localhost", 3128, ("a", "b"))) + self.assertEqual(get_proxy_info("echo.websocket.org", True, proxy_host="localhost", proxy_port=3128, no_proxy=["echo.websocket.org"], proxy_auth=("a", "b")), + (None, 0, None)) + + def testProxyFromEnv(self): + os.environ["http_proxy"] = "http://localhost/" + self.assertEqual(get_proxy_info("echo.websocket.org", False), ("localhost", None, None)) + os.environ["http_proxy"] = "http://localhost:3128/" + self.assertEqual(get_proxy_info("echo.websocket.org", False), ("localhost", 3128, None)) + + os.environ["http_proxy"] = "http://localhost/" + os.environ["https_proxy"] = "http://localhost2/" + self.assertEqual(get_proxy_info("echo.websocket.org", False), ("localhost", None, None)) + os.environ["http_proxy"] = "http://localhost:3128/" + os.environ["https_proxy"] = "http://localhost2:3128/" + self.assertEqual(get_proxy_info("echo.websocket.org", False), ("localhost", 3128, None)) + + os.environ["http_proxy"] = "http://localhost/" + os.environ["https_proxy"] = "http://localhost2/" + self.assertEqual(get_proxy_info("echo.websocket.org", True), ("localhost2", None, None)) + os.environ["http_proxy"] = "http://localhost:3128/" + os.environ["https_proxy"] = "http://localhost2:3128/" + self.assertEqual(get_proxy_info("echo.websocket.org", True), ("localhost2", 3128, None)) + + + os.environ["http_proxy"] = "http://a:b@localhost/" + self.assertEqual(get_proxy_info("echo.websocket.org", False), ("localhost", None, ("a", "b"))) + os.environ["http_proxy"] = "http://a:b@localhost:3128/" + self.assertEqual(get_proxy_info("echo.websocket.org", False), ("localhost", 3128, ("a", "b"))) + + os.environ["http_proxy"] = "http://a:b@localhost/" + os.environ["https_proxy"] = "http://a:b@localhost2/" + self.assertEqual(get_proxy_info("echo.websocket.org", False), ("localhost", None, ("a", "b"))) + os.environ["http_proxy"] = "http://a:b@localhost:3128/" + os.environ["https_proxy"] = "http://a:b@localhost2:3128/" + self.assertEqual(get_proxy_info("echo.websocket.org", False), ("localhost", 3128, ("a", "b"))) + + os.environ["http_proxy"] = "http://a:b@localhost/" + os.environ["https_proxy"] = "http://a:b@localhost2/" + self.assertEqual(get_proxy_info("echo.websocket.org", True), ("localhost2", None, ("a", "b"))) + os.environ["http_proxy"] = "http://a:b@localhost:3128/" + os.environ["https_proxy"] = "http://a:b@localhost2:3128/" + self.assertEqual(get_proxy_info("echo.websocket.org", True), ("localhost2", 3128, ("a", "b"))) + + os.environ["http_proxy"] = "http://a:b@localhost/" + os.environ["https_proxy"] = "http://a:b@localhost2/" + os.environ["no_proxy"] = "example1.com,example2.com" + self.assertEqual(get_proxy_info("example.1.com", True), ("localhost2", None, ("a", "b"))) + os.environ["http_proxy"] = "http://a:b@localhost:3128/" + os.environ["https_proxy"] = "http://a:b@localhost2:3128/" + os.environ["no_proxy"] = "example1.com,example2.com, echo.websocket.org" + self.assertEqual(get_proxy_info("echo.websocket.org", True), (None, 0, None)) + + os.environ["http_proxy"] = "http://a:b@localhost:3128/" + os.environ["https_proxy"] = "http://a:b@localhost2:3128/" + os.environ["no_proxy"] = "127.0.0.0/8, 192.168.0.0/16" + self.assertEqual(get_proxy_info("127.0.0.1", False), (None, 0, None)) + self.assertEqual(get_proxy_info("192.168.1.1", False), (None, 0, None)) + + +if __name__ == "__main__": + unittest.main() diff --git a/pyextra/websocket_client-0.55.0-py2.7.egg-info/PKG-INFO b/pyextra/websocket_client-0.55.0-py2.7.egg-info/PKG-INFO new file mode 100644 index 00000000000000..d9ae5598097cc0 --- /dev/null +++ b/pyextra/websocket_client-0.55.0-py2.7.egg-info/PKG-INFO @@ -0,0 +1,305 @@ +Metadata-Version: 1.2 +Name: websocket-client +Version: 0.55.0 +Summary: WebSocket client for Python. hybi13 is supported. +Home-page: https://github.com/websocket-client/websocket-client.git +Author: liris +Author-email: liris.pp@gmail.com +License: BSD +Description: ================= + websocket-client + ================= + + websocket-client module is WebSocket client for python. This provide the low level APIs for WebSocket. All APIs are the synchronous functions. + + websocket-client supports only hybi-13. + + + License + ======= + + - BSD + + Installation + ============ + + This module is tested on Python 2.7 and Python 3.4+. + + Type "python setup.py install" or "pip install websocket-client" to install. + + .. CAUTION:: + + from v0.16.0, we can install by "pip install websocket-client" for Python 3. + + This module depends on + + - six + - backports.ssl_match_hostname for Python 2.x + + Performance + ----------- + + The "send" and "validate_utf8" methods are too slow on pure python. If you want to get better performace, please install both numpy and wsaccel. + + + How about Python 3 + ================== + + Now, we support Python 3 on single source code from version 0.14.0. Thanks, @battlemidget and @ralphbean. + + HTTP Proxy + ========== + + Support websocket access via http proxy. + The proxy server must allow "CONNECT" method to websocket port. + Default squid setting is "ALLOWED TO CONNECT ONLY HTTPS PORT". + + Current implementation of websocket-client is using "CONNECT" method via proxy. + + + example + + .. code:: python + + import websocket + ws = websocket.WebSocket() + ws.connect("ws://example.com/websocket", http_proxy_host="proxy_host_name", http_proxy_port=3128) + + + + Examples + ======== + + Long-lived connection + --------------------- + This example is similar to how WebSocket code looks in browsers using JavaScript. + + .. code:: python + + import websocket + try: + import thread + except ImportError: + import _thread as thread + import time + + def on_message(ws, message): + print(message) + + def on_error(ws, error): + print(error) + + def on_close(ws): + print("### closed ###") + + def on_open(ws): + def run(*args): + for i in range(3): + time.sleep(1) + ws.send("Hello %d" % i) + time.sleep(1) + ws.close() + print("thread terminating...") + thread.start_new_thread(run, ()) + + + if __name__ == "__main__": + websocket.enableTrace(True) + ws = websocket.WebSocketApp("ws://echo.websocket.org/", + on_message = on_message, + on_error = on_error, + on_close = on_close) + ws.on_open = on_open + ws.run_forever() + + + + Short-lived one-off send-receive + -------------------------------- + This is if you want to communicate a short message and disconnect immediately when done. + + .. code:: python + + from websocket import create_connection + ws = create_connection("ws://echo.websocket.org/") + print("Sending 'Hello, World'...") + ws.send("Hello, World") + print("Sent") + print("Receiving...") + result = ws.recv() + print("Received '%s'" % result) + ws.close() + + + If you want to customize socket options, set sockopt. + + sockopt example + + .. code:: python + + from websocket import create_connection + ws = create_connection("ws://echo.websocket.org/", + sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY),)) + + + More advanced: Custom class + --------------------------- + You can also write your own class for the connection, if you want to handle the nitty-gritty details yourself. + + .. code:: python + + import socket + from websocket import create_connection, WebSocket + class MyWebSocket(WebSocket): + def recv_frame(self): + frame = super().recv_frame() + print('yay! I got this frame: ', frame) + return frame + + ws = create_connection("ws://echo.websocket.org/", + sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),), class_=MyWebSocket) + + + FAQ + === + + How to disable ssl cert verification? + ------------------------------------- + + Please set sslopt to {"cert_reqs": ssl.CERT_NONE}. + + WebSocketApp sample + + .. code:: python + + ws = websocket.WebSocketApp("wss://echo.websocket.org") + ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}) + + + create_connection sample + + .. code:: python + + ws = websocket.create_connection("wss://echo.websocket.org", + sslopt={"cert_reqs": ssl.CERT_NONE}) + + + WebSocket sample + + .. code:: python + + ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE}) + ws.connect("wss://echo.websocket.org") + + + How to disable hostname verification? + ------------------------------------- + + Please set sslopt to {"check_hostname": False}. + (since v0.18.0) + + WebSocketApp sample + + .. code:: python + + ws = websocket.WebSocketApp("wss://echo.websocket.org") + ws.run_forever(sslopt={"check_hostname": False}) + + + create_connection sample + + .. code:: python + + ws = websocket.create_connection("wss://echo.websocket.org", + sslopt={"check_hostname": False}) + + + WebSocket sample + + .. code:: python + + ws = websocket.WebSocket(sslopt={"check_hostname": False}) + ws.connect("wss://echo.websocket.org") + + + How to enable `SNI `_? + --------------------------------------------------------------------------- + + SNI support is available for Python 2.7.9+ and 3.2+. It will be enabled automatically whenever possible. + + + Sub Protocols. + -------------- + + The server needs to support sub protocols, please set the subprotocol like this. + + + Subprotocol sample + + .. code:: python + + ws = websocket.create_connection("ws://example.com/websocket", subprotocols=["binary", "base64"]) + + + + wsdump.py + ========= + + wsdump.py is simple WebSocket test(debug) tool. + + sample for echo.websocket.org:: + + $ wsdump.py ws://echo.websocket.org/ + Press Ctrl+C to quit + > Hello, WebSocket + < Hello, WebSocket + > How are you? + < How are you? + + + Usage + ----- + + usage:: + + wsdump.py [-h] [-v [VERBOSE]] ws_url + + + WebSocket Simple Dump Tool + + positional arguments: + ws_url websocket url. ex. ws://echo.websocket.org/ + + + optional arguments: + -h, --help show this help message and exit + WebSocketApp + -v VERBOSE, --verbose VERBOSE set verbose mode. If set to 1, show opcode. If set to 2, enable to trace websocket module + + + example:: + + $ wsdump.py ws://echo.websocket.org/ + $ wsdump.py ws://echo.websocket.org/ -v + $ wsdump.py ws://echo.websocket.org/ -vv + +Keywords: websockets +Platform: UNKNOWN +Classifier: Development Status :: 4 - Beta +Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: POSIX +Classifier: Operating System :: Microsoft :: Windows +Classifier: Topic :: Internet +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Intended Audience :: Developers +Requires-Python: >=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* diff --git a/pyextra/websocket_client-0.55.0-py2.7.egg-info/SOURCES.txt b/pyextra/websocket_client-0.55.0-py2.7.egg-info/SOURCES.txt new file mode 100644 index 00000000000000..d003db826bf1c3 --- /dev/null +++ b/pyextra/websocket_client-0.55.0-py2.7.egg-info/SOURCES.txt @@ -0,0 +1,32 @@ +ChangeLog +LICENSE +MANIFEST.in +README.rst +setup.cfg +setup.py +bin/wsdump.py +examples/echo_client.py +examples/echoapp_client.py +websocket/__init__.py +websocket/_abnf.py +websocket/_app.py +websocket/_cookiejar.py +websocket/_core.py +websocket/_exceptions.py +websocket/_handshake.py +websocket/_http.py +websocket/_logging.py +websocket/_socket.py +websocket/_ssl_compat.py +websocket/_url.py +websocket/_utils.py +websocket/tests/__init__.py +websocket/tests/test_cookiejar.py +websocket/tests/test_websocket.py +websocket/tests/data/header01.txt +websocket/tests/data/header02.txt +websocket_client.egg-info/PKG-INFO +websocket_client.egg-info/SOURCES.txt +websocket_client.egg-info/dependency_links.txt +websocket_client.egg-info/requires.txt +websocket_client.egg-info/top_level.txt \ No newline at end of file diff --git a/pyextra/websocket_client-0.55.0-py2.7.egg-info/dependency_links.txt b/pyextra/websocket_client-0.55.0-py2.7.egg-info/dependency_links.txt new file mode 100644 index 00000000000000..8b137891791fe9 --- /dev/null +++ b/pyextra/websocket_client-0.55.0-py2.7.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/pyextra/websocket_client-0.55.0-py2.7.egg-info/installed-files.txt b/pyextra/websocket_client-0.55.0-py2.7.egg-info/installed-files.txt new file mode 100644 index 00000000000000..2069b5c8fd07c6 --- /dev/null +++ b/pyextra/websocket_client-0.55.0-py2.7.egg-info/installed-files.txt @@ -0,0 +1,40 @@ +../../../../bin/wsdump.py +../websocket/__init__.py +../websocket/__init__.pyc +../websocket/_abnf.py +../websocket/_abnf.pyc +../websocket/_app.py +../websocket/_app.pyc +../websocket/_cookiejar.py +../websocket/_cookiejar.pyc +../websocket/_core.py +../websocket/_core.pyc +../websocket/_exceptions.py +../websocket/_exceptions.pyc +../websocket/_handshake.py +../websocket/_handshake.pyc +../websocket/_http.py +../websocket/_http.pyc +../websocket/_logging.py +../websocket/_logging.pyc +../websocket/_socket.py +../websocket/_socket.pyc +../websocket/_ssl_compat.py +../websocket/_ssl_compat.pyc +../websocket/_url.py +../websocket/_url.pyc +../websocket/_utils.py +../websocket/_utils.pyc +../websocket/tests/__init__.py +../websocket/tests/__init__.pyc +../websocket/tests/data/header01.txt +../websocket/tests/data/header02.txt +../websocket/tests/test_cookiejar.py +../websocket/tests/test_cookiejar.pyc +../websocket/tests/test_websocket.py +../websocket/tests/test_websocket.pyc +PKG-INFO +SOURCES.txt +dependency_links.txt +requires.txt +top_level.txt diff --git a/pyextra/websocket_client-0.55.0-py2.7.egg-info/requires.txt b/pyextra/websocket_client-0.55.0-py2.7.egg-info/requires.txt new file mode 100644 index 00000000000000..e87d975317496c --- /dev/null +++ b/pyextra/websocket_client-0.55.0-py2.7.egg-info/requires.txt @@ -0,0 +1,2 @@ +six +backports.ssl_match_hostname diff --git a/pyextra/websocket_client-0.55.0-py2.7.egg-info/top_level.txt b/pyextra/websocket_client-0.55.0-py2.7.egg-info/top_level.txt new file mode 100644 index 00000000000000..ca4cb0cf822783 --- /dev/null +++ b/pyextra/websocket_client-0.55.0-py2.7.egg-info/top_level.txt @@ -0,0 +1 @@ +websocket diff --git a/requirements_openpilot.txt b/requirements_openpilot.txt index 03459175d4f03b..48b2ddb3115ca0 100644 --- a/requirements_openpilot.txt +++ b/requirements_openpilot.txt @@ -1,19 +1,68 @@ -Cython==0.24.1 +# This are the packages installed on the EON +-e git+https://github.com/commaai/le_python.git@5eef8f5be5929d33973e1b10e686fa0cdcd6792f#egg=Logentries +-e git+https://github.com/commaai/python-overpy.git@f86529af402d4642e1faeb146671c40284007323#egg=overpy +Cython==0.27.3 +Flask==1.0.2 +#PyGObject==3.28.2 This is installed on the EON, but requires a ton of dependencies to install +PyYAML==3.12 +appdirs==1.4.0 +atomicwrites==1.1.5 +attrs==16.0.0 bitstring==3.1.5 -fastcluster==1.1.21 +capnpy==0.4.2 +certifi==2016.8.31 +cffi==1.11.5 +contextlib2==0.5.4 +crc16==0.1.1 +crcmod==1.7 +cryptography==1.4 +cycler==0.10.0 +decorator==4.0.10 +docopt==0.6.2 +enum34==1.1.6 +evdev==0.6.1 +fastcluster==1.1.20 +filterpy==1.2.4 +ipaddress==1.0.16 +json-rpc==1.12.1 libusb1==1.5.0 +lmdb==0.92 +mpmath==1.0.0 +nose==1.3.7 +numpy==1.11.1 +pause==0.1.2 +py==1.4.31 +pyOpenSSL==16.0.0 +pyasn1-modules==0.0.8 +pyasn1==0.1.9 pycapnp==0.6.3 +pycparser==2.18 +pycrypto==2.6.1 +pyflakes==1.6.0 +pyopencl==2016.1 +pyparsing==2.1.10 +#pypcap==1.1.5 needs extra dependencies and is not used +pyproj==1.9.5.1 +pypytools==0.4.3 +pyserial==3.1.1 +pytest==2.9.2 +python-dateutil==2.6.0 +pytools==2016.2.1 +pytz==2016.10 +pyyaml==3.12 pyzmq==15.4.0 raven==5.23.0 +recordclass==0.4.1 requests==2.10.0 +scipy==0.19.1 +service-identity==16.0.0 setproctitle==1.1.10 simplejson==3.8.2 -pyyaml==3.12 -cffi==1.7.0 -enum34==1.1.1 -sympy==1.1.1 -filterpy==1.0.0 +six==1.10.0 +smbus-cffi==0.5.1 smbus2==0.2.0 -pyflakes==1.5.0 --e git+https://github.com/commaai/le_python.git@5eef8f5be5929d33973e1b10e686fa0cdcd6792f#egg=Logentries -Flask==1.0.1 +sympy==1.1.1 +tqdm==4.23.1 +ujson==1.35 +v4l2==0.2 +websocket_client==0.55.0 diff --git a/selfdrive/assets/img_driver_face.png b/selfdrive/assets/img_driver_face.png new file mode 100644 index 00000000000000..ddde478cd789ec Binary files /dev/null and b/selfdrive/assets/img_driver_face.png differ diff --git a/selfdrive/assets/img_map.png b/selfdrive/assets/img_map.png new file mode 100644 index 00000000000000..8bdae4d7d81e0b Binary files /dev/null and b/selfdrive/assets/img_map.png differ diff --git a/selfdrive/assets/img_trafficSign_turn.png b/selfdrive/assets/img_trafficSign_turn.png new file mode 100644 index 00000000000000..c304d1bf2c8e53 Binary files /dev/null and b/selfdrive/assets/img_trafficSign_turn.png differ diff --git a/selfdrive/assets/sounds/disengaged.wav b/selfdrive/assets/sounds/disengaged.wav new file mode 100644 index 00000000000000..958e08fd85b3e6 Binary files /dev/null and b/selfdrive/assets/sounds/disengaged.wav differ diff --git a/selfdrive/assets/sounds/engaged.wav b/selfdrive/assets/sounds/engaged.wav new file mode 100644 index 00000000000000..c6c088e01c8b73 Binary files /dev/null and b/selfdrive/assets/sounds/engaged.wav differ diff --git a/selfdrive/assets/sounds/error.wav b/selfdrive/assets/sounds/error.wav new file mode 100644 index 00000000000000..1ff0c540d26ab0 Binary files /dev/null and b/selfdrive/assets/sounds/error.wav differ diff --git a/selfdrive/assets/sounds/warning_1.wav b/selfdrive/assets/sounds/warning_1.wav new file mode 100644 index 00000000000000..67b8d76fe804fa Binary files /dev/null and b/selfdrive/assets/sounds/warning_1.wav differ diff --git a/selfdrive/assets/sounds/warning_2.wav b/selfdrive/assets/sounds/warning_2.wav new file mode 100644 index 00000000000000..8e1b1d7d9161a7 Binary files /dev/null and b/selfdrive/assets/sounds/warning_2.wav differ diff --git a/selfdrive/athena/__init__.py b/selfdrive/athena/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/selfdrive/athena/athenad.py b/selfdrive/athena/athenad.py new file mode 100755 index 00000000000000..f6f9ef231acb2d --- /dev/null +++ b/selfdrive/athena/athenad.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python2.7 +import json +import os +import random +import time +import threading +import traceback +import zmq +import Queue +from jsonrpc import JSONRPCResponseManager, dispatcher +from websocket import create_connection, WebSocketTimeoutException + +import selfdrive.crash as crash +import selfdrive.messaging as messaging +from common.params import Params +from selfdrive.services import service_list +from selfdrive.swaglog import cloudlog +from selfdrive.version import version, dirty + +ATHENA_HOST = os.getenv('ATHENA_HOST', 'wss://athena.comma.ai') +HANDLER_THREADS = os.getenv('HANDLER_THREADS', 4) + +dispatcher["echo"] = lambda s: s +payload_queue = Queue.Queue() +response_queue = Queue.Queue() + +def handle_long_poll(ws): + end_event = threading.Event() + + threads = [ + threading.Thread(target=ws_recv, args=(ws, end_event)), + threading.Thread(target=ws_send, args=(ws, end_event)) + ] + [ + threading.Thread(target=jsonrpc_handler, args=(end_event,)) + for x in xrange(HANDLER_THREADS) + ] + + map(lambda thread: thread.start(), threads) + try: + while not end_event.is_set(): + time.sleep(0.1) + except (KeyboardInterrupt, SystemExit): + end_event.set() + raise + finally: + for i, thread in enumerate(threads): + thread.join() + +def jsonrpc_handler(end_event): + while not end_event.is_set(): + try: + data = payload_queue.get(timeout=1) + response = JSONRPCResponseManager.handle(data, dispatcher) + response_queue.put_nowait(response) + except Queue.Empty: + pass + except Exception as e: + cloudlog.exception("athena jsonrpc handler failed") + traceback.print_exc() + response_queue.put_nowait(json.dumps({"error": str(e)})) + +# security: user should be able to request any message from their car +# TODO: add service to, for example, start visiond and take a picture +@dispatcher.add_method +def getMessage(service=None, timeout=1000): + context = zmq.Context() + if service is None or service not in service_list: + raise Exception("invalid service") + socket = messaging.sub_sock(context, service_list[service].port) + socket.setsockopt(zmq.RCVTIMEO, timeout) + ret = messaging.recv_one(socket) + return ret.to_dict() + +def ws_recv(ws, end_event): + while not end_event.is_set(): + try: + data = ws.recv() + payload_queue.put_nowait(data) + except WebSocketTimeoutException: + pass + except Exception: + traceback.print_exc() + end_event.set() + +def ws_send(ws, end_event): + while not end_event.is_set(): + try: + response = response_queue.get(timeout=1) + ws.send(response.json) + except Queue.Empty: + pass + except Exception: + traceback.print_exc() + end_event.set() + +def backoff(retries): + return random.randrange(0, min(128, int(2 ** retries))) + +def main(gctx=None): + params = Params() + dongle_id = params.get("DongleId") + access_token = params.get("AccessToken") + ws_uri = ATHENA_HOST + "/ws/" + dongle_id + + crash.bind_user(id=dongle_id) + crash.bind_extra(version=version, dirty=dirty, is_eon=True) + crash.install() + + conn_retries = 0 + while 1: + try: + print("connecting to %s" % ws_uri) + ws = create_connection(ws_uri, + cookie="jwt=" + access_token, + enable_multithread=True) + ws.settimeout(1) + conn_retries = 0 + handle_long_poll(ws) + except (KeyboardInterrupt, SystemExit): + break + except Exception: + conn_retries += 1 + traceback.print_exc() + + time.sleep(backoff(conn_retries)) + +if __name__ == "__main__": + main() diff --git a/selfdrive/boardd/Makefile b/selfdrive/boardd/Makefile index 1573304e673498..893edde545b848 100644 --- a/selfdrive/boardd/Makefile +++ b/selfdrive/boardd/Makefile @@ -13,8 +13,8 @@ WARN_FLAGS = -Werror=implicit-function-declaration \ -Werror=return-type \ -Werror=format-extra-args -CFLAGS = -std=gnu11 -g -fPIC -I../../ -O2 $(WARN_FLAGS) -CXXFLAGS = -std=c++11 -g -fPIC -I../../ -O2 $(WARN_FLAGS) +CFLAGS = -std=gnu11 -g -fPIC -I../ -I../../ -O2 $(WARN_FLAGS) +CXXFLAGS = -std=c++11 -g -fPIC -I../ -I../../ -O2 $(WARN_FLAGS) ZMQ_FLAGS = -I$(PHONELIBS)/zmq/aarch64/include ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib \ diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index 669f0fdd8cbb5d..dd89d4d6d48bda 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -39,8 +39,14 @@ #define SAFETY_HONDA_BOSCH 4 #define SAFETY_FORD 5 #define SAFETY_CADILLAC 6 +#define SAFETY_HYUNDAI 7 +#define SAFETY_TESLA 8 +#define SAFETY_CHRYSLER 9 +#define SAFETY_SUBARU 10 +#define SAFETY_TOYOTA_IPAS 0x1335 #define SAFETY_TOYOTA_NOLIMITS 0x1336 #define SAFETY_ALLOUTPUT 0x1337 +#define SAFETY_ELM327 0xE327 namespace { @@ -113,6 +119,15 @@ void *safety_setter_thread(void *s) { case (int)cereal::CarParams::SafetyModels::CADILLAC: safety_setting = SAFETY_CADILLAC; break; + case (int)cereal::CarParams::SafetyModels::HYUNDAI: + safety_setting = SAFETY_HYUNDAI; + break; + case (int)cereal::CarParams::SafetyModels::CHRYSLER: + safety_setting = SAFETY_CHRYSLER; + break; + case (int)cereal::CarParams::SafetyModels::SUBARU: + safety_setting = SAFETY_SUBARU; + break; default: LOGE("unknown safety model: %d", safety_model); } @@ -320,6 +335,11 @@ void can_send(void *s) { capnp::FlatArrayMessageReader cmsg(amsg); cereal::Event::Reader event = cmsg.getRoot(); + if (nanos_since_boot() - event.getLogMonoTime() > 1e9) { + //Older than 1 second. Dont send. + zmq_msg_close(&msg); + return; + } int msg_count = event.getCan().size(); uint32_t *send = (uint32_t*)malloc(msg_count*0x10); @@ -413,6 +433,14 @@ void *can_send_thread(void *crap) { zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, "", 0); zmq_connect(subscriber, "tcp://127.0.0.1:8017"); + // drain sendcan to delete any stale messages from previous runs + zmq_msg_t msg; + zmq_msg_init(&msg); + int err = 0; + while(err >= 0) { + err = zmq_msg_recv(&msg, subscriber, ZMQ_DONTWAIT); + } + // run as fast as messages come in while (!do_exit) { can_send(subscriber); @@ -584,7 +612,7 @@ void *pigeon_thread(void *crap) { //printf("got %d\n", len); alen += len; } - if (alen > 0) { + if (alen > 0) { if (dat[0] == (char)0x00){ LOGW("received invalid ublox message, resetting pigeon"); pigeon_init(); diff --git a/selfdrive/boardd/boardd.py b/selfdrive/boardd/boardd.py index 849d43979b9f19..fb045bb3aafdc2 100755 --- a/selfdrive/boardd/boardd.py +++ b/selfdrive/boardd/boardd.py @@ -1,4 +1,11 @@ #!/usr/bin/env python + +# This file is not used by OpenPilot. Only boardd.cc is used. +# The python version is slower, but has more options for development. + +# TODO: merge the extra functionalities of this file (like MOCK) in boardd.c and +# delete this python version of boardd + import os import struct import zmq @@ -16,11 +23,10 @@ except Exception: pass -# TODO: rewrite in C to save CPU - SAFETY_NOOUTPUT = 0 SAFETY_HONDA = 1 SAFETY_TOYOTA = 2 +SAFETY_CHRYSLER = 9 SAFETY_TOYOTA_NOLIMITS = 0x1336 SAFETY_ALLOUTPUT = 0x1337 @@ -69,9 +75,10 @@ def __parse_can_buffer(dat): def can_send_many(arr): snds = [] for addr, _, dat, alt in arr: - snd = struct.pack("II", ((addr << 21) | 1), len(dat) | (alt << 4)) + dat - snd = snd.ljust(0x10, '\x00') - snds.append(snd) + if addr < 0x800: # only support 11 bit addr + snd = struct.pack("II", ((addr << 21) | 1), len(dat) | (alt << 4)) + dat + snd = snd.ljust(0x10, '\x00') + snds.append(snd) while 1: try: handle.bulkWrite(3, ''.join(snds)) @@ -160,6 +167,9 @@ def boardd_loop(rate=200): # *** subscribes to can send sendcan = messaging.sub_sock(context, service_list['sendcan'].port) + # drain sendcan to delete any stale messages from previous runs + messaging.drain_sock(sendcan) + while 1: # health packet @ 1hz if (rk.frame%rate) == 0: @@ -171,6 +181,7 @@ def boardd_loop(rate=200): msg.health.voltage = health['voltage'] msg.health.current = health['current'] msg.health.started = health['started'] + msg.health.controlsAllowed = True health_sock.send(msg.to_bytes()) @@ -202,6 +213,9 @@ def boardd_proxy_loop(rate=200, address="192.168.2.251"): # *** publishes to can send sendcan = messaging.pub_sock(context, service_list['sendcan'].port) + # drain sendcan to delete any stale messages from previous runs + messaging.drain_sock(sendcan) + while 1: # recv @ 100hz can_msgs = can_recv() diff --git a/selfdrive/can/common.h b/selfdrive/can/common.h index accb593ff395bf..4f097228432543 100644 --- a/selfdrive/can/common.h +++ b/selfdrive/can/common.h @@ -10,6 +10,7 @@ unsigned int honda_checksum(unsigned int address, uint64_t d, int l); unsigned int toyota_checksum(unsigned int address, uint64_t d, int l); +unsigned int pedal_checksum(unsigned int address, uint64_t d, int l); struct SignalPackValue { const char* name; @@ -41,6 +42,8 @@ enum SignalType { HONDA_CHECKSUM, HONDA_COUNTER, TOYOTA_CHECKSUM, + PEDAL_CHECKSUM, + PEDAL_COUNTER, }; struct Signal { @@ -60,10 +63,19 @@ struct Msg { const Signal *sigs; }; +struct Val { + const char* name; + uint32_t address; + const char* def_val; + const Signal *sigs; +}; + struct DBC { const char* name; size_t num_msgs; const Msg *msgs; + const Val *vals; + size_t num_vals; }; const DBC* dbc_lookup(const std::string& dbc_name); diff --git a/selfdrive/can/dbc_template.cc b/selfdrive/can/dbc_template.cc index 3615e0529761e0..776403b22f03ff 100644 --- a/selfdrive/can/dbc_template.cc +++ b/selfdrive/can/dbc_template.cc @@ -27,6 +27,10 @@ const Signal sigs_{{address}}[] = { .type = SignalType::HONDA_COUNTER, {% elif checksum_type == "toyota" and sig.name == "CHECKSUM" %} .type = SignalType::TOYOTA_CHECKSUM, + {% elif address in [512, 513] and sig.name == "CHECKSUM_PEDAL" %} + .type = SignalType::PEDAL_CHECKSUM, + {% elif address in [512, 513] and sig.name == "COUNTER_PEDAL" %} + .type = SignalType::PEDAL_COUNTER, {% else %} .type = SignalType::DEFAULT, {% endif %} @@ -48,12 +52,28 @@ const Msg msgs[] = { {% endfor %} }; +const Val vals[] = { +{% for address, sig in def_vals %} + {% for sg_name, def_val in sig %} + {% set address_hex = "0x%X" % address %} + { + .name = "{{sg_name}}", + .address = {{address_hex}}, + .def_val = {{def_val}}, + .sigs = sigs_{{address}}, + }, + {% endfor %} +{% endfor %} +}; + } const DBC {{dbc.name}} = { .name = "{{dbc.name}}", .num_msgs = ARRAYSIZE(msgs), .msgs = msgs, + .vals = vals, + .num_vals = ARRAYSIZE(vals), }; dbc_init({{dbc.name}}) diff --git a/selfdrive/can/libdbc_py.py b/selfdrive/can/libdbc_py.py index 3c5d440f3bea4f..cf712cf634ee89 100644 --- a/selfdrive/can/libdbc_py.py +++ b/selfdrive/can/libdbc_py.py @@ -39,6 +39,8 @@ HONDA_CHECKSUM, HONDA_COUNTER, TOYOTA_CHECKSUM, + PEDAL_CHECKSUM, + PEDAL_COUNTER, } SignalType; typedef struct { @@ -57,10 +59,19 @@ const Signal *sigs; } Msg; +typedef struct { + const char* name; + uint32_t address; + const char* def_val; + const Signal *sigs; +} Val; + typedef struct { const char* name; size_t num_msgs; const Msg *msgs; + const Val *vals; + size_t num_vals; } DBC; diff --git a/selfdrive/can/packer.cc b/selfdrive/can/packer.cc index 2443f10f7156cb..17171f15503048 100644 --- a/selfdrive/can/packer.cc +++ b/selfdrive/can/packer.cc @@ -1,5 +1,4 @@ #include - #include #include #include @@ -13,9 +12,26 @@ namespace { + // this is the same as read_u64_le, but uses uint64_t as in/out + uint64_t ReverseBytes(uint64_t x) { + return ((x & 0xff00000000000000ull) >> 56) | + ((x & 0x00ff000000000000ull) >> 40) | + ((x & 0x0000ff0000000000ull) >> 24) | + ((x & 0x000000ff00000000ull) >> 8) | + ((x & 0x00000000ff000000ull) << 8) | + ((x & 0x0000000000ff0000ull) << 24) | + ((x & 0x000000000000ff00ull) << 40) | + ((x & 0x00000000000000ffull) << 56); + } + uint64_t set_value(uint64_t ret, Signal sig, int64_t ival){ - uint64_t mask = ((1ULL << sig.b2)-1) << sig.bo; - uint64_t dat = (ival & ((1ULL << sig.b2)-1)) << sig.bo; + int shift = sig.is_little_endian? sig.b1 : sig.bo; + uint64_t mask = ((1ULL << sig.b2)-1) << shift; + uint64_t dat = (ival & ((1ULL << sig.b2)-1)) << shift; + if (sig.is_little_endian) { + dat = ReverseBytes(dat); + mask = ReverseBytes(mask); + } ret &= ~mask; ret |= dat; return ret; @@ -84,7 +100,7 @@ namespace { unsigned int chksm = toyota_checksum(address, ret, message_lookup[address].size); ret = set_value(ret, sig, chksm); } else { - WARN("CHECKSUM signal type not valid\n"); + //WARN("CHECKSUM signal type not valid\n"); } } diff --git a/selfdrive/can/packer.py b/selfdrive/can/packer.py index 58f5e3efc3e8f7..cc669e60c6a23c 100644 --- a/selfdrive/can/packer.py +++ b/selfdrive/can/packer.py @@ -46,9 +46,22 @@ def make_can_msg(self, addr, bus, values, counter=-1): if __name__ == "__main__": - cp = CANPacker("honda_civic_touring_2016_can_generated") - s = cp.pack_bytes(0x30c, [ - ("PCM_SPEED", 123), - ("PCM_GAS", 10), - ]) + ## little endian test + cp = CANPacker("hyundai_santa_fe_2019_ccan") + s = cp.pack_bytes(0x340, { + "CR_Lkas_StrToqReq": -0.06, + #"CF_Lkas_FcwBasReq": 1, + "CF_Lkas_MsgCount": 7, + "CF_Lkas_HbaSysState": 0, + #"CF_Lkas_Chksum": 3, + }) + s = cp.pack_bytes(0x340, { + "CF_Lkas_MsgCount": 1, + }) + # big endian test + #cp = CANPacker("honda_civic_touring_2016_can_generated") + #s = cp.pack_bytes(0xe4, { + # "STEER_TORQUE": -2, + #}) + print [hex(ord(v)) for v in s[1]] print(s[1].encode("hex")) diff --git a/selfdrive/can/parser.cc b/selfdrive/can/parser.cc index 9246ae5b7e4ad1..b6845b47db2ad9 100644 --- a/selfdrive/can/parser.cc +++ b/selfdrive/can/parser.cc @@ -51,6 +51,30 @@ unsigned int toyota_checksum(unsigned int address, uint64_t d, int l) { return s & 0xFF; } +unsigned int pedal_checksum(unsigned int address, uint64_t d, int l) { + uint8_t crc = 0xFF; + uint8_t poly = 0xD5; // standard crc8 + + d >>= ((8-l)*8); // remove padding + d >>= 8; // remove checksum + + uint8_t *dat = (uint8_t *)&d; + + int i, j; + for (i = 0; i < l - 1; i++) { + crc ^= dat[i]; + for (j = 0; j < 8; j++) { + if ((crc & 0x80) != 0) { + crc = (uint8_t)((crc << 1) ^ poly); + } + else { + crc <<= 1; + } + } + } + return crc; +} + namespace { uint64_t read_u64_be(const uint8_t* v) { @@ -113,16 +137,23 @@ struct MessageState { return false; } } else if (sig.type == SignalType::HONDA_COUNTER) { - if (!honda_update_counter(tmp)) { + if (!update_counter_generic(tmp, sig.b2)) { return false; } } else if (sig.type == SignalType::TOYOTA_CHECKSUM) { - // INFO("CHECKSUM %d %d %018llX - %lld vs %d\n", address, size, dat, tmp, toyota_checksum(address, dat, size)); - if (toyota_checksum(address, dat, size) != tmp) { INFO("%X CHECKSUM FAIL\n", address); return false; } + } else if (sig.type == SignalType::PEDAL_CHECKSUM) { + if (pedal_checksum(address, dat, size) != tmp) { + INFO("%X PEDAL CHECKSUM FAIL\n", address); + return false; + } + } else if (sig.type == SignalType::PEDAL_COUNTER) { + if (!update_counter_generic(tmp, sig.b2)) { + return false; + } } vals[i] = tmp * sig.factor + sig.offset; @@ -134,10 +165,10 @@ struct MessageState { } - bool honda_update_counter(int64_t v) { + bool update_counter_generic(int64_t v, int cnt_size) { uint8_t old_counter = counter; counter = v; - if (((old_counter+1) & 3) != v) { + if (((old_counter+1) & ((1 << cnt_size) -1)) != v) { counter_fail += 1; if (counter_fail > 1) { INFO("%X COUNTER FAIL %d -- %d vs %d\n", address, counter_fail, old_counter, (int)v); @@ -177,6 +208,14 @@ class CANParser { zmq_connect(subscriber, tcp_addr_char); + // drain sendcan to delete any stale messages from previous runs + zmq_msg_t msgDrain; + zmq_msg_init(&msgDrain); + int err = 0; + while(err >= 0) { + err = zmq_msg_recv(&msgDrain, subscriber, ZMQ_DONTWAIT); + } + dbc = dbc_lookup(dbc_name); assert(dbc); @@ -259,6 +298,7 @@ class CANParser { memcpy(dat, cmsg.getDat().begin(), cmsg.getDat().size()); // Assumes all signals in the message are of the same type (little or big endian) + // TODO: allow signals within the same message to have different endianess auto& sig = message_states[cmsg.getAddress()].parse_sigs[0]; if (sig.is_little_endian) { p = read_u64_le(dat); diff --git a/selfdrive/can/parser.py b/selfdrive/can/parser.py index 6abbb3c18adf09..8960953edab2f7 100644 --- a/selfdrive/can/parser.py +++ b/selfdrive/can/parser.py @@ -4,8 +4,12 @@ from selfdrive.can.libdbc_py import libdbc, ffi + class CANParser(object): - def __init__(self, dbc_name, signals, checks=[], bus=0, sendcan=False, tcp_addr="127.0.0.1"): + def __init__(self, dbc_name, signals, checks=None, bus=0, sendcan=False, tcp_addr="127.0.0.1"): + if checks is None: + checks = [] + self.can_valid = True self.vl = defaultdict(dict) self.ts = defaultdict(dict) @@ -93,6 +97,44 @@ def update(self, sec, wait): libdbc.can_update(self.can, sec, wait) return self.update_vl(sec) +class CANDefine(object): + def __init__(self, dbc_name): + self.dv = defaultdict(dict) + self.dbc_name = dbc_name + self.dbc = libdbc.dbc_lookup(dbc_name) + + num_vals = self.dbc[0].num_vals + + self.address_to_msg_name = {} + num_msgs = self.dbc[0].num_msgs + for i in range(num_msgs): + msg = self.dbc[0].msgs[i] + name = ffi.string(msg.name) + address = msg.address + self.address_to_msg_name[address] = name + + for i in range(num_vals): + val = self.dbc[0].vals[i] + + sgname = ffi.string(val.name) + address = val.address + def_val = ffi.string(val.def_val) + + #separate definition/value pairs + def_val = def_val.split() + values = [int(v) for v in def_val[::2]] + defs = def_val[1::2] + + if address not in self.dv: + self.dv[address] = {} + msgname = self.address_to_msg_name[address] + self.dv[msgname] = {} + + # two ways to lookup: address or msg name + self.dv[address][sgname] = {v: d for v, d in zip(values, defs)} #build dict + self.dv[msgname][sgname] = self.dv[address][sgname] + + if __name__ == "__main__": from common.realtime import sec_since_boot diff --git a/selfdrive/can/process_dbc.py b/selfdrive/can/process_dbc.py index b1e66780a77db4..810947c8ef18d3 100755 --- a/selfdrive/can/process_dbc.py +++ b/selfdrive/can/process_dbc.py @@ -24,6 +24,9 @@ msgs = [(address, msg_name, msg_size, sorted(msg_sigs, key=lambda s: s.name not in ("COUNTER", "CHECKSUM"))) # process counter and checksums first for address, ((msg_name, msg_size), msg_sigs) in sorted(can_dbc.msgs.iteritems()) if msg_sigs] +def_vals = {a: set(b) for a,b in can_dbc.def_vals.items()} #remove duplicates +def_vals = [(address, sig) for address, sig in sorted(def_vals.iteritems())] + if can_dbc.name.startswith("honda") or can_dbc.name.startswith("acura"): checksum_type = "honda" checksum_size = 4 @@ -47,7 +50,11 @@ sys.exit("COUNTER is not 2 bits longs %s" % msg_name) if sig.start_bit % 8 != 5: sys.exit("COUNTER starts at wrong bit %s" % msg_name) - + if address in [0x200, 0x201]: + if sig.name == "COUNTER_PEDAL" and sig.size != 4: + sys.exit("PEDAL COUNTER is not 4 bits longs %s" % msg_name) + if sig.name == "CHECKSUM_PEDAL" and sig.size != 8: + sys.exit("PEDAL CHECKSUM is not 8 bits longs %s" % msg_name) # Fail on duplicate message names c = Counter([msg_name for address, msg_name, msg_size, sigs in msgs]) @@ -55,7 +62,7 @@ if count > 1: sys.exit("Duplicate message name in DBC file %s" % name) -parser_code = template.render(dbc=can_dbc, checksum_type=checksum_type, msgs=msgs, len=len) +parser_code = template.render(dbc=can_dbc, checksum_type=checksum_type, msgs=msgs, def_vals=def_vals, len=len) with open(out_fn, "w") as out_f: out_f.write(parser_code) diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py index 80e79f03493eff..255b20806cce36 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -1,4 +1,83 @@ # functions common among cars +from common.numpy_fast import clip + def dbc_dict(pt_dbc, radar_dbc, chassis_dbc=None): return {'pt': pt_dbc, 'radar': radar_dbc, 'chassis': chassis_dbc} + + +def apply_std_steer_torque_limits(apply_torque, apply_torque_last, driver_torque, LIMITS): + + # limits due to driver torque + driver_max_torque = LIMITS.STEER_MAX + (LIMITS.STEER_DRIVER_ALLOWANCE + driver_torque * LIMITS.STEER_DRIVER_FACTOR) * LIMITS.STEER_DRIVER_MULTIPLIER + driver_min_torque = -LIMITS.STEER_MAX + (-LIMITS.STEER_DRIVER_ALLOWANCE + driver_torque * LIMITS.STEER_DRIVER_FACTOR) * LIMITS.STEER_DRIVER_MULTIPLIER + max_steer_allowed = max(min(LIMITS.STEER_MAX, driver_max_torque), 0) + min_steer_allowed = min(max(-LIMITS.STEER_MAX, driver_min_torque), 0) + apply_torque = clip(apply_torque, min_steer_allowed, max_steer_allowed) + + # slow rate if steer torque increases in magnitude + if apply_torque_last > 0: + apply_torque = clip(apply_torque, max(apply_torque_last - LIMITS.STEER_DELTA_DOWN, -LIMITS.STEER_DELTA_UP), + apply_torque_last + LIMITS.STEER_DELTA_UP) + else: + apply_torque = clip(apply_torque, apply_torque_last - LIMITS.STEER_DELTA_UP, + min(apply_torque_last + LIMITS.STEER_DELTA_DOWN, LIMITS.STEER_DELTA_UP)) + + return int(round(apply_torque)) + + +def apply_toyota_steer_torque_limits(apply_torque, apply_torque_last, motor_torque, LIMITS): + + # limits due to comparison of commanded torque VS motor reported torque + max_lim = min(max(motor_torque + LIMITS.STEER_ERROR_MAX, LIMITS.STEER_ERROR_MAX), LIMITS.STEER_MAX) + min_lim = max(min(motor_torque - LIMITS.STEER_ERROR_MAX, -LIMITS.STEER_ERROR_MAX), -LIMITS.STEER_MAX) + + apply_torque = clip(apply_torque, min_lim, max_lim) + + # slow rate if steer torque increases in magnitude + if apply_torque_last > 0: + apply_torque = clip(apply_torque, + max(apply_torque_last - LIMITS.STEER_DELTA_DOWN, -LIMITS.STEER_DELTA_UP), + apply_torque_last + LIMITS.STEER_DELTA_UP) + else: + apply_torque = clip(apply_torque, + apply_torque_last - LIMITS.STEER_DELTA_UP, + min(apply_torque_last + LIMITS.STEER_DELTA_DOWN, LIMITS.STEER_DELTA_UP)) + + return int(round(apply_torque)) + + +def crc8_pedal(data): + crc = 0xFF # standard init value + poly = 0xD5 # standard crc8: x8+x7+x6+x4+x2+1 + size = len(data) + for i in range(size-1, -1, -1): + crc ^= data[i] + for j in range(8): + if ((crc & 0x80) != 0): + crc = ((crc << 1) ^ poly) & 0xFF + else: + crc <<= 1 + return crc + + +def create_gas_command(packer, gas_amount, idx): + # Common gas pedal msg generator + enable = gas_amount > 0.001 + + values = { + "ENABLE": enable, + "COUNTER_PEDAL": idx & 0xF, + } + + if enable: + values["GAS_COMMAND"] = gas_amount * 255. + values["GAS_COMMAND2"] = gas_amount * 255. + + dat = packer.make_can_msg("GAS_COMMAND", 0, values)[2] + + dat = [ord(i) for i in dat] + checksum = crc8_pedal(dat[:-1]) + values["CHECKSUM_PEDAL"] = checksum + + return packer.make_can_msg("GAS_COMMAND", 0, values) diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index afe5a9e4c1dcca..58cde11bdf293c 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -39,6 +39,7 @@ def _get_interface_names(): interfaces = load_interfaces(_get_interface_names()) +# BOUNTY: every added fingerprint in selfdrive/car/*/values.py is a $100 coupon code on shop.comma.ai # **** for use live only **** def fingerprint(logcan, timeout): if os.getenv("SIMULATOR2") is not None: @@ -97,6 +98,7 @@ def get_car(logcan, sendcan=None, passive=True): return None, None interface_cls = interfaces[candidate] + if interface_cls is None: cloudlog.warning("car matched %s, but interface wasn't available or failed to import" % candidate) return None, None diff --git a/selfdrive/car/chrysler/__init__.py b/selfdrive/car/chrysler/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/selfdrive/car/chrysler/carcontroller.py b/selfdrive/car/chrysler/carcontroller.py new file mode 100644 index 00000000000000..7db36634c0bd0d --- /dev/null +++ b/selfdrive/car/chrysler/carcontroller.py @@ -0,0 +1,100 @@ +from cereal import car +from selfdrive.boardd.boardd import can_list_to_can_capnp +from selfdrive.car import apply_toyota_steer_torque_limits +from selfdrive.car.chrysler.chryslercan import create_lkas_hud, create_lkas_command, \ + create_wheel_buttons, \ + create_chimes +from selfdrive.car.chrysler.values import ECU, CAR +from selfdrive.can.packer import CANPacker + +AudibleAlert = car.CarControl.HUDControl.AudibleAlert +LOUD_ALERTS = [AudibleAlert.chimeWarning1, AudibleAlert.chimeWarning2, AudibleAlert.chimeWarningRepeat] + +class SteerLimitParams: + STEER_MAX = 261 # 262 faults + STEER_DELTA_UP = 3 # 3 is stock. 100 is fine. 200 is too much it seems + STEER_DELTA_DOWN = 3 # no faults on the way down it seems + STEER_ERROR_MAX = 80 + + +class CarController(object): + def __init__(self, dbc_name, car_fingerprint, enable_camera): + self.braking = False + # redundant safety check with the board + self.controls_allowed = True + self.apply_steer_last = 0 + self.ccframe = 0 + self.prev_frame = -1 + self.hud_count = 0 + self.car_fingerprint = car_fingerprint + self.alert_active = False + self.send_chime = False + self.gone_fast_yet = False + + self.fake_ecus = set() + if enable_camera: + self.fake_ecus.add(ECU.CAM) + + self.packer = CANPacker(dbc_name) + + + def update(self, sendcan, enabled, CS, frame, actuators, + pcm_cancel_cmd, hud_alert, audible_alert): + # this seems needed to avoid steering faults and to force the sync with the EPS counter + frame = CS.lkas_counter + if self.prev_frame == frame: + return + + # *** compute control surfaces *** + # steer torque + apply_steer = actuators.steer * SteerLimitParams.STEER_MAX + apply_steer = apply_toyota_steer_torque_limits(apply_steer, self.apply_steer_last, + CS.steer_torque_motor, SteerLimitParams) + + moving_fast = CS.v_ego > CS.CP.minSteerSpeed # for status message + if CS.v_ego > (CS.CP.minSteerSpeed - 0.5): # for command high bit + self.gone_fast_yet = True + elif self.car_fingerprint in (CAR.PACIFICA_2019_HYBRID, CAR.JEEP_CHEROKEE_2019): + if CS.v_ego < (CS.CP.minSteerSpeed - 3.0): + self.gone_fast_yet = False # < 14.5m/s stock turns off this bit, but fine down to 13.5 + lkas_active = moving_fast and enabled + + if not lkas_active: + apply_steer = 0 + + self.apply_steer_last = apply_steer + + if audible_alert in LOUD_ALERTS: + self.send_chime = True + + can_sends = [] + + #*** control msgs *** + + if self.send_chime: + new_msg = create_chimes(AudibleAlert) + can_sends.append(new_msg) + if audible_alert not in LOUD_ALERTS: + self.send_chime = False + + if pcm_cancel_cmd: + # TODO: would be better to start from frame_2b3 + new_msg = create_wheel_buttons(self.ccframe) + can_sends.append(new_msg) + + # LKAS_HEARTBIT is forwarded by Panda so no need to send it here. + # frame is 100Hz (0.01s period) + if (self.ccframe % 25 == 0): # 0.25s period + if (CS.lkas_car_model != -1): + new_msg = create_lkas_hud( + self.packer, CS.gear_shifter, lkas_active, hud_alert, + self.hud_count, CS.lkas_car_model) + can_sends.append(new_msg) + self.hud_count += 1 + + new_msg = create_lkas_command(self.packer, int(apply_steer), self.gone_fast_yet, frame) + can_sends.append(new_msg) + + self.ccframe += 1 + self.prev_frame = frame + sendcan.send(can_list_to_can_capnp(can_sends, msgtype='sendcan').to_bytes()) diff --git a/selfdrive/car/chrysler/carstate.py b/selfdrive/car/chrysler/carstate.py new file mode 100644 index 00000000000000..fd3c081f3d8d5e --- /dev/null +++ b/selfdrive/car/chrysler/carstate.py @@ -0,0 +1,160 @@ +from selfdrive.can.parser import CANParser +from selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD +from common.kalman.simple_kalman import KF1D +import numpy as np + + +def parse_gear_shifter(can_gear): + if can_gear == 0x1: + return "park" + elif can_gear == 0x2: + return "reverse" + elif can_gear == 0x3: + return "neutral" + elif can_gear == 0x4: + return "drive" + elif can_gear == 0x5: + return "low" + return "unknown" + + +def get_can_parser(CP): + + signals = [ + # sig_name, sig_address, default + ("PRNDL", "GEAR", 0), + ("DOOR_OPEN_FL", "DOORS", 0), + ("DOOR_OPEN_FR", "DOORS", 0), + ("DOOR_OPEN_RL", "DOORS", 0), + ("DOOR_OPEN_RR", "DOORS", 0), + ("BRAKE_PRESSED_2", "BRAKE_2", 0), + ("ACCEL_PEDAL", "ACCEL_PEDAL_MSG", 0), + ("SPEED_LEFT", "SPEED_1", 0), + ("SPEED_RIGHT", "SPEED_1", 0), + ("WHEEL_SPEED_FL", "WHEEL_SPEEDS", 0), + ("WHEEL_SPEED_RR", "WHEEL_SPEEDS", 0), + ("WHEEL_SPEED_RL", "WHEEL_SPEEDS", 0), + ("WHEEL_SPEED_FR", "WHEEL_SPEEDS", 0), + ("STEER_ANGLE", "STEERING", 0), + ("STEERING_RATE", "STEERING", 0), + ("TURN_SIGNALS", "STEERING_LEVERS", 0), + ("ACC_STATUS_2", "ACC_2", 0), + ("HIGH_BEAM_FLASH", "STEERING_LEVERS", 0), + ("ACC_SPEED_CONFIG_KPH", "DASHBOARD", 0), + ("TORQUE_DRIVER", "EPS_STATUS", 0), + ("TORQUE_MOTOR", "EPS_STATUS", 0), + ("LKAS_STATE", "EPS_STATUS", 1), + ("COUNTER", "EPS_STATUS", -1), + ("TRACTION_OFF", "TRACTION_BUTTON", 0), + ("SEATBELT_DRIVER_UNLATCHED", "SEATBELT_STATUS", 0), + ("COUNTER", "WHEEL_BUTTONS", -1), # incrementing counter for 23b + ] + + # It's considered invalid if it is not received for 10x the expected period (1/f). + checks = [ + # sig_address, frequency + ("BRAKE_2", 50), + ("EPS_STATUS", 100), + ("SPEED_1", 100), + ("WHEEL_SPEEDS", 50), + ("STEERING", 100), + ("ACC_2", 50), + ] + + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0) + +def get_camera_parser(CP): + signals = [ + # sig_name, sig_address, default + # TODO read in all the other values + ("COUNTER", "LKAS_COMMAND", -1), + ("CAR_MODEL", "LKAS_HUD", -1), + ("LKAS_STATUS_OK", "LKAS_HEARTBIT", -1) + ] + checks = [] + + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 2) + + +class CarState(object): + def __init__(self, CP): + + self.CP = CP + self.left_blinker_on = 0 + self.right_blinker_on = 0 + + # initialize can parser + self.car_fingerprint = CP.carFingerprint + + # vEgo kalman filter + dt = 0.01 + # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]]) + # R = 1e3 + self.v_ego_kf = KF1D(x0=np.matrix([[0.0], [0.0]]), + A=np.matrix([[1.0, dt], [0.0, 1.0]]), + C=np.matrix([1.0, 0.0]), + K=np.matrix([[0.12287673], [0.29666309]])) + self.v_ego = 0.0 + + + def update(self, cp, cp_cam): + # copy can_valid + self.can_valid = cp.can_valid + + # update prevs, update must run once per loop + self.prev_left_blinker_on = self.left_blinker_on + self.prev_right_blinker_on = self.right_blinker_on + + self.frame_23b = int(cp.vl["WHEEL_BUTTONS"]['COUNTER']) + self.frame = int(cp.vl["EPS_STATUS"]['COUNTER']) + + self.door_all_closed = not any([cp.vl["DOORS"]['DOOR_OPEN_FL'], + cp.vl["DOORS"]['DOOR_OPEN_FR'], + cp.vl["DOORS"]['DOOR_OPEN_RL'], + cp.vl["DOORS"]['DOOR_OPEN_RR']]) + self.seatbelt = (cp.vl["SEATBELT_STATUS"]['SEATBELT_DRIVER_UNLATCHED'] == 0) + + self.brake_pressed = cp.vl["BRAKE_2"]['BRAKE_PRESSED_2'] == 5 # human-only + self.pedal_gas = cp.vl["ACCEL_PEDAL_MSG"]['ACCEL_PEDAL'] + self.car_gas = self.pedal_gas + self.esp_disabled = (cp.vl["TRACTION_BUTTON"]['TRACTION_OFF'] == 1) + + self.v_wheel_fl = cp.vl['WHEEL_SPEEDS']['WHEEL_SPEED_FL'] + self.v_wheel_rr = cp.vl['WHEEL_SPEEDS']['WHEEL_SPEED_RR'] + self.v_wheel_rl = cp.vl['WHEEL_SPEEDS']['WHEEL_SPEED_RL'] + self.v_wheel_fr = cp.vl['WHEEL_SPEEDS']['WHEEL_SPEED_FR'] + v_wheel = (cp.vl['SPEED_1']['SPEED_LEFT'] + cp.vl['SPEED_1']['SPEED_RIGHT']) / 2. + + # Kalman filter + if abs(v_wheel - self.v_ego) > 2.0: # Prevent large accelerations when car starts at non zero speed + self.v_ego_kf.x = np.matrix([[v_wheel], [0.0]]) + + self.v_ego_raw = v_wheel + v_ego_x = self.v_ego_kf.update(v_wheel) + self.v_ego = float(v_ego_x[0]) + self.a_ego = float(v_ego_x[1]) + self.standstill = not v_wheel > 0.001 + + self.angle_steers = cp.vl["STEERING"]['STEER_ANGLE'] + self.angle_steers_rate = cp.vl["STEERING"]['STEERING_RATE'] + self.gear_shifter = parse_gear_shifter(cp.vl['GEAR']['PRNDL']) + self.main_on = cp.vl["ACC_2"]['ACC_STATUS_2'] == 7 # ACC is green. + self.left_blinker_on = cp.vl["STEERING_LEVERS"]['TURN_SIGNALS'] == 1 + self.right_blinker_on = cp.vl["STEERING_LEVERS"]['TURN_SIGNALS'] == 2 + + self.steer_torque_driver = cp.vl["EPS_STATUS"]["TORQUE_DRIVER"] + self.steer_torque_motor = cp.vl["EPS_STATUS"]["TORQUE_MOTOR"] + self.steer_override = abs(self.steer_torque_driver) > STEER_THRESHOLD + steer_state = cp.vl["EPS_STATUS"]["LKAS_STATE"] + self.steer_error = steer_state == 4 or (steer_state == 0 and self.v_ego > self.CP.minSteerSpeed) + + self.user_brake = 0 + self.brake_lights = self.brake_pressed + self.v_cruise_pcm = cp.vl["DASHBOARD"]['ACC_SPEED_CONFIG_KPH'] + self.pcm_acc_status = self.main_on + + self.generic_toggle = bool(cp.vl["STEERING_LEVERS"]['HIGH_BEAM_FLASH']) + + self.lkas_counter = cp_cam.vl["LKAS_COMMAND"]['COUNTER'] + self.lkas_car_model = cp_cam.vl["LKAS_HUD"]['CAR_MODEL'] + self.lkas_status_ok = cp_cam.vl["LKAS_HEARTBIT"]['LKAS_STATUS_OK'] diff --git a/selfdrive/car/chrysler/chryslercan.py b/selfdrive/car/chrysler/chryslercan.py new file mode 100644 index 00000000000000..53c1eb662bb72b --- /dev/null +++ b/selfdrive/car/chrysler/chryslercan.py @@ -0,0 +1,119 @@ +from cereal import car +from selfdrive.car.chrysler.values import CAR + + +VisualAlert = car.CarControl.HUDControl.VisualAlert +AudibleAlert = car.CarControl.HUDControl.AudibleAlert + +def calc_checksum(data): + """This function does not want the checksum byte in the input data. + + jeep chrysler canbus checksum from http://illmatics.com/Remote%20Car%20Hacking.pdf + """ + end_index = len(data) + index = 0 + checksum = 0xFF + temp_chk = 0; + bit_sum = 0; + if(end_index <= index): + return False + for index in range(0, end_index): + shift = 0x80 + curr = data[index] + iterate = 8 + while(iterate > 0): + iterate -= 1 + bit_sum = curr & shift; + temp_chk = checksum & 0x80 + if (bit_sum != 0): + bit_sum = 0x1C + if (temp_chk != 0): + bit_sum = 1 + checksum = checksum << 1 + temp_chk = checksum | 1 + bit_sum ^= temp_chk + else: + if (temp_chk != 0): + bit_sum = 0x1D + checksum = checksum << 1 + bit_sum ^= checksum + checksum = bit_sum + shift = shift >> 1 + return ~checksum & 0xFF + + +def make_can_msg(addr, dat): + return [addr, 0, dat, 0] + +def create_lkas_heartbit(packer, lkas_status_ok): + # LKAS_HEARTBIT 0x2d9 (729) Lane-keeping heartbeat. + values = { + "LKAS_STATUS_OK": lkas_status_ok + } + return packer.make_can_msg("LKAS_HEARTBIT", 0, values) + +def create_lkas_hud(packer, gear, lkas_active, hud_alert, hud_count, lkas_car_model): + # LKAS_HUD 0x2a6 (678) Controls what lane-keeping icon is displayed. + + if hud_alert == VisualAlert.steerRequired: + msg = '0000000300000000'.decode('hex') + return make_can_msg(0x2a6, msg) + + color = 1 # default values are for park or neutral in 2017 are 0 0, but trying 1 1 for 2019 + lines = 1 + alerts = 0 + + if hud_count < (1 *4): # first 3 seconds, 4Hz + alerts = 1 + # CAR.PACIFICA_2018_HYBRID and CAR.PACIFICA_2019_HYBRID + # had color = 1 and lines = 1 but trying 2017 hybrid style for now. + if gear in ('drive', 'reverse', 'low'): + if lkas_active: + color = 2 # control active, display green. + lines = 6 + else: + color = 1 # control off, display white. + lines = 1 + + values = { + "LKAS_ICON_COLOR": color, # byte 0, last 2 bits + "CAR_MODEL": lkas_car_model, # byte 1 + "LKAS_LANE_LINES": lines, # byte 2, last 4 bits + "LKAS_ALERTS": alerts, # byte 3, last 4 bits + } + + return packer.make_can_msg("LKAS_HUD", 0, values) # 0x2a6 + + +def create_lkas_command(packer, apply_steer, moving_fast, frame): + # LKAS_COMMAND 0x292 (658) Lane-keeping signal to turn the wheel. + values = { + "LKAS_STEERING_TORQUE": apply_steer, + "LKAS_HIGH_TORQUE": int(moving_fast), + "COUNTER": frame % 0x10, + } + + dat = packer.make_can_msg("LKAS_COMMAND", 0, values)[2] + dat = [ord(i) for i in dat][:-1] + checksum = calc_checksum(dat) + + values["CHECKSUM"] = checksum + return packer.make_can_msg("LKAS_COMMAND", 0, values) + + +def create_chimes(audible_alert): + # '0050' nothing, chime '4f55' + if audible_alert == AudibleAlert.none: + msg = '0050'.decode('hex') + else: + msg = '4f55'.decode('hex') + return make_can_msg(0x339, msg) + + +def create_wheel_buttons(frame): + # WHEEL_BUTTONS (571) Message sent to cancel ACC. + start = [0x01] # acc cancel set + counter = (frame % 10) << 4 + dat = start + [counter] + dat = dat + [calc_checksum(dat)] + return make_can_msg(0x23b, str(bytearray(dat))) diff --git a/selfdrive/car/chrysler/chryslercan_test.py b/selfdrive/car/chrysler/chryslercan_test.py new file mode 100644 index 00000000000000..b4ca4a91f89a68 --- /dev/null +++ b/selfdrive/car/chrysler/chryslercan_test.py @@ -0,0 +1,68 @@ +import chryslercan +from values import CAR +from carcontroller import CarController +from selfdrive.can.packer import CANPacker + +from cereal import car +VisualAlert = car.CarControl.HUDControl.VisualAlert +AudibleAlert = car.CarControl.HUDControl.AudibleAlert + +import unittest + + +class TestChryslerCan(unittest.TestCase): + + def test_checksum(self): + self.assertEqual(0x75, chryslercan.calc_checksum([0x01, 0x20])) + self.assertEqual(0xcc, chryslercan.calc_checksum([0x14, 0, 0, 0, 0x20])) + + def test_heartbit(self): + packer = CANPacker('chrysler_pacifica_2017_hybrid') + self.assertEqual( + [0x2d9, 0, '0000000820'.decode('hex'), 0], + chryslercan.create_lkas_heartbit(packer, 0x820)) + + def test_hud(self): + packer = CANPacker('chrysler_pacifica_2017_hybrid') + self.assertEqual( + [0x2a6, 0, '0100010100000000'.decode('hex'), 0], + chryslercan.create_lkas_hud( + packer, + 'park', False, False, 1, 0)) + self.assertEqual( + [0x2a6, 0, '0100010000000000'.decode('hex'), 0], + chryslercan.create_lkas_hud( + packer, + 'park', False, False, 5*4, 0)) + self.assertEqual( + [0x2a6, 0, '0100010000000000'.decode('hex'), 0], + chryslercan.create_lkas_hud( + packer, + 'park', False, False, 99999, 0)) + self.assertEqual( + [0x2a6, 0, '0200060000000000'.decode('hex'), 0], + chryslercan.create_lkas_hud( + packer, + 'drive', True, False, 99999, 0)) + self.assertEqual( + [0x2a6, 0, '0264060000000000'.decode('hex'), 0], + chryslercan.create_lkas_hud( + packer, + 'drive', True, False, 99999, 0x64)) + + def test_command(self): + packer = CANPacker('chrysler_pacifica_2017_hybrid') + self.assertEqual( + [0x292, 0, '140000001086'.decode('hex'), 0], + chryslercan.create_lkas_command( + packer, + 0, True, 1)) + self.assertEqual( + [0x292, 0, '040000008083'.decode('hex'), 0], + chryslercan.create_lkas_command( + packer, + 0, False, 8)) + + +if __name__ == '__main__': + unittest.main() diff --git a/selfdrive/car/chrysler/interface.py b/selfdrive/car/chrysler/interface.py new file mode 100755 index 00000000000000..7e96ebc2b593a1 --- /dev/null +++ b/selfdrive/car/chrysler/interface.py @@ -0,0 +1,273 @@ +#!/usr/bin/env python +from common.realtime import sec_since_boot +from cereal import car +from selfdrive.config import Conversions as CV +from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event +from selfdrive.controls.lib.vehicle_model import VehicleModel +from selfdrive.car.chrysler.carstate import CarState, get_can_parser, get_camera_parser +from selfdrive.car.chrysler.values import ECU, check_ecu_msgs, CAR + +try: + from selfdrive.car.chrysler.carcontroller import CarController +except ImportError: + CarController = None + + +class CarInterface(object): + def __init__(self, CP, sendcan=None): + self.CP = CP + self.VM = VehicleModel(CP) + + self.frame = 0 + self.can_invalid_count = 0 + self.gas_pressed_prev = False + self.brake_pressed_prev = False + self.cruise_enabled_prev = False + self.low_speed_alert = False + + # *** init the major players *** + self.CS = CarState(CP) + self.cp = get_can_parser(CP) + self.cp_cam = get_camera_parser(CP) + + # sending if read only is False + if sendcan is not None: + self.sendcan = sendcan + self.CC = CarController(self.cp.dbc_name, CP.carFingerprint, CP.enableCamera) + + @staticmethod + def compute_gb(accel, speed): + return float(accel) / 3.0 + + @staticmethod + def calc_accel_override(a_ego, a_target, v_ego, v_target): + return 1.0 + + @staticmethod + def get_params(candidate, fingerprint): + + # kg of standard extra cargo to count for drive, gas, etc... + std_cargo = 136 + + ret = car.CarParams.new_message() + + ret.carName = "chrysler" + ret.carFingerprint = candidate + + ret.safetyModel = car.CarParams.SafetyModels.chrysler + + # pedal + ret.enableCruise = True + + # FIXME: hardcoding honda civic 2016 touring params so they can be used to + # scale unknown params for other cars + mass_civic = 2923./2.205 + std_cargo + wheelbase_civic = 2.70 + centerToFront_civic = wheelbase_civic * 0.4 + centerToRear_civic = wheelbase_civic - centerToFront_civic + rotationalInertia_civic = 2500 + tireStiffnessFront_civic = 85400 * 2.0 + tireStiffnessRear_civic = 90000 * 2.0 + + # Speed conversion: 20, 45 mph + ret.steerKpBP, ret.steerKiBP = [[9., 20.], [9., 20.]] + ret.wheelbase = 3.089 # in meters for Pacifica Hybrid 2017 + ret.steerRatio = 16.2 # Pacifica Hybrid 2017 + ret.mass = 2858 + std_cargo # kg curb weight Pacifica Hybrid 2017 + ret.steerKpV, ret.steerKiV = [[0.15,0.30], [0.03,0.05]] + ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594 + ret.steerActuatorDelay = 0.1 + ret.steerRateCost = 0.7 + + if candidate in (CAR.JEEP_CHEROKEE, CAR.JEEP_CHEROKEE_2019): + ret.wheelbase = 2.91 # in meters + ret.steerRatio = 12.7 + ret.steerActuatorDelay = 0.2 # in seconds + + ret.centerToFront = ret.wheelbase * 0.44 + + ret.longPidDeadzoneBP = [0., 9.] + ret.longPidDeadzoneV = [0., .15] + + ret.minSteerSpeed = 3.8 # m/s + ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this + if candidate in (CAR.PACIFICA_2019_HYBRID, CAR.JEEP_CHEROKEE_2019): + ret.minSteerSpeed = 17.5 # m/s 17 on the way up, 13 on the way down once engaged. + # TODO allow 2019 cars to steer down to 13 m/s if already engaged. + + centerToRear = ret.wheelbase - ret.centerToFront + # TODO: get actual value, for now starting with reasonable value for + # civic and scaling by mass and wheelbase + ret.rotationalInertia = rotationalInertia_civic * \ + ret.mass * ret.wheelbase**2 / (mass_civic * wheelbase_civic**2) + + # TODO: start from empirically derived lateral slip stiffness for the civic and scale by + # mass and CG position, so all cars will have approximately similar dyn behaviors + ret.tireStiffnessFront = tireStiffnessFront_civic * \ + ret.mass / mass_civic * \ + (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic) + ret.tireStiffnessRear = tireStiffnessRear_civic * \ + ret.mass / mass_civic * \ + (ret.centerToFront / ret.wheelbase) / (centerToFront_civic / wheelbase_civic) + + # no rear steering, at least on the listed cars above + ret.steerRatioRear = 0. + + # steer, gas, brake limitations VS speed + ret.steerMaxBP = [16. * CV.KPH_TO_MS, 45. * CV.KPH_TO_MS] # breakpoints at 1 and 40 kph + ret.steerMaxV = [1., 1.] # 2/3rd torque allowed above 45 kph + ret.gasMaxBP = [0.] + ret.gasMaxV = [0.5] + ret.brakeMaxBP = [5., 20.] + ret.brakeMaxV = [1., 0.8] + + ret.enableCamera = not check_ecu_msgs(fingerprint, ECU.CAM) + print "ECU Camera Simulated: ", ret.enableCamera + ret.openpilotLongitudinalControl = False + + ret.steerLimitAlert = True + ret.stoppingControl = False + ret.startAccel = 0.0 + + ret.longitudinalKpBP = [0., 5., 35.] + ret.longitudinalKpV = [3.6, 2.4, 1.5] + ret.longitudinalKiBP = [0., 35.] + ret.longitudinalKiV = [0.54, 0.36] + + return ret + + # returns a car.CarState + def update(self, c): + # ******************* do can recv ******************* + canMonoTimes = [] + self.cp.update(int(sec_since_boot() * 1e9), False) + self.cp_cam.update(int(sec_since_boot() * 1e9), False) + self.CS.update(self.cp, self.cp_cam) + + # create message + ret = car.CarState.new_message() + + # speeds + ret.vEgo = self.CS.v_ego + ret.vEgoRaw = self.CS.v_ego_raw + ret.aEgo = self.CS.a_ego + ret.yawRate = self.VM.yaw_rate(self.CS.angle_steers * CV.DEG_TO_RAD, self.CS.v_ego) + ret.standstill = self.CS.standstill + ret.wheelSpeeds.fl = self.CS.v_wheel_fl + ret.wheelSpeeds.fr = self.CS.v_wheel_fr + ret.wheelSpeeds.rl = self.CS.v_wheel_rl + ret.wheelSpeeds.rr = self.CS.v_wheel_rr + + # gear shifter + ret.gearShifter = self.CS.gear_shifter + + # gas pedal + ret.gas = self.CS.car_gas + ret.gasPressed = self.CS.pedal_gas > 0 + + # brake pedal + ret.brake = self.CS.user_brake + ret.brakePressed = self.CS.brake_pressed + ret.brakeLights = self.CS.brake_lights + + # steering wheel + ret.steeringAngle = self.CS.angle_steers + ret.steeringRate = self.CS.angle_steers_rate + + ret.steeringTorque = self.CS.steer_torque_driver + ret.steeringPressed = self.CS.steer_override + + # cruise state + ret.cruiseState.enabled = self.CS.pcm_acc_status # same as main_on + ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS + ret.cruiseState.available = self.CS.main_on + ret.cruiseState.speedOffset = 0. + # ignore standstill in hybrid rav4, since pcm allows to restart without + # receiving any special command + ret.cruiseState.standstill = False + + # TODO: button presses + buttonEvents = [] + + if self.CS.left_blinker_on != self.CS.prev_left_blinker_on: + be = car.CarState.ButtonEvent.new_message() + be.type = 'leftBlinker' + be.pressed = self.CS.left_blinker_on != 0 + buttonEvents.append(be) + + if self.CS.right_blinker_on != self.CS.prev_right_blinker_on: + be = car.CarState.ButtonEvent.new_message() + be.type = 'rightBlinker' + be.pressed = self.CS.right_blinker_on != 0 + buttonEvents.append(be) + + ret.buttonEvents = buttonEvents + ret.leftBlinker = bool(self.CS.left_blinker_on) + ret.rightBlinker = bool(self.CS.right_blinker_on) + + ret.doorOpen = not self.CS.door_all_closed + ret.seatbeltUnlatched = not self.CS.seatbelt + self.low_speed_alert = (ret.vEgo < self.CP.minSteerSpeed) + + ret.genericToggle = self.CS.generic_toggle + #ret.lkasCounter = self.CS.lkas_counter + #ret.lkasCarModel = self.CS.lkas_car_model + + # events + events = [] + if not self.CS.can_valid: + self.can_invalid_count += 1 + if self.can_invalid_count >= 5: + events.append(create_event('commIssue', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) + else: + self.can_invalid_count = 0 + if not (ret.gearShifter in ('drive', 'low')): + events.append(create_event('wrongGear', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if ret.doorOpen: + events.append(create_event('doorOpen', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if ret.seatbeltUnlatched: + events.append(create_event('seatbeltNotLatched', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if self.CS.esp_disabled: + events.append(create_event('espDisabled', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if not self.CS.main_on: + events.append(create_event('wrongCarMode', [ET.NO_ENTRY, ET.USER_DISABLE])) + if ret.gearShifter == 'reverse': + events.append(create_event('reverseGear', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) + if self.CS.steer_error: + events.append(create_event('steerUnavailable', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT])) + + if ret.cruiseState.enabled and not self.cruise_enabled_prev: + events.append(create_event('pcmEnable', [ET.ENABLE])) + elif not ret.cruiseState.enabled: + events.append(create_event('pcmDisable', [ET.USER_DISABLE])) + + # disable on gas pedal and speed isn't zero. Gas pedal is used to resume ACC + # from a 3+ second stop. + if (ret.gasPressed and (not self.gas_pressed_prev) and ret.vEgo > 2.0): + events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) + + if self.low_speed_alert: + events.append(create_event('belowSteerSpeed', [ET.WARNING])) + + ret.events = events + ret.canMonoTimes = canMonoTimes + + self.gas_pressed_prev = ret.gasPressed + self.brake_pressed_prev = ret.brakePressed + self.cruise_enabled_prev = ret.cruiseState.enabled + + return ret.as_reader() + + # pass in a car.CarControl + # to be called @ 100hz + def apply(self, c): + + if (self.CS.frame == -1): + return False # if we haven't seen a frame 220, then do not update. + + self.frame = self.CS.frame + self.CC.update(self.sendcan, c.enabled, self.CS, self.frame, + c.actuators, c.cruiseControl.cancel, c.hudControl.visualAlert, + c.hudControl.audibleAlert) + + return False diff --git a/selfdrive/car/chrysler/radar_interface.py b/selfdrive/car/chrysler/radar_interface.py new file mode 100755 index 00000000000000..60eaa4566a8819 --- /dev/null +++ b/selfdrive/car/chrysler/radar_interface.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +import os +from selfdrive.can.parser import CANParser +from cereal import car +from common.realtime import sec_since_boot +import zmq +from selfdrive.services import service_list +import selfdrive.messaging as messaging + + +RADAR_MSGS_C = range(0x2c2, 0x2d4+2, 2) # c_ messages 706,...,724 +RADAR_MSGS_D = range(0x2a2, 0x2b4+2, 2) # d_ messages +LAST_MSG = max(RADAR_MSGS_C + RADAR_MSGS_D) +NUMBER_MSGS = len(RADAR_MSGS_C) + len(RADAR_MSGS_D) + +def _create_radard_can_parser(): + dbc_f = 'chrysler_pacifica_2017_hybrid_private_fusion.dbc' + msg_n = len(RADAR_MSGS_C) + # list of [(signal name, message name or number, initial values), (...)] + # [('RADAR_STATE', 1024, 0), + # ('LONG_DIST', 1072, 255), + # ('LONG_DIST', 1073, 255), + # ('LONG_DIST', 1074, 255), + # ('LONG_DIST', 1075, 255), + + # The factor and offset are applied by the dbc parsing library, so the + # default values should be after the factor/offset are applied. + signals = zip(['LONG_DIST'] * msg_n + + ['LAT_DIST'] * msg_n + + ['REL_SPEED'] * msg_n, + RADAR_MSGS_C * 2 + # LONG_DIST, LAT_DIST + RADAR_MSGS_D, # REL_SPEED + [0] * msg_n + # LONG_DIST + [-1000] * msg_n + # LAT_DIST + [-146.278] * msg_n) # REL_SPEED set to 0, factor/offset to this + # TODO what are the checks actually used for? + # honda only checks the last message, + # toyota checks all the messages. Which do we want? + checks = zip(RADAR_MSGS_C + + RADAR_MSGS_D, + [20]*msg_n + # 20Hz (0.05s) + [20]*msg_n) # 20Hz (0.05s) + + return CANParser(os.path.splitext(dbc_f)[0], signals, checks, 1) + +def _address_to_track(address): + if address in RADAR_MSGS_C: + return (address - RADAR_MSGS_C[0]) / 2 + if address in RADAR_MSGS_D: + return (address - RADAR_MSGS_D[0]) / 2 + raise ValueError("radar received unexpected address %d" % address) + +class RadarInterface(object): + def __init__(self, CP): + self.pts = {} + self.delay = 0.0 # Delay of radar #TUNE + self.rcp = _create_radard_can_parser() + context = zmq.Context() + self.logcan = messaging.sub_sock(context, service_list['can'].port) + + def update(self): + canMonoTimes = [] + + updated_messages = set() # set of message IDs (sig_addresses) we've seen + + while 1: + tm = int(sec_since_boot() * 1e9) + updated_messages.update(self.rcp.update(tm, True)) + if LAST_MSG in updated_messages: + break + + ret = car.RadarState.new_message() + errors = [] + if not self.rcp.can_valid: + errors.append("commIssue") + ret.errors = errors + ret.canMonoTimes = canMonoTimes + + for ii in updated_messages: # ii should be the message ID as a number + cpt = self.rcp.vl[ii] + trackId = _address_to_track(ii) + + if trackId not in self.pts: + self.pts[trackId] = car.RadarState.RadarPoint.new_message() + self.pts[trackId].trackId = trackId + self.pts[trackId].aRel = float('nan') + self.pts[trackId].yvRel = float('nan') + self.pts[trackId].measured = True + + if 'LONG_DIST' in cpt: # c_* message + self.pts[trackId].dRel = cpt['LONG_DIST'] # from front of car + # our lat_dist is positive to the right in car's frame. + # TODO what does yRel want? + self.pts[trackId].yRel = cpt['LAT_DIST'] # in car frame's y axis, left is positive + else: # d_* message + self.pts[trackId].vRel = cpt['REL_SPEED'] + + # We want a list, not a dictionary. Filter out LONG_DIST==0 because that means it's not valid. + ret.points = [x for x in self.pts.values() if x.dRel != 0] + return ret + +if __name__ == "__main__": + RI = RadarInterface(None) + while 1: + ret = RI.update() + print(chr(27) + "[2J") # clear screen + print ret diff --git a/selfdrive/car/chrysler/run_tests.sh b/selfdrive/car/chrysler/run_tests.sh new file mode 100755 index 00000000000000..1dcc8b2acf0bbf --- /dev/null +++ b/selfdrive/car/chrysler/run_tests.sh @@ -0,0 +1 @@ +PYTHONPATH=`realpath ../../../` python chryslercan_test.py diff --git a/selfdrive/car/chrysler/values.py b/selfdrive/car/chrysler/values.py new file mode 100644 index 00000000000000..4636b89a31ec24 --- /dev/null +++ b/selfdrive/car/chrysler/values.py @@ -0,0 +1,88 @@ +from selfdrive.car import dbc_dict + +class CAR: + PACIFICA_2017_HYBRID = "CHRYSLER PACIFICA HYBRID 2017" + PACIFICA_2018_HYBRID = "CHRYSLER PACIFICA HYBRID 2018" + PACIFICA_2019_HYBRID = "CHRYSLER PACIFICA HYBRID 2019" + PACIFICA_2018 = "CHRYSLER PACIFICA 2018" + JEEP_CHEROKEE = "JEEP GRAND CHEROKEE V6 2018" # Also covers Tailhawk 2017. + JEEP_CHEROKEE_2019 = "JEEP GRAND CHEROKEE 2019" + +# Unique can messages: +# Only the hybrids have 270: 8 +# Only the gas have 55: 8, 416: 7 +# For 564, All 2017 have length 4, whereas 2018-19 have length 8. +# For 924, Pacifica 2017 has length 3, whereas all 2018-19 have length 8. +# For 560, All 2019 have length 8, whereas all 2017-18 have length 4. + +# Jeep Grand Cherokee unique messages: +# 2017 Trailhawk: 618: 8 +# For 924, Trailhawk 2017 has length 3, whereas 2018 V6 has length 8. + +FINGERPRINTS = { + CAR.PACIFICA_2017_HYBRID: [ + {168: 8, 257: 5, 258: 8, 264: 8, 268: 8, 270: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 291: 8, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 515: 7, 516: 7, 517: 7, 518: 7, 520: 8, 528: 8, 532: 8, 542: 8, 544: 8, 557: 8, 559: 8, 560: 4, 564: 4, 571: 3, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 653: 8, 654: 8, 655: 8, 658: 6, 660: 8, 669: 3, 671: 8, 672: 8, 678: 8, 680: 8, 701: 8, 704: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 746: 5, 760: 8, 764: 8, 766: 8, 770: 8, 773: 8, 779: 8, 782: 8, 784: 8, 792: 8, 799: 8, 800: 8, 804: 8, 808: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 878: 8, 882: 8, 897: 8, 908: 8, 924: 3, 926: 3, 929: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 956: 8, 958: 8, 959: 8, 969: 4, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1082: 8, 1083: 8, 1098: 8, 1100: 8, 1216: 8, 1218: 8, 1220: 8, 1225: 8, 1235: 8, 1242: 8, 1246: 8, 1250: 8, 1284: 8, 1537: 8, 1538: 8, 1562: 8, 1568: 8, 1856: 8, 1858: 8, 1860: 8, 1865: 8, 1875: 8, 1882: 8, 1886: 8, 1890: 8, 1892: 8, 2016: 8, 2024: 8}, + ], + CAR.PACIFICA_2018: [ + {55: 8, 257: 5, 258: 8, 264: 8, 268: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 416: 7, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 528: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 4, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 658: 6, 660: 8, 669: 3, 671: 8, 672: 8, 678: 8, 680: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 746: 5, 752: 2, 760: 8, 764: 8, 766: 8, 770: 8, 773: 8, 779: 8, 784: 8, 792: 8, 799: 8, 800: 8, 804: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 882: 8, 897: 8, 924: 8, 926: 3, 937: 8, 947: 8, 948: 8, 969: 4, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1098: 8, 1100: 8}, + ], + CAR.PACIFICA_2018_HYBRID: [ + {68: 8, 168: 8, 257: 5, 258: 8, 264: 8, 268: 8, 270: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 291: 8, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 528: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 4, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 653: 8, 654: 8, 655: 8, 660: 8, 669: 3, 671: 8, 672: 8, 680: 8, 701: 8, 704: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 736: 8, 737: 8, 746: 5, 760: 8, 764: 8, 766: 8, 770: 8, 773: 8, 779: 8, 782: 8, 784: 8, 792: 8, 799: 8, 800: 8, 804: 8, 808: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 878: 8, 882: 8, 897: 8, 908: 8, 924: 8, 926: 3, 929: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 958: 8, 959: 8, 969: 4, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1082: 8, 1083: 8, 1098: 8, 1100: 8}, + ], + CAR.PACIFICA_2019_HYBRID: [ + {168: 8, 257: 5, 258: 8, 264: 8, 268: 8, 270: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 291: 8, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 515: 7, 516: 7, 517: 7, 518: 7, 520: 8, 528: 8, 532: 8, 542: 8, 544: 8, 557: 8, 559: 8, 560: 8, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 653: 8, 654: 8, 655: 8, 660: 8, 669: 3, 671: 8, 672: 8, 680: 8, 701: 8, 703: 8, 704: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 736: 8, 737: 8, 746: 5, 752: 2, 754: 8, 760: 8, 764: 8, 766: 8, 770:8, 773: 8, 779: 8, 782: 8, 784: 8, 792: 8, 799: 8, 800: 8, 804: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 878: 8, 882: 8, 897: 8, 906: 8, 908: 8, 924: 8, 926: 3, 929: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 958: 8, 959: 8, 962: 8, 969: 4, 973: 8, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1082: 8, 1083: 8, 1098: 8, 1100: 8, 1538: 8}, + # Based on 0607d2516fc2148f|2019-02-13--23-03-16 + { + 168: 8, 257: 5, 258: 8, 264: 8, 268: 8, 270: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 291: 8, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 528: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 8, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 653: 8, 654: 8, 655: 8, 658: 6, 660: 8, 669: 3, 671: 8, 672: 8, 678: 8, 680: 8, 701: 8, 703: 8, 704: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 746: 5, 752: 2, 754: 8, 760: 8, 764: 8, 766: 8, 770: 8, 773: 8, 779: 8, 782: 8, 784: 8, 792: 8, 799: 8, 800: 8, 804: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 878: 8, 882: 8, 897: 8, 906: 8, 908: 8, 924: 8, 926: 3, 929: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 958: 8, 959: 8, 962: 8, 969: 4, 973: 8, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1082: 8, 1083: 8, 1098: 8, 1100: 8, 1537: 8 + } + ], + CAR.JEEP_CHEROKEE: [ + # JEEP GRAND CHEROKEE V6 2018 + {55: 8, 168: 8, 181: 8, 256: 4, 257: 5, 258: 8, 264: 8, 268: 8, 272: 6, 273: 6, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 292: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 352: 8, 362: 8, 368: 8, 376: 3, 384: 8, 388: 4, 416: 7, 448: 6, 456: 4, 464: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 4, 564: 4, 571: 3, 579: 8, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 656: 4, 658: 6, 660: 8, 671: 8, 672: 8, 676: 8, 678: 8, 680: 8, 683: 8, 684: 8, 703: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 738: 8, 746: 5, 752: 2, 754: 8, 760: 8, 761: 8, 764: 8, 766: 8, 773: 8, 776: 8, 779: 8, 782: 8, 783: 8, 784: 8, 785: 8, 788: 3, 792: 8, 799: 8, 800: 8, 804: 8, 806: 2, 808: 8, 810: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 831: 6, 832: 8, 838: 2, 844: 5, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 882: 8, 897: 8, 906: 8, 924: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 968: 8, 969: 4, 970: 8, 973: 8, 974: 5, 976: 8, 977: 4, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1062: 8, 1098: 8, 1100: 8}, + # Jeep Grand Cherokee 2017 Trailhawk + {257: 5, 258: 8, 264: 8, 268: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 292: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 352: 8, 362: 8, 368: 8, 376: 3, 384: 8, 388: 4, 416: 7, 448: 6, 456: 4, 464: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 4, 564: 4, 571: 3, 584: 8, 608: 8, 618: 8, 624: 8, 625: 8, 632: 8, 639: 8, 660: 8, 671: 8, 672: 8, 680: 8, 684: 8, 703: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 736: 8, 737: 8, 746: 5, 752: 2, 760: 8, 761: 8, 764: 8, 766: 8, 773: 8, 776: 8, 779: 8, 783: 8, 784: 8, 792: 8, 799: 8, 800: 8, 804: 8, 806: 2, 808: 8, 810: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 831: 6, 832: 8, 838: 2, 844: 5, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 882: 8, 897: 8, 924: 3, 937: 8, 947: 8, 948: 8, 969: 4, 974: 5, 977: 4, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1062: 8, 1098: 8, 1100: 8}, + ], + CAR.JEEP_CHEROKEE_2019: [ + # Jeep Grand Cherokee 2019 from Switzerland + # 530: 8 is so far only in this Jeep. + {55: 8, 181: 8, 256: 4, 257: 5, 258: 8, 264: 8, 268: 8, 272: 6, 273: 6, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 292: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 352: 8, 362: 8, 368: 8, 376: 3, 384: 8, 388: 4, 416: 7, 448: 6, 456: 4, 464: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 530: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 8, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 618: 8, 624: 8, 625: 8, 632: 8, 639: 8, 660: 8, 671: 8, 672: 8, 676: 8, 680: 8, 683: 8, 684: 8, 703: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 736: 8, 737: 8, 738: 8, 746: 5, 752: 2, 754: 8, 760: 8, 761: 8, 764: 8, 773: 8, 776: 8, 779: 8, 782: 8, 783: 8, 784: 8, 792: 8, 799: 8, 804: 8, 806: 2, 808: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 831: 6, 832: 8, 838: 2, 844: 5, 848: 8, 853: 8, 856: 4, 860: 6, 882: 8, 897: 8, 906: 8, 924: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 968: 8, 969: 4, 970: 8, 973: 8, 974: 5, 977: 4, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1062: 8, 1098: 8, 1100: 8}, + ], +} + + +DBC = { + CAR.PACIFICA_2017_HYBRID: dbc_dict( + 'chrysler_pacifica_2017_hybrid', # 'pt' + 'chrysler_pacifica_2017_hybrid_private_fusion'), # 'radar' + CAR.PACIFICA_2018: dbc_dict( # Same DBC file works. + 'chrysler_pacifica_2017_hybrid', # 'pt' + 'chrysler_pacifica_2017_hybrid_private_fusion'), # 'radar' + CAR.PACIFICA_2018_HYBRID: dbc_dict( # Same DBC file works. + 'chrysler_pacifica_2017_hybrid', # 'pt' + 'chrysler_pacifica_2017_hybrid_private_fusion'), # 'radar' + CAR.PACIFICA_2019_HYBRID: dbc_dict( # Same DBC file works. + 'chrysler_pacifica_2017_hybrid', # 'pt' + 'chrysler_pacifica_2017_hybrid_private_fusion'), # 'radar' + CAR.JEEP_CHEROKEE: dbc_dict( # Same DBC file works. + 'chrysler_pacifica_2017_hybrid', # 'pt' + 'chrysler_pacifica_2017_hybrid_private_fusion'), # 'radar' + CAR.JEEP_CHEROKEE_2019: dbc_dict( # Same DBC file works. + 'chrysler_pacifica_2017_hybrid', # 'pt' + 'chrysler_pacifica_2017_hybrid_private_fusion'), # 'radar' +} + +STEER_THRESHOLD = 120 + + +class ECU: + CAM = 0 # LKAS camera + + +ECU_FINGERPRINT = { + ECU.CAM: 0x2d9, # steer torque cmd +} + + +def check_ecu_msgs(fingerprint, ecu): + # return True if fingerprint contains messages normally sent by a given ecu + return ECU_FINGERPRINT[ecu] in fingerprint diff --git a/selfdrive/car/ford/carstate.py b/selfdrive/car/ford/carstate.py index 4626d28f4ad9ac..5a8f1f142c5d34 100644 --- a/selfdrive/car/ford/carstate.py +++ b/selfdrive/car/ford/carstate.py @@ -6,21 +6,6 @@ WHEEL_RADIUS = 0.33 -def parse_gear_shifter(can_gear, car_fingerprint): - # TODO: Use values from DBC to parse this field - if can_gear == 0x0: - return "park" - elif can_gear == 0x1: - return "reverse" - elif can_gear == 0x2: - return "neutral" - elif can_gear == 0x3: - return "drive" - elif can_gear == 0x4: - return "brake" - return "unknown" - - def get_can_parser(CP): signals = [ @@ -80,17 +65,17 @@ def update(self, cp): self.v_wheel_fr = cp.vl["WheelSpeed_CG1"]['WhlRl_W_Meas'] * WHEEL_RADIUS self.v_wheel_rl = cp.vl["WheelSpeed_CG1"]['WhlFr_W_Meas'] * WHEEL_RADIUS self.v_wheel_rr = cp.vl["WheelSpeed_CG1"]['WhlFl_W_Meas'] * WHEEL_RADIUS - self.v_wheel = float(np.mean([self.v_wheel_fl, self.v_wheel_fr, self.v_wheel_rl, self.v_wheel_rr])) + v_wheel = float(np.mean([self.v_wheel_fl, self.v_wheel_fr, self.v_wheel_rl, self.v_wheel_rr])) # Kalman filter - if abs(self.v_wheel - self.v_ego) > 2.0: # Prevent large accelerations when car starts at non zero speed - self.v_ego_x = np.matrix([[self.v_wheel], [0.0]]) + if abs(v_wheel - self.v_ego) > 2.0: # Prevent large accelerations when car starts at non zero speed + self.v_ego_kf.x = np.matrix([[v_wheel], [0.0]]) - self.v_ego_raw = self.v_wheel - v_ego_x = self.v_ego_kf.update(self.v_wheel) + self.v_ego_raw = v_wheel + v_ego_x = self.v_ego_kf.update(v_wheel) self.v_ego = float(v_ego_x[0]) self.a_ego = float(v_ego_x[1]) - self.standstill = not self.v_wheel > 0.001 + self.standstill = not v_wheel > 0.001 self.angle_steers = cp.vl["Steering_Wheel_Data_CG1"]['SteWhlRelInit_An_Sns'] self.v_cruise_pcm = cp.vl["Cruise_Status"]['Set_Speed'] * CV.MPH_TO_MS diff --git a/selfdrive/car/ford/interface.py b/selfdrive/car/ford/interface.py index 6a64183425e0ea..0e29ea62620814 100755 --- a/selfdrive/car/ford/interface.py +++ b/selfdrive/car/ford/interface.py @@ -119,6 +119,7 @@ def get_params(candidate, fingerprint): ret.brakeMaxV = [1., 0.8] ret.enableCamera = not any(x for x in [970, 973, 984] if x in fingerprint) + ret.openpilotLongitudinalControl = False cloudlog.warn("ECU Camera Simulated: %r", ret.enableCamera) ret.steerLimitAlert = False diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index d3c8ee1967308d..b242bc57b7914f 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -1,31 +1,38 @@ -from common.numpy_fast import clip, interp +from common.numpy_fast import interp from common.realtime import sec_since_boot from selfdrive.config import Conversions as CV from selfdrive.boardd.boardd import can_list_to_can_capnp +from selfdrive.car import apply_std_steer_torque_limits from selfdrive.car.gm import gmcan -from selfdrive.car.gm.values import CAR, DBC +from selfdrive.car.gm.values import DBC, SUPERCRUISE_CARS from selfdrive.can.packer import CANPacker class CarControllerParams(): def __init__(self, car_fingerprint): - if car_fingerprint == CAR.VOLT: - self.STEER_MAX = 255 - self.STEER_STEP = 2 # how often we update the steer cmd - self.STEER_DELTA_UP = 7 # ~0.75s time to peak torque (255/50hz/0.75s) - self.STEER_DELTA_DOWN = 17 # ~0.3s from peak torque to zero - elif car_fingerprint == CAR.CADILLAC_CT6: + if car_fingerprint in SUPERCRUISE_CARS: self.STEER_MAX = 150 self.STEER_STEP = 1 # how often we update the steer cmd self.STEER_DELTA_UP = 2 # 0.75s time to peak torque self.STEER_DELTA_DOWN = 5 # 0.3s from peak torque to zero + self.MIN_STEER_SPEED = -1. # can steer down to zero + else: + self.STEER_MAX = 300 + self.STEER_STEP = 2 # how often we update the steer cmd + self.STEER_DELTA_UP = 7 # ~0.75s time to peak torque (255/50hz/0.75s) + self.STEER_DELTA_DOWN = 17 # ~0.3s from peak torque to zero + self.MIN_STEER_SPEED = 3. self.STEER_DRIVER_ALLOWANCE = 50 # allowed driver torque before start limiting self.STEER_DRIVER_MULTIPLIER = 4 # weight driver torque heavily self.STEER_DRIVER_FACTOR = 100 # from dbc self.NEAR_STOP_BRAKE_PHASE = 0.5 # m/s, more aggressive braking near full stop - self.ADAS_KEEPALIVE_STEP = 10 + # Takes case of "Service Adaptive Cruise" and "Service Front Camera" + # dashboard messages. + self.ADAS_KEEPALIVE_STEP = 100 + self.CAMERA_KEEPALIVE_STEP = 100 + # pedal lookups, only for Volt MAX_GAS = 3072 # Only a safety limit ZERO_GAS = 2048 @@ -54,15 +61,15 @@ def actuator_hystereses(final_pedal, pedal_steady): class CarController(object): - def __init__(self, canbus, car_fingerprint): + def __init__(self, canbus, car_fingerprint, allow_controls): self.pedal_steady = 0. self.start_time = sec_since_boot() self.chime = 0 - self.lkas_active = False - self.inhibit_steer_for = 0 self.steer_idx = 0 self.apply_steer_last = 0 self.car_fingerprint = car_fingerprint + self.allow_controls = allow_controls + self.lka_icon_status_last = (False, False) # Setup detection helper. Routes commands to # an appropriate CAN bus number. @@ -76,6 +83,10 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ hud_v_cruise, hud_show_lanes, hud_show_car, chime, chime_cnt): """ Controls thread """ + # Sanity check. + if not self.allow_controls: + return + P = self.params # Send CAN commands. @@ -85,45 +96,28 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ ### STEER ### if (frame % P.STEER_STEP) == 0: - final_steer = actuators.steer if enabled else 0. - apply_steer = final_steer * P.STEER_MAX - - # limits due to driver torque - driver_max_torque = P.STEER_MAX + (P.STEER_DRIVER_ALLOWANCE + CS.steer_torque_driver * P.STEER_DRIVER_FACTOR) * P.STEER_DRIVER_MULTIPLIER - driver_min_torque = -P.STEER_MAX + (-P.STEER_DRIVER_ALLOWANCE + CS.steer_torque_driver * P.STEER_DRIVER_FACTOR) * P.STEER_DRIVER_MULTIPLIER - max_steer_allowed = max(min(P.STEER_MAX, driver_max_torque), 0) - min_steer_allowed = min(max(-P.STEER_MAX, driver_min_torque), 0) - apply_steer = clip(apply_steer, min_steer_allowed, max_steer_allowed) - - # slow rate if steer torque increases in magnitude - if self.apply_steer_last > 0: - apply_steer = clip(apply_steer, max(self.apply_steer_last - P.STEER_DELTA_DOWN, -P.STEER_DELTA_UP), - self.apply_steer_last + P.STEER_DELTA_UP) + lkas_enabled = enabled and not CS.steer_not_allowed and CS.v_ego > P.MIN_STEER_SPEED + if lkas_enabled: + apply_steer = actuators.steer * P.STEER_MAX + apply_steer = apply_std_steer_torque_limits(apply_steer, self.apply_steer_last, CS.steer_torque_driver, P) else: - apply_steer = clip(apply_steer, self.apply_steer_last - P.STEER_DELTA_UP, - min(self.apply_steer_last + P.STEER_DELTA_DOWN, P.STEER_DELTA_UP)) - - lkas_enabled = enabled and not CS.steer_not_allowed and CS.v_ego > 3. - - if not lkas_enabled: apply_steer = 0 - apply_steer = int(round(apply_steer)) self.apply_steer_last = apply_steer idx = (frame / P.STEER_STEP) % 4 - if self.car_fingerprint == CAR.VOLT: + if self.car_fingerprint in SUPERCRUISE_CARS: + can_sends += gmcan.create_steering_control_ct6(self.packer_pt, + canbus, apply_steer, CS.v_ego, idx, lkas_enabled) + else: can_sends.append(gmcan.create_steering_control(self.packer_pt, canbus.powertrain, apply_steer, idx, lkas_enabled)) - if self.car_fingerprint == CAR.CADILLAC_CT6: - can_sends += gmcan.create_steering_control_ct6(self.packer_pt, - canbus, apply_steer, CS.v_ego, idx, lkas_enabled) ### GAS/BRAKE ### - if self.car_fingerprint == CAR.VOLT: + if self.car_fingerprint not in SUPERCRUISE_CARS: # no output if not enabled, but keep sending keepalive messages - # threat pedals as one + # treat pedals as one final_pedal = actuators.gas - actuators.brake # *** apply pedal hysteresis *** @@ -131,7 +125,8 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ final_pedal, self.pedal_steady) if not enabled: - apply_gas = P.MAX_ACC_REGEN # TODO: do we really need to send max regen when not enabled? + # Stock ECU sends max regen when not enabled. + apply_gas = P.MAX_ACC_REGEN apply_brake = 0 else: apply_gas = int(round(interp(final_pedal, P.GAS_LOOKUP_BP, P.GAS_LOOKUP_V))) @@ -150,7 +145,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # Send dashboard UI commands (ACC status), 25hz if (frame % 4) == 0: - can_sends.append(gmcan.create_acc_dashboard_command(canbus.powertrain, enabled, hud_v_cruise / CV.MS_TO_KPH, hud_show_car)) + can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, canbus.powertrain, enabled, hud_v_cruise * CV.MS_TO_KPH, hud_show_car)) # Radar needs to know current speed and yaw rate (50hz), # and that ADAS is alive (10hz) @@ -168,10 +163,21 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ can_sends.append(gmcan.create_adas_steering_status(canbus.obstacle, idx)) can_sends.append(gmcan.create_adas_accelerometer_speed_status(canbus.obstacle, CS.v_ego, idx)) - # Send ADAS keepalive, 10hz if frame % P.ADAS_KEEPALIVE_STEP == 0: can_sends += gmcan.create_adas_keepalive(canbus.powertrain) + # Show green icon when LKA torque is applied, and + # alarming orange icon when approaching torque limit. + # If not sent again, LKA icon disappears in about 5 seconds. + # Conveniently, sending camera message periodically also works as a keepalive. + lka_active = CS.lkas_status == 1 + lka_critical = lka_active and abs(actuators.steer) > 0.9 + lka_icon_status = (lka_active, lka_critical) + if frame % P.CAMERA_KEEPALIVE_STEP == 0 \ + or lka_icon_status != self.lka_icon_status_last: + can_sends.append(gmcan.create_lka_icon_command(canbus.sw_gmlan, lka_active, lka_critical)) + self.lka_icon_status_last = lka_icon_status + # Send chimes if self.chime != chime: duration = 0x3c diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index 59b6e35c748312..ae97a38b9ceede 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -4,7 +4,8 @@ from selfdrive.config import Conversions as CV from selfdrive.can.parser import CANParser from selfdrive.car.gm.values import DBC, CAR, parse_gear_shifter, \ - CruiseButtons, is_eps_status_ok + CruiseButtons, is_eps_status_ok, \ + STEER_THRESHOLD, SUPERCRUISE_CARS def get_powertrain_can_parser(CP, canbus): # this function generates lists for signal, messages and initial values @@ -33,20 +34,24 @@ def get_powertrain_can_parser(CP, canbus): if CP.carFingerprint == CAR.VOLT: signals += [ ("RegenPaddle", "EBCMRegenPaddle", 0), + ] + if CP.carFingerprint in SUPERCRUISE_CARS: + signals += [ + ("ACCCmdActive", "ASCMActiveCruiseControlStatus", 0) + ] + else: + signals += [ ("TractionControlOn", "ESPStatus", 0), ("EPBClosed", "EPBStatus", 0), ("CruiseMainOn", "ECMEngineStatus", 0), ("CruiseState", "AcceleratorPedal2", 0), ] - elif CP.carFingerprint == CAR.CADILLAC_CT6: - signals += [ - ("ACCCmdActive", "ASCMActiveCruiseControlStatus", 0) - ] return CANParser(DBC[CP.carFingerprint]['pt'], signals, [], canbus.powertrain) class CarState(object): def __init__(self, CP, canbus): + self.CP = CP # initialize can parser self.car_fingerprint = CP.carFingerprint @@ -74,10 +79,13 @@ def update(self, pt_cp): self.v_wheel_fr = pt_cp.vl["EBCMWheelSpdFront"]['FRWheelSpd'] * CV.KPH_TO_MS self.v_wheel_rl = pt_cp.vl["EBCMWheelSpdRear"]['RLWheelSpd'] * CV.KPH_TO_MS self.v_wheel_rr = pt_cp.vl["EBCMWheelSpdRear"]['RRWheelSpd'] * CV.KPH_TO_MS - speed_estimate = float(np.mean([self.v_wheel_fl, self.v_wheel_fr, self.v_wheel_rl, self.v_wheel_rr])) + v_wheel = float(np.mean([self.v_wheel_fl, self.v_wheel_fr, self.v_wheel_rl, self.v_wheel_rr])) - self.v_ego_raw = speed_estimate - v_ego_x = self.v_ego_kf.update(speed_estimate) + if abs(v_wheel - self.v_ego) > 2.0: # Prevent large accelerations when car starts at non zero speed + self.v_ego_kf.x = [[v_wheel], [0.0]] + + self.v_ego_raw = v_wheel + v_ego_x = self.v_ego_kf.update(v_wheel) self.v_ego = float(v_ego_x[0]) self.a_ego = float(v_ego_x[1]) @@ -91,7 +99,7 @@ def update(self, pt_cp): self.user_gas_pressed = self.pedal_gas > 0 self.steer_torque_driver = pt_cp.vl["PSCMStatus"]['LKADriverAppldTrq'] - self.steer_override = abs(self.steer_torque_driver) > 1.0 + self.steer_override = abs(self.steer_torque_driver) > STEER_THRESHOLD # 0 - inactive, 1 - active, 2 - temporary limited, 3 - failed self.lkas_status = pt_cp.vl["PSCMStatus"]['LKATorqueDeliveredStatus'] @@ -116,20 +124,23 @@ def update(self, pt_cp): self.left_blinker_on = pt_cp.vl["BCMTurnSignals"]['TurnSignals'] == 1 self.right_blinker_on = pt_cp.vl["BCMTurnSignals"]['TurnSignals'] == 2 - if self.car_fingerprint == CAR.VOLT: - self.park_brake = pt_cp.vl["EPBStatus"]['EPBClosed'] - self.main_on = pt_cp.vl["ECMEngineStatus"]['CruiseMainOn'] - self.acc_active = False - self.esp_disabled = pt_cp.vl["ESPStatus"]['TractionControlOn'] != 1 - self.regen_pressed = bool(pt_cp.vl["EBCMRegenPaddle"]['RegenPaddle']) - self.pcm_acc_status = pt_cp.vl["AcceleratorPedal2"]['CruiseState'] - else: + if self.car_fingerprint in SUPERCRUISE_CARS: self.park_brake = False self.main_on = False self.acc_active = pt_cp.vl["ASCMActiveCruiseControlStatus"]['ACCCmdActive'] self.esp_disabled = False self.regen_pressed = False self.pcm_acc_status = int(self.acc_active) + else: + self.park_brake = pt_cp.vl["EPBStatus"]['EPBClosed'] + self.main_on = pt_cp.vl["ECMEngineStatus"]['CruiseMainOn'] + self.acc_active = False + self.esp_disabled = pt_cp.vl["ESPStatus"]['TractionControlOn'] != 1 + self.pcm_acc_status = pt_cp.vl["AcceleratorPedal2"]['CruiseState'] + if self.car_fingerprint == CAR.VOLT: + self.regen_pressed = bool(pt_cp.vl["EBCMRegenPaddle"]['RegenPaddle']) + else: + self.regen_pressed = False # Brake pedal's potentiometer returns near-zero reading # even when pedal is not pressed. @@ -140,4 +151,3 @@ def update(self, pt_cp): self.brake_pressed = self.user_brake > 10 or self.regen_pressed self.gear_shifter_valid = self.gear_shifter == car.CarState.GearShifter.drive - diff --git a/selfdrive/car/gm/gmcan.py b/selfdrive/car/gm/gmcan.py index 0c84df422f9031..910cb1d95604ce 100644 --- a/selfdrive/car/gm/gmcan.py +++ b/selfdrive/car/gm/gmcan.py @@ -84,14 +84,21 @@ def create_friction_brake_command(packer, bus, apply_brake, idx, near_stop, at_f return packer.make_can_msg("EBCMFrictionBrakeCmd", bus, values) -def create_acc_dashboard_command(bus, acc_engaged, target_speed_ms, lead_car_in_sight): - engaged = 0x90 if acc_engaged else 0 - lead_car = 0x10 if lead_car_in_sight else 0 - target_speed = int(target_speed_ms * 208) & 0xfff - speed_high = target_speed >> 8 - speed_low = target_speed & 0xff - dat = [0x01, 0x00, engaged | speed_high, speed_low, 0x01, lead_car] - return [0x370, 0, "".join(map(chr, dat)), bus] +def create_acc_dashboard_command(packer, bus, acc_engaged, target_speed_kph, lead_car_in_sight): + # Not a bit shift, dash can round up based on low 4 bits. + target_speed = int(target_speed_kph * 16) & 0xfff + + values = { + "ACCAlwaysOne" : 1, + "ACCResumeButton" : 0, + "ACCSpeedSetpoint" : target_speed, + "ACCGapLevel" : 3 * acc_engaged, # 3 "far", 0 "inactive" + "ACCCmdActive" : acc_engaged, + "ACCAlwaysOne2" : 1, + "ACCLeadCar" : lead_car_in_sight + } + + return packer.make_can_msg("ASCMActiveCruiseControlStatus", bus, values) def create_adas_time_status(bus, tt, idx): dat = [(tt >> 20) & 0xff, (tt >> 12) & 0xff, (tt >> 4) & 0xff, @@ -127,6 +134,16 @@ def create_chime_command(bus, chime_type, duration, repeat_cnt): dat = [chime_type, duration, repeat_cnt, 0xff, 0] return [0x10400060, 0, "".join(map(chr, dat)), bus] +def create_lka_icon_command(bus, active, critical): + if active: + if critical: + dat = "\x40\xc0\x14" + else: + dat = "\x40\x40\x18" + else: + dat = "\x00\x00\x00" + return [0x104c006c, 0, dat, bus] + # TODO: WIP ''' def create_friction_brake_command_ct6(packer, bus, apply_brake, idx, near_stop, at_full_stop): diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 53dc8b68e78ee9..83e90c3c7d7fcb 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -4,7 +4,7 @@ from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET from selfdrive.controls.lib.vehicle_model import VehicleModel -from selfdrive.car.gm.values import DBC, CAR +from selfdrive.car.gm.values import DBC, CAR, STOCK_CONTROL_MSGS, AUDIO_HUD, SUPERCRUISE_CARS from selfdrive.car.gm.carstate import CarState, CruiseButtons, get_powertrain_can_parser try: @@ -12,21 +12,6 @@ except ImportError: CarController = None -# Car chimes, beeps, blinker sounds etc -class CM: - TOCK = 0x81 - TICK = 0x82 - LOW_BEEP = 0x84 - HIGH_BEEP = 0x85 - LOW_CHIME = 0x86 - HIGH_CHIME = 0x87 - -# GM cars have 4 CAN buses, which creates many ways -# of how the car can be connected to. -# This ia a helper class for the interface to be setup-agnostic. -# Supports single Panda setup (connected to OBDII port), -# and a CAN forwarding setup (connected to camera module connector). - class CanBus(object): def __init__(self): self.powertrain = 0 @@ -54,7 +39,7 @@ def __init__(self, CP, sendcan=None): # sending if read only is False if sendcan is not None: self.sendcan = sendcan - self.CC = CarController(canbus, CP.carFingerprint) + self.CC = CarController(canbus, CP.carFingerprint, CP.enableCamera) @staticmethod def compute_gb(accel, speed): @@ -73,14 +58,18 @@ def get_params(candidate, fingerprint): ret.enableCruise = False - # TODO: gate this on detection - ret.enableCamera = True + # Presence of a camera on the object bus is ok. + # Have to go passive if ASCM is online (ACC-enabled cars), + # or camera is on powertrain bus (LKA cars without ACC). + ret.enableCamera = not any(x for x in STOCK_CONTROL_MSGS[candidate] if x in fingerprint) + ret.openpilotLongitudinalControl = ret.enableCamera + std_cargo = 136 if candidate == CAR.VOLT: # supports stop and go, but initial engage must be above 18mph (which include conservatism) ret.minEnableSpeed = 18 * CV.MPH_TO_MS - # kg of standard extra cargo to count for drive, gas, etc... + # kg of standard extra cargo to count for driver, gas, etc... ret.mass = 1607 + std_cargo ret.safetyModel = car.CarParams.SafetyModels.gm ret.wheelbase = 2.69 @@ -88,10 +77,58 @@ def get_params(candidate, fingerprint): ret.steerRatioRear = 0. ret.centerToFront = ret.wheelbase * 0.4 # wild guess + elif candidate == CAR.MALIBU: + # supports stop and go, but initial engage must be above 18mph (which include conservatism) + ret.minEnableSpeed = 18 * CV.MPH_TO_MS + ret.mass = 1496 + std_cargo + ret.safetyModel = car.CarParams.SafetyModels.gm + ret.wheelbase = 2.83 + ret.steerRatio = 15.8 + ret.steerRatioRear = 0. + ret.centerToFront = ret.wheelbase * 0.4 # wild guess + + elif candidate == CAR.HOLDEN_ASTRA: + # kg of standard extra cargo to count for driver, gas, etc... + ret.mass = 1363 + std_cargo + ret.wheelbase = 2.662 + # Remaining parameters copied from Volt for now + ret.centerToFront = ret.wheelbase * 0.4 + ret.minEnableSpeed = 18 * CV.MPH_TO_MS + ret.safetyModel = car.CarParams.SafetyModels.gm + ret.steerRatio = 15.7 + ret.steerRatioRear = 0. + + elif candidate == CAR.ACADIA: + ret.minEnableSpeed = -1 # engage speed is decided by pcm + ret.mass = 4353. * CV.LB_TO_KG + std_cargo + ret.safetyModel = car.CarParams.SafetyModels.gm + ret.wheelbase = 2.86 + ret.steerRatio = 14.4 #end to end is 13.46 + ret.steerRatioRear = 0. + ret.centerToFront = ret.wheelbase * 0.4 + + elif candidate == CAR.BUICK_REGAL: + ret.minEnableSpeed = 18 * CV.MPH_TO_MS + ret.mass = 3779. * CV.LB_TO_KG + std_cargo # (3849+3708)/2 + ret.safetyModel = car.CarParams.SafetyModels.gm + ret.wheelbase = 2.83 #111.4 inches in meters + ret.steerRatio = 14.4 # guess for tourx + ret.steerRatioRear = 0. + ret.centerToFront = ret.wheelbase * 0.4 # guess for tourx + + elif candidate == CAR.CADILLAC_ATS: + ret.minEnableSpeed = 18 * CV.MPH_TO_MS + ret.mass = 1601 + std_cargo + ret.safetyModel = car.CarParams.SafetyModels.gm + ret.wheelbase = 2.78 + ret.steerRatio = 15.3 + ret.steerRatioRear = 0. + ret.centerToFront = ret.wheelbase * 0.49 + elif candidate == CAR.CADILLAC_CT6: # engage speed is decided by pcm ret.minEnableSpeed = -1 - # kg of standard extra cargo to count for drive, gas, etc... + # kg of standard extra cargo to count for driver, gas, etc... ret.mass = 4016. * CV.LB_TO_KG + std_cargo ret.safetyModel = car.CarParams.SafetyModels.cadillac ret.wheelbase = 3.11 @@ -194,7 +231,8 @@ def update(self, c): # cruise state ret.cruiseState.available = bool(self.CS.main_on) - ret.cruiseState.enabled = self.CS.pcm_acc_status != 0 + cruiseEnabled = self.CS.pcm_acc_status != 0 + ret.cruiseState.enabled = cruiseEnabled ret.cruiseState.standstill = self.CS.pcm_acc_status == 4 ret.leftBlinker = self.CS.left_blinker_on @@ -228,7 +266,8 @@ def update(self, c): be.pressed = False but = self.CS.prev_cruise_buttons if but == CruiseButtons.RES_ACCEL: - be.type = 'accelCruise' + if not (cruiseEnabled and self.CS.standstill): + be.type = 'accelCruise' # Suppress resume button if we're resuming from stop so we don't adjust speed. elif but == CruiseButtons.DECEL_SET: be.type = 'decelCruise' elif but == CruiseButtons.CANCEL: @@ -255,8 +294,13 @@ def update(self, c): if ret.seatbeltUnlatched: events.append(create_event('seatbeltNotLatched', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - if self.CS.car_fingerprint == CAR.VOLT: + if self.CS.car_fingerprint in SUPERCRUISE_CARS: + if self.CS.acc_active and not self.acc_active_prev: + events.append(create_event('pcmEnable', [ET.ENABLE])) + if not self.CS.acc_active: + events.append(create_event('pcmDisable', [ET.USER_DISABLE])) + else: if self.CS.brake_error: events.append(create_event('brakeUnavailable', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT])) if not self.CS.gear_shifter_valid: @@ -289,13 +333,6 @@ def update(self, c): if b.type == "cancel" and b.pressed: events.append(create_event('buttonCancel', [ET.USER_DISABLE])) - if self.CS.car_fingerprint == CAR.CADILLAC_CT6: - - if self.CS.acc_active and not self.acc_active_prev: - events.append(create_event('pcmEnable', [ET.ENABLE])) - if not self.CS.acc_active: - events.append(create_event('pcmDisable', [ET.USER_DISABLE])) - ret.events = events # update previous brake/gas pressed @@ -313,17 +350,13 @@ def apply(self, c): if hud_v_cruise > 70: hud_v_cruise = 0 - chime, chime_count = { - "none": (0, 0), - "beepSingle": (CM.HIGH_CHIME, 1), - "beepTriple": (CM.HIGH_CHIME, 3), - "beepRepeated": (CM.LOW_CHIME, -1), - "chimeSingle": (CM.LOW_CHIME, 1), - "chimeDouble": (CM.LOW_CHIME, 2), - "chimeRepeated": (CM.LOW_CHIME, -1), - "chimeContinuous": (CM.LOW_CHIME, -1)}[str(c.hudControl.audibleAlert)] - - self.CC.update(self.sendcan, c.enabled, self.CS, self.frame, \ + chime, chime_count = AUDIO_HUD[c.hudControl.audibleAlert.raw] + + # For Openpilot, "enabled" includes pre-enable. + # In GM, PCM faults out if ACC command overlaps user gas. + enabled = c.enabled and not self.CS.user_gas_pressed + + self.CC.update(self.sendcan, enabled, self.CS, self.frame, \ c.actuators, hud_v_cruise, c.hudControl.lanesVisible, \ c.hudControl.leadVisible, \ diff --git a/selfdrive/car/gm/radar_interface.py b/selfdrive/car/gm/radar_interface.py index bc35b3459b537e..6af0d3f8fae843 100755 --- a/selfdrive/car/gm/radar_interface.py +++ b/selfdrive/car/gm/radar_interface.py @@ -11,26 +11,30 @@ from selfdrive.services import service_list import selfdrive.messaging as messaging -NUM_TARGETS_MSG = 1120 -SLOT_1_MSG = NUM_TARGETS_MSG + 1 +RADAR_HEADER_MSG = 1120 +SLOT_1_MSG = RADAR_HEADER_MSG + 1 NUM_SLOTS = 20 # Actually it's 0x47f, but can parser only reports # messages that are present in DBC -LAST_RADAR_MSG = NUM_TARGETS_MSG + NUM_SLOTS +LAST_RADAR_MSG = RADAR_HEADER_MSG + NUM_SLOTS def create_radard_can_parser(canbus, car_fingerprint): dbc_f = DBC[car_fingerprint]['radar'] - if car_fingerprint == CAR.VOLT: + if car_fingerprint in (CAR.VOLT, CAR.MALIBU, CAR.HOLDEN_ASTRA, CAR.ACADIA, CAR.CADILLAC_ATS): # C1A-ARS3-A by Continental radar_targets = range(SLOT_1_MSG, SLOT_1_MSG + NUM_SLOTS) - signals = zip(['LRRNumObjects'] + + signals = zip(['FLRRNumValidTargets', + 'FLRRSnsrBlckd', 'FLRRYawRtPlsblityFlt', + 'FLRRHWFltPrsntInt', 'FLRRAntTngFltPrsnt', + 'FLRRAlgnFltPrsnt', 'FLRRSnstvFltPrsntInt'] + ['TrkRange'] * NUM_SLOTS + ['TrkRangeRate'] * NUM_SLOTS + ['TrkRangeAccel'] * NUM_SLOTS + ['TrkAzimuth'] * NUM_SLOTS + ['TrkWidth'] * NUM_SLOTS + ['TrkObjectID'] * NUM_SLOTS, - [NUM_TARGETS_MSG] + radar_targets * 6, - [0] + [0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS + + [RADAR_HEADER_MSG] * 7 + radar_targets * 6, + [0] * 7 + + [0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS + [0] * NUM_SLOTS) @@ -44,8 +48,6 @@ class RadarInterface(object): def __init__(self, CP): # radar self.pts = {} - self.track_id = 0 - self.num_targets = 0 self.delay = 0.0 # Delay of radar @@ -70,22 +72,27 @@ def update(self): if LAST_RADAR_MSG in updated_messages: break + header = self.rcp.vl[RADAR_HEADER_MSG] + fault = header['FLRRSnsrBlckd'] or header['FLRRSnstvFltPrsntInt'] or \ + header['FLRRYawRtPlsblityFlt'] or header['FLRRHWFltPrsntInt'] or \ + header['FLRRAntTngFltPrsnt'] or header['FLRRAlgnFltPrsnt'] errors = [] if not self.rcp.can_valid: - errors.append("notValid") + errors.append("commIssue") + if fault: + errors.append("fault") ret.errors = errors currentTargets = set() - if self.rcp.vl[NUM_TARGETS_MSG]['LRRNumObjects'] != self.num_targets: - self.num_targets = self.rcp.vl[NUM_TARGETS_MSG]['LRRNumObjects'] + num_targets = header['FLRRNumValidTargets'] # Not all radar messages describe targets, - # no need to monitor all of the sself.rcp.msgs_upd + # no need to monitor all of the self.rcp.msgs_upd for ii in updated_messages: - if ii == NUM_TARGETS_MSG: + if ii == RADAR_HEADER_MSG: continue - if self.num_targets == 0: + if num_targets == 0: break cpt = self.rcp.vl[ii] @@ -118,5 +125,3 @@ def update(self): ret = RI.update() print(chr(27) + "[2J") print ret - - diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py index 314bb4a3f645fd..f6aa0658fff354 100644 --- a/selfdrive/car/gm/values.py +++ b/selfdrive/car/gm/values.py @@ -1,9 +1,18 @@ from cereal import car from selfdrive.car import dbc_dict +AudibleAlert = car.CarControl.HUDControl.AudibleAlert + class CAR: + HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017" VOLT = "CHEVROLET VOLT PREMIER 2017" + CADILLAC_ATS = "CADILLAC ATS Premium Performance 2018" CADILLAC_CT6 = "CADILLAC CT6 SUPERCRUISE 2018" + MALIBU = "CHEVROLET MALIBU PREMIER 2017" + ACADIA = "GMC ACADIA DENALI 2018" + BUICK_REGAL = "BUICK REGAL ESSENCE 2018" + +SUPERCRUISE_CARS = [CAR.CADILLAC_CT6] class CruiseButtons: UNPRESS = 1 @@ -12,12 +21,31 @@ class CruiseButtons: MAIN = 5 CANCEL = 6 +# Car chimes, beeps, blinker sounds etc +class CM: + TOCK = 0x81 + TICK = 0x82 + LOW_BEEP = 0x84 + HIGH_BEEP = 0x85 + LOW_CHIME = 0x86 + HIGH_CHIME = 0x87 + +AUDIO_HUD = { + AudibleAlert.none: (0, 0), + AudibleAlert.chimeEngage: (CM.HIGH_CHIME, 1), + AudibleAlert.chimeDisengage: (CM.HIGH_CHIME, 1), + AudibleAlert.chimeError: (CM.LOW_CHIME, 2), + AudibleAlert.chimePrompt: (CM.LOW_CHIME, 1), + AudibleAlert.chimeWarning1: (CM.LOW_CHIME, 2), + AudibleAlert.chimeWarning2: (CM.LOW_CHIME, -1), + AudibleAlert.chimeWarningRepeat: (CM.LOW_CHIME, -1)} + def is_eps_status_ok(eps_status, car_fingerprint): valid_eps_status = [] - if car_fingerprint == CAR.VOLT: - valid_eps_status += [0, 1] - elif car_fingerprint == CAR.CADILLAC_CT6: + if car_fingerprint in SUPERCRUISE_CARS: valid_eps_status += [0, 1, 4, 5, 6] + else: + valid_eps_status += [0, 1] return eps_status in valid_eps_status def parse_gear_shifter(can_gear): @@ -33,6 +61,10 @@ def parse_gear_shifter(can_gear): return car.CarState.GearShifter.unknown FINGERPRINTS = { + # Astra BK MY17, ASCM unplugged + CAR.HOLDEN_ASTRA: [{ + 190: 8, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 8, 241: 6, 249: 8, 288: 5, 298: 8, 304: 1, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 386: 8, 388: 8, 393: 8, 398: 8, 401: 8, 413: 8, 417: 8, 419: 8, 422: 1, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 8, 455: 7, 456: 8, 458: 5, 479: 8, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 8, 501: 8, 508: 8, 528: 5, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 647: 5, 707: 8, 723: 8, 753: 5, 761: 7, 806: 1, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 961: 8, 969: 8, 977: 8, 979: 8, 985: 5, 1001: 8, 1009: 8, 1011: 6, 1017: 8, 1019: 3, 1020: 8, 1105: 6, 1217: 8, 1221: 5, 1225: 8, 1233: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 8, 1280: 4, 1300: 8, 1328: 4, 1417: 8, 1906: 7, 1907: 7, 1908: 7, 1912: 7, 1919: 7, + }], CAR.VOLT: [ # Volt Premier w/ ACC 2017 { @@ -40,15 +72,51 @@ def parse_gear_shifter(can_gear): }, # Volt Premier w/ ACC 2018 { - 170: 8, 171: 8, 189: 7, 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 288: 5, 298: 8, 304: 1, 308: 4, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 384: 4, 386: 8, 388: 8, 389: 2, 390: 7, 417: 7, 419: 1, 426: 7, 451: 8, 452: 8, 453: 6, 454: 8, 456: 8, 479: 3, 481: 7, 485: 8, 489: 8, 493: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 528: 4, 532: 6, 546: 7, 550: 8, 554: 3, 558: 8, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 566: 5, 567: 3, 568: 1, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 3, 707: 8, 711: 6, 715: 8, 717: 5, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 961: 8, 967: 4, 969: 8, 977: 8, 979: 7, 988: 6, 989: 8, 995: 7, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1019: 2, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1187: 4, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1227: 4, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1273: 3, 1275: 3, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1601: 8, 1905: 7, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1922: 7, 1927: 7, 1930: 7, 2016: 8, 2020: 8, 2024: 8, 2028: 8 + 170: 8, 171: 8, 189: 7, 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 288: 5, 298: 8, 304: 1, 308: 4, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 384: 4, 386: 8, 388: 8, 389: 2, 390: 7, 417: 7, 419: 1, 426: 7, 451: 8, 452: 8, 453: 6, 454: 8, 456: 8, 479: 3, 481: 7, 485: 8, 489: 8, 493: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 528: 4, 532: 6, 546: 7, 550: 8, 554: 3, 558: 8, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 566: 5, 567: 3, 568: 1, 573: 1, 577: 8, 578: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 3, 707: 8, 711: 6, 715: 8, 717: 5, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 961: 8, 967: 4, 969: 8, 977: 8, 979: 7, 988: 6, 989: 8, 995: 7, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1019: 2, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1187: 4, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1227: 4, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1273: 3, 1275: 3, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1516: 8, 1601: 8, 1618: 8, 1905: 7, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1922: 7, 1927: 7, 1930: 7, 2016: 8, 2018: 8, 2020: 8, 2024: 8, 2028: 8 + }], + CAR.BUICK_REGAL : [ + # Regal TourX Essence w/ ACC 2018 + { + 190: 8, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 8, 241: 6, 249: 8, 288: 5, 298: 8, 304: 1, 309: 8, 311: 8, 313: 8, 320: 3, 322: 7, 328: 1, 352: 5, 381: 6, 384: 4, 386: 8, 388: 8, 393: 7, 398: 8, 407: 7, 413: 8, 417: 8, 419: 8, 422: 4, 426: 8, 431: 8, 442: 8, 451: 8, 452: 8, 453: 8, 455: 7, 456: 8, 463: 3, 479: 8, 481: 7, 485: 8, 487: 8, 489: 8, 495: 8, 497: 8, 499: 3, 500: 8, 501: 8, 508: 8, 528: 5, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 569: 3, 573: 1, 577: 8, 578: 8, 579: 8, 587: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 3, 707: 8, 715: 8, 717: 5, 753: 5, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 882: 8, 884: 8, 890: 1, 892: 2, 893: 2, 894: 1, 961: 8, 967: 8, 969: 8, 977: 8, 979: 8, 985: 8, 1001: 8, 1005: 6, 1009: 8, 1011: 8, 1013: 3, 1017: 8, 1020: 8, 1024: 8, 1025: 8, 1026: 8, 1027: 8, 1028: 8, 1029: 8, 1030: 8, 1031: 8, 1032: 2, 1033: 7, 1034: 7, 1105: 6, 1217: 8, 1221: 5, 1223: 8, 1225: 7, 1233: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 8, 1263: 8, 1265: 8, 1267: 8, 1271: 8, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1328: 4, 1417: 8, 1601: 8, 1602: 8, 1603: 7, 1611: 8, 1618: 8, 1906: 8, 1907: 7, 1912: 7, 1914: 7, 1916: 7, 1919: 7, 1930: 7, 2016: 8, 2018: 8, 2019: 8, 2024: 8, 2026: 8 + }], + CAR.CADILLAC_ATS: [ + # Cadillac ATS Coupe Premium Performance 3.6L RWD w/ ACC 2018 + { + 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 298: 8, 304: 1, 309: 8, 311: 8, 313: 8, 320: 3, 322: 7, 328: 1, 352: 5, 368: 3, 381: 6, 384: 4, 386: 8, 388: 8, 393: 7, 398: 8, 401: 8, 407: 7, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 6, 455: 7, 456: 8, 462: 4, 479: 3, 481: 7, 485: 8, 487: 8, 489: 8, 491: 2, 493: 8, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 510: 8, 528: 5, 532: 6, 534: 2, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 719: 5, 723: 2, 753: 5, 761: 7, 801: 8, 804: 3, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 882: 8, 890: 1, 892: 2, 893: 2, 894: 1, 961: 8, 967: 4, 969: 8, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1011: 6, 1013: 3, 1017: 8, 1019: 2, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1233: 8, 1241: 3, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1271: 8, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1601: 8, 1904: 7, 1906: 7, 1907: 7, 1912: 7, 1916: 7, 1917: 7, 1918: 7, 1919: 7, 1920: 7, 1930: 7, 2016: 8, 2024: 8 }], CAR.CADILLAC_CT6: [{ 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 298: 8, 304: 1, 309: 8, 313: 8, 320: 3, 322: 7, 328: 1, 336: 1, 338: 6, 340: 6, 352: 5, 354: 5, 356: 8, 368: 3, 372: 5, 381: 8, 386: 8, 393: 7, 398: 8, 407: 7, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 6, 455: 7, 456: 8, 458: 5, 460: 5, 462: 4, 463: 3, 479: 3, 481: 7, 485: 8, 487: 8, 489: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 528: 5, 532: 6, 534: 2, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 569: 3, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 719: 5, 723: 2, 753: 5, 761: 7, 800: 6, 801: 8, 804: 3, 810: 8, 832: 8, 833: 8, 834: 8, 835: 6, 836: 5, 837: 8, 838: 8, 839: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 884: 8, 961: 8, 969: 8, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1011: 6, 1013: 1, 1017: 8, 1019: 2, 1020: 8, 1105: 6, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1233: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1417: 8, 1601: 8, 1906: 7, 1907: 7, 1912: 7, 1914: 7, 1918: 7, 1919: 7, 1934: 7, 2016: 8, 2024: 8 }], + CAR.MALIBU: [ + # Malibu Premier w/ ACC 2017 + { + 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 298: 8, 304: 1, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 384: 4, 386: 8, 388: 8, 393: 7, 398: 8, 407: 7, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 6, 455: 7, 456: 8, 479: 3, 481: 7, 485: 8, 487: 8, 489: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 510: 8, 528: 5, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 753: 5, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 961: 8, 969: 8, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1013: 3, 1017: 8, 1019: 2, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1217: 8, 1221: 5, 1223: 2, 1225: 7, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1601: 8, 1906: 7, 1907: 7, 1912: 7, 1919: 7, 1930: 7, 2016: 8, 2024: 8, + }], + CAR.ACADIA: [ + # Acadia Denali w/ /ACC 2018 + { + 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 208: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 289: 8, 298: 8, 304: 1, 309: 8, 313: 8, 320: 3, 322: 7, 328: 1, 338: 6, 340: 6, 352: 5, 381: 8, 384: 4, 386: 8, 388: 8, 393: 8, 398: 8, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 6, 454: 8, 455: 7, 462: 4, 463: 3, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 510: 8, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 567: 5, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 753: 5, 761: 7, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 961: 8, 969: 8, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1217: 8, 1221: 5, 1225: 8, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1328: 4, 1417: 8, 1601: 8, 1906: 7, 1907: 7, 1912: 7, 1914: 7, 1919: 7, 1920: 7, 1930: 7, 2016: 8, 2024: 8 + }], } +STEER_THRESHOLD = 1.0 + +STOCK_CONTROL_MSGS = { + CAR.HOLDEN_ASTRA: [384, 715], + CAR.VOLT: [384, 715], # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd" + CAR.MALIBU: [384, 715], # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd" + CAR.ACADIA: [384, 715], # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd" + CAR.CADILLAC_ATS: [384, 715], # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd" + CAR.BUICK_REGAL: [384, 715], # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd" + CAR.CADILLAC_CT6: [], # CT6 does not require ASCMs to be disconnected +} DBC = { + CAR.HOLDEN_ASTRA: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), CAR.VOLT: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), + CAR.MALIBU: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), + CAR.ACADIA: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), + CAR.CADILLAC_ATS: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), + CAR.BUICK_REGAL: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), CAR.CADILLAC_CT6: dbc_dict('cadillac_ct6_powertrain', 'cadillac_ct6_object', chassis_dbc='cadillac_ct6_chassis'), } diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 0875a67234a02d..9325e896466052 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -1,13 +1,15 @@ from collections import namedtuple +from common.realtime import sec_since_boot from selfdrive.boardd.boardd import can_list_to_can_capnp from selfdrive.controls.lib.drive_helpers import rate_limit from common.numpy_fast import clip +from selfdrive.car import create_gas_command from selfdrive.car.honda import hondacan from selfdrive.car.honda.values import AH, CruiseButtons, CAR from selfdrive.can.packer import CANPacker def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): - # hyst params... TODO: move these to VehicleParams + # hyst params brake_hyst_on = 0.02 # to activate brakes exceed this value brake_hyst_off = 0.005 # to deactivate brakes below this value brake_hyst_gap = 0.01 # don't change brake command for small ocilalitons within this value @@ -32,6 +34,24 @@ def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): return brake, braking, brake_steady +def brake_pump_hysteresys(apply_brake, apply_brake_last, last_pump_ts): + ts = sec_since_boot() + pump_on = False + + # reset pump timer if: + # - there is an increment in brake request + # - we are applying steady state brakes and we haven't been running the pump + # for more than 20s (to prevent pressure bleeding) + if apply_brake > apply_brake_last or (ts - last_pump_ts > 20 and apply_brake > 0): + last_pump_ts = ts + + # once the pump is on, run it for at least 0.2s + if ts - last_pump_ts < 0.2 and apply_brake > 0: + pump_on = True + + return pump_on, last_pump_ts + + def process_hud_alert(hud_alert): # initialize to no alert fcw_display = 0 @@ -59,13 +79,16 @@ def __init__(self, dbc_name, enable_camera=True): self.braking = False self.brake_steady = 0. self.brake_last = 0. + self.apply_brake_last = 0 + self.last_pump_ts = 0 self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) + self.new_radar_config = False def update(self, sendcan, enabled, CS, frame, actuators, \ pcm_speed, pcm_override, pcm_cancel_cmd, pcm_accel, \ - hud_v_cruise, hud_show_lanes, hud_show_car, hud_alert, \ - snd_beep, snd_chime): + hud_v_cruise, hud_show_lanes, hud_show_car, \ + hud_alert, snd_beep, snd_chime): """ Controls thread """ @@ -99,7 +122,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # For lateral control-only, send chimes as a beep since we don't send 0x1fa if CS.CP.radarOffCan: - snd_beep = snd_beep if snd_beep is not 0 else snd_chime + snd_beep = snd_beep if snd_beep != 0 else snd_chime #print chime, alert_id, hud_alert fcw_display, steer_required, acc_alert = process_hud_alert(hud_alert) @@ -107,9 +130,6 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), 1, hud_car, 0xc1, hud_lanes, int(snd_beep), snd_chime, fcw_display, acc_alert, steer_required) - if not all(isinstance(x, int) and 0 <= x < 256 for x in hud): - hud = HUDData(0xc6, 255, 64, 0xc0, 209, 0x40, 0, 0, 0, 0) - # **** process the car messages **** # *** compute control surfaces *** @@ -118,6 +138,8 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ STEER_MAX = 0xF00 elif CS.CP.carFingerprint in (CAR.CRV, CAR.ACURA_RDX): STEER_MAX = 0x3e8 # CR-V only uses 12-bits and requires a lower value (max value from energee) + elif CS.CP.carFingerprint in (CAR.ODYSSEY_CHN): + STEER_MAX = 0x7FFF else: STEER_MAX = 0x1000 @@ -126,7 +148,6 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX - 1)) apply_steer = int(clip(-actuators.steer * STEER_MAX, -STEER_MAX, STEER_MAX)) - # any other cp.vl[0x18F]['STEER_STATUS'] is common and can happen during user override. sending 0 torque to avoid EPS sending error 5 lkas_active = enabled and not CS.steer_not_allowed # Send CAN commands. @@ -134,7 +155,8 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # Send steering command. idx = frame % 4 - can_sends.append(hondacan.create_steering_control(self.packer, apply_steer, lkas_active, CS.CP.carFingerprint, idx)) + can_sends.append(hondacan.create_steering_control(self.packer, apply_steer, + lkas_active, CS.CP.carFingerprint, idx)) # Send dashboard UI commands. if (frame % 10) == 0: @@ -147,26 +169,19 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.CANCEL, idx)) elif CS.stopped: can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.RES_ACCEL, idx)) + else: # Send gas and brake commands. if (frame % 2) == 0: - idx = (frame / 2) % 4 - can_sends.append( - hondacan.create_brake_command(self.packer, apply_brake, pcm_override, - pcm_cancel_cmd, hud.chime, hud.fcw, idx)) + idx = frame / 2 + pump_on, self.last_pump_ts = brake_pump_hysteresys(apply_brake, self.apply_brake_last, self.last_pump_ts) + can_sends.append(hondacan.create_brake_command(self.packer, apply_brake, pump_on, + pcm_override, pcm_cancel_cmd, hud.chime, hud.fcw, idx)) + self.apply_brake_last = apply_brake + if CS.CP.enableGasInterceptor: # send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas. # This prevents unexpected pedal range rescaling - can_sends.append(hondacan.create_gas_command(self.packer, apply_gas, idx)) - - # radar at 20Hz, but these msgs need to be sent at 50Hz on ilx (seems like an Acura bug) - if CS.CP.carFingerprint == CAR.ACURA_ILX: - radar_send_step = 2 - else: - radar_send_step = 5 - - if (frame % radar_send_step) == 0: - idx = (frame/radar_send_step) % 4 - can_sends.extend(hondacan.create_radar_commands(CS.v_ego, CS.CP.carFingerprint, idx)) + can_sends.append(create_gas_command(self.packer, apply_gas, idx)) sendcan.send(can_list_to_can_capnp(can_sends, msgtype='sendcan').to_bytes()) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 36dea1f7ff1fbb..b8164e8c52f65a 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -1,48 +1,17 @@ from common.numpy_fast import interp from common.kalman.simple_kalman import KF1D -from selfdrive.can.parser import CANParser +from selfdrive.can.parser import CANParser, CANDefine from selfdrive.config import Conversions as CV -from selfdrive.car.honda.values import CAR, DBC - -def parse_gear_shifter(can_gear_shifter, car_fingerprint): - - # TODO: Use VAL from DBC to parse this field - if car_fingerprint in (CAR.ACURA_ILX, CAR.ODYSSEY): - if can_gear_shifter == 0x1: - return "park" - elif can_gear_shifter == 0x2: - return "reverse" - elif can_gear_shifter == 0x3: - return "neutral" - elif can_gear_shifter == 0x4: - return "drive" - elif can_gear_shifter == 0xa: - return "sport" - elif car_fingerprint in (CAR.CIVIC, CAR.CRV, CAR.ACURA_RDX, CAR.CRV_5G, CAR.CIVIC_HATCH): - if can_gear_shifter == 0x1: - return "park" - elif can_gear_shifter == 0x2: - return "reverse" - elif can_gear_shifter == 0x4: - return "neutral" - elif can_gear_shifter == 0x8: - return "drive" - elif can_gear_shifter == 0x10: - return "sport" - elif can_gear_shifter == 0x20: - return "low" - - elif car_fingerprint in (CAR.ACCORD, CAR.PILOT, CAR.RIDGELINE): - if can_gear_shifter == 0x8: - return "reverse" - elif can_gear_shifter == 0x4: - return "park" - elif can_gear_shifter == 0x20: - return "drive" - elif can_gear_shifter == 0x2: - return "sport" - - return "unknown" +from selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, SPEED_FACTOR, HONDA_BOSCH + +def parse_gear_shifter(gear, vals): + + val_to_capnp = {'P': 'park', 'R': 'reverse', 'N': 'neutral', + 'D': 'drive', 'S': 'sport', 'L': 'low'} + try: + return val_to_capnp[vals[gear]] + except KeyError: + return "unknown" def calc_cruise_offset(offset, speed): @@ -71,8 +40,6 @@ def get_can_signals(CP): ("LEFT_BLINKER", "SCM_FEEDBACK", 0), ("RIGHT_BLINKER", "SCM_FEEDBACK", 0), ("GEAR", "GEARBOX", 0), - ("BRAKE_ERROR_1", "STANDSTILL", 1), - ("BRAKE_ERROR_2", "STANDSTILL", 1), ("SEATBELT_DRIVER_LAMP", "SEATBELT_STATUS", 1), ("SEATBELT_DRIVER_LATCHED", "SEATBELT_STATUS", 0), ("BRAKE_PRESSED", "POWERTRAIN_DATA", 0), @@ -81,6 +48,7 @@ def get_can_signals(CP): ("ESP_DISABLED", "VSA_STATUS", 1), ("HUD_LEAD", "ACC_HUD", 0), ("USER_BRAKE", "VSA_STATUS", 0), + ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0), ("STEER_STATUS", "STEER_STATUS", 5), ("GEAR_SHIFTER", "GEARBOX", 0), ("PEDAL_GAS", "POWERTRAIN_DATA", 0), @@ -92,35 +60,59 @@ def get_can_signals(CP): ("ENGINE_DATA", 100), ("WHEEL_SPEEDS", 50), ("STEERING_SENSORS", 100), - ("SCM_FEEDBACK", 10), - ("GEARBOX", 100), - ("STANDSTILL", 50), ("SEATBELT_STATUS", 10), ("CRUISE", 10), ("POWERTRAIN_DATA", 100), ("VSA_STATUS", 50), - ("SCM_BUTTONS", 25), ] + if CP.carFingerprint == CAR.ODYSSEY_CHN: + checks += [ + ("SCM_FEEDBACK", 25), + ("SCM_BUTTONS", 50), + ] + else: + checks += [ + ("SCM_FEEDBACK", 10), + ("SCM_BUTTONS", 25), + ] + + if CP.carFingerprint == CAR.CRV_HYBRID: + checks += [ + ("GEARBOX", 50), + ] + else: + checks += [ + ("GEARBOX", 100), + ] + if CP.radarOffCan: # Civic is only bosch to use the same brake message as other hondas. - if CP.carFingerprint != CAR.CIVIC_HATCH: + if CP.carFingerprint not in (CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CRV_HYBRID): signals += [("BRAKE_PRESSED", "BRAKE_MODULE", 0)] checks += [("BRAKE_MODULE", 50)] signals += [("CAR_GAS", "GAS_PEDAL_2", 0), ("MAIN_ON", "SCM_FEEDBACK", 0), ("EPB_STATE", "EPB_STATUS", 0), - ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0), ("CRUISE_SPEED", "ACC_HUD", 0)] checks += [("GAS_PEDAL_2", 100)] else: # Nidec signals. - signals += [("CRUISE_SPEED_PCM", "CRUISE", 0), + signals += [("BRAKE_ERROR_1", "STANDSTILL", 1), + ("BRAKE_ERROR_2", "STANDSTILL", 1), + ("CRUISE_SPEED_PCM", "CRUISE", 0), ("CRUISE_SPEED_OFFSET", "CRUISE_PARAMS", 0)] - checks += [("CRUISE_PARAMS", 50)] + checks += [("STANDSTILL", 50)] + + if CP.carFingerprint == CAR.ODYSSEY_CHN: + checks += [("CRUISE_PARAMS", 10)] + else: + checks += [("CRUISE_PARAMS", 50)] - if CP.carFingerprint == CAR.ACCORD: + if CP.carFingerprint in (CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CRV_HYBRID): signals += [("DRIVERS_DOOR_OPEN", "SCM_FEEDBACK", 1)] + elif CP.carFingerprint == CAR.ODYSSEY_CHN: + signals += [("DRIVERS_DOOR_OPEN", "SCM_BUTTONS", 1)] else: signals += [("DOOR_OPEN_FL", "DOORS_STATUS", 1), ("DOOR_OPEN_FR", "DOORS_STATUS", 1), @@ -132,25 +124,23 @@ def get_can_signals(CP): if CP.carFingerprint == CAR.CIVIC: signals += [("CAR_GAS", "GAS_PEDAL_2", 0), ("MAIN_ON", "SCM_FEEDBACK", 0), - ("EPB_STATE", "EPB_STATUS", 0), - ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0)] + ("EPB_STATE", "EPB_STATUS", 0)] elif CP.carFingerprint == CAR.ACURA_ILX: signals += [("CAR_GAS", "GAS_PEDAL_2", 0), ("MAIN_ON", "SCM_BUTTONS", 0)] - elif CP.carFingerprint == CAR.CRV: - signals += [("MAIN_ON", "SCM_BUTTONS", 0)] - elif CP.carFingerprint == CAR.ACURA_RDX: + elif CP.carFingerprint in (CAR.CRV, CAR.ACURA_RDX, CAR.PILOT_2019, CAR.RIDGELINE): signals += [("MAIN_ON", "SCM_BUTTONS", 0)] elif CP.carFingerprint == CAR.ODYSSEY: signals += [("MAIN_ON", "SCM_FEEDBACK", 0), - ("EPB_STATE", "EPB_STATUS", 0), - ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0)] + ("EPB_STATE", "EPB_STATUS", 0)] checks += [("EPB_STATUS", 50)] elif CP.carFingerprint == CAR.PILOT: signals += [("MAIN_ON", "SCM_BUTTONS", 0), ("CAR_GAS", "GAS_PEDAL_2", 0)] - elif CP.carFingerprint == CAR.RIDGELINE: - signals += [("MAIN_ON", "SCM_BUTTONS", 0)] + elif CP.carFingerprint == CAR.ODYSSEY_CHN: + signals += [("MAIN_ON", "SCM_BUTTONS", 0), + ("EPB_STATE", "EPB_STATUS", 0)] + checks += [("EPB_STATUS", 50)] # add gas interceptor reading if we are using it if CP.enableGasInterceptor: @@ -164,10 +154,23 @@ def get_can_parser(CP): signals, checks = get_can_signals(CP) return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0) +def get_cam_can_parser(CP): + signals = [] + + # all hondas except CRV, RDX and 2019 Odyssey@China use 0xe4 for steering + checks = [(0xe4, 100)] + if CP.carFingerprint in [CAR.CRV, CAR.ACURA_RDX, CAR.ODYSSEY_CHN]: + checks = [(0x194, 100)] + + cam_bus = 1 if CP.carFingerprint in HONDA_BOSCH else 2 + + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, cam_bus) class CarState(object): def __init__(self, CP): self.CP = CP + self.can_define = CANDefine(DBC[CP.carFingerprint]['pt']) + self.shifter_values = self.can_define.dv["GEARBOX"]["GEAR_SHIFTER"] self.user_gas, self.user_gas_pressed = 0., 0 self.brake_switch_prev = 0 @@ -193,10 +196,11 @@ def __init__(self, CP): K=[[0.12287673], [0.29666309]]) self.v_ego = 0.0 - def update(self, cp): + def update(self, cp, cp_cam): - # copy can_valid + # copy can_valid on buses 0 and 2 self.can_valid = cp.can_valid + self.cam_can_valid = cp_cam.can_valid # car params v_weight_v = [0., 1.] # don't trust smooth speed at low values to avoid premature zero snapping @@ -212,36 +216,44 @@ def update(self, cp): # ******************* parse out can ******************* - if self.CP.carFingerprint == CAR.ACCORD: # TODO: find wheels moving bit in dbc + if self.CP.carFingerprint in (CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CRV_HYBRID): # TODO: find wheels moving bit in dbc self.standstill = cp.vl["ENGINE_DATA"]['XMISSION_SPEED'] < 0.1 self.door_all_closed = not cp.vl["SCM_FEEDBACK"]['DRIVERS_DOOR_OPEN'] + elif self.CP.carFingerprint == CAR.ODYSSEY_CHN: + self.standstill = cp.vl["ENGINE_DATA"]['XMISSION_SPEED'] < 0.1 + self.door_all_closed = not cp.vl["SCM_BUTTONS"]['DRIVERS_DOOR_OPEN'] else: self.standstill = not cp.vl["STANDSTILL"]['WHEELS_MOVING'] self.door_all_closed = not any([cp.vl["DOORS_STATUS"]['DOOR_OPEN_FL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_FR'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_RL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_RR']]) self.seatbelt = not cp.vl["SEATBELT_STATUS"]['SEATBELT_DRIVER_LAMP'] and cp.vl["SEATBELT_STATUS"]['SEATBELT_DRIVER_LATCHED'] - # 2 = temporary; 3 = TBD; 4 = temporary, hit a bump; 5 = (permanent); 6 = temporary; 7 = (permanent) + # 2 = temporary; 3 = TBD; 4 = significant steering wheel torque; 5 = (permanent); 6 = temporary; 7 = (permanent) # TODO: Use values from DBC to parse this field self.steer_error = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 2, 3, 4, 6] - self.steer_not_allowed = cp.vl["STEER_STATUS"]['STEER_STATUS'] != 0 - self.steer_warning = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 3] # 3 is low speed lockout, not worth a warning - self.brake_error = cp.vl["STANDSTILL"]['BRAKE_ERROR_1'] or cp.vl["STANDSTILL"]['BRAKE_ERROR_2'] + self.steer_not_allowed = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 4] # 4 can be caused by bump OR steering nudge from driver + self.steer_warning = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 3, 4] # 3 is low speed lockout, not worth a warning + if self.CP.radarOffCan: + self.brake_error = 0 + else: + self.brake_error = cp.vl["STANDSTILL"]['BRAKE_ERROR_1'] or cp.vl["STANDSTILL"]['BRAKE_ERROR_2'] self.esp_disabled = cp.vl["VSA_STATUS"]['ESP_DISABLED'] # calc best v_ego estimate, by averaging two opposite corners - self.v_wheel_fl = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_FL'] * CV.KPH_TO_MS - self.v_wheel_fr = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_FR'] * CV.KPH_TO_MS - self.v_wheel_rl = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_RL'] * CV.KPH_TO_MS - self.v_wheel_rr = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_RR'] * CV.KPH_TO_MS - self.v_wheel = (self.v_wheel_fl+self.v_wheel_fr+self.v_wheel_rl+self.v_wheel_rr)/4. + speed_factor = SPEED_FACTOR[self.CP.carFingerprint] + self.v_wheel_fl = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_FL'] * CV.KPH_TO_MS * speed_factor + self.v_wheel_fr = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_FR'] * CV.KPH_TO_MS * speed_factor + self.v_wheel_rl = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_RL'] * CV.KPH_TO_MS * speed_factor + self.v_wheel_rr = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_RR'] * CV.KPH_TO_MS * speed_factor + v_wheel = (self.v_wheel_fl + self.v_wheel_fr + self.v_wheel_rl + self.v_wheel_rr)/4. # blend in transmission speed at low speed, since it has more low speed accuracy - self.v_weight = interp(self.v_wheel, v_weight_bp, v_weight_v) - speed = (1. - self.v_weight) * cp.vl["ENGINE_DATA"]['XMISSION_SPEED'] * CV.KPH_TO_MS + self.v_weight * self.v_wheel + self.v_weight = interp(v_wheel, v_weight_bp, v_weight_v) + speed = (1. - self.v_weight) * cp.vl["ENGINE_DATA"]['XMISSION_SPEED'] * CV.KPH_TO_MS * speed_factor + \ + self.v_weight * v_wheel if abs(speed - self.v_ego) > 2.0: # Prevent large accelerations when car starts at non zero speed - self.v_ego_x = [[speed], [0.0]] + self.v_ego_kf.x = [[speed], [0.0]] self.v_ego_raw = speed v_ego_x = self.v_ego_kf.update(speed) @@ -254,7 +266,6 @@ def update(self, cp): self.user_gas = cp.vl["GAS_SENSOR"]['INTERCEPTOR_GAS'] self.user_gas_pressed = self.user_gas > 0 # this works because interceptor read < 0 when pedal position is 0. Once calibrated, this will change - can_gear_shifter = cp.vl["GEARBOX"]['GEAR_SHIFTER'] self.gear = 0 if self.CP.carFingerprint == CAR.CIVIC else cp.vl["GEARBOX"]['GEAR'] self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] @@ -265,36 +276,37 @@ def update(self, cp): self.blinker_on = cp.vl["SCM_FEEDBACK"]['LEFT_BLINKER'] or cp.vl["SCM_FEEDBACK"]['RIGHT_BLINKER'] self.left_blinker_on = cp.vl["SCM_FEEDBACK"]['LEFT_BLINKER'] self.right_blinker_on = cp.vl["SCM_FEEDBACK"]['RIGHT_BLINKER'] + self.brake_hold = cp.vl["VSA_STATUS"]['BRAKE_HOLD_ACTIVE'] - if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH): + if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.CRV_5G, CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CRV_HYBRID): self.park_brake = cp.vl["EPB_STATUS"]['EPB_STATE'] != 0 - self.brake_hold = cp.vl["VSA_STATUS"]['BRAKE_HOLD_ACTIVE'] self.main_on = cp.vl["SCM_FEEDBACK"]['MAIN_ON'] + elif self.CP.carFingerprint == CAR.ODYSSEY_CHN: + self.park_brake = cp.vl["EPB_STATUS"]['EPB_STATE'] != 0 + self.main_on = cp.vl["SCM_BUTTONS"]['MAIN_ON'] else: self.park_brake = 0 # TODO - self.brake_hold = 0 # TODO self.main_on = cp.vl["SCM_BUTTONS"]['MAIN_ON'] - self.gear_shifter = parse_gear_shifter(can_gear_shifter, self.CP.carFingerprint) + can_gear_shifter = int(cp.vl["GEARBOX"]['GEAR_SHIFTER']) + self.gear_shifter = parse_gear_shifter(can_gear_shifter, self.shifter_values) self.pedal_gas = cp.vl["POWERTRAIN_DATA"]['PEDAL_GAS'] # crv doesn't include cruise control - if self.CP.carFingerprint in (CAR.CRV, CAR.ODYSSEY, CAR.ACURA_RDX, CAR.RIDGELINE): + if self.CP.carFingerprint in (CAR.CRV, CAR.ODYSSEY, CAR.ACURA_RDX, CAR.RIDGELINE, CAR.PILOT_2019, CAR.ODYSSEY_CHN): self.car_gas = self.pedal_gas else: self.car_gas = cp.vl["GAS_PEDAL_2"]['CAR_GAS'] - #rdx has different steer override threshold - steer_thrsld = 400 if self.CP.carFingerprint == CAR.ACURA_RDX else 1200 - self.steer_override = abs(cp.vl["STEER_STATUS"]['STEER_TORQUE_SENSOR']) > steer_thrsld self.steer_torque_driver = cp.vl["STEER_STATUS"]['STEER_TORQUE_SENSOR'] + self.steer_override = abs(self.steer_torque_driver) > STEER_THRESHOLD[self.CP.carFingerprint] self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] if self.CP.radarOffCan: self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) - if self.CP.carFingerprint == CAR.CIVIC_HATCH: + if self.CP.carFingerprint in (CAR.CIVIC_BOSCH, CAR.ACCORDH, CAR.CRV_HYBRID): self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ (self.brake_switch and self.brake_switch_prev and \ @@ -322,6 +334,11 @@ def update(self, cp): self.pcm_acc_status = cp.vl["POWERTRAIN_DATA"]['ACC_STATUS'] self.hud_lead = cp.vl["ACC_HUD"]['HUD_LEAD'] + # Gets rid of Pedal Grinding noise when brake is pressed at slow speeds for some models + # TODO: this should be ok for all cars. Verify it. + if self.CP.carFingerprint in (CAR.PILOT, CAR.PILOT_2019, CAR.RIDGELINE): + if self.user_brake > 0.05: + self.brake_pressed = 1 # carstate standalone tester if __name__ == '__main__': diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 92e74cd6868155..8f369feca3711f 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -1,8 +1,6 @@ import struct - -import common.numpy_fast as np from selfdrive.config import Conversions as CV -from selfdrive.car.honda.values import CAR +from selfdrive.car.honda.values import CAR, HONDA_BOSCH # *** Honda specific *** def can_cksum(mm): @@ -21,16 +19,8 @@ def fix(msg, addr): return msg2 -def make_can_msg(addr, dat, idx, alt): - if idx is not None: - dat += chr(idx << 4) - dat = fix(dat, addr) - return [addr, 0, dat, alt] - - -def create_brake_command(packer, apply_brake, pcm_override, pcm_cancel_cmd, chime, fcw, idx): - """Creates a CAN message for the Honda DBC BRAKE_COMMAND.""" - pump_on = apply_brake > 0 +def create_brake_command(packer, apply_brake, pump_on, pcm_override, pcm_cancel_cmd, chime, fcw, idx): + # TODO: do we loose pressure if we keep pump off for long? brakelights = apply_brake > 0 brake_rq = apply_brake > 0 pcm_fault_cmd = False @@ -45,42 +35,28 @@ def create_brake_command(packer, apply_brake, pcm_override, pcm_cancel_cmd, chim "SET_ME_0X80": 0x80, "BRAKE_LIGHTS": brakelights, "CHIME": chime, - "FCW": fcw << 1, # TODO: Why are there two bits for fcw? According to dbc file the first bit should also work + # TODO: Why are there two bits for fcw? According to dbc file the first bit should also work + "FCW": fcw << 1, } return packer.make_can_msg("BRAKE_COMMAND", 0, values, idx) -def create_gas_command(packer, gas_amount, idx): - """Creates a CAN message for the Honda DBC GAS_COMMAND.""" - enable = gas_amount > 0.001 - - values = {"ENABLE": enable} - - if enable: - values["GAS_COMMAND"] = gas_amount * 255. - values["GAS_COMMAND2"] = gas_amount * 255. - - return packer.make_can_msg("GAS_COMMAND", 0, values, idx) - - def create_steering_control(packer, apply_steer, lkas_active, car_fingerprint, idx): - """Creates a CAN message for the Honda DBC STEERING_CONTROL.""" values = { "STEER_TORQUE": apply_steer if lkas_active else 0, "STEER_TORQUE_REQUEST": lkas_active, } # Set bus 2 for accord and new crv. - bus = 2 if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH) else 0 + bus = 2 if car_fingerprint in HONDA_BOSCH else 0 return packer.make_can_msg("STEERING_CONTROL", bus, values, idx) def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): - """Creates an iterable of CAN messages for the UIs.""" commands = [] bus = 0 # Bosch sends commands to bus 2. - if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH): + if car_fingerprint in HONDA_BOSCH: bus = 2 else: acc_hud_values = { @@ -89,8 +65,8 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): 'CRUISE_SPEED': hud.v_cruise, 'ENABLE_MINI_CAR': hud.mini_car, 'HUD_LEAD': hud.car, - 'SET_ME_X03': 0x03, - 'SET_ME_X03_2': 0x03, + 'SET_ME_X03': 0x01 if car_fingerprint == CAR.ODYSSEY_CHN else 0x03, + 'SET_ME_X03_2': 0x02 if car_fingerprint == CAR.ODYSSEY_CHN else 0x03, 'SET_ME_X01': 0x01, } commands.append(packer.make_can_msg("ACC_HUD", 0, acc_hud_values, idx)) @@ -105,7 +81,6 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): commands.append(packer.make_can_msg('LKAS_HUD', bus, lkas_hud_values, idx)) if car_fingerprint in (CAR.CIVIC, CAR.ODYSSEY): - commands.append(packer.make_can_msg('HIGHBEAM_CONTROL', 0, {'HIGHBEAMS_ON': False}, idx)) radar_hud_values = { 'ACC_ALERTS': hud.acc_alert, @@ -117,37 +92,6 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): return commands -def create_radar_commands(v_ego, car_fingerprint, idx): - """Creates an iterable of CAN messages for the radar system.""" - commands = [] - v_ego_kph = np.clip(int(round(v_ego * CV.MS_TO_KPH)), 0, 255) - speed = struct.pack('!B', v_ego_kph) - - msg_0x300 = ("\xf9" + speed + "\x8a\xd0" + - ("\x20" if idx == 0 or idx == 3 else "\x00") + - "\x00\x00") - - if car_fingerprint == CAR.CIVIC: - msg_0x301 = "\x02\x38\x44\x32\x4f\x00\x00" - commands.append(make_can_msg(0x300, msg_0x300, idx + 8, 1)) # add 8 on idx. - else: - if car_fingerprint == CAR.CRV: - msg_0x301 = "\x00\x00\x50\x02\x51\x00\x00" - elif car_fingerprint == CAR.ACURA_RDX: - msg_0x301 = "\x0f\x57\x4f\x02\x5a\x00\x00" - elif car_fingerprint == CAR.ODYSSEY: - msg_0x301 = "\x00\x00\x56\x02\x55\x00\x00" - elif car_fingerprint == CAR.ACURA_ILX: - msg_0x301 = "\x0f\x18\x51\x02\x5a\x00\x00" - elif car_fingerprint == CAR.PILOT: - msg_0x301 = "\x00\x00\x56\x02\x58\x00\x00" - elif car_fingerprint == CAR.RIDGELINE: - msg_0x301 = "\x00\x00\x56\x02\x57\x00\x00" - commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) - - commands.append(make_can_msg(0x301, msg_0x301, idx, 1)) - return commands - def spam_buttons_command(packer, button_val, idx): values = { 'CRUISE_BUTTONS': button_val, diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index db02a9725a969e..4072b035480af9 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -8,9 +8,9 @@ from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET, get_events from selfdrive.controls.lib.vehicle_model import VehicleModel -from selfdrive.car.honda.carstate import CarState, get_can_parser -from selfdrive.car.honda.values import CruiseButtons, CM, BP, AH, CAR, HONDA_BOSCH -from selfdrive.controls.lib.planner import A_ACC_MAX +from selfdrive.car.honda.carstate import CarState, get_can_parser, get_cam_can_parser +from selfdrive.car.honda.values import CruiseButtons, CAR, HONDA_BOSCH, AUDIO_HUD, VISUAL_HUD +from selfdrive.controls.lib.planner import _A_CRUISE_MAX_V_FOLLOWING try: from selfdrive.car.honda.carcontroller import CarController @@ -22,6 +22,8 @@ # those messages are mutually exclusive on CRV and non-CRV cars CAMERA_MSGS = [0xe4, 0x194] +A_ACC_MAX = max(_A_CRUISE_MAX_V_FOLLOWING) + def compute_gb_honda(accel, speed): creep_brake = 0.0 @@ -87,8 +89,10 @@ def __init__(self, CP, sendcan=None): self.gas_pressed_prev = False self.brake_pressed_prev = False self.can_invalid_count = 0 + self.cam_can_invalid_count = 0 self.cp = get_can_parser(CP) + self.cp_cam = get_cam_can_parser(CP) # *** init the major players *** self.CS = CarState(CP) @@ -106,6 +110,12 @@ def __init__(self, CP, sendcan=None): @staticmethod def calc_accel_override(a_ego, a_target, v_ego, v_target): + + # normalized max accel. Allowing max accel at low speed causes speed overshoots + max_accel_bp = [10, 20] # m/s + max_accel_v = [0.714, 1.0] # unit of max accel + max_accel = interp(v_ego, max_accel_bp, max_accel_v) + # limit the pcm accel cmd if: # - v_ego exceeds v_target, or # - a_ego exceeds a_target and v_ego is close to v_target @@ -128,7 +138,7 @@ def calc_accel_override(a_ego, a_target, v_ego, v_target): # accelOverride is more or less the max throttle allowed to pcm: usually set to a constant # unless aTargetMax is very high and then we scale with it; this help in quicker restart - return float(max(0.714, a_target / A_ACC_MAX)) * min(speedLimiter, accelLimiter) + return float(max(max_accel, a_target / A_ACC_MAX)) * min(speedLimiter, accelLimiter) @staticmethod def get_params(candidate, fingerprint): @@ -141,10 +151,13 @@ def get_params(candidate, fingerprint): ret.safetyModel = car.CarParams.SafetyModels.hondaBosch ret.enableCamera = True ret.radarOffCan = True + ret.openpilotLongitudinalControl = False else: ret.safetyModel = car.CarParams.SafetyModels.honda ret.enableCamera = not any(x for x in CAMERA_MSGS if x in fingerprint) ret.enableGasInterceptor = 0x201 in fingerprint + ret.openpilotLongitudinalControl = ret.enableCamera + cloudlog.warn("ECU Camera Simulated: %r", ret.enableCamera) cloudlog.warn("ECU Gas Interceptor: %r", ret.enableGasInterceptor) @@ -174,7 +187,7 @@ def get_params(candidate, fingerprint): ret.steerKf = 0.00006 # conservative feed-forward - if candidate == CAR.CIVIC: + if candidate in [CAR.CIVIC, CAR.CIVIC_BOSCH]: stop_and_go = True ret.mass = mass_civic ret.wheelbase = wheelbase_civic @@ -183,30 +196,19 @@ def get_params(candidate, fingerprint): tire_stiffness_factor = 1. # Civic at comma has modified steering FW, so different tuning for the Neo in that car is_fw_modified = os.getenv("DONGLE_ID") in ['99c94dc769b5d96e'] - ret.steerKpV, ret.steerKiV = [[0.33], [0.10]] if is_fw_modified else [[0.8], [0.24]] + ret.steerKpV, ret.steerKiV = [[0.4], [0.12]] if is_fw_modified else [[0.8], [0.24]] if is_fw_modified: - ret.steerKf = 0.00003 + tire_stiffness_factor = 0.9 + ret.steerKf = 0.00004 ret.longitudinalKpBP = [0., 5., 35.] ret.longitudinalKpV = [3.6, 2.4, 1.5] ret.longitudinalKiBP = [0., 35.] ret.longitudinalKiV = [0.54, 0.36] - elif candidate == CAR.CIVIC_HATCH: - stop_and_go = True - ret.mass = 2916. * CV.LB_TO_KG + std_cargo - ret.wheelbase = wheelbase_civic - ret.centerToFront = centerToFront_civic - ret.steerRatio = 14.63 # 10.93 is spec end-to-end - tire_stiffness_factor = 1. - ret.steerKpV, ret.steerKiV = [[0.8], [0.24]] - ret.longitudinalKpBP = [0., 5., 35.] - ret.longitudinalKpV = [1.2, 0.8, 0.5] - ret.longitudinalKiBP = [0., 35.] - ret.longitudinalKiV = [0.18, 0.12] - - elif candidate == CAR.ACCORD: + elif candidate in (CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH): stop_and_go = True - ret.safetyParam = 1 # Accord and CRV 5G use an alternate user brake msg + if not candidate == CAR.ACCORDH: # Hybrid uses same brake msg as hatch + ret.safetyParam = 1 # Accord and CRV 5G use an alternate user brake msg ret.mass = 3279. * CV.LB_TO_KG + std_cargo ret.wheelbase = 2.83 ret.centerToFront = ret.wheelbase * 0.39 @@ -225,11 +227,7 @@ def get_params(candidate, fingerprint): ret.centerToFront = ret.wheelbase * 0.37 ret.steerRatio = 18.61 # 15.3 is spec end-to-end tire_stiffness_factor = 0.72 - # Acura at comma has modified steering FW, so different tuning for the Neo in that car - is_fw_modified = os.getenv("DONGLE_ID") in ['ff83f397542ab647'] - ret.steerKpV, ret.steerKiV = [[0.45], [0.00]] if is_fw_modified else [[0.8], [0.24]] - if is_fw_modified: - ret.steerKf = 0.00003 + ret.steerKpV, ret.steerKiV = [[0.8], [0.24]] ret.longitudinalKpBP = [0., 5., 35.] ret.longitudinalKpV = [1.2, 0.8, 0.5] ret.longitudinalKiBP = [0., 35.] @@ -262,6 +260,20 @@ def get_params(candidate, fingerprint): ret.longitudinalKiBP = [0., 35.] ret.longitudinalKiV = [0.18, 0.12] + elif candidate == CAR.CRV_HYBRID: + stop_and_go = True + ret.safetyParam = 1 # Accord and CRV 5G use an alternate user brake msg + ret.mass = 1667. + std_cargo # mean of 4 models in kg + ret.wheelbase = 2.66 + ret.centerToFront = ret.wheelbase * 0.41 + ret.steerRatio = 16.0 # 12.3 is spec end-to-end + tire_stiffness_factor = 0.677 + ret.steerKpV, ret.steerKiV = [[0.6], [0.18]] + ret.longitudinalKpBP = [0., 5., 35.] + ret.longitudinalKpV = [1.2, 0.8, 0.5] + ret.longitudinalKiBP = [0., 35.] + ret.longitudinalKiV = [0.18, 0.12] + elif candidate == CAR.ACURA_RDX: stop_and_go = False ret.mass = 3935 * CV.LB_TO_KG + std_cargo @@ -277,18 +289,31 @@ def get_params(candidate, fingerprint): elif candidate == CAR.ODYSSEY: stop_and_go = False - ret.mass = 4354 * CV.LB_TO_KG + std_cargo + ret.mass = 4471 * CV.LB_TO_KG + std_cargo ret.wheelbase = 3.00 ret.centerToFront = ret.wheelbase * 0.41 ret.steerRatio = 14.35 # as spec - tire_stiffness_factor = 0.444 # not optimized yet - ret.steerKpV, ret.steerKiV = [[0.6], [0.18]] + tire_stiffness_factor = 0.82 + ret.steerKpV, ret.steerKiV = [[0.45], [0.135]] + ret.longitudinalKpBP = [0., 5., 35.] + ret.longitudinalKpV = [1.2, 0.8, 0.5] + ret.longitudinalKiBP = [0., 35.] + ret.longitudinalKiV = [0.18, 0.12] + + elif candidate == CAR.ODYSSEY_CHN: + stop_and_go = False + ret.mass = 1849.2 + std_cargo # mean of 4 models in kg + ret.wheelbase = 2.90 # spec + ret.centerToFront = ret.wheelbase * 0.41 # from CAR.ODYSSEY + ret.steerRatio = 14.35 # from CAR.ODYSSEY + tire_stiffness_factor = 0.82 # from CAR.ODYSSEY + ret.steerKpV, ret.steerKiV = [[0.45], [0.135]] ret.longitudinalKpBP = [0., 5., 35.] ret.longitudinalKpV = [1.2, 0.8, 0.5] ret.longitudinalKiBP = [0., 35.] ret.longitudinalKiV = [0.18, 0.12] - elif candidate == CAR.PILOT: + elif candidate in (CAR.PILOT, CAR.PILOT_2019): stop_and_go = False ret.mass = 4303 * CV.LB_TO_KG + std_cargo ret.wheelbase = 2.81 @@ -369,8 +394,9 @@ def update(self, c): canMonoTimes = [] self.cp.update(int(sec_since_boot() * 1e9), False) + self.cp_cam.update(int(sec_since_boot() * 1e9), False) - self.CS.update(self.cp) + self.CS.update(self.cp, self.cp_cam) # create message ret = car.CarState.new_message() @@ -473,8 +499,8 @@ def update(self, c): ret.buttonEvents = buttonEvents # events - # TODO: I don't like the way capnp does enums - # These strings aren't checked at compile time + # TODO: event names aren't checked at compile time. + # Maybe there is a way to use capnp enums directly events = [] if not self.CS.can_valid: self.can_invalid_count += 1 @@ -482,6 +508,15 @@ def update(self, c): events.append(create_event('commIssue', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) else: self.can_invalid_count = 0 + + if not self.CS.cam_can_valid and self.CP.enableCamera: + self.cam_can_invalid_count += 1 + # wait 1.0s before throwing the alert to avoid it popping when you turn off the car + if self.cam_can_invalid_count >= 100 and self.CS.CP.carFingerprint not in HONDA_BOSCH: + events.append(create_event('invalidGiraffeHonda', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT])) + else: + self.cam_can_invalid_count = 0 + if self.CS.steer_error: events.append(create_event('steerUnavailable', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT])) elif self.CS.steer_warning: @@ -500,7 +535,7 @@ def update(self, c): events.append(create_event('wrongCarMode', [ET.NO_ENTRY, ET.USER_DISABLE])) if ret.gearShifter == 'reverse': events.append(create_event('reverseGear', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) - if self.CS.brake_hold: + if self.CS.brake_hold and self.CS.CP.carFingerprint not in HONDA_BOSCH: events.append(create_event('brakeHold', [ET.NO_ENTRY, ET.USER_DISABLE])) if self.CS.park_brake: events.append(create_event('parkBrake', [ET.NO_ENTRY, ET.USER_DISABLE])) @@ -573,37 +608,22 @@ def apply(self, c): else: hud_v_cruise = 255 - hud_alert = { - "none": AH.NONE, - "fcw": AH.FCW, - "steerRequired": AH.STEER, - "brakePressed": AH.BRAKE_PRESSED, - "wrongGear": AH.GEAR_NOT_D, - "seatbeltUnbuckled": AH.SEATBELT, - "speedTooHigh": AH.SPEED_TOO_HIGH}[str(c.hudControl.visualAlert)] - - snd_beep, snd_chime = { - "none": (BP.MUTE, CM.MUTE), - "beepSingle": (BP.SINGLE, CM.MUTE), - "beepTriple": (BP.TRIPLE, CM.MUTE), - "beepRepeated": (BP.REPEATED, CM.MUTE), - "chimeSingle": (BP.MUTE, CM.SINGLE), - "chimeDouble": (BP.MUTE, CM.DOUBLE), - "chimeRepeated": (BP.MUTE, CM.REPEATED), - "chimeContinuous": (BP.MUTE, CM.CONTINUOUS)}[str(c.hudControl.audibleAlert)] - - pcm_accel = int(clip(c.cruiseControl.accelOverride,0,1)*0xc6) - - self.CC.update(self.sendcan, c.enabled, self.CS, self.frame, \ - c.actuators, \ - c.cruiseControl.speedOverride, \ - c.cruiseControl.override, \ - c.cruiseControl.cancel, \ - pcm_accel, \ - hud_v_cruise, c.hudControl.lanesVisible, \ - hud_show_car = c.hudControl.leadVisible, \ - hud_alert = hud_alert, \ - snd_beep = snd_beep, \ - snd_chime = snd_chime) + hud_alert = VISUAL_HUD[c.hudControl.visualAlert.raw] + snd_beep, snd_chime = AUDIO_HUD[c.hudControl.audibleAlert.raw] + + pcm_accel = int(clip(c.cruiseControl.accelOverride, 0, 1) * 0xc6) + + self.CC.update(self.sendcan, c.enabled, self.CS, self.frame, + c.actuators, + c.cruiseControl.speedOverride, + c.cruiseControl.override, + c.cruiseControl.cancel, + pcm_accel, + hud_v_cruise, + c.hudControl.lanesVisible, + hud_show_car=c.hudControl.leadVisible, + hud_alert=hud_alert, + snd_beep=snd_beep, + snd_chime=snd_chime) self.frame += 1 diff --git a/selfdrive/car/honda/radar_interface.py b/selfdrive/car/honda/radar_interface.py index 3081474487540d..7d30265c2f471e 100755 --- a/selfdrive/car/honda/radar_interface.py +++ b/selfdrive/car/honda/radar_interface.py @@ -28,6 +28,7 @@ def __init__(self, CP): self.pts = {} self.track_id = 0 self.radar_fault = False + self.radar_wrong_config = False self.radar_off_can = CP.radarOffCan self.delay = 0.1 # Delay of radar @@ -61,6 +62,7 @@ def update(self): if ii == 0x400: # check for radar faults self.radar_fault = cpt['RADAR_STATE'] != 0x79 + self.radar_wrong_config = cpt['RADAR_STATE'] == 0x69 elif cpt['LONG_DIST'] < 255: if ii not in self.pts or cpt['NEW_TRACK']: self.pts[ii] = car.RadarState.RadarPoint.new_message() @@ -81,6 +83,8 @@ def update(self): errors.append("commIssue") if self.radar_fault: errors.append("fault") + if self.radar_wrong_config: + errors.append("wrongConfig") ret.errors = errors ret.canMonoTimes = canMonoTimes diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index b15a90a6e25de6..f106ccab34054c 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -1,5 +1,9 @@ +from cereal import car from selfdrive.car import dbc_dict +AudibleAlert = car.CarControl.HUDControl.AudibleAlert +VisualAlert = car.CarControl.HUDControl.VisualAlert + # Car button codes class CruiseButtons: RES_ACCEL = 4 @@ -7,7 +11,6 @@ class CruiseButtons: CANCEL = 2 MAIN = 1 - #car chimes: enumeration from dbc file. Chimes are for alerts and warnings class CM: MUTE = 0 @@ -16,14 +19,23 @@ class CM: REPEATED = 1 CONTINUOUS = 2 - -#car beepss: enumeration from dbc file. Beeps are for activ and deactiv +#car beeps: enumeration from dbc file. Beeps are for engage and disengage class BP: MUTE = 0 SINGLE = 3 TRIPLE = 2 REPEATED = 1 +AUDIO_HUD = { + AudibleAlert.none: (BP.MUTE, CM.MUTE), + AudibleAlert.chimeEngage: (BP.SINGLE, CM.MUTE), + AudibleAlert.chimeDisengage: (BP.SINGLE, CM.MUTE), + AudibleAlert.chimeError: (BP.MUTE, CM.DOUBLE), + AudibleAlert.chimePrompt: (BP.MUTE, CM.SINGLE), + AudibleAlert.chimeWarning1: (BP.MUTE, CM.DOUBLE), + AudibleAlert.chimeWarning2: (BP.MUTE, CM.REPEATED), + AudibleAlert.chimeWarningRepeat: (BP.MUTE, CM.REPEATED)} + class AH: #[alert_idx, value] # See dbc files for info on values" @@ -35,77 +47,150 @@ class AH: SEATBELT = [5, 5] SPEED_TOO_HIGH = [6, 8] +VISUAL_HUD = { + VisualAlert.none: AH.NONE, + VisualAlert.fcw: AH.FCW, + VisualAlert.steerRequired: AH.STEER, + VisualAlert.brakePressed: AH.BRAKE_PRESSED, + VisualAlert.wrongGear: AH.GEAR_NOT_D, + VisualAlert.seatbeltUnbuckled: AH.SEATBELT, + VisualAlert.speedTooHigh: AH.SPEED_TOO_HIGH} class CAR: ACCORD = "HONDA ACCORD 2018 SPORT 2T" + ACCORD_15 = "HONDA ACCORD 2018 LX 1.5T" + ACCORDH = "HONDA ACCORD 2018 HYBRID TOURING" CIVIC = "HONDA CIVIC 2016 TOURING" - CIVIC_HATCH = "HONDA CIVIC HATCHBACK 2017 EX" + CIVIC_BOSCH = "HONDA CIVIC HATCHBACK 2017 SEDAN/COUPE 2019" ACURA_ILX = "ACURA ILX 2016 ACURAWATCH PLUS" CRV = "HONDA CR-V 2016 TOURING" CRV_5G = "HONDA CR-V 2017 EX" + CRV_HYBRID = "HONDA CR-V 2019 HYBRID" ODYSSEY = "HONDA ODYSSEY 2018 EX-L" + ODYSSEY_CHN = "HONDA ODYSSEY 2019 EXCLUSIVE CHN" ACURA_RDX = "ACURA RDX 2018 ACURAWATCH PLUS" PILOT = "HONDA PILOT 2017 TOURING" + PILOT_2019 = "HONDA PILOT 2019 ELITE" RIDGELINE = "HONDA RIDGELINE 2017 BLACK EDITION" - FINGERPRINTS = { CAR.ACCORD: [{ - 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 387: 8, 388: 8, 399: 7, 419: 8, 420: 8, 427: 3, 432: 7, 441: 5, 446: 3, 450: 8, 464: 8, 477: 8, 479: 8, 495: 8, 525: 8, 545: 6, 662: 4, 773: 7, 777: 8, 780: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 927: 8, 929: 8, 1302: 8, 1600: 5, 1601: 8, 1652: 8 + 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 419: 8, 420: 8, 427: 3, 432: 7, 441: 5, 446: 3, 450: 8, 464: 8, 477: 8, 479: 8, 495: 8, 545: 6, 662: 4, 773: 7, 777: 8, 780: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 927: 8, 929: 8, 1302: 8, 1600: 5, 1601: 8, 1652: 8 + }], + CAR.ACCORD_15: [{ + 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 427: 3, 432: 7, 441: 5, 446: 3, 450: 8, 464: 8, 477: 8, 479: 8, 495: 8, 545: 6, 662: 4, 773: 7, 777: 8, 780: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 927: 8, 929: 8, 1302: 8, 1600: 5, 1601: 8, 1652: 8 + }], + CAR.ACCORDH: [{ + 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 387: 8, 388: 8, 399: 7, 419: 8, 420: 8, 427: 3, 432: 7, 441: 5, 450: 8, 464: 8, 477: 8, 479: 8, 495: 8, 525: 8, 545: 6, 662: 4, 773: 7, 777: 8, 780: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 927: 8, 929: 8, 1302: 8, 1600: 5, 1601: 8, 1652: 8 }], CAR.ACURA_ILX: [{ - 1024: 5, 513: 6, 1027: 5, 1029: 8, 929: 4, 1057: 5, 777: 8, 1034: 5, 1036: 8, 398: 3, 399: 7, 145: 8, 660: 8, 985: 3, 923: 2, 542: 7, 773: 7, 800: 8, 432: 7, 419: 8, 420: 8, 1030: 5, 422: 8, 808: 8, 428: 8, 304: 8, 819: 7, 821: 5, 57: 3, 316: 8, 545: 4, 464: 8, 1108: 8, 597: 8, 342: 6, 983: 8, 344: 8, 804: 8, 1039: 8, 476: 4, 892: 8, 490: 8, 1064: 7, 882: 2, 884: 7, 887: 8, 888: 8, 380: 8, 1365: 5, - # sent messages - 0xe4: 5, 0x1fa: 8, 0x200: 6, 0x30c: 8, 0x33d: 5, - }], + 57: 3, 145: 8, 228: 5, 304: 8, 316: 8, 342: 6, 344: 8, 380: 8, 398: 3, 399: 7, 419: 8, 420: 8, 422: 8, 428: 8, 432: 7, 464: 8, 476: 4, 490: 8, 506: 8, 512: 6, 513: 6, 542: 7, 545: 4, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 829: 5, 882: 2, 884: 7, 887: 8, 888: 8, 892: 8, 923: 2, 929: 4, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1030: 5, 1034: 5, 1036: 8, 1039: 8, 1057: 5, 1064: 7, 1108: 8, 1365: 5, + }], + # Acura RDX w/ Added Comma Pedal Support (512L & 513L) CAR.ACURA_RDX: [{ - 57: 3, 145: 8, 229: 4, 308: 5, 316: 8, 342: 6, 344: 8, 380: 8, 392: 6, 398: 3, 399: 6, 404: 4, 420: 8, 422: 8, 426: 8, 432: 7, 464: 8, 474: 5, 476: 4, 487: 4, 490: 8, 506: 8, 542: 7, 545: 4, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 829: 5, 882: 2, 884: 7, 887: 8, 888: 8, 892: 8, 923: 2, 929: 4, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1033: 5, 1034: 5, 1036: 8, 1039: 8, 1057: 5, 1064: 7, 1108: 8, 1365: 5, 1424: 5, 1729: 1 - }], + 57: 3, 145: 8, 229: 4, 308: 5, 316: 8, 342: 6, 344: 8, 380: 8, 392: 6, 398: 3, 399: 6, 404: 4, 420: 8, 422: 8, 426: 8, 432: 7, 464: 8, 474: 5, 476: 4, 487: 4, 490: 8, 506: 8, 512: 6, 513: 6, 542: 7, 545: 4, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 829: 5, 882: 2, 884: 7, 887: 8, 888: 8, 892: 8, 923: 2, 929: 4, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1033: 5, 1034: 5, 1036: 8, 1039: 8, 1057: 5, 1064: 7, 1108: 8, 1365: 5, 1424: 5, 1729: 1 + }], CAR.CIVIC: [{ - 1024: 5, 513: 6, 1027: 5, 1029: 8, 777: 8, 1036: 8, 1039: 8, 1424: 5, 401: 8, 148: 8, 662: 4, 985: 3, 795: 8, 773: 7, 800: 8, 545: 6, 420: 8, 806: 8, 808: 8, 1322: 5, 427: 3, 428: 8, 304: 8, 432: 7, 57: 3, 450: 8, 929: 8, 330: 8, 1302: 8, 464: 8, 1361: 5, 1108: 8, 597: 8, 470: 2, 344: 8, 804: 8, 399: 7, 476: 7, 1633: 8, 487: 4, 892: 8, 490: 8, 493: 5, 884: 8, 891: 8, 380: 8, 1365: 5, - # sent messages - 0xe4: 5, 0x1fa: 8, 0x200: 6, 0x30c: 8, 0x33d: 5, 0x35e: 8, 0x39f: 8, - }], - CAR.CIVIC_HATCH: [{ - 57: 3, 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 427: 3, 428: 8, 432: 7, 441: 5, 450: 8, 464: 8, 470: 2, 476: 7, 477: 8, 479: 8, 490: 8, 493: 5, 495: 8, 506: 8, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 892: 8, 927: 8, 929: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1108: 8, 1302: 8, 1322: 5, 1361: 5, 1365: 5, 1424: 5, 1600: 5, 1601: 8, 1633: 8 - }], + 57: 3, 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 427: 3, 428: 8, 432: 7, 450: 8, 464: 8, 470: 2, 476: 7, 487: 4, 490: 8, 493: 5, 506: 8, 512: 6, 513: 6, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 892: 8, 927: 8, 929: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1108: 8, 1302: 8, 1322: 5, 1361: 5, 1365: 5, 1424: 5, 1633: 8, + }], + CAR.CIVIC_BOSCH: [{ + # 2017 Civic Hatchback EX and 2019 Civic Sedan Touring Canadian + 57: 3, 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 427: 3, 428: 8, 432: 7, 441: 5, 450: 8, 464: 8, 470: 2, 476: 7, 477: 8, 479: 8, 490: 8, 493: 5, 495: 8, 506: 8, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 892: 8, 927: 8, 929: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1108: 8, 1302: 8, 1322: 5, 1361: 5, 1365: 5, 1424: 5, 1600: 5, 1601: 8, 1633: 8, + }], CAR.CRV: [{ - 57: 3, 145: 8, 316: 8, 340: 8, 342: 6, 344: 8, 380: 8, 398: 3, 399: 6, 401: 8, 420: 8, 422: 8, 426: 8, 432: 7, 464: 8, 474: 5, 476: 4, 487: 4, 490: 8, 493: 3, 507: 1, 542: 7, 545: 4, 597: 8, 660: 8, 661: 4, 773: 7, 777: 8, 800: 8, 804: 8, 808: 8, 882: 2, 884: 7, 888: 8, 891: 8, 892: 8, 923: 2, 929: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1033: 5, 1036: 8, 1039: 8, 1057: 5, 1064: 7, 1108: 8, 1125: 8, 1296: 8, 1365: 5, 1424: 5, 1600: 5, 1601: 8, - # sent messages - 0x194: 4, 0x1fa: 8, 0x30c: 8, 0x33d: 5, - }], + 57: 3, 145: 8, 316: 8, 340: 8, 342: 6, 344: 8, 380: 8, 398: 3, 399: 6, 401: 8, 404: 4, 420: 8, 422: 8, 426: 8, 432: 7, 464: 8, 474: 5, 476: 4, 487: 4, 490: 8, 493: 3, 506: 8, 507: 1, 512: 6, 513: 6, 542: 7, 545: 4, 597: 8, 660: 8, 661: 4, 773: 7, 777: 8, 780: 8, 800: 8, 804: 8, 808: 8, 829: 5, 882: 2, 884: 7, 888: 8, 891: 8, 892: 8, 923: 2, 929: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1033: 5, 1036: 8, 1039: 8, 1057: 5, 1064: 7, 1108: 8, 1125: 8, 1296: 8, 1365: 5, 1424: 5, 1600: 5, 1601: 8, + }], CAR.CRV_5G: [{ 57: 3, 148: 8, 199: 4, 228: 5, 231: 5, 232: 7, 304: 8, 330: 8, 340: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 423: 2, 427: 3, 428: 8, 432: 7, 441: 5, 446: 3, 450: 8, 464: 8, 467: 2, 469: 3, 470: 2, 474: 8, 476: 7, 477: 8, 479: 8, 490: 8, 493: 5, 495: 8, 507: 1, 545: 6, 597: 8, 661: 4, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 814: 4, 815: 8, 817: 4, 825: 4, 829: 5, 862: 8, 881: 8, 882: 4, 884: 8, 888: 8, 891: 8, 927: 8, 918: 7, 929: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1064: 7, 1108: 8, 1092: 1, 1115: 4, 1125: 8, 1127: 2, 1296: 8, 1302: 8, 1322: 5, 1361: 5, 1365: 5, 1424: 5, 1600: 5, 1601: 8, 1618: 5, 1633: 8, 1670: 5 - }], + }], + CAR.CRV_HYBRID: [{ + 57: 3, 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 387: 8, 388: 8, 399: 7, 419: 8, 420: 8, 427: 3, 432: 7, 441: 5, 450: 8, 464: 8, 477: 8, 479: 8, 490: 8, 495: 8, 525: 8, 531: 8, 545: 6, 662: 4, 773: 7, 777: 8, 780: 8, 804: 8, 806: 8, 808: 8, 814: 4, 829: 5, 833: 6, 862: 8, 884: 8, 891: 8, 927: 8, 929: 8, 1302: 8, 1361: 5, 1365: 5, 1600: 5, 1601: 8 + }], + # 2018 Odyssey w/ Added Comma Pedal Support (512L & 513L) CAR.ODYSSEY: [{ - 57: 3, 148: 8, 228: 5, 229: 4, 316: 8, 342: 6, 344: 8, 380: 8, 399: 7, 411: 5, 419: 8, 420: 8, 427: 3, 432: 7, 450: 8, 463: 8, 464: 8, 476: 4, 490: 8, 506: 8, 542: 7, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 817: 4, 819: 7, 821: 5, 825: 4, 829: 5, 837: 5, 856: 7, 862: 8, 871: 8, 881: 8, 882: 4, 884: 8, 891: 8, 892: 8, 905: 8, 923: 2, 927: 8, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1029: 8, 1036: 8, 1052: 8, 1064: 7, 1088: 8, 1089: 8, 1092: 1, 1108: 8, 1110: 8, 1125: 8, 1296: 8, 1302: 8, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1614: 5, 1615: 8, 1616: 5, 1619: 5, 1623: 5, 1668: 5 - }, - # Odyssey Elite + 57: 3, 148: 8, 228: 5, 229: 4, 316: 8, 342: 6, 344: 8, 380: 8, 399: 7, 411: 5, 419: 8, 420: 8, 427: 3, 432: 7, 450: 8, 463: 8, 464: 8, 476: 4, 490: 8, 506: 8, 512: 6, 513: 6, 542: 7, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 817: 4, 819: 7, 821: 5, 825: 4, 829: 5, 837: 5, 856: 7, 862: 8, 871: 8, 881: 8, 882: 4, 884: 8, 891: 8, 892: 8, 905: 8, 923: 2, 927: 8, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1029: 8, 1036: 8, 1052: 8, 1064: 7, 1088: 8, 1089: 8, 1092: 1, 1108: 8, 1110: 8, 1125: 8, 1296: 8, 1302: 8, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1614: 5, 1615: 8, 1616: 5, 1619: 5, 1623: 5, 1668: 5 + }, + # 2018 Odyssey Elite w/ Added Comma Pedal Support (512L & 513L) { 57: 3, 148: 8, 228: 5, 229: 4, 304: 8, 342: 6, 344: 8, 380: 8, 399: 7, 411: 5, 419: 8, 420: 8, 427: 3, 432: 7, 440: 8, 450: 8, 463: 8, 464: 8, 476: 4, 490: 8, 506: 8, 507: 1, 542: 7, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 817: 4, 819: 7, 821: 5, 825: 4, 829: 5, 837: 5, 856: 7, 862: 8, 871: 8, 881: 8, 882: 4, 884: 8, 891: 8, 892: 8, 905: 8, 923: 2, 927: 8, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1029: 8, 1036: 8, 1052: 8, 1064: 7, 1088: 8, 1089: 8, 1092: 1, 1108: 8, 1110: 8, 1125: 8, 1296: 8, 1302: 8, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1614: 5, 1616: 5, 1619: 5, 1623: 5, 1668: 5 - }], - # Includes 2017 Touring and 2016 EX-L messaging. + }], + CAR.ODYSSEY_CHN: [{ + 57: 3, 145: 8, 316: 8, 342: 6, 344: 8, 380: 8, 398: 3, 399: 7, 401: 8, 404: 4, 411: 5, 420: 8, 422: 8, 423: 2, 426: 8, 432: 7, 450: 8, 464: 8, 490: 8, 506: 8, 507: 1, 597: 8, 610: 8, 611: 8, 612: 8, 617: 8, 660: 8, 661: 4, 773: 7, 780: 8, 804: 8, 808: 8, 829: 5, 862: 8, 884: 7, 892: 8, 923: 2, 929: 8, 1030: 5, 1137: 8, 1302: 8, 1348: 5, 1361: 5, 1365: 5, 1600: 5, 1601: 8, 1639: 8 + }], + # 2017 Pilot Touring AND 2016 Pilot EX-L w/ Added Comma Pedal Support (512L & 513L) CAR.PILOT: [{ - 57: 3, 145: 8, 228: 5, 229: 4, 308: 5, 316: 8, 334: 8, 339: 7, 342: 6, 344: 8, 379: 8, 380: 8, 392: 6, 399: 7, 419: 8, 420: 8, 422: 8, 425: 8, 426: 8, 427: 3, 432: 7, 463: 8, 464: 8, 476: 4, 490: 8, 506: 8, 507: 1, 538: 3, 542: 7, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 829: 5, 837: 5, 856: 7, 871: 8, 882: 2, 884: 7, 891: 8, 892: 8, 923: 2, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1064: 7, 1088: 8, 1089: 8, 1108: 8, 1125: 8, 1296: 8, 1424: 5, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1616: 5, 1618: 5, 1668: 5 - }], + 57: 3, 145: 8, 228: 5, 229: 4, 308: 5, 316: 8, 334: 8, 339: 7, 342: 6, 344: 8, 379: 8, 380: 8, 392: 6, 399: 7, 419: 8, 420: 8, 422: 8, 425: 8, 426: 8, 427: 3, 432: 7, 463: 8, 464: 8, 476: 4, 490: 8, 506: 8, 507: 1, 512: 6, 513: 6, 538: 3, 542: 7, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 829: 5, 837: 5, 856: 7, 871: 8, 882: 2, 884: 7, 891: 8, 892: 8, 923: 2, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1064: 7, 1088: 8, 1089: 8, 1108: 8, 1125: 8, 1296: 8, 1424: 5, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1616: 5, 1618: 5, 1668: 5 + }], + CAR.PILOT_2019: [{ + 57: 3, 145: 8, 228: 5, 308: 5, 316: 8, 334: 8, 342: 6, 344: 8, 379: 8, 380: 8, 399: 7, 411: 5, 419: 8, 420: 8, 422: 8, 425: 8, 426: 8, 427: 3, 432: 7, 463: 8, 464: 8, 476: 4, 490: 8, 506: 8, 538: 3, 542: 7, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 808: 8, 817: 4, 819: 7, 821: 5, 825: 4, 829: 5, 837: 5, 856: 7, 871: 8, 881: 8, 882: 2, 884: 7, 891: 8, 892: 8, 923: 2, 927: 8, 929: 8, 983: 8, 985: 3, 1029: 8, 1052: 8, 1064: 7, 1088: 8, 1089: 8, 1092: 1, 1108: 8, 1110: 8, 1125: 8, 1296: 8, 1424: 5, 1445: 8, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1614: 5, 1615: 8, 1616: 5, 1617: 8, 1618: 5, 1623: 5, 1668: 5 + }, + # 2019 Pilot EX-L + { + 57: 3, 145: 8, 228: 5, 229: 4, 308: 5, 316: 8, 339: 7, 342: 6, 344: 8, 380: 8, 392: 6, 399: 7, 411: 5, 419: 8, 420: 8, 422: 8, 425: 8, 426: 8, 427: 3, 432: 7, 464: 8, 476: 4, 490: 8, 506: 8, 542: 7, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 808: 8, 817: 4, 819: 7, 821: 5, 829: 5, 871: 8, 881: 8, 882: 2, 884: 7, 891: 8, 892: 8, 923: 2, 927: 8, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1027: 5, 1029: 8, 1039: 8, 1064: 7, 1088: 8, 1089: 8, 1092: 1, 1108: 8, 1125: 8, 1296: 8, 1424: 5, 1445: 8, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1616: 5, 1617: 8, 1618: 5, 1623: 5, 1668: 5 + }], + # Ridgeline w/ Added Comma Pedal Support (512L & 513L) CAR.RIDGELINE: [{ - 57: 3, 145: 8, 228: 5, 229: 4, 308: 5, 316: 8, 339: 7, 342: 6, 344: 8, 380: 8, 392: 6, 399: 7, 419: 8, 420: 8, 422: 8, 425: 8, 426: 8, 427: 3, 432: 7, 464: 8, 471: 3, 476: 4, 490: 8, 506: 8, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 829: 5, 871: 8, 882: 2, 884: 7, 892: 8, 923: 2, 927: 8, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1064: 7, 1088: 8, 1089: 8, 1108: 8, 1125: 8, 1296: 8, 1365: 5, 1424: 5, 1600: 5, 1601: 8, 1613: 5, 1616: 5, 1618: 5, 1668: 5, 2015: 3 + 57: 3, 145: 8, 228: 5, 229: 4, 308: 5, 316: 8, 339: 7, 342: 6, 344: 8, 380: 8, 392: 6, 399: 7, 419: 8, 420: 8, 422: 8, 425: 8, 426: 8, 427: 3, 432: 7, 464: 8, 471: 3, 476: 4, 490: 8, 506: 8, 512: 6, 513: 6, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 829: 5, 871: 8, 882: 2, 884: 7, 892: 8, 923: 2, 927: 8, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1064: 7, 1088: 8, 1089: 8, 1108: 8, 1125: 8, 1296: 8, 1365: 5, 1424: 5, 1600: 5, 1601: 8, 1613: 5, 1616: 5, 1618: 5, 1668: 5, 2015: 3 + }, + # 2019 Ridgeline + { + 57: 3, 145: 8, 229: 4, 308: 5, 316: 8, 339: 7, 342: 6, 344: 8, 380: 8, 392: 6, 399: 7, 419: 8, 420: 8, 422:8, 425: 8, 426: 8, 427: 3, 432: 7, 464: 8, 476: 4, 490: 8, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 795: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 871: 8, 882: 2, 884: 7, 892: 8, 923: 2, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1064: 7, 1088: 8, 1089: 8, 1092: 1, 1108: 8, 1125: 8, 1296: 8, 1365: 5, 424: 5, 1613: 5, 1616: 5, 1618: 5, 1623: 5, 1668: 5 }] } - DBC = { CAR.ACCORD: dbc_dict('honda_accord_s2t_2018_can_generated', None), + CAR.ACCORD_15: dbc_dict('honda_accord_lx15t_2018_can_generated', None), + CAR.ACCORDH: dbc_dict('honda_accord_s2t_2018_can_generated', None), CAR.ACURA_ILX: dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.ACURA_RDX: dbc_dict('acura_rdx_2018_can_generated', 'acura_ilx_2016_nidec'), CAR.CIVIC: dbc_dict('honda_civic_touring_2016_can_generated', 'acura_ilx_2016_nidec'), - CAR.CIVIC_HATCH: dbc_dict('honda_civic_hatchback_ex_2017_can_generated', None), + CAR.CIVIC_BOSCH: dbc_dict('honda_civic_hatchback_ex_2017_can_generated', None), CAR.CRV: dbc_dict('honda_crv_touring_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.CRV_5G: dbc_dict('honda_crv_ex_2017_can_generated', None), + CAR.CRV_HYBRID: dbc_dict('honda_crv_hybrid_2019_can_generated', None), CAR.ODYSSEY: dbc_dict('honda_odyssey_exl_2018_generated', 'acura_ilx_2016_nidec'), + CAR.ODYSSEY_CHN: dbc_dict('honda_odyssey_extreme_edition_2018_china_can', 'acura_ilx_2016_nidec'), CAR.PILOT: dbc_dict('honda_pilot_touring_2017_can_generated', 'acura_ilx_2016_nidec'), + CAR.PILOT_2019: dbc_dict('honda_pilot_touring_2017_can_generated', 'acura_ilx_2016_nidec'), CAR.RIDGELINE: dbc_dict('honda_ridgeline_black_edition_2017_can_generated', 'acura_ilx_2016_nidec'), } +STEER_THRESHOLD = { + CAR.ACCORD: 1200, + CAR.ACCORD_15: 1200, + CAR.ACCORDH: 1200, + CAR.ACURA_ILX: 1200, + CAR.ACURA_RDX: 400, + CAR.CIVIC: 1200, + CAR.CIVIC_BOSCH: 1200, + CAR.CRV: 1200, + CAR.CRV_5G: 1200, + CAR.CRV_HYBRID: 1200, + CAR.ODYSSEY: 1200, + CAR.ODYSSEY_CHN: 1200, + CAR.PILOT: 1200, + CAR.PILOT_2019: 1200, + CAR.RIDGELINE: 1200, +} + +SPEED_FACTOR = { + CAR.ACCORD: 1., + CAR.ACCORD_15: 1., + CAR.ACCORDH: 1., + CAR.ACURA_ILX: 1., + CAR.ACURA_RDX: 1., + CAR.CIVIC: 1., + CAR.CIVIC_BOSCH: 1., + CAR.CRV: 1.025, + CAR.CRV_5G: 1.025, + CAR.CRV_HYBRID: 1.025, + CAR.ODYSSEY: 1., + CAR.ODYSSEY_CHN: 1., + CAR.PILOT: 1., + CAR.PILOT_2019: 1., + CAR.RIDGELINE: 1., +} + # TODO: get these from dbc file -HONDA_BOSCH = [CAR.ACCORD, CAR.CIVIC_HATCH, CAR.CRV_5G] +HONDA_BOSCH = [CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CRV_5G, CAR.CRV_HYBRID] diff --git a/selfdrive/car/hyundai/__init__.py b/selfdrive/car/hyundai/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py new file mode 100644 index 00000000000000..627e27b4c4b012 --- /dev/null +++ b/selfdrive/car/hyundai/carcontroller.py @@ -0,0 +1,76 @@ +from selfdrive.car import apply_std_steer_torque_limits +from selfdrive.boardd.boardd import can_list_to_can_capnp +from selfdrive.car.hyundai.hyundaican import create_lkas11, create_lkas12, \ + create_1191, create_1156, \ + create_clu11 +from selfdrive.car.hyundai.values import Buttons +from selfdrive.can.packer import CANPacker + + +# Steer torque limits + +class SteerLimitParams: + STEER_MAX = 255 # 409 is the max, 255 is stock + STEER_DELTA_UP = 3 + STEER_DELTA_DOWN = 7 + STEER_DRIVER_ALLOWANCE = 50 + STEER_DRIVER_MULTIPLIER = 2 + STEER_DRIVER_FACTOR = 1 + +class CarController(object): + def __init__(self, dbc_name, car_fingerprint, enable_camera): + self.apply_steer_last = 0 + self.car_fingerprint = car_fingerprint + self.lkas11_cnt = 0 + self.cnt = 0 + self.last_resume_cnt = 0 + self.enable_camera = enable_camera + # True when giraffe switch 2 is low and we need to replace all the camera messages + # otherwise we forward the camera msgs and we just replace the lkas cmd signals + self.camera_disconnected = False + + self.packer = CANPacker(dbc_name) + + def update(self, sendcan, enabled, CS, actuators, pcm_cancel_cmd, hud_alert): + + if not self.enable_camera: + return + + ### Steering Torque + apply_steer = actuators.steer * SteerLimitParams.STEER_MAX + + apply_steer = apply_std_steer_torque_limits(apply_steer, self.apply_steer_last, CS.steer_torque_driver, SteerLimitParams) + + if not enabled: + apply_steer = 0 + + steer_req = 1 if enabled else 0 + + self.apply_steer_last = apply_steer + + can_sends = [] + + self.lkas11_cnt = self.cnt % 0x10 + self.clu11_cnt = self.cnt % 0x10 + + if self.camera_disconnected: + if (self.cnt % 10) == 0: + can_sends.append(create_lkas12()) + if (self.cnt % 50) == 0: + can_sends.append(create_1191()) + if (self.cnt % 7) == 0: + can_sends.append(create_1156()) + + can_sends.append(create_lkas11(self.packer, self.car_fingerprint, apply_steer, steer_req, self.lkas11_cnt, + enabled, CS.lkas11, hud_alert, keep_stock=(not self.camera_disconnected))) + + if pcm_cancel_cmd: + can_sends.append(create_clu11(self.packer, CS.clu11, Buttons.CANCEL)) + elif CS.stopped and (self.cnt - self.last_resume_cnt) > 5: + self.last_resume_cnt = self.cnt + can_sends.append(create_clu11(self.packer, CS.clu11, Buttons.RES_ACCEL)) + + ### Send messages to canbus + sendcan.send(can_list_to_can_capnp(can_sends, msgtype='sendcan').to_bytes()) + + self.cnt += 1 diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py new file mode 100644 index 00000000000000..bd3e63740c1646 --- /dev/null +++ b/selfdrive/car/hyundai/carstate.py @@ -0,0 +1,251 @@ +from selfdrive.car.hyundai.values import DBC, STEER_THRESHOLD +from selfdrive.can.parser import CANParser +from selfdrive.config import Conversions as CV +from common.kalman.simple_kalman import KF1D +import numpy as np + + +def get_can_parser(CP): + + signals = [ + # sig_name, sig_address, default + ("WHL_SPD_FL", "WHL_SPD11", 0), + ("WHL_SPD_FR", "WHL_SPD11", 0), + ("WHL_SPD_RL", "WHL_SPD11", 0), + ("WHL_SPD_RR", "WHL_SPD11", 0), + + ("YAW_RATE", "ESP12", 0), + + ("CF_Gway_DrvSeatBeltInd", "CGW4", 1), + + ("CF_Gway_DrvSeatBeltSw", "CGW1", 0), + ("CF_Gway_TSigLHSw", "CGW1", 0), + ("CF_Gway_TurnSigLh", "CGW1", 0), + ("CF_Gway_TSigRHSw", "CGW1", 0), + ("CF_Gway_TurnSigRh", "CGW1", 0), + ("CF_Gway_ParkBrakeSw", "CGW1", 0), + + ("BRAKE_ACT", "EMS12", 0), + ("PV_AV_CAN", "EMS12", 0), + ("TPS", "EMS12", 0), + + ("CYL_PRES", "ESP12", 0), + + ("CF_Clu_CruiseSwState", "CLU11", 0), + ("CF_Clu_CruiseSwMain" , "CLU11", 0), + ("CF_Clu_SldMainSW", "CLU11", 0), + ("CF_Clu_ParityBit1", "CLU11", 0), + ("CF_Clu_VanzDecimal" , "CLU11", 0), + ("CF_Clu_Vanz", "CLU11", 0), + ("CF_Clu_SPEED_UNIT", "CLU11", 0), + ("CF_Clu_DetentOut", "CLU11", 0), + ("CF_Clu_RheostatLevel", "CLU11", 0), + ("CF_Clu_CluInfo", "CLU11", 0), + ("CF_Clu_AmpInfo", "CLU11", 0), + ("CF_Clu_AliveCnt1", "CLU11", 0), + + ("CF_Clu_InhibitD", "CLU15", 0), + ("CF_Clu_InhibitP", "CLU15", 0), + ("CF_Clu_InhibitN", "CLU15", 0), + ("CF_Clu_InhibitR", "CLU15", 0), + + ("CF_Lvr_Gear","LVR12",0), + ("CUR_GR", "TCU12",0), + + ("ACCEnable", "TCS13", 0), + ("ACC_REQ", "TCS13", 0), + ("DriverBraking", "TCS13", 0), + ("DriverOverride", "TCS13", 0), + + ("ESC_Off_Step", "TCS15", 0), + + ("CF_Lvr_GearInf", "LVR11", 0), #Transmission Gear (0 = N or P, 1-8 = Fwd, 14 = Rev) + + ("CR_Mdps_DrvTq", "MDPS11", 0), + + ("CR_Mdps_StrColTq", "MDPS12", 0), + ("CF_Mdps_ToiActive", "MDPS12", 0), + ("CF_Mdps_ToiUnavail", "MDPS12", 0), + ("CF_Mdps_FailStat", "MDPS12", 0), + ("CR_Mdps_OutTq", "MDPS12", 0), + + ("VSetDis", "SCC11", 0), + ("SCCInfoDisplay", "SCC11", 0), + ("ACCMode", "SCC12", 1), + + ("SAS_Angle", "SAS11", 0), + ("SAS_Speed", "SAS11", 0), + ] + + checks = [ + # address, frequency + ("MDPS12", 50), + ("MDPS11", 100), + ("TCS15", 10), + ("TCS13", 50), + ("CLU11", 50), + ("ESP12", 100), + ("EMS12", 100), + ("CGW1", 10), + ("CGW4", 5), + ("WHL_SPD11", 50), + ("SCC11", 50), + ("SCC12", 50), + ("SAS11", 100) + ] + + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0) + +def get_camera_parser(CP): + + signals = [ + # sig_name, sig_address, default + ("CF_Lkas_LdwsSysState", "LKAS11", 0), + ("CF_Lkas_SysWarning", "LKAS11", 0), + ("CF_Lkas_LdwsLHWarning", "LKAS11", 0), + ("CF_Lkas_LdwsRHWarning", "LKAS11", 0), + ("CF_Lkas_HbaLamp", "LKAS11", 0), + ("CF_Lkas_FcwBasReq", "LKAS11", 0), + ("CF_Lkas_ToiFlt", "LKAS11", 0), + ("CF_Lkas_HbaSysState", "LKAS11", 0), + ("CF_Lkas_FcwOpt", "LKAS11", 0), + ("CF_Lkas_HbaOpt", "LKAS11", 0), + ("CF_Lkas_FcwSysState", "LKAS11", 0), + ("CF_Lkas_FcwCollisionWarning", "LKAS11", 0), + ("CF_Lkas_FusionState", "LKAS11", 0), + ("CF_Lkas_FcwOpt_USM", "LKAS11", 0), + ("CF_Lkas_LdwsOpt_USM", "LKAS11", 0) + ] + + checks = [] + + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 2) + +class CarState(object): + def __init__(self, CP): + + self.CP = CP + + # initialize can parser + self.car_fingerprint = CP.carFingerprint + + # vEgo kalman filter + dt = 0.01 + # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]]) + # R = 1e3 + self.v_ego_kf = KF1D(x0=np.matrix([[0.0], [0.0]]), + A=np.matrix([[1.0, dt], [0.0, 1.0]]), + C=np.matrix([1.0, 0.0]), + K=np.matrix([[0.12287673], [0.29666309]])) + self.v_ego = 0.0 + self.left_blinker_on = 0 + self.left_blinker_flash = 0 + self.right_blinker_on = 0 + self.right_blinker_flash = 0 + + def update(self, cp, cp_cam): + # copy can_valid + self.can_valid = cp.can_valid + + # update prevs, update must run once per Loop + self.prev_left_blinker_on = self.left_blinker_on + self.prev_right_blinker_on = self.right_blinker_on + + self.door_all_closed = True + self.seatbelt = cp.vl["CGW1"]['CF_Gway_DrvSeatBeltSw'] + + self.brake_pressed = cp.vl["TCS13"]['DriverBraking'] + self.esp_disabled = cp.vl["TCS15"]['ESC_Off_Step'] + + self.park_brake = cp.vl["CGW1"]['CF_Gway_ParkBrakeSw'] + self.main_on = True + self.acc_active = cp.vl["SCC12"]['ACCMode'] != 0 + self.pcm_acc_status = int(self.acc_active) + + # calc best v_ego estimate, by averaging two opposite corners + self.v_wheel_fl = cp.vl["WHL_SPD11"]['WHL_SPD_FL'] * CV.KPH_TO_MS + self.v_wheel_fr = cp.vl["WHL_SPD11"]['WHL_SPD_FR'] * CV.KPH_TO_MS + self.v_wheel_rl = cp.vl["WHL_SPD11"]['WHL_SPD_RL'] * CV.KPH_TO_MS + self.v_wheel_rr = cp.vl["WHL_SPD11"]['WHL_SPD_RR'] * CV.KPH_TO_MS + v_wheel = (self.v_wheel_fl + self.v_wheel_fr + self.v_wheel_rl + self.v_wheel_rr) / 4. + + self.low_speed_lockout = v_wheel < 1.0 + + # Kalman filter, even though Hyundai raw wheel speed is heaviliy filtered by default + if abs(v_wheel - self.v_ego) > 2.0: # Prevent large accelerations when car starts at non zero speed + self.v_ego_kf.x = np.matrix([[v_wheel], [0.0]]) + + self.v_ego_raw = v_wheel + v_ego_x = self.v_ego_kf.update(v_wheel) + self.v_ego = float(v_ego_x[0]) + self.a_ego = float(v_ego_x[1]) + is_set_speed_in_mph = int(cp.vl["CLU11"]["CF_Clu_SPEED_UNIT"]) + speed_conv = CV.MPH_TO_MS if is_set_speed_in_mph else CV.KPH_TO_MS + self.cruise_set_speed = cp.vl["SCC11"]['VSetDis'] * speed_conv + self.standstill = not v_wheel > 0.1 + + self.angle_steers = cp.vl["SAS11"]['SAS_Angle'] + self.angle_steers_rate = cp.vl["SAS11"]['SAS_Speed'] + self.yaw_rate = cp.vl["ESP12"]['YAW_RATE'] + self.main_on = True + self.left_blinker_on = cp.vl["CGW1"]['CF_Gway_TSigLHSw'] + self.left_blinker_flash = cp.vl["CGW1"]['CF_Gway_TurnSigLh'] + self.right_blinker_on = cp.vl["CGW1"]['CF_Gway_TSigRHSw'] + self.right_blinker_flash = cp.vl["CGW1"]['CF_Gway_TurnSigRh'] + self.steer_override = abs(cp.vl["MDPS11"]['CR_Mdps_DrvTq']) > STEER_THRESHOLD + self.steer_state = cp.vl["MDPS12"]['CF_Mdps_ToiActive'] #0 NOT ACTIVE, 1 ACTIVE + self.steer_error = cp.vl["MDPS12"]['CF_Mdps_ToiUnavail'] + self.brake_error = 0 + self.steer_torque_driver = cp.vl["MDPS11"]['CR_Mdps_DrvTq'] + self.steer_torque_motor = cp.vl["MDPS12"]['CR_Mdps_OutTq'] + self.stopped = cp.vl["SCC11"]['SCCInfoDisplay'] == 4. + + self.user_brake = 0 + + self.brake_pressed = cp.vl["TCS13"]['DriverBraking'] + self.brake_lights = bool(self.brake_pressed) + if (cp.vl["TCS13"]["DriverOverride"] == 0 and cp.vl["TCS13"]['ACC_REQ'] == 1): + self.pedal_gas = 0 + else: + self.pedal_gas = cp.vl["EMS12"]['TPS'] + self.car_gas = cp.vl["EMS12"]['TPS'] + + # Gear Selecton - This is not compatible with all Kia/Hyundai's, But is the best way for those it is compatible with + gear = cp.vl["LVR12"]["CF_Lvr_Gear"] + if gear == 5: + self.gear_shifter = "drive" + elif gear == 6: + self.gear_shifter = "neutral" + elif gear == 0: + self.gear_shifter = "park" + elif gear == 7: + self.gear_shifter = "reverse" + else: + self.gear_shifter = "unknown" + + # Gear Selection via Cluster - For those Kia/Hyundai which are not fully discovered, we can use the Cluster Indicator for Gear Selection, as this seems to be standard over all cars, but is not the preferred method. + if cp.vl["CLU15"]["CF_Clu_InhibitD"] == 1: + self.gear_shifter_cluster = "drive" + elif cp.vl["CLU15"]["CF_Clu_InhibitN"] == 1: + self.gear_shifter_cluster = "neutral" + elif cp.vl["CLU15"]["CF_Clu_InhibitP"] == 1: + self.gear_shifter_cluster = "park" + elif cp.vl["CLU15"]["CF_Clu_InhibitR"] == 1: + self.gear_shifter_cluster = "reverse" + else: + self.gear_shifter_cluster = "unknown" + + # Gear Selecton via TCU12 + gear2 = cp.vl["TCU12"]["CUR_GR"] + if gear2 == 0: + self.gear_tcu = "park" + elif gear2 == 14: + self.gear_tcu = "reverse" + elif gear2 > 0 and gear2 < 9: # unaware of anything over 8 currently + self.gear_tcu = "drive" + else: + self.gear_tcu = "unknown" + + # save the entire LKAS11 and CLU11 + self.lkas11 = cp_cam.vl["LKAS11"] + self.clu11 = cp.vl["CLU11"] diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py new file mode 100644 index 00000000000000..5a895497a1865f --- /dev/null +++ b/selfdrive/car/hyundai/hyundaican.py @@ -0,0 +1,79 @@ +import crcmod +from selfdrive.car.hyundai.values import CHECKSUM + +hyundai_checksum = crcmod.mkCrcFun(0x11D, initCrc=0xFD, rev=False, xorOut=0xdf) + +def make_can_msg(addr, dat, alt): + return [addr, 0, dat, alt] + +def create_lkas11(packer, car_fingerprint, apply_steer, steer_req, cnt, enabled, lkas11, hud_alert, keep_stock=False): + values = { + "CF_Lkas_Icon": 3 if enabled else 0, + "CF_Lkas_LdwsSysState": 3 if steer_req else 1, + "CF_Lkas_SysWarning": hud_alert, + "CF_Lkas_LdwsLHWarning": lkas11["CF_Lkas_LdwsLHWarning"] if keep_stock else 0, + "CF_Lkas_LdwsRHWarning": lkas11["CF_Lkas_LdwsRHWarning"] if keep_stock else 0, + "CF_Lkas_HbaLamp": lkas11["CF_Lkas_HbaLamp"] if keep_stock else 0, + "CF_Lkas_FcwBasReq": lkas11["CF_Lkas_FcwBasReq"] if keep_stock else 0, + "CR_Lkas_StrToqReq": apply_steer, + "CF_Lkas_ActToi": steer_req, + "CF_Lkas_ToiFlt": 0, + "CF_Lkas_HbaSysState": lkas11["CF_Lkas_HbaSysState"] if keep_stock else 1, + "CF_Lkas_FcwOpt": lkas11["CF_Lkas_FcwOpt"] if keep_stock else 0, + "CF_Lkas_HbaOpt": lkas11["CF_Lkas_HbaOpt"] if keep_stock else 3, + "CF_Lkas_MsgCount": cnt, + "CF_Lkas_FcwSysState": lkas11["CF_Lkas_FcwSysState"] if keep_stock else 0, + "CF_Lkas_FcwCollisionWarning": lkas11["CF_Lkas_FcwCollisionWarning"] if keep_stock else 0, + "CF_Lkas_FusionState": lkas11["CF_Lkas_FusionState"] if keep_stock else 0, + "CF_Lkas_Chksum": 0, + "CF_Lkas_FcwOpt_USM": 2 if enabled else 1, + "CF_Lkas_LdwsOpt_USM": lkas11["CF_Lkas_LdwsOpt_USM"] if keep_stock else 3, + } + + dat = packer.make_can_msg("LKAS11", 0, values)[2] + + if car_fingerprint in CHECKSUM["crc8"]: + # CRC Checksum as seen on 2019 Hyundai Santa Fe + dat = dat[:6] + dat[7] + checksum = hyundai_checksum(dat) + elif car_fingerprint in CHECKSUM["6B"]: + # Checksum of first 6 Bytes, as seen on 2018 Kia Sorento + dat = [ord(i) for i in dat] + checksum = sum(dat[:6]) % 256 + elif car_fingerprint in CHECKSUM["7B"]: + # Checksum of first 6 Bytes and last Byte as seen on 2018 Kia Stinger + dat = [ord(i) for i in dat] + checksum = (sum(dat[:6]) + dat[7]) % 256 + + values["CF_Lkas_Chksum"] = checksum + + return packer.make_can_msg("LKAS11", 0, values) + +def create_lkas12(): + return make_can_msg(1342, "\x00\x00\x00\x00\x60\x05", 0) + + +def create_1191(): + return make_can_msg(1191, "\x01\x00", 0) + + +def create_1156(): + return make_can_msg(1156, "\x08\x20\xfe\x3f\x00\xe0\xfd\x3f", 0) + +def create_clu11(packer, clu11, button): + values = { + "CF_Clu_CruiseSwState": button, + "CF_Clu_CruiseSwMain": clu11["CF_Clu_CruiseSwMain"], + "CF_Clu_SldMainSW": clu11["CF_Clu_SldMainSW"], + "CF_Clu_ParityBit1": clu11["CF_Clu_ParityBit1"], + "CF_Clu_VanzDecimal": clu11["CF_Clu_VanzDecimal"], + "CF_Clu_Vanz": clu11["CF_Clu_Vanz"], + "CF_Clu_SPEED_UNIT": clu11["CF_Clu_SPEED_UNIT"], + "CF_Clu_DetentOut": clu11["CF_Clu_DetentOut"], + "CF_Clu_RheostatLevel": clu11["CF_Clu_RheostatLevel"], + "CF_Clu_CluInfo": clu11["CF_Clu_CluInfo"], + "CF_Clu_AmpInfo": clu11["CF_Clu_AmpInfo"], + "CF_Clu_AliveCnt1": 0, + } + + return packer.make_can_msg("CLU11", 0, values) diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py new file mode 100644 index 00000000000000..d7fc2bd394774e --- /dev/null +++ b/selfdrive/car/hyundai/interface.py @@ -0,0 +1,316 @@ +#!/usr/bin/env python +from cereal import car +from common.realtime import sec_since_boot +from selfdrive.config import Conversions as CV +from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event +from selfdrive.controls.lib.vehicle_model import VehicleModel +from selfdrive.car.hyundai.carstate import CarState, get_can_parser, get_camera_parser +from selfdrive.car.hyundai.values import CAMERA_MSGS, CAR, get_hud_alerts, FEATURES + +try: + from selfdrive.car.hyundai.carcontroller import CarController +except ImportError: + CarController = None + + +class CarInterface(object): + def __init__(self, CP, sendcan=None): + self.CP = CP + self.VM = VehicleModel(CP) + self.idx = 0 + self.lanes = 0 + self.lkas_request = 0 + + self.gas_pressed_prev = False + self.brake_pressed_prev = False + self.can_invalid_count = 0 + self.cruise_enabled_prev = False + self.low_speed_alert = False + + # *** init the major players *** + self.CS = CarState(CP) + self.cp = get_can_parser(CP) + self.cp_cam = get_camera_parser(CP) + + # sending if read only is False + if sendcan is not None: + self.sendcan = sendcan + self.CC = CarController(self.cp.dbc_name, CP.carFingerprint, CP.enableCamera) + + @staticmethod + def compute_gb(accel, speed): + return float(accel) / 3.0 + + @staticmethod + def calc_accel_override(a_ego, a_target, v_ego, v_target): + return 1.0 + + @staticmethod + def get_params(candidate, fingerprint): + + # kg of standard extra cargo to count for drive, gas, etc... + std_cargo = 136 + + ret = car.CarParams.new_message() + + ret.carName = "hyundai" + ret.carFingerprint = candidate + ret.radarOffCan = True + ret.safetyModel = car.CarParams.SafetyModels.hyundai + ret.enableCruise = True # stock acc + + # FIXME: hardcoding honda civic 2016 touring params so they can be used to + # scale unknown params for other cars + mass_civic = 2923 * CV.LB_TO_KG + std_cargo + wheelbase_civic = 2.70 + centerToFront_civic = wheelbase_civic * 0.4 + centerToRear_civic = wheelbase_civic - centerToFront_civic + rotationalInertia_civic = 2500 + tireStiffnessFront_civic = 192150 + tireStiffnessRear_civic = 202500 + + ret.steerActuatorDelay = 0.1 # Default delay + tire_stiffness_factor = 1. + + if candidate == CAR.SANTA_FE: + ret.steerKf = 0.00005 + ret.steerRateCost = 0.5 + ret.mass = 3982 * CV.LB_TO_KG + std_cargo + ret.wheelbase = 2.766 + + # Values from optimizer + ret.steerRatio = 16.55 # 13.8 is spec end-to-end + tire_stiffness_factor = 0.82 + + ret.steerKiBP, ret.steerKpBP = [[9., 22.], [9., 22.]] + ret.steerKpV, ret.steerKiV = [[0.2, 0.35], [0.05, 0.09]] + ret.minSteerSpeed = 0. + elif candidate == CAR.KIA_SORENTO: + ret.steerKf = 0.00005 + ret.mass = 1985 + std_cargo + ret.wheelbase = 2.78 + ret.steerRatio = 14.4 * 1.1 # 10% higher at the center seems reasonable + ret.steerKiBP, ret.steerKpBP = [[0.], [0.]] + ret.steerKpV, ret.steerKiV = [[0.25], [0.05]] + ret.minSteerSpeed = 0. + elif candidate == CAR.ELANTRA: + ret.steerKf = 0.00006 + ret.mass = 1275 + std_cargo + ret.wheelbase = 2.7 + ret.steerRatio = 13.73 #Spec + tire_stiffness_factor = 0.385 + ret.steerKiBP, ret.steerKpBP = [[0.], [0.]] + ret.steerKpV, ret.steerKiV = [[0.25], [0.05]] + ret.minSteerSpeed = 32 * CV.MPH_TO_MS + elif candidate == CAR.GENESIS: + ret.steerKf = 0.00005 + ret.mass = 2060 + std_cargo + ret.wheelbase = 3.01 + ret.steerRatio = 16.5 + ret.steerKiBP, ret.steerKpBP = [[0.], [0.]] + ret.steerKpV, ret.steerKiV = [[0.16], [0.01]] + ret.minSteerSpeed = 35 * CV.MPH_TO_MS + elif candidate == CAR.KIA_OPTIMA: + ret.steerKf = 0.00005 + ret.mass = 3558 * CV.LB_TO_KG + ret.wheelbase = 2.80 + ret.steerRatio = 13.75 + tire_stiffness_factor = 0.5 + ret.steerKiBP, ret.steerKpBP = [[0.], [0.]] + ret.steerKpV, ret.steerKiV = [[0.25], [0.05]] + elif candidate == CAR.KIA_STINGER: + ret.steerKf = 0.00005 + ret.mass = 1825 + std_cargo + ret.wheelbase = 2.78 + ret.steerRatio = 14.4 * 1.15 # 15% higher at the center seems reasonable + ret.steerKiBP, ret.steerKpBP = [[0.], [0.]] + ret.steerKpV, ret.steerKiV = [[0.25], [0.05]] + ret.minSteerSpeed = 0. + + ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this + ret.longitudinalKpBP = [0.] + ret.longitudinalKpV = [0.] + ret.longitudinalKiBP = [0.] + ret.longitudinalKiV = [0.] + + ret.centerToFront = ret.wheelbase * 0.4 + + centerToRear = ret.wheelbase - ret.centerToFront + + # TODO: get actual value, for now starting with reasonable value for + # civic and scaling by mass and wheelbase + ret.rotationalInertia = rotationalInertia_civic * \ + ret.mass * ret.wheelbase**2 / (mass_civic * wheelbase_civic**2) + + # TODO: start from empirically derived lateral slip stiffness for the civic and scale by + # mass and CG position, so all cars will have approximately similar dyn behaviors + ret.tireStiffnessFront = (tireStiffnessFront_civic * tire_stiffness_factor) * \ + ret.mass / mass_civic * \ + (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic) + ret.tireStiffnessRear = (tireStiffnessRear_civic * tire_stiffness_factor) * \ + ret.mass / mass_civic * \ + (ret.centerToFront / ret.wheelbase) / (centerToFront_civic / wheelbase_civic) + + + # no rear steering, at least on the listed cars above + ret.steerRatioRear = 0. + ret.steerControlType = car.CarParams.SteerControlType.torque + + # steer, gas, brake limitations VS speed + ret.steerMaxBP = [0.] + ret.steerMaxV = [1.0] + ret.gasMaxBP = [0.] + ret.gasMaxV = [1.] + ret.brakeMaxBP = [0.] + ret.brakeMaxV = [1.] + ret.longPidDeadzoneBP = [0.] + ret.longPidDeadzoneV = [0.] + + ret.enableCamera = not any(x for x in CAMERA_MSGS if x in fingerprint) + ret.openpilotLongitudinalControl = False + + ret.steerLimitAlert = False + ret.stoppingControl = False + ret.startAccel = 0.0 + + return ret + + # returns a car.CarState + def update(self, c): + # ******************* do can recv ******************* + canMonoTimes = [] + self.cp.update(int(sec_since_boot() * 1e9), False) + self.cp_cam.update(int(sec_since_boot() * 1e9), False) + self.CS.update(self.cp, self.cp_cam) + # create message + ret = car.CarState.new_message() + # speeds + ret.vEgo = self.CS.v_ego + ret.vEgoRaw = self.CS.v_ego_raw + ret.aEgo = self.CS.a_ego + ret.yawRate = self.CS.yaw_rate + ret.standstill = self.CS.standstill + ret.wheelSpeeds.fl = self.CS.v_wheel_fl + ret.wheelSpeeds.fr = self.CS.v_wheel_fr + ret.wheelSpeeds.rl = self.CS.v_wheel_rl + ret.wheelSpeeds.rr = self.CS.v_wheel_rr + + # gear shifter + if self.CP.carFingerprint in FEATURES["use_cluster_gears"]: + ret.gearShifter = self.CS.gear_shifter_cluster + elif self.CP.carFingerprint in FEATURES["use_tcu_gears"]: + ret.gearShifter = self.CS.gear_tcu + else: + ret.gearShifter = self.CS.gear_shifter + + # gas pedal + ret.gas = self.CS.car_gas + ret.gasPressed = self.CS.pedal_gas > 1e-3 # tolerance to avoid false press reading + + # brake pedal + ret.brake = self.CS.user_brake + ret.brakePressed = self.CS.brake_pressed != 0 + ret.brakeLights = self.CS.brake_lights + + # steering wheel + ret.steeringAngle = self.CS.angle_steers + ret.steeringRate = self.CS.angle_steers_rate # it's unsigned + + ret.steeringTorque = self.CS.steer_torque_driver + ret.steeringPressed = self.CS.steer_override + + # cruise state + ret.cruiseState.enabled = self.CS.pcm_acc_status != 0 + if self.CS.pcm_acc_status != 0: + ret.cruiseState.speed = self.CS.cruise_set_speed + else: + ret.cruiseState.speed = 0 + ret.cruiseState.available = bool(self.CS.main_on) + ret.cruiseState.standstill = False + + # TODO: button presses + buttonEvents = [] + + if self.CS.left_blinker_on != self.CS.prev_left_blinker_on: + be = car.CarState.ButtonEvent.new_message() + be.type = 'leftBlinker' + be.pressed = self.CS.left_blinker_on != 0 + buttonEvents.append(be) + + if self.CS.right_blinker_on != self.CS.prev_right_blinker_on: + be = car.CarState.ButtonEvent.new_message() + be.type = 'rightBlinker' + be.pressed = self.CS.right_blinker_on != 0 + buttonEvents.append(be) + + ret.buttonEvents = buttonEvents + ret.leftBlinker = bool(self.CS.left_blinker_on) + ret.rightBlinker = bool(self.CS.right_blinker_on) + + ret.doorOpen = not self.CS.door_all_closed + ret.seatbeltUnlatched = not self.CS.seatbelt + + + # low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s) + if ret.vEgo < (self.CP.minSteerSpeed + 2.) and self.CP.minSteerSpeed > 10.: + self.low_speed_alert = True + if ret.vEgo > (self.CP.minSteerSpeed + 4.): + self.low_speed_alert = False + + # events + events = [] + if not self.CS.can_valid: + self.can_invalid_count += 1 + if self.can_invalid_count >= 5: + events.append(create_event('commIssue', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) + else: + self.can_invalid_count = 0 + if not ret.gearShifter == 'drive': + events.append(create_event('wrongGear', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if ret.doorOpen: + events.append(create_event('doorOpen', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if ret.seatbeltUnlatched: + events.append(create_event('seatbeltNotLatched', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if self.CS.esp_disabled: + events.append(create_event('espDisabled', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if not self.CS.main_on: + events.append(create_event('wrongCarMode', [ET.NO_ENTRY, ET.USER_DISABLE])) + if ret.gearShifter == 'reverse': + events.append(create_event('reverseGear', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) + if self.CS.steer_error: + events.append(create_event('steerTempUnavailable', [ET.NO_ENTRY, ET.WARNING])) + + # enable request in prius is simple, as we activate when Toyota is active (rising edge) + if ret.cruiseState.enabled and not self.cruise_enabled_prev: + events.append(create_event('pcmEnable', [ET.ENABLE])) + elif not ret.cruiseState.enabled: + events.append(create_event('pcmDisable', [ET.USER_DISABLE])) + + # disable on pedals rising edge or when brake is pressed and speed isn't zero + if (ret.gasPressed and not self.gas_pressed_prev) or \ + (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgoRaw > 0.1)): + events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) + + if ret.gasPressed: + events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) + + if self.low_speed_alert: + events.append(create_event('belowSteerSpeed', [ET.WARNING])) + + ret.events = events + ret.canMonoTimes = canMonoTimes + + self.gas_pressed_prev = ret.gasPressed + self.brake_pressed_prev = ret.brakePressed + self.cruise_enabled_prev = ret.cruiseState.enabled + + return ret.as_reader() + + def apply(self, c): + + hud_alert = get_hud_alerts(c.hudControl.visualAlert, c.hudControl.audibleAlert) + + self.CC.update(self.sendcan, c.enabled, self.CS, c.actuators, + c.cruiseControl.cancel, hud_alert) + + return False diff --git a/selfdrive/car/hyundai/radar_interface.py b/selfdrive/car/hyundai/radar_interface.py new file mode 100644 index 00000000000000..96159fd87d9535 --- /dev/null +++ b/selfdrive/car/hyundai/radar_interface.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +from cereal import car +import time + + +class RadarInterface(object): + def __init__(self, CP): + # radar + self.pts = {} + self.delay = 0.1 + + def update(self): + + ret = car.RadarState.new_message() + time.sleep(0.05) # radard runs on RI updates + + return ret + +if __name__ == "__main__": + RI = RadarInterface(None) + while 1: + ret = RI.update() + print(chr(27) + "[2J") + print ret diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py new file mode 100644 index 00000000000000..1756976e94aa13 --- /dev/null +++ b/selfdrive/car/hyundai/values.py @@ -0,0 +1,77 @@ +from cereal import car +from selfdrive.car import dbc_dict + +VisualAlert = car.CarControl.HUDControl.VisualAlert +AudibleAlert = car.CarControl.HUDControl.AudibleAlert + +def get_hud_alerts(visual_alert, audible_alert): + if visual_alert == VisualAlert.steerRequired: + return 4 if audible_alert != AudibleAlert.none else 5 + else: + return 0 + +class CAR: + ELANTRA = "HYUNDAI ELANTRA LIMITED ULTIMATE 2017" + GENESIS = "HYUNDAI GENESIS 2018" + KIA_OPTIMA = "KIA OPTIMA SX 2019" + KIA_SORENTO = "KIA SORENTO GT LINE 2018" + KIA_STINGER = "KIA STINGER GT2 2018" + SANTA_FE = "HYUNDAI SANTA FE LIMITED 2019" + +class Buttons: + NONE = 0 + RES_ACCEL = 1 + SET_DECEL = 2 + CANCEL = 4 + +FINGERPRINTS = { + CAR.ELANTRA: [{ + 66: 8, 67: 8, 68: 8, 127: 8, 273: 8, 274: 8, 275: 8, 339: 8, 356: 4, 399: 8, 512: 6, 544: 8, 593: 8, 608: 8, 688: 5, 790: 8, 809: 8, 897: 8, 899: 8, 902: 8, 903: 8, 905: 8, 909: 8, 916: 8, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1170: 8, 1265: 4, 1280: 1, 1282: 4, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1314: 8, 1322: 8, 1345: 8, 1349: 8, 1351: 8, 1353: 8, 1363: 8, 1366: 8, 1367: 8, 1369: 8, 1407: 8, 1415: 8, 1419: 8, 1425: 2, 1427: 6, 1440: 8, 1456: 4, 1472: 8, 1486: 8, 1487: 8, 1491: 8, 1530: 8, 1532: 5, 2001: 8, 2003: 8, 2004: 8, 2009: 8, 2012: 8, 2016: 8, 2017: 8, 2024: 8, 2025: 8 + }], + CAR.GENESIS: [{ + 67: 8, 68: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 7, 593: 8, 608: 8, 688: 5, 809: 8, 832: 8, 854: 7, 870: 7, 871: 8, 872: 5, 897: 8, 902: 8, 903: 6, 916: 8, 1024: 2, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1168: 7, 1170: 8, 1173: 8, 1184: 8, 1265: 4, 1280: 1, 1287: 4, 1292: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1334: 8, 1335: 8, 1342: 6, 1345: 8, 1363: 8, 1369: 8, 1370: 8, 1371: 8, 1378: 4, 1384: 5, 1407: 8, 1419: 8, 1427: 6, 1434: 2, 1456: 4 + }, + { + 67: 8, 68: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 7, 593: 8, 608: 8, 688: 5, 809: 8, 832: 8, 854: 7, 870: 7, 871: 8, 872: 5, 897: 8, 902: 8, 903: 6, 916: 8, 1024: 2, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1168: 7, 1170: 8, 1173: 8, 1184: 8, 1265: 4, 1280: 1, 1281: 3, 1287: 4, 1292: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1334: 8, 1335: 8, 1345: 8, 1363: 8, 1369: 8, 1370: 8, 1378: 4, 1379: 8, 1384: 5, 1407: 8, 1419: 8, 1427: 6, 1434: 2, 1456: 4 + }], + CAR.KIA_OPTIMA: [{ + 64: 8, 66: 8, 67: 8, 68: 8, 127: 8, 273: 8, 274: 8, 275: 8, 339: 8, 356: 4, 399: 8, 447: 8, 512: 6, 544: 8, 593: 8, 608: 8, 688: 5, 790: 8, 809: 8, 832: 8, 884: 8, 897: 8, 899: 8, 902: 8, 903: 6, 909: 8, 916: 8, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1151: 6, 1168: 7, 1170: 8, 1186: 2, 1191: 2, 1253: 8, 1254: 8, 1255: 8, 1265: 4, 1280: 1, 1282: 4, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1342: 6, 1345: 8, 1348: 8, 1349: 8, 1351: 8, 1353: 8, 1363: 8, 1365: 8, 1366: 8, 1367: 8, 1369: 8, 1407: 8, 1414: 3, 1415: 8, 1419: 8, 1425: 2, 1427: 6, 1440: 8, 1456: 4, 1470: 8, 1472: 8, 1486: 8, 1487: 8, 1491: 8, 1530: 8, 1532: 5, 1952: 8, 1960: 8, 1988: 8, 1996: 8, 2001: 8, 2004: 8, 2008: 8, 2009: 8, 2012: 8, 2016: 8, 2017: 8, 2024: 8, 2025: 8 + }], + CAR.KIA_SORENTO: [{ + 67: 8, 68: 8, 127: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 8, 593: 8, 608: 8, 688: 5, 809: 8, 832: 8, 854: 7, 870: 7, 871: 8, 872: 8, 897: 8, 902: 8, 903: 8, 916: 8, 1040: 8, 1042: 8, 1056: 8, 1057: 8, 1064: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1168: 7, 1170: 8, 1173: 8, 1265: 4, 1280: 1, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1342: 6, 1345: 8, 1348: 8, 1363: 8, 1369: 8, 1370: 8, 1371: 8, 1384: 8, 1407: 8, 1411: 8, 1419: 8, 1425: 2, 1427: 6, 1444: 8, 1456: 4, 1470: 8, 1489: 1 + }], + CAR.KIA_STINGER: [{ + 67: 8, 127: 8, 304: 8, 320: 8, 339: 8, 356: 4, 358: 6, 359: 8, 544: 8, 576: 8, 593: 8, 608: 8, 688: 5, 809: 8, 832: 8, 854: 7, 870: 7, 871: 8, 872: 8, 897: 8, 902: 8, 909: 8, 916: 8, 1040: 8, 1042: 8, 1056: 8, 1057: 8, 1064: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1168: 7, 1170: 8, 1173: 8, 1184: 8, 1265: 4, 1280: 1, 1281: 4, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1342: 6, 1345: 8, 1348: 8, 1363: 8, 1369: 8, 1378: 4, 1379: 8, 1384: 8, 1407: 8, 1419: 8, 1425: 2, 1427: 6, 1456: 4, 1470: 8 + }], + CAR.SANTA_FE: [{ + 67: 8, 127: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 8, 593: 8, 608: 8, 688: 6, 809: 8, 832: 8, 854: 7, 870: 7, 871: 8, 872: 8, 897: 8, 902: 8, 903: 8, 905: 8, 909: 8, 916: 8, 1040: 8, 1042: 8, 1056: 8, 1057: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1155: 8, 1156: 8, 1162: 8, 1164: 8, 1168: 7, 1170: 8, 1173: 8, 1183: 8, 1186: 2, 1191: 2, 1227: 8, 1265: 4, 1280: 1, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1342: 6, 1345: 8, 1348: 8, 1363: 8, 1369: 8, 1379: 8, 1384: 8, 1407: 8, 1414: 3, 1419: 8, 1427: 6, 1456: 4, 1470: 8 + }, + { + 67: 8, 127: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 8, 593: 8, 608: 8, 688: 6, 764: 8, 809: 8, 854: 7, 870: 7, 871: 8, 872: 8, 897: 8, 902: 8, 903: 8, 905: 8, 909: 8, 916: 8, 1040: 8, 1042: 8, 1056: 8, 1057: 8, 1064: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1155: 8, 1162: 8, 1164: 8, 1168: 7, 1170: 8, 1173: 8, 1180: 8, 1183: 8, 1186: 2, 1227: 8, 1265: 4, 1280: 1, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1345: 8, 1348: 8, 1363: 8, 1369: 8, 1371: 8, 1378: 8, 1384: 8, 1407: 8, 1414: 3, 1419: 8, 1427: 6, 1456: 4, 1470: 8, 1988: 8, 2000: 8, 2004: 8, 2008: 8, 2012: 8 + } + ], +} + +CAMERA_MSGS = [832, 1156, 1191, 1342] + +CHECKSUM = { + "crc8": [CAR.SANTA_FE], + "6B": [CAR.KIA_SORENTO, CAR.GENESIS], + "7B": [CAR.KIA_STINGER, CAR.ELANTRA, CAR.KIA_OPTIMA], +} + +FEATURES = { + "use_cluster_gears": [CAR.ELANTRA], # Use Cluster for Gear Selection, rather than Transmission + "use_tcu_gears": [CAR.KIA_OPTIMA], # Use TCU Message for Gear Selection +} + +DBC = { + CAR.ELANTRA: dbc_dict('hyundai_kia_generic', None), + CAR.GENESIS: dbc_dict('hyundai_kia_generic', None), + CAR.KIA_OPTIMA: dbc_dict('hyundai_kia_generic', None), + CAR.KIA_SORENTO: dbc_dict('hyundai_kia_generic', None), + CAR.KIA_STINGER: dbc_dict('hyundai_kia_generic', None), + CAR.SANTA_FE: dbc_dict('hyundai_kia_generic', None), +} + +STEER_THRESHOLD = 100 diff --git a/selfdrive/car/mock/interface.py b/selfdrive/car/mock/interface.py index db3b8b6a53dac3..3a5e05257c4a90 100755 --- a/selfdrive/car/mock/interface.py +++ b/selfdrive/car/mock/interface.py @@ -47,6 +47,7 @@ def get_params(candidate, fingerprint): ret.carFingerprint = candidate ret.safetyModel = car.CarParams.SafetyModels.noOutput + ret.openpilotLongitudinalControl = False # FIXME: hardcoding honda civic 2016 touring params so they can be used to # scale unknown params for other cars diff --git a/selfdrive/car/subaru/__init__.py b/selfdrive/car/subaru/__init__.py new file mode 100644 index 00000000000000..8b137891791fe9 --- /dev/null +++ b/selfdrive/car/subaru/__init__.py @@ -0,0 +1 @@ + diff --git a/selfdrive/car/subaru/carstate.py b/selfdrive/car/subaru/carstate.py new file mode 100644 index 00000000000000..e12f5f957f26ff --- /dev/null +++ b/selfdrive/car/subaru/carstate.py @@ -0,0 +1,104 @@ +import numpy as np +from common.kalman.simple_kalman import KF1D +from selfdrive.config import Conversions as CV +from selfdrive.can.parser import CANParser +from selfdrive.car.subaru.values import DBC, STEER_THRESHOLD + +def get_powertrain_can_parser(CP): + # this function generates lists for signal, messages and initial values + signals = [ + # sig_name, sig_address, default + ("Steer_Torque_Sensor", "Steering_Torque", 0), + ("Steering_Angle", "Steering_Torque", 0), + ("Cruise_On", "CruiseControl", 0), + ("Cruise_Activated", "CruiseControl", 0), + ("Brake_Pedal", "Brake_Pedal", 0), + ("Throttle_Pedal", "Throttle", 0), + ("LEFT_BLINKER", "Dashlights", 0), + ("RIGHT_BLINKER", "Dashlights", 0), + ("SEATBELT_FL", "Dashlights", 0), + ("FL", "Wheel_Speeds", 0), + ("FR", "Wheel_Speeds", 0), + ("RL", "Wheel_Speeds", 0), + ("RR", "Wheel_Speeds", 0), + ("DOOR_OPEN_FR", "BodyInfo", 1), + ("DOOR_OPEN_FL", "BodyInfo", 1), + ("DOOR_OPEN_RR", "BodyInfo", 1), + ("DOOR_OPEN_RL", "BodyInfo", 1), + ] + + checks = [ + # sig_address, frequency + ("Dashlights", 10), + ("CruiseControl", 20), + ("Wheel_Speeds", 50), + ("Steering_Torque", 100), + ("BodyInfo", 10), + ] + + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0) + +class CarState(object): + def __init__(self, CP): + # initialize can parser + self.CP = CP + + self.car_fingerprint = CP.carFingerprint + self.left_blinker_on = False + self.prev_left_blinker_on = False + self.right_blinker_on = False + self.prev_right_blinker_on = False + self.steer_torque_driver = 0 + self.steer_not_allowed = False + self.main_on = False + + # vEgo kalman filter + dt = 0.01 + self.v_ego_kf = KF1D(x0=np.matrix([[0.], [0.]]), + A=np.matrix([[1., dt], [0., 1.]]), + C=np.matrix([1., 0.]), + K=np.matrix([[0.12287673], [0.29666309]])) + self.v_ego = 0. + + def update(self, cp): + + self.can_valid = True + self.pedal_gas = cp.vl["Throttle"]['Throttle_Pedal'] + self.brake_pressure = cp.vl["Brake_Pedal"]['Brake_Pedal'] + self.user_gas_pressed = self.pedal_gas > 0 + self.brake_pressed = self.brake_pressure > 0 + self.brake_lights = bool(self.brake_pressed) + + self.v_wheel_fl = cp.vl["Wheel_Speeds"]['FL'] * CV.KPH_TO_MS + self.v_wheel_fr = cp.vl["Wheel_Speeds"]['FR'] * CV.KPH_TO_MS + self.v_wheel_rl = cp.vl["Wheel_Speeds"]['RL'] * CV.KPH_TO_MS + self.v_wheel_rr = cp.vl["Wheel_Speeds"]['RR'] * CV.KPH_TO_MS + + v_wheel = (self.v_wheel_fl + self.v_wheel_fr + self.v_wheel_rl + self.v_wheel_rr) / 4. + # Kalman filter, even though Hyundai raw wheel speed is heaviliy filtered by default + if abs(v_wheel - self.v_ego) > 2.0: # Prevent large accelerations when car starts at non zero speed + self.v_ego_kf.x = np.matrix([[v_wheel], [0.0]]) + + self.v_ego_raw = v_wheel + v_ego_x = self.v_ego_kf.update(v_wheel) + + self.v_ego = float(v_ego_x[0]) + self.a_ego = float(v_ego_x[1]) + self.standstill = self.v_ego_raw < 0.01 + + self.prev_left_blinker_on = self.left_blinker_on + self.prev_right_blinker_on = self.right_blinker_on + self.left_blinker_on = cp.vl["Dashlights"]['LEFT_BLINKER'] == 1 + self.right_blinker_on = cp.vl["Dashlights"]['RIGHT_BLINKER'] == 1 + self.seatbelt_unlatched = cp.vl["Dashlights"]['SEATBELT_FL'] == 1 + self.steer_torque_driver = cp.vl["Steering_Torque"]['Steer_Torque_Sensor'] + self.acc_active = cp.vl["CruiseControl"]['Cruise_Activated'] + self.main_on = cp.vl["CruiseControl"]['Cruise_On'] + self.steer_override = abs(self.steer_torque_driver) > STEER_THRESHOLD[self.car_fingerprint] + self.angle_steers = cp.vl["Steering_Torque"]['Steering_Angle'] + self.door_open = any([cp.vl["BodyInfo"]['DOOR_OPEN_RR'], + cp.vl["BodyInfo"]['DOOR_OPEN_RL'], + cp.vl["BodyInfo"]['DOOR_OPEN_FR'], + cp.vl["BodyInfo"]['DOOR_OPEN_FL']]) + + diff --git a/selfdrive/car/subaru/interface.py b/selfdrive/car/subaru/interface.py new file mode 100644 index 00000000000000..93a1ac62b2ddda --- /dev/null +++ b/selfdrive/car/subaru/interface.py @@ -0,0 +1,205 @@ +#!/usr/bin/env python +from cereal import car +from common.realtime import sec_since_boot +from selfdrive.config import Conversions as CV +from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET +from selfdrive.controls.lib.vehicle_model import VehicleModel +from selfdrive.car.subaru.values import CAR +from selfdrive.car.subaru.carstate import CarState, get_powertrain_can_parser + +try: + from selfdrive.car.subaru.carcontroller import CarController +except ImportError: + CarController = None + + +class CarInterface(object): + def __init__(self, CP, sendcan=None): + self.CP = CP + + self.frame = 0 + self.can_invalid_count = 0 + self.acc_active_prev = 0 + + # *** init the major players *** + self.CS = CarState(CP) + self.VM = VehicleModel(CP) + self.pt_cp = get_powertrain_can_parser(CP) + + # sending if read only is False + if sendcan is not None: + self.sendcan = sendcan + self.CC = CarController(CP.carFingerprint) + + @staticmethod + def compute_gb(accel, speed): + return float(accel) / 4.0 + + @staticmethod + def calc_accel_override(a_ego, a_target, v_ego, v_target): + return 1.0 + + @staticmethod + def get_params(candidate, fingerprint): + ret = car.CarParams.new_message() + + ret.carName = "subaru" + ret.carFingerprint = candidate + ret.safetyModel = car.CarParams.SafetyModels.subaru + + ret.enableCruise = False + ret.steerLimitAlert = True + ret.enableCamera = True + + std_cargo = 136 + ret.steerRateCost = 0.7 + + if candidate in [CAR.IMPREZA]: + ret.mass = 1568 + std_cargo + ret.wheelbase = 2.67 + ret.centerToFront = ret.wheelbase * 0.5 + ret.steerRatio = 15 + tire_stiffness_factor = 1.0 + ret.steerActuatorDelay = 0.4 # end-to-end angle controller + ret.steerKf = 0.00005 + ret.steerKiBP, ret.steerKpBP = [[0., 20.], [0., 20.]] + ret.steerKpV, ret.steerKiV = [[0.2, 0.3], [0.02, 0.03]] + ret.steerMaxBP = [0.] # m/s + ret.steerMaxV = [1.] + + ret.steerControlType = car.CarParams.SteerControlType.torque + ret.steerRatioRear = 0. + # testing tuning + + # No long control in subaru + ret.gasMaxBP = [0.] + ret.gasMaxV = [0.] + ret.brakeMaxBP = [0.] + ret.brakeMaxV = [0.] + ret.longPidDeadzoneBP = [0.] + ret.longPidDeadzoneV = [0.] + ret.longitudinalKpBP = [0.] + ret.longitudinalKpV = [0.] + ret.longitudinalKiBP = [0.] + ret.longitudinalKiV = [0.] + + # end from gm + + # hardcoding honda civic 2016 touring params so they can be used to + # scale unknown params for other cars + mass_civic = 2923./2.205 + std_cargo + wheelbase_civic = 2.70 + centerToFront_civic = wheelbase_civic * 0.4 + centerToRear_civic = wheelbase_civic - centerToFront_civic + rotationalInertia_civic = 2500 + tireStiffnessFront_civic = 192150 + tireStiffnessRear_civic = 202500 + centerToRear = ret.wheelbase - ret.centerToFront + + # TODO: get actual value, for now starting with reasonable value for + # civic and scaling by mass and wheelbase + ret.rotationalInertia = rotationalInertia_civic * \ + ret.mass * ret.wheelbase**2 / (mass_civic * wheelbase_civic**2) + + # TODO: start from empirically derived lateral slip stiffness for the civic and scale by + # mass and CG position, so all cars will have approximately similar dyn behaviors + ret.tireStiffnessFront = (tireStiffnessFront_civic * tire_stiffness_factor) * \ + ret.mass / mass_civic * \ + (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic) + ret.tireStiffnessRear = (tireStiffnessRear_civic * tire_stiffness_factor) * \ + ret.mass / mass_civic * \ + (ret.centerToFront / ret.wheelbase) / (centerToFront_civic / wheelbase_civic) + + return ret + + # returns a car.CarState + def update(self, c): + + self.pt_cp.update(int(sec_since_boot() * 1e9), False) + self.CS.update(self.pt_cp) + + # create message + ret = car.CarState.new_message() + + # speeds + ret.vEgo = self.CS.v_ego + ret.aEgo = self.CS.a_ego + ret.vEgoRaw = self.CS.v_ego_raw + ret.yawRate = self.VM.yaw_rate(self.CS.angle_steers * CV.DEG_TO_RAD, self.CS.v_ego) + ret.standstill = self.CS.standstill + ret.wheelSpeeds.fl = self.CS.v_wheel_fl + ret.wheelSpeeds.fr = self.CS.v_wheel_fr + ret.wheelSpeeds.rl = self.CS.v_wheel_rl + ret.wheelSpeeds.rr = self.CS.v_wheel_rr + + # steering wheel + ret.steeringAngle = self.CS.angle_steers + + # torque and user override. Driver awareness + # timer resets when the user uses the steering wheel. + ret.steeringPressed = self.CS.steer_override + ret.steeringTorque = self.CS.steer_torque_driver + + # cruise state + ret.cruiseState.available = bool(self.CS.main_on) + ret.leftBlinker = self.CS.left_blinker_on + ret.rightBlinker = self.CS.right_blinker_on + ret.seatbeltUnlatched = self.CS.seatbelt_unlatched + + buttonEvents = [] + + # blinkers + if self.CS.left_blinker_on != self.CS.prev_left_blinker_on: + be = car.CarState.ButtonEvent.new_message() + be.type = 'leftBlinker' + be.pressed = self.CS.left_blinker_on + buttonEvents.append(be) + + if self.CS.right_blinker_on != self.CS.prev_right_blinker_on: + be = car.CarState.ButtonEvent.new_message() + be.type = 'rightBlinker' + be.pressed = self.CS.right_blinker_on + buttonEvents.append(be) + + be = car.CarState.ButtonEvent.new_message() + be.type = 'accelCruise' + buttonEvents.append(be) + + + events = [] + if not self.CS.can_valid: + self.can_invalid_count += 1 + if self.can_invalid_count >= 5: + events.append(create_event('commIssue', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) + else: + self.can_invalid_count = 0 + + if ret.seatbeltUnlatched: + events.append(create_event('seatbeltNotLatched', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + + if self.CS.acc_active and not self.acc_active_prev: + events.append(create_event('pcmEnable', [ET.ENABLE])) + if not self.CS.acc_active: + events.append(create_event('pcmDisable', [ET.USER_DISABLE])) + + ## handle button presses + #for b in ret.buttonEvents: + # # do enable on both accel and decel buttons + # if b.type in ["accelCruise", "decelCruise"] and not b.pressed: + # events.append(create_event('buttonEnable', [ET.ENABLE])) + # # do disable on button down + # if b.type == "cancel" and b.pressed: + # events.append(create_event('buttonCancel', [ET.USER_DISABLE])) + + ret.events = events + + # update previous brake/gas pressed + self.acc_active_prev = self.CS.acc_active + + + # cast to reader so it can't be modified + return ret.as_reader() + + def apply(self, c): + self.CC.update(self.sendcan, c.enabled, self.CS, self.frame, c.actuators) + self.frame += 1 diff --git a/selfdrive/car/subaru/radar_interface.py b/selfdrive/car/subaru/radar_interface.py new file mode 100644 index 00000000000000..96159fd87d9535 --- /dev/null +++ b/selfdrive/car/subaru/radar_interface.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +from cereal import car +import time + + +class RadarInterface(object): + def __init__(self, CP): + # radar + self.pts = {} + self.delay = 0.1 + + def update(self): + + ret = car.RadarState.new_message() + time.sleep(0.05) # radard runs on RI updates + + return ret + +if __name__ == "__main__": + RI = RadarInterface(None) + while 1: + ret = RI.update() + print(chr(27) + "[2J") + print ret diff --git a/selfdrive/car/subaru/values.py b/selfdrive/car/subaru/values.py new file mode 100644 index 00000000000000..18b89295648731 --- /dev/null +++ b/selfdrive/car/subaru/values.py @@ -0,0 +1,18 @@ +from selfdrive.car import dbc_dict + +class CAR: + IMPREZA = "SUBARU IMPREZA LIMITED 2019" + +FINGERPRINTS = { + CAR.IMPREZA: [{ + 2: 8, 64: 8, 65: 8, 72: 8, 73: 8, 280: 8, 281: 8, 290: 8, 312: 8, 313: 8, 314: 8, 315: 8, 316: 8, 326: 8, 544: 8, 545: 8, 546: 8, 552: 8, 554: 8, 557: 8, 576: 8, 577: 8, 722: 8, 801: 8, 802: 8, 805: 8, 808: 8, 816: 8, 826: 8, 837: 8, 838: 8, 839: 8, 842: 8, 912: 8, 915: 8, 940: 8, 1614: 8, 1617: 8, 1632: 8, 1650: 8, 1657: 8, 1658: 8, 1677: 8, 1697: 8, 1722: 8, 1743: 8, 1759: 8, 1786: 5, 1787: 5, 1788: 8, 1809: 8, 1813: 8, 1817: 8, 1821: 8, 1840: 8, 1848: 8, 1924: 8, 1932: 8, 1952: 8, 1960: 8 + }], +} + +STEER_THRESHOLD = { + CAR.IMPREZA: 80, +} + +DBC = { + CAR.IMPREZA: dbc_dict('subaru_global_2017', None), +} diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index 7752add1b23c2a..cdd1bde51b5a3d 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -1,5 +1,8 @@ +from cereal import car from common.numpy_fast import clip, interp from selfdrive.boardd.boardd import can_list_to_can_capnp +from selfdrive.car import apply_toyota_steer_torque_limits +from selfdrive.car import create_gas_command from selfdrive.car.toyota.toyotacan import make_can_msg, create_video_target,\ create_steer_command, create_ui_command, \ create_ipas_steer_command, create_accel_command, \ @@ -7,6 +10,9 @@ from selfdrive.car.toyota.values import ECU, STATIC_MSGS from selfdrive.can.packer import CANPacker +VisualAlert = car.CarControl.HUDControl.VisualAlert +AudibleAlert = car.CarControl.HUDControl.AudibleAlert + # Accel limits ACCEL_HYST_GAP = 0.02 # don't change accel command for small oscilalitons within this value ACCEL_MAX = 1.5 # 1.5 m/s2 @@ -14,10 +20,11 @@ ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN) # Steer torque limits -STEER_MAX = 1500 -STEER_DELTA_UP = 10 # 1.5s time to peak torque -STEER_DELTA_DOWN = 25 # always lower than 45 otherwise the Rav4 faults (Prius seems ok with 50) -STEER_ERROR_MAX = 350 # max delta between torque cmd and torque motor +class SteerLimitParams: + STEER_MAX = 1500 + STEER_DELTA_UP = 10 # 1.5s time to peak torque + STEER_DELTA_DOWN = 25 # always lower than 45 otherwise the Rav4 faults (Prius seems ok with 50) + STEER_ERROR_MAX = 350 # max delta between torque cmd and torque motor # Steer angle limits (tested at the Crows Landing track and considered ok) ANGLE_MAX_BP = [0., 5.] @@ -54,14 +61,14 @@ def process_hud_alert(hud_alert, audible_alert): sound1 = 0 sound2 = 0 - if hud_alert == 'fcw': + if hud_alert == VisualAlert.fcw: fcw = 1 - elif hud_alert == 'steerRequired': + elif hud_alert == VisualAlert.steerRequired: steer = 1 - if audible_alert == 'chimeRepeated': + if audible_alert == AudibleAlert.chimeWarningRepeat: sound1 = 1 - elif audible_alert in ['beepSingle', 'chimeSingle', 'chimeDouble']: + elif audible_alert != AudibleAlert.none: # TODO: find a way to send single chimes sound2 = 1 @@ -108,6 +115,7 @@ def __init__(self, dbc_name, car_fingerprint, enable_camera, enable_dsu, enable_ self.steer_angle_enabled = False self.ipas_reset_counter = 0 + self.last_fault_frame = -200 self.fake_ecus = set() if enable_camera: self.fake_ecus.add(ECU.CAM) @@ -117,34 +125,39 @@ def __init__(self, dbc_name, car_fingerprint, enable_camera, enable_dsu, enable_ self.packer = CANPacker(dbc_name) def update(self, sendcan, enabled, CS, frame, actuators, - pcm_cancel_cmd, hud_alert, audible_alert): + pcm_cancel_cmd, hud_alert, audible_alert, forwarding_camera, left_line, right_line, lead): # *** compute control surfaces *** # gas and brake - apply_accel = actuators.gas - actuators.brake + + apply_gas = clip(actuators.gas, 0., 1.) + + if CS.CP.enableGasInterceptor: + # send only negative accel if interceptor is detected. otherwise, send the regular value + # +0.06 offset to reduce ABS pump usage when OP is engaged + apply_accel = 0.06 - actuators.brake + else: + apply_accel = actuators.gas - actuators.brake + apply_accel, self.accel_steady = accel_hysteresis(apply_accel, self.accel_steady, enabled) apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) # steer torque - apply_steer = int(round(actuators.steer * STEER_MAX)) - - max_lim = min(max(CS.steer_torque_motor + STEER_ERROR_MAX, STEER_ERROR_MAX), STEER_MAX) - min_lim = max(min(CS.steer_torque_motor - STEER_ERROR_MAX, -STEER_ERROR_MAX), -STEER_MAX) + apply_steer = int(round(actuators.steer * SteerLimitParams.STEER_MAX)) - apply_steer = clip(apply_steer, min_lim, max_lim) + apply_steer = apply_toyota_steer_torque_limits(apply_steer, self.last_steer, CS.steer_torque_motor, SteerLimitParams) - # slow rate if steer torque increases in magnitude - if self.last_steer > 0: - apply_steer = clip(apply_steer, max(self.last_steer - STEER_DELTA_DOWN, - STEER_DELTA_UP), self.last_steer + STEER_DELTA_UP) - else: - apply_steer = clip(apply_steer, self.last_steer - STEER_DELTA_UP, min(self.last_steer + STEER_DELTA_DOWN, STEER_DELTA_UP)) - - # dropping torque immediately might cause eps to temp fault. On the other hand, safety_toyota - # cuts steer torque immediately anyway TODO: monitor if this is a real issue # only cut torque when steer state is a known fault - if not enabled or CS.steer_state in [9, 25]: + if CS.steer_state in [9, 25]: + self.last_fault_frame = frame + + # Cut steering for 2s after fault + if not enabled or (frame - self.last_fault_frame < 200): apply_steer = 0 + apply_steer_req = 0 + else: + apply_steer_req = 1 self.steer_angle_enabled, self.ipas_reset_counter = \ ipas_state_transition(self.steer_angle_enabled, enabled, CS.ipas_active, self.ipas_reset_counter) @@ -192,24 +205,30 @@ def update(self, sendcan, enabled, CS, frame, actuators, # on consecutive messages if ECU.CAM in self.fake_ecus: if self.angle_control: - can_sends.append(create_steer_command(self.packer, 0., frame)) + can_sends.append(create_steer_command(self.packer, 0., 0, frame)) else: - can_sends.append(create_steer_command(self.packer, apply_steer, frame)) + can_sends.append(create_steer_command(self.packer, apply_steer, apply_steer_req, frame)) if self.angle_control: - can_sends.append(create_ipas_steer_command(self.packer, apply_angle, self.steer_angle_enabled, + can_sends.append(create_ipas_steer_command(self.packer, apply_angle, self.steer_angle_enabled, ECU.APGS in self.fake_ecus)) elif ECU.APGS in self.fake_ecus: can_sends.append(create_ipas_steer_command(self.packer, 0, 0, True)) # accel cmd comes from DSU, but we can spam can to cancel the system even if we are using lat only control if (frame % 3 == 0 and ECU.DSU in self.fake_ecus) or (pcm_cancel_cmd and ECU.CAM in self.fake_ecus): + lead = lead or CS.v_ego < 12. # at low speed we always assume the lead is present do ACC can be engaged if ECU.DSU in self.fake_ecus: - can_sends.append(create_accel_command(self.packer, apply_accel, pcm_cancel_cmd, self.standstill_req)) + can_sends.append(create_accel_command(self.packer, apply_accel, pcm_cancel_cmd, self.standstill_req, lead)) else: - can_sends.append(create_accel_command(self.packer, 0, pcm_cancel_cmd, False)) + can_sends.append(create_accel_command(self.packer, 0, pcm_cancel_cmd, False, lead)) + + if (frame % 2 == 0) and (CS.CP.enableGasInterceptor): + # send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas. + # This prevents unexpected pedal range rescaling + can_sends.append(create_gas_command(self.packer, apply_gas, frame/2)) - if frame % 10 == 0 and ECU.CAM in self.fake_ecus: + if frame % 10 == 0 and ECU.CAM in self.fake_ecus and not forwarding_camera: for addr in TARGET_IDS: can_sends.append(create_video_target(frame/10, addr)) @@ -227,13 +246,15 @@ def update(self, sendcan, enabled, CS, frame, actuators, send_ui = False if (frame % 100 == 0 or send_ui) and ECU.CAM in self.fake_ecus: - can_sends.append(create_ui_command(self.packer, steer, sound1, sound2)) + can_sends.append(create_ui_command(self.packer, steer, sound1, sound2, left_line, right_line)) + + if frame % 100 == 0 and ECU.DSU in self.fake_ecus: can_sends.append(create_fcw_command(self.packer, fcw)) #*** static msgs *** for (addr, ecu, cars, bus, fr_step, vl) in STATIC_MSGS: - if frame % fr_step == 0 and ecu in self.fake_ecus and self.car_fingerprint in cars: + if frame % fr_step == 0 and ecu in self.fake_ecus and self.car_fingerprint in cars and not (ecu == ECU.CAM and forwarding_camera): # special cases if fr_step == 5 and ecu == ECU.CAM and bus == 1: cnt = (((frame / 5) % 7) + 1) << 5 diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index 28bfc0fb5761a7..02debc47bf8484 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -1,37 +1,17 @@ -from selfdrive.car.toyota.values import CAR, DBC -from selfdrive.can.parser import CANParser -from selfdrive.config import Conversions as CV -from common.kalman.simple_kalman import KF1D import numpy as np +from common.kalman.simple_kalman import KF1D +from selfdrive.can.parser import CANParser, CANDefine +from selfdrive.config import Conversions as CV +from selfdrive.car.toyota.values import CAR, DBC, STEER_THRESHOLD +def parse_gear_shifter(gear, vals): -def parse_gear_shifter(can_gear, car_fingerprint): - # TODO: Use values from DBC to parse this field - if car_fingerprint == CAR.PRIUS: - if can_gear == 0x0: - return "park" - elif can_gear == 0x1: - return "reverse" - elif can_gear == 0x2: - return "neutral" - elif can_gear == 0x3: - return "drive" - elif can_gear == 0x4: - return "brake" - elif car_fingerprint in [CAR.RAV4, CAR.RAV4H, - CAR.LEXUS_RXH, CAR.COROLLA]: - if can_gear == 0x20: - return "park" - elif can_gear == 0x10: - return "reverse" - elif can_gear == 0x8: - return "neutral" - elif can_gear == 0x0: - return "drive" - elif can_gear == 0x1: - return "sport" - - return "unknown" + val_to_capnp = {'P': 'park', 'R': 'reverse', 'N': 'neutral', + 'D': 'drive', 'B': 'brake'} + try: + return val_to_capnp[vals[gear]] + except KeyError: + return "unknown" def get_can_parser(CP): @@ -55,6 +35,7 @@ def get_can_parser(CP): ("STEER_FRACTION", "STEER_ANGLE_SENSOR", 0), ("STEER_RATE", "STEER_ANGLE_SENSOR", 0), ("GAS_RELEASED", "PCM_CRUISE", 0), + ("CRUISE_ACTIVE", "PCM_CRUISE", 0), ("CRUISE_STATE", "PCM_CRUISE", 0), ("MAIN_ON", "PCM_CRUISE_2", 0), ("SET_SPEED", "PCM_CRUISE_2", 0), @@ -82,13 +63,30 @@ def get_can_parser(CP): if CP.carFingerprint == CAR.PRIUS: signals += [("STATE", "AUTOPARK_STATUS", 0)] + # add gas interceptor reading if we are using it + if CP.enableGasInterceptor: + signals.append(("INTERCEPTOR_GAS", "GAS_SENSOR", 0)) + checks.append(("GAS_SENSOR", 50)) + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0) +def get_cam_can_parser(CP): + + signals = [] + + # use steering message to check if panda is connected to frc + checks = [("STEERING_LKA", 42)] + + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 2) + + class CarState(object): def __init__(self, CP): self.CP = CP + self.can_define = CANDefine(DBC[CP.carFingerprint]['pt']) + self.shifter_values = self.can_define.dv["GEAR_PACKET"]['GEAR'] self.left_blinker_on = 0 self.right_blinker_on = 0 @@ -105,9 +103,10 @@ def __init__(self, CP): K=np.matrix([[0.12287673], [0.29666309]])) self.v_ego = 0.0 - def update(self, cp): + def update(self, cp, cp_cam): # copy can_valid self.can_valid = cp.can_valid + self.cam_can_valid = cp_cam.can_valid # update prevs, update must run once per loop self.prev_left_blinker_on = self.left_blinker_on @@ -117,9 +116,11 @@ def update(self, cp): cp.vl["SEATS_DOORS"]['DOOR_OPEN_RL'], cp.vl["SEATS_DOORS"]['DOOR_OPEN_RR']]) self.seatbelt = not cp.vl["SEATS_DOORS"]['SEATBELT_DRIVER_UNLATCHED'] - can_gear = cp.vl["GEAR_PACKET"]['GEAR'] self.brake_pressed = cp.vl["BRAKE_MODULE"]['BRAKE_PRESSED'] - self.pedal_gas = cp.vl["GAS_PEDAL"]['GAS_PEDAL'] + if self.CP.enableGasInterceptor: + self.pedal_gas = cp.vl["GAS_SENSOR"]['INTERCEPTOR_GAS'] + else: + self.pedal_gas = cp.vl["GAS_PEDAL"]['GAS_PEDAL'] self.car_gas = self.pedal_gas self.esp_disabled = cp.vl["ESP_CONTROL"]['TC_DISABLED'] @@ -128,27 +129,26 @@ def update(self, cp): self.v_wheel_fr = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_FR'] * CV.KPH_TO_MS self.v_wheel_rl = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_RL'] * CV.KPH_TO_MS self.v_wheel_rr = cp.vl["WHEEL_SPEEDS"]['WHEEL_SPEED_RR'] * CV.KPH_TO_MS - self.v_wheel = float(np.mean([self.v_wheel_fl, self.v_wheel_fr, self.v_wheel_rl, self.v_wheel_rr])) + v_wheel = float(np.mean([self.v_wheel_fl, self.v_wheel_fr, self.v_wheel_rl, self.v_wheel_rr])) # Kalman filter - if abs(self.v_wheel - self.v_ego) > 2.0: # Prevent large accelerations when car starts at non zero speed - self.v_ego_x = np.matrix([[self.v_wheel], [0.0]]) + if abs(v_wheel - self.v_ego) > 2.0: # Prevent large accelerations when car starts at non zero speed + self.v_ego_kf.x = np.matrix([[v_wheel], [0.0]]) - self.v_ego_raw = self.v_wheel - v_ego_x = self.v_ego_kf.update(self.v_wheel) + self.v_ego_raw = v_wheel + v_ego_x = self.v_ego_kf.update(v_wheel) self.v_ego = float(v_ego_x[0]) self.a_ego = float(v_ego_x[1]) - self.standstill = not self.v_wheel > 0.001 + self.standstill = not v_wheel > 0.001 self.angle_steers = cp.vl["STEER_ANGLE_SENSOR"]['STEER_ANGLE'] + cp.vl["STEER_ANGLE_SENSOR"]['STEER_FRACTION'] self.angle_steers_rate = cp.vl["STEER_ANGLE_SENSOR"]['STEER_RATE'] - self.gear_shifter = parse_gear_shifter(can_gear, self.car_fingerprint) + can_gear = int(cp.vl["GEAR_PACKET"]['GEAR']) + self.gear_shifter = parse_gear_shifter(can_gear, self.shifter_values) self.main_on = cp.vl["PCM_CRUISE_2"]['MAIN_ON'] self.left_blinker_on = cp.vl["STEERING_LEVERS"]['TURN_SIGNALS'] == 1 self.right_blinker_on = cp.vl["STEERING_LEVERS"]['TURN_SIGNALS'] == 2 - # we could use the override bit from dbc, but it's triggered at too high torque values - self.steer_override = abs(cp.vl["STEER_TORQUE_SENSOR"]['STEER_TORQUE_DRIVER']) > 100 # 2 is standby, 10 is active. TODO: check that everything else is really a faulty state self.steer_state = cp.vl["EPS_STATUS"]['LKA_STATE'] self.steer_error = cp.vl["EPS_STATUS"]['LKA_STATE'] not in [1, 5] @@ -156,10 +156,13 @@ def update(self, cp): self.brake_error = 0 self.steer_torque_driver = cp.vl["STEER_TORQUE_SENSOR"]['STEER_TORQUE_DRIVER'] self.steer_torque_motor = cp.vl["STEER_TORQUE_SENSOR"]['STEER_TORQUE_EPS'] + # we could use the override bit from dbc, but it's triggered at too high torque values + self.steer_override = abs(self.steer_torque_driver) > STEER_THRESHOLD self.user_brake = 0 self.v_cruise_pcm = cp.vl["PCM_CRUISE_2"]['SET_SPEED'] self.pcm_acc_status = cp.vl["PCM_CRUISE"]['CRUISE_STATE'] + self.pcm_acc_active = bool(cp.vl["PCM_CRUISE"]['CRUISE_ACTIVE']) self.gas_pressed = not cp.vl["PCM_CRUISE"]['GAS_RELEASED'] self.low_speed_lockout = cp.vl["PCM_CRUISE_2"]['LOW_SPEED_LOCKOUT'] == 2 self.brake_lights = bool(cp.vl["ESP_CONTROL"]['BRAKE_LIGHTS_ACC'] or self.brake_pressed) diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index 0170c4c942b990..8b6cb0a0129844 100755 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -4,7 +4,7 @@ from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event from selfdrive.controls.lib.vehicle_model import VehicleModel -from selfdrive.car.toyota.carstate import CarState, get_can_parser +from selfdrive.car.toyota.carstate import CarState, get_can_parser, get_cam_can_parser from selfdrive.car.toyota.values import ECU, check_ecu_msgs, CAR from selfdrive.swaglog import cloudlog @@ -23,12 +23,16 @@ def __init__(self, CP, sendcan=None): self.gas_pressed_prev = False self.brake_pressed_prev = False self.can_invalid_count = 0 + self.cam_can_valid_count = 0 self.cruise_enabled_prev = False # *** init the major players *** self.CS = CarState(CP) self.cp = get_can_parser(CP) + self.cp_cam = get_cam_can_parser(CP) + + self.forwarding_camera = False # sending if read only is False if sendcan is not None: @@ -57,7 +61,7 @@ def get_params(candidate, fingerprint): ret.safetyModel = car.CarParams.SafetyModels.toyota # pedal - ret.enableCruise = True + ret.enableCruise = not ret.enableGasInterceptor # FIXME: hardcoding honda civic 2016 touring params so they can be used to # scale unknown params for other cars @@ -73,10 +77,11 @@ def get_params(candidate, fingerprint): ret.steerActuatorDelay = 0.12 # Default delay, Prius has larger delay if candidate == CAR.PRIUS: + stop_and_go = True ret.safetyParam = 66 # see conversion factor for STEER_TORQUE_EPS in dbc file ret.wheelbase = 2.70 - ret.steerRatio = 15.59 # unknown end-to-end spec - tire_stiffness_factor = 0.7933 + ret.steerRatio = 15.00 # unknown end-to-end spec + tire_stiffness_factor = 0.6371 # hand-tune ret.mass = 3045 * CV.LB_TO_KG + std_cargo ret.steerKpV, ret.steerKiV = [[0.4], [0.01]] ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594 @@ -84,6 +89,7 @@ def get_params(candidate, fingerprint): ret.steerActuatorDelay = 0.25 elif candidate in [CAR.RAV4, CAR.RAV4H]: + stop_and_go = True if (candidate in CAR.RAV4H) else False ret.safetyParam = 73 # see conversion factor for STEER_TORQUE_EPS in dbc file ret.wheelbase = 2.65 ret.steerRatio = 16.30 # 14.5 is spec end-to-end @@ -93,6 +99,7 @@ def get_params(candidate, fingerprint): ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594 elif candidate == CAR.COROLLA: + stop_and_go = False ret.safetyParam = 100 # see conversion factor for STEER_TORQUE_EPS in dbc file ret.wheelbase = 2.70 ret.steerRatio = 17.8 @@ -102,6 +109,7 @@ def get_params(candidate, fingerprint): ret.steerKf = 0.00003 # full torque for 20 deg at 80mph means 0.00007818594 elif candidate == CAR.LEXUS_RXH: + stop_and_go = True ret.safetyParam = 100 # see conversion factor for STEER_TORQUE_EPS in dbc file ret.wheelbase = 2.79 ret.steerRatio = 16. # 14.8 is spec end-to-end @@ -110,18 +118,48 @@ def get_params(candidate, fingerprint): ret.steerKpV, ret.steerKiV = [[0.6], [0.1]] ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594 + elif candidate in [CAR.CHR, CAR.CHRH]: + stop_and_go = True + ret.safetyParam = 100 + ret.wheelbase = 2.63906 + ret.steerRatio = 13.6 + tire_stiffness_factor = 0.7933 + ret.mass = 3300. * CV.LB_TO_KG + std_cargo + ret.steerKpV, ret.steerKiV = [[0.723], [0.0428]] + ret.steerKf = 0.00006 + + elif candidate in [CAR.CAMRY, CAR.CAMRYH]: + stop_and_go = True + ret.safetyParam = 100 + ret.wheelbase = 2.82448 + ret.steerRatio = 13.7 + tire_stiffness_factor = 0.7933 + ret.mass = 3400 * CV.LB_TO_KG + std_cargo #mean between normal and hybrid + ret.steerKpV, ret.steerKiV = [[0.6], [0.1]] + ret.steerKf = 0.00006 + + elif candidate in [CAR.HIGHLANDER, CAR.HIGHLANDERH]: + stop_and_go = True + ret.safetyParam = 100 + ret.wheelbase = 2.78 + ret.steerRatio = 16.0 + tire_stiffness_factor = 0.444 # not optimized yet + ret.mass = 4607 * CV.LB_TO_KG + std_cargo #mean between normal and hybrid limited + ret.steerKpV, ret.steerKiV = [[0.6], [0.05]] + ret.steerKf = 0.00006 + ret.steerRateCost = 1. ret.centerToFront = ret.wheelbase * 0.44 ret.longPidDeadzoneBP = [0., 9.] ret.longPidDeadzoneV = [0., .15] + #detect the Pedal address + ret.enableGasInterceptor = 0x201 in fingerprint + # min speed to enable ACC. if car can do stop and go, then set enabling speed # to a negative value, so it won't matter. - if candidate in [CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH]: # rav4 hybrid can do stop and go - ret.minEnableSpeed = -1. - elif candidate in [CAR.RAV4, CAR.COROLLA]: # TODO: hack ICE to do stop and go - ret.minEnableSpeed = 19. * CV.MPH_TO_MS + ret.minEnableSpeed = -1. if (stop_and_go or ret.enableGasInterceptor) else 19. * CV.MPH_TO_MS centerToRear = ret.wheelbase - ret.centerToFront # TODO: get actual value, for now starting with reasonable value for @@ -145,26 +183,34 @@ def get_params(candidate, fingerprint): # steer, gas, brake limitations VS speed ret.steerMaxBP = [16. * CV.KPH_TO_MS, 45. * CV.KPH_TO_MS] # breakpoints at 1 and 40 kph ret.steerMaxV = [1., 1.] # 2/3rd torque allowed above 45 kph - ret.gasMaxBP = [0.] - ret.gasMaxV = [0.5] ret.brakeMaxBP = [5., 20.] ret.brakeMaxV = [1., 0.8] - ret.enableCamera = not check_ecu_msgs(fingerprint, candidate, ECU.CAM) - ret.enableDsu = not check_ecu_msgs(fingerprint, candidate, ECU.DSU) - ret.enableApgs = False #not check_ecu_msgs(fingerprint, candidate, ECU.APGS) + ret.enableCamera = not check_ecu_msgs(fingerprint, ECU.CAM) + ret.enableDsu = not check_ecu_msgs(fingerprint, ECU.DSU) + ret.enableApgs = False #not check_ecu_msgs(fingerprint, ECU.APGS) + ret.openpilotLongitudinalControl = ret.enableCamera and ret.enableDsu cloudlog.warn("ECU Camera Simulated: %r", ret.enableCamera) cloudlog.warn("ECU DSU Simulated: %r", ret.enableDsu) cloudlog.warn("ECU APGS Simulated: %r", ret.enableApgs) + cloudlog.warn("ECU Gas Interceptor: %r", ret.enableGasInterceptor) ret.steerLimitAlert = False + ret.longitudinalKpBP = [0., 5., 35.] + ret.longitudinalKiBP = [0., 35.] ret.stoppingControl = False ret.startAccel = 0.0 - ret.longitudinalKpBP = [0., 5., 35.] - ret.longitudinalKpV = [3.6, 2.4, 1.5] - ret.longitudinalKiBP = [0., 35.] - ret.longitudinalKiV = [0.54, 0.36] + if ret.enableGasInterceptor: + ret.gasMaxBP = [0., 9., 35] + ret.gasMaxV = [0.2, 0.5, 0.7] + ret.longitudinalKpV = [1.2, 0.8, 0.5] + ret.longitudinalKiV = [0.18, 0.12] + else: + ret.gasMaxBP = [0.] + ret.gasMaxV = [0.5] + ret.longitudinalKpV = [3.6, 2.4, 1.5] + ret.longitudinalKiV = [0.54, 0.36] return ret @@ -175,7 +221,11 @@ def update(self, c): self.cp.update(int(sec_since_boot() * 1e9), False) - self.CS.update(self.cp) + # run the cam can update for 10s as we just need to know if the camera is alive + if self.frame < 1000: + self.cp_cam.update(int(sec_since_boot() * 1e9), False) + + self.CS.update(self.cp, self.cp_cam) # create message ret = car.CarState.new_message() @@ -196,7 +246,11 @@ def update(self, c): # gas pedal ret.gas = self.CS.car_gas - ret.gasPressed = self.CS.pedal_gas > 0 + if self.CP.enableGasInterceptor: + # use interceptor values to disengage on pedal press + ret.gasPressed = self.CS.pedal_gas > 15 + else: + ret.gasPressed = self.CS.pedal_gas > 0 # brake pedal ret.brake = self.CS.user_brake @@ -211,20 +265,20 @@ def update(self, c): ret.steeringPressed = self.CS.steer_override # cruise state - ret.cruiseState.enabled = self.CS.pcm_acc_status != 0 + ret.cruiseState.enabled = self.CS.pcm_acc_active ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS ret.cruiseState.available = bool(self.CS.main_on) ret.cruiseState.speedOffset = 0. - if self.CP.carFingerprint == CAR.RAV4H: - # ignore standstill in hybrid rav4, since pcm allows to restart without + + if self.CP.carFingerprint in [CAR.RAV4H, CAR.HIGHLANDERH, CAR.HIGHLANDER] or self.CP.enableGasInterceptor: + # ignore standstill in hybrid vehicles, since pcm allows to restart without # receiving any special command + # also if interceptor is detected ret.cruiseState.standstill = False else: ret.cruiseState.standstill = self.CS.pcm_acc_status == 7 - # TODO: button presses buttonEvents = [] - if self.CS.left_blinker_on != self.CS.prev_left_blinker_on: be = car.CarState.ButtonEvent.new_message() be.type = 'leftBlinker' @@ -254,6 +308,12 @@ def update(self, c): events.append(create_event('commIssue', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) else: self.can_invalid_count = 0 + + if self.CS.cam_can_valid: + self.cam_can_valid_count += 1 + if self.cam_can_valid_count >= 5: + self.forwarding_camera = True + if not ret.gearShifter == 'drive' and self.CP.enableDsu: events.append(create_event('wrongGear', [ET.NO_ENTRY, ET.SOFT_DISABLE])) if ret.doorOpen: @@ -308,7 +368,8 @@ def apply(self, c): self.CC.update(self.sendcan, c.enabled, self.CS, self.frame, c.actuators, c.cruiseControl.cancel, c.hudControl.visualAlert, - c.hudControl.audibleAlert) + c.hudControl.audibleAlert, self.forwarding_camera, + c.hudControl.leftLaneVisible, c.hudControl.rightLaneVisible, c.hudControl.leadVisible) self.frame += 1 return False diff --git a/selfdrive/car/toyota/radar_interface.py b/selfdrive/car/toyota/radar_interface.py index 9af6aed47bf9c3..9711f1393ff566 100755 --- a/selfdrive/car/toyota/radar_interface.py +++ b/selfdrive/car/toyota/radar_interface.py @@ -1,53 +1,65 @@ #!/usr/bin/env python import os +import zmq +import time from selfdrive.can.parser import CANParser from cereal import car from common.realtime import sec_since_boot -import zmq from selfdrive.services import service_list import selfdrive.messaging as messaging +from selfdrive.car.toyota.values import NO_DSU_CAR -RADAR_MSGS = list(range(0x210, 0x220)) +RADAR_A_MSGS = list(range(0x210, 0x220)) +RADAR_B_MSGS = list(range(0x220, 0x230)) def _create_radard_can_parser(): dbc_f = 'toyota_prius_2017_adas.dbc' - msg_n = len(RADAR_MSGS) - signals = zip(['LONG_DIST'] * msg_n + ['NEW_TRACK'] * msg_n + ['LAT_DIST'] * msg_n + - ['REL_SPEED'] * msg_n + ['VALID'] * msg_n, - RADAR_MSGS * 5, - [255] * msg_n + [1] * msg_n + [0] * msg_n + [0] * msg_n + [0] * msg_n) - checks = zip(RADAR_MSGS, [20]*msg_n) + + msg_a_n = len(RADAR_A_MSGS) + msg_b_n = len(RADAR_B_MSGS) + + signals = zip(['LONG_DIST'] * msg_a_n + ['NEW_TRACK'] * msg_a_n + ['LAT_DIST'] * msg_a_n + + ['REL_SPEED'] * msg_a_n + ['VALID'] * msg_a_n + ['SCORE'] * msg_b_n, + RADAR_A_MSGS * 5 + RADAR_B_MSGS, + [255] * msg_a_n + [1] * msg_a_n + [0] * msg_a_n + [0] * msg_a_n + [0] * msg_a_n + [0] * msg_b_n) + + checks = zip(RADAR_A_MSGS + RADAR_B_MSGS, [20]*(msg_a_n + msg_b_n)) return CANParser(os.path.splitext(dbc_f)[0], signals, checks, 1) + class RadarInterface(object): def __init__(self, CP): # radar self.pts = {} - self.validCnt = {key: 0 for key in RADAR_MSGS} + self.valid_cnt = {key: 0 for key in RADAR_A_MSGS} self.track_id = 0 self.delay = 0.0 # Delay of radar - # Nidec self.rcp = _create_radard_can_parser() + self.no_dsu_car = CP.carFingerprint in NO_DSU_CAR context = zmq.Context() self.logcan = messaging.sub_sock(context, service_list['can'].port) def update(self): - canMonoTimes = [] + ret = car.RadarState.new_message() + if self.no_dsu_car: + # TODO: make a adas dbc file for dsu-less models + time.sleep(0.05) + return ret + + canMonoTimes = [] updated_messages = set() while 1: tm = int(sec_since_boot() * 1e9) updated_messages.update(self.rcp.update(tm, True)) - # TODO: do not hardcode last msg - if 0x21f in updated_messages: + if RADAR_B_MSGS[-1] in updated_messages: break - ret = car.RadarState.new_message() errors = [] if not self.rcp.can_valid: errors.append("commIssue") @@ -55,32 +67,34 @@ def update(self): ret.canMonoTimes = canMonoTimes for ii in updated_messages: - cpt = self.rcp.vl[ii] - - if cpt['LONG_DIST'] >=255 or cpt['NEW_TRACK']: - self.validCnt[ii] = 0 # reset counter - - if cpt['VALID'] and cpt['LONG_DIST'] < 255: - self.validCnt[ii] += 1 - else: - self.validCnt[ii] = max(self.validCnt[ii] -1, 0) - #print ii, self.validCnt[ii], cpt['VALID'], cpt['LONG_DIST'], cpt['LAT_DIST'] - - # radar point only valid if there have been enough valid measurements - if self.validCnt[ii] > 0: - if ii not in self.pts or cpt['NEW_TRACK']: - self.pts[ii] = car.RadarState.RadarPoint.new_message() - self.pts[ii].trackId = self.track_id - self.track_id += 1 - self.pts[ii].dRel = cpt['LONG_DIST'] # from front of car - self.pts[ii].yRel = -cpt['LAT_DIST'] # in car frame's y axis, left is positive - self.pts[ii].vRel = cpt['REL_SPEED'] - self.pts[ii].aRel = float('nan') - self.pts[ii].yvRel = float('nan') - self.pts[ii].measured = bool(cpt['VALID']) - else: - if ii in self.pts: - del self.pts[ii] + if ii in RADAR_A_MSGS: + cpt = self.rcp.vl[ii] + + if cpt['LONG_DIST'] >=255 or cpt['NEW_TRACK']: + self.valid_cnt[ii] = 0 # reset counter + if cpt['VALID'] and cpt['LONG_DIST'] < 255: + self.valid_cnt[ii] += 1 + else: + self.valid_cnt[ii] = max(self.valid_cnt[ii] -1, 0) + + score = self.rcp.vl[ii+16]['SCORE'] + # print ii, self.valid_cnt[ii], score, cpt['VALID'], cpt['LONG_DIST'], cpt['LAT_DIST'] + + # radar point only valid if it's a valid measurement and score is above 50 + if cpt['VALID'] or (score > 50 and cpt['LONG_DIST'] < 255 and self.valid_cnt[ii] > 0): + if ii not in self.pts or cpt['NEW_TRACK']: + self.pts[ii] = car.RadarState.RadarPoint.new_message() + self.pts[ii].trackId = self.track_id + self.track_id += 1 + self.pts[ii].dRel = cpt['LONG_DIST'] # from front of car + self.pts[ii].yRel = -cpt['LAT_DIST'] # in car frame's y axis, left is positive + self.pts[ii].vRel = cpt['REL_SPEED'] + self.pts[ii].aRel = float('nan') + self.pts[ii].yvRel = float('nan') + self.pts[ii].measured = bool(cpt['VALID']) + else: + if ii in self.pts: + del self.pts[ii] ret.points = self.pts.values() return ret diff --git a/selfdrive/car/toyota/toyotacan.py b/selfdrive/car/toyota/toyotacan.py index 150167b9e6a8da..720c0ef60a8a25 100644 --- a/selfdrive/car/toyota/toyotacan.py +++ b/selfdrive/car/toyota/toyotacan.py @@ -52,11 +52,11 @@ def create_ipas_steer_command(packer, steer, enabled, apgs_enabled): return packer.make_can_msg("STEERING_IPAS_COMMA", 0, values) -def create_steer_command(packer, steer, raw_cnt): +def create_steer_command(packer, steer, steer_req, raw_cnt): """Creates a CAN message for the Toyota Steer Command.""" values = { - "STEER_REQUEST": abs(steer) > 0.001, + "STEER_REQUEST": steer_req, "STEER_TORQUE_CMD": steer, "COUNTER": raw_cnt, "SET_ME_1": 1, @@ -64,11 +64,14 @@ def create_steer_command(packer, steer, raw_cnt): return packer.make_can_msg("STEERING_LKA", 0, values) -def create_accel_command(packer, accel, pcm_cancel, standstill_req): - # TODO: find the exact canceling bit +def create_accel_command(packer, accel, pcm_cancel, standstill_req, lead): + # TODO: find the exact canceling bit that does not create a chime values = { "ACCEL_CMD": accel, - "SET_ME_X63": 0x63, + "SET_ME_X01": 1, + "DISTANCE": 0, + "MINI_CAR": lead, + "SET_ME_X3": 3, "SET_ME_1": 1, "RELEASE_STANDSTILL": not standstill_req, "CANCEL_REQ": pcm_cancel, @@ -86,10 +89,10 @@ def create_fcw_command(packer, fcw): return packer.make_can_msg("ACC_HUD", 0, values) -def create_ui_command(packer, steer, sound1, sound2): +def create_ui_command(packer, steer, sound1, sound2, left_line, right_line): values = { - "RIGHT_LINE": 1, - "LEFT_LINE": 1, + "RIGHT_LINE": 1 if right_line else 2, + "LEFT_LINE": 1 if left_line else 2, "SET_ME_X0C": 0x0c, "SET_ME_X2C": 0x2c, "SET_ME_X38": 0x38, diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 649146073f6518..2f3f44448a5332 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -2,10 +2,16 @@ class CAR: PRIUS = "TOYOTA PRIUS 2017" - RAV4H = "TOYOTA RAV4 2017 HYBRID" + RAV4H = "TOYOTA RAV4 HYBRID 2017" RAV4 = "TOYOTA RAV4 2017" COROLLA = "TOYOTA COROLLA 2017" LEXUS_RXH = "LEXUS RX HYBRID 2017" + CHR = "TOYOTA C-HR 2018" + CHRH = "TOYOTA C-HR HYBRID 2018" + CAMRY = "TOYOTA CAMRY 2018" + CAMRYH = "TOYOTA CAMRY HYBRID 2018" + HIGHLANDER = "TOYOTA HIGHLANDER 2017" + HIGHLANDERH = "TOYOTA HIGHLANDER HYBRID 2018" class ECU: @@ -15,90 +21,125 @@ class ECU: # addr: (ecu, cars, bus, 1/freq*100, vl) -STATIC_MSGS = [(0x141, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 2, '\x00\x00\x00\x46'), - (0x128, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 3, '\xf4\x01\x90\x83\x00\x37'), - - (0x292, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 3, '\x00\x00\x00\x00\x00\x00\x00\x9e'), - (0x283, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 3, '\x00\x00\x00\x00\x00\x00\x8c'), - (0x2E6, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, '\xff\xf8\x00\x08\x7f\xe0\x00\x4e'), - (0x2E7, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, '\xa8\x9c\x31\x9c\x00\x00\x00\x02'), - - (0x240, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), - (0x241, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), - (0x244, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), - (0x245, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), - (0x248, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x00\x00\x00\x00\x00\x01'), - (0x344, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 5, '\x00\x00\x01\x00\x00\x00\x00\x50'), - - (0x160, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 7, '\x00\x00\x08\x12\x01\x31\x9c\x51'), - (0x161, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 7, '\x00\x1e\x00\x00\x00\x80\x07'), - - (0x32E, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 20, '\x00\x00\x00\x00\x00\x00\x00\x00'), - (0x33E, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 20, '\x0f\xff\x26\x40\x00\x1f\x00'), - (0x365, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 20, '\x00\x00\x00\x80\x03\x00\x08'), - (0x365, ECU.DSU, (CAR.RAV4, CAR.COROLLA), 0, 20, '\x00\x00\x00\x80\xfc\x00\x08'), - (0x366, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 20, '\x00\x00\x4d\x82\x40\x02\x00'), - (0x366, ECU.DSU, (CAR.RAV4, CAR.COROLLA), 0, 20, '\x00\x72\x07\xff\x09\xfe\x00'), - - (0x367, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 40, '\x06\x00'), - - (0x414, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x17\x00'), - (0x489, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00'), - (0x48a, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00'), - (0x48b, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x66\x06\x08\x0a\x02\x00\x00\x00'), - (0x4d3, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x1C\x00\x00\x01\x00\x00\x00\x00'), - (0x130, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 100, '\x00\x00\x00\x00\x00\x00\x38'), - (0x466, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4), 1, 100, '\x20\x20\xAD'), - (0x466, ECU.CAM, (CAR.COROLLA), 1, 100, '\x24\x20\xB1'), - (0x396, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\xBD\x00\x00\x00\x60\x0F\x02\x00'), - (0x43A, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x84\x00\x00\x00\x00\x00\x00\x00'), - (0x43B, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00\x00'), - (0x497, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00\x00'), - (0x4CC, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x0D\x00\x00\x00\x00\x00\x00\x00'), - (0x4CB, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x0c\x00\x00\x00\x00\x00\x00\x00'), - (0x470, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 1, 100, '\x00\x00\x02\x7a'), - ] +STATIC_MSGS = [ + (0x130, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 100, '\x00\x00\x00\x00\x00\x00\x38'), + (0x240, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), + (0x241, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), + (0x244, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), + (0x245, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), + (0x248, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 5, '\x00\x00\x00\x00\x00\x00\x01'), + (0x367, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 0, 40, '\x06\x00'), + (0x414, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 0, 100, '\x00\x00\x00\x00\x00\x00\x17\x00'), + (0x466, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 100, '\x20\x20\xAD'), + (0x466, ECU.CAM, (CAR.COROLLA), 1, 100, '\x24\x20\xB1'), + (0x489, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 0, 100, '\x00\x00\x00\x00\x00\x00\x00'), + (0x48a, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 0, 100, '\x00\x00\x00\x00\x00\x00\x00'), + (0x48b, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 0, 100, '\x66\x06\x08\x0a\x02\x00\x00\x00'), + (0x4d3, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x1C\x00\x00\x01\x00\x00\x00\x00'), + + (0x128, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 3, '\xf4\x01\x90\x83\x00\x37'), + (0x128, ECU.DSU, (CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 3, '\x03\x00\x20\x00\x00\x52'), + (0x141, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 2, '\x00\x00\x00\x46'), + (0x160, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 1, 7, '\x00\x00\x08\x12\x01\x31\x9c\x51'), + (0x161, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 7, '\x00\x1e\x00\x00\x00\x80\x07'), + (0X161, ECU.DSU, (CAR.HIGHLANDERH, CAR.HIGHLANDER), 1, 7, '\x00\x1e\x00\xd4\x00\x00\x5b'), + (0x283, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 0, 3, '\x00\x00\x00\x00\x00\x00\x8c'), + (0x2E6, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, '\xff\xf8\x00\x08\x7f\xe0\x00\x4e'), + (0x2E7, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, '\xa8\x9c\x31\x9c\x00\x00\x00\x02'), + (0x33E, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 20, '\x0f\xff\x26\x40\x00\x1f\x00'), + (0x344, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH), 0, 5, '\x00\x00\x01\x00\x00\x00\x00\x50'), + (0x365, ECU.DSU, (CAR.PRIUS, CAR.LEXUS_RXH, CAR.HIGHLANDERH), 0, 20, '\x00\x00\x00\x80\x03\x00\x08'), + (0x365, ECU.DSU, (CAR.RAV4, CAR.RAV4H, CAR.COROLLA, CAR.HIGHLANDER), 0, 20, '\x00\x00\x00\x80\xfc\x00\x08'), + (0x366, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.HIGHLANDERH), 0, 20, '\x00\x00\x4d\x82\x40\x02\x00'), + (0x366, ECU.DSU, (CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER), 0, 20, '\x00\x72\x07\xff\x09\xfe\x00'), + (0x470, ECU.DSU, (CAR.PRIUS, CAR.LEXUS_RXH), 1, 100, '\x00\x00\x02\x7a'), + (0x470, ECU.DSU, (CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.RAV4H), 1, 100, '\x00\x00\x01\x79'), + (0x4CB, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDERH, CAR.HIGHLANDER), 0, 100, '\x0c\x00\x00\x00\x00\x00\x00\x00'), + + (0x292, ECU.APGS, (CAR.PRIUS), 0, 3, '\x00\x00\x00\x00\x00\x00\x00\x9e'), + (0x32E, ECU.APGS, (CAR.PRIUS), 0, 20, '\x00\x00\x00\x00\x00\x00\x00\x00'), + (0x396, ECU.APGS, (CAR.PRIUS), 0, 100, '\xBD\x00\x00\x00\x60\x0F\x02\x00'), + (0x43A, ECU.APGS, (CAR.PRIUS), 0, 100, '\x84\x00\x00\x00\x00\x00\x00\x00'), + (0x43B, ECU.APGS, (CAR.PRIUS), 0, 100, '\x00\x00\x00\x00\x00\x00\x00\x00'), + (0x497, ECU.APGS, (CAR.PRIUS), 0, 100, '\x00\x00\x00\x00\x00\x00\x00\x00'), + (0x4CC, ECU.APGS, (CAR.PRIUS), 0, 100, '\x0D\x00\x00\x00\x00\x00\x00\x00'), +] + +ECU_FINGERPRINT = { + ECU.CAM: 0x2e4, # steer torque cmd + ECU.DSU: 0x343, # accel cmd + ECU.APGS: 0x835, # angle cmd +} -def check_ecu_msgs(fingerprint, candidate, ecu): +def check_ecu_msgs(fingerprint, ecu): # return True if fingerprint contains messages normally sent by a given ecu - ecu_msgs = [x[0] for x in STATIC_MSGS if (x[1] == ecu and - candidate in x[2] and - x[3] == 0)] - - return any(msg for msg in fingerprint if msg in ecu_msgs) + return ECU_FINGERPRINT[ecu] in fingerprint FINGERPRINTS = { CAR.RAV4: [{ - 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 547: 8, 548: 8, 552: 4, 562: 4, 608: 8, 610: 5, 643: 7, 705: 8, 725: 2, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 918: 7, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 4, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1008: 2, 1014: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1408: 8, 1409: 8, 1410: 8, 1552: 8, 1553: 8, 1554: 8, 1555: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1596: 8, 1597: 8, 1600: 8, 1656: 8, 1664: 8, 1728: 8, 1745: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 512: 6, 513: 6, 547: 8, 548: 8, 552: 4, 562: 4, 608: 8, 610: 5, 643: 7, 705: 8, 725: 2, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 918: 7, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 4, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1008: 2, 1014: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1408: 8, 1409: 8, 1410: 8, 1552: 8, 1553: 8, 1554: 8, 1555: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1596: 8, 1597: 8, 1600: 8, 1656: 8, 1664: 8, 1728: 8, 1745: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8, 2015: 8, 2024: 8 }], CAR.RAV4H: [{ 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 296: 8, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 547: 8, 548: 8, 550: 8, 552: 4, 560: 7, 562: 4, 581: 5, 608: 8, 610: 5, 643: 7, 705: 8, 713: 8, 725: 2, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 918: 7, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 3, 955: 8, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1008: 2, 1014: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1184: 8, 1185: 8, 1186: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1197: 8, 1198: 8, 1199: 8, 1212: 8, 1227: 8, 1228: 8, 1232: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1408: 8, 1409: 8, 1410: 8, 1552: 8, 1553: 8, 1554: 8, 1555: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1596: 8, 1597: 8, 1600: 8, 1656: 8, 1664: 8, 1728: 8, 1745: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 - }], + }, + # Chinese RAV4 + { + 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 355: 5, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 547: 8, 548: 8, 552: 4, 562: 4, 608: 8, 610: 5, 643: 7, 705: 8, 725: 2, 740: 5, 742: 8, 743: 8, 800: 8, 830: 7, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 921: 8, 922: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1008: 2, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1207: 8, 1227: 8, 1235: 8, 1263: 8, 1279: 8, 1552: 8, 1553: 8, 1554: 8, 1555: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1596: 8, 1597: 8, 1600: 8, 1664: 8, 1728: 8, 1745: 8, 1779: 8 + }], CAR.PRIUS: [{ - 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 814: 8, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1077: 8, 1082: 8, 1083: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1175: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + # with ipas + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 512: 6, 513: 6, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 814: 8, 824: 2, 829: 2, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 869: 7, 870: 7, 871: 2,898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 974: 8, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1083: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1175: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }], + #Corolla w/ added Pedal Support (512L and 513L) + CAR.COROLLA: [{ + 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 512: 6, 513: 6, 547: 8, 548: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 2, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 4, 956: 8, 979: 2, 992: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1196: 8, 1227: 8, 1235: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1596: 8, 1597: 8, 1600: 8, 1664: 8, 1728: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8, 2016: 8, 2017: 8, 2018: 8, 2019: 8, 2020: 8, 2021: 8, 2022: 8, 2023: 8, 2024: 8 + }], + CAR.LEXUS_RXH: [{ + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 5, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 814: 8, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 6, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1071: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1595: 8, 1777: 8, 1779: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1840: 8, 1848: 8, 1904: 8, 1912: 8, 1940: 8, 1941: 8, 1948: 8, 1949: 8, 1952: 8, 1956: 8, 1960: 8, 1964: 8, 1986: 8, 1990: 8, 1994: 8, 1998: 8, 2004: 8, 2012: 8 }, - # Prius Prime + # RX450HL { - 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 814: 8, 824: 2, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 869: 7, 870: 7, 871: 2,898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 974: 8, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1083: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1175: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 5, 643: 7, 658: 8, 713: 8, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 814: 8, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 6, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1056: 8, 1057: 8, 1059: 1, 1063: 8, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1114: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1592: 8, 1594: 8, 1595: 8, 1649: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }], + CAR.CHR: [{ + 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 705: 8, 740: 5, 800: 8, 810: 2, 812: 8, 814: 8, 830: 7, 835: 8, 836: 8, 845: 5, 869: 7, 870: 7, 871: 2, 898: 8, 913: 8, 918: 8, 921: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 976: 1, 1014: 8, 1017: 8, 1020: 8, 1021: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1082: 8, 1083: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1175: 8, 1228: 8, 1235: 8, 1237: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1745: 8, 1779: 8 + }], + CAR.CHRH: [{ + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 713: 8, 740: 5, 800: 8, 810: 2, 812: 8, 814: 8, 829: 2, 830: 7, 835: 8, 836: 8, 845: 5, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1021: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1083: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1175: 8, 1228: 8, 1235: 8, 1237: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1745: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }], + CAR.CAMRY: [ + #XLE and LE + { + 36: 8, 37: 8, 119: 6, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 8, 643: 7, 658: 8, 705: 8, 728: 8, 740: 5, 761: 8, 764: 8, 800: 8, 810: 2, 812: 8, 814: 8, 818: 8, 822: 8, 824: 8, 830: 7, 835: 8, 836: 8, 869: 7, 870: 7, 871: 2, 888: 8, 889: 8, 891: 8, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 976: 1, 983: 8, 984: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1011: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1076: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1412: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1745: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1808: 8, 1816: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }, - # Taiwanese Prius Prime + #XSE and SE { - 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 814: 8, 824: 2, 829: 2, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 869: 7, 870: 7, 871: 2,898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 974: 8, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1083: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1175: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + 36: 8, 37: 8, 114: 5, 119: 6, 120: 4, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 8, 643: 7, 658: 8, 705: 8, 728: 8, 761: 8, 764: 8, 800: 8, 810: 2, 812: 8, 814: 8, 818: 8, 822: 8, 824: 8, 830: 7, 835: 8, 836: 8, 869: 7, 870: 7, 888: 8, 889: 8, 891: 8, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 976: 1, 983: 8, 984: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1011: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1056: 8, 1059: 1, 1076: 8, 1077: 8, 1082: 8, 1114: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1228: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1412: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1745: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1808: 8, 1816: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }], - CAR.COROLLA: [{ - 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 547: 8, 548: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 2, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 4, 956: 8, 979: 2, 992: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1196: 8, 1227: 8, 1235: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1596: 8, 1597: 8, 1600: 8, 1664: 8, 1728: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + CAR.CAMRYH: [ + #LE and LE with Blindspot Monitor + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 728: 8, 740: 5, 761: 8, 764: 8, 800: 8, 810: 2, 812: 8, 818: 8, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 869: 7, 870: 7, 871: 2, 889: 8, 898: 8, 900: 6, 902: 6, 905: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 983: 8, 984: 8, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1011: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1745: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }, + #SL + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 728: 8, 740: 5, 761: 8, 764: 8, 800: 8, 810: 2, 812: 8, 818: 8, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 869: 7, 870: 7, 871: 2, 888: 8, 889: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1745: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }], + CAR.HIGHLANDER: [{ + 36: 8, 37: 8, 114: 5, 119: 6, 120: 4, 170: 8, 180: 8, 186: 4, 238: 4, 355: 5, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 545: 5, 550: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 725: 2, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 921: 8, 922: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1008: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1182: 8, 1183: 8, 1189: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1197: 8, 1198: 8, 1199: 8, 1206: 8, 1207: 8, 1212: 8, 1227: 8, 1235: 8, 1237: 8, 1279: 8, 1408: 8, 1409: 8, 1410: 8, 1552: 8, 1553: 8, 1554: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1599: 8, 1656: 8, 1666: 8, 1667: 8, 1728: 8, 1745: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }, - # Corolla LE 2017 + # 2017 Highlander Limited { - 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 547: 8, 548: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 2, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 4, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1196: 8, 1227: 8, 1235: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1596: 8, 1597: 8, 1600: 8, 1664: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8, 2016: 8, 2017: 8, 2018: 8, 2019: 8, 2020: 8, 2021: 8, 2022: 8, 2023: 8, 2024: 8 + 36: 8, 37: 8, 114: 5, 119: 6, 120: 4, 170: 8, 180: 8, 186: 4, 238: 4, 355: 5, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 545: 5, 550: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 725: 2, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 918: 7, 921: 8, 922: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1008: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1182: 8, 1183: 8, 1189: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1197: 8, 1198: 8, 1199: 8, 1206: 8, 1207: 8, 1212: 8, 1227: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1408: 8, 1409: 8, 1410: 8, 1552: 8, 1553: 8, 1554: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1599: 8, 1656: 8, 1728: 8, 1745: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }], - CAR.LEXUS_RXH: [{ - 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 5, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 814: 8, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 6, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1071: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1595: 8, 1777: 8, 1779: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1840: 8, 1848: 8, 1904: 8, 1912: 8, 1940: 8, 1941: 8, 1948: 8, 1949: 8, 1952: 8, 1956: 8, 1960: 8, 1964: 8, 1986: 8, 1990: 8, 1994: 8, 1998: 8, 2004: 8, 2012: 8 + CAR.HIGHLANDERH: [{ + 36: 8, 37: 8, 170: 8, 180: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 581: 5, 608: 8, 610: 5, 643: 7, 713: 8, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 918: 7, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 3, 955: 8, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1112: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1184: 8, 1185: 8, 1186: 8, 1189: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1197: 8, 1198: 8, 1199: 8, 1206: 8, 1212: 8, 1227: 8, 1232: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1554: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1599: 8, 1656: 8, 1728: 8, 1745: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }], } +STEER_THRESHOLD = 100 DBC = { CAR.RAV4H: dbc_dict('toyota_rav4_hybrid_2017_pt_generated', 'toyota_prius_2017_adas'), @@ -106,4 +147,12 @@ def check_ecu_msgs(fingerprint, candidate, ecu): CAR.PRIUS: dbc_dict('toyota_prius_2017_pt_generated', 'toyota_prius_2017_adas'), CAR.COROLLA: dbc_dict('toyota_corolla_2017_pt_generated', 'toyota_prius_2017_adas'), CAR.LEXUS_RXH: dbc_dict('lexus_rx_hybrid_2017_pt_generated', 'toyota_prius_2017_adas'), + CAR.CHR: dbc_dict('toyota_chr_2018_pt_generated', 'toyota_prius_2017_adas'), + CAR.CHRH: dbc_dict('toyota_chr_hybrid_2018_pt_generated', 'toyota_prius_2017_adas'), + CAR.CAMRY: dbc_dict('toyota_chr_2018_pt_generated', 'toyota_prius_2017_adas'), + CAR.CAMRYH: dbc_dict('toyota_camry_hybrid_2018_pt_generated', 'toyota_prius_2017_adas'), + CAR.HIGHLANDER: dbc_dict('toyota_highlander_2017_pt_generated', 'toyota_prius_2017_adas'), + CAR.HIGHLANDERH: dbc_dict('toyota_highlander_hybrid_2018_pt_generated', 'toyota_prius_2017_adas'), } + +NO_DSU_CAR = [CAR.CHR, CAR.CHRH, CAR.CAMRY, CAR.CAMRYH] diff --git a/selfdrive/common/buffering.c b/selfdrive/common/buffering.c new file mode 100644 index 00000000000000..9cbb1b86e0df11 --- /dev/null +++ b/selfdrive/common/buffering.c @@ -0,0 +1,438 @@ +#include +#include +#include +#include +#include +#include + +#include "common/efd.h" + +#include "buffering.h" + +void tbuffer_init(TBuffer *tb, int num_bufs, const char* name) { + assert(num_bufs >= 3); + + memset(tb, 0, sizeof(TBuffer)); + tb->reading = (bool*)calloc(num_bufs, sizeof(bool)); + assert(tb->reading); + tb->pending_idx = -1; + tb->num_bufs = num_bufs; + tb->name = name; + + pthread_mutex_init(&tb->lock, NULL); + pthread_cond_init(&tb->cv, NULL); + tb->efd = efd_init(); + assert(tb->efd >= 0); +} + +void tbuffer_init2(TBuffer *tb, int num_bufs, const char* name, + void (*release_cb)(void* c, int idx), + void* cb_cookie) { + + tbuffer_init(tb, num_bufs, name); + + tb->release_cb = release_cb; + tb->cb_cookie = cb_cookie; +} + +int tbuffer_efd(TBuffer *tb) { + return tb->efd; +} + +int tbuffer_select(TBuffer *tb) { + pthread_mutex_lock(&tb->lock); + + int i; + for (i=0; inum_bufs; i++) { + if (!tb->reading[i] && i != tb->pending_idx) { + break; + } + } + assert(i < tb->num_bufs); + + pthread_mutex_unlock(&tb->lock); + return i; +} + +void tbuffer_dispatch(TBuffer *tb, int idx) { + pthread_mutex_lock(&tb->lock); + + if (tb->pending_idx != -1) { + //printf("tbuffer (%s) dropped!\n", tb->name ? tb->name : "?"); + if (tb->release_cb) { + tb->release_cb(tb->cb_cookie, tb->pending_idx); + } + tb->pending_idx = -1; + } + + tb->pending_idx = idx; + + efd_write(tb->efd); + pthread_cond_signal(&tb->cv); + + pthread_mutex_unlock(&tb->lock); +} + +int tbuffer_acquire(TBuffer *tb) { + pthread_mutex_lock(&tb->lock); + + if (tb->stopped) { + pthread_mutex_unlock(&tb->lock); + return -1; + } + + while (tb->pending_idx == -1) { + pthread_cond_wait(&tb->cv, &tb->lock); + + if (tb->stopped) { + pthread_mutex_unlock(&tb->lock); + return -1; + } + } + + efd_clear(tb->efd); + + int ret = tb->pending_idx; + assert(ret < tb->num_bufs); + + tb->reading[ret] = true; + tb->pending_idx = -1; + + pthread_mutex_unlock(&tb->lock); + + return ret; +} + +static void tbuffer_release_locked(TBuffer *tb, int idx) { + assert(idx < tb->num_bufs); + if (!tb->reading[idx]) { + printf("!! releasing tbuffer we aren't reading %d\n", idx); + } + + if (tb->release_cb) { + tb->release_cb(tb->cb_cookie, idx); + } + + tb->reading[idx] = false; +} + +void tbuffer_release(TBuffer *tb, int idx) { + pthread_mutex_lock(&tb->lock); + tbuffer_release_locked(tb, idx); + pthread_mutex_unlock(&tb->lock); +} + +void tbuffer_release_all(TBuffer *tb) { + pthread_mutex_lock(&tb->lock); + for (int i=0; inum_bufs; i++) { + if (tb->reading[i]) { + tbuffer_release_locked(tb, i); + } + } + pthread_mutex_unlock(&tb->lock); +} + +void tbuffer_stop(TBuffer *tb) { + pthread_mutex_lock(&tb->lock); + tb->stopped = true; + efd_write(tb->efd); + pthread_cond_signal(&tb->cv); + pthread_mutex_unlock(&tb->lock); +} + + + + + + + + + + + +void pool_init(Pool *s, int num_bufs) { + assert(num_bufs > 3); + + memset(s, 0, sizeof(*s)); + s->num_bufs = num_bufs; + + s->refcnt = (int*)calloc(num_bufs, sizeof(int)); + s->ts = (int*)calloc(num_bufs, sizeof(int)); + + s->counter = 1; + + pthread_mutex_init(&s->lock, NULL); +} + +void pool_init2(Pool *s, int num_bufs, + void (*release_cb)(void* c, int idx), void* cb_cookie) { + + pool_init(s, num_bufs); + s->cb_cookie = cb_cookie; + s->release_cb = release_cb; + +} + + +void pool_acquire(Pool *s, int idx) { + pthread_mutex_lock(&s->lock); + + assert(idx >= 0 && idx < s->num_bufs); + + s->refcnt[idx]++; + + pthread_mutex_unlock(&s->lock); +} + +static void pool_release_locked(Pool *s, int idx) { + // printf("release %d refcnt %d\n", idx, s->refcnt[idx]); + + assert(idx >= 0 && idx < s->num_bufs); + + assert(s->refcnt[idx] > 0); + s->refcnt[idx]--; + + // printf("release %d -> %d, %p\n", idx, s->refcnt[idx], s->release_cb); + if (s->refcnt[idx] == 0 && s->release_cb) { + // printf("call %p\b", s->release_cb); + s->release_cb(s->cb_cookie, idx); + } +} + +void pool_release(Pool *s, int idx) { + pthread_mutex_lock(&s->lock); + pool_release_locked(s, idx); + pthread_mutex_unlock(&s->lock); +} + +TBuffer* pool_get_tbuffer(Pool *s) { + pthread_mutex_lock(&s->lock); + + assert(s->num_tbufs < POOL_MAX_TBUFS); + TBuffer* tbuf = &s->tbufs[s->num_tbufs]; + s->num_tbufs++; + tbuffer_init2(tbuf, s->num_bufs, + "pool", (void (*)(void *, int))pool_release, s); + + bool stopped = s->stopped; + pthread_mutex_unlock(&s->lock); + + // Stop the tbuffer so we can return a valid object. + // We must stop here because the pool_stop may have already been called, + // in which case tbuffer_stop may never be called again. + if (stopped) { + tbuffer_stop(tbuf); + } + return tbuf; +} + +PoolQueue* pool_get_queue(Pool *s) { + pthread_mutex_lock(&s->lock); + + int i; + for (i = 0; i < POOL_MAX_QUEUES; i++) { + if (!s->queues[i].inited) { + break; + } + } + assert(i < POOL_MAX_QUEUES); + + PoolQueue *c = &s->queues[i]; + memset(c, 0, sizeof(*c)); + + c->pool = s; + c->inited = true; + + c->efd = efd_init(); + assert(c->efd >= 0); + + c->num_bufs = s->num_bufs; + c->num = c->num_bufs+1; + c->idx = (int*)malloc(sizeof(int)*c->num); + memset(c->idx, -1, sizeof(int)*c->num); + + pthread_mutex_init(&c->lock, NULL); + pthread_cond_init(&c->cv, NULL); + + pthread_mutex_unlock(&s->lock); + return c; +} + +void pool_release_queue(PoolQueue *c) { + Pool *s = c->pool; + + pthread_mutex_lock(&s->lock); + pthread_mutex_lock(&c->lock); + + for (int i=0; inum; i++) { + if (c->idx[i] != -1) { + pool_release_locked(s, c->idx[i]); + } + } + + close(c->efd); + free(c->idx); + + c->inited = false; + + pthread_mutex_unlock(&c->lock); + + pthread_mutex_destroy(&c->lock); + pthread_cond_destroy(&c->cv); + + pthread_mutex_unlock(&s->lock); +} + +int pool_select(Pool *s) { + pthread_mutex_lock(&s->lock); + + int i; + for (i=0; inum_bufs; i++) { + if (s->refcnt[i] == 0) { + break; + } + } + + if (i >= s->num_bufs) { + // overwrite the oldest + // still being using in a queue or tbuffer :/ + + int min_k = 0; + int min_ts = s->ts[0]; + for (int k=1; knum_bufs; k++) { + if (s->ts[k] < min_ts) { + min_ts = s->ts[k]; + min_k = k; + } + } + i = min_k; + printf("pool is full! evicted %d\n", min_k); + + // might be really bad if the user is doing pointery stuff + if (s->release_cb) { + s->release_cb(s->cb_cookie, min_k); + } + } + + s->refcnt[i]++; + + s->ts[i] = s->counter; + s->counter++; + + pthread_mutex_unlock(&s->lock); + + return i; +} + +void pool_push(Pool *s, int idx) { + pthread_mutex_lock(&s->lock); + + // printf("push %d head %d tail %d\n", idx, s->head, s->tail); + + assert(idx >= 0 && idx < s->num_bufs); + + s->ts[idx] = s->counter; + s->counter++; + + assert(s->refcnt[idx] > 0); + s->refcnt[idx]--; //push is a implcit release + + int num_tbufs = s->num_tbufs; + s->refcnt[idx] += num_tbufs; + + // dispatch pool queues + for (int i=0; iqueues[i]; + if (!c->inited) continue; + + pthread_mutex_lock(&c->lock); + if (((c->head+1) % c->num) == c->tail) { + // queue is full. skip for now + pthread_mutex_unlock(&c->lock); + continue; + } + + s->refcnt[idx]++; + + c->idx[c->head] = idx; + c->head = (c->head+1) % c->num; + assert(c->head != c->tail); + pthread_mutex_unlock(&c->lock); + + efd_write(c->efd); + pthread_cond_signal(&c->cv); + } + + pthread_mutex_unlock(&s->lock); + + for (int i=0; itbufs[i], idx); + } +} + +int poolq_pop(PoolQueue *c) { + pthread_mutex_lock(&c->lock); + + if (c->stopped) { + pthread_mutex_unlock(&c->lock); + return -1; + } + + while (c->head == c->tail) { + pthread_cond_wait(&c->cv, &c->lock); + + if (c->stopped) { + pthread_mutex_unlock(&c->lock); + return -1; + } + } + + // printf("pop head %d tail %d\n", s->head, s->tail); + + assert(c->head != c->tail); + + int r = c->idx[c->tail]; + c->idx[c->tail] = -1; + c->tail = (c->tail+1) % c->num; + + // queue event is level triggered + if (c->head == c->tail) { + efd_clear(c->efd); + } + + // printf("pop %d head %d tail %d\n", r, s->head, s->tail); + + assert(r >= 0 && r < c->num_bufs); + + pthread_mutex_unlock(&c->lock); + + return r; +} + +int poolq_efd(PoolQueue *c) { + return c->efd; +} + +void poolq_release(PoolQueue *c, int idx) { + pool_release(c->pool, idx); +} + +void pool_stop(Pool *s) { + for (int i=0; inum_tbufs; i++) { + tbuffer_stop(&s->tbufs[i]); + } + + pthread_mutex_lock(&s->lock); + s->stopped = true; + for (int i=0; iqueues[i]; + if (!c->inited) continue; + + pthread_mutex_lock(&c->lock); + c->stopped = true; + pthread_mutex_unlock(&c->lock); + efd_write(c->efd); + pthread_cond_signal(&c->cv); + } + pthread_mutex_unlock(&s->lock); +} diff --git a/selfdrive/common/buffering.h b/selfdrive/common/buffering.h new file mode 100644 index 00000000000000..fda4c644928423 --- /dev/null +++ b/selfdrive/common/buffering.h @@ -0,0 +1,123 @@ +#ifndef BUFFERING_H +#define BUFFERING_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// Tripple buffering helper + +typedef struct TBuffer { + pthread_mutex_t lock; + pthread_cond_t cv; + int efd; + + bool* reading; + int pending_idx; + + int num_bufs; + const char* name; + + void (*release_cb)(void* c, int idx); + void *cb_cookie; + + bool stopped; +} TBuffer; + +// num_bufs must be at least the number of buffers that can be acquired simultaniously plus two +void tbuffer_init(TBuffer *tb, int num_bufs, const char* name); + +void tbuffer_init2(TBuffer *tb, int num_bufs, const char* name, + void (*release_cb)(void* c, int idx), + void* cb_cookie); + +// returns an eventfd that signals if a buffer is ready and tbuffer_acquire shouldn't to block. +// useful to polling on multiple tbuffers. +int tbuffer_efd(TBuffer *tb); + +// Chooses a buffer that's not reading or pending +int tbuffer_select(TBuffer *tb); + +// Called when the writer is done with their buffer +// - Wakes up the reader if it's waiting +// - releases the pending buffer if the reader's too slow +void tbuffer_dispatch(TBuffer *tb, int idx); + +// Called when the reader wants a new buffer, will return -1 when stopped +int tbuffer_acquire(TBuffer *tb); + +// Called when the reader is done with their buffer +void tbuffer_release(TBuffer *tb, int idx); + +void tbuffer_release_all(TBuffer *tb); + +void tbuffer_stop(TBuffer *tb); + + + + +// pool: buffer pool + queue thing... + +#define POOL_MAX_TBUFS 8 +#define POOL_MAX_QUEUES 8 + +typedef struct Pool Pool; + +typedef struct PoolQueue { + pthread_mutex_t lock; + pthread_cond_t cv; + Pool* pool; + bool inited; + bool stopped; + int efd; + int num_bufs; + int num; + int head, tail; + int* idx; +} PoolQueue; + +int poolq_pop(PoolQueue *s); +int poolq_efd(PoolQueue *s); +void poolq_release(PoolQueue *c, int idx); + +typedef struct Pool { + pthread_mutex_t lock; + bool stopped; + int num_bufs; + int counter; + + int* ts; + int* refcnt; + + void (*release_cb)(void* c, int idx); + void *cb_cookie; + + int num_tbufs; + TBuffer tbufs[POOL_MAX_TBUFS]; + PoolQueue queues[POOL_MAX_QUEUES]; +} Pool; + +void pool_init(Pool *s, int num_bufs); +void pool_init2(Pool *s, int num_bufs, + void (*release_cb)(void* c, int idx), void* cb_cookie); + +TBuffer* pool_get_tbuffer(Pool *s); + +PoolQueue* pool_get_queue(Pool *s); +void pool_release_queue(PoolQueue *q); + +int pool_select(Pool *s); +void pool_push(Pool *s, int idx); +void pool_acquire(Pool *s, int idx); +void pool_release(Pool *s, int idx); +void pool_stop(Pool *s); + + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/selfdrive/common/efd.c b/selfdrive/common/efd.c new file mode 100644 index 00000000000000..78a7c098949b56 --- /dev/null +++ b/selfdrive/common/efd.c @@ -0,0 +1,56 @@ +#include +#include + +#ifdef __linux__ +#include +#else +#include +#include +#define EVENT_IDENT 42 +#endif + +#include "efd.h" + + +int efd_init() { +#ifdef __linux__ + return eventfd(0, EFD_CLOEXEC); +#else + int fd = kqueue(); + assert(fd >= 0); + + struct kevent kev; + EV_SET(&kev, EVENT_IDENT, EVFILT_USER, EV_ADD | EV_CLEAR, 0, 0, NULL); + + struct timespec timeout = {0, 0}; + int err = kevent(fd, &kev, 1, NULL, 0, &timeout); + assert(err != -1); + + return fd; +#endif +} + +void efd_write(int fd) { +#ifdef __linux__ + eventfd_write(fd, 1); +#else + struct kevent kev; + EV_SET(&kev, EVENT_IDENT, EVFILT_USER, 0, NOTE_TRIGGER, 0, NULL); + + struct timespec timeout = {0, 0}; + int err = kevent(fd, &kev, 1, NULL, 0, &timeout); + assert(err != -1); +#endif +} + +void efd_clear(int fd) { +#ifdef __linux__ + eventfd_t efd_cnt; + eventfd_read(fd, &efd_cnt); +#else + struct kevent kev; + struct timespec timeout = {0, 0}; + int nfds = kevent(fd, NULL, 0, &kev, 1, &timeout); + assert(nfds != -1); +#endif +} diff --git a/selfdrive/common/efd.h b/selfdrive/common/efd.h new file mode 100644 index 00000000000000..056482ffa51f3e --- /dev/null +++ b/selfdrive/common/efd.h @@ -0,0 +1,17 @@ +#ifndef EFD_H +#define EFD_H + +#ifdef __cplusplus +extern "C" { +#endif + +// event fd: a semaphore that can be poll()'d +int efd_init(); +void efd_write(int fd); +void efd_clear(int fd); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/selfdrive/common/ipc.c b/selfdrive/common/ipc.c new file mode 100644 index 00000000000000..8d391074786815 --- /dev/null +++ b/selfdrive/common/ipc.c @@ -0,0 +1,119 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "ipc.h" + +int ipc_connect(const char* socket_path) { + int err; + + int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); + assert(sock >= 0); + struct sockaddr_un addr = { + .sun_family = AF_UNIX, + }; + snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path); + err = connect(sock, (struct sockaddr*)&addr, sizeof(addr)); + if (err != 0) { + close(sock); + return -1; + } + + return sock; +} + +int ipc_bind(const char* socket_path) { + int err; + + unlink(socket_path); + + int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); + struct sockaddr_un addr = { + .sun_family = AF_UNIX, + }; + snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path); + err = bind(sock, (struct sockaddr *)&addr, sizeof(addr)); + assert(err == 0); + + err = listen(sock, 3); + assert(err == 0); + + return sock; +} + + +int ipc_sendrecv_with_fds(bool send, int fd, void *buf, size_t buf_size, int* fds, int num_fds, + int *out_num_fds) { + int err; + + char control_buf[CMSG_SPACE(sizeof(int) * num_fds)]; + memset(control_buf, 0, CMSG_SPACE(sizeof(int) * num_fds)); + + struct iovec iov = { + .iov_base = buf, + .iov_len = buf_size, + }; + struct msghdr msg = { + .msg_iov = &iov, + .msg_iovlen = 1, + }; + + if (num_fds > 0) { + assert(fds); + + msg.msg_control = control_buf; + msg.msg_controllen = CMSG_SPACE(sizeof(int) * num_fds); + } + + if (send) { + if (num_fds) { + struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); + assert(cmsg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int) * num_fds); + memcpy(CMSG_DATA(cmsg), fds, sizeof(int) * num_fds); + // printf("send clen %d -> %d\n", num_fds, cmsg->cmsg_len); + } + return sendmsg(fd, &msg, 0); + } else { + int r = recvmsg(fd, &msg, 0); + if (r < 0) return r; + + int recv_fds = 0; + if (msg.msg_controllen > 0) { + struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); + assert(cmsg); + assert(cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS); + recv_fds = (cmsg->cmsg_len - CMSG_LEN(0)); + assert(recv_fds > 0 && (recv_fds % sizeof(int)) == 0); + recv_fds /= sizeof(int); + // printf("recv clen %d -> %d\n", cmsg->cmsg_len, recv_fds); + // assert(cmsg->cmsg_len == CMSG_LEN(sizeof(int) * num_fds)); + + assert(fds && recv_fds <= num_fds); + memcpy(fds, CMSG_DATA(cmsg), sizeof(int) * recv_fds); + } + + if (msg.msg_flags) { + for (int i=0; i + +#ifdef __cplusplus +extern "C" { +#endif + +int ipc_connect(const char* socket_path); +int ipc_bind(const char* socket_path); +int ipc_sendrecv_with_fds(bool send, int fd, void *buf, size_t buf_size, int* fds, int num_fds, + int *out_num_fds); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif \ No newline at end of file diff --git a/selfdrive/common/params.cc b/selfdrive/common/params.cc index 5b0d216bdd873c..7bbcf5fad11c60 100644 --- a/selfdrive/common/params.cc +++ b/selfdrive/common/params.cc @@ -1,15 +1,20 @@ -#include "selfdrive/common/params.h" - -#include "selfdrive/common/util.h" +#include "common/params.h" #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif // _GNU_SOURCE -#include -#include -#include #include +#include +#include +#include +#include + +#include +#include + +#include "common/util.h" +#include "common/utilpp.h" namespace { @@ -152,3 +157,40 @@ void read_db_value_blocking(const char* params_path, const char* key, } } } + +int read_db_all(const char* params_path, std::map *params) { + int err = 0; + + if (params_path == NULL) { + params_path = default_params_path; + } + + std::string lock_path = util::string_format("%s/.lock", params_path); + + int lock_fd = open(lock_path.c_str(), 0); + if (lock_fd < 0) return -1; + + err = flock(lock_fd, LOCK_EX); + if (err < 0) return err; + + std::string key_path = util::string_format("%s/d", params_path); + DIR *d = opendir(key_path.c_str()); + if (!d) { + close(lock_fd); + return -1; + } + + struct dirent *de = NULL; + while ((de = readdir(d))) { + if (!isalnum(de->d_name[0])) continue; + std::string key = std::string(de->d_name); + std::string value = util::read_file(util::string_format("%s/%s", key_path.c_str(), key.c_str())); + + (*params)[key] = value; + } + + closedir(d); + + close(lock_fd); + return 0; +} diff --git a/selfdrive/common/params.h b/selfdrive/common/params.h index bd4d86dcfee97c..299dcccd0a412d 100644 --- a/selfdrive/common/params.h +++ b/selfdrive/common/params.h @@ -32,4 +32,10 @@ void read_db_value_blocking(const char* params_path, const char* key, } // extern "C" #endif +#ifdef __cplusplus +#include +#include +int read_db_all(const char* params_path, std::map *params); +#endif + #endif // _SELFDRIVE_COMMON_PARAMS_H_ diff --git a/selfdrive/common/touch.c b/selfdrive/common/touch.c index eb59db965fe327..f21fac8f07afd5 100644 --- a/selfdrive/common/touch.c +++ b/selfdrive/common/touch.c @@ -24,15 +24,14 @@ static int find_dev() { int fd = openat(dirfd(dir), de->d_name, O_RDONLY); assert(fd >= 0); - char name[128] = {0}; - err = ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name); + unsigned char ev_bits[KEY_MAX / 8 + 1]; + err = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(ev_bits)), ev_bits); assert(err >= 0); - unsigned long ev_bits[8] = {0}; - err = ioctl(fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits); - assert(err >= 0); - - if (strncmp(name, "synaptics", 9) == 0 && ev_bits[0] == 0xb) { + const int x_key = ABS_MT_POSITION_X / 8; + const int y_key = ABS_MT_POSITION_Y / 8; + if ((ev_bits[x_key] & (ABS_MT_POSITION_X - x_key)) && + (ev_bits[y_key] & (ABS_MT_POSITION_Y - y_key))) { ret = fd; break; } @@ -77,12 +76,7 @@ int touch_poll(TouchState *s, int* out_x, int* out_y, int timeout) { } else if (event.code == ABS_MT_POSITION_Y) { s->last_y = event.value; } - break; - case EV_KEY: - if (event.code == BTN_TOOL_FINGER && event.value == 0) { - // finger up - up = true; - } + up = true; break; default: break; diff --git a/selfdrive/common/utilpp.h b/selfdrive/common/utilpp.h index bc1b2fd267d966..e374c5c256f772 100644 --- a/selfdrive/common/utilpp.h +++ b/selfdrive/common/utilpp.h @@ -9,10 +9,6 @@ #include #include -#ifdef __x86_64 -#include -#endif - namespace util { inline bool starts_with(std::string s, std::string prefix) { @@ -56,13 +52,13 @@ inline std::string dir_name(std::string const & path) { } inline std::string readlink(std::string path) { - char buff[PATH_MAX]; - ssize_t len = ::readlink(path.c_str(), buff, sizeof(buff)-1); - if (len != -1) { - buff[len] = '\0'; - return std::string(buff); - } - return ""; + char buff[4096]; + ssize_t len = ::readlink(path.c_str(), buff, sizeof(buff)-1); + if (len != -1) { + buff[len] = '\0'; + return std::string(buff); + } + return ""; } } diff --git a/selfdrive/common/version.h b/selfdrive/common/version.h index 2b226fc6e0cd8c..b1cb55d122aa18 100644 --- a/selfdrive/common/version.h +++ b/selfdrive/common/version.h @@ -1 +1 @@ -#define COMMA_VERSION "0.5-release" +#define COMMA_VERSION "0.5.10-release" diff --git a/selfdrive/common/visionimg.cc b/selfdrive/common/visionimg.cc index 45bc7bfc4a5be6..8179166e1c7759 100644 --- a/selfdrive/common/visionimg.cc +++ b/selfdrive/common/visionimg.cc @@ -36,14 +36,17 @@ extern "C" void compute_aligned_width_and_height(int width, int *aligned_h); #endif -VisionImg visionimg_alloc_rgb24(int width, int height, VisionBuf *out_buf) { - - int aligned_w = 0, aligned_h = 0; +void visionimg_compute_aligned_width_and_height(int width, int height, int *aligned_w, int *aligned_h) { #ifdef QCOM - compute_aligned_width_and_height(ALIGN(width, 32), ALIGN(height, 32), 3, 0, 0, 512, &aligned_w, &aligned_h); + compute_aligned_width_and_height(ALIGN(width, 32), ALIGN(height, 32), 3, 0, 0, 512, aligned_w, aligned_h); #else - aligned_w = width; aligned_h = height; + *aligned_w = width; *aligned_h = height; #endif +} + +VisionImg visionimg_alloc_rgb24(int width, int height, VisionBuf *out_buf) { + int aligned_w = 0, aligned_h = 0; + visionimg_compute_aligned_width_and_height(width, height, &aligned_w, &aligned_h); int stride = aligned_w * 3; size_t size = aligned_w * aligned_h * 3; diff --git a/selfdrive/common/visionimg.h b/selfdrive/common/visionimg.h index 1a98b55bc7579a..9fabb6054f6dd3 100644 --- a/selfdrive/common/visionimg.h +++ b/selfdrive/common/visionimg.h @@ -23,6 +23,7 @@ typedef struct VisionImg { size_t size; } VisionImg; +void visionimg_compute_aligned_width_and_height(int width, int height, int *aligned_w, int *aligned_h); VisionImg visionimg_alloc_rgb24(int width, int height, VisionBuf *out_buf); #ifdef QCOM diff --git a/selfdrive/common/visionipc.c b/selfdrive/common/visionipc.c index d56fbdd7736d9f..314f7d0a55c712 100644 --- a/selfdrive/common/visionipc.c +++ b/selfdrive/common/visionipc.c @@ -10,6 +10,8 @@ #include #include +#include "ipc.h" + #include "visionipc.h" typedef struct VisionPacketWire { @@ -18,95 +20,14 @@ typedef struct VisionPacketWire { } VisionPacketWire; int vipc_connect() { - int err; - - int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); - assert(sock >= 0); - struct sockaddr_un addr = { - .sun_family = AF_UNIX, - .sun_path = VIPC_SOCKET_PATH, - }; - err = connect(sock, (struct sockaddr*)&addr, sizeof(addr)); - if (err != 0) { - close(sock); - return -1; - } - - return sock; + return ipc_connect(VIPC_SOCKET_PATH); } -static int sendrecv_with_fds(bool send, int fd, void *buf, size_t buf_size, int* fds, int num_fds, - int *out_num_fds) { - int err; - - char control_buf[CMSG_SPACE(sizeof(int) * num_fds)]; - memset(control_buf, 0, CMSG_SPACE(sizeof(int) * num_fds)); - - struct iovec iov = { - .iov_base = buf, - .iov_len = buf_size, - }; - struct msghdr msg = { - .msg_iov = &iov, - .msg_iovlen = 1, - }; - - if (num_fds > 0) { - assert(fds); - - msg.msg_control = control_buf; - msg.msg_controllen = CMSG_SPACE(sizeof(int) * num_fds); - } - - if (send) { - if (num_fds) { - struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); - assert(cmsg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int) * num_fds); - memcpy(CMSG_DATA(cmsg), fds, sizeof(int) * num_fds); - // printf("send clen %d -> %d\n", num_fds, cmsg->cmsg_len); - } - return sendmsg(fd, &msg, 0); - } else { - int r = recvmsg(fd, &msg, 0); - if (r < 0) return r; - - int recv_fds = 0; - if (msg.msg_controllen > 0) { - struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); - assert(cmsg); - assert(cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS); - recv_fds = (cmsg->cmsg_len - CMSG_LEN(0)); - assert(recv_fds > 0 && (recv_fds % sizeof(int)) == 0); - recv_fds /= sizeof(int); - // printf("recv clen %d -> %d\n", cmsg->cmsg_len, recv_fds); - // assert(cmsg->cmsg_len == CMSG_LEN(sizeof(int) * num_fds)); - - assert(fds && recv_fds <= num_fds); - memcpy(fds, CMSG_DATA(cmsg), sizeof(int) * recv_fds); - } - - if (msg.msg_flags) { - for (int i=0; itype, .d = p2->d, }; - return sendrecv_with_fds(true, fd, (void*)&p, sizeof(p), (int*)p2->fds, p2->num_fds, NULL); + return ipc_sendrecv_with_fds(true, fd, (void*)&p, sizeof(p), (int*)p2->fds, p2->num_fds, NULL); } void vipc_bufs_load(VIPCBuf *bufs, const VisionStreamBufs *stream_bufs, diff --git a/selfdrive/config.py b/selfdrive/config.py index 1219965e11ce84..751a84e285f52c 100644 --- a/selfdrive/config.py +++ b/selfdrive/config.py @@ -19,28 +19,6 @@ class Conversions: RADAR_TO_CENTER = 2.7 # RADAR is ~ 2.7m ahead from center of car -# Image params for color cam on acura, calibrated on pre las vegas drive (2016-05-21) -class ImageParams: - def __init__(self): - self.SX_R = 160 # top left corner pixel shift of the visual region considered by the model - self.SY_R = 180 # top left corner pixel shift of the visual region considered by the model - self.VPX_R = 319 # vanishing point reference, as calibrated in Vegas drive - self.VPY_R = 201 # vanishing point reference, as calibrated in Vegas drive - self.X = 320 # pixel length of image for model - self.Y = 160 # pixel length of image for model - self.SX = self.SX_R # current visual region with shift - self.SY = self.SY_R # current visual region with shift - self.VPX = self.VPX_R # current vanishing point with shift - self.VPY = self.VPY_R # current vanishing point with shift - def shift(self, shift): - def to_int(fl): - return int(round(fl)) - # shift comes from calibration and says how much to shift the viual region - self.SX = self.SX_R + to_int(shift[0]) # current visual region with shift - self.SY = self.SY_R + to_int(shift[1]) # current visual region with shift - self.VPX = self.VPX_R + to_int(shift[0]) # current vanishing point with shift - self.VPY = self.VPY_R + to_int(shift[1]) # current vanishing point with shift - class UIParams: lidar_x, lidar_y, lidar_zoom = 384, 960, 6 lidar_car_x, lidar_car_y = lidar_x/2., lidar_y/1.1 diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 1b8ad21282a78c..b5d699bdaabfa4 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import gc -import json import zmq +import json from cereal import car, log from common.numpy_fast import clip from common.realtime import sec_since_boot, set_realtime_priority, Ratekeeper @@ -11,54 +11,49 @@ from selfdrive.config import Conversions as CV from selfdrive.services import service_list from selfdrive.car.car_helpers import get_car -from selfdrive.controls.lib.planner import Planner -from selfdrive.controls.lib.drive_helpers import learn_angle_offset, \ +from selfdrive.controls.lib.drive_helpers import learn_angle_model_bias, \ get_events, \ create_event, \ EventTypes as ET, \ update_v_cruise, \ - initialize_v_cruise, \ - kill_defaultd + initialize_v_cruise from selfdrive.controls.lib.longcontrol import LongControl, STARTING_TARGET_SPEED from selfdrive.controls.lib.latcontrol import LatControl from selfdrive.controls.lib.alertmanager import AlertManager from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.controls.lib.driver_monitor import DriverStatus +from selfdrive.controls.lib.planner import _DT_MPC +from selfdrive.locationd.calibration_helpers import Calibration, Filter ThermalStatus = log.ThermalData.ThermalStatus State = log.Live100Data.ControlState -class Calibration: - UNCALIBRATED = 0 - CALIBRATED = 1 - INVALID = 2 - - -# True when actuators are controlled def isActive(state): + """Check if the actuators are enabled""" return state in [State.enabled, State.softDisabling] -# True if system is engaged def isEnabled(state): + """Check if openpilot is engaged""" return (isActive(state) or state == State.preEnabled) -def data_sample(CI, CC, thermal, calibration, health, driver_monitor, gps_location, - poller, cal_status, overtemp, free_space, driver_status, geofence, - state, mismatch_counter, params): +def data_sample(CI, CC, plan_sock, path_plan_sock, thermal, calibration, health, driver_monitor, + poller, cal_status, cal_perc, overtemp, free_space, low_battery, + driver_status, state, mismatch_counter, params, plan, path_plan): + """Receive data from sockets and create events for battery, temperature and disk space""" - # *** read can and compute car states *** + # Update carstate from CAN and create events CS = CI.update(CC) events = list(CS.events) enabled = isEnabled(state) + # Receive from sockets td = None cal = None hh = None dm = None - gps = None for socket, event in poller.poll(0): if socket is thermal: @@ -69,77 +64,58 @@ def data_sample(CI, CC, thermal, calibration, health, driver_monitor, gps_locati hh = messaging.recv_one(socket) elif socket is driver_monitor: dm = messaging.recv_one(socket) - elif socket is gps_location: - gps = messaging.recv_one(socket) + elif socket is plan_sock: + plan = messaging.recv_one(socket) + elif socket is path_plan_sock: + path_plan = messaging.recv_one(socket) - # *** thermal checking logic *** - # thermal data, checked every second if td is not None: overtemp = td.thermal.thermalStatus >= ThermalStatus.red + free_space = td.thermal.freeSpace < 0.07 # under 7% of space free no enable allowed + low_battery = td.thermal.batteryPercent < 1 # at zero percent battery, OP should not be allowed - # under 15% of space free no enable allowed - free_space = td.thermal.freeSpace < 0.15 - + # Create events for battery, temperature and disk space + if low_battery: + events.append(create_event('lowBattery', [ET.NO_ENTRY, ET.SOFT_DISABLE])) if overtemp: events.append(create_event('overheat', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - if free_space: events.append(create_event('outOfSpace', [ET.NO_ENTRY])) - # *** read calibration status *** + # Handle calibration if cal is not None: cal_status = cal.liveCalibration.calStatus + cal_perc = cal.liveCalibration.calPerc if cal_status != Calibration.CALIBRATED: if cal_status == Calibration.UNCALIBRATED: - events.append(create_event('calibrationInProgress', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + events.append(create_event('calibrationIncomplete', [ET.NO_ENTRY, ET.SOFT_DISABLE, ET.PERMANENT])) else: events.append(create_event('calibrationInvalid', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + # When the panda and controlsd do not agree on controls_allowed + # we want to disengage openpilot. However the status from the panda goes through + # another socket than the CAN messages, therefore one can arrive earlier than the other. + # Therefore we allow a mismatch for two samples, then we trigger the disengagement. if not enabled: mismatch_counter = 0 - # *** health checking logic *** if hh is not None: controls_allowed = hh.health.controlsAllowed if not controls_allowed and enabled: mismatch_counter += 1 - if mismatch_counter >= 2: events.append(create_event('controlsMismatch', [ET.IMMEDIATE_DISABLE])) + # Driver monitoring if dm is not None: driver_status.get_pose(dm.driverMonitoring, params) - if geofence is not None and gps is not None: - geofence.update_geofence_status(gps.gpsLocationExternal, params) - - if geofence is not None and not geofence.in_geofence: - events.append(create_event('geofence', [ET.NO_ENTRY, ET.WARNING])) - - return CS, events, cal_status, overtemp, free_space, mismatch_counter - - -def calc_plan(CS, CP, events, PL, LaC, LoC, v_cruise_kph, driver_status, geofence): - # plan runs always, independently of the state - force_decel = driver_status.awareness < 0. or (geofence is not None and not geofence.in_geofence) - plan_packet = PL.update(CS, LaC, LoC, v_cruise_kph, force_decel) - plan = plan_packet.plan - plan_ts = plan_packet.logMonoTime - - # add events from planner - events += list(plan.events) - - # disable if lead isn't close when system is active and brake is pressed to avoid - # unexpected vehicle accelerations - if CS.brakePressed and plan.vTargetFuture >= STARTING_TARGET_SPEED and not CP.radarOffCan and CS.vEgo < 0.3: - events.append(create_event('noTarget', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) - - return plan, plan_ts + return CS, events, cal_status, cal_perc, overtemp, free_space, low_battery, mismatch_counter, plan, path_plan def state_transition(CS, CP, state, events, soft_disable_timer, v_cruise_kph, AM): - # compute conditional state transitions and execute actions on state transitions + """Compute conditional state transitions and execute actions on state transitions""" enabled = isEnabled(state) v_cruise_kph_last = v_cruise_kph @@ -154,8 +130,6 @@ def state_transition(CS, CP, state, events, soft_disable_timer, v_cruise_kph, AM # entrance in SOFT_DISABLING state soft_disable_timer = max(0, soft_disable_timer - 1) - # ***** handle state transitions ***** - # DISABLED if state == State.disabled: if get_events(events, [ET.ENABLE]): @@ -184,7 +158,7 @@ def state_transition(CS, CP, state, events, soft_disable_timer, v_cruise_kph, AM elif get_events(events, [ET.SOFT_DISABLE]): state = State.softDisabling - soft_disable_timer = 300 # 3s TODO: use rate + soft_disable_timer = 300 # 3s for e in get_events(events, [ET.SOFT_DISABLE]): AM.add(e, enabled) @@ -203,6 +177,10 @@ def state_transition(CS, CP, state, events, soft_disable_timer, v_cruise_kph, AM # no more soft disabling condition, so go back to ENABLED state = State.enabled + elif get_events(events, [ET.SOFT_DISABLE]) and soft_disable_timer > 0: + for e in get_events(events, [ET.SOFT_DISABLE]): + AM.add(e, enabled) + elif soft_disable_timer <= 0: state = State.disabled @@ -223,11 +201,10 @@ def state_transition(CS, CP, state, events, soft_disable_timer, v_cruise_kph, AM return state, soft_disable_timer, v_cruise_kph, v_cruise_kph_last -def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, AM, rk, - driver_status, PL, LaC, LoC, VM, angle_offset, passive): - # Given the state, this function returns the actuators +def state_control(plan, path_plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, AM, rk, + driver_status, LaC, LoC, VM, angle_model_bias, passive, is_metric, cal_perc): + """Given the state, this function returns an actuators packet""" - # reset actuators to zero actuators = car.CarControl.Actuators.new_message() enabled = isEnabled(state) @@ -245,73 +222,82 @@ def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, if plan.fcw: AM.add("fcw", enabled) - # ***** state specific actions ***** + # State specific actions - # DISABLED if state in [State.preEnabled, State.disabled]: - LaC.reset() LoC.reset(v_pid=CS.vEgo) - # ENABLED or SOFT_DISABLING elif state in [State.enabled, State.softDisabling]: - # parse warnings from car specific interface for e in get_events(events, [ET.WARNING]): - AM.add(e, enabled) - - # *** angle offset learning *** + extra_text = "" + if e == "belowSteerSpeed": + if is_metric: + extra_text = str(int(round(CP.minSteerSpeed * CV.MS_TO_KPH))) + " kph" + else: + extra_text = str(int(round(CP.minSteerSpeed * CV.MS_TO_MPH))) + " mph" + AM.add(e, enabled, extra_text_2=extra_text) - if rk.frame % 5 == 2 and plan.lateralValid: - # *** run this at 20hz again *** - angle_offset = learn_angle_offset(active, CS.vEgo, angle_offset, - PL.PP.c_poly, PL.PP.c_prob, CS.steeringAngle, + # Run angle offset learner at 20 Hz + if rk.frame % 5 == 2: + angle_model_bias = learn_angle_model_bias(active, CS.vEgo, angle_model_bias, + path_plan.cPoly, path_plan.cProb, CS.steeringAngle, CS.steeringPressed) - # *** gas/brake PID loop *** - actuators.gas, actuators.brake = LoC.update(active, CS.vEgo, CS.brakePressed, CS.standstill, CS.cruiseState.standstill, - v_cruise_kph, plan.vTarget, plan.vTargetFuture, plan.aTarget, - CP, PL.lead_1) + cur_time = sec_since_boot() # TODO: This won't work in replay + mpc_time = plan.l20MonoTime / 1e9 + _DT = 0.01 # 100Hz - # *** steering PID loop *** + dt = min(cur_time - mpc_time, _DT_MPC + _DT) + _DT # no greater than dt mpc + dt, to prevent too high extraps + a_acc_sol = plan.aStart + (dt / _DT_MPC) * (plan.aTarget - plan.aStart) + v_acc_sol = plan.vStart + dt * (a_acc_sol + plan.aStart) / 2.0 + + # Gas/Brake PID loop + actuators.gas, actuators.brake = LoC.update(active, CS.vEgo, CS.brakePressed, CS.standstill, CS.cruiseState.standstill, + v_cruise_kph, v_acc_sol, plan.vTargetFuture, a_acc_sol, CP) + # Steering PID loop and lateral MPC actuators.steer, actuators.steerAngle = LaC.update(active, CS.vEgo, CS.steeringAngle, - CS.steeringPressed, plan.dPoly, angle_offset, VM, PL) + CS.steeringPressed, CP, VM, path_plan) - # send a "steering required alert" if saturation count has reached the limit + # Send a "steering required alert" if saturation count has reached the limit if LaC.sat_flag and CP.steerLimitAlert: AM.add("steerSaturated", enabled) - # parse permanent warnings to display constantly + # Parse permanent warnings to display constantly for e in get_events(events, [ET.PERMANENT]): - AM.add(str(e) + "Permanent", enabled) - - # *** process alerts *** + extra_text_1, extra_text_2 = "", "" + if e == "calibrationIncomplete": + extra_text_1 = str(cal_perc) + "%" + if is_metric: + extra_text_2 = str(int(round(Filter.MIN_SPEED * CV.MS_TO_KPH))) + " kph" + else: + extra_text_2 = str(int(round(Filter.MIN_SPEED * CV.MS_TO_MPH))) + " mph" + AM.add(str(e) + "Permanent", enabled, extra_text_1=extra_text_1, extra_text_2=extra_text_2) AM.process_alerts(sec_since_boot()) - return actuators, v_cruise_kph, driver_status, angle_offset - + return actuators, v_cruise_kph, driver_status, angle_model_bias, v_acc_sol, a_acc_sol -def data_send(plan, plan_ts, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk, carstate, - carcontrol, live100, livempc, AM, driver_status, - LaC, LoC, angle_offset, passive): - # ***** control the car ***** +def data_send(plan, path_plan, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk, carstate, + carcontrol, live100, AM, driver_status, + LaC, LoC, angle_model_bias, passive, start_time, params, v_acc, a_acc): + """Send actuators and hud commands to the car, send live100 and MPC logging""" + plan_ts = plan.logMonoTime + plan = plan.plan CC = car.CarControl.new_message() if not passive: - CC.enabled = isEnabled(state) - CC.actuators = actuators CC.cruiseControl.override = True - # always cancel if we have an interceptor CC.cruiseControl.cancel = not CP.enableCruise or (not isEnabled(state) and CS.cruiseState.enabled) - # brake discount removes a sharp nonlinearity - brake_discount = (1.0 - clip(actuators.brake*3., 0.0, 1.0)) + # Some override values for Honda + brake_discount = (1.0 - clip(actuators.brake * 3., 0.0, 1.0)) # brake discount removes a sharp nonlinearity CC.cruiseControl.speedOverride = float(max(0.0, (LoC.v_pid + CS.cruiseState.speedOffset) * brake_discount) if CP.enableCruise else 0.0) CC.cruiseControl.accelOverride = CI.calc_accel_override(CS.aEgo, plan.aTarget, CS.vEgo, plan.vTarget) @@ -319,26 +305,32 @@ def data_send(plan, plan_ts, CS, CI, CP, VM, state, events, actuators, v_cruise_ CC.hudControl.speedVisible = isEnabled(state) CC.hudControl.lanesVisible = isEnabled(state) CC.hudControl.leadVisible = plan.hasLead + CC.hudControl.rightLaneVisible = bool(path_plan.pathPlan.rProb > 0.5) + CC.hudControl.leftLaneVisible = bool(path_plan.pathPlan.lProb > 0.5) CC.hudControl.visualAlert = AM.visual_alert CC.hudControl.audibleAlert = AM.audible_alert # send car controls over can CI.apply(CC) - # ***** publish state to logger ***** - # publish controls state at 100Hz + force_decel = driver_status.awareness < 0. + + # live100 dat = messaging.new_message() dat.init('live100') - dat.live100 = { "alertText1": AM.alert_text_1, "alertText2": AM.alert_text_2, "alertSize": AM.alert_size, "alertStatus": AM.alert_status, "alertBlinkingRate": AM.alert_rate, + "alertType": AM.alert_type, + "alertSound": "", # no EON sounds yet "awarenessStatus": max(driver_status.awareness, 0.0) if isEnabled(state) else 0.0, + "driverMonitoringOn": bool(driver_status.monitor_on), "canMonoTimes": list(CS.canMonoTimes), "planMonoTime": plan_ts, + "pathPlanMonoTime": path_plan.logMonoTime, "enabled": isEnabled(state), "active": isActive(state), "vEgo": CS.vEgo, @@ -358,43 +350,40 @@ def data_send(plan, plan_ts, CS, CI, CP, VM, state, events, actuators, v_cruise_ "upSteer": float(LaC.pid.p), "uiSteer": float(LaC.pid.i), "ufSteer": float(LaC.pid.f), - "vTargetLead": float(plan.vTarget), - "aTarget": float(plan.aTarget), + "vTargetLead": float(v_acc), + "aTarget": float(a_acc), "jerkFactor": float(plan.jerkFactor), - "angleOffset": float(angle_offset), + "angleModelBias": float(angle_model_bias), "gpsPlannerActive": plan.gpsPlannerActive, - "cumLagMs": -rk.remaining*1000., + "vCurvature": plan.vCurvature, + "decelForTurn": plan.decelForTurn, + "cumLagMs": -rk.remaining * 1000., + "startMonoTime": start_time, + "mapValid": plan.mapValid, + "forceDecel": bool(force_decel), } live100.send(dat.to_bytes()) - # broadcast carState + # carState cs_send = messaging.new_message() cs_send.init('carState') cs_send.carState = CS cs_send.carState.events = events carstate.send(cs_send.to_bytes()) - # broadcast carControl + # carControl cc_send = messaging.new_message() cc_send.init('carControl') cc_send.carControl = CC carcontrol.send(cc_send.to_bytes()) - # publish mpc state at 20Hz - if hasattr(LaC, 'mpc_updated') and LaC.mpc_updated: - dat = messaging.new_message() - dat.init('liveMpc') - dat.liveMpc.x = list(LaC.mpc_solution[0].x) - dat.liveMpc.y = list(LaC.mpc_solution[0].y) - dat.liveMpc.psi = list(LaC.mpc_solution[0].psi) - dat.liveMpc.delta = list(LaC.mpc_solution[0].delta) - dat.liveMpc.cost = LaC.mpc_solution[0].cost - livempc.send(dat.to_bytes()) + if (rk.frame % 36000) == 0: # update angle offset every 6 minutes + params.put("ControlsParams", json.dumps({'angle_model_bias': angle_model_bias})) return CC -def controlsd_thread(gctx=None, rate=100, default_bias=0.): +def controlsd_thread(gctx=None, rate=100): gc.disable() # start the loop @@ -403,35 +392,31 @@ def controlsd_thread(gctx=None, rate=100, default_bias=0.): context = zmq.Context() params = Params() - # pub + # Pub Sockets live100 = messaging.pub_sock(context, service_list['live100'].port) carstate = messaging.pub_sock(context, service_list['carState'].port) carcontrol = messaging.pub_sock(context, service_list['carControl'].port) - livempc = messaging.pub_sock(context, service_list['liveMpc'].port) + is_metric = params.get("IsMetric") == "1" passive = params.get("Passive") != "0" + + # No sendcan if passive if not passive: - while 1: - try: - sendcan = messaging.pub_sock(context, service_list['sendcan'].port) - break - except zmq.error.ZMQError: - kill_defaultd() + sendcan = messaging.pub_sock(context, service_list['sendcan'].port) else: sendcan = None - # sub + # Sub sockets poller = zmq.Poller() thermal = messaging.sub_sock(context, service_list['thermal'].port, conflate=True, poller=poller) health = messaging.sub_sock(context, service_list['health'].port, conflate=True, poller=poller) cal = messaging.sub_sock(context, service_list['liveCalibration'].port, conflate=True, poller=poller) driver_monitor = messaging.sub_sock(context, service_list['driverMonitoring'].port, conflate=True, poller=poller) - gps_location = messaging.sub_sock(context, service_list['gpsLocationExternal'].port, conflate=True, poller=poller) - + plan_sock = messaging.sub_sock(context, service_list['plan'].port, conflate=True, poller=poller) + path_plan_sock = messaging.sub_sock(context, service_list['pathPlan'].port, conflate=True, poller=poller) logcan = messaging.sub_sock(context, service_list['can'].port) CC = car.CarControl.new_message() - CI, CP = get_car(logcan, sendcan, 1.0 if passive else None) if CI is None: @@ -445,28 +430,18 @@ def controlsd_thread(gctx=None, rate=100, default_bias=0.): if passive: CP.safetyModel = car.CarParams.SafetyModels.noOutput - fcw_enabled = params.get("IsFcwEnabled") == "1" - driver_monitor_on = params.get("IsDriverMonitoringEnabled") == "1" - geofence = None - try: - from selfdrive.controls.lib.geofence import Geofence - geofence = Geofence(params.get("IsGeofenceEnabled") == "1") - except ImportError: - # geofence not available - params.put("IsGeofenceEnabled", "-1") - - PL = Planner(CP, fcw_enabled) LoC = LongControl(CP, CI.compute_gb) VM = VehicleModel(CP) - LaC = LatControl(VM) + LaC = LatControl(CP) AM = AlertManager() - driver_status = DriverStatus(driver_monitor_on) + driver_status = DriverStatus() if not passive: AM.add("startup", False) - # write CarParams + # Write CarParams for radard and boardd safety mode params.put("CarParams", CP.to_bytes()) + params.put("LongitudinalControl", "1" if CP.openpilotLongitudinalControl else "0") state = State.disabled soft_disable_timer = 0 @@ -474,35 +449,52 @@ def controlsd_thread(gctx=None, rate=100, default_bias=0.): v_cruise_kph_last = 0 overtemp = False free_space = False - cal_status = Calibration.UNCALIBRATED + cal_status = Calibration.INVALID + cal_perc = 0 mismatch_counter = 0 + low_battery = False + + plan = messaging.new_message() + plan.init('plan') + path_plan = messaging.new_message() + path_plan.init('pathPlan') - rk = Ratekeeper(rate, print_delay_threshold=2./1000) + rk = Ratekeeper(rate, print_delay_threshold=2. / 1000) + controls_params = params.get("ControlsParams") - # learned angle offset - angle_offset = default_bias - calibration_params = params.get("CalibrationParams") - if calibration_params: + # Read angle offset from previous drive + angle_model_bias = 0. + if controls_params is not None: try: - calibration_params = json.loads(calibration_params) - angle_offset = calibration_params["angle_offset2"] + controls_params = json.loads(controls_params) + angle_model_bias = controls_params['angle_model_bias'] except (ValueError, KeyError): pass prof = Profiler(False) # off by default - while 1: - + while True: + start_time = int(sec_since_boot() * 1e9) prof.checkpoint("Ratekeeper", ignore=True) - # sample data and compute car events - CS, events, cal_status, overtemp, free_space, mismatch_counter = data_sample(CI, CC, thermal, cal, health, - driver_monitor, gps_location, poller, cal_status, overtemp, free_space, driver_status, geofence, state, mismatch_counter, params) + # Sample data and compute car events + CS, events, cal_status, cal_perc, overtemp, free_space, low_battery, mismatch_counter, plan, path_plan =\ + data_sample(CI, CC, plan_sock, path_plan_sock, thermal, cal, health, driver_monitor, + poller, cal_status, cal_perc, overtemp, free_space, low_battery, driver_status, + state, mismatch_counter, params, plan, path_plan) prof.checkpoint("Sample") - # define plan - plan, plan_ts = calc_plan(CS, CP, events, PL, LaC, LoC, v_cruise_kph, driver_status, geofence) - prof.checkpoint("Plan") + path_plan_age = (start_time - path_plan.logMonoTime) / 1e9 + plan_age = (start_time - plan.logMonoTime) / 1e9 + if not path_plan.pathPlan.valid or plan_age > 0.5 or path_plan_age > 0.5: + events.append(create_event('plannerError', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if not path_plan.pathPlan.paramsValid: + events.append(create_event('vehicleModelInvalid', [ET.WARNING])) + events += list(plan.plan.events) + + # Only allow engagement with brake pressed when stopped behind another stopped car + if CS.brakePressed and plan.plan.vTargetFuture >= STARTING_TARGET_SPEED and not CP.radarOffCan and CS.vEgo < 0.3: + events.append(create_event('noTarget', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) if not passive: # update control state @@ -510,24 +502,26 @@ def controlsd_thread(gctx=None, rate=100, default_bias=0.): state_transition(CS, CP, state, events, soft_disable_timer, v_cruise_kph, AM) prof.checkpoint("State transition") - # compute actuators - actuators, v_cruise_kph, driver_status, angle_offset = state_control(plan, CS, CP, state, events, v_cruise_kph, - v_cruise_kph_last, AM, rk, driver_status, PL, LaC, LoC, VM, angle_offset, passive) + # Compute actuators (runs PID loops and lateral MPC) + actuators, v_cruise_kph, driver_status, angle_model_bias, v_acc, a_acc = \ + state_control(plan.plan, path_plan.pathPlan, CS, CP, state, events, v_cruise_kph, + v_cruise_kph_last, AM, rk, driver_status, + LaC, LoC, VM, angle_model_bias, passive, is_metric, cal_perc) + prof.checkpoint("State Control") - # publish data - CC = data_send(plan, plan_ts, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk, carstate, carcontrol, - live100, livempc, AM, driver_status, LaC, LoC, angle_offset, passive) + # Publish data + CC = data_send(plan, path_plan, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk, carstate, carcontrol, + live100, AM, driver_status, LaC, LoC, angle_model_bias, passive, start_time, params, v_acc, a_acc) prof.checkpoint("Sent") - # *** run loop at fixed rate *** - rk.keep_time() - + rk.keep_time() # Run at 100Hz prof.display() def main(gctx=None): controlsd_thread(gctx, 100) + if __name__ == "__main__": main() diff --git a/selfdrive/controls/lib/alertmanager.py b/selfdrive/controls/lib/alertmanager.py index 9d053c211fb496..5884e987033fc3 100644 --- a/selfdrive/controls/lib/alertmanager.py +++ b/selfdrive/controls/lib/alertmanager.py @@ -1,514 +1,49 @@ -from cereal import car, log +from cereal import log from selfdrive.swaglog import cloudlog +from selfdrive.controls.lib.alerts import ALERTS from common.realtime import sec_since_boot import copy -# Priority -class Priority: - HIGHEST = 4 - HIGH = 3 - MID = 2 - LOW = 1 - LOWEST = 0 - AlertSize = log.Live100Data.AlertSize AlertStatus = log.Live100Data.AlertStatus -class Alert(object): - def __init__(self, - alert_text_1, - alert_text_2, - alert_status, - alert_size, - alert_priority, - visual_alert, - audible_alert, - duration_sound, - duration_hud_alert, - duration_text, - alert_rate=0.): - - self.alert_text_1 = alert_text_1 - self.alert_text_2 = alert_text_2 - self.alert_status = alert_status - self.alert_size = alert_size - self.alert_priority = alert_priority - self.visual_alert = visual_alert if visual_alert is not None else "none" - self.audible_alert = audible_alert if audible_alert is not None else "none" - - self.duration_sound = duration_sound - self.duration_hud_alert = duration_hud_alert - self.duration_text = duration_text - - self.start_time = 0. - self.alert_rate = alert_rate - - # typecheck that enums are valid on startup - tst = car.CarControl.new_message() - tst.hudControl.visualAlert = self.visual_alert - tst.hudControl.audibleAlert = self.audible_alert - - def __str__(self): - return self.alert_text_1 + "/" + self.alert_text_2 + " " + str(self.alert_priority) + " " + str( - self.visual_alert) + " " + str(self.audible_alert) - - def __gt__(self, alert2): - return self.alert_priority > alert2.alert_priority - class AlertManager(object): - alerts = { - - # Miscellaneous alerts - "enable": Alert( - "", - "", - AlertStatus.normal, AlertSize.none, - Priority.MID, None, "beepSingle", .2, 0., 0.), - - "disable": Alert( - "", - "", - AlertStatus.normal, AlertSize.none, - Priority.MID, None, "beepSingle", .2, 0., 0.), - - "fcw": Alert( - "Brake!", - "Risk of Collision", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "fcw", "chimeRepeated", 1., 2., 2.), - - "steerSaturated": Alert( - "TAKE CONTROL", - "Turn Exceeds Steering Limit", - AlertStatus.userPrompt, AlertSize.mid, - Priority.LOW, "steerRequired", "chimeSingle", 1., 2., 3.), - - "steerTempUnavailable": Alert( - "TAKE CONTROL", - "Steering Temporarily Unavailable", - AlertStatus.userPrompt, AlertSize.mid, - Priority.LOW, "steerRequired", "chimeDouble", .4, 2., 3.), - - "steerTempUnavailableMute": Alert( - "TAKE CONTROL", - "Steering Temporarily Unavailable", - AlertStatus.userPrompt, AlertSize.mid, - Priority.LOW, None, None, .2, .2, .2), - - "preDriverDistracted": Alert( - "TAKE CONTROL: User Appears Distracted", - "", - AlertStatus.normal, AlertSize.small, - Priority.LOW, "steerRequired", None, 0., .1, .1, alert_rate=0.75), - - "promptDriverDistracted": Alert( - "TAKE CONTROL", - "User Appears Distracted", - AlertStatus.userPrompt, AlertSize.mid, - Priority.MID, "steerRequired", "chimeRepeated", .1, .1, .1), - - "driverDistracted": Alert( - "DISENGAGEMENT REQUIRED", - "User Was Distracted", - AlertStatus.critical, AlertSize.full, - Priority.HIGH, "steerRequired", "chimeRepeated", .1, .1, .1), - - "geofence": Alert( - "DISENGAGEMENT REQUIRED", - "Not in Geofenced Area", - AlertStatus.userPrompt, AlertSize.mid, - Priority.HIGH, "steerRequired", "chimeRepeated", .1, .1, .1), - - "startup": Alert( - "Be ready to take over at any time", - "Always keep hands on wheel and eyes on road", - AlertStatus.normal, AlertSize.mid, - Priority.LOWEST, None, None, 0., 0., 15.), - - "ethicalDilemma": Alert( - "TAKE CONTROL IMMEDIATELY", - "Ethical Dilemma Detected", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 3.), - - "steerTempUnavailableNoEntry": Alert( - "openpilot Unavailable", - "Steering Temporarily Unavailable", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 0., 3.), - - "manualRestart": Alert( - "TAKE CONTROL", - "Resume Driving Manually", - AlertStatus.userPrompt, AlertSize.mid, - Priority.LOW, None, None, 0., 0., .2), - - "resumeRequired": Alert( - "STOPPED", - "Press Resume to Move", - AlertStatus.userPrompt, AlertSize.mid, - Priority.LOW, None, None, 0., 0., .2), - - "debugAlert": Alert( - "DEBUG ALERT", - "", - AlertStatus.userPrompt, AlertSize.mid, - Priority.LOW, None, None, .1, .1, .1), - - # Non-entry only alerts - "wrongCarModeNoEntry": Alert( - "openpilot Unavailable", - "Main Switch Off", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 0., 3.), - - "dataNeededNoEntry": Alert( - "openpilot Unavailable", - "Data Needed for Calibration. Upload Drive, Try Again", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 0., 3.), - - "outOfSpaceNoEntry": Alert( - "openpilot Unavailable", - "Out of Storage Space", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 0., 3.), - - "pedalPressedNoEntry": Alert( - "openpilot Unavailable", - "Pedal Pressed During Attempt", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, "brakePressed", "chimeDouble", .4, 2., 3.), - - "speedTooLowNoEntry": Alert( - "openpilot Unavailable", - "Speed Too Low", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "brakeHoldNoEntry": Alert( - "openpilot Unavailable", - "Brake Hold Active", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "parkBrakeNoEntry": Alert( - "openpilot Unavailable", - "Park Brake Engaged", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "lowSpeedLockoutNoEntry": Alert( - "openpilot Unavailable", - "Cruise Fault: Restart the Car", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - # Cancellation alerts causing soft disabling - "overheat": Alert( - "TAKE CONTROL IMMEDIATELY", - "System Overheated", - AlertStatus.critical, AlertSize.full, - Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.), - - "wrongGear": Alert( - "TAKE CONTROL IMMEDIATELY", - "Gear not D", - AlertStatus.critical, AlertSize.full, - Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.), - - "calibrationInvalid": Alert( - "TAKE CONTROL IMMEDIATELY", - "Calibration Invalid: Reposition EON and Recalibrate", - AlertStatus.critical, AlertSize.full, - Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.), - - "calibrationInProgress": Alert( - "TAKE CONTROL IMMEDIATELY", - "Calibration in Progress", - AlertStatus.critical, AlertSize.full, - Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.), - - "doorOpen": Alert( - "TAKE CONTROL IMMEDIATELY", - "Door Open", - AlertStatus.critical, AlertSize.full, - Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.), - - "seatbeltNotLatched": Alert( - "TAKE CONTROL IMMEDIATELY", - "Seatbelt Unlatched", - AlertStatus.critical, AlertSize.full, - Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.), - - "espDisabled": Alert( - "TAKE CONTROL IMMEDIATELY", - "ESP Off", - AlertStatus.critical, AlertSize.full, - Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.), - - # Cancellation alerts causing immediate disabling - "radarCommIssue": Alert( - "TAKE CONTROL IMMEDIATELY", - "Radar Error: Restart the Car", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "radarFault": Alert( - "TAKE CONTROL IMMEDIATELY", - "Radar Error: Restart the Car", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "modelCommIssue": Alert( - "TAKE CONTROL IMMEDIATELY", - "Model Error: Check Internet Connection", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "controlsFailed": Alert( - "TAKE CONTROL IMMEDIATELY", - "Controls Failed", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "controlsMismatch": Alert( - "TAKE CONTROL IMMEDIATELY", - "Controls Mismatch", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "commIssue": Alert( - "TAKE CONTROL IMMEDIATELY", - "CAN Error: Check Connections", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "steerUnavailable": Alert( - "TAKE CONTROL IMMEDIATELY", - "Steer Fault: Restart the Car", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "brakeUnavailable": Alert( - "TAKE CONTROL IMMEDIATELY", - "Brake Fault: Restart the Car", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "gasUnavailable": Alert( - "TAKE CONTROL IMMEDIATELY", - "Gas Fault: Restart the Car", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "reverseGear": Alert( - "TAKE CONTROL IMMEDIATELY", - "Reverse Gear", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "cruiseDisabled": Alert( - "TAKE CONTROL IMMEDIATELY", - "Cruise Is Off", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - "plannerError": Alert( - "TAKE CONTROL IMMEDIATELY", - "Planner Solution Error", - AlertStatus.critical, AlertSize.full, - Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.), - - # not loud cancellations (user is in control) - "noTarget": Alert( - "openpilot Canceled", - "No close lead car", - AlertStatus.normal, AlertSize.mid, - Priority.HIGH, None, "chimeDouble", .4, 2., 3.), - - "speedTooLow": Alert( - "openpilot Canceled", - "Speed too low", - AlertStatus.normal, AlertSize.mid, - Priority.HIGH, None, "chimeDouble", .4, 2., 3.), - - # Cancellation alerts causing non-entry - "overheatNoEntry": Alert( - "openpilot Unavailable", - "System overheated", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "wrongGearNoEntry": Alert( - "openpilot Unavailable", - "Gear not D", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "calibrationInvalidNoEntry": Alert( - "openpilot Unavailable", - "Calibration Invalid: Reposition EON and Recalibrate", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "calibrationInProgressNoEntry": Alert( - "openpilot Unavailable", - "Calibration in Progress", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "doorOpenNoEntry": Alert( - "openpilot Unavailable", - "Door open", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "seatbeltNotLatchedNoEntry": Alert( - "openpilot Unavailable", - "Seatbelt unlatched", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "espDisabledNoEntry": Alert( - "openpilot Unavailable", - "ESP Off", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "geofenceNoEntry": Alert( - "openpilot Unavailable", - "Not in Geofenced Area", - AlertStatus.normal, AlertSize.mid, - Priority.MID, None, "chimeDouble", .4, 2., 3.), - - "radarCommIssueNoEntry": Alert( - "openpilot Unavailable", - "Radar Error: Restart the Car", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "radarFaultNoEntry": Alert( - "openpilot Unavailable", - "Radar Error: Restart the Car", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "modelCommIssueNoEntry": Alert( - "openpilot Unavailable", - "Model Error: Check Internet Connection", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "controlsFailedNoEntry": Alert( - "openpilot Unavailable", - "Controls Failed", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "commIssueNoEntry": Alert( - "openpilot Unavailable", - "CAN Error: Check Connections", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "steerUnavailableNoEntry": Alert( - "openpilot Unavailable", - "Steer Fault: Restart the Car", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "brakeUnavailableNoEntry": Alert( - "openpilot Unavailable", - "Brake Fault: Restart the Car", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "gasUnavailableNoEntry": Alert( - "openpilot Unavailable", - "Gas Error: Restart the Car", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "reverseGearNoEntry": Alert( - "openpilot Unavailable", - "Reverse Gear", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "cruiseDisabledNoEntry": Alert( - "openpilot Unavailable", - "Cruise is Off", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "noTargetNoEntry": Alert( - "openpilot Unavailable", - "No Close Lead Car", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - "plannerErrorNoEntry": Alert( - "openpilot Unavailable", - "Planner Solution Error", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, None, "chimeDouble", .4, 2., 3.), - - # permanent alerts to display on small UI upper box - "steerUnavailablePermanent": Alert( - "STEER FAULT: Restart the car to engage", - "", - AlertStatus.normal, AlertSize.small, - Priority.LOWEST, None, None, 0., 0., .2), - - "brakeUnavailablePermanent": Alert( - "BRAKE FAULT: Restart the car to engage", - "", - AlertStatus.normal, AlertSize.small, - Priority.LOWEST, None, None, 0., 0., .2), - - "lowSpeedLockoutPermanent": Alert( - "CRUISE FAULT: Restart the car to engage", - "", - AlertStatus.normal, AlertSize.small, - Priority.LOWEST, None, None, 0., 0., .2), - } def __init__(self): self.activealerts = [] + self.alerts = {alert.alert_type: alert for alert in ALERTS} def alertPresent(self): return len(self.activealerts) > 0 - def add(self, alert_type, enabled=True, extra_text=''): + def add(self, alert_type, enabled=True, extra_text_1='', extra_text_2=''): alert_type = str(alert_type) added_alert = copy.copy(self.alerts[alert_type]) - added_alert.alert_text_2 += extra_text + added_alert.alert_text_1 += extra_text_1 + added_alert.alert_text_2 += extra_text_2 added_alert.start_time = sec_since_boot() # if new alert is higher priority, log it - if not self.alertPresent() or \ - added_alert.alert_priority > self.activealerts[0].alert_priority: - cloudlog.event('alert_add', - alert_type=alert_type, - enabled=enabled) + if not self.alertPresent() or added_alert.alert_priority > self.activealerts[0].alert_priority: + cloudlog.event('alert_add', alert_type=alert_type, enabled=enabled) self.activealerts.append(added_alert) + # sort by priority first and then by start_time self.activealerts.sort(key=lambda k: (k.alert_priority, k.start_time), reverse=True) - # TODO: cycle through alerts? def process_alerts(self, cur_time): # first get rid of all the expired alerts self.activealerts = [a for a in self.activealerts if a.start_time + max(a.duration_sound, a.duration_hud_alert, a.duration_text) > cur_time] - ca = self.activealerts[0] if self.alertPresent() else None + current_alert = self.activealerts[0] if self.alertPresent() else None # start with assuming no alerts + self.alert_type = "" self.alert_text_1 = "" self.alert_text_2 = "" self.alert_status = AlertStatus.normal @@ -517,16 +52,18 @@ def process_alerts(self, cur_time): self.audible_alert = "none" self.alert_rate = 0. - if ca: - if ca.start_time + ca.duration_sound > cur_time: - self.audible_alert = ca.audible_alert + if current_alert: + self.alert_type = current_alert.alert_type + + if current_alert.start_time + current_alert.duration_sound > cur_time: + self.audible_alert = current_alert.audible_alert - if ca.start_time + ca.duration_hud_alert > cur_time: - self.visual_alert = ca.visual_alert + if current_alert.start_time + current_alert.duration_hud_alert > cur_time: + self.visual_alert = current_alert.visual_alert - if ca.start_time + ca.duration_text > cur_time: - self.alert_text_1 = ca.alert_text_1 - self.alert_text_2 = ca.alert_text_2 - self.alert_status = ca.alert_status - self.alert_size = ca.alert_size - self.alert_rate = ca.alert_rate + if current_alert.start_time + current_alert.duration_text > cur_time: + self.alert_text_1 = current_alert.alert_text_1 + self.alert_text_2 = current_alert.alert_text_2 + self.alert_status = current_alert.alert_status + self.alert_size = current_alert.alert_size + self.alert_rate = current_alert.alert_rate diff --git a/selfdrive/controls/lib/alerts.py b/selfdrive/controls/lib/alerts.py new file mode 100644 index 00000000000000..17caf7fbf647fb --- /dev/null +++ b/selfdrive/controls/lib/alerts.py @@ -0,0 +1,634 @@ +from cereal import car, log + +# Priority +class Priority: + LOWEST = 0 + LOW_LOWEST = 1 + LOW = 2 + MID = 3 + HIGH = 4 + HIGHEST = 5 + +AlertSize = log.Live100Data.AlertSize +AlertStatus = log.Live100Data.AlertStatus +AudibleAlert = car.CarControl.HUDControl.AudibleAlert +VisualAlert = car.CarControl.HUDControl.VisualAlert + +class Alert(object): + def __init__(self, + alert_type, + alert_text_1, + alert_text_2, + alert_status, + alert_size, + alert_priority, + visual_alert, + audible_alert, + duration_sound, + duration_hud_alert, + duration_text, + alert_rate=0.): + + self.alert_type = alert_type + self.alert_text_1 = alert_text_1 + self.alert_text_2 = alert_text_2 + self.alert_status = alert_status + self.alert_size = alert_size + self.alert_priority = alert_priority + self.visual_alert = visual_alert + self.audible_alert = audible_alert + + self.duration_sound = duration_sound + self.duration_hud_alert = duration_hud_alert + self.duration_text = duration_text + + self.start_time = 0. + self.alert_rate = alert_rate + + # typecheck that enums are valid on startup + tst = car.CarControl.new_message() + tst.hudControl.visualAlert = self.visual_alert + + def __str__(self): + return self.alert_text_1 + "/" + self.alert_text_2 + " " + str(self.alert_priority) + " " + str( + self.visual_alert) + " " + str(self.audible_alert) + + def __gt__(self, alert2): + return self.alert_priority > alert2.alert_priority + + +ALERTS = [ + # Miscellaneous alerts + Alert( + "enable", + "", + "", + AlertStatus.normal, AlertSize.none, + Priority.MID, VisualAlert.none, AudibleAlert.chimeEngage, .2, 0., 0.), + + Alert( + "disable", + "", + "", + AlertStatus.normal, AlertSize.none, + Priority.MID, VisualAlert.none, AudibleAlert.chimeDisengage, .2, 0., 0.), + + Alert( + "fcw", + "BRAKE!", + "Risk of Collision", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.fcw, AudibleAlert.chimeWarningRepeat, 1., 2., 2.), + + Alert( + "steerSaturated", + "TAKE CONTROL", + "Turn Exceeds Steering Limit", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW, VisualAlert.steerRequired, AudibleAlert.chimePrompt, 1., 2., 3.), + + Alert( + "steerTempUnavailable", + "TAKE CONTROL", + "Steering Temporarily Unavailable", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW, VisualAlert.steerRequired, AudibleAlert.chimeWarning1, .4, 2., 3.), + + Alert( + "steerTempUnavailableMute", + "TAKE CONTROL", + "Steering Temporarily Unavailable", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.none, .2, .2, .2), + + Alert( + "preDriverDistracted", + "KEEP EYES ON ROAD: User Appears Distracted", + "", + AlertStatus.normal, AlertSize.small, + Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .0, .1, .1, alert_rate=0.75), + + Alert( + "promptDriverDistracted", + "KEEP EYES ON ROAD", + "User Appears Distracted", + AlertStatus.userPrompt, AlertSize.mid, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, .1, .1), + + Alert( + "driverDistracted", + "DISENGAGE IMMEDIATELY", + "User Was Distracted", + AlertStatus.critical, AlertSize.full, + Priority.HIGH, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, .1, .1), + + Alert( + "preDriverUnresponsive", + "TOUCH STEERING WHEEL: No Driver Monitoring", + "", + AlertStatus.normal, AlertSize.small, + Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .0, .1, .1, alert_rate=0.75), + + Alert( + "promptDriverUnresponsive", + "TOUCH STEERING WHEEL", + "User Is Unresponsive", + AlertStatus.userPrompt, AlertSize.mid, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, .1, .1), + + Alert( + "driverUnresponsive", + "DISENGAGE IMMEDIATELY", + "User Was Unresponsive", + AlertStatus.critical, AlertSize.full, + Priority.HIGH, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, .1, .1), + + Alert( + "driverMonitorOff", + "DRIVER MONITOR IS UNAVAILABLE", + "Accuracy Is Low", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.none, .4, 0., 4.), + + Alert( + "driverMonitorOn", + "DRIVER MONITOR IS AVAILABLE", + "Accuracy Is High", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.none, .4, 0., 4.), + + Alert( + "geofence", + "DISENGAGEMENT REQUIRED", + "Not in Geofenced Area", + AlertStatus.userPrompt, AlertSize.mid, + Priority.HIGH, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, .1, .1), + + Alert( + "startup", + "Be ready to take over at any time", + "Always keep hands on wheel and eyes on road", + AlertStatus.normal, AlertSize.mid, + Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., 15.), + + Alert( + "ethicalDilemma", + "TAKE CONTROL IMMEDIATELY", + "Ethical Dilemma Detected", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 3.), + + Alert( + "steerTempUnavailableNoEntry", + "openpilot Unavailable", + "Steering Temporarily Unavailable", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 0., 3.), + + Alert( + "manualRestart", + "TAKE CONTROL", + "Resume Driving Manually", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 0., .2), + + Alert( + "resumeRequired", + "STOPPED", + "Press Resume to Move", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 0., .2), + + Alert( + "belowSteerSpeed", + "TAKE CONTROL", + "Steer Unavailable Below ", + AlertStatus.userPrompt, AlertSize.mid, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning1, 0., 0., .1), + + Alert( + "debugAlert", + "DEBUG ALERT", + "", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.none, .1, .1, .1), + + # Non-entry only alerts + Alert( + "wrongCarModeNoEntry", + "openpilot Unavailable", + "Main Switch Off", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 0., 3.), + + Alert( + "dataNeededNoEntry", + "openpilot Unavailable", + "Data Needed for Calibration. Upload Drive, Try Again", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 0., 3.), + + Alert( + "outOfSpaceNoEntry", + "openpilot Unavailable", + "Out of Storage Space", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 0., 3.), + + Alert( + "pedalPressedNoEntry", + "openpilot Unavailable", + "Pedal Pressed During Attempt", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, "brakePressed", AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "speedTooLowNoEntry", + "openpilot Unavailable", + "Speed Too Low", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "brakeHoldNoEntry", + "openpilot Unavailable", + "Brake Hold Active", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "parkBrakeNoEntry", + "openpilot Unavailable", + "Park Brake Engaged", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "lowSpeedLockoutNoEntry", + "openpilot Unavailable", + "Cruise Fault: Restart the Car", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "lowBatteryNoEntry", + "openpilot Unavailable", + "Low Battery", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + # Cancellation alerts causing soft disabling + Alert( + "overheat", + "TAKE CONTROL IMMEDIATELY", + "System Overheated", + AlertStatus.critical, AlertSize.full, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), + + Alert( + "wrongGear", + "TAKE CONTROL IMMEDIATELY", + "Gear not D", + AlertStatus.critical, AlertSize.full, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), + + Alert( + "calibrationInvalid", + "TAKE CONTROL IMMEDIATELY", + "Calibration Invalid: Reposition EON and Recalibrate", + AlertStatus.critical, AlertSize.full, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), + + Alert( + "calibrationIncomplete", + "TAKE CONTROL IMMEDIATELY", + "Calibration in Progress", + AlertStatus.critical, AlertSize.full, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), + + Alert( + "doorOpen", + "TAKE CONTROL IMMEDIATELY", + "Door Open", + AlertStatus.critical, AlertSize.full, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), + + Alert( + "seatbeltNotLatched", + "TAKE CONTROL IMMEDIATELY", + "Seatbelt Unlatched", + AlertStatus.critical, AlertSize.full, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), + + Alert( + "espDisabled", + "TAKE CONTROL IMMEDIATELY", + "ESP Off", + AlertStatus.critical, AlertSize.full, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), + + Alert( + "lowBattery", + "TAKE CONTROL IMMEDIATELY", + "Low Battery", + AlertStatus.critical, AlertSize.full, + Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), + + # Cancellation alerts causing immediate disabling + Alert( + "radarCommIssue", + "TAKE CONTROL IMMEDIATELY", + "Radar Error: Restart the Car", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "radarFault", + "TAKE CONTROL IMMEDIATELY", + "Radar Error: Restart the Car", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "modelCommIssue", + "TAKE CONTROL IMMEDIATELY", + "Model Error: Check Internet Connection", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "controlsFailed", + "TAKE CONTROL IMMEDIATELY", + "Controls Failed", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "controlsMismatch", + "TAKE CONTROL IMMEDIATELY", + "Controls Mismatch", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "commIssue", + "TAKE CONTROL IMMEDIATELY", + "CAN Error: Check Connections", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "steerUnavailable", + "TAKE CONTROL IMMEDIATELY", + "LKAS Fault: Restart the Car", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "brakeUnavailable", + "TAKE CONTROL IMMEDIATELY", + "Cruise Fault: Restart the Car", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "gasUnavailable", + "TAKE CONTROL IMMEDIATELY", + "Gas Fault: Restart the Car", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "reverseGear", + "TAKE CONTROL IMMEDIATELY", + "Reverse Gear", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "cruiseDisabled", + "TAKE CONTROL IMMEDIATELY", + "Cruise Is Off", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + Alert( + "plannerError", + "TAKE CONTROL IMMEDIATELY", + "Planner Solution Error", + AlertStatus.critical, AlertSize.full, + Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), + + # not loud cancellations (user is in control) + Alert( + "noTarget", + "openpilot Canceled", + "No close lead car", + AlertStatus.normal, AlertSize.mid, + Priority.HIGH, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), + + Alert( + "speedTooLow", + "openpilot Canceled", + "Speed too low", + AlertStatus.normal, AlertSize.mid, + Priority.HIGH, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), + + Alert( + "invalidGiraffeHonda", + "Invalid Giraffe Configuration", + "Set 0111 for openpilot. 1011 for stock", + AlertStatus.normal, AlertSize.mid, + Priority.HIGH, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), + + # Cancellation alerts causing non-entry + Alert( + "overheatNoEntry", + "openpilot Unavailable", + "System overheated", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "wrongGearNoEntry", + "openpilot Unavailable", + "Gear not D", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "calibrationInvalidNoEntry", + "openpilot Unavailable", + "Calibration Invalid: Reposition EON and Recalibrate", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "calibrationIncompleteNoEntry", + "openpilot Unavailable", + "Calibration in Progress", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "doorOpenNoEntry", + "openpilot Unavailable", + "Door open", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "seatbeltNotLatchedNoEntry", + "openpilot Unavailable", + "Seatbelt unlatched", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "espDisabledNoEntry", + "openpilot Unavailable", + "ESP Off", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "geofenceNoEntry", + "openpilot Unavailable", + "Not in Geofenced Area", + AlertStatus.normal, AlertSize.mid, + Priority.MID, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "radarCommIssueNoEntry", + "openpilot Unavailable", + "Radar Error: Restart the Car", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "radarFaultNoEntry", + "openpilot Unavailable", + "Radar Error: Restart the Car", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "modelCommIssueNoEntry", + "openpilot Unavailable", + "Model Error: Check Internet Connection", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "controlsFailedNoEntry", + "openpilot Unavailable", + "Controls Failed", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "commIssueNoEntry", + "openpilot Unavailable", + "CAN Error: Check Connections", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "steerUnavailableNoEntry", + "openpilot Unavailable", + "LKAS Fault: Restart the Car", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "brakeUnavailableNoEntry", + "openpilot Unavailable", + "Cruise Fault: Restart the Car", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "gasUnavailableNoEntry", + "openpilot Unavailable", + "Gas Error: Restart the Car", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "reverseGearNoEntry", + "openpilot Unavailable", + "Reverse Gear", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "cruiseDisabledNoEntry", + "openpilot Unavailable", + "Cruise is Off", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "noTargetNoEntry", + "openpilot Unavailable", + "No Close Lead Car", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "plannerErrorNoEntry", + "openpilot Unavailable", + "Planner Solution Error", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), + + Alert( + "invalidGiraffeHondaNoEntry", + "openpilot Unavailable", + "Set 0111 for openpilot. 1011 for stock", + AlertStatus.normal, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), + + # permanent alerts + Alert( + "steerUnavailablePermanent", + "LKAS Fault: Restart the car to engage", + "", + AlertStatus.normal, AlertSize.small, + Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), + + Alert( + "brakeUnavailablePermanent", + "Cruise Fault: Restart the car to engage", + "", + AlertStatus.normal, AlertSize.small, + Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), + + Alert( + "lowSpeedLockoutPermanent", + "Cruise Fault: Restart the car to engage", + "", + AlertStatus.normal, AlertSize.small, + Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), + + Alert( + "calibrationIncompletePermanent", + "Calibration in Progress: ", + "Drive Above ", + AlertStatus.normal, AlertSize.mid, + Priority.LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), + + Alert( + "invalidGiraffeHondaPermanent", + "Invalid Giraffe Configuration", + "Set 0111 for openpilot. 1011 for stock", + AlertStatus.normal, AlertSize.mid, + Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), + + Alert( + "vehicleModelInvalid", + "Vehicle Parameter Identification Failed", + "", + AlertStatus.normal, AlertSize.small, + Priority.LOWEST, VisualAlert.steerRequired, AudibleAlert.none, .0, .0, .1), +] diff --git a/selfdrive/controls/lib/drive_helpers.py b/selfdrive/controls/lib/drive_helpers.py index 10d3eee73ddaec..15d5a202f74c4d 100644 --- a/selfdrive/controls/lib/drive_helpers.py +++ b/selfdrive/controls/lib/drive_helpers.py @@ -1,5 +1,3 @@ -import os -import signal from cereal import car from common.numpy_fast import clip from selfdrive.config import Conversions as CV @@ -10,6 +8,7 @@ V_CRUISE_DELTA = 8 V_CRUISE_ENABLE_MIN = 40 + class MPC_COST_LAT: PATH = 1.0 LANE = 3.0 @@ -56,12 +55,12 @@ def rate_limit(new_value, last_value, dw_step, up_step): return clip(new_value, last_value + dw_step, last_value + up_step) -def learn_angle_offset(lateral_control, v_ego, angle_offset, c_poly, c_prob, angle_steers, steer_override): +def learn_angle_model_bias(lateral_control, v_ego, angle_model_bias, c_poly, c_prob, angle_steers, steer_override): # simple integral controller that learns how much steering offset to put to have the car going straight # while being in the middle of the lane min_offset = -5. # deg - max_offset = 5. # deg - alpha = 1./36000. # correct by 1 deg in 2 mins, at 30m/s, with 50cm of error, at 20Hz + max_offset = 5. # deg + alpha = 1. / 36000. # correct by 1 deg in 2 mins, at 30m/s, with 50cm of error, at 20Hz min_learn_speed = 1. # learn less at low speed or when turning @@ -70,10 +69,10 @@ def learn_angle_offset(lateral_control, v_ego, angle_offset, c_poly, c_prob, ang # only learn if lateral control is active and if driver is not overriding: if lateral_control and not steer_override: - angle_offset += c_poly[3] * alpha_v - angle_offset = clip(angle_offset, min_offset, max_offset) + angle_model_bias += c_poly[3] * alpha_v + angle_model_bias = clip(angle_model_bias, min_offset, max_offset) - return angle_offset + return angle_model_bias def update_v_cruise(v_cruise_kph, buttonEvents, enabled): @@ -92,17 +91,8 @@ def update_v_cruise(v_cruise_kph, buttonEvents, enabled): def initialize_v_cruise(v_ego, buttonEvents, v_cruise_last): for b in buttonEvents: - # 300kph or above probably means we never had a set speed - if b.type == "accelCruise" and v_cruise_last < 300: + # 250kph or above probably means we never had a set speed + if b.type == "accelCruise" and v_cruise_last < 250: return v_cruise_last - return int(round(max(v_ego * CV.MS_TO_KPH, V_CRUISE_ENABLE_MIN))) - - -def kill_defaultd(): - # defaultd is used to send can messages when controlsd is off to make car test easier - if os.path.isfile("/tmp/defaultd_pid"): - with open("/tmp/defaultd_pid") as f: - ddpid = int(f.read()) - print("signalling defaultd with pid %d" % ddpid) - os.kill(ddpid, signal.SIGUSR1) + return int(round(clip(v_ego * CV.MS_TO_KPH, V_CRUISE_ENABLE_MIN, V_CRUISE_MAX))) diff --git a/selfdrive/controls/lib/driver_monitor.py b/selfdrive/controls/lib/driver_monitor.py index a593f1091dc6f9..10e0e0be66131b 100644 --- a/selfdrive/controls/lib/driver_monitor.py +++ b/selfdrive/controls/lib/driver_monitor.py @@ -1,12 +1,14 @@ import numpy as np from common.realtime import sec_since_boot from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET +from common.filter_simple import FirstOrderFilter _DT = 0.01 # update runs at 100Hz +_DTM = 0.1 # DM runs at 10Hz _AWARENESS_TIME = 180 # 3 minutes limit without user touching steering wheels make the car enter a terminal status _AWARENESS_PRE_TIME = 20. # a first alert is issued 20s before expiration _AWARENESS_PROMPT_TIME = 5. # a second alert is issued 5s before start decelerating the car -_DISTRACTED_TIME = 6. +_DISTRACTED_TIME = 7. _DISTRACTED_PRE_TIME = 4. _DISTRACTED_PROMPT_TIME = 2. # measured 1 rad in x FOV. 1152x864 is original image, 160x320 is a right crop for model @@ -18,10 +20,10 @@ _PITCH_WEIGHT = 1.5 # pitch matters a lot more _METRIC_THRESHOLD = 0.4 _PITCH_POS_ALLOWANCE = 0.08 # rad, to not be too sensitive on positive pitch -_DTM = 0.2 # driver monitor runs at 5Hz -_DISTRACTED_FILTER_F = 0.3 # 0.3Hz -_DISTRACTED_FILTER_K = 2 * np.pi * _DISTRACTED_FILTER_F * _DTM / (1 + 2 * np.pi * _DISTRACTED_FILTER_F * _DTM) _PITCH_NATURAL_OFFSET = 0.1 # people don't seem to look straight when they drive relaxed, rather a bit up +_STD_THRESHOLD = 0.1 # above this standard deviation consider the measurement invalid +_DISTRACTED_FILTER_TS = 0.25 # 0.6Hz +_VARIANCE_FILTER_TS = 20. # 0.008Hz class _DriverPose(): @@ -32,16 +34,29 @@ def __init__(self): self.yaw_offset = 0. self.pitch_offset = 0. +def _monitor_hysteresys(variance_level, monitor_valid_prev): + var_thr = 0.63 if monitor_valid_prev else 0.37 + return variance_level < var_thr + class DriverStatus(): - def __init__(self, monitor_on): + def __init__(self, monitor_on=False): self.pose = _DriverPose() self.monitor_on = monitor_on + self.monitor_param_on = monitor_on + self.monitor_valid = True # variance needs to be low self.awareness = 1. self.driver_distracted = False - self.driver_distraction_level = 0. + self.driver_distraction_filter = FirstOrderFilter(0., _DISTRACTED_FILTER_TS, _DTM) + self.variance_high = False + self.variance_filter = FirstOrderFilter(0., _VARIANCE_FILTER_TS, _DTM) self.ts_last_check = 0. self._set_timers() + def _reset_filters(self): + self.driver_distraction_filter.x = 0. + self.variance_filter.x = 0. + self.monitor_valid = True + def _set_timers(self): if self.monitor_on: self.threshold_pre = _DISTRACTED_PRE_TIME / _DISTRACTED_TIME @@ -64,14 +79,8 @@ def _is_driver_distracted(self, pose): #print "%02.4f" % np.degrees(pose.pitch), "%02.4f" % np.degrees(pitch_error), "%03.4f" % np.degrees(pose.pitch_offset), metric return 1 if metric > _METRIC_THRESHOLD else 0 - def get_pose(self, driver_monitoring, params): - ts = sec_since_boot() - # don's check for param too often as it's a kernel call - if ts - self.ts_last_check > 1.: - self.monitor_on = params.get("IsDriverMonitoringEnabled") == "1" - self._set_timers() - self.ts_last_check = ts + def get_pose(self, driver_monitoring, params): self.pose.pitch = driver_monitoring.descriptor[0] self.pose.yaw = driver_monitoring.descriptor[1] @@ -79,43 +88,62 @@ def get_pose(self, driver_monitoring, params): self.pose.yaw_offset = (driver_monitoring.descriptor[3] * _CAMERA_X_CONV + _CAMERA_OFFSET_X) * _CAMERA_FOV_X self.pose.pitch_offset = -driver_monitoring.descriptor[4] * _CAMERA_FOV_Y # positive y is down self.driver_distracted = self._is_driver_distracted(self.pose) - # first order filter - self.driver_distraction_level = (1. - _DISTRACTED_FILTER_K) * self.driver_distraction_level + \ - _DISTRACTED_FILTER_K * self.driver_distracted + # first order filters + self.driver_distraction_filter.update(self.driver_distracted) + self.variance_high = driver_monitoring.std > _STD_THRESHOLD + self.variance_filter.update(self.variance_high) + + monitor_param_on_prev = self.monitor_param_on + monitor_valid_prev = self.monitor_valid + + # don't check for param too often as it's a kernel call + ts = sec_since_boot() + if ts - self.ts_last_check > 1.: + self.monitor_param_on = params.get("IsDriverMonitoringEnabled") == "1" + self.ts_last_check = ts + + self.monitor_valid = _monitor_hysteresys(self.variance_filter.x, monitor_valid_prev) + self.monitor_on = self.monitor_valid and self.monitor_param_on + if monitor_param_on_prev != self.monitor_param_on: + self._reset_filters() + self._set_timers() + def update(self, events, driver_engaged, ctrl_active, standstill): - driver_engaged |= (self.driver_distraction_level < 0.37 and self.monitor_on) + driver_engaged |= (self.driver_distraction_filter.x < 0.37 and self.monitor_on) if (driver_engaged and self.awareness > 0.) or not ctrl_active: # always reset if driver is in control (unless we are in red alert state) or op isn't active self.awareness = 1. - if (not self.monitor_on or (self.driver_distraction_level > 0.63 and self.driver_distracted)) and \ + if (not self.monitor_on or (self.driver_distraction_filter.x > 0.63 and self.driver_distracted)) and \ not (standstill and self.awareness - self.step_change <= self.threshold_prompt): self.awareness = max(self.awareness - self.step_change, -0.1) + alert = None if self.awareness <= 0.: # terminal red alert: disengagement required - events.append(create_event('driverDistracted', [ET.WARNING])) + alert = 'driverDistracted' if self.monitor_on else 'driverUnresponsive' elif self.awareness <= self.threshold_prompt: # prompt orange alert - events.append(create_event('promptDriverDistracted', [ET.WARNING])) + alert = 'promptDriverDistracted' if self.monitor_on else 'promptDriverUnresponsive' elif self.awareness <= self.threshold_pre: # pre green alert - events.append(create_event('preDriverDistracted', [ET.WARNING])) + alert = 'preDriverDistracted' if self.monitor_on else 'preDriverUnresponsive' + if alert is not None: + events.append(create_event(alert, [ET.WARNING])) return events if __name__ == "__main__": ds = DriverStatus(True) - ds.driver_distraction_level = 1. + ds.driver_distraction_filter.x = 0. ds.driver_distracted = 1 - for i in range(1000): - ds.update([], False, True, True) - print(ds.awareness, ds.driver_distracted, ds.driver_distraction_level) + for i in range(10): + ds.update([], False, True, False) + print(ds.awareness, ds.driver_distracted, ds.driver_distraction_filter.x) ds.update([], True, True, False) - print(ds.awareness, ds.driver_distracted, ds.driver_distraction_level) - + print(ds.awareness, ds.driver_distracted, ds.driver_distraction_filter.x) diff --git a/selfdrive/controls/lib/fcw.py b/selfdrive/controls/lib/fcw.py new file mode 100644 index 00000000000000..f93a72cfcce321 --- /dev/null +++ b/selfdrive/controls/lib/fcw.py @@ -0,0 +1,71 @@ +import numpy as np +from collections import defaultdict + +from common.numpy_fast import interp + +_FCW_A_ACT_V = [-3., -2.] +_FCW_A_ACT_BP = [0., 30.] + + +class FCWChecker(object): + def __init__(self): + self.reset_lead(0.0) + + def reset_lead(self, cur_time): + self.last_fcw_a = 0.0 + self.v_lead_max = 0.0 + self.lead_seen_t = cur_time + self.last_fcw_time = 0.0 + self.last_min_a = 0.0 + + self.counters = defaultdict(lambda: 0) + + @staticmethod + def calc_ttc(v_ego, a_ego, x_lead, v_lead, a_lead): + max_ttc = 5.0 + + v_rel = v_ego - v_lead + a_rel = a_ego - a_lead + + # assuming that closing gap ARel comes from lead vehicle decel, + # then limit ARel so that v_lead will get to zero in no sooner than t_decel. + # This helps underweighting ARel when v_lead is close to zero. + t_decel = 2. + a_rel = np.minimum(a_rel, v_lead / t_decel) + + # delta of the quadratic equation to solve for ttc + delta = v_rel**2 + 2 * x_lead * a_rel + + # assign an arbitrary high ttc value if there is no solution to ttc + if delta < 0.1 or (np.sqrt(delta) + v_rel < 0.1): + ttc = max_ttc + else: + ttc = np.minimum(2 * x_lead / (np.sqrt(delta) + v_rel), max_ttc) + return ttc + + def update(self, mpc_solution, cur_time, v_ego, a_ego, x_lead, v_lead, a_lead, y_lead, vlat_lead, fcw_lead, blinkers): + mpc_solution_a = list(mpc_solution[0].a_ego) + self.last_min_a = min(mpc_solution_a) + self.v_lead_max = max(self.v_lead_max, v_lead) + + if (fcw_lead > 0.99): + ttc = self.calc_ttc(v_ego, a_ego, x_lead, v_lead, a_lead) + self.counters['v_ego'] = self.counters['v_ego'] + 1 if v_ego > 5.0 else 0 + self.counters['ttc'] = self.counters['ttc'] + 1 if ttc < 2.5 else 0 + self.counters['v_lead_max'] = self.counters['v_lead_max'] + 1 if self.v_lead_max > 2.5 else 0 + self.counters['v_ego_lead'] = self.counters['v_ego_lead'] + 1 if v_ego > v_lead else 0 + self.counters['lead_seen'] = self.counters['lead_seen'] + 0.33 + self.counters['y_lead'] = self.counters['y_lead'] + 1 if abs(y_lead) < 1.0 else 0 + self.counters['vlat_lead'] = self.counters['vlat_lead'] + 1 if abs(vlat_lead) < 0.4 else 0 + self.counters['blinkers'] = self.counters['blinkers'] + 10.0 / (20 * 3.0) if not blinkers else 0 + + a_thr = interp(v_lead, _FCW_A_ACT_BP, _FCW_A_ACT_V) + a_delta = min(mpc_solution_a[:15]) - min(0.0, a_ego) + + fcw_allowed = all(c >= 10 for c in self.counters.values()) + if (self.last_min_a < -3.0 or a_delta < a_thr) and fcw_allowed and self.last_fcw_time + 5.0 < cur_time: + self.last_fcw_time = cur_time + self.last_fcw_a = self.last_min_a + return True + + return False diff --git a/selfdrive/controls/lib/latcontrol.py b/selfdrive/controls/lib/latcontrol.py index e1fd68b90df397..69494387083414 100644 --- a/selfdrive/controls/lib/latcontrol.py +++ b/selfdrive/controls/lib/latcontrol.py @@ -1,102 +1,27 @@ -import math -import numpy as np from selfdrive.controls.lib.pid import PIController -from selfdrive.controls.lib.drive_helpers import MPC_COST_LAT -from selfdrive.controls.lib.lateral_mpc import libmpc_py from common.numpy_fast import interp -from common.realtime import sec_since_boot -from selfdrive.swaglog import cloudlog from cereal import car _DT = 0.01 # 100Hz _DT_MPC = 0.05 # 20Hz -def calc_states_after_delay(states, v_ego, steer_angle, curvature_factor, steer_ratio, delay): - states[0].x = v_ego * delay - states[0].psi = v_ego * curvature_factor * math.radians(steer_angle) / steer_ratio * delay - return states - - def get_steer_max(CP, v_ego): return interp(v_ego, CP.steerMaxBP, CP.steerMaxV) class LatControl(object): - def __init__(self, VM): - self.pid = PIController((VM.CP.steerKpBP, VM.CP.steerKpV), - (VM.CP.steerKiBP, VM.CP.steerKiV), - k_f=VM.CP.steerKf, pos_limit=1.0) + def __init__(self, CP): + self.pid = PIController((CP.steerKpBP, CP.steerKpV), + (CP.steerKiBP, CP.steerKiV), + k_f=CP.steerKf, pos_limit=1.0) self.last_cloudlog_t = 0.0 - self.setup_mpc(VM.CP.steerRateCost) - - def setup_mpc(self, steer_rate_cost): - self.libmpc = libmpc_py.libmpc - self.libmpc.init(MPC_COST_LAT.PATH, MPC_COST_LAT.LANE, MPC_COST_LAT.HEADING, steer_rate_cost) - - self.mpc_solution = libmpc_py.ffi.new("log_t *") - self.cur_state = libmpc_py.ffi.new("state_t *") - self.mpc_updated = False - self.mpc_nans = False - self.cur_state[0].x = 0.0 - self.cur_state[0].y = 0.0 - self.cur_state[0].psi = 0.0 - self.cur_state[0].delta = 0.0 - - self.last_mpc_ts = 0.0 - self.angle_steers_des = 0.0 - self.angle_steers_des_mpc = 0.0 - self.angle_steers_des_prev = 0.0 - self.angle_steers_des_time = 0.0 + self.angle_steers_des = 0. def reset(self): self.pid.reset() - def update(self, active, v_ego, angle_steers, steer_override, d_poly, angle_offset, VM, PL): - cur_time = sec_since_boot() - self.mpc_updated = False - # TODO: this creates issues in replay when rewinding time: mpc won't run - if self.last_mpc_ts < PL.last_md_ts: - self.last_mpc_ts = PL.last_md_ts - self.angle_steers_des_prev = self.angle_steers_des_mpc - - curvature_factor = VM.curvature_factor(v_ego) - - l_poly = libmpc_py.ffi.new("double[4]", list(PL.PP.l_poly)) - r_poly = libmpc_py.ffi.new("double[4]", list(PL.PP.r_poly)) - p_poly = libmpc_py.ffi.new("double[4]", list(PL.PP.p_poly)) - - # account for actuation delay - self.cur_state = calc_states_after_delay(self.cur_state, v_ego, angle_steers, curvature_factor, VM.CP.steerRatio, VM.CP.steerActuatorDelay) - - v_ego_mpc = max(v_ego, 5.0) # avoid mpc roughness due to low speed - self.libmpc.run_mpc(self.cur_state, self.mpc_solution, - l_poly, r_poly, p_poly, - PL.PP.l_prob, PL.PP.r_prob, PL.PP.p_prob, curvature_factor, v_ego_mpc, PL.PP.lane_width) - - # reset to current steer angle if not active or overriding - if active: - delta_desired = self.mpc_solution[0].delta[1] - else: - delta_desired = math.radians(angle_steers - angle_offset) / VM.CP.steerRatio - - self.cur_state[0].delta = delta_desired - - self.angle_steers_des_mpc = float(math.degrees(delta_desired * VM.CP.steerRatio) + angle_offset) - self.angle_steers_des_time = cur_time - self.mpc_updated = True - - # Check for infeasable MPC solution - self.mpc_nans = np.any(np.isnan(list(self.mpc_solution[0].delta))) - t = sec_since_boot() - if self.mpc_nans: - self.libmpc.init(MPC_COST_LAT.PATH, MPC_COST_LAT.LANE, MPC_COST_LAT.HEADING, VM.CP.steerRateCost) - self.cur_state[0].delta = math.radians(angle_steers) / VM.CP.steerRatio - - if t > self.last_cloudlog_t + 5.0: - self.last_cloudlog_t = t - cloudlog.warning("Lateral mpc - nan: True") - + def update(self, active, v_ego, angle_steers, steer_override, CP, VM, path_plan): if v_ego < 0.3 or not active: output_steer = 0.0 self.pid.reset() @@ -105,12 +30,15 @@ def update(self, active, v_ego, angle_steers, steer_override, d_poly, angle_offs # constant for 0.05s. #dt = min(cur_time - self.angle_steers_des_time, _DT_MPC + _DT) + _DT # no greater than dt mpc + dt, to prevent too high extraps #self.angle_steers_des = self.angle_steers_des_prev + (dt / _DT_MPC) * (self.angle_steers_des_mpc - self.angle_steers_des_prev) - self.angle_steers_des = self.angle_steers_des_mpc - steers_max = get_steer_max(VM.CP, v_ego) + self.angle_steers_des = path_plan.angleSteers # get from MPC/PathPlanner + + steers_max = get_steer_max(CP, v_ego) self.pid.pos_limit = steers_max self.pid.neg_limit = -steers_max steer_feedforward = self.angle_steers_des # feedforward desired angle - if VM.CP.steerControlType == car.CarParams.SteerControlType.torque: + if CP.steerControlType == car.CarParams.SteerControlType.torque: + # TODO: feedforward something based on path_plan.rateSteers + steer_feedforward -= path_plan.angleOffset # subtract the offset, since it does not contribute to resistive torque steer_feedforward *= v_ego**2 # proportional to realigning tire momentum (~ lateral accel) deadzone = 0.0 output_steer = self.pid.update(self.angle_steers_des, angle_steers, check_saturation=(v_ego > 10), override=steer_override, diff --git a/selfdrive/controls/lib/lateral_mpc/Makefile b/selfdrive/controls/lib/lateral_mpc/Makefile index becef563e5ea53..97579e751c833e 100644 --- a/selfdrive/controls/lib/lateral_mpc/Makefile +++ b/selfdrive/controls/lib/lateral_mpc/Makefile @@ -4,6 +4,7 @@ CXX = clang++ PHONELIBS = ../../../../phonelibs +UNAME_S := $(shell uname -s) UNAME_M := $(shell uname -m) CFLAGS = -O3 -fPIC -I. @@ -13,70 +14,63 @@ QPOASES_FLAGS = -I$(PHONELIBS)/qpoases -I$(PHONELIBS)/qpoases/INCLUDE -I$(PHONEL ACADO_FLAGS = -I$(PHONELIBS)/acado/include -I$(PHONELIBS)/acado/include/acado -ifeq ($(UNAME_M),aarch64) -ACADO_LIBS := -L $(PHONELIBS)/acado/aarch64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a +ifeq ($(UNAME_S),Darwin) + ACADO_LIBS := -lacado_toolkit_s +else ifeq ($(UNAME_M),aarch64) + ACADO_LIBS := -L $(PHONELIBS)/acado/aarch64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a else -ACADO_LIBS := -L $(PHONELIBS)/acado/x64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a + ACADO_LIBS := -L $(PHONELIBS)/acado/x64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a endif OBJS = \ - qp/Bounds.o \ - qp/Constraints.o \ - qp/CyclingManager.o \ - qp/Indexlist.o \ - qp/MessageHandling.o \ - qp/QProblem.o \ - qp/QProblemB.o \ - qp/SubjectTo.o \ - qp/Utils.o \ - qp/EXTRAS/SolutionAnalysis.o \ - mpc_export/acado_qpoases_interface.o \ - mpc_export/acado_integrator.o \ - mpc_export/acado_solver.o \ - mpc_export/acado_auxiliary_functions.o \ - mpc.o + lib_qp/Bounds.o \ + lib_qp/Constraints.o \ + lib_qp/CyclingManager.o \ + lib_qp/Indexlist.o \ + lib_qp/MessageHandling.o \ + lib_qp/QProblem.o \ + lib_qp/QProblemB.o \ + lib_qp/SubjectTo.o \ + lib_qp/Utils.o \ + lib_qp/EXTRAS/SolutionAnalysis.o \ + lib_mpc_export/acado_qpoases_interface.o \ + lib_mpc_export/acado_integrator.o \ + lib_mpc_export/acado_solver.o \ + lib_mpc_export/acado_auxiliary_functions.o \ + lateral_mpc.o DEPS := $(OBJS:.o=.d) .PHONY: all -all: libcommampc.so +all: libmpc.so -libcommampc.so: $(OBJS) +libmpc.so: $(OBJS) $(CXX) -shared -o '$@' $^ -lm - -qp/%.o: $(PHONELIBS)/qpoases/SRC/%.cpp - @echo "[ CXX ] $@" - mkdir -p qp - $(CXX) $(CXXFLAGS) -MMD \ - -I mpc_export/ \ - $(QPOASES_FLAGS) \ - -c -o '$@' '$<' - -qp/EXTRAS/%.o: $(PHONELIBS)/qpoases/SRC/EXTRAS/%.cpp +lib_qp/%.o: $(PHONELIBS)/qpoases/SRC/%.cpp @echo "[ CXX ] $@" - mkdir -p qp/EXTRAS + mkdir -p lib_qp/EXTRAS $(CXX) $(CXXFLAGS) -MMD \ - -I mpc_export/ \ + -I lib_mpc_export/ \ $(QPOASES_FLAGS) \ -c -o '$@' '$<' %.o: %.cpp @echo "[ CXX ] $@" $(CXX) $(CXXFLAGS) -MMD \ - -I mpc_export/ \ + -I lib_mpc_export/ \ $(QPOASES_FLAGS) \ -c -o '$@' '$<' %.o: %.c @echo "[ CC ] $@" $(CC) $(CFLAGS) -MMD \ - -I mpc_export/ \ + -I lib_mpc_export/ \ $(QPOASES_FLAGS) \ -c -o '$@' '$<' generator: generator.cpp - $(CXX) -Wall -std=c++11 \ + $(CXX) -v -Wall -std=c++11 \ generator.cpp \ -o generator \ $(ACADO_FLAGS) \ @@ -88,6 +82,6 @@ generate: generator .PHONY: clean clean: - rm -f libcommampc.so generator $(OBJS) $(DEPS) + rm -f *.so generator $(OBJS) $(DEPS) -include $(DEPS) diff --git a/selfdrive/controls/lib/lateral_mpc/generator.cpp b/selfdrive/controls/lib/lateral_mpc/generator.cpp index 32e2d30e3de355..9af88f9dc8a732 100644 --- a/selfdrive/controls/lib/lateral_mpc/generator.cpp +++ b/selfdrive/controls/lib/lateral_mpc/generator.cpp @@ -141,7 +141,7 @@ int main( ) mpc.set( GENERATE_MATLAB_INTERFACE, NO ); mpc.set( GENERATE_SIMULINK_INTERFACE, NO ); - if (mpc.exportCode( "mpc_export" ) != SUCCESSFUL_RETURN) + if (mpc.exportCode( "lib_mpc_export" ) != SUCCESSFUL_RETURN) exit( EXIT_FAILURE ); mpc.printDimensionsQP( ); diff --git a/selfdrive/controls/lib/lateral_mpc/mpc.c b/selfdrive/controls/lib/lateral_mpc/lateral_mpc.c similarity index 98% rename from selfdrive/controls/lib/lateral_mpc/mpc.c rename to selfdrive/controls/lib/lateral_mpc/lateral_mpc.c index f4cee7f2d0a2aa..e5adf02cf4e125 100644 --- a/selfdrive/controls/lib/lateral_mpc/mpc.c +++ b/selfdrive/controls/lib/lateral_mpc/lateral_mpc.c @@ -26,6 +26,7 @@ typedef struct { double y[N+1]; double psi[N+1]; double delta[N+1]; + double rate[N+1]; double cost; } log_t; @@ -103,7 +104,7 @@ int run_mpc(state_t * x0, log_t * solution, acado_preparationStep(); acado_feedbackStep(); - + /* printf("lat its: %d\n", acado_getNWSR()); // n iterations printf("Objective: %.6f\n", acado_getObjective()); // solution cost */ @@ -112,6 +113,7 @@ int run_mpc(state_t * x0, log_t * solution, solution->y[i] = acadoVariables.x[i*NX+1]; solution->psi[i] = acadoVariables.x[i*NX+2]; solution->delta[i] = acadoVariables.x[i*NX+3]; + solution->rate[i] = acadoVariables.u[i]; } solution->cost = acado_getObjective(); diff --git a/selfdrive/controls/lib/lateral_mpc/lateral_mpc.d b/selfdrive/controls/lib/lateral_mpc/lateral_mpc.d new file mode 100644 index 00000000000000..6cac7c2e148128 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lateral_mpc.d @@ -0,0 +1,3 @@ +lateral_mpc.o: lateral_mpc.c lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp \ + lib_mpc_export/acado_auxiliary_functions.h diff --git a/selfdrive/controls/lib/lateral_mpc/lateral_mpc.o b/selfdrive/controls/lib/lateral_mpc/lateral_mpc.o new file mode 100644 index 00000000000000..fdd82d242cbaff Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lateral_mpc.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/mpc_export/acado_auxiliary_functions.c b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.c similarity index 100% rename from selfdrive/controls/lib/lateral_mpc/mpc_export/acado_auxiliary_functions.c rename to selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.c diff --git a/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.d b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.d new file mode 100644 index 00000000000000..50c6a60d1fb846 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.d @@ -0,0 +1,5 @@ +lib_mpc_export/acado_auxiliary_functions.o: \ + lib_mpc_export/acado_auxiliary_functions.c \ + lib_mpc_export/acado_auxiliary_functions.h \ + lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp diff --git a/selfdrive/controls/lib/lateral_mpc/mpc_export/acado_auxiliary_functions.h b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.h similarity index 100% rename from selfdrive/controls/lib/lateral_mpc/mpc_export/acado_auxiliary_functions.h rename to selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.h diff --git a/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.o b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.o new file mode 100644 index 00000000000000..07d92429b217f2 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_auxiliary_functions.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/mpc_export/acado_common.h b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_common.h similarity index 100% rename from selfdrive/controls/lib/lateral_mpc/mpc_export/acado_common.h rename to selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_common.h diff --git a/selfdrive/controls/lib/lateral_mpc/mpc_export/acado_integrator.c b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_integrator.c similarity index 100% rename from selfdrive/controls/lib/lateral_mpc/mpc_export/acado_integrator.c rename to selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_integrator.c diff --git a/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_integrator.d b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_integrator.d new file mode 100644 index 00000000000000..7c057e5ec0f3a9 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_integrator.d @@ -0,0 +1,3 @@ +lib_mpc_export/acado_integrator.o: lib_mpc_export/acado_integrator.c \ + lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_integrator.o b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_integrator.o new file mode 100644 index 00000000000000..d08f1e41279bb7 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_integrator.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/mpc_export/acado_qpoases_interface.cpp b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.cpp similarity index 100% rename from selfdrive/controls/lib/lateral_mpc/mpc_export/acado_qpoases_interface.cpp rename to selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.cpp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.d b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.d new file mode 100644 index 00000000000000..ba3c6ef1c831b7 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.d @@ -0,0 +1,24 @@ +lib_mpc_export/acado_qpoases_interface.o: \ + lib_mpc_export/acado_qpoases_interface.cpp \ + lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblem.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblemB.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblemB.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/Constraints.hpp \ + ../../../../phonelibs/qpoases/SRC/Constraints.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/CyclingManager.hpp \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblem.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/mpc_export/acado_qpoases_interface.hpp b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.hpp similarity index 100% rename from selfdrive/controls/lib/lateral_mpc/mpc_export/acado_qpoases_interface.hpp rename to selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.hpp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.o b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.o new file mode 100644 index 00000000000000..e10c9772ab2b29 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/mpc_export/acado_solver.c b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_solver.c similarity index 100% rename from selfdrive/controls/lib/lateral_mpc/mpc_export/acado_solver.c rename to selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_solver.c diff --git a/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_solver.d b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_solver.d new file mode 100644 index 00000000000000..2dae4b94389e48 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_solver.d @@ -0,0 +1,3 @@ +lib_mpc_export/acado_solver.o: lib_mpc_export/acado_solver.c \ + lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_solver.o b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_solver.o new file mode 100644 index 00000000000000..f91ea40ab5e655 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_solver.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/Bounds.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/Bounds.d new file mode 100644 index 00000000000000..752ec5e9f3c686 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/Bounds.d @@ -0,0 +1,14 @@ +lib_qp/Bounds.o: ../../../../phonelibs/qpoases/SRC/Bounds.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/Bounds.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/Bounds.o new file mode 100644 index 00000000000000..ba30572669f57d Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/Bounds.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/Constraints.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/Constraints.d new file mode 100644 index 00000000000000..60295bc07b3dc9 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/Constraints.d @@ -0,0 +1,14 @@ +lib_qp/Constraints.o: ../../../../phonelibs/qpoases/SRC/Constraints.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constraints.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Constraints.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/Constraints.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/Constraints.o new file mode 100644 index 00000000000000..d892c668667029 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/Constraints.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/CyclingManager.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/CyclingManager.d new file mode 100644 index 00000000000000..24145d8ed318e1 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/CyclingManager.d @@ -0,0 +1,11 @@ +lib_qp/CyclingManager.o: \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/CyclingManager.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/CyclingManager.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/CyclingManager.o new file mode 100644 index 00000000000000..685e25d56b0c62 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/CyclingManager.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/EXTRAS/SolutionAnalysis.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/EXTRAS/SolutionAnalysis.d new file mode 100644 index 00000000000000..77c09376eef96e --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/EXTRAS/SolutionAnalysis.d @@ -0,0 +1,24 @@ +lib_qp/EXTRAS/SolutionAnalysis.o: \ + ../../../../phonelibs/qpoases/SRC/EXTRAS/SolutionAnalysis.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/EXTRAS/SolutionAnalysis.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblem.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblemB.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblemB.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/Constraints.hpp \ + ../../../../phonelibs/qpoases/SRC/Constraints.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/CyclingManager.hpp \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblem.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/EXTRAS/SolutionAnalysis.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/EXTRAS/SolutionAnalysis.o new file mode 100644 index 00000000000000..987f1e56361641 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/EXTRAS/SolutionAnalysis.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/Indexlist.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/Indexlist.d new file mode 100644 index 00000000000000..6ead64cb9d8ee6 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/Indexlist.d @@ -0,0 +1,10 @@ +lib_qp/Indexlist.o: ../../../../phonelibs/qpoases/SRC/Indexlist.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/Indexlist.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/Indexlist.o new file mode 100644 index 00000000000000..bd77188d453aae Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/Indexlist.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/MessageHandling.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/MessageHandling.d new file mode 100644 index 00000000000000..b5c6166aba1f64 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/MessageHandling.d @@ -0,0 +1,9 @@ +lib_qp/MessageHandling.o: \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/MessageHandling.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/MessageHandling.o new file mode 100644 index 00000000000000..87b200d0475adb Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/MessageHandling.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblem.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblem.d new file mode 100644 index 00000000000000..1f6e188af55c17 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblem.d @@ -0,0 +1,22 @@ +lib_qp/QProblem.o: ../../../../phonelibs/qpoases/SRC/QProblem.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblem.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblemB.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblemB.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/Constraints.hpp \ + ../../../../phonelibs/qpoases/SRC/Constraints.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/CyclingManager.hpp \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblem.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblem.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblem.o new file mode 100644 index 00000000000000..8c179beae1dc8f Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblem.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblemB.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblemB.d new file mode 100644 index 00000000000000..7878a825ce5749 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblemB.d @@ -0,0 +1,16 @@ +lib_qp/QProblemB.o: ../../../../phonelibs/qpoases/SRC/QProblemB.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblemB.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblemB.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblemB.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblemB.o new file mode 100644 index 00000000000000..9c75cb83225246 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/QProblemB.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/SubjectTo.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/SubjectTo.d new file mode 100644 index 00000000000000..c896d9a9faf58d --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/SubjectTo.d @@ -0,0 +1,12 @@ +lib_qp/SubjectTo.o: ../../../../phonelibs/qpoases/SRC/SubjectTo.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/SubjectTo.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/SubjectTo.o new file mode 100644 index 00000000000000..820c930ce31ec4 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/SubjectTo.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/Utils.d b/selfdrive/controls/lib/lateral_mpc/lib_qp/Utils.d new file mode 100644 index 00000000000000..58f35a065397a3 --- /dev/null +++ b/selfdrive/controls/lib/lateral_mpc/lib_qp/Utils.d @@ -0,0 +1,8 @@ +lib_qp/Utils.o: ../../../../phonelibs/qpoases/SRC/Utils.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp diff --git a/selfdrive/controls/lib/lateral_mpc/lib_qp/Utils.o b/selfdrive/controls/lib/lateral_mpc/lib_qp/Utils.o new file mode 100644 index 00000000000000..ef645ef188049f Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/lib_qp/Utils.o differ diff --git a/selfdrive/controls/lib/lateral_mpc/libmpc.so b/selfdrive/controls/lib/lateral_mpc/libmpc.so new file mode 100755 index 00000000000000..3fd13255020c98 Binary files /dev/null and b/selfdrive/controls/lib/lateral_mpc/libmpc.so differ diff --git a/selfdrive/controls/lib/lateral_mpc/libmpc_py.py b/selfdrive/controls/lib/lateral_mpc/libmpc_py.py index 5970dab9039709..3af46c304e7f18 100644 --- a/selfdrive/controls/lib/lateral_mpc/libmpc_py.py +++ b/selfdrive/controls/lib/lateral_mpc/libmpc_py.py @@ -4,7 +4,7 @@ from cffi import FFI mpc_dir = os.path.dirname(os.path.abspath(__file__)) -libmpc_fn = os.path.join(mpc_dir, "libcommampc.so") +libmpc_fn = os.path.join(mpc_dir, "libmpc.so") subprocess.check_call(["make", "-j4"], cwd=mpc_dir) ffi = FFI() @@ -18,6 +18,7 @@ double y[21]; double psi[21]; double delta[21]; + double rate[21]; double cost; } log_t; diff --git a/selfdrive/controls/lib/long_mpc.py b/selfdrive/controls/lib/long_mpc.py new file mode 100644 index 00000000000000..19fb706debb2d7 --- /dev/null +++ b/selfdrive/controls/lib/long_mpc.py @@ -0,0 +1,120 @@ +import numpy as np + +import selfdrive.messaging as messaging +from selfdrive.swaglog import cloudlog +from common.realtime import sec_since_boot +from selfdrive.controls.lib.radar_helpers import _LEAD_ACCEL_TAU +from selfdrive.controls.lib.longitudinal_mpc import libmpc_py +from selfdrive.controls.lib.drive_helpers import MPC_COST_LONG + + +class LongitudinalMpc(object): + def __init__(self, mpc_id, live_longitudinal_mpc): + self.live_longitudinal_mpc = live_longitudinal_mpc + self.mpc_id = mpc_id + + self.setup_mpc() + self.v_mpc = 0.0 + self.v_mpc_future = 0.0 + self.a_mpc = 0.0 + self.v_cruise = 0.0 + self.prev_lead_status = False + self.prev_lead_x = 0.0 + self.new_lead = False + + self.last_cloudlog_t = 0.0 + + def send_mpc_solution(self, qp_iterations, calculation_time): + qp_iterations = max(0, qp_iterations) + dat = messaging.new_message() + dat.init('liveLongitudinalMpc') + dat.liveLongitudinalMpc.xEgo = list(self.mpc_solution[0].x_ego) + dat.liveLongitudinalMpc.vEgo = list(self.mpc_solution[0].v_ego) + dat.liveLongitudinalMpc.aEgo = list(self.mpc_solution[0].a_ego) + dat.liveLongitudinalMpc.xLead = list(self.mpc_solution[0].x_l) + dat.liveLongitudinalMpc.vLead = list(self.mpc_solution[0].v_l) + dat.liveLongitudinalMpc.cost = self.mpc_solution[0].cost + dat.liveLongitudinalMpc.aLeadTau = self.a_lead_tau + dat.liveLongitudinalMpc.qpIterations = qp_iterations + dat.liveLongitudinalMpc.mpcId = self.mpc_id + dat.liveLongitudinalMpc.calculationTime = calculation_time + self.live_longitudinal_mpc.send(dat.to_bytes()) + + def setup_mpc(self): + ffi, self.libmpc = libmpc_py.get_libmpc(self.mpc_id) + self.libmpc.init(MPC_COST_LONG.TTC, MPC_COST_LONG.DISTANCE, + MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK) + + self.mpc_solution = ffi.new("log_t *") + self.cur_state = ffi.new("state_t *") + self.cur_state[0].v_ego = 0 + self.cur_state[0].a_ego = 0 + self.a_lead_tau = _LEAD_ACCEL_TAU + + def set_cur_state(self, v, a): + self.cur_state[0].v_ego = v + self.cur_state[0].a_ego = a + + def update(self, CS, lead, v_cruise_setpoint): + v_ego = CS.carState.vEgo + + # Setup current mpc state + self.cur_state[0].x_ego = 0.0 + + if lead is not None and lead.status: + x_lead = lead.dRel + v_lead = max(0.0, lead.vLead) + a_lead = lead.aLeadK + + if (v_lead < 0.1 or -a_lead / 2.0 > v_lead): + v_lead = 0.0 + a_lead = 0.0 + + self.a_lead_tau = lead.aLeadTau + self.new_lead = False + if not self.prev_lead_status or abs(x_lead - self.prev_lead_x) > 2.5: + self.libmpc.init_with_simulation(self.v_mpc, x_lead, v_lead, a_lead, self.a_lead_tau) + self.new_lead = True + + self.prev_lead_status = True + self.prev_lead_x = x_lead + self.cur_state[0].x_l = x_lead + self.cur_state[0].v_l = v_lead + else: + self.prev_lead_status = False + # Fake a fast lead car, so mpc keeps running + self.cur_state[0].x_l = 50.0 + self.cur_state[0].v_l = v_ego + 10.0 + a_lead = 0.0 + self.a_lead_tau = _LEAD_ACCEL_TAU + + # Calculate mpc + t = sec_since_boot() + n_its = self.libmpc.run_mpc(self.cur_state, self.mpc_solution, self.a_lead_tau, a_lead) + duration = int((sec_since_boot() - t) * 1e9) + self.send_mpc_solution(n_its, duration) + + # Get solution. MPC timestep is 0.2 s, so interpolation to 0.05 s is needed + self.v_mpc = self.mpc_solution[0].v_ego[1] + self.a_mpc = self.mpc_solution[0].a_ego[1] + self.v_mpc_future = self.mpc_solution[0].v_ego[10] + + # Reset if NaN or goes through lead car + dls = np.array(list(self.mpc_solution[0].x_l)) - np.array(list(self.mpc_solution[0].x_ego)) + crashing = min(dls) < -50.0 + nans = np.any(np.isnan(list(self.mpc_solution[0].v_ego))) + backwards = min(list(self.mpc_solution[0].v_ego)) < -0.01 + + if ((backwards or crashing) and self.prev_lead_status) or nans: + if t > self.last_cloudlog_t + 5.0: + self.last_cloudlog_t = t + cloudlog.warning("Longitudinal mpc %d reset - backwards: %s crashing: %s nan: %s" % ( + self.mpc_id, backwards, crashing, nans)) + + self.libmpc.init(MPC_COST_LONG.TTC, MPC_COST_LONG.DISTANCE, + MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK) + self.cur_state[0].v_ego = v_ego + self.cur_state[0].a_ego = 0.0 + self.v_mpc = v_ego + self.a_mpc = CS.carState.aEgo + self.prev_lead_status = False diff --git a/selfdrive/controls/lib/longcontrol.py b/selfdrive/controls/lib/longcontrol.py index d6a7cc76900d8a..da324a39a10759 100644 --- a/selfdrive/controls/lib/longcontrol.py +++ b/selfdrive/controls/lib/longcontrol.py @@ -1,26 +1,28 @@ +from cereal import log from common.numpy_fast import clip, interp from selfdrive.controls.lib.pid import PIController +LongCtrlState = log.Live100Data.LongControlState + STOPPING_EGO_SPEED = 0.5 -MIN_CAN_SPEED = 0.3 #TODO: parametrize this in car interface +MIN_CAN_SPEED = 0.3 # TODO: parametrize this in car interface STOPPING_TARGET_SPEED = MIN_CAN_SPEED + 0.01 STARTING_TARGET_SPEED = 0.5 BRAKE_THRESHOLD_TO_PID = 0.2 +STOPPING_BRAKE_RATE = 0.2 # brake_travel/s while trying to stop +STARTING_BRAKE_RATE = 0.8 # brake_travel/s while releasing on restart +BRAKE_STOPPING_TARGET = 0.5 # apply at least this amount of brake to maintain the vehicle stationary -class LongCtrlState: - #*** this function handles the long control state transitions - # long_control_state labels (see capnp enum): - off = 'off' # Off - pid = 'pid' # moving and tracking targets, with PID control running - stopping = 'stopping' # stopping and changing controls to almost open loop as PID does not fit well at such a low speed - starting = 'starting' # starting and releasing brakes in open loop before giving back to PID +_MAX_SPEED_ERROR_BP = [0., 30.] # speed breakpoints +_MAX_SPEED_ERROR_V = [1.5, .8] # max positive v_pid error VS actual speed; this avoids controls windup due to slow pedal resp +RATE = 100.0 def long_control_state_trans(active, long_control_state, v_ego, v_target, v_pid, output_gb, brake_pressed, cruise_standstill): - + """Update longitudinal control state machine""" stopping_condition = (v_ego < 2.0 and cruise_standstill) or \ (v_ego < STOPPING_EGO_SPEED and \ ((v_pid < STOPPING_TARGET_SPEED and v_target < STOPPING_TARGET_SPEED) or @@ -53,74 +55,71 @@ def long_control_state_trans(active, long_control_state, v_ego, v_target, v_pid, return long_control_state -stopping_brake_rate = 0.2 # brake_travel/s while trying to stop -starting_brake_rate = 0.8 # brake_travel/s while releasing on restart -brake_stopping_target = 0.5 # apply at least this amount of brake to maintain the vehicle stationary - -_MAX_SPEED_ERROR_BP = [0., 30.] # speed breakpoints -_MAX_SPEED_ERROR_V = [1.5, .8] # max positive v_pid error VS actual speed; this avoids controls windup due to slow pedal resp - - class LongControl(object): def __init__(self, CP, compute_gb): self.long_control_state = LongCtrlState.off # initialized to off self.pid = PIController((CP.longitudinalKpBP, CP.longitudinalKpV), (CP.longitudinalKiBP, CP.longitudinalKiV), - rate=100.0, + rate=RATE, sat_limit=0.8, convert=compute_gb) self.v_pid = 0.0 self.last_output_gb = 0.0 def reset(self, v_pid): + """Reset PID controller and change setpoint""" self.pid.reset() self.v_pid = v_pid - def update(self, active, v_ego, brake_pressed, standstill, cruise_standstill, v_cruise, v_target, v_target_future, a_target, CP, lead_1): - # actuation limits + def update(self, active, v_ego, brake_pressed, standstill, cruise_standstill, v_cruise, v_target, v_target_future, a_target, CP): + """Update longitudinal control. This updates the state machine and runs a PID loop""" + # Actuation limits gas_max = interp(v_ego, CP.gasMaxBP, CP.gasMaxV) brake_max = interp(v_ego, CP.brakeMaxBP, CP.brakeMaxV) + # Update state machine output_gb = self.last_output_gb - rate = 100.0 self.long_control_state = long_control_state_trans(active, self.long_control_state, v_ego, v_target_future, self.v_pid, output_gb, brake_pressed, cruise_standstill) v_ego_pid = max(v_ego, MIN_CAN_SPEED) # Without this we get jumps, CAN bus reports 0 when speed < 0.3 - # *** long control behavior based on state if self.long_control_state == LongCtrlState.off: - self.v_pid = v_ego_pid # do nothing - output_gb = 0. + self.v_pid = v_ego_pid self.pid.reset() + output_gb = 0. # tracking objects and driving elif self.long_control_state == LongCtrlState.pid: - prevent_overshoot = not CP.stoppingControl and v_ego < 1.5 and v_target_future < 0.7 - self.v_pid = v_target self.pid.pos_limit = gas_max self.pid.neg_limit = - brake_max + + # Toyota starts braking more when it thinks you want to stop + # Freeze the integrator so we don't accelerate to compensate, and don't allow positive acceleration + prevent_overshoot = not CP.stoppingControl and v_ego < 1.5 and v_target_future < 0.7 deadzone = interp(v_ego_pid, CP.longPidDeadzoneBP, CP.longPidDeadzoneV) + output_gb = self.pid.update(self.v_pid, v_ego_pid, speed=v_ego_pid, deadzone=deadzone, feedforward=a_target, freeze_integrator=prevent_overshoot) + if prevent_overshoot: output_gb = min(output_gb, 0.0) - # intention is to stop, switch to a different brake control until we stop + # Intention is to stop, switch to a different brake control until we stop elif self.long_control_state == LongCtrlState.stopping: - # TODO: use the standstill bit from CAN to detect movements, usually more accurate than looking at v_ego - if not standstill or output_gb > -brake_stopping_target: - output_gb -= stopping_brake_rate / rate + # Keep applying brakes until the car is stopped + if not standstill or output_gb > -BRAKE_STOPPING_TARGET: + output_gb -= STOPPING_BRAKE_RATE / RATE output_gb = clip(output_gb, -brake_max, gas_max) self.v_pid = v_ego self.pid.reset() - # intention is to move again, release brake fast before handling control to PID + # Intention is to move again, release brake fast before handing control to PID elif self.long_control_state == LongCtrlState.starting: if output_gb < -0.2: - output_gb += starting_brake_rate / rate + output_gb += STARTING_BRAKE_RATE / RATE self.v_pid = v_ego self.pid.reset() diff --git a/selfdrive/controls/lib/longitudinal_mpc/Makefile b/selfdrive/controls/lib/longitudinal_mpc/Makefile index 409715cf17e9d6..17f78eada990df 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/Makefile +++ b/selfdrive/controls/lib/longitudinal_mpc/Makefile @@ -3,6 +3,7 @@ CXX = clang++ PHONELIBS = ../../../../phonelibs +UNAME_S := $(shell uname -s) UNAME_M := $(shell uname -m) CFLAGS = -O3 -fPIC -I. @@ -12,67 +13,61 @@ QPOASES_FLAGS = -I$(PHONELIBS)/qpoases -I$(PHONELIBS)/qpoases/INCLUDE -I$(PHONEL ACADO_FLAGS = -I$(PHONELIBS)/acado/include -I$(PHONELIBS)/acado/include/acado -ifeq ($(UNAME_M),aarch64) -ACADO_LIBS := -L $(PHONELIBS)/acado/aarch64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a +ifeq ($(UNAME_S),Darwin) + ACADO_LIBS := -lacado_toolkit_s +else ifeq ($(UNAME_M),aarch64) + ACADO_LIBS := -L $(PHONELIBS)/acado/aarch64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a else -ACADO_LIBS := -L $(PHONELIBS)/acado/x64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a + ACADO_LIBS := -L $(PHONELIBS)/acado/x64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a endif OBJS = \ - qp/Bounds.o \ - qp/Constraints.o \ - qp/CyclingManager.o \ - qp/Indexlist.o \ - qp/MessageHandling.o \ - qp/QProblem.o \ - qp/QProblemB.o \ - qp/SubjectTo.o \ - qp/Utils.o \ - qp/EXTRAS/SolutionAnalysis.o \ - mpc_export/acado_qpoases_interface.o \ - mpc_export/acado_integrator.o \ - mpc_export/acado_solver.o \ - mpc_export/acado_auxiliary_functions.o \ - mpc.o + lib_qp/Bounds.o \ + lib_qp/Constraints.o \ + lib_qp/CyclingManager.o \ + lib_qp/Indexlist.o \ + lib_qp/MessageHandling.o \ + lib_qp/QProblem.o \ + lib_qp/QProblemB.o \ + lib_qp/SubjectTo.o \ + lib_qp/Utils.o \ + lib_qp/EXTRAS/SolutionAnalysis.o \ + lib_mpc_export/acado_qpoases_interface.o \ + lib_mpc_export/acado_integrator.o \ + lib_mpc_export/acado_solver.o \ + lib_mpc_export/acado_auxiliary_functions.o \ + longitudinal_mpc.o DEPS := $(OBJS:.o=.d) .PHONY: all -all: libcommampc1.so libcommampc2.so +all: libmpc1.so libmpc2.so -libcommampc1.so: $(OBJS) +libmpc1.so: $(OBJS) $(CXX) -shared -o '$@' $^ -lm -libcommampc2.so: libcommampc1.so - cp libcommampc1.so libcommampc2.so +libmpc2.so: libmpc1.so + cp libmpc1.so libmpc2.so -qp/%.o: $(PHONELIBS)/qpoases/SRC/%.cpp +lib_qp/%.o: $(PHONELIBS)/qpoases/SRC/%.cpp @echo "[ CXX ] $@" - mkdir -p qp + mkdir -p lib_qp/EXTRAS $(CXX) $(CXXFLAGS) -MMD \ - -I mpc_export/ \ - $(QPOASES_FLAGS) \ - -c -o '$@' '$<' - -qp/EXTRAS/%.o: $(PHONELIBS)/qpoases/SRC/EXTRAS/%.cpp - @echo "[ CXX ] $@" - mkdir -p qp/EXTRAS - $(CXX) $(CXXFLAGS) -MMD \ - -I mpc_export/ \ + -I lib_mpc_export/ \ $(QPOASES_FLAGS) \ -c -o '$@' '$<' %.o: %.cpp @echo "[ CXX ] $@" $(CXX) $(CXXFLAGS) -MMD \ - -I mpc_export/ \ + -I lib_mpc_export/ \ $(QPOASES_FLAGS) \ -c -o '$@' '$<' %.o: %.c @echo "[ CC ] $@" $(CC) $(CFLAGS) -MMD \ - -I mpc_export/ \ + -I lib_mpc_export/ \ $(QPOASES_FLAGS) \ -c -o '$@' '$<' @@ -89,6 +84,6 @@ generate: generator .PHONY: clean clean: - rm -f libcommampc1.so libcommampc2.so generator $(OBJS) $(DEPS) + rm -f *.so generator $(OBJS) $(DEPS) -include $(DEPS) diff --git a/selfdrive/controls/lib/longitudinal_mpc/generator.cpp b/selfdrive/controls/lib/longitudinal_mpc/generator.cpp index 30b0bd858a82d0..1f0e28d0057081 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/generator.cpp +++ b/selfdrive/controls/lib/longitudinal_mpc/generator.cpp @@ -18,9 +18,7 @@ int main( ) DifferentialEquation f; DifferentialState x_ego, v_ego, a_ego; - DifferentialState x_l, v_l, a_l; - - OnlineData lambda; + OnlineData x_l, v_l; Control j_ego; @@ -32,13 +30,9 @@ int main( ) f << dot(v_ego) == a_ego; f << dot(a_ego) == j_ego; - f << dot(x_l) == v_l; - f << dot(v_l) == a_l; - f << dot(a_l) == -lambda * a_l; - // Running cost Function h; - h << exp(0.3 * NORM_RW_ERROR(v_ego, v_l, d_l)) - exp(0.3 * NORM_RW_ERROR(v_ego, v_l, desired)); + h << exp(0.3 * NORM_RW_ERROR(v_ego, v_l, d_l)); h << (d_l - desired) / (0.05 * v_ego + 0.5); h << a_ego * (0.1 * v_ego + 1.0); h << j_ego * (0.1 * v_ego + 1.0); @@ -48,7 +42,7 @@ int main( ) // Terminal cost Function hN; - hN << exp(0.3 * NORM_RW_ERROR(v_ego, v_l, d_l)) - exp(0.3 * NORM_RW_ERROR(v_ego, v_l, desired)); + hN << exp(0.3 * NORM_RW_ERROR(v_ego, v_l, d_l)); hN << (d_l - desired) / (0.05 * v_ego + 0.5); hN << a_ego * (0.1 * v_ego + 1.0); @@ -76,7 +70,7 @@ int main( ) ocp.minimizeLSQEndTerm(QN, hN); ocp.subjectTo( 0.0 <= v_ego); - ocp.setNOD(1); + ocp.setNOD(2); OCPexport mpc(ocp); mpc.set( HESSIAN_APPROXIMATION, GAUSS_NEWTON ); @@ -94,7 +88,7 @@ int main( ) mpc.set( GENERATE_MATLAB_INTERFACE, NO ); mpc.set( GENERATE_SIMULINK_INTERFACE, NO ); - if (mpc.exportCode( "mpc_export" ) != SUCCESSFUL_RETURN) + if (mpc.exportCode( "lib_mpc_export" ) != SUCCESSFUL_RETURN) exit( EXIT_FAILURE ); mpc.printDimensionsQP( ); diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_auxiliary_functions.c b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.c similarity index 100% rename from selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_auxiliary_functions.c rename to selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.c diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.d b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.d new file mode 100644 index 00000000000000..50c6a60d1fb846 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.d @@ -0,0 +1,5 @@ +lib_mpc_export/acado_auxiliary_functions.o: \ + lib_mpc_export/acado_auxiliary_functions.c \ + lib_mpc_export/acado_auxiliary_functions.h \ + lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_auxiliary_functions.h b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.h similarity index 100% rename from selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_auxiliary_functions.h rename to selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.h diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.o b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.o new file mode 100644 index 00000000000000..5466ca143bdeea Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_common.h b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_common.h similarity index 78% rename from selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_common.h rename to selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_common.h index 1f1c21e6e017fd..bf64887f19c092 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_common.h +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_common.h @@ -64,13 +64,13 @@ extern "C" /** Number of control/estimation intervals. */ #define ACADO_N 20 /** Number of online data values. */ -#define ACADO_NOD 1 +#define ACADO_NOD 2 /** Number of path constraints. */ #define ACADO_NPAC 0 /** Number of control variables. */ #define ACADO_NU 1 /** Number of differential variables. */ -#define ACADO_NX 6 +#define ACADO_NX 3 /** Number of algebraic variables. */ #define ACADO_NXA 0 /** Number of differential derivative variables. */ @@ -80,7 +80,7 @@ extern "C" /** Number of references/measurements on the last (N + 1)st node. */ #define ACADO_NYN 3 /** Total number of QP optimization variables. */ -#define ACADO_QP_NV 26 +#define ACADO_QP_NV 23 /** Number of Runge-Kutta stages per integration step. */ #define ACADO_RK_NSTAGES 4 /** Providing interface for arrival cost. */ @@ -102,11 +102,11 @@ extern "C" typedef struct ACADOvariables_ { int dummy; -/** Matrix of size: 21 x 6 (row major format) +/** Matrix of size: 21 x 3 (row major format) * * Matrix containing 21 differential variable vectors. */ -real_t x[ 126 ]; +real_t x[ 63 ]; /** Column vector of size: 20 * @@ -114,11 +114,11 @@ real_t x[ 126 ]; */ real_t u[ 20 ]; -/** Column vector of size: 21 +/** Matrix of size: 21 x 2 (row major format) * * Matrix containing 21 online data vectors. */ -real_t od[ 21 ]; +real_t od[ 42 ]; /** Column vector of size: 80 * @@ -138,11 +138,11 @@ real_t W[ 320 ]; /** Matrix of size: 3 x 3 (row major format) */ real_t WN[ 9 ]; -/** Column vector of size: 6 +/** Column vector of size: 3 * * Current state feedback vector. */ -real_t x0[ 6 ]; +real_t x0[ 3 ]; } ACADOvariables; @@ -157,17 +157,17 @@ typedef struct ACADOworkspace_ { real_t rk_ttt; -/** Row vector of size: 50 */ -real_t rk_xxx[ 50 ]; +/** Row vector of size: 18 */ +real_t rk_xxx[ 18 ]; -/** Matrix of size: 4 x 48 (row major format) */ -real_t rk_kkk[ 192 ]; +/** Matrix of size: 4 x 15 (row major format) */ +real_t rk_kkk[ 60 ]; -/** Row vector of size: 50 */ -real_t state[ 50 ]; +/** Row vector of size: 18 */ +real_t state[ 18 ]; -/** Column vector of size: 120 */ -real_t d[ 120 ]; +/** Column vector of size: 60 */ +real_t d[ 60 ]; /** Column vector of size: 80 */ real_t Dy[ 80 ]; @@ -175,26 +175,26 @@ real_t Dy[ 80 ]; /** Column vector of size: 3 */ real_t DyN[ 3 ]; -/** Matrix of size: 120 x 6 (row major format) */ -real_t evGx[ 720 ]; +/** Matrix of size: 60 x 3 (row major format) */ +real_t evGx[ 180 ]; -/** Column vector of size: 120 */ -real_t evGu[ 120 ]; +/** Column vector of size: 60 */ +real_t evGu[ 60 ]; -/** Column vector of size: 30 */ -real_t objAuxVar[ 30 ]; +/** Column vector of size: 15 */ +real_t objAuxVar[ 15 ]; -/** Row vector of size: 8 */ -real_t objValueIn[ 8 ]; +/** Row vector of size: 6 */ +real_t objValueIn[ 6 ]; -/** Row vector of size: 32 */ -real_t objValueOut[ 32 ]; +/** Row vector of size: 20 */ +real_t objValueOut[ 20 ]; -/** Matrix of size: 120 x 6 (row major format) */ -real_t Q1[ 720 ]; +/** Matrix of size: 60 x 3 (row major format) */ +real_t Q1[ 180 ]; -/** Matrix of size: 120 x 4 (row major format) */ -real_t Q2[ 480 ]; +/** Matrix of size: 60 x 4 (row major format) */ +real_t Q2[ 240 ]; /** Column vector of size: 20 */ real_t R1[ 20 ]; @@ -202,53 +202,53 @@ real_t R1[ 20 ]; /** Matrix of size: 20 x 4 (row major format) */ real_t R2[ 80 ]; -/** Column vector of size: 120 */ -real_t S1[ 120 ]; +/** Column vector of size: 60 */ +real_t S1[ 60 ]; -/** Matrix of size: 6 x 6 (row major format) */ -real_t QN1[ 36 ]; +/** Matrix of size: 3 x 3 (row major format) */ +real_t QN1[ 9 ]; -/** Matrix of size: 6 x 3 (row major format) */ -real_t QN2[ 18 ]; +/** Matrix of size: 3 x 3 (row major format) */ +real_t QN2[ 9 ]; -/** Column vector of size: 6 */ -real_t Dx0[ 6 ]; +/** Column vector of size: 3 */ +real_t Dx0[ 3 ]; -/** Matrix of size: 6 x 6 (row major format) */ -real_t T[ 36 ]; +/** Matrix of size: 3 x 3 (row major format) */ +real_t T[ 9 ]; -/** Column vector of size: 1260 */ -real_t E[ 1260 ]; +/** Column vector of size: 630 */ +real_t E[ 630 ]; -/** Column vector of size: 1260 */ -real_t QE[ 1260 ]; +/** Column vector of size: 630 */ +real_t QE[ 630 ]; -/** Matrix of size: 120 x 6 (row major format) */ -real_t QGx[ 720 ]; +/** Matrix of size: 60 x 3 (row major format) */ +real_t QGx[ 180 ]; -/** Column vector of size: 120 */ -real_t Qd[ 120 ]; +/** Column vector of size: 60 */ +real_t Qd[ 60 ]; -/** Column vector of size: 126 */ -real_t QDy[ 126 ]; +/** Column vector of size: 63 */ +real_t QDy[ 63 ]; -/** Matrix of size: 20 x 6 (row major format) */ -real_t H10[ 120 ]; +/** Matrix of size: 20 x 3 (row major format) */ +real_t H10[ 60 ]; -/** Matrix of size: 26 x 26 (row major format) */ -real_t H[ 676 ]; +/** Matrix of size: 23 x 23 (row major format) */ +real_t H[ 529 ]; -/** Matrix of size: 20 x 26 (row major format) */ -real_t A[ 520 ]; +/** Matrix of size: 20 x 23 (row major format) */ +real_t A[ 460 ]; -/** Column vector of size: 26 */ -real_t g[ 26 ]; +/** Column vector of size: 23 */ +real_t g[ 23 ]; -/** Column vector of size: 26 */ -real_t lb[ 26 ]; +/** Column vector of size: 23 */ +real_t lb[ 23 ]; -/** Column vector of size: 26 */ -real_t ub[ 26 ]; +/** Column vector of size: 23 */ +real_t ub[ 23 ]; /** Column vector of size: 20 */ real_t lbA[ 20 ]; @@ -256,11 +256,11 @@ real_t lbA[ 20 ]; /** Column vector of size: 20 */ real_t ubA[ 20 ]; -/** Column vector of size: 26 */ -real_t x[ 26 ]; +/** Column vector of size: 23 */ +real_t x[ 23 ]; -/** Column vector of size: 46 */ -real_t y[ 46 ]; +/** Column vector of size: 43 */ +real_t y[ 43 ]; } ACADOworkspace; diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.c b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.c new file mode 100644 index 00000000000000..a0bac9681c5293 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.c @@ -0,0 +1,159 @@ +/* + * This file was auto-generated using the ACADO Toolkit. + * + * While ACADO Toolkit is free software released under the terms of + * the GNU Lesser General Public License (LGPL), the generated code + * as such remains the property of the user who used ACADO Toolkit + * to generate this code. In particular, user dependent data of the code + * do not inherit the GNU LGPL license. On the other hand, parts of the + * generated code that are a direct copy of source code from the + * ACADO Toolkit or the software tools it is based on, remain, as derived + * work, automatically covered by the LGPL license. + * + * ACADO Toolkit 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. + * + */ + + +#include "acado_common.h" + + +void acado_rhs_forw(const real_t* in, real_t* out) +{ +const real_t* xd = in; +const real_t* u = in + 15; + +/* Compute outputs: */ +out[0] = xd[1]; +out[1] = xd[2]; +out[2] = u[0]; +out[3] = xd[6]; +out[4] = xd[7]; +out[5] = xd[8]; +out[6] = xd[9]; +out[7] = xd[10]; +out[8] = xd[11]; +out[9] = (real_t)(0.0000000000000000e+00); +out[10] = (real_t)(0.0000000000000000e+00); +out[11] = (real_t)(0.0000000000000000e+00); +out[12] = xd[13]; +out[13] = xd[14]; +out[14] = (real_t)(1.0000000000000000e+00); +} + +/* Fixed step size:0.2 */ +int acado_integrate( real_t* const rk_eta, int resetIntegrator, int rk_index ) +{ +int error; + +int run1; +int numSteps[20] = {1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}; +int numInts = numSteps[rk_index]; +acadoWorkspace.rk_ttt = 0.0000000000000000e+00; +rk_eta[3] = 1.0000000000000000e+00; +rk_eta[4] = 0.0000000000000000e+00; +rk_eta[5] = 0.0000000000000000e+00; +rk_eta[6] = 0.0000000000000000e+00; +rk_eta[7] = 1.0000000000000000e+00; +rk_eta[8] = 0.0000000000000000e+00; +rk_eta[9] = 0.0000000000000000e+00; +rk_eta[10] = 0.0000000000000000e+00; +rk_eta[11] = 1.0000000000000000e+00; +rk_eta[12] = 0.0000000000000000e+00; +rk_eta[13] = 0.0000000000000000e+00; +rk_eta[14] = 0.0000000000000000e+00; +acadoWorkspace.rk_xxx[15] = rk_eta[15]; +acadoWorkspace.rk_xxx[16] = rk_eta[16]; +acadoWorkspace.rk_xxx[17] = rk_eta[17]; + +for (run1 = 0; run1 < 1; ++run1) +{ +for(run1 = 0; run1 < numInts; run1++ ) { +acadoWorkspace.rk_xxx[0] = + rk_eta[0]; +acadoWorkspace.rk_xxx[1] = + rk_eta[1]; +acadoWorkspace.rk_xxx[2] = + rk_eta[2]; +acadoWorkspace.rk_xxx[3] = + rk_eta[3]; +acadoWorkspace.rk_xxx[4] = + rk_eta[4]; +acadoWorkspace.rk_xxx[5] = + rk_eta[5]; +acadoWorkspace.rk_xxx[6] = + rk_eta[6]; +acadoWorkspace.rk_xxx[7] = + rk_eta[7]; +acadoWorkspace.rk_xxx[8] = + rk_eta[8]; +acadoWorkspace.rk_xxx[9] = + rk_eta[9]; +acadoWorkspace.rk_xxx[10] = + rk_eta[10]; +acadoWorkspace.rk_xxx[11] = + rk_eta[11]; +acadoWorkspace.rk_xxx[12] = + rk_eta[12]; +acadoWorkspace.rk_xxx[13] = + rk_eta[13]; +acadoWorkspace.rk_xxx[14] = + rk_eta[14]; +acado_rhs_forw( acadoWorkspace.rk_xxx, acadoWorkspace.rk_kkk ); +acadoWorkspace.rk_xxx[0] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[0] + rk_eta[0]; +acadoWorkspace.rk_xxx[1] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[1] + rk_eta[1]; +acadoWorkspace.rk_xxx[2] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[2] + rk_eta[2]; +acadoWorkspace.rk_xxx[3] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[3] + rk_eta[3]; +acadoWorkspace.rk_xxx[4] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[4] + rk_eta[4]; +acadoWorkspace.rk_xxx[5] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[5] + rk_eta[5]; +acadoWorkspace.rk_xxx[6] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[6] + rk_eta[6]; +acadoWorkspace.rk_xxx[7] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[7] + rk_eta[7]; +acadoWorkspace.rk_xxx[8] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[8] + rk_eta[8]; +acadoWorkspace.rk_xxx[9] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[9] + rk_eta[9]; +acadoWorkspace.rk_xxx[10] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[10] + rk_eta[10]; +acadoWorkspace.rk_xxx[11] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[11] + rk_eta[11]; +acadoWorkspace.rk_xxx[12] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[12] + rk_eta[12]; +acadoWorkspace.rk_xxx[13] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[13] + rk_eta[13]; +acadoWorkspace.rk_xxx[14] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[14] + rk_eta[14]; +acado_rhs_forw( acadoWorkspace.rk_xxx, &(acadoWorkspace.rk_kkk[ 15 ]) ); +acadoWorkspace.rk_xxx[0] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[15] + rk_eta[0]; +acadoWorkspace.rk_xxx[1] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[16] + rk_eta[1]; +acadoWorkspace.rk_xxx[2] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[17] + rk_eta[2]; +acadoWorkspace.rk_xxx[3] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[18] + rk_eta[3]; +acadoWorkspace.rk_xxx[4] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[19] + rk_eta[4]; +acadoWorkspace.rk_xxx[5] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[20] + rk_eta[5]; +acadoWorkspace.rk_xxx[6] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[21] + rk_eta[6]; +acadoWorkspace.rk_xxx[7] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[22] + rk_eta[7]; +acadoWorkspace.rk_xxx[8] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[23] + rk_eta[8]; +acadoWorkspace.rk_xxx[9] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[24] + rk_eta[9]; +acadoWorkspace.rk_xxx[10] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[25] + rk_eta[10]; +acadoWorkspace.rk_xxx[11] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[26] + rk_eta[11]; +acadoWorkspace.rk_xxx[12] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[27] + rk_eta[12]; +acadoWorkspace.rk_xxx[13] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[28] + rk_eta[13]; +acadoWorkspace.rk_xxx[14] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[29] + rk_eta[14]; +acado_rhs_forw( acadoWorkspace.rk_xxx, &(acadoWorkspace.rk_kkk[ 30 ]) ); +acadoWorkspace.rk_xxx[0] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[30] + rk_eta[0]; +acadoWorkspace.rk_xxx[1] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[31] + rk_eta[1]; +acadoWorkspace.rk_xxx[2] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[32] + rk_eta[2]; +acadoWorkspace.rk_xxx[3] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[33] + rk_eta[3]; +acadoWorkspace.rk_xxx[4] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[34] + rk_eta[4]; +acadoWorkspace.rk_xxx[5] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[35] + rk_eta[5]; +acadoWorkspace.rk_xxx[6] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[36] + rk_eta[6]; +acadoWorkspace.rk_xxx[7] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[37] + rk_eta[7]; +acadoWorkspace.rk_xxx[8] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[38] + rk_eta[8]; +acadoWorkspace.rk_xxx[9] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[39] + rk_eta[9]; +acadoWorkspace.rk_xxx[10] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[40] + rk_eta[10]; +acadoWorkspace.rk_xxx[11] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[41] + rk_eta[11]; +acadoWorkspace.rk_xxx[12] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[42] + rk_eta[12]; +acadoWorkspace.rk_xxx[13] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[43] + rk_eta[13]; +acadoWorkspace.rk_xxx[14] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[44] + rk_eta[14]; +acado_rhs_forw( acadoWorkspace.rk_xxx, &(acadoWorkspace.rk_kkk[ 45 ]) ); +rk_eta[0] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[0] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[15] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[30] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[45]; +rk_eta[1] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[1] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[16] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[31] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[46]; +rk_eta[2] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[2] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[17] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[32] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[47]; +rk_eta[3] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[3] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[18] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[33] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[48]; +rk_eta[4] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[4] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[19] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[34] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[49]; +rk_eta[5] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[5] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[20] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[35] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[50]; +rk_eta[6] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[6] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[21] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[36] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[51]; +rk_eta[7] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[7] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[22] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[37] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[52]; +rk_eta[8] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[8] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[23] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[38] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[53]; +rk_eta[9] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[9] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[24] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[39] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[54]; +rk_eta[10] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[10] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[25] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[40] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[55]; +rk_eta[11] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[11] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[26] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[41] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[56]; +rk_eta[12] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[12] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[27] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[42] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[57]; +rk_eta[13] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[13] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[28] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[43] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[58]; +rk_eta[14] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[14] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[29] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[44] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[59]; +acadoWorkspace.rk_ttt += 1.0000000000000000e+00; +} +} +error = 0; +return error; +} + diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.d b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.d new file mode 100644 index 00000000000000..7c057e5ec0f3a9 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.d @@ -0,0 +1,3 @@ +lib_mpc_export/acado_integrator.o: lib_mpc_export/acado_integrator.c \ + lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.o b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.o new file mode 100644 index 00000000000000..2ee2d13004acdc Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_qpoases_interface.cpp b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.cpp similarity index 98% rename from selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_qpoases_interface.cpp rename to selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.cpp index a4d9f8cde2777f..36e675e03aa07c 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_qpoases_interface.cpp +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.cpp @@ -40,7 +40,7 @@ int acado_solve( void ) { acado_nWSR = QPOASES_NWSRMAX; - QProblem qp(26, 20); + QProblem qp(23, 20); returnValue retVal = qp.init(acadoWorkspace.H, acadoWorkspace.g, acadoWorkspace.A, acadoWorkspace.lb, acadoWorkspace.ub, acadoWorkspace.lbA, acadoWorkspace.ubA, acado_nWSR, acadoWorkspace.y); diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.d b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.d new file mode 100644 index 00000000000000..ba3c6ef1c831b7 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.d @@ -0,0 +1,24 @@ +lib_mpc_export/acado_qpoases_interface.o: \ + lib_mpc_export/acado_qpoases_interface.cpp \ + lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblem.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblemB.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblemB.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/Constraints.hpp \ + ../../../../phonelibs/qpoases/SRC/Constraints.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/CyclingManager.hpp \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblem.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_qpoases_interface.hpp b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.hpp similarity index 98% rename from selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_qpoases_interface.hpp rename to selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.hpp index 3b3c75aa111c72..8a58805f8e6d29 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_qpoases_interface.hpp +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.hpp @@ -37,7 +37,7 @@ */ /** Maximum number of optimization variables. */ -#define QPOASES_NVMAX 26 +#define QPOASES_NVMAX 23 /** Maximum number of constraints. */ #define QPOASES_NCMAX 20 /** Maximum number of working set recalculations. */ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.o b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.o new file mode 100644 index 00000000000000..21293576928754 Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.c b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.c new file mode 100644 index 00000000000000..e4bf392f98fb30 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.c @@ -0,0 +1,4785 @@ +/* + * This file was auto-generated using the ACADO Toolkit. + * + * While ACADO Toolkit is free software released under the terms of + * the GNU Lesser General Public License (LGPL), the generated code + * as such remains the property of the user who used ACADO Toolkit + * to generate this code. In particular, user dependent data of the code + * do not inherit the GNU LGPL license. On the other hand, parts of the + * generated code that are a direct copy of source code from the + * ACADO Toolkit or the software tools it is based on, remain, as derived + * work, automatically covered by the LGPL license. + * + * ACADO Toolkit 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. + * + */ + + +#include "acado_common.h" + + + + +/******************************************************************************/ +/* */ +/* ACADO code generation */ +/* */ +/******************************************************************************/ + + +int acado_modelSimulation( ) +{ +int ret; + +int lRun1; +ret = 0; +for (lRun1 = 0; lRun1 < 20; ++lRun1) +{ +acadoWorkspace.state[0] = acadoVariables.x[lRun1 * 3]; +acadoWorkspace.state[1] = acadoVariables.x[lRun1 * 3 + 1]; +acadoWorkspace.state[2] = acadoVariables.x[lRun1 * 3 + 2]; + +acadoWorkspace.state[15] = acadoVariables.u[lRun1]; +acadoWorkspace.state[16] = acadoVariables.od[lRun1 * 2]; +acadoWorkspace.state[17] = acadoVariables.od[lRun1 * 2 + 1]; + +ret = acado_integrate(acadoWorkspace.state, 1, lRun1); + +acadoWorkspace.d[lRun1 * 3] = acadoWorkspace.state[0] - acadoVariables.x[lRun1 * 3 + 3]; +acadoWorkspace.d[lRun1 * 3 + 1] = acadoWorkspace.state[1] - acadoVariables.x[lRun1 * 3 + 4]; +acadoWorkspace.d[lRun1 * 3 + 2] = acadoWorkspace.state[2] - acadoVariables.x[lRun1 * 3 + 5]; + +acadoWorkspace.evGx[lRun1 * 9] = acadoWorkspace.state[3]; +acadoWorkspace.evGx[lRun1 * 9 + 1] = acadoWorkspace.state[4]; +acadoWorkspace.evGx[lRun1 * 9 + 2] = acadoWorkspace.state[5]; +acadoWorkspace.evGx[lRun1 * 9 + 3] = acadoWorkspace.state[6]; +acadoWorkspace.evGx[lRun1 * 9 + 4] = acadoWorkspace.state[7]; +acadoWorkspace.evGx[lRun1 * 9 + 5] = acadoWorkspace.state[8]; +acadoWorkspace.evGx[lRun1 * 9 + 6] = acadoWorkspace.state[9]; +acadoWorkspace.evGx[lRun1 * 9 + 7] = acadoWorkspace.state[10]; +acadoWorkspace.evGx[lRun1 * 9 + 8] = acadoWorkspace.state[11]; + +acadoWorkspace.evGu[lRun1 * 3] = acadoWorkspace.state[12]; +acadoWorkspace.evGu[lRun1 * 3 + 1] = acadoWorkspace.state[13]; +acadoWorkspace.evGu[lRun1 * 3 + 2] = acadoWorkspace.state[14]; +} +return ret; +} + +void acado_evaluateLSQ(const real_t* in, real_t* out) +{ +const real_t* xd = in; +const real_t* u = in + 3; +const real_t* od = in + 4; +/* Vector of auxiliary variables; number of elements: 15. */ +real_t* a = acadoWorkspace.objAuxVar; + +/* Compute intermediate quantities: */ +a[0] = (sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); +a[1] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(od[0]-xd[0]))/(a[0]+(real_t)(1.0000000000000001e-01)))))); +a[2] = ((real_t)(1.0000000000000000e+00)/(a[0]+(real_t)(1.0000000000000001e-01))); +a[3] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(od[0]-xd[0]))/(a[0]+(real_t)(1.0000000000000001e-01)))))); +a[4] = (((real_t)(2.9999999999999999e-01)*(((real_t)(0.0000000000000000e+00)-((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00)))*a[2]))*a[3]); +a[5] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); +a[6] = (1.0/sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); +a[7] = (a[6]*(real_t)(5.0000000000000000e-01)); +a[8] = (a[2]*a[2]); +a[9] = (((real_t)(2.9999999999999999e-01)*(((((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[5]))*a[2])-((((((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(od[0]-xd[0]))*a[7])*a[8])))*a[3]); +a[10] = (real_t)(0.0000000000000000e+00); +a[11] = ((real_t)(1.0000000000000000e+00)/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); +a[12] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); +a[13] = (a[11]*a[11]); +a[14] = (real_t)(0.0000000000000000e+00); + +/* Compute outputs: */ +out[0] = a[1]; +out[1] = (((od[0]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))))/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); +out[2] = (xd[2]*(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00))); +out[3] = (u[0]*(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00))); +out[4] = a[4]; +out[5] = a[9]; +out[6] = a[10]; +out[7] = (((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00))*a[11]); +out[8] = ((((real_t)(0.0000000000000000e+00)-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[12])))*a[11])-((((od[0]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))))*(real_t)(5.0000000000000003e-02))*a[13])); +out[9] = (real_t)(0.0000000000000000e+00); +out[10] = (real_t)(0.0000000000000000e+00); +out[11] = (xd[2]*(real_t)(1.0000000000000001e-01)); +out[12] = (((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00)); +out[13] = (real_t)(0.0000000000000000e+00); +out[14] = (u[0]*(real_t)(1.0000000000000001e-01)); +out[15] = (real_t)(0.0000000000000000e+00); +out[16] = a[14]; +out[17] = (real_t)(0.0000000000000000e+00); +out[18] = (real_t)(0.0000000000000000e+00); +out[19] = (((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00)); +} + +void acado_evaluateLSQEndTerm(const real_t* in, real_t* out) +{ +const real_t* xd = in; +const real_t* od = in + 3; +/* Vector of auxiliary variables; number of elements: 14. */ +real_t* a = acadoWorkspace.objAuxVar; + +/* Compute intermediate quantities: */ +a[0] = (sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); +a[1] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(od[0]-xd[0]))/(a[0]+(real_t)(1.0000000000000001e-01)))))); +a[2] = ((real_t)(1.0000000000000000e+00)/(a[0]+(real_t)(1.0000000000000001e-01))); +a[3] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(od[0]-xd[0]))/(a[0]+(real_t)(1.0000000000000001e-01)))))); +a[4] = (((real_t)(2.9999999999999999e-01)*(((real_t)(0.0000000000000000e+00)-((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00)))*a[2]))*a[3]); +a[5] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); +a[6] = (1.0/sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); +a[7] = (a[6]*(real_t)(5.0000000000000000e-01)); +a[8] = (a[2]*a[2]); +a[9] = (((real_t)(2.9999999999999999e-01)*(((((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[5]))*a[2])-((((((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(od[0]-xd[0]))*a[7])*a[8])))*a[3]); +a[10] = (real_t)(0.0000000000000000e+00); +a[11] = ((real_t)(1.0000000000000000e+00)/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); +a[12] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); +a[13] = (a[11]*a[11]); + +/* Compute outputs: */ +out[0] = a[1]; +out[1] = (((od[0]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))))/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); +out[2] = (xd[2]*(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00))); +out[3] = a[4]; +out[4] = a[9]; +out[5] = a[10]; +out[6] = (((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00))*a[11]); +out[7] = ((((real_t)(0.0000000000000000e+00)-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[12])))*a[11])-((((od[0]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((od[1]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((od[1]*od[1])/(real_t)(1.9620000000000001e+01)))))*(real_t)(5.0000000000000003e-02))*a[13])); +out[8] = (real_t)(0.0000000000000000e+00); +out[9] = (real_t)(0.0000000000000000e+00); +out[10] = (xd[2]*(real_t)(1.0000000000000001e-01)); +out[11] = (((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00)); +} + +void acado_setObjQ1Q2( real_t* const tmpFx, real_t* const tmpObjS, real_t* const tmpQ1, real_t* const tmpQ2 ) +{ +tmpQ2[0] = + tmpFx[0]*tmpObjS[0] + tmpFx[3]*tmpObjS[4] + tmpFx[6]*tmpObjS[8] + tmpFx[9]*tmpObjS[12]; +tmpQ2[1] = + tmpFx[0]*tmpObjS[1] + tmpFx[3]*tmpObjS[5] + tmpFx[6]*tmpObjS[9] + tmpFx[9]*tmpObjS[13]; +tmpQ2[2] = + tmpFx[0]*tmpObjS[2] + tmpFx[3]*tmpObjS[6] + tmpFx[6]*tmpObjS[10] + tmpFx[9]*tmpObjS[14]; +tmpQ2[3] = + tmpFx[0]*tmpObjS[3] + tmpFx[3]*tmpObjS[7] + tmpFx[6]*tmpObjS[11] + tmpFx[9]*tmpObjS[15]; +tmpQ2[4] = + tmpFx[1]*tmpObjS[0] + tmpFx[4]*tmpObjS[4] + tmpFx[7]*tmpObjS[8] + tmpFx[10]*tmpObjS[12]; +tmpQ2[5] = + tmpFx[1]*tmpObjS[1] + tmpFx[4]*tmpObjS[5] + tmpFx[7]*tmpObjS[9] + tmpFx[10]*tmpObjS[13]; +tmpQ2[6] = + tmpFx[1]*tmpObjS[2] + tmpFx[4]*tmpObjS[6] + tmpFx[7]*tmpObjS[10] + tmpFx[10]*tmpObjS[14]; +tmpQ2[7] = + tmpFx[1]*tmpObjS[3] + tmpFx[4]*tmpObjS[7] + tmpFx[7]*tmpObjS[11] + tmpFx[10]*tmpObjS[15]; +tmpQ2[8] = + tmpFx[2]*tmpObjS[0] + tmpFx[5]*tmpObjS[4] + tmpFx[8]*tmpObjS[8] + tmpFx[11]*tmpObjS[12]; +tmpQ2[9] = + tmpFx[2]*tmpObjS[1] + tmpFx[5]*tmpObjS[5] + tmpFx[8]*tmpObjS[9] + tmpFx[11]*tmpObjS[13]; +tmpQ2[10] = + tmpFx[2]*tmpObjS[2] + tmpFx[5]*tmpObjS[6] + tmpFx[8]*tmpObjS[10] + tmpFx[11]*tmpObjS[14]; +tmpQ2[11] = + tmpFx[2]*tmpObjS[3] + tmpFx[5]*tmpObjS[7] + tmpFx[8]*tmpObjS[11] + tmpFx[11]*tmpObjS[15]; +tmpQ1[0] = + tmpQ2[0]*tmpFx[0] + tmpQ2[1]*tmpFx[3] + tmpQ2[2]*tmpFx[6] + tmpQ2[3]*tmpFx[9]; +tmpQ1[1] = + tmpQ2[0]*tmpFx[1] + tmpQ2[1]*tmpFx[4] + tmpQ2[2]*tmpFx[7] + tmpQ2[3]*tmpFx[10]; +tmpQ1[2] = + tmpQ2[0]*tmpFx[2] + tmpQ2[1]*tmpFx[5] + tmpQ2[2]*tmpFx[8] + tmpQ2[3]*tmpFx[11]; +tmpQ1[3] = + tmpQ2[4]*tmpFx[0] + tmpQ2[5]*tmpFx[3] + tmpQ2[6]*tmpFx[6] + tmpQ2[7]*tmpFx[9]; +tmpQ1[4] = + tmpQ2[4]*tmpFx[1] + tmpQ2[5]*tmpFx[4] + tmpQ2[6]*tmpFx[7] + tmpQ2[7]*tmpFx[10]; +tmpQ1[5] = + tmpQ2[4]*tmpFx[2] + tmpQ2[5]*tmpFx[5] + tmpQ2[6]*tmpFx[8] + tmpQ2[7]*tmpFx[11]; +tmpQ1[6] = + tmpQ2[8]*tmpFx[0] + tmpQ2[9]*tmpFx[3] + tmpQ2[10]*tmpFx[6] + tmpQ2[11]*tmpFx[9]; +tmpQ1[7] = + tmpQ2[8]*tmpFx[1] + tmpQ2[9]*tmpFx[4] + tmpQ2[10]*tmpFx[7] + tmpQ2[11]*tmpFx[10]; +tmpQ1[8] = + tmpQ2[8]*tmpFx[2] + tmpQ2[9]*tmpFx[5] + tmpQ2[10]*tmpFx[8] + tmpQ2[11]*tmpFx[11]; +} + +void acado_setObjR1R2( real_t* const tmpFu, real_t* const tmpObjS, real_t* const tmpR1, real_t* const tmpR2 ) +{ +tmpR2[0] = + tmpFu[0]*tmpObjS[0] + tmpFu[1]*tmpObjS[4] + tmpFu[2]*tmpObjS[8] + tmpFu[3]*tmpObjS[12]; +tmpR2[1] = + tmpFu[0]*tmpObjS[1] + tmpFu[1]*tmpObjS[5] + tmpFu[2]*tmpObjS[9] + tmpFu[3]*tmpObjS[13]; +tmpR2[2] = + tmpFu[0]*tmpObjS[2] + tmpFu[1]*tmpObjS[6] + tmpFu[2]*tmpObjS[10] + tmpFu[3]*tmpObjS[14]; +tmpR2[3] = + tmpFu[0]*tmpObjS[3] + tmpFu[1]*tmpObjS[7] + tmpFu[2]*tmpObjS[11] + tmpFu[3]*tmpObjS[15]; +tmpR1[0] = + tmpR2[0]*tmpFu[0] + tmpR2[1]*tmpFu[1] + tmpR2[2]*tmpFu[2] + tmpR2[3]*tmpFu[3]; +} + +void acado_setObjQN1QN2( real_t* const tmpFx, real_t* const tmpObjSEndTerm, real_t* const tmpQN1, real_t* const tmpQN2 ) +{ +tmpQN2[0] = + tmpFx[0]*tmpObjSEndTerm[0] + tmpFx[3]*tmpObjSEndTerm[3] + tmpFx[6]*tmpObjSEndTerm[6]; +tmpQN2[1] = + tmpFx[0]*tmpObjSEndTerm[1] + tmpFx[3]*tmpObjSEndTerm[4] + tmpFx[6]*tmpObjSEndTerm[7]; +tmpQN2[2] = + tmpFx[0]*tmpObjSEndTerm[2] + tmpFx[3]*tmpObjSEndTerm[5] + tmpFx[6]*tmpObjSEndTerm[8]; +tmpQN2[3] = + tmpFx[1]*tmpObjSEndTerm[0] + tmpFx[4]*tmpObjSEndTerm[3] + tmpFx[7]*tmpObjSEndTerm[6]; +tmpQN2[4] = + tmpFx[1]*tmpObjSEndTerm[1] + tmpFx[4]*tmpObjSEndTerm[4] + tmpFx[7]*tmpObjSEndTerm[7]; +tmpQN2[5] = + tmpFx[1]*tmpObjSEndTerm[2] + tmpFx[4]*tmpObjSEndTerm[5] + tmpFx[7]*tmpObjSEndTerm[8]; +tmpQN2[6] = + tmpFx[2]*tmpObjSEndTerm[0] + tmpFx[5]*tmpObjSEndTerm[3] + tmpFx[8]*tmpObjSEndTerm[6]; +tmpQN2[7] = + tmpFx[2]*tmpObjSEndTerm[1] + tmpFx[5]*tmpObjSEndTerm[4] + tmpFx[8]*tmpObjSEndTerm[7]; +tmpQN2[8] = + tmpFx[2]*tmpObjSEndTerm[2] + tmpFx[5]*tmpObjSEndTerm[5] + tmpFx[8]*tmpObjSEndTerm[8]; +tmpQN1[0] = + tmpQN2[0]*tmpFx[0] + tmpQN2[1]*tmpFx[3] + tmpQN2[2]*tmpFx[6]; +tmpQN1[1] = + tmpQN2[0]*tmpFx[1] + tmpQN2[1]*tmpFx[4] + tmpQN2[2]*tmpFx[7]; +tmpQN1[2] = + tmpQN2[0]*tmpFx[2] + tmpQN2[1]*tmpFx[5] + tmpQN2[2]*tmpFx[8]; +tmpQN1[3] = + tmpQN2[3]*tmpFx[0] + tmpQN2[4]*tmpFx[3] + tmpQN2[5]*tmpFx[6]; +tmpQN1[4] = + tmpQN2[3]*tmpFx[1] + tmpQN2[4]*tmpFx[4] + tmpQN2[5]*tmpFx[7]; +tmpQN1[5] = + tmpQN2[3]*tmpFx[2] + tmpQN2[4]*tmpFx[5] + tmpQN2[5]*tmpFx[8]; +tmpQN1[6] = + tmpQN2[6]*tmpFx[0] + tmpQN2[7]*tmpFx[3] + tmpQN2[8]*tmpFx[6]; +tmpQN1[7] = + tmpQN2[6]*tmpFx[1] + tmpQN2[7]*tmpFx[4] + tmpQN2[8]*tmpFx[7]; +tmpQN1[8] = + tmpQN2[6]*tmpFx[2] + tmpQN2[7]*tmpFx[5] + tmpQN2[8]*tmpFx[8]; +} + +void acado_evaluateObjective( ) +{ +int runObj; +for (runObj = 0; runObj < 20; ++runObj) +{ +acadoWorkspace.objValueIn[0] = acadoVariables.x[runObj * 3]; +acadoWorkspace.objValueIn[1] = acadoVariables.x[runObj * 3 + 1]; +acadoWorkspace.objValueIn[2] = acadoVariables.x[runObj * 3 + 2]; +acadoWorkspace.objValueIn[3] = acadoVariables.u[runObj]; +acadoWorkspace.objValueIn[4] = acadoVariables.od[runObj * 2]; +acadoWorkspace.objValueIn[5] = acadoVariables.od[runObj * 2 + 1]; + +acado_evaluateLSQ( acadoWorkspace.objValueIn, acadoWorkspace.objValueOut ); +acadoWorkspace.Dy[runObj * 4] = acadoWorkspace.objValueOut[0]; +acadoWorkspace.Dy[runObj * 4 + 1] = acadoWorkspace.objValueOut[1]; +acadoWorkspace.Dy[runObj * 4 + 2] = acadoWorkspace.objValueOut[2]; +acadoWorkspace.Dy[runObj * 4 + 3] = acadoWorkspace.objValueOut[3]; + +acado_setObjQ1Q2( &(acadoWorkspace.objValueOut[ 4 ]), &(acadoVariables.W[ runObj * 16 ]), &(acadoWorkspace.Q1[ runObj * 9 ]), &(acadoWorkspace.Q2[ runObj * 12 ]) ); + +acado_setObjR1R2( &(acadoWorkspace.objValueOut[ 16 ]), &(acadoVariables.W[ runObj * 16 ]), &(acadoWorkspace.R1[ runObj ]), &(acadoWorkspace.R2[ runObj * 4 ]) ); + +} +acadoWorkspace.objValueIn[0] = acadoVariables.x[60]; +acadoWorkspace.objValueIn[1] = acadoVariables.x[61]; +acadoWorkspace.objValueIn[2] = acadoVariables.x[62]; +acadoWorkspace.objValueIn[3] = acadoVariables.od[40]; +acadoWorkspace.objValueIn[4] = acadoVariables.od[41]; +acado_evaluateLSQEndTerm( acadoWorkspace.objValueIn, acadoWorkspace.objValueOut ); + +acadoWorkspace.DyN[0] = acadoWorkspace.objValueOut[0]; +acadoWorkspace.DyN[1] = acadoWorkspace.objValueOut[1]; +acadoWorkspace.DyN[2] = acadoWorkspace.objValueOut[2]; + +acado_setObjQN1QN2( &(acadoWorkspace.objValueOut[ 3 ]), acadoVariables.WN, acadoWorkspace.QN1, acadoWorkspace.QN2 ); + +} + +void acado_multGxd( real_t* const dOld, real_t* const Gx1, real_t* const dNew ) +{ +dNew[0] += + Gx1[0]*dOld[0] + Gx1[1]*dOld[1] + Gx1[2]*dOld[2]; +dNew[1] += + Gx1[3]*dOld[0] + Gx1[4]*dOld[1] + Gx1[5]*dOld[2]; +dNew[2] += + Gx1[6]*dOld[0] + Gx1[7]*dOld[1] + Gx1[8]*dOld[2]; +} + +void acado_moveGxT( real_t* const Gx1, real_t* const Gx2 ) +{ +Gx2[0] = Gx1[0]; +Gx2[1] = Gx1[1]; +Gx2[2] = Gx1[2]; +Gx2[3] = Gx1[3]; +Gx2[4] = Gx1[4]; +Gx2[5] = Gx1[5]; +Gx2[6] = Gx1[6]; +Gx2[7] = Gx1[7]; +Gx2[8] = Gx1[8]; +} + +void acado_multGxGx( real_t* const Gx1, real_t* const Gx2, real_t* const Gx3 ) +{ +Gx3[0] = + Gx1[0]*Gx2[0] + Gx1[1]*Gx2[3] + Gx1[2]*Gx2[6]; +Gx3[1] = + Gx1[0]*Gx2[1] + Gx1[1]*Gx2[4] + Gx1[2]*Gx2[7]; +Gx3[2] = + Gx1[0]*Gx2[2] + Gx1[1]*Gx2[5] + Gx1[2]*Gx2[8]; +Gx3[3] = + Gx1[3]*Gx2[0] + Gx1[4]*Gx2[3] + Gx1[5]*Gx2[6]; +Gx3[4] = + Gx1[3]*Gx2[1] + Gx1[4]*Gx2[4] + Gx1[5]*Gx2[7]; +Gx3[5] = + Gx1[3]*Gx2[2] + Gx1[4]*Gx2[5] + Gx1[5]*Gx2[8]; +Gx3[6] = + Gx1[6]*Gx2[0] + Gx1[7]*Gx2[3] + Gx1[8]*Gx2[6]; +Gx3[7] = + Gx1[6]*Gx2[1] + Gx1[7]*Gx2[4] + Gx1[8]*Gx2[7]; +Gx3[8] = + Gx1[6]*Gx2[2] + Gx1[7]*Gx2[5] + Gx1[8]*Gx2[8]; +} + +void acado_multGxGu( real_t* const Gx1, real_t* const Gu1, real_t* const Gu2 ) +{ +Gu2[0] = + Gx1[0]*Gu1[0] + Gx1[1]*Gu1[1] + Gx1[2]*Gu1[2]; +Gu2[1] = + Gx1[3]*Gu1[0] + Gx1[4]*Gu1[1] + Gx1[5]*Gu1[2]; +Gu2[2] = + Gx1[6]*Gu1[0] + Gx1[7]*Gu1[1] + Gx1[8]*Gu1[2]; +} + +void acado_moveGuE( real_t* const Gu1, real_t* const Gu2 ) +{ +Gu2[0] = Gu1[0]; +Gu2[1] = Gu1[1]; +Gu2[2] = Gu1[2]; +} + +void acado_setBlockH11( int iRow, int iCol, real_t* const Gu1, real_t* const Gu2 ) +{ +acadoWorkspace.H[(iRow * 23 + 69) + (iCol + 3)] += + Gu1[0]*Gu2[0] + Gu1[1]*Gu2[1] + Gu1[2]*Gu2[2]; +} + +void acado_setBlockH11_R1( int iRow, int iCol, real_t* const R11 ) +{ +acadoWorkspace.H[(iRow * 23 + 69) + (iCol + 3)] = R11[0]; +} + +void acado_zeroBlockH11( int iRow, int iCol ) +{ +acadoWorkspace.H[(iRow * 23 + 69) + (iCol + 3)] = 0.0000000000000000e+00; +} + +void acado_copyHTH( int iRow, int iCol ) +{ +acadoWorkspace.H[(iRow * 23 + 69) + (iCol + 3)] = acadoWorkspace.H[(iCol * 23 + 69) + (iRow + 3)]; +} + +void acado_multQ1d( real_t* const Gx1, real_t* const dOld, real_t* const dNew ) +{ +dNew[0] = + Gx1[0]*dOld[0] + Gx1[1]*dOld[1] + Gx1[2]*dOld[2]; +dNew[1] = + Gx1[3]*dOld[0] + Gx1[4]*dOld[1] + Gx1[5]*dOld[2]; +dNew[2] = + Gx1[6]*dOld[0] + Gx1[7]*dOld[1] + Gx1[8]*dOld[2]; +} + +void acado_multQN1d( real_t* const QN1, real_t* const dOld, real_t* const dNew ) +{ +dNew[0] = + acadoWorkspace.QN1[0]*dOld[0] + acadoWorkspace.QN1[1]*dOld[1] + acadoWorkspace.QN1[2]*dOld[2]; +dNew[1] = + acadoWorkspace.QN1[3]*dOld[0] + acadoWorkspace.QN1[4]*dOld[1] + acadoWorkspace.QN1[5]*dOld[2]; +dNew[2] = + acadoWorkspace.QN1[6]*dOld[0] + acadoWorkspace.QN1[7]*dOld[1] + acadoWorkspace.QN1[8]*dOld[2]; +} + +void acado_multRDy( real_t* const R2, real_t* const Dy1, real_t* const RDy1 ) +{ +RDy1[0] = + R2[0]*Dy1[0] + R2[1]*Dy1[1] + R2[2]*Dy1[2] + R2[3]*Dy1[3]; +} + +void acado_multQDy( real_t* const Q2, real_t* const Dy1, real_t* const QDy1 ) +{ +QDy1[0] = + Q2[0]*Dy1[0] + Q2[1]*Dy1[1] + Q2[2]*Dy1[2] + Q2[3]*Dy1[3]; +QDy1[1] = + Q2[4]*Dy1[0] + Q2[5]*Dy1[1] + Q2[6]*Dy1[2] + Q2[7]*Dy1[3]; +QDy1[2] = + Q2[8]*Dy1[0] + Q2[9]*Dy1[1] + Q2[10]*Dy1[2] + Q2[11]*Dy1[3]; +} + +void acado_multEQDy( real_t* const E1, real_t* const QDy1, real_t* const U1 ) +{ +U1[0] += + E1[0]*QDy1[0] + E1[1]*QDy1[1] + E1[2]*QDy1[2]; +} + +void acado_multQETGx( real_t* const E1, real_t* const Gx1, real_t* const H101 ) +{ +H101[0] += + E1[0]*Gx1[0] + E1[1]*Gx1[3] + E1[2]*Gx1[6]; +H101[1] += + E1[0]*Gx1[1] + E1[1]*Gx1[4] + E1[2]*Gx1[7]; +H101[2] += + E1[0]*Gx1[2] + E1[1]*Gx1[5] + E1[2]*Gx1[8]; +} + +void acado_zeroBlockH10( real_t* const H101 ) +{ +{ int lCopy; for (lCopy = 0; lCopy < 3; lCopy++) H101[ lCopy ] = 0; } +} + +void acado_multEDu( real_t* const E1, real_t* const U1, real_t* const dNew ) +{ +dNew[0] += + E1[0]*U1[0]; +dNew[1] += + E1[1]*U1[0]; +dNew[2] += + E1[2]*U1[0]; +} + +void acado_zeroBlockH00( ) +{ +acadoWorkspace.H[0] = 0.0000000000000000e+00; +acadoWorkspace.H[1] = 0.0000000000000000e+00; +acadoWorkspace.H[2] = 0.0000000000000000e+00; +acadoWorkspace.H[23] = 0.0000000000000000e+00; +acadoWorkspace.H[24] = 0.0000000000000000e+00; +acadoWorkspace.H[25] = 0.0000000000000000e+00; +acadoWorkspace.H[46] = 0.0000000000000000e+00; +acadoWorkspace.H[47] = 0.0000000000000000e+00; +acadoWorkspace.H[48] = 0.0000000000000000e+00; +} + +void acado_multCTQC( real_t* const Gx1, real_t* const Gx2 ) +{ +acadoWorkspace.H[0] += + Gx1[0]*Gx2[0] + Gx1[3]*Gx2[3] + Gx1[6]*Gx2[6]; +acadoWorkspace.H[1] += + Gx1[0]*Gx2[1] + Gx1[3]*Gx2[4] + Gx1[6]*Gx2[7]; +acadoWorkspace.H[2] += + Gx1[0]*Gx2[2] + Gx1[3]*Gx2[5] + Gx1[6]*Gx2[8]; +acadoWorkspace.H[23] += + Gx1[1]*Gx2[0] + Gx1[4]*Gx2[3] + Gx1[7]*Gx2[6]; +acadoWorkspace.H[24] += + Gx1[1]*Gx2[1] + Gx1[4]*Gx2[4] + Gx1[7]*Gx2[7]; +acadoWorkspace.H[25] += + Gx1[1]*Gx2[2] + Gx1[4]*Gx2[5] + Gx1[7]*Gx2[8]; +acadoWorkspace.H[46] += + Gx1[2]*Gx2[0] + Gx1[5]*Gx2[3] + Gx1[8]*Gx2[6]; +acadoWorkspace.H[47] += + Gx1[2]*Gx2[1] + Gx1[5]*Gx2[4] + Gx1[8]*Gx2[7]; +acadoWorkspace.H[48] += + Gx1[2]*Gx2[2] + Gx1[5]*Gx2[5] + Gx1[8]*Gx2[8]; +} + +void acado_macCTSlx( real_t* const C0, real_t* const g0 ) +{ +g0[0] += 0.0; +; +g0[1] += 0.0; +; +g0[2] += 0.0; +; +} + +void acado_macETSlu( real_t* const E0, real_t* const g1 ) +{ +g1[0] += 0.0; +; +} + +void acado_condensePrep( ) +{ +int lRun1; +int lRun2; +int lRun3; +int lRun4; +int lRun5; +/** Row vector of size: 20 */ +static const int xBoundIndices[ 20 ] = +{ 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61 }; +acado_moveGuE( acadoWorkspace.evGu, acadoWorkspace.E ); +acado_moveGxT( &(acadoWorkspace.evGx[ 9 ]), acadoWorkspace.T ); +acado_multGxd( acadoWorkspace.d, &(acadoWorkspace.evGx[ 9 ]), &(acadoWorkspace.d[ 3 ]) ); +acado_multGxGx( acadoWorkspace.T, acadoWorkspace.evGx, &(acadoWorkspace.evGx[ 9 ]) ); + +acado_multGxGu( acadoWorkspace.T, acadoWorkspace.E, &(acadoWorkspace.E[ 3 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 3 ]), &(acadoWorkspace.E[ 6 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 18 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 3 ]), &(acadoWorkspace.evGx[ 18 ]), &(acadoWorkspace.d[ 6 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 9 ]), &(acadoWorkspace.evGx[ 18 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 3 ]), &(acadoWorkspace.E[ 9 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.E[ 12 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 6 ]), &(acadoWorkspace.E[ 15 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 27 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 6 ]), &(acadoWorkspace.evGx[ 27 ]), &(acadoWorkspace.d[ 9 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 18 ]), &(acadoWorkspace.evGx[ 27 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 9 ]), &(acadoWorkspace.E[ 18 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.E[ 21 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 15 ]), &(acadoWorkspace.E[ 24 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 9 ]), &(acadoWorkspace.E[ 27 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 36 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 9 ]), &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.d[ 12 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 27 ]), &(acadoWorkspace.evGx[ 36 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.E[ 30 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 21 ]), &(acadoWorkspace.E[ 33 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.E[ 36 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 27 ]), &(acadoWorkspace.E[ 39 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 12 ]), &(acadoWorkspace.E[ 42 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 45 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 12 ]), &(acadoWorkspace.evGx[ 45 ]), &(acadoWorkspace.d[ 15 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.evGx[ 45 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.E[ 45 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 33 ]), &(acadoWorkspace.E[ 48 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.E[ 51 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 39 ]), &(acadoWorkspace.E[ 54 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.E[ 57 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 15 ]), &(acadoWorkspace.E[ 60 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 54 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 15 ]), &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.d[ 18 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 45 ]), &(acadoWorkspace.evGx[ 54 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.E[ 63 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.E[ 66 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 51 ]), &(acadoWorkspace.E[ 69 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.E[ 72 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 57 ]), &(acadoWorkspace.E[ 75 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.E[ 78 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 18 ]), &(acadoWorkspace.E[ 81 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 63 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 18 ]), &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.d[ 21 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.evGx[ 63 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.E[ 84 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.E[ 87 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 69 ]), &(acadoWorkspace.E[ 90 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.E[ 93 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 75 ]), &(acadoWorkspace.E[ 96 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.E[ 99 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 81 ]), &(acadoWorkspace.E[ 102 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 21 ]), &(acadoWorkspace.E[ 105 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 72 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 21 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.d[ 24 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.evGx[ 72 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.E[ 108 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.E[ 111 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.E[ 114 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 93 ]), &(acadoWorkspace.E[ 117 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.E[ 120 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 99 ]), &(acadoWorkspace.E[ 123 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.E[ 126 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 105 ]), &(acadoWorkspace.E[ 129 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 24 ]), &(acadoWorkspace.E[ 132 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 81 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 24 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.d[ 27 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.evGx[ 81 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.E[ 135 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.E[ 138 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.E[ 141 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.E[ 144 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.E[ 147 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 123 ]), &(acadoWorkspace.E[ 150 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.E[ 153 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 129 ]), &(acadoWorkspace.E[ 156 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.E[ 159 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 27 ]), &(acadoWorkspace.E[ 162 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 90 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 27 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.d[ 30 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.evGx[ 90 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.E[ 165 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.E[ 168 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.E[ 171 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.E[ 174 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.E[ 177 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.E[ 180 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 153 ]), &(acadoWorkspace.E[ 183 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.E[ 186 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 159 ]), &(acadoWorkspace.E[ 189 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.E[ 192 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 30 ]), &(acadoWorkspace.E[ 195 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 99 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 30 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.d[ 33 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.evGx[ 99 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.E[ 198 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.E[ 201 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.E[ 204 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.E[ 207 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.E[ 210 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.E[ 213 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 183 ]), &(acadoWorkspace.E[ 216 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.E[ 219 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 189 ]), &(acadoWorkspace.E[ 222 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.E[ 225 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 195 ]), &(acadoWorkspace.E[ 228 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 33 ]), &(acadoWorkspace.E[ 231 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 108 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 33 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.d[ 36 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.evGx[ 108 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.E[ 234 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.E[ 237 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.E[ 240 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.E[ 243 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.E[ 246 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.E[ 249 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.E[ 252 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 219 ]), &(acadoWorkspace.E[ 255 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.E[ 258 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 225 ]), &(acadoWorkspace.E[ 261 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.E[ 264 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 231 ]), &(acadoWorkspace.E[ 267 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 36 ]), &(acadoWorkspace.E[ 270 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 117 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 36 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.d[ 39 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.evGx[ 117 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.E[ 273 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.E[ 276 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.E[ 279 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.E[ 282 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.E[ 285 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.E[ 288 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.E[ 291 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.E[ 294 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.E[ 297 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 261 ]), &(acadoWorkspace.E[ 300 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.E[ 303 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 267 ]), &(acadoWorkspace.E[ 306 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.E[ 309 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 39 ]), &(acadoWorkspace.E[ 312 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 126 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 39 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.d[ 42 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.evGx[ 126 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.E[ 315 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.E[ 318 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.E[ 321 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.E[ 324 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.E[ 327 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.E[ 330 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.E[ 333 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.E[ 336 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.E[ 339 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.E[ 342 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 303 ]), &(acadoWorkspace.E[ 345 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.E[ 348 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 309 ]), &(acadoWorkspace.E[ 351 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.E[ 354 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 42 ]), &(acadoWorkspace.E[ 357 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 135 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 42 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.d[ 45 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.evGx[ 135 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.E[ 360 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.E[ 363 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.E[ 366 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.E[ 369 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.E[ 372 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.E[ 375 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.E[ 378 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.E[ 381 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.E[ 384 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.E[ 387 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 345 ]), &(acadoWorkspace.E[ 390 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.E[ 393 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 351 ]), &(acadoWorkspace.E[ 396 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.E[ 399 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 357 ]), &(acadoWorkspace.E[ 402 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 45 ]), &(acadoWorkspace.E[ 405 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 144 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 45 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.d[ 48 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.evGx[ 144 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.E[ 408 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.E[ 411 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.E[ 414 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.E[ 417 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.E[ 420 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.E[ 423 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.E[ 426 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.E[ 429 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.E[ 432 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.E[ 435 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.E[ 438 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 393 ]), &(acadoWorkspace.E[ 441 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.E[ 444 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 399 ]), &(acadoWorkspace.E[ 447 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.E[ 450 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 405 ]), &(acadoWorkspace.E[ 453 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 48 ]), &(acadoWorkspace.E[ 456 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 153 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 48 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.d[ 51 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.evGx[ 153 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.E[ 459 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.E[ 462 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.E[ 465 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.E[ 468 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.E[ 471 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.E[ 474 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.E[ 477 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.E[ 480 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.E[ 483 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.E[ 486 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.E[ 489 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.E[ 492 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.E[ 495 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 447 ]), &(acadoWorkspace.E[ 498 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.E[ 501 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 453 ]), &(acadoWorkspace.E[ 504 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.E[ 507 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 51 ]), &(acadoWorkspace.E[ 510 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 162 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 51 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.d[ 54 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.evGx[ 162 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.E[ 513 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.E[ 516 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.E[ 519 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.E[ 522 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.E[ 525 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.E[ 528 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.E[ 531 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.E[ 534 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.E[ 537 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.E[ 540 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.E[ 543 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.E[ 546 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.E[ 549 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.E[ 552 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 501 ]), &(acadoWorkspace.E[ 555 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.E[ 558 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 507 ]), &(acadoWorkspace.E[ 561 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.E[ 564 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 54 ]), &(acadoWorkspace.E[ 567 ]) ); + +acado_moveGxT( &(acadoWorkspace.evGx[ 171 ]), acadoWorkspace.T ); +acado_multGxd( &(acadoWorkspace.d[ 54 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.d[ 57 ]) ); +acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.evGx[ 171 ]) ); + +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.E[ 570 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.E[ 573 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.E[ 576 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.E[ 579 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.E[ 582 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.E[ 585 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.E[ 588 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.E[ 591 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.E[ 594 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.E[ 597 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.E[ 600 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.E[ 603 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.E[ 606 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.E[ 609 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 555 ]), &(acadoWorkspace.E[ 612 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.E[ 615 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 561 ]), &(acadoWorkspace.E[ 618 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.E[ 621 ]) ); +acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 567 ]), &(acadoWorkspace.E[ 624 ]) ); + +acado_moveGuE( &(acadoWorkspace.evGu[ 57 ]), &(acadoWorkspace.E[ 627 ]) ); + +acado_multGxGx( &(acadoWorkspace.Q1[ 9 ]), acadoWorkspace.evGx, acadoWorkspace.QGx ); +acado_multGxGx( &(acadoWorkspace.Q1[ 18 ]), &(acadoWorkspace.evGx[ 9 ]), &(acadoWorkspace.QGx[ 9 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 27 ]), &(acadoWorkspace.evGx[ 18 ]), &(acadoWorkspace.QGx[ 18 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 36 ]), &(acadoWorkspace.evGx[ 27 ]), &(acadoWorkspace.QGx[ 27 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 45 ]), &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.QGx[ 36 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 54 ]), &(acadoWorkspace.evGx[ 45 ]), &(acadoWorkspace.QGx[ 45 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 63 ]), &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.QGx[ 54 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.QGx[ 63 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.QGx[ 72 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.QGx[ 81 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.QGx[ 90 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.QGx[ 99 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.QGx[ 108 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.QGx[ 117 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.QGx[ 126 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.QGx[ 135 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.QGx[ 144 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.QGx[ 153 ]) ); +acado_multGxGx( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.QGx[ 162 ]) ); +acado_multGxGx( acadoWorkspace.QN1, &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.QGx[ 171 ]) ); + +acado_multGxGu( &(acadoWorkspace.Q1[ 9 ]), acadoWorkspace.E, acadoWorkspace.QE ); +acado_multGxGu( &(acadoWorkspace.Q1[ 18 ]), &(acadoWorkspace.E[ 3 ]), &(acadoWorkspace.QE[ 3 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 18 ]), &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.QE[ 6 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 27 ]), &(acadoWorkspace.E[ 9 ]), &(acadoWorkspace.QE[ 9 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 27 ]), &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.QE[ 12 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 27 ]), &(acadoWorkspace.E[ 15 ]), &(acadoWorkspace.QE[ 15 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 36 ]), &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QE[ 18 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 36 ]), &(acadoWorkspace.E[ 21 ]), &(acadoWorkspace.QE[ 21 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 36 ]), &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.QE[ 24 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 36 ]), &(acadoWorkspace.E[ 27 ]), &(acadoWorkspace.QE[ 27 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 45 ]), &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QE[ 30 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 45 ]), &(acadoWorkspace.E[ 33 ]), &(acadoWorkspace.QE[ 33 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 45 ]), &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QE[ 36 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 45 ]), &(acadoWorkspace.E[ 39 ]), &(acadoWorkspace.QE[ 39 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 45 ]), &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.QE[ 42 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 54 ]), &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.QE[ 45 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 54 ]), &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QE[ 48 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 54 ]), &(acadoWorkspace.E[ 51 ]), &(acadoWorkspace.QE[ 51 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 54 ]), &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.QE[ 54 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 54 ]), &(acadoWorkspace.E[ 57 ]), &(acadoWorkspace.QE[ 57 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 54 ]), &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QE[ 60 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 63 ]), &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.QE[ 63 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 63 ]), &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 66 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 63 ]), &(acadoWorkspace.E[ 69 ]), &(acadoWorkspace.QE[ 69 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 63 ]), &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QE[ 72 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 63 ]), &(acadoWorkspace.E[ 75 ]), &(acadoWorkspace.QE[ 75 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 63 ]), &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.QE[ 78 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 63 ]), &(acadoWorkspace.E[ 81 ]), &(acadoWorkspace.QE[ 81 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 84 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.QE[ 87 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 90 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 93 ]), &(acadoWorkspace.QE[ 93 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 96 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 99 ]), &(acadoWorkspace.QE[ 99 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QE[ 102 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 105 ]), &(acadoWorkspace.QE[ 105 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 108 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QE[ 111 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 114 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.QE[ 117 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QE[ 120 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.E[ 123 ]), &(acadoWorkspace.QE[ 123 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 126 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.E[ 129 ]), &(acadoWorkspace.QE[ 129 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 135 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 138 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QE[ 141 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 144 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.QE[ 147 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 150 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 153 ]), &(acadoWorkspace.QE[ 153 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.QE[ 156 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 159 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 165 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 168 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 171 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 174 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.QE[ 177 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 180 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 183 ]), &(acadoWorkspace.QE[ 183 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 186 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 189 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.E[ 195 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 198 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 201 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 204 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 207 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 210 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.QE[ 213 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 216 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 219 ]), &(acadoWorkspace.QE[ 219 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 225 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 231 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 234 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 237 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 240 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 243 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 246 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QE[ 249 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 252 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.QE[ 255 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 261 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 267 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 273 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 276 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 279 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 282 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 285 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 288 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QE[ 291 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 294 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 303 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 309 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 315 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 318 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 321 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 324 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 327 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 330 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 333 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 336 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 345 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 351 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.E[ 357 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 360 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 363 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 366 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 369 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 372 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 375 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 378 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 381 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 393 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 399 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 405 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 408 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 411 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 414 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 417 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 420 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 423 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 426 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 429 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 447 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 453 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 459 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 462 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 465 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 468 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 471 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 474 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 477 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 480 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 501 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 507 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 513 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 516 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 519 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 522 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 525 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 528 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 531 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 534 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 555 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 561 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_multGxGu( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.E[ 567 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 570 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 573 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 576 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 579 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 582 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 585 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 588 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 591 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 594 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 597 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 600 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 603 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 606 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.QE[ 609 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 612 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 615 ]), &(acadoWorkspace.QE[ 615 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QE[ 618 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 621 ]), &(acadoWorkspace.QE[ 621 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.QE[ 624 ]) ); +acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 627 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_zeroBlockH00( ); +acado_multCTQC( acadoWorkspace.evGx, acadoWorkspace.QGx ); +acado_multCTQC( &(acadoWorkspace.evGx[ 9 ]), &(acadoWorkspace.QGx[ 9 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 18 ]), &(acadoWorkspace.QGx[ 18 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 27 ]), &(acadoWorkspace.QGx[ 27 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.QGx[ 36 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 45 ]), &(acadoWorkspace.QGx[ 45 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.QGx[ 54 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.QGx[ 63 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.QGx[ 72 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.QGx[ 81 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.QGx[ 90 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.QGx[ 99 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.QGx[ 108 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.QGx[ 117 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.QGx[ 126 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.QGx[ 135 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.QGx[ 144 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.QGx[ 153 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.QGx[ 162 ]) ); +acado_multCTQC( &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.QGx[ 171 ]) ); + +acado_zeroBlockH10( acadoWorkspace.H10 ); +acado_multQETGx( acadoWorkspace.QE, acadoWorkspace.evGx, acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 3 ]), &(acadoWorkspace.evGx[ 9 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 9 ]), &(acadoWorkspace.evGx[ 18 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 18 ]), &(acadoWorkspace.evGx[ 27 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 30 ]), &(acadoWorkspace.evGx[ 36 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 45 ]), &(acadoWorkspace.evGx[ 45 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 63 ]), &(acadoWorkspace.evGx[ 54 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 84 ]), &(acadoWorkspace.evGx[ 63 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 108 ]), &(acadoWorkspace.evGx[ 72 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 135 ]), &(acadoWorkspace.evGx[ 81 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 165 ]), &(acadoWorkspace.evGx[ 90 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 198 ]), &(acadoWorkspace.evGx[ 99 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 234 ]), &(acadoWorkspace.evGx[ 108 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 273 ]), &(acadoWorkspace.evGx[ 117 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 315 ]), &(acadoWorkspace.evGx[ 126 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 360 ]), &(acadoWorkspace.evGx[ 135 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 408 ]), &(acadoWorkspace.evGx[ 144 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 459 ]), &(acadoWorkspace.evGx[ 153 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 513 ]), &(acadoWorkspace.evGx[ 162 ]), acadoWorkspace.H10 ); +acado_multQETGx( &(acadoWorkspace.QE[ 570 ]), &(acadoWorkspace.evGx[ 171 ]), acadoWorkspace.H10 ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 6 ]), &(acadoWorkspace.evGx[ 9 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 12 ]), &(acadoWorkspace.evGx[ 18 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 21 ]), &(acadoWorkspace.evGx[ 27 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 33 ]), &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 48 ]), &(acadoWorkspace.evGx[ 45 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 66 ]), &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 87 ]), &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 111 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 138 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 168 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 201 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 237 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 276 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 318 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 363 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 411 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 462 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 516 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 573 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 3 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 15 ]), &(acadoWorkspace.evGx[ 18 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 24 ]), &(acadoWorkspace.evGx[ 27 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 36 ]), &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 51 ]), &(acadoWorkspace.evGx[ 45 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 69 ]), &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 90 ]), &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 114 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 141 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 171 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 204 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 240 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 279 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 321 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 366 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 414 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 465 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 519 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 576 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 6 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 27 ]), &(acadoWorkspace.evGx[ 27 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 39 ]), &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 54 ]), &(acadoWorkspace.evGx[ 45 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 72 ]), &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 93 ]), &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 117 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 144 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 174 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 207 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 243 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 282 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 324 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 369 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 417 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 468 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 522 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 579 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 9 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 42 ]), &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 57 ]), &(acadoWorkspace.evGx[ 45 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 75 ]), &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 96 ]), &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 120 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 147 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 177 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 210 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 246 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 285 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 327 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 372 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 420 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 471 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 525 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 582 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 12 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 60 ]), &(acadoWorkspace.evGx[ 45 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 78 ]), &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 99 ]), &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 123 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 150 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 180 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 213 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 249 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 288 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 330 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 375 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 423 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 474 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 528 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 585 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 15 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 81 ]), &(acadoWorkspace.evGx[ 54 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 102 ]), &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 126 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 153 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 183 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 216 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 252 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 291 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 333 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 378 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 426 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 477 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 531 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 588 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 18 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 105 ]), &(acadoWorkspace.evGx[ 63 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 129 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 156 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 186 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 219 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 255 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 294 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 336 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 381 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 429 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 480 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 534 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 591 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 21 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 132 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 159 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 189 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 222 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 258 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 297 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 339 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 384 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 432 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 483 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 537 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 594 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 24 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 162 ]), &(acadoWorkspace.evGx[ 81 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 192 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 225 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 261 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 300 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 342 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 387 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 435 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 486 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 540 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 597 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 27 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 195 ]), &(acadoWorkspace.evGx[ 90 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 228 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 264 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 303 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 345 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 390 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 438 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 489 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 543 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 600 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 30 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 33 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 231 ]), &(acadoWorkspace.evGx[ 99 ]), &(acadoWorkspace.H10[ 33 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 267 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 33 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 306 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 33 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 348 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 33 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 393 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 33 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 441 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 33 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 492 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 33 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 546 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 33 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 603 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 33 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 36 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 270 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 36 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 309 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 36 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 351 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 36 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 396 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 36 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 444 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 36 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 495 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 36 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 549 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 36 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 606 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 36 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 39 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 312 ]), &(acadoWorkspace.evGx[ 117 ]), &(acadoWorkspace.H10[ 39 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 354 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 39 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 399 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 39 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 447 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 39 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 498 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 39 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 552 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 39 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 609 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 39 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 42 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 357 ]), &(acadoWorkspace.evGx[ 126 ]), &(acadoWorkspace.H10[ 42 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 402 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 42 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 450 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 42 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 501 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 42 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 555 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 42 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 612 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 42 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 45 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 405 ]), &(acadoWorkspace.evGx[ 135 ]), &(acadoWorkspace.H10[ 45 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 453 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 45 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 504 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 45 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 558 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 45 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 615 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 45 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 48 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 456 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 48 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 507 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 48 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 561 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 48 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 618 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 48 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 51 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 510 ]), &(acadoWorkspace.evGx[ 153 ]), &(acadoWorkspace.H10[ 51 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 564 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 51 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 621 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 51 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 54 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 567 ]), &(acadoWorkspace.evGx[ 162 ]), &(acadoWorkspace.H10[ 54 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 624 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 54 ]) ); +acado_zeroBlockH10( &(acadoWorkspace.H10[ 57 ]) ); +acado_multQETGx( &(acadoWorkspace.QE[ 627 ]), &(acadoWorkspace.evGx[ 171 ]), &(acadoWorkspace.H10[ 57 ]) ); + +acadoWorkspace.H[3] = acadoWorkspace.H10[0]; +acadoWorkspace.H[4] = acadoWorkspace.H10[3]; +acadoWorkspace.H[5] = acadoWorkspace.H10[6]; +acadoWorkspace.H[6] = acadoWorkspace.H10[9]; +acadoWorkspace.H[7] = acadoWorkspace.H10[12]; +acadoWorkspace.H[8] = acadoWorkspace.H10[15]; +acadoWorkspace.H[9] = acadoWorkspace.H10[18]; +acadoWorkspace.H[10] = acadoWorkspace.H10[21]; +acadoWorkspace.H[11] = acadoWorkspace.H10[24]; +acadoWorkspace.H[12] = acadoWorkspace.H10[27]; +acadoWorkspace.H[13] = acadoWorkspace.H10[30]; +acadoWorkspace.H[14] = acadoWorkspace.H10[33]; +acadoWorkspace.H[15] = acadoWorkspace.H10[36]; +acadoWorkspace.H[16] = acadoWorkspace.H10[39]; +acadoWorkspace.H[17] = acadoWorkspace.H10[42]; +acadoWorkspace.H[18] = acadoWorkspace.H10[45]; +acadoWorkspace.H[19] = acadoWorkspace.H10[48]; +acadoWorkspace.H[20] = acadoWorkspace.H10[51]; +acadoWorkspace.H[21] = acadoWorkspace.H10[54]; +acadoWorkspace.H[22] = acadoWorkspace.H10[57]; +acadoWorkspace.H[26] = acadoWorkspace.H10[1]; +acadoWorkspace.H[27] = acadoWorkspace.H10[4]; +acadoWorkspace.H[28] = acadoWorkspace.H10[7]; +acadoWorkspace.H[29] = acadoWorkspace.H10[10]; +acadoWorkspace.H[30] = acadoWorkspace.H10[13]; +acadoWorkspace.H[31] = acadoWorkspace.H10[16]; +acadoWorkspace.H[32] = acadoWorkspace.H10[19]; +acadoWorkspace.H[33] = acadoWorkspace.H10[22]; +acadoWorkspace.H[34] = acadoWorkspace.H10[25]; +acadoWorkspace.H[35] = acadoWorkspace.H10[28]; +acadoWorkspace.H[36] = acadoWorkspace.H10[31]; +acadoWorkspace.H[37] = acadoWorkspace.H10[34]; +acadoWorkspace.H[38] = acadoWorkspace.H10[37]; +acadoWorkspace.H[39] = acadoWorkspace.H10[40]; +acadoWorkspace.H[40] = acadoWorkspace.H10[43]; +acadoWorkspace.H[41] = acadoWorkspace.H10[46]; +acadoWorkspace.H[42] = acadoWorkspace.H10[49]; +acadoWorkspace.H[43] = acadoWorkspace.H10[52]; +acadoWorkspace.H[44] = acadoWorkspace.H10[55]; +acadoWorkspace.H[45] = acadoWorkspace.H10[58]; +acadoWorkspace.H[49] = acadoWorkspace.H10[2]; +acadoWorkspace.H[50] = acadoWorkspace.H10[5]; +acadoWorkspace.H[51] = acadoWorkspace.H10[8]; +acadoWorkspace.H[52] = acadoWorkspace.H10[11]; +acadoWorkspace.H[53] = acadoWorkspace.H10[14]; +acadoWorkspace.H[54] = acadoWorkspace.H10[17]; +acadoWorkspace.H[55] = acadoWorkspace.H10[20]; +acadoWorkspace.H[56] = acadoWorkspace.H10[23]; +acadoWorkspace.H[57] = acadoWorkspace.H10[26]; +acadoWorkspace.H[58] = acadoWorkspace.H10[29]; +acadoWorkspace.H[59] = acadoWorkspace.H10[32]; +acadoWorkspace.H[60] = acadoWorkspace.H10[35]; +acadoWorkspace.H[61] = acadoWorkspace.H10[38]; +acadoWorkspace.H[62] = acadoWorkspace.H10[41]; +acadoWorkspace.H[63] = acadoWorkspace.H10[44]; +acadoWorkspace.H[64] = acadoWorkspace.H10[47]; +acadoWorkspace.H[65] = acadoWorkspace.H10[50]; +acadoWorkspace.H[66] = acadoWorkspace.H10[53]; +acadoWorkspace.H[67] = acadoWorkspace.H10[56]; +acadoWorkspace.H[68] = acadoWorkspace.H10[59]; + +acado_setBlockH11_R1( 0, 0, acadoWorkspace.R1 ); +acado_setBlockH11( 0, 0, acadoWorkspace.E, acadoWorkspace.QE ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 3 ]), &(acadoWorkspace.QE[ 3 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 9 ]), &(acadoWorkspace.QE[ 9 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QE[ 18 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QE[ 30 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.QE[ 45 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.QE[ 63 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 84 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 108 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 135 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 165 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 198 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 234 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 273 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 315 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 360 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 408 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 459 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 513 ]) ); +acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 570 ]) ); + +acado_zeroBlockH11( 0, 1 ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 3 ]), &(acadoWorkspace.QE[ 6 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 9 ]), &(acadoWorkspace.QE[ 12 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QE[ 21 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QE[ 33 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.QE[ 48 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.QE[ 66 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 87 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 111 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 138 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 168 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 201 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 237 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 276 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 318 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 363 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 411 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 462 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 516 ]) ); +acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 573 ]) ); + +acado_zeroBlockH11( 0, 2 ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 9 ]), &(acadoWorkspace.QE[ 15 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QE[ 24 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QE[ 36 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.QE[ 51 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.QE[ 69 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 90 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 114 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 141 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 171 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 204 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 240 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 279 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 321 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 366 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 414 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 465 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 519 ]) ); +acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 576 ]) ); + +acado_zeroBlockH11( 0, 3 ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QE[ 27 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QE[ 39 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.QE[ 54 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.QE[ 72 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 93 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 117 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 144 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 174 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 207 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 243 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 282 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 324 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 369 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 417 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 468 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 522 ]) ); +acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 579 ]) ); + +acado_zeroBlockH11( 0, 4 ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QE[ 42 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.QE[ 57 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.QE[ 75 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 96 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 120 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 147 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 177 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 210 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 246 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 285 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 327 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 372 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 420 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 471 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 525 ]) ); +acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 582 ]) ); + +acado_zeroBlockH11( 0, 5 ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.QE[ 60 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.QE[ 78 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 99 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 123 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 150 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 180 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 213 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 249 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 288 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 330 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 375 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 423 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 474 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 528 ]) ); +acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 585 ]) ); + +acado_zeroBlockH11( 0, 6 ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.QE[ 81 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 102 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 126 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 153 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 183 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 216 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 252 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 291 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 333 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 378 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 426 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 477 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 531 ]) ); +acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 588 ]) ); + +acado_zeroBlockH11( 0, 7 ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 105 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 129 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 156 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 186 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 219 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 255 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 294 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 336 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 381 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 429 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 480 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 534 ]) ); +acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 591 ]) ); + +acado_zeroBlockH11( 0, 8 ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 594 ]) ); + +acado_zeroBlockH11( 0, 9 ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 0, 10 ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 0, 11 ); +acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 0, 12 ); +acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 0, 13 ); +acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 0, 14 ); +acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 0, 15 ); +acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 0, 16 ); +acado_setBlockH11( 0, 16, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 0, 16, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 0, 16, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 0, 16, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 0, 17 ); +acado_setBlockH11( 0, 17, &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 0, 17, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 0, 17, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 0, 18 ); +acado_setBlockH11( 0, 18, &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 0, 18, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 0, 19 ); +acado_setBlockH11( 0, 19, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 1, 1, &(acadoWorkspace.R1[ 1 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.QE[ 6 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.QE[ 12 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 21 ]), &(acadoWorkspace.QE[ 21 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 33 ]), &(acadoWorkspace.QE[ 33 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QE[ 48 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 66 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.QE[ 87 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QE[ 111 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 138 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 168 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 201 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 237 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 276 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 318 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 363 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 411 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 462 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 516 ]) ); +acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 573 ]) ); + +acado_zeroBlockH11( 1, 2 ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.QE[ 15 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 21 ]), &(acadoWorkspace.QE[ 24 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 33 ]), &(acadoWorkspace.QE[ 36 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QE[ 51 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 69 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.QE[ 90 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QE[ 114 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 141 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 171 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 204 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 240 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 279 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 321 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 366 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 414 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 465 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 519 ]) ); +acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 576 ]) ); + +acado_zeroBlockH11( 1, 3 ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 21 ]), &(acadoWorkspace.QE[ 27 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 33 ]), &(acadoWorkspace.QE[ 39 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QE[ 54 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 72 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.QE[ 93 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QE[ 117 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 144 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 174 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 207 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 243 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 282 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 324 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 369 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 417 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 468 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 522 ]) ); +acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 579 ]) ); + +acado_zeroBlockH11( 1, 4 ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 33 ]), &(acadoWorkspace.QE[ 42 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QE[ 57 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 75 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.QE[ 96 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QE[ 120 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 147 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 177 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 210 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 246 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 285 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 327 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 372 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 420 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 471 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 525 ]) ); +acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 582 ]) ); + +acado_zeroBlockH11( 1, 5 ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QE[ 60 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 78 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.QE[ 99 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QE[ 123 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 150 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 180 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 213 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 249 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 288 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 330 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 375 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 423 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 474 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 528 ]) ); +acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 585 ]) ); + +acado_zeroBlockH11( 1, 6 ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 81 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.QE[ 102 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QE[ 126 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 153 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 183 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 216 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 252 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 291 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 333 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 378 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 426 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 477 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 531 ]) ); +acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 588 ]) ); + +acado_zeroBlockH11( 1, 7 ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.QE[ 105 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QE[ 129 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 156 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 186 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 219 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 255 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 294 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 336 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 381 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 429 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 480 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 534 ]) ); +acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 591 ]) ); + +acado_zeroBlockH11( 1, 8 ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 594 ]) ); + +acado_zeroBlockH11( 1, 9 ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 1, 10 ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 1, 11 ); +acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 1, 12 ); +acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 1, 13 ); +acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 1, 14 ); +acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 1, 15 ); +acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 1, 16 ); +acado_setBlockH11( 1, 16, &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 1, 16, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 1, 16, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 1, 16, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 1, 17 ); +acado_setBlockH11( 1, 17, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 1, 17, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 1, 17, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 1, 18 ); +acado_setBlockH11( 1, 18, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 1, 18, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 1, 19 ); +acado_setBlockH11( 1, 19, &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 2, 2, &(acadoWorkspace.R1[ 2 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 15 ]), &(acadoWorkspace.QE[ 15 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.QE[ 24 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QE[ 36 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 51 ]), &(acadoWorkspace.QE[ 51 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 69 ]), &(acadoWorkspace.QE[ 69 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 90 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 114 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QE[ 141 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 171 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 204 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 240 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 279 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 321 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 366 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 414 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 465 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 519 ]) ); +acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 576 ]) ); + +acado_zeroBlockH11( 2, 3 ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.QE[ 27 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QE[ 39 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 51 ]), &(acadoWorkspace.QE[ 54 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 69 ]), &(acadoWorkspace.QE[ 72 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 93 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 117 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QE[ 144 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 174 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 207 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 243 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 282 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 324 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 369 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 417 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 468 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 522 ]) ); +acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 579 ]) ); + +acado_zeroBlockH11( 2, 4 ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QE[ 42 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 51 ]), &(acadoWorkspace.QE[ 57 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 69 ]), &(acadoWorkspace.QE[ 75 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 96 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 120 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QE[ 147 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 177 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 210 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 246 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 285 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 327 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 372 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 420 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 471 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 525 ]) ); +acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 582 ]) ); + +acado_zeroBlockH11( 2, 5 ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 51 ]), &(acadoWorkspace.QE[ 60 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 69 ]), &(acadoWorkspace.QE[ 78 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 99 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 123 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QE[ 150 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 180 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 213 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 249 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 288 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 330 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 375 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 423 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 474 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 528 ]) ); +acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 585 ]) ); + +acado_zeroBlockH11( 2, 6 ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 69 ]), &(acadoWorkspace.QE[ 81 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 102 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 126 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QE[ 153 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 183 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 216 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 252 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 291 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 333 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 378 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 426 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 477 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 531 ]) ); +acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 588 ]) ); + +acado_zeroBlockH11( 2, 7 ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 105 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 129 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QE[ 156 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 186 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 219 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 255 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 294 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 336 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 381 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 429 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 480 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 534 ]) ); +acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 591 ]) ); + +acado_zeroBlockH11( 2, 8 ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 594 ]) ); + +acado_zeroBlockH11( 2, 9 ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 2, 10 ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 2, 11 ); +acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 2, 12 ); +acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 2, 13 ); +acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 2, 14 ); +acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 2, 15 ); +acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 2, 16 ); +acado_setBlockH11( 2, 16, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 2, 16, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 2, 16, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 2, 16, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 2, 17 ); +acado_setBlockH11( 2, 17, &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 2, 17, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 2, 17, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 2, 18 ); +acado_setBlockH11( 2, 18, &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 2, 18, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 2, 19 ); +acado_setBlockH11( 2, 19, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 3, 3, &(acadoWorkspace.R1[ 3 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 27 ]), &(acadoWorkspace.QE[ 27 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 39 ]), &(acadoWorkspace.QE[ 39 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.QE[ 54 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QE[ 72 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 93 ]), &(acadoWorkspace.QE[ 93 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.QE[ 117 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 144 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 174 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 207 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 243 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 282 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 324 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 369 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 417 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 468 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 522 ]) ); +acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 579 ]) ); + +acado_zeroBlockH11( 3, 4 ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 39 ]), &(acadoWorkspace.QE[ 42 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.QE[ 57 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QE[ 75 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 93 ]), &(acadoWorkspace.QE[ 96 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.QE[ 120 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 147 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 177 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 210 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 246 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 285 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 327 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 372 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 420 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 471 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 525 ]) ); +acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 582 ]) ); + +acado_zeroBlockH11( 3, 5 ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.QE[ 60 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QE[ 78 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 93 ]), &(acadoWorkspace.QE[ 99 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.QE[ 123 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 150 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 180 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 213 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 249 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 288 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 330 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 375 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 423 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 474 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 528 ]) ); +acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 585 ]) ); + +acado_zeroBlockH11( 3, 6 ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QE[ 81 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 93 ]), &(acadoWorkspace.QE[ 102 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.QE[ 126 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 153 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 183 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 216 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 252 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 291 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 333 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 378 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 426 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 477 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 531 ]) ); +acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 588 ]) ); + +acado_zeroBlockH11( 3, 7 ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 93 ]), &(acadoWorkspace.QE[ 105 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.QE[ 129 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 156 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 186 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 219 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 255 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 294 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 336 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 381 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 429 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 480 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 534 ]) ); +acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 591 ]) ); + +acado_zeroBlockH11( 3, 8 ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 594 ]) ); + +acado_zeroBlockH11( 3, 9 ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 3, 10 ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 3, 11 ); +acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 3, 12 ); +acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 3, 13 ); +acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 3, 14 ); +acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 3, 15 ); +acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 3, 16 ); +acado_setBlockH11( 3, 16, &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 3, 16, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 3, 16, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 3, 16, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 3, 17 ); +acado_setBlockH11( 3, 17, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 3, 17, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 3, 17, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 3, 18 ); +acado_setBlockH11( 3, 18, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 3, 18, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 3, 19 ); +acado_setBlockH11( 3, 19, &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 4, 4, &(acadoWorkspace.R1[ 4 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.QE[ 42 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 57 ]), &(acadoWorkspace.QE[ 57 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 75 ]), &(acadoWorkspace.QE[ 75 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 96 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QE[ 120 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.QE[ 147 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.QE[ 177 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 210 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 246 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 285 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 327 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 372 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 420 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 471 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 525 ]) ); +acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 582 ]) ); + +acado_zeroBlockH11( 4, 5 ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 57 ]), &(acadoWorkspace.QE[ 60 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 75 ]), &(acadoWorkspace.QE[ 78 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 99 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QE[ 123 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.QE[ 150 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.QE[ 180 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 213 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 249 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 288 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 330 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 375 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 423 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 474 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 528 ]) ); +acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 585 ]) ); + +acado_zeroBlockH11( 4, 6 ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 75 ]), &(acadoWorkspace.QE[ 81 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 102 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QE[ 126 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.QE[ 153 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.QE[ 183 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 216 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 252 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 291 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 333 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 378 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 426 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 477 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 531 ]) ); +acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 588 ]) ); + +acado_zeroBlockH11( 4, 7 ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 105 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QE[ 129 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.QE[ 156 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.QE[ 186 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 219 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 255 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 294 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 336 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 381 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 429 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 480 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 534 ]) ); +acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 591 ]) ); + +acado_zeroBlockH11( 4, 8 ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 594 ]) ); + +acado_zeroBlockH11( 4, 9 ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 4, 10 ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 4, 11 ); +acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 4, 12 ); +acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 4, 13 ); +acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 4, 14 ); +acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 4, 15 ); +acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 4, 16 ); +acado_setBlockH11( 4, 16, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 4, 16, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 4, 16, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 4, 16, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 4, 17 ); +acado_setBlockH11( 4, 17, &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 4, 17, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 4, 17, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 4, 18 ); +acado_setBlockH11( 4, 18, &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 4, 18, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 4, 19 ); +acado_setBlockH11( 4, 19, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 5, 5, &(acadoWorkspace.R1[ 5 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QE[ 60 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.QE[ 78 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 99 ]), &(acadoWorkspace.QE[ 99 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 123 ]), &(acadoWorkspace.QE[ 123 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 150 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 180 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.QE[ 213 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QE[ 249 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 288 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 330 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 375 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 423 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 474 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 528 ]) ); +acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 585 ]) ); + +acado_zeroBlockH11( 5, 6 ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.QE[ 81 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 99 ]), &(acadoWorkspace.QE[ 102 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 123 ]), &(acadoWorkspace.QE[ 126 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 153 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 183 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.QE[ 216 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QE[ 252 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 291 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 333 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 378 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 426 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 477 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 531 ]) ); +acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 588 ]) ); + +acado_zeroBlockH11( 5, 7 ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 99 ]), &(acadoWorkspace.QE[ 105 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 123 ]), &(acadoWorkspace.QE[ 129 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 156 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 186 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.QE[ 219 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QE[ 255 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 294 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 336 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 381 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 429 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 480 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 534 ]) ); +acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 591 ]) ); + +acado_zeroBlockH11( 5, 8 ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 123 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 594 ]) ); + +acado_zeroBlockH11( 5, 9 ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 5, 10 ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 5, 11 ); +acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 5, 12 ); +acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 5, 13 ); +acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 5, 14 ); +acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 5, 15 ); +acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 5, 16 ); +acado_setBlockH11( 5, 16, &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 5, 16, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 5, 16, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 5, 16, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 5, 17 ); +acado_setBlockH11( 5, 17, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 5, 17, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 5, 17, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 5, 18 ); +acado_setBlockH11( 5, 18, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 5, 18, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 5, 19 ); +acado_setBlockH11( 5, 19, &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 6, 6, &(acadoWorkspace.R1[ 6 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 81 ]), &(acadoWorkspace.QE[ 81 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QE[ 102 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 126 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 153 ]), &(acadoWorkspace.QE[ 153 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 183 ]), &(acadoWorkspace.QE[ 183 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 216 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 252 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QE[ 291 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 333 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 378 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 426 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 477 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 531 ]) ); +acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 588 ]) ); + +acado_zeroBlockH11( 6, 7 ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QE[ 105 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 129 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 153 ]), &(acadoWorkspace.QE[ 156 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 183 ]), &(acadoWorkspace.QE[ 186 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 219 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 255 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QE[ 294 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 336 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 381 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 429 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 480 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 534 ]) ); +acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 591 ]) ); + +acado_zeroBlockH11( 6, 8 ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 153 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 183 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 594 ]) ); + +acado_zeroBlockH11( 6, 9 ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 153 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 183 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 6, 10 ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 183 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 6, 11 ); +acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 6, 12 ); +acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 6, 13 ); +acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 6, 14 ); +acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 6, 15 ); +acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 6, 16 ); +acado_setBlockH11( 6, 16, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 6, 16, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 6, 16, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 6, 16, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 6, 17 ); +acado_setBlockH11( 6, 17, &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 6, 17, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 6, 17, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 6, 18 ); +acado_setBlockH11( 6, 18, &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 6, 18, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 6, 19 ); +acado_setBlockH11( 6, 19, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 7, 7, &(acadoWorkspace.R1[ 7 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 105 ]), &(acadoWorkspace.QE[ 105 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 129 ]), &(acadoWorkspace.QE[ 129 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.QE[ 156 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 186 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 219 ]), &(acadoWorkspace.QE[ 219 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.QE[ 255 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 294 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 336 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 381 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 429 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 480 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 534 ]) ); +acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 591 ]) ); + +acado_zeroBlockH11( 7, 8 ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 129 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 219 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 594 ]) ); + +acado_zeroBlockH11( 7, 9 ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 219 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 7, 10 ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 219 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 7, 11 ); +acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 219 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 7, 12 ); +acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 7, 13 ); +acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 7, 14 ); +acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 7, 15 ); +acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 7, 16 ); +acado_setBlockH11( 7, 16, &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 7, 16, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 7, 16, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 7, 16, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 7, 17 ); +acado_setBlockH11( 7, 17, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 7, 17, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 7, 17, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 7, 18 ); +acado_setBlockH11( 7, 18, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 7, 18, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 7, 19 ); +acado_setBlockH11( 7, 19, &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 8, 8, &(acadoWorkspace.R1[ 8 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QE[ 132 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 159 ]), &(acadoWorkspace.QE[ 159 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 189 ]), &(acadoWorkspace.QE[ 189 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 222 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QE[ 258 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.QE[ 297 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.QE[ 339 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 384 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 432 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 483 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 537 ]) ); +acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 594 ]) ); + +acado_zeroBlockH11( 8, 9 ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 159 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 189 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 8, 10 ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 189 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 8, 11 ); +acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 8, 12 ); +acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 8, 13 ); +acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 8, 14 ); +acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 8, 15 ); +acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 8, 16 ); +acado_setBlockH11( 8, 16, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 8, 16, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 8, 16, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 8, 16, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 8, 17 ); +acado_setBlockH11( 8, 17, &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 8, 17, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 8, 17, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 8, 18 ); +acado_setBlockH11( 8, 18, &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 8, 18, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 8, 19 ); +acado_setBlockH11( 8, 19, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 9, 9, &(acadoWorkspace.R1[ 9 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.QE[ 162 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QE[ 192 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 225 ]), &(acadoWorkspace.QE[ 225 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 261 ]), &(acadoWorkspace.QE[ 261 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 300 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 342 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.QE[ 387 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QE[ 435 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 486 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 540 ]) ); +acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 597 ]) ); + +acado_zeroBlockH11( 9, 10 ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 225 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 261 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 9, 11 ); +acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 225 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 261 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 9, 12 ); +acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 261 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 9, 13 ); +acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 9, 14 ); +acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 9, 15 ); +acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 9, 16 ); +acado_setBlockH11( 9, 16, &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 9, 16, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 9, 16, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 9, 16, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 9, 17 ); +acado_setBlockH11( 9, 17, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 9, 17, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 9, 17, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 9, 18 ); +acado_setBlockH11( 9, 18, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 9, 18, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 9, 19 ); +acado_setBlockH11( 9, 19, &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 10, 10, &(acadoWorkspace.R1[ 10 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 195 ]), &(acadoWorkspace.QE[ 195 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 228 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.QE[ 264 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 303 ]), &(acadoWorkspace.QE[ 303 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 345 ]), &(acadoWorkspace.QE[ 345 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QE[ 390 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 438 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QE[ 489 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 543 ]) ); +acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 600 ]) ); + +acado_zeroBlockH11( 10, 11 ); +acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 303 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 345 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 10, 12 ); +acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 303 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 345 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 10, 13 ); +acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 303 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 345 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 10, 14 ); +acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 345 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 10, 15 ); +acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 10, 16 ); +acado_setBlockH11( 10, 16, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 10, 16, &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 10, 16, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 10, 16, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 10, 17 ); +acado_setBlockH11( 10, 17, &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 10, 17, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 10, 17, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 10, 18 ); +acado_setBlockH11( 10, 18, &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 10, 18, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 10, 19 ); +acado_setBlockH11( 10, 19, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 11, 11, &(acadoWorkspace.R1[ 11 ]) ); +acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 231 ]), &(acadoWorkspace.QE[ 231 ]) ); +acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 267 ]), &(acadoWorkspace.QE[ 267 ]) ); +acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QE[ 306 ]) ); +acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 348 ]) ); +acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 393 ]), &(acadoWorkspace.QE[ 393 ]) ); +acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.QE[ 441 ]) ); +acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 492 ]) ); +acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 546 ]) ); +acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 603 ]) ); + +acado_zeroBlockH11( 11, 12 ); +acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 267 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 393 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 11, 13 ); +acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 393 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 11, 14 ); +acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 393 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 11, 15 ); +acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 393 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 11, 16 ); +acado_setBlockH11( 11, 16, &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 11, 16, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 11, 16, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 11, 16, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 11, 17 ); +acado_setBlockH11( 11, 17, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 11, 17, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 11, 17, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 11, 18 ); +acado_setBlockH11( 11, 18, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 11, 18, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 11, 19 ); +acado_setBlockH11( 11, 19, &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 12, 12, &(acadoWorkspace.R1[ 12 ]) ); +acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 270 ]) ); +acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 309 ]), &(acadoWorkspace.QE[ 309 ]) ); +acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 351 ]), &(acadoWorkspace.QE[ 351 ]) ); +acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 396 ]) ); +acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 444 ]) ); +acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.QE[ 495 ]) ); +acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.QE[ 549 ]) ); +acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 606 ]) ); + +acado_zeroBlockH11( 12, 13 ); +acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 309 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 351 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 12, 14 ); +acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 351 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 12, 15 ); +acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 12, 16 ); +acado_setBlockH11( 12, 16, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 12, 16, &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 12, 16, &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 12, 16, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 12, 17 ); +acado_setBlockH11( 12, 17, &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 12, 17, &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 12, 17, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 12, 18 ); +acado_setBlockH11( 12, 18, &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 12, 18, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 12, 19 ); +acado_setBlockH11( 12, 19, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 13, 13, &(acadoWorkspace.R1[ 13 ]) ); +acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.QE[ 312 ]) ); +acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 354 ]) ); +acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 399 ]), &(acadoWorkspace.QE[ 399 ]) ); +acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 447 ]), &(acadoWorkspace.QE[ 447 ]) ); +acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 498 ]) ); +acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 552 ]) ); +acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.QE[ 609 ]) ); + +acado_zeroBlockH11( 13, 14 ); +acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 399 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 447 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 13, 15 ); +acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 399 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 447 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 13, 16 ); +acado_setBlockH11( 13, 16, &(acadoWorkspace.E[ 447 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 13, 16, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 13, 16, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 13, 16, &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 13, 17 ); +acado_setBlockH11( 13, 17, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 13, 17, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 13, 17, &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 13, 18 ); +acado_setBlockH11( 13, 18, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 13, 18, &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 13, 19 ); +acado_setBlockH11( 13, 19, &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 14, 14, &(acadoWorkspace.R1[ 14 ]) ); +acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 357 ]), &(acadoWorkspace.QE[ 357 ]) ); +acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 402 ]) ); +acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QE[ 450 ]) ); +acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 501 ]), &(acadoWorkspace.QE[ 501 ]) ); +acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 555 ]), &(acadoWorkspace.QE[ 555 ]) ); +acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 612 ]) ); + +acado_zeroBlockH11( 14, 15 ); +acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 501 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 555 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 14, 16 ); +acado_setBlockH11( 14, 16, &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 14, 16, &(acadoWorkspace.E[ 501 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 14, 16, &(acadoWorkspace.E[ 555 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 14, 16, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 14, 17 ); +acado_setBlockH11( 14, 17, &(acadoWorkspace.E[ 501 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 14, 17, &(acadoWorkspace.E[ 555 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 14, 17, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 14, 18 ); +acado_setBlockH11( 14, 18, &(acadoWorkspace.E[ 555 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 14, 18, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 14, 19 ); +acado_setBlockH11( 14, 19, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 15, 15, &(acadoWorkspace.R1[ 15 ]) ); +acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 405 ]), &(acadoWorkspace.QE[ 405 ]) ); +acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 453 ]), &(acadoWorkspace.QE[ 453 ]) ); +acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 504 ]) ); +acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 558 ]) ); +acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 615 ]), &(acadoWorkspace.QE[ 615 ]) ); + +acado_zeroBlockH11( 15, 16 ); +acado_setBlockH11( 15, 16, &(acadoWorkspace.E[ 453 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 15, 16, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 15, 16, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 15, 16, &(acadoWorkspace.E[ 615 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 15, 17 ); +acado_setBlockH11( 15, 17, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 15, 17, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 15, 17, &(acadoWorkspace.E[ 615 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 15, 18 ); +acado_setBlockH11( 15, 18, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 15, 18, &(acadoWorkspace.E[ 615 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 15, 19 ); +acado_setBlockH11( 15, 19, &(acadoWorkspace.E[ 615 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 16, 16, &(acadoWorkspace.R1[ 16 ]) ); +acado_setBlockH11( 16, 16, &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.QE[ 456 ]) ); +acado_setBlockH11( 16, 16, &(acadoWorkspace.E[ 507 ]), &(acadoWorkspace.QE[ 507 ]) ); +acado_setBlockH11( 16, 16, &(acadoWorkspace.E[ 561 ]), &(acadoWorkspace.QE[ 561 ]) ); +acado_setBlockH11( 16, 16, &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QE[ 618 ]) ); + +acado_zeroBlockH11( 16, 17 ); +acado_setBlockH11( 16, 17, &(acadoWorkspace.E[ 507 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 16, 17, &(acadoWorkspace.E[ 561 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 16, 17, &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 16, 18 ); +acado_setBlockH11( 16, 18, &(acadoWorkspace.E[ 561 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 16, 18, &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 16, 19 ); +acado_setBlockH11( 16, 19, &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 17, 17, &(acadoWorkspace.R1[ 17 ]) ); +acado_setBlockH11( 17, 17, &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QE[ 510 ]) ); +acado_setBlockH11( 17, 17, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 564 ]) ); +acado_setBlockH11( 17, 17, &(acadoWorkspace.E[ 621 ]), &(acadoWorkspace.QE[ 621 ]) ); + +acado_zeroBlockH11( 17, 18 ); +acado_setBlockH11( 17, 18, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 17, 18, &(acadoWorkspace.E[ 621 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 17, 19 ); +acado_setBlockH11( 17, 19, &(acadoWorkspace.E[ 621 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 18, 18, &(acadoWorkspace.R1[ 18 ]) ); +acado_setBlockH11( 18, 18, &(acadoWorkspace.E[ 567 ]), &(acadoWorkspace.QE[ 567 ]) ); +acado_setBlockH11( 18, 18, &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.QE[ 624 ]) ); + +acado_zeroBlockH11( 18, 19 ); +acado_setBlockH11( 18, 19, &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.QE[ 627 ]) ); + +acado_setBlockH11_R1( 19, 19, &(acadoWorkspace.R1[ 19 ]) ); +acado_setBlockH11( 19, 19, &(acadoWorkspace.E[ 627 ]), &(acadoWorkspace.QE[ 627 ]) ); + + +acado_copyHTH( 1, 0 ); +acado_copyHTH( 2, 0 ); +acado_copyHTH( 2, 1 ); +acado_copyHTH( 3, 0 ); +acado_copyHTH( 3, 1 ); +acado_copyHTH( 3, 2 ); +acado_copyHTH( 4, 0 ); +acado_copyHTH( 4, 1 ); +acado_copyHTH( 4, 2 ); +acado_copyHTH( 4, 3 ); +acado_copyHTH( 5, 0 ); +acado_copyHTH( 5, 1 ); +acado_copyHTH( 5, 2 ); +acado_copyHTH( 5, 3 ); +acado_copyHTH( 5, 4 ); +acado_copyHTH( 6, 0 ); +acado_copyHTH( 6, 1 ); +acado_copyHTH( 6, 2 ); +acado_copyHTH( 6, 3 ); +acado_copyHTH( 6, 4 ); +acado_copyHTH( 6, 5 ); +acado_copyHTH( 7, 0 ); +acado_copyHTH( 7, 1 ); +acado_copyHTH( 7, 2 ); +acado_copyHTH( 7, 3 ); +acado_copyHTH( 7, 4 ); +acado_copyHTH( 7, 5 ); +acado_copyHTH( 7, 6 ); +acado_copyHTH( 8, 0 ); +acado_copyHTH( 8, 1 ); +acado_copyHTH( 8, 2 ); +acado_copyHTH( 8, 3 ); +acado_copyHTH( 8, 4 ); +acado_copyHTH( 8, 5 ); +acado_copyHTH( 8, 6 ); +acado_copyHTH( 8, 7 ); +acado_copyHTH( 9, 0 ); +acado_copyHTH( 9, 1 ); +acado_copyHTH( 9, 2 ); +acado_copyHTH( 9, 3 ); +acado_copyHTH( 9, 4 ); +acado_copyHTH( 9, 5 ); +acado_copyHTH( 9, 6 ); +acado_copyHTH( 9, 7 ); +acado_copyHTH( 9, 8 ); +acado_copyHTH( 10, 0 ); +acado_copyHTH( 10, 1 ); +acado_copyHTH( 10, 2 ); +acado_copyHTH( 10, 3 ); +acado_copyHTH( 10, 4 ); +acado_copyHTH( 10, 5 ); +acado_copyHTH( 10, 6 ); +acado_copyHTH( 10, 7 ); +acado_copyHTH( 10, 8 ); +acado_copyHTH( 10, 9 ); +acado_copyHTH( 11, 0 ); +acado_copyHTH( 11, 1 ); +acado_copyHTH( 11, 2 ); +acado_copyHTH( 11, 3 ); +acado_copyHTH( 11, 4 ); +acado_copyHTH( 11, 5 ); +acado_copyHTH( 11, 6 ); +acado_copyHTH( 11, 7 ); +acado_copyHTH( 11, 8 ); +acado_copyHTH( 11, 9 ); +acado_copyHTH( 11, 10 ); +acado_copyHTH( 12, 0 ); +acado_copyHTH( 12, 1 ); +acado_copyHTH( 12, 2 ); +acado_copyHTH( 12, 3 ); +acado_copyHTH( 12, 4 ); +acado_copyHTH( 12, 5 ); +acado_copyHTH( 12, 6 ); +acado_copyHTH( 12, 7 ); +acado_copyHTH( 12, 8 ); +acado_copyHTH( 12, 9 ); +acado_copyHTH( 12, 10 ); +acado_copyHTH( 12, 11 ); +acado_copyHTH( 13, 0 ); +acado_copyHTH( 13, 1 ); +acado_copyHTH( 13, 2 ); +acado_copyHTH( 13, 3 ); +acado_copyHTH( 13, 4 ); +acado_copyHTH( 13, 5 ); +acado_copyHTH( 13, 6 ); +acado_copyHTH( 13, 7 ); +acado_copyHTH( 13, 8 ); +acado_copyHTH( 13, 9 ); +acado_copyHTH( 13, 10 ); +acado_copyHTH( 13, 11 ); +acado_copyHTH( 13, 12 ); +acado_copyHTH( 14, 0 ); +acado_copyHTH( 14, 1 ); +acado_copyHTH( 14, 2 ); +acado_copyHTH( 14, 3 ); +acado_copyHTH( 14, 4 ); +acado_copyHTH( 14, 5 ); +acado_copyHTH( 14, 6 ); +acado_copyHTH( 14, 7 ); +acado_copyHTH( 14, 8 ); +acado_copyHTH( 14, 9 ); +acado_copyHTH( 14, 10 ); +acado_copyHTH( 14, 11 ); +acado_copyHTH( 14, 12 ); +acado_copyHTH( 14, 13 ); +acado_copyHTH( 15, 0 ); +acado_copyHTH( 15, 1 ); +acado_copyHTH( 15, 2 ); +acado_copyHTH( 15, 3 ); +acado_copyHTH( 15, 4 ); +acado_copyHTH( 15, 5 ); +acado_copyHTH( 15, 6 ); +acado_copyHTH( 15, 7 ); +acado_copyHTH( 15, 8 ); +acado_copyHTH( 15, 9 ); +acado_copyHTH( 15, 10 ); +acado_copyHTH( 15, 11 ); +acado_copyHTH( 15, 12 ); +acado_copyHTH( 15, 13 ); +acado_copyHTH( 15, 14 ); +acado_copyHTH( 16, 0 ); +acado_copyHTH( 16, 1 ); +acado_copyHTH( 16, 2 ); +acado_copyHTH( 16, 3 ); +acado_copyHTH( 16, 4 ); +acado_copyHTH( 16, 5 ); +acado_copyHTH( 16, 6 ); +acado_copyHTH( 16, 7 ); +acado_copyHTH( 16, 8 ); +acado_copyHTH( 16, 9 ); +acado_copyHTH( 16, 10 ); +acado_copyHTH( 16, 11 ); +acado_copyHTH( 16, 12 ); +acado_copyHTH( 16, 13 ); +acado_copyHTH( 16, 14 ); +acado_copyHTH( 16, 15 ); +acado_copyHTH( 17, 0 ); +acado_copyHTH( 17, 1 ); +acado_copyHTH( 17, 2 ); +acado_copyHTH( 17, 3 ); +acado_copyHTH( 17, 4 ); +acado_copyHTH( 17, 5 ); +acado_copyHTH( 17, 6 ); +acado_copyHTH( 17, 7 ); +acado_copyHTH( 17, 8 ); +acado_copyHTH( 17, 9 ); +acado_copyHTH( 17, 10 ); +acado_copyHTH( 17, 11 ); +acado_copyHTH( 17, 12 ); +acado_copyHTH( 17, 13 ); +acado_copyHTH( 17, 14 ); +acado_copyHTH( 17, 15 ); +acado_copyHTH( 17, 16 ); +acado_copyHTH( 18, 0 ); +acado_copyHTH( 18, 1 ); +acado_copyHTH( 18, 2 ); +acado_copyHTH( 18, 3 ); +acado_copyHTH( 18, 4 ); +acado_copyHTH( 18, 5 ); +acado_copyHTH( 18, 6 ); +acado_copyHTH( 18, 7 ); +acado_copyHTH( 18, 8 ); +acado_copyHTH( 18, 9 ); +acado_copyHTH( 18, 10 ); +acado_copyHTH( 18, 11 ); +acado_copyHTH( 18, 12 ); +acado_copyHTH( 18, 13 ); +acado_copyHTH( 18, 14 ); +acado_copyHTH( 18, 15 ); +acado_copyHTH( 18, 16 ); +acado_copyHTH( 18, 17 ); +acado_copyHTH( 19, 0 ); +acado_copyHTH( 19, 1 ); +acado_copyHTH( 19, 2 ); +acado_copyHTH( 19, 3 ); +acado_copyHTH( 19, 4 ); +acado_copyHTH( 19, 5 ); +acado_copyHTH( 19, 6 ); +acado_copyHTH( 19, 7 ); +acado_copyHTH( 19, 8 ); +acado_copyHTH( 19, 9 ); +acado_copyHTH( 19, 10 ); +acado_copyHTH( 19, 11 ); +acado_copyHTH( 19, 12 ); +acado_copyHTH( 19, 13 ); +acado_copyHTH( 19, 14 ); +acado_copyHTH( 19, 15 ); +acado_copyHTH( 19, 16 ); +acado_copyHTH( 19, 17 ); +acado_copyHTH( 19, 18 ); + +acadoWorkspace.H[69] = acadoWorkspace.H10[0]; +acadoWorkspace.H[70] = acadoWorkspace.H10[1]; +acadoWorkspace.H[71] = acadoWorkspace.H10[2]; +acadoWorkspace.H[92] = acadoWorkspace.H10[3]; +acadoWorkspace.H[93] = acadoWorkspace.H10[4]; +acadoWorkspace.H[94] = acadoWorkspace.H10[5]; +acadoWorkspace.H[115] = acadoWorkspace.H10[6]; +acadoWorkspace.H[116] = acadoWorkspace.H10[7]; +acadoWorkspace.H[117] = acadoWorkspace.H10[8]; +acadoWorkspace.H[138] = acadoWorkspace.H10[9]; +acadoWorkspace.H[139] = acadoWorkspace.H10[10]; +acadoWorkspace.H[140] = acadoWorkspace.H10[11]; +acadoWorkspace.H[161] = acadoWorkspace.H10[12]; +acadoWorkspace.H[162] = acadoWorkspace.H10[13]; +acadoWorkspace.H[163] = acadoWorkspace.H10[14]; +acadoWorkspace.H[184] = acadoWorkspace.H10[15]; +acadoWorkspace.H[185] = acadoWorkspace.H10[16]; +acadoWorkspace.H[186] = acadoWorkspace.H10[17]; +acadoWorkspace.H[207] = acadoWorkspace.H10[18]; +acadoWorkspace.H[208] = acadoWorkspace.H10[19]; +acadoWorkspace.H[209] = acadoWorkspace.H10[20]; +acadoWorkspace.H[230] = acadoWorkspace.H10[21]; +acadoWorkspace.H[231] = acadoWorkspace.H10[22]; +acadoWorkspace.H[232] = acadoWorkspace.H10[23]; +acadoWorkspace.H[253] = acadoWorkspace.H10[24]; +acadoWorkspace.H[254] = acadoWorkspace.H10[25]; +acadoWorkspace.H[255] = acadoWorkspace.H10[26]; +acadoWorkspace.H[276] = acadoWorkspace.H10[27]; +acadoWorkspace.H[277] = acadoWorkspace.H10[28]; +acadoWorkspace.H[278] = acadoWorkspace.H10[29]; +acadoWorkspace.H[299] = acadoWorkspace.H10[30]; +acadoWorkspace.H[300] = acadoWorkspace.H10[31]; +acadoWorkspace.H[301] = acadoWorkspace.H10[32]; +acadoWorkspace.H[322] = acadoWorkspace.H10[33]; +acadoWorkspace.H[323] = acadoWorkspace.H10[34]; +acadoWorkspace.H[324] = acadoWorkspace.H10[35]; +acadoWorkspace.H[345] = acadoWorkspace.H10[36]; +acadoWorkspace.H[346] = acadoWorkspace.H10[37]; +acadoWorkspace.H[347] = acadoWorkspace.H10[38]; +acadoWorkspace.H[368] = acadoWorkspace.H10[39]; +acadoWorkspace.H[369] = acadoWorkspace.H10[40]; +acadoWorkspace.H[370] = acadoWorkspace.H10[41]; +acadoWorkspace.H[391] = acadoWorkspace.H10[42]; +acadoWorkspace.H[392] = acadoWorkspace.H10[43]; +acadoWorkspace.H[393] = acadoWorkspace.H10[44]; +acadoWorkspace.H[414] = acadoWorkspace.H10[45]; +acadoWorkspace.H[415] = acadoWorkspace.H10[46]; +acadoWorkspace.H[416] = acadoWorkspace.H10[47]; +acadoWorkspace.H[437] = acadoWorkspace.H10[48]; +acadoWorkspace.H[438] = acadoWorkspace.H10[49]; +acadoWorkspace.H[439] = acadoWorkspace.H10[50]; +acadoWorkspace.H[460] = acadoWorkspace.H10[51]; +acadoWorkspace.H[461] = acadoWorkspace.H10[52]; +acadoWorkspace.H[462] = acadoWorkspace.H10[53]; +acadoWorkspace.H[483] = acadoWorkspace.H10[54]; +acadoWorkspace.H[484] = acadoWorkspace.H10[55]; +acadoWorkspace.H[485] = acadoWorkspace.H10[56]; +acadoWorkspace.H[506] = acadoWorkspace.H10[57]; +acadoWorkspace.H[507] = acadoWorkspace.H10[58]; +acadoWorkspace.H[508] = acadoWorkspace.H10[59]; + +acado_multQ1d( &(acadoWorkspace.Q1[ 9 ]), acadoWorkspace.d, acadoWorkspace.Qd ); +acado_multQ1d( &(acadoWorkspace.Q1[ 18 ]), &(acadoWorkspace.d[ 3 ]), &(acadoWorkspace.Qd[ 3 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 27 ]), &(acadoWorkspace.d[ 6 ]), &(acadoWorkspace.Qd[ 6 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 36 ]), &(acadoWorkspace.d[ 9 ]), &(acadoWorkspace.Qd[ 9 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 45 ]), &(acadoWorkspace.d[ 12 ]), &(acadoWorkspace.Qd[ 12 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 54 ]), &(acadoWorkspace.d[ 15 ]), &(acadoWorkspace.Qd[ 15 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 63 ]), &(acadoWorkspace.d[ 18 ]), &(acadoWorkspace.Qd[ 18 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.d[ 21 ]), &(acadoWorkspace.Qd[ 21 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 81 ]), &(acadoWorkspace.d[ 24 ]), &(acadoWorkspace.Qd[ 24 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 90 ]), &(acadoWorkspace.d[ 27 ]), &(acadoWorkspace.Qd[ 27 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 99 ]), &(acadoWorkspace.d[ 30 ]), &(acadoWorkspace.Qd[ 30 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.d[ 33 ]), &(acadoWorkspace.Qd[ 33 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 117 ]), &(acadoWorkspace.d[ 36 ]), &(acadoWorkspace.Qd[ 36 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 126 ]), &(acadoWorkspace.d[ 39 ]), &(acadoWorkspace.Qd[ 39 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 135 ]), &(acadoWorkspace.d[ 42 ]), &(acadoWorkspace.Qd[ 42 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.d[ 45 ]), &(acadoWorkspace.Qd[ 45 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 153 ]), &(acadoWorkspace.d[ 48 ]), &(acadoWorkspace.Qd[ 48 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 162 ]), &(acadoWorkspace.d[ 51 ]), &(acadoWorkspace.Qd[ 51 ]) ); +acado_multQ1d( &(acadoWorkspace.Q1[ 171 ]), &(acadoWorkspace.d[ 54 ]), &(acadoWorkspace.Qd[ 54 ]) ); +acado_multQN1d( acadoWorkspace.QN1, &(acadoWorkspace.d[ 57 ]), &(acadoWorkspace.Qd[ 57 ]) ); + +acado_macCTSlx( acadoWorkspace.evGx, acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 9 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 18 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 27 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 36 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 45 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 54 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 63 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 72 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 81 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 90 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 99 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 108 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 117 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 126 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 135 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 144 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 153 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 162 ]), acadoWorkspace.g ); +acado_macCTSlx( &(acadoWorkspace.evGx[ 171 ]), acadoWorkspace.g ); +acado_macETSlu( acadoWorkspace.QE, &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 3 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 9 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 18 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 30 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 45 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 63 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 84 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 108 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 135 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 165 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 198 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 234 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 273 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 315 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 360 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 408 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 459 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 513 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 570 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 6 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 12 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 21 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 33 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 48 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 66 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 87 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 111 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 138 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 168 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 201 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 237 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 276 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 318 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 363 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 411 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 462 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 516 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 573 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 15 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 24 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 36 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 51 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 69 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 90 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 114 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 141 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 171 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 204 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 240 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 279 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 321 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 366 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 414 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 465 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 519 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 576 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 27 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 39 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 54 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 72 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 93 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 117 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 144 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 174 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 207 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 243 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 282 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 324 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 369 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 417 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 468 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 522 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 579 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 42 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 57 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 75 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 96 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 120 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 147 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 177 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 210 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 246 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 285 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 327 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 372 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 420 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 471 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 525 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 582 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 60 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 78 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 99 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 123 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 150 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 180 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 213 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 249 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 288 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 330 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 375 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 423 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 474 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 528 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 585 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 81 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 102 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 126 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 153 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 183 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 216 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 252 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 291 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 333 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 378 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 426 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 477 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 531 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 588 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 105 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 129 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 156 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 186 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 219 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 255 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 294 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 336 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 381 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 429 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 480 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 534 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 591 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 132 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 159 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 189 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 222 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 258 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 297 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 339 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 384 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 432 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 483 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 537 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 594 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 162 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 192 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 225 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 261 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 300 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 342 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 387 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 435 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 486 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 540 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 597 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 195 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 228 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 264 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 303 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 345 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 390 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 438 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 489 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 543 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 600 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 231 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 267 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 306 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 348 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 393 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 441 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 492 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 546 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 603 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 270 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 309 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 351 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 396 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 444 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 495 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 549 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 606 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 312 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 354 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 399 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 447 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 498 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 552 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 609 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 357 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 402 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 450 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 501 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 555 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 612 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 405 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 453 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 504 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 558 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 615 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 456 ]), &(acadoWorkspace.g[ 19 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 507 ]), &(acadoWorkspace.g[ 19 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 561 ]), &(acadoWorkspace.g[ 19 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 618 ]), &(acadoWorkspace.g[ 19 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 510 ]), &(acadoWorkspace.g[ 20 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 564 ]), &(acadoWorkspace.g[ 20 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 621 ]), &(acadoWorkspace.g[ 20 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 567 ]), &(acadoWorkspace.g[ 21 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 624 ]), &(acadoWorkspace.g[ 21 ]) ); +acado_macETSlu( &(acadoWorkspace.QE[ 627 ]), &(acadoWorkspace.g[ 22 ]) ); +acadoWorkspace.lb[3] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[0]; +acadoWorkspace.lb[4] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[1]; +acadoWorkspace.lb[5] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[2]; +acadoWorkspace.lb[6] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[3]; +acadoWorkspace.lb[7] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[4]; +acadoWorkspace.lb[8] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[5]; +acadoWorkspace.lb[9] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[6]; +acadoWorkspace.lb[10] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[7]; +acadoWorkspace.lb[11] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[8]; +acadoWorkspace.lb[12] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[9]; +acadoWorkspace.lb[13] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[10]; +acadoWorkspace.lb[14] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[11]; +acadoWorkspace.lb[15] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[12]; +acadoWorkspace.lb[16] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[13]; +acadoWorkspace.lb[17] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[14]; +acadoWorkspace.lb[18] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[15]; +acadoWorkspace.lb[19] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[16]; +acadoWorkspace.lb[20] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[17]; +acadoWorkspace.lb[21] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[18]; +acadoWorkspace.lb[22] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[19]; +acadoWorkspace.ub[3] = (real_t)1.0000000000000000e+12 - acadoVariables.u[0]; +acadoWorkspace.ub[4] = (real_t)1.0000000000000000e+12 - acadoVariables.u[1]; +acadoWorkspace.ub[5] = (real_t)1.0000000000000000e+12 - acadoVariables.u[2]; +acadoWorkspace.ub[6] = (real_t)1.0000000000000000e+12 - acadoVariables.u[3]; +acadoWorkspace.ub[7] = (real_t)1.0000000000000000e+12 - acadoVariables.u[4]; +acadoWorkspace.ub[8] = (real_t)1.0000000000000000e+12 - acadoVariables.u[5]; +acadoWorkspace.ub[9] = (real_t)1.0000000000000000e+12 - acadoVariables.u[6]; +acadoWorkspace.ub[10] = (real_t)1.0000000000000000e+12 - acadoVariables.u[7]; +acadoWorkspace.ub[11] = (real_t)1.0000000000000000e+12 - acadoVariables.u[8]; +acadoWorkspace.ub[12] = (real_t)1.0000000000000000e+12 - acadoVariables.u[9]; +acadoWorkspace.ub[13] = (real_t)1.0000000000000000e+12 - acadoVariables.u[10]; +acadoWorkspace.ub[14] = (real_t)1.0000000000000000e+12 - acadoVariables.u[11]; +acadoWorkspace.ub[15] = (real_t)1.0000000000000000e+12 - acadoVariables.u[12]; +acadoWorkspace.ub[16] = (real_t)1.0000000000000000e+12 - acadoVariables.u[13]; +acadoWorkspace.ub[17] = (real_t)1.0000000000000000e+12 - acadoVariables.u[14]; +acadoWorkspace.ub[18] = (real_t)1.0000000000000000e+12 - acadoVariables.u[15]; +acadoWorkspace.ub[19] = (real_t)1.0000000000000000e+12 - acadoVariables.u[16]; +acadoWorkspace.ub[20] = (real_t)1.0000000000000000e+12 - acadoVariables.u[17]; +acadoWorkspace.ub[21] = (real_t)1.0000000000000000e+12 - acadoVariables.u[18]; +acadoWorkspace.ub[22] = (real_t)1.0000000000000000e+12 - acadoVariables.u[19]; + +for (lRun1 = 0; lRun1 < 20; ++lRun1) +{ +lRun3 = xBoundIndices[ lRun1 ] - 3; +lRun4 = ((lRun3) / (3)) + (1); +acadoWorkspace.A[lRun1 * 23] = acadoWorkspace.evGx[lRun3 * 3]; +acadoWorkspace.A[lRun1 * 23 + 1] = acadoWorkspace.evGx[lRun3 * 3 + 1]; +acadoWorkspace.A[lRun1 * 23 + 2] = acadoWorkspace.evGx[lRun3 * 3 + 2]; +for (lRun2 = 0; lRun2 < lRun4; ++lRun2) +{ +lRun5 = (((((lRun4) * (lRun4-1)) / (2)) + (lRun2)) * (3)) + ((lRun3) % (3)); +acadoWorkspace.A[(lRun1 * 23) + (lRun2 + 3)] = acadoWorkspace.E[lRun5]; +} +} + +} + +void acado_condenseFdb( ) +{ +real_t tmp; + +acadoWorkspace.Dx0[0] = acadoVariables.x0[0] - acadoVariables.x[0]; +acadoWorkspace.Dx0[1] = acadoVariables.x0[1] - acadoVariables.x[1]; +acadoWorkspace.Dx0[2] = acadoVariables.x0[2] - acadoVariables.x[2]; + +acadoWorkspace.Dy[0] -= acadoVariables.y[0]; +acadoWorkspace.Dy[1] -= acadoVariables.y[1]; +acadoWorkspace.Dy[2] -= acadoVariables.y[2]; +acadoWorkspace.Dy[3] -= acadoVariables.y[3]; +acadoWorkspace.Dy[4] -= acadoVariables.y[4]; +acadoWorkspace.Dy[5] -= acadoVariables.y[5]; +acadoWorkspace.Dy[6] -= acadoVariables.y[6]; +acadoWorkspace.Dy[7] -= acadoVariables.y[7]; +acadoWorkspace.Dy[8] -= acadoVariables.y[8]; +acadoWorkspace.Dy[9] -= acadoVariables.y[9]; +acadoWorkspace.Dy[10] -= acadoVariables.y[10]; +acadoWorkspace.Dy[11] -= acadoVariables.y[11]; +acadoWorkspace.Dy[12] -= acadoVariables.y[12]; +acadoWorkspace.Dy[13] -= acadoVariables.y[13]; +acadoWorkspace.Dy[14] -= acadoVariables.y[14]; +acadoWorkspace.Dy[15] -= acadoVariables.y[15]; +acadoWorkspace.Dy[16] -= acadoVariables.y[16]; +acadoWorkspace.Dy[17] -= acadoVariables.y[17]; +acadoWorkspace.Dy[18] -= acadoVariables.y[18]; +acadoWorkspace.Dy[19] -= acadoVariables.y[19]; +acadoWorkspace.Dy[20] -= acadoVariables.y[20]; +acadoWorkspace.Dy[21] -= acadoVariables.y[21]; +acadoWorkspace.Dy[22] -= acadoVariables.y[22]; +acadoWorkspace.Dy[23] -= acadoVariables.y[23]; +acadoWorkspace.Dy[24] -= acadoVariables.y[24]; +acadoWorkspace.Dy[25] -= acadoVariables.y[25]; +acadoWorkspace.Dy[26] -= acadoVariables.y[26]; +acadoWorkspace.Dy[27] -= acadoVariables.y[27]; +acadoWorkspace.Dy[28] -= acadoVariables.y[28]; +acadoWorkspace.Dy[29] -= acadoVariables.y[29]; +acadoWorkspace.Dy[30] -= acadoVariables.y[30]; +acadoWorkspace.Dy[31] -= acadoVariables.y[31]; +acadoWorkspace.Dy[32] -= acadoVariables.y[32]; +acadoWorkspace.Dy[33] -= acadoVariables.y[33]; +acadoWorkspace.Dy[34] -= acadoVariables.y[34]; +acadoWorkspace.Dy[35] -= acadoVariables.y[35]; +acadoWorkspace.Dy[36] -= acadoVariables.y[36]; +acadoWorkspace.Dy[37] -= acadoVariables.y[37]; +acadoWorkspace.Dy[38] -= acadoVariables.y[38]; +acadoWorkspace.Dy[39] -= acadoVariables.y[39]; +acadoWorkspace.Dy[40] -= acadoVariables.y[40]; +acadoWorkspace.Dy[41] -= acadoVariables.y[41]; +acadoWorkspace.Dy[42] -= acadoVariables.y[42]; +acadoWorkspace.Dy[43] -= acadoVariables.y[43]; +acadoWorkspace.Dy[44] -= acadoVariables.y[44]; +acadoWorkspace.Dy[45] -= acadoVariables.y[45]; +acadoWorkspace.Dy[46] -= acadoVariables.y[46]; +acadoWorkspace.Dy[47] -= acadoVariables.y[47]; +acadoWorkspace.Dy[48] -= acadoVariables.y[48]; +acadoWorkspace.Dy[49] -= acadoVariables.y[49]; +acadoWorkspace.Dy[50] -= acadoVariables.y[50]; +acadoWorkspace.Dy[51] -= acadoVariables.y[51]; +acadoWorkspace.Dy[52] -= acadoVariables.y[52]; +acadoWorkspace.Dy[53] -= acadoVariables.y[53]; +acadoWorkspace.Dy[54] -= acadoVariables.y[54]; +acadoWorkspace.Dy[55] -= acadoVariables.y[55]; +acadoWorkspace.Dy[56] -= acadoVariables.y[56]; +acadoWorkspace.Dy[57] -= acadoVariables.y[57]; +acadoWorkspace.Dy[58] -= acadoVariables.y[58]; +acadoWorkspace.Dy[59] -= acadoVariables.y[59]; +acadoWorkspace.Dy[60] -= acadoVariables.y[60]; +acadoWorkspace.Dy[61] -= acadoVariables.y[61]; +acadoWorkspace.Dy[62] -= acadoVariables.y[62]; +acadoWorkspace.Dy[63] -= acadoVariables.y[63]; +acadoWorkspace.Dy[64] -= acadoVariables.y[64]; +acadoWorkspace.Dy[65] -= acadoVariables.y[65]; +acadoWorkspace.Dy[66] -= acadoVariables.y[66]; +acadoWorkspace.Dy[67] -= acadoVariables.y[67]; +acadoWorkspace.Dy[68] -= acadoVariables.y[68]; +acadoWorkspace.Dy[69] -= acadoVariables.y[69]; +acadoWorkspace.Dy[70] -= acadoVariables.y[70]; +acadoWorkspace.Dy[71] -= acadoVariables.y[71]; +acadoWorkspace.Dy[72] -= acadoVariables.y[72]; +acadoWorkspace.Dy[73] -= acadoVariables.y[73]; +acadoWorkspace.Dy[74] -= acadoVariables.y[74]; +acadoWorkspace.Dy[75] -= acadoVariables.y[75]; +acadoWorkspace.Dy[76] -= acadoVariables.y[76]; +acadoWorkspace.Dy[77] -= acadoVariables.y[77]; +acadoWorkspace.Dy[78] -= acadoVariables.y[78]; +acadoWorkspace.Dy[79] -= acadoVariables.y[79]; +acadoWorkspace.DyN[0] -= acadoVariables.yN[0]; +acadoWorkspace.DyN[1] -= acadoVariables.yN[1]; +acadoWorkspace.DyN[2] -= acadoVariables.yN[2]; + +acado_multRDy( acadoWorkspace.R2, acadoWorkspace.Dy, &(acadoWorkspace.g[ 3 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 4 ]), &(acadoWorkspace.Dy[ 4 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 8 ]), &(acadoWorkspace.Dy[ 8 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 12 ]), &(acadoWorkspace.Dy[ 12 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 16 ]), &(acadoWorkspace.Dy[ 16 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 20 ]), &(acadoWorkspace.Dy[ 20 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 24 ]), &(acadoWorkspace.Dy[ 24 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 28 ]), &(acadoWorkspace.Dy[ 28 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 32 ]), &(acadoWorkspace.Dy[ 32 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 36 ]), &(acadoWorkspace.Dy[ 36 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 40 ]), &(acadoWorkspace.Dy[ 40 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 44 ]), &(acadoWorkspace.Dy[ 44 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 48 ]), &(acadoWorkspace.Dy[ 48 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 52 ]), &(acadoWorkspace.Dy[ 52 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 56 ]), &(acadoWorkspace.Dy[ 56 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 60 ]), &(acadoWorkspace.Dy[ 60 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 64 ]), &(acadoWorkspace.Dy[ 64 ]), &(acadoWorkspace.g[ 19 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 68 ]), &(acadoWorkspace.Dy[ 68 ]), &(acadoWorkspace.g[ 20 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 72 ]), &(acadoWorkspace.Dy[ 72 ]), &(acadoWorkspace.g[ 21 ]) ); +acado_multRDy( &(acadoWorkspace.R2[ 76 ]), &(acadoWorkspace.Dy[ 76 ]), &(acadoWorkspace.g[ 22 ]) ); + +acado_multQDy( acadoWorkspace.Q2, acadoWorkspace.Dy, acadoWorkspace.QDy ); +acado_multQDy( &(acadoWorkspace.Q2[ 12 ]), &(acadoWorkspace.Dy[ 4 ]), &(acadoWorkspace.QDy[ 3 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 24 ]), &(acadoWorkspace.Dy[ 8 ]), &(acadoWorkspace.QDy[ 6 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 36 ]), &(acadoWorkspace.Dy[ 12 ]), &(acadoWorkspace.QDy[ 9 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 48 ]), &(acadoWorkspace.Dy[ 16 ]), &(acadoWorkspace.QDy[ 12 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 60 ]), &(acadoWorkspace.Dy[ 20 ]), &(acadoWorkspace.QDy[ 15 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 72 ]), &(acadoWorkspace.Dy[ 24 ]), &(acadoWorkspace.QDy[ 18 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 84 ]), &(acadoWorkspace.Dy[ 28 ]), &(acadoWorkspace.QDy[ 21 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 96 ]), &(acadoWorkspace.Dy[ 32 ]), &(acadoWorkspace.QDy[ 24 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 108 ]), &(acadoWorkspace.Dy[ 36 ]), &(acadoWorkspace.QDy[ 27 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 120 ]), &(acadoWorkspace.Dy[ 40 ]), &(acadoWorkspace.QDy[ 30 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 132 ]), &(acadoWorkspace.Dy[ 44 ]), &(acadoWorkspace.QDy[ 33 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 144 ]), &(acadoWorkspace.Dy[ 48 ]), &(acadoWorkspace.QDy[ 36 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 156 ]), &(acadoWorkspace.Dy[ 52 ]), &(acadoWorkspace.QDy[ 39 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 168 ]), &(acadoWorkspace.Dy[ 56 ]), &(acadoWorkspace.QDy[ 42 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 180 ]), &(acadoWorkspace.Dy[ 60 ]), &(acadoWorkspace.QDy[ 45 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 192 ]), &(acadoWorkspace.Dy[ 64 ]), &(acadoWorkspace.QDy[ 48 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 204 ]), &(acadoWorkspace.Dy[ 68 ]), &(acadoWorkspace.QDy[ 51 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 216 ]), &(acadoWorkspace.Dy[ 72 ]), &(acadoWorkspace.QDy[ 54 ]) ); +acado_multQDy( &(acadoWorkspace.Q2[ 228 ]), &(acadoWorkspace.Dy[ 76 ]), &(acadoWorkspace.QDy[ 57 ]) ); + +acadoWorkspace.QDy[60] = + acadoWorkspace.QN2[0]*acadoWorkspace.DyN[0] + acadoWorkspace.QN2[1]*acadoWorkspace.DyN[1] + acadoWorkspace.QN2[2]*acadoWorkspace.DyN[2]; +acadoWorkspace.QDy[61] = + acadoWorkspace.QN2[3]*acadoWorkspace.DyN[0] + acadoWorkspace.QN2[4]*acadoWorkspace.DyN[1] + acadoWorkspace.QN2[5]*acadoWorkspace.DyN[2]; +acadoWorkspace.QDy[62] = + acadoWorkspace.QN2[6]*acadoWorkspace.DyN[0] + acadoWorkspace.QN2[7]*acadoWorkspace.DyN[1] + acadoWorkspace.QN2[8]*acadoWorkspace.DyN[2]; + +acadoWorkspace.QDy[3] += acadoWorkspace.Qd[0]; +acadoWorkspace.QDy[4] += acadoWorkspace.Qd[1]; +acadoWorkspace.QDy[5] += acadoWorkspace.Qd[2]; +acadoWorkspace.QDy[6] += acadoWorkspace.Qd[3]; +acadoWorkspace.QDy[7] += acadoWorkspace.Qd[4]; +acadoWorkspace.QDy[8] += acadoWorkspace.Qd[5]; +acadoWorkspace.QDy[9] += acadoWorkspace.Qd[6]; +acadoWorkspace.QDy[10] += acadoWorkspace.Qd[7]; +acadoWorkspace.QDy[11] += acadoWorkspace.Qd[8]; +acadoWorkspace.QDy[12] += acadoWorkspace.Qd[9]; +acadoWorkspace.QDy[13] += acadoWorkspace.Qd[10]; +acadoWorkspace.QDy[14] += acadoWorkspace.Qd[11]; +acadoWorkspace.QDy[15] += acadoWorkspace.Qd[12]; +acadoWorkspace.QDy[16] += acadoWorkspace.Qd[13]; +acadoWorkspace.QDy[17] += acadoWorkspace.Qd[14]; +acadoWorkspace.QDy[18] += acadoWorkspace.Qd[15]; +acadoWorkspace.QDy[19] += acadoWorkspace.Qd[16]; +acadoWorkspace.QDy[20] += acadoWorkspace.Qd[17]; +acadoWorkspace.QDy[21] += acadoWorkspace.Qd[18]; +acadoWorkspace.QDy[22] += acadoWorkspace.Qd[19]; +acadoWorkspace.QDy[23] += acadoWorkspace.Qd[20]; +acadoWorkspace.QDy[24] += acadoWorkspace.Qd[21]; +acadoWorkspace.QDy[25] += acadoWorkspace.Qd[22]; +acadoWorkspace.QDy[26] += acadoWorkspace.Qd[23]; +acadoWorkspace.QDy[27] += acadoWorkspace.Qd[24]; +acadoWorkspace.QDy[28] += acadoWorkspace.Qd[25]; +acadoWorkspace.QDy[29] += acadoWorkspace.Qd[26]; +acadoWorkspace.QDy[30] += acadoWorkspace.Qd[27]; +acadoWorkspace.QDy[31] += acadoWorkspace.Qd[28]; +acadoWorkspace.QDy[32] += acadoWorkspace.Qd[29]; +acadoWorkspace.QDy[33] += acadoWorkspace.Qd[30]; +acadoWorkspace.QDy[34] += acadoWorkspace.Qd[31]; +acadoWorkspace.QDy[35] += acadoWorkspace.Qd[32]; +acadoWorkspace.QDy[36] += acadoWorkspace.Qd[33]; +acadoWorkspace.QDy[37] += acadoWorkspace.Qd[34]; +acadoWorkspace.QDy[38] += acadoWorkspace.Qd[35]; +acadoWorkspace.QDy[39] += acadoWorkspace.Qd[36]; +acadoWorkspace.QDy[40] += acadoWorkspace.Qd[37]; +acadoWorkspace.QDy[41] += acadoWorkspace.Qd[38]; +acadoWorkspace.QDy[42] += acadoWorkspace.Qd[39]; +acadoWorkspace.QDy[43] += acadoWorkspace.Qd[40]; +acadoWorkspace.QDy[44] += acadoWorkspace.Qd[41]; +acadoWorkspace.QDy[45] += acadoWorkspace.Qd[42]; +acadoWorkspace.QDy[46] += acadoWorkspace.Qd[43]; +acadoWorkspace.QDy[47] += acadoWorkspace.Qd[44]; +acadoWorkspace.QDy[48] += acadoWorkspace.Qd[45]; +acadoWorkspace.QDy[49] += acadoWorkspace.Qd[46]; +acadoWorkspace.QDy[50] += acadoWorkspace.Qd[47]; +acadoWorkspace.QDy[51] += acadoWorkspace.Qd[48]; +acadoWorkspace.QDy[52] += acadoWorkspace.Qd[49]; +acadoWorkspace.QDy[53] += acadoWorkspace.Qd[50]; +acadoWorkspace.QDy[54] += acadoWorkspace.Qd[51]; +acadoWorkspace.QDy[55] += acadoWorkspace.Qd[52]; +acadoWorkspace.QDy[56] += acadoWorkspace.Qd[53]; +acadoWorkspace.QDy[57] += acadoWorkspace.Qd[54]; +acadoWorkspace.QDy[58] += acadoWorkspace.Qd[55]; +acadoWorkspace.QDy[59] += acadoWorkspace.Qd[56]; +acadoWorkspace.QDy[60] += acadoWorkspace.Qd[57]; +acadoWorkspace.QDy[61] += acadoWorkspace.Qd[58]; +acadoWorkspace.QDy[62] += acadoWorkspace.Qd[59]; + +acadoWorkspace.g[0] = + acadoWorkspace.evGx[0]*acadoWorkspace.QDy[3] + acadoWorkspace.evGx[3]*acadoWorkspace.QDy[4] + acadoWorkspace.evGx[6]*acadoWorkspace.QDy[5] + acadoWorkspace.evGx[9]*acadoWorkspace.QDy[6] + acadoWorkspace.evGx[12]*acadoWorkspace.QDy[7] + acadoWorkspace.evGx[15]*acadoWorkspace.QDy[8] + acadoWorkspace.evGx[18]*acadoWorkspace.QDy[9] + acadoWorkspace.evGx[21]*acadoWorkspace.QDy[10] + acadoWorkspace.evGx[24]*acadoWorkspace.QDy[11] + acadoWorkspace.evGx[27]*acadoWorkspace.QDy[12] + acadoWorkspace.evGx[30]*acadoWorkspace.QDy[13] + acadoWorkspace.evGx[33]*acadoWorkspace.QDy[14] + acadoWorkspace.evGx[36]*acadoWorkspace.QDy[15] + acadoWorkspace.evGx[39]*acadoWorkspace.QDy[16] + acadoWorkspace.evGx[42]*acadoWorkspace.QDy[17] + acadoWorkspace.evGx[45]*acadoWorkspace.QDy[18] + acadoWorkspace.evGx[48]*acadoWorkspace.QDy[19] + acadoWorkspace.evGx[51]*acadoWorkspace.QDy[20] + acadoWorkspace.evGx[54]*acadoWorkspace.QDy[21] + acadoWorkspace.evGx[57]*acadoWorkspace.QDy[22] + acadoWorkspace.evGx[60]*acadoWorkspace.QDy[23] + acadoWorkspace.evGx[63]*acadoWorkspace.QDy[24] + acadoWorkspace.evGx[66]*acadoWorkspace.QDy[25] + acadoWorkspace.evGx[69]*acadoWorkspace.QDy[26] + acadoWorkspace.evGx[72]*acadoWorkspace.QDy[27] + acadoWorkspace.evGx[75]*acadoWorkspace.QDy[28] + acadoWorkspace.evGx[78]*acadoWorkspace.QDy[29] + acadoWorkspace.evGx[81]*acadoWorkspace.QDy[30] + acadoWorkspace.evGx[84]*acadoWorkspace.QDy[31] + acadoWorkspace.evGx[87]*acadoWorkspace.QDy[32] + acadoWorkspace.evGx[90]*acadoWorkspace.QDy[33] + acadoWorkspace.evGx[93]*acadoWorkspace.QDy[34] + acadoWorkspace.evGx[96]*acadoWorkspace.QDy[35] + acadoWorkspace.evGx[99]*acadoWorkspace.QDy[36] + acadoWorkspace.evGx[102]*acadoWorkspace.QDy[37] + acadoWorkspace.evGx[105]*acadoWorkspace.QDy[38] + acadoWorkspace.evGx[108]*acadoWorkspace.QDy[39] + acadoWorkspace.evGx[111]*acadoWorkspace.QDy[40] + acadoWorkspace.evGx[114]*acadoWorkspace.QDy[41] + acadoWorkspace.evGx[117]*acadoWorkspace.QDy[42] + acadoWorkspace.evGx[120]*acadoWorkspace.QDy[43] + acadoWorkspace.evGx[123]*acadoWorkspace.QDy[44] + acadoWorkspace.evGx[126]*acadoWorkspace.QDy[45] + acadoWorkspace.evGx[129]*acadoWorkspace.QDy[46] + acadoWorkspace.evGx[132]*acadoWorkspace.QDy[47] + acadoWorkspace.evGx[135]*acadoWorkspace.QDy[48] + acadoWorkspace.evGx[138]*acadoWorkspace.QDy[49] + acadoWorkspace.evGx[141]*acadoWorkspace.QDy[50] + acadoWorkspace.evGx[144]*acadoWorkspace.QDy[51] + acadoWorkspace.evGx[147]*acadoWorkspace.QDy[52] + acadoWorkspace.evGx[150]*acadoWorkspace.QDy[53] + acadoWorkspace.evGx[153]*acadoWorkspace.QDy[54] + acadoWorkspace.evGx[156]*acadoWorkspace.QDy[55] + acadoWorkspace.evGx[159]*acadoWorkspace.QDy[56] + acadoWorkspace.evGx[162]*acadoWorkspace.QDy[57] + acadoWorkspace.evGx[165]*acadoWorkspace.QDy[58] + acadoWorkspace.evGx[168]*acadoWorkspace.QDy[59] + acadoWorkspace.evGx[171]*acadoWorkspace.QDy[60] + acadoWorkspace.evGx[174]*acadoWorkspace.QDy[61] + acadoWorkspace.evGx[177]*acadoWorkspace.QDy[62]; +acadoWorkspace.g[1] = + acadoWorkspace.evGx[1]*acadoWorkspace.QDy[3] + acadoWorkspace.evGx[4]*acadoWorkspace.QDy[4] + acadoWorkspace.evGx[7]*acadoWorkspace.QDy[5] + acadoWorkspace.evGx[10]*acadoWorkspace.QDy[6] + acadoWorkspace.evGx[13]*acadoWorkspace.QDy[7] + acadoWorkspace.evGx[16]*acadoWorkspace.QDy[8] + acadoWorkspace.evGx[19]*acadoWorkspace.QDy[9] + acadoWorkspace.evGx[22]*acadoWorkspace.QDy[10] + acadoWorkspace.evGx[25]*acadoWorkspace.QDy[11] + acadoWorkspace.evGx[28]*acadoWorkspace.QDy[12] + acadoWorkspace.evGx[31]*acadoWorkspace.QDy[13] + acadoWorkspace.evGx[34]*acadoWorkspace.QDy[14] + acadoWorkspace.evGx[37]*acadoWorkspace.QDy[15] + acadoWorkspace.evGx[40]*acadoWorkspace.QDy[16] + acadoWorkspace.evGx[43]*acadoWorkspace.QDy[17] + acadoWorkspace.evGx[46]*acadoWorkspace.QDy[18] + acadoWorkspace.evGx[49]*acadoWorkspace.QDy[19] + acadoWorkspace.evGx[52]*acadoWorkspace.QDy[20] + acadoWorkspace.evGx[55]*acadoWorkspace.QDy[21] + acadoWorkspace.evGx[58]*acadoWorkspace.QDy[22] + acadoWorkspace.evGx[61]*acadoWorkspace.QDy[23] + acadoWorkspace.evGx[64]*acadoWorkspace.QDy[24] + acadoWorkspace.evGx[67]*acadoWorkspace.QDy[25] + acadoWorkspace.evGx[70]*acadoWorkspace.QDy[26] + acadoWorkspace.evGx[73]*acadoWorkspace.QDy[27] + acadoWorkspace.evGx[76]*acadoWorkspace.QDy[28] + acadoWorkspace.evGx[79]*acadoWorkspace.QDy[29] + acadoWorkspace.evGx[82]*acadoWorkspace.QDy[30] + acadoWorkspace.evGx[85]*acadoWorkspace.QDy[31] + acadoWorkspace.evGx[88]*acadoWorkspace.QDy[32] + acadoWorkspace.evGx[91]*acadoWorkspace.QDy[33] + acadoWorkspace.evGx[94]*acadoWorkspace.QDy[34] + acadoWorkspace.evGx[97]*acadoWorkspace.QDy[35] + acadoWorkspace.evGx[100]*acadoWorkspace.QDy[36] + acadoWorkspace.evGx[103]*acadoWorkspace.QDy[37] + acadoWorkspace.evGx[106]*acadoWorkspace.QDy[38] + acadoWorkspace.evGx[109]*acadoWorkspace.QDy[39] + acadoWorkspace.evGx[112]*acadoWorkspace.QDy[40] + acadoWorkspace.evGx[115]*acadoWorkspace.QDy[41] + acadoWorkspace.evGx[118]*acadoWorkspace.QDy[42] + acadoWorkspace.evGx[121]*acadoWorkspace.QDy[43] + acadoWorkspace.evGx[124]*acadoWorkspace.QDy[44] + acadoWorkspace.evGx[127]*acadoWorkspace.QDy[45] + acadoWorkspace.evGx[130]*acadoWorkspace.QDy[46] + acadoWorkspace.evGx[133]*acadoWorkspace.QDy[47] + acadoWorkspace.evGx[136]*acadoWorkspace.QDy[48] + acadoWorkspace.evGx[139]*acadoWorkspace.QDy[49] + acadoWorkspace.evGx[142]*acadoWorkspace.QDy[50] + acadoWorkspace.evGx[145]*acadoWorkspace.QDy[51] + acadoWorkspace.evGx[148]*acadoWorkspace.QDy[52] + acadoWorkspace.evGx[151]*acadoWorkspace.QDy[53] + acadoWorkspace.evGx[154]*acadoWorkspace.QDy[54] + acadoWorkspace.evGx[157]*acadoWorkspace.QDy[55] + acadoWorkspace.evGx[160]*acadoWorkspace.QDy[56] + acadoWorkspace.evGx[163]*acadoWorkspace.QDy[57] + acadoWorkspace.evGx[166]*acadoWorkspace.QDy[58] + acadoWorkspace.evGx[169]*acadoWorkspace.QDy[59] + acadoWorkspace.evGx[172]*acadoWorkspace.QDy[60] + acadoWorkspace.evGx[175]*acadoWorkspace.QDy[61] + acadoWorkspace.evGx[178]*acadoWorkspace.QDy[62]; +acadoWorkspace.g[2] = + acadoWorkspace.evGx[2]*acadoWorkspace.QDy[3] + acadoWorkspace.evGx[5]*acadoWorkspace.QDy[4] + acadoWorkspace.evGx[8]*acadoWorkspace.QDy[5] + acadoWorkspace.evGx[11]*acadoWorkspace.QDy[6] + acadoWorkspace.evGx[14]*acadoWorkspace.QDy[7] + acadoWorkspace.evGx[17]*acadoWorkspace.QDy[8] + acadoWorkspace.evGx[20]*acadoWorkspace.QDy[9] + acadoWorkspace.evGx[23]*acadoWorkspace.QDy[10] + acadoWorkspace.evGx[26]*acadoWorkspace.QDy[11] + acadoWorkspace.evGx[29]*acadoWorkspace.QDy[12] + acadoWorkspace.evGx[32]*acadoWorkspace.QDy[13] + acadoWorkspace.evGx[35]*acadoWorkspace.QDy[14] + acadoWorkspace.evGx[38]*acadoWorkspace.QDy[15] + acadoWorkspace.evGx[41]*acadoWorkspace.QDy[16] + acadoWorkspace.evGx[44]*acadoWorkspace.QDy[17] + acadoWorkspace.evGx[47]*acadoWorkspace.QDy[18] + acadoWorkspace.evGx[50]*acadoWorkspace.QDy[19] + acadoWorkspace.evGx[53]*acadoWorkspace.QDy[20] + acadoWorkspace.evGx[56]*acadoWorkspace.QDy[21] + acadoWorkspace.evGx[59]*acadoWorkspace.QDy[22] + acadoWorkspace.evGx[62]*acadoWorkspace.QDy[23] + acadoWorkspace.evGx[65]*acadoWorkspace.QDy[24] + acadoWorkspace.evGx[68]*acadoWorkspace.QDy[25] + acadoWorkspace.evGx[71]*acadoWorkspace.QDy[26] + acadoWorkspace.evGx[74]*acadoWorkspace.QDy[27] + acadoWorkspace.evGx[77]*acadoWorkspace.QDy[28] + acadoWorkspace.evGx[80]*acadoWorkspace.QDy[29] + acadoWorkspace.evGx[83]*acadoWorkspace.QDy[30] + acadoWorkspace.evGx[86]*acadoWorkspace.QDy[31] + acadoWorkspace.evGx[89]*acadoWorkspace.QDy[32] + acadoWorkspace.evGx[92]*acadoWorkspace.QDy[33] + acadoWorkspace.evGx[95]*acadoWorkspace.QDy[34] + acadoWorkspace.evGx[98]*acadoWorkspace.QDy[35] + acadoWorkspace.evGx[101]*acadoWorkspace.QDy[36] + acadoWorkspace.evGx[104]*acadoWorkspace.QDy[37] + acadoWorkspace.evGx[107]*acadoWorkspace.QDy[38] + acadoWorkspace.evGx[110]*acadoWorkspace.QDy[39] + acadoWorkspace.evGx[113]*acadoWorkspace.QDy[40] + acadoWorkspace.evGx[116]*acadoWorkspace.QDy[41] + acadoWorkspace.evGx[119]*acadoWorkspace.QDy[42] + acadoWorkspace.evGx[122]*acadoWorkspace.QDy[43] + acadoWorkspace.evGx[125]*acadoWorkspace.QDy[44] + acadoWorkspace.evGx[128]*acadoWorkspace.QDy[45] + acadoWorkspace.evGx[131]*acadoWorkspace.QDy[46] + acadoWorkspace.evGx[134]*acadoWorkspace.QDy[47] + acadoWorkspace.evGx[137]*acadoWorkspace.QDy[48] + acadoWorkspace.evGx[140]*acadoWorkspace.QDy[49] + acadoWorkspace.evGx[143]*acadoWorkspace.QDy[50] + acadoWorkspace.evGx[146]*acadoWorkspace.QDy[51] + acadoWorkspace.evGx[149]*acadoWorkspace.QDy[52] + acadoWorkspace.evGx[152]*acadoWorkspace.QDy[53] + acadoWorkspace.evGx[155]*acadoWorkspace.QDy[54] + acadoWorkspace.evGx[158]*acadoWorkspace.QDy[55] + acadoWorkspace.evGx[161]*acadoWorkspace.QDy[56] + acadoWorkspace.evGx[164]*acadoWorkspace.QDy[57] + acadoWorkspace.evGx[167]*acadoWorkspace.QDy[58] + acadoWorkspace.evGx[170]*acadoWorkspace.QDy[59] + acadoWorkspace.evGx[173]*acadoWorkspace.QDy[60] + acadoWorkspace.evGx[176]*acadoWorkspace.QDy[61] + acadoWorkspace.evGx[179]*acadoWorkspace.QDy[62]; + + +acado_multEQDy( acadoWorkspace.E, &(acadoWorkspace.QDy[ 3 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 3 ]), &(acadoWorkspace.QDy[ 6 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 9 ]), &(acadoWorkspace.QDy[ 9 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QDy[ 12 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QDy[ 15 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.QDy[ 18 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.QDy[ 21 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QDy[ 27 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 3 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.QDy[ 6 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.QDy[ 9 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 21 ]), &(acadoWorkspace.QDy[ 12 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 33 ]), &(acadoWorkspace.QDy[ 15 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QDy[ 18 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QDy[ 21 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.QDy[ 27 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 4 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 15 ]), &(acadoWorkspace.QDy[ 9 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.QDy[ 12 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QDy[ 15 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 51 ]), &(acadoWorkspace.QDy[ 18 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 69 ]), &(acadoWorkspace.QDy[ 21 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QDy[ 27 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 5 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 27 ]), &(acadoWorkspace.QDy[ 12 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 39 ]), &(acadoWorkspace.QDy[ 15 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.QDy[ 18 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QDy[ 21 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 93 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.QDy[ 27 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 6 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.QDy[ 15 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 57 ]), &(acadoWorkspace.QDy[ 18 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 75 ]), &(acadoWorkspace.QDy[ 21 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QDy[ 27 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 7 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QDy[ 18 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.QDy[ 21 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 99 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 123 ]), &(acadoWorkspace.QDy[ 27 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 8 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 81 ]), &(acadoWorkspace.QDy[ 21 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QDy[ 27 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 153 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 183 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 9 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 105 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 129 ]), &(acadoWorkspace.QDy[ 27 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 219 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 10 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QDy[ 27 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 159 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 189 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 11 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 225 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 261 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 12 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 195 ]), &(acadoWorkspace.QDy[ 33 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 303 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 345 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 13 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 231 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 267 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 393 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 14 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QDy[ 39 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 309 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 351 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 15 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 399 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 447 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 16 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 357 ]), &(acadoWorkspace.QDy[ 45 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 501 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 555 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 17 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 405 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 453 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 615 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 18 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.QDy[ 51 ]), &(acadoWorkspace.g[ 19 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 507 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 19 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 561 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 19 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 19 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 20 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 20 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 621 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 20 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 567 ]), &(acadoWorkspace.QDy[ 57 ]), &(acadoWorkspace.g[ 21 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 21 ]) ); +acado_multEQDy( &(acadoWorkspace.E[ 627 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 22 ]) ); + +acadoWorkspace.lb[0] = acadoWorkspace.Dx0[0]; +acadoWorkspace.lb[1] = acadoWorkspace.Dx0[1]; +acadoWorkspace.lb[2] = acadoWorkspace.Dx0[2]; +acadoWorkspace.ub[0] = acadoWorkspace.Dx0[0]; +acadoWorkspace.ub[1] = acadoWorkspace.Dx0[1]; +acadoWorkspace.ub[2] = acadoWorkspace.Dx0[2]; +tmp = acadoVariables.x[4] + acadoWorkspace.d[1]; +acadoWorkspace.lbA[0] = - tmp; +acadoWorkspace.ubA[0] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[7] + acadoWorkspace.d[4]; +acadoWorkspace.lbA[1] = - tmp; +acadoWorkspace.ubA[1] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[10] + acadoWorkspace.d[7]; +acadoWorkspace.lbA[2] = - tmp; +acadoWorkspace.ubA[2] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[13] + acadoWorkspace.d[10]; +acadoWorkspace.lbA[3] = - tmp; +acadoWorkspace.ubA[3] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[16] + acadoWorkspace.d[13]; +acadoWorkspace.lbA[4] = - tmp; +acadoWorkspace.ubA[4] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[19] + acadoWorkspace.d[16]; +acadoWorkspace.lbA[5] = - tmp; +acadoWorkspace.ubA[5] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[22] + acadoWorkspace.d[19]; +acadoWorkspace.lbA[6] = - tmp; +acadoWorkspace.ubA[6] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[25] + acadoWorkspace.d[22]; +acadoWorkspace.lbA[7] = - tmp; +acadoWorkspace.ubA[7] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[28] + acadoWorkspace.d[25]; +acadoWorkspace.lbA[8] = - tmp; +acadoWorkspace.ubA[8] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[31] + acadoWorkspace.d[28]; +acadoWorkspace.lbA[9] = - tmp; +acadoWorkspace.ubA[9] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[34] + acadoWorkspace.d[31]; +acadoWorkspace.lbA[10] = - tmp; +acadoWorkspace.ubA[10] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[37] + acadoWorkspace.d[34]; +acadoWorkspace.lbA[11] = - tmp; +acadoWorkspace.ubA[11] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[40] + acadoWorkspace.d[37]; +acadoWorkspace.lbA[12] = - tmp; +acadoWorkspace.ubA[12] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[43] + acadoWorkspace.d[40]; +acadoWorkspace.lbA[13] = - tmp; +acadoWorkspace.ubA[13] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[46] + acadoWorkspace.d[43]; +acadoWorkspace.lbA[14] = - tmp; +acadoWorkspace.ubA[14] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[49] + acadoWorkspace.d[46]; +acadoWorkspace.lbA[15] = - tmp; +acadoWorkspace.ubA[15] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[52] + acadoWorkspace.d[49]; +acadoWorkspace.lbA[16] = - tmp; +acadoWorkspace.ubA[16] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[55] + acadoWorkspace.d[52]; +acadoWorkspace.lbA[17] = - tmp; +acadoWorkspace.ubA[17] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[58] + acadoWorkspace.d[55]; +acadoWorkspace.lbA[18] = - tmp; +acadoWorkspace.ubA[18] = (real_t)1.0000000000000000e+12 - tmp; +tmp = acadoVariables.x[61] + acadoWorkspace.d[58]; +acadoWorkspace.lbA[19] = - tmp; +acadoWorkspace.ubA[19] = (real_t)1.0000000000000000e+12 - tmp; + +} + +void acado_expand( ) +{ +acadoVariables.x[0] += acadoWorkspace.x[0]; +acadoVariables.x[1] += acadoWorkspace.x[1]; +acadoVariables.x[2] += acadoWorkspace.x[2]; + +acadoVariables.u[0] += acadoWorkspace.x[3]; +acadoVariables.u[1] += acadoWorkspace.x[4]; +acadoVariables.u[2] += acadoWorkspace.x[5]; +acadoVariables.u[3] += acadoWorkspace.x[6]; +acadoVariables.u[4] += acadoWorkspace.x[7]; +acadoVariables.u[5] += acadoWorkspace.x[8]; +acadoVariables.u[6] += acadoWorkspace.x[9]; +acadoVariables.u[7] += acadoWorkspace.x[10]; +acadoVariables.u[8] += acadoWorkspace.x[11]; +acadoVariables.u[9] += acadoWorkspace.x[12]; +acadoVariables.u[10] += acadoWorkspace.x[13]; +acadoVariables.u[11] += acadoWorkspace.x[14]; +acadoVariables.u[12] += acadoWorkspace.x[15]; +acadoVariables.u[13] += acadoWorkspace.x[16]; +acadoVariables.u[14] += acadoWorkspace.x[17]; +acadoVariables.u[15] += acadoWorkspace.x[18]; +acadoVariables.u[16] += acadoWorkspace.x[19]; +acadoVariables.u[17] += acadoWorkspace.x[20]; +acadoVariables.u[18] += acadoWorkspace.x[21]; +acadoVariables.u[19] += acadoWorkspace.x[22]; + +acadoVariables.x[3] += + acadoWorkspace.evGx[0]*acadoWorkspace.x[0] + acadoWorkspace.evGx[1]*acadoWorkspace.x[1] + acadoWorkspace.evGx[2]*acadoWorkspace.x[2] + acadoWorkspace.d[0]; +acadoVariables.x[4] += + acadoWorkspace.evGx[3]*acadoWorkspace.x[0] + acadoWorkspace.evGx[4]*acadoWorkspace.x[1] + acadoWorkspace.evGx[5]*acadoWorkspace.x[2] + acadoWorkspace.d[1]; +acadoVariables.x[5] += + acadoWorkspace.evGx[6]*acadoWorkspace.x[0] + acadoWorkspace.evGx[7]*acadoWorkspace.x[1] + acadoWorkspace.evGx[8]*acadoWorkspace.x[2] + acadoWorkspace.d[2]; +acadoVariables.x[6] += + acadoWorkspace.evGx[9]*acadoWorkspace.x[0] + acadoWorkspace.evGx[10]*acadoWorkspace.x[1] + acadoWorkspace.evGx[11]*acadoWorkspace.x[2] + acadoWorkspace.d[3]; +acadoVariables.x[7] += + acadoWorkspace.evGx[12]*acadoWorkspace.x[0] + acadoWorkspace.evGx[13]*acadoWorkspace.x[1] + acadoWorkspace.evGx[14]*acadoWorkspace.x[2] + acadoWorkspace.d[4]; +acadoVariables.x[8] += + acadoWorkspace.evGx[15]*acadoWorkspace.x[0] + acadoWorkspace.evGx[16]*acadoWorkspace.x[1] + acadoWorkspace.evGx[17]*acadoWorkspace.x[2] + acadoWorkspace.d[5]; +acadoVariables.x[9] += + acadoWorkspace.evGx[18]*acadoWorkspace.x[0] + acadoWorkspace.evGx[19]*acadoWorkspace.x[1] + acadoWorkspace.evGx[20]*acadoWorkspace.x[2] + acadoWorkspace.d[6]; +acadoVariables.x[10] += + acadoWorkspace.evGx[21]*acadoWorkspace.x[0] + acadoWorkspace.evGx[22]*acadoWorkspace.x[1] + acadoWorkspace.evGx[23]*acadoWorkspace.x[2] + acadoWorkspace.d[7]; +acadoVariables.x[11] += + acadoWorkspace.evGx[24]*acadoWorkspace.x[0] + acadoWorkspace.evGx[25]*acadoWorkspace.x[1] + acadoWorkspace.evGx[26]*acadoWorkspace.x[2] + acadoWorkspace.d[8]; +acadoVariables.x[12] += + acadoWorkspace.evGx[27]*acadoWorkspace.x[0] + acadoWorkspace.evGx[28]*acadoWorkspace.x[1] + acadoWorkspace.evGx[29]*acadoWorkspace.x[2] + acadoWorkspace.d[9]; +acadoVariables.x[13] += + acadoWorkspace.evGx[30]*acadoWorkspace.x[0] + acadoWorkspace.evGx[31]*acadoWorkspace.x[1] + acadoWorkspace.evGx[32]*acadoWorkspace.x[2] + acadoWorkspace.d[10]; +acadoVariables.x[14] += + acadoWorkspace.evGx[33]*acadoWorkspace.x[0] + acadoWorkspace.evGx[34]*acadoWorkspace.x[1] + acadoWorkspace.evGx[35]*acadoWorkspace.x[2] + acadoWorkspace.d[11]; +acadoVariables.x[15] += + acadoWorkspace.evGx[36]*acadoWorkspace.x[0] + acadoWorkspace.evGx[37]*acadoWorkspace.x[1] + acadoWorkspace.evGx[38]*acadoWorkspace.x[2] + acadoWorkspace.d[12]; +acadoVariables.x[16] += + acadoWorkspace.evGx[39]*acadoWorkspace.x[0] + acadoWorkspace.evGx[40]*acadoWorkspace.x[1] + acadoWorkspace.evGx[41]*acadoWorkspace.x[2] + acadoWorkspace.d[13]; +acadoVariables.x[17] += + acadoWorkspace.evGx[42]*acadoWorkspace.x[0] + acadoWorkspace.evGx[43]*acadoWorkspace.x[1] + acadoWorkspace.evGx[44]*acadoWorkspace.x[2] + acadoWorkspace.d[14]; +acadoVariables.x[18] += + acadoWorkspace.evGx[45]*acadoWorkspace.x[0] + acadoWorkspace.evGx[46]*acadoWorkspace.x[1] + acadoWorkspace.evGx[47]*acadoWorkspace.x[2] + acadoWorkspace.d[15]; +acadoVariables.x[19] += + acadoWorkspace.evGx[48]*acadoWorkspace.x[0] + acadoWorkspace.evGx[49]*acadoWorkspace.x[1] + acadoWorkspace.evGx[50]*acadoWorkspace.x[2] + acadoWorkspace.d[16]; +acadoVariables.x[20] += + acadoWorkspace.evGx[51]*acadoWorkspace.x[0] + acadoWorkspace.evGx[52]*acadoWorkspace.x[1] + acadoWorkspace.evGx[53]*acadoWorkspace.x[2] + acadoWorkspace.d[17]; +acadoVariables.x[21] += + acadoWorkspace.evGx[54]*acadoWorkspace.x[0] + acadoWorkspace.evGx[55]*acadoWorkspace.x[1] + acadoWorkspace.evGx[56]*acadoWorkspace.x[2] + acadoWorkspace.d[18]; +acadoVariables.x[22] += + acadoWorkspace.evGx[57]*acadoWorkspace.x[0] + acadoWorkspace.evGx[58]*acadoWorkspace.x[1] + acadoWorkspace.evGx[59]*acadoWorkspace.x[2] + acadoWorkspace.d[19]; +acadoVariables.x[23] += + acadoWorkspace.evGx[60]*acadoWorkspace.x[0] + acadoWorkspace.evGx[61]*acadoWorkspace.x[1] + acadoWorkspace.evGx[62]*acadoWorkspace.x[2] + acadoWorkspace.d[20]; +acadoVariables.x[24] += + acadoWorkspace.evGx[63]*acadoWorkspace.x[0] + acadoWorkspace.evGx[64]*acadoWorkspace.x[1] + acadoWorkspace.evGx[65]*acadoWorkspace.x[2] + acadoWorkspace.d[21]; +acadoVariables.x[25] += + acadoWorkspace.evGx[66]*acadoWorkspace.x[0] + acadoWorkspace.evGx[67]*acadoWorkspace.x[1] + acadoWorkspace.evGx[68]*acadoWorkspace.x[2] + acadoWorkspace.d[22]; +acadoVariables.x[26] += + acadoWorkspace.evGx[69]*acadoWorkspace.x[0] + acadoWorkspace.evGx[70]*acadoWorkspace.x[1] + acadoWorkspace.evGx[71]*acadoWorkspace.x[2] + acadoWorkspace.d[23]; +acadoVariables.x[27] += + acadoWorkspace.evGx[72]*acadoWorkspace.x[0] + acadoWorkspace.evGx[73]*acadoWorkspace.x[1] + acadoWorkspace.evGx[74]*acadoWorkspace.x[2] + acadoWorkspace.d[24]; +acadoVariables.x[28] += + acadoWorkspace.evGx[75]*acadoWorkspace.x[0] + acadoWorkspace.evGx[76]*acadoWorkspace.x[1] + acadoWorkspace.evGx[77]*acadoWorkspace.x[2] + acadoWorkspace.d[25]; +acadoVariables.x[29] += + acadoWorkspace.evGx[78]*acadoWorkspace.x[0] + acadoWorkspace.evGx[79]*acadoWorkspace.x[1] + acadoWorkspace.evGx[80]*acadoWorkspace.x[2] + acadoWorkspace.d[26]; +acadoVariables.x[30] += + acadoWorkspace.evGx[81]*acadoWorkspace.x[0] + acadoWorkspace.evGx[82]*acadoWorkspace.x[1] + acadoWorkspace.evGx[83]*acadoWorkspace.x[2] + acadoWorkspace.d[27]; +acadoVariables.x[31] += + acadoWorkspace.evGx[84]*acadoWorkspace.x[0] + acadoWorkspace.evGx[85]*acadoWorkspace.x[1] + acadoWorkspace.evGx[86]*acadoWorkspace.x[2] + acadoWorkspace.d[28]; +acadoVariables.x[32] += + acadoWorkspace.evGx[87]*acadoWorkspace.x[0] + acadoWorkspace.evGx[88]*acadoWorkspace.x[1] + acadoWorkspace.evGx[89]*acadoWorkspace.x[2] + acadoWorkspace.d[29]; +acadoVariables.x[33] += + acadoWorkspace.evGx[90]*acadoWorkspace.x[0] + acadoWorkspace.evGx[91]*acadoWorkspace.x[1] + acadoWorkspace.evGx[92]*acadoWorkspace.x[2] + acadoWorkspace.d[30]; +acadoVariables.x[34] += + acadoWorkspace.evGx[93]*acadoWorkspace.x[0] + acadoWorkspace.evGx[94]*acadoWorkspace.x[1] + acadoWorkspace.evGx[95]*acadoWorkspace.x[2] + acadoWorkspace.d[31]; +acadoVariables.x[35] += + acadoWorkspace.evGx[96]*acadoWorkspace.x[0] + acadoWorkspace.evGx[97]*acadoWorkspace.x[1] + acadoWorkspace.evGx[98]*acadoWorkspace.x[2] + acadoWorkspace.d[32]; +acadoVariables.x[36] += + acadoWorkspace.evGx[99]*acadoWorkspace.x[0] + acadoWorkspace.evGx[100]*acadoWorkspace.x[1] + acadoWorkspace.evGx[101]*acadoWorkspace.x[2] + acadoWorkspace.d[33]; +acadoVariables.x[37] += + acadoWorkspace.evGx[102]*acadoWorkspace.x[0] + acadoWorkspace.evGx[103]*acadoWorkspace.x[1] + acadoWorkspace.evGx[104]*acadoWorkspace.x[2] + acadoWorkspace.d[34]; +acadoVariables.x[38] += + acadoWorkspace.evGx[105]*acadoWorkspace.x[0] + acadoWorkspace.evGx[106]*acadoWorkspace.x[1] + acadoWorkspace.evGx[107]*acadoWorkspace.x[2] + acadoWorkspace.d[35]; +acadoVariables.x[39] += + acadoWorkspace.evGx[108]*acadoWorkspace.x[0] + acadoWorkspace.evGx[109]*acadoWorkspace.x[1] + acadoWorkspace.evGx[110]*acadoWorkspace.x[2] + acadoWorkspace.d[36]; +acadoVariables.x[40] += + acadoWorkspace.evGx[111]*acadoWorkspace.x[0] + acadoWorkspace.evGx[112]*acadoWorkspace.x[1] + acadoWorkspace.evGx[113]*acadoWorkspace.x[2] + acadoWorkspace.d[37]; +acadoVariables.x[41] += + acadoWorkspace.evGx[114]*acadoWorkspace.x[0] + acadoWorkspace.evGx[115]*acadoWorkspace.x[1] + acadoWorkspace.evGx[116]*acadoWorkspace.x[2] + acadoWorkspace.d[38]; +acadoVariables.x[42] += + acadoWorkspace.evGx[117]*acadoWorkspace.x[0] + acadoWorkspace.evGx[118]*acadoWorkspace.x[1] + acadoWorkspace.evGx[119]*acadoWorkspace.x[2] + acadoWorkspace.d[39]; +acadoVariables.x[43] += + acadoWorkspace.evGx[120]*acadoWorkspace.x[0] + acadoWorkspace.evGx[121]*acadoWorkspace.x[1] + acadoWorkspace.evGx[122]*acadoWorkspace.x[2] + acadoWorkspace.d[40]; +acadoVariables.x[44] += + acadoWorkspace.evGx[123]*acadoWorkspace.x[0] + acadoWorkspace.evGx[124]*acadoWorkspace.x[1] + acadoWorkspace.evGx[125]*acadoWorkspace.x[2] + acadoWorkspace.d[41]; +acadoVariables.x[45] += + acadoWorkspace.evGx[126]*acadoWorkspace.x[0] + acadoWorkspace.evGx[127]*acadoWorkspace.x[1] + acadoWorkspace.evGx[128]*acadoWorkspace.x[2] + acadoWorkspace.d[42]; +acadoVariables.x[46] += + acadoWorkspace.evGx[129]*acadoWorkspace.x[0] + acadoWorkspace.evGx[130]*acadoWorkspace.x[1] + acadoWorkspace.evGx[131]*acadoWorkspace.x[2] + acadoWorkspace.d[43]; +acadoVariables.x[47] += + acadoWorkspace.evGx[132]*acadoWorkspace.x[0] + acadoWorkspace.evGx[133]*acadoWorkspace.x[1] + acadoWorkspace.evGx[134]*acadoWorkspace.x[2] + acadoWorkspace.d[44]; +acadoVariables.x[48] += + acadoWorkspace.evGx[135]*acadoWorkspace.x[0] + acadoWorkspace.evGx[136]*acadoWorkspace.x[1] + acadoWorkspace.evGx[137]*acadoWorkspace.x[2] + acadoWorkspace.d[45]; +acadoVariables.x[49] += + acadoWorkspace.evGx[138]*acadoWorkspace.x[0] + acadoWorkspace.evGx[139]*acadoWorkspace.x[1] + acadoWorkspace.evGx[140]*acadoWorkspace.x[2] + acadoWorkspace.d[46]; +acadoVariables.x[50] += + acadoWorkspace.evGx[141]*acadoWorkspace.x[0] + acadoWorkspace.evGx[142]*acadoWorkspace.x[1] + acadoWorkspace.evGx[143]*acadoWorkspace.x[2] + acadoWorkspace.d[47]; +acadoVariables.x[51] += + acadoWorkspace.evGx[144]*acadoWorkspace.x[0] + acadoWorkspace.evGx[145]*acadoWorkspace.x[1] + acadoWorkspace.evGx[146]*acadoWorkspace.x[2] + acadoWorkspace.d[48]; +acadoVariables.x[52] += + acadoWorkspace.evGx[147]*acadoWorkspace.x[0] + acadoWorkspace.evGx[148]*acadoWorkspace.x[1] + acadoWorkspace.evGx[149]*acadoWorkspace.x[2] + acadoWorkspace.d[49]; +acadoVariables.x[53] += + acadoWorkspace.evGx[150]*acadoWorkspace.x[0] + acadoWorkspace.evGx[151]*acadoWorkspace.x[1] + acadoWorkspace.evGx[152]*acadoWorkspace.x[2] + acadoWorkspace.d[50]; +acadoVariables.x[54] += + acadoWorkspace.evGx[153]*acadoWorkspace.x[0] + acadoWorkspace.evGx[154]*acadoWorkspace.x[1] + acadoWorkspace.evGx[155]*acadoWorkspace.x[2] + acadoWorkspace.d[51]; +acadoVariables.x[55] += + acadoWorkspace.evGx[156]*acadoWorkspace.x[0] + acadoWorkspace.evGx[157]*acadoWorkspace.x[1] + acadoWorkspace.evGx[158]*acadoWorkspace.x[2] + acadoWorkspace.d[52]; +acadoVariables.x[56] += + acadoWorkspace.evGx[159]*acadoWorkspace.x[0] + acadoWorkspace.evGx[160]*acadoWorkspace.x[1] + acadoWorkspace.evGx[161]*acadoWorkspace.x[2] + acadoWorkspace.d[53]; +acadoVariables.x[57] += + acadoWorkspace.evGx[162]*acadoWorkspace.x[0] + acadoWorkspace.evGx[163]*acadoWorkspace.x[1] + acadoWorkspace.evGx[164]*acadoWorkspace.x[2] + acadoWorkspace.d[54]; +acadoVariables.x[58] += + acadoWorkspace.evGx[165]*acadoWorkspace.x[0] + acadoWorkspace.evGx[166]*acadoWorkspace.x[1] + acadoWorkspace.evGx[167]*acadoWorkspace.x[2] + acadoWorkspace.d[55]; +acadoVariables.x[59] += + acadoWorkspace.evGx[168]*acadoWorkspace.x[0] + acadoWorkspace.evGx[169]*acadoWorkspace.x[1] + acadoWorkspace.evGx[170]*acadoWorkspace.x[2] + acadoWorkspace.d[56]; +acadoVariables.x[60] += + acadoWorkspace.evGx[171]*acadoWorkspace.x[0] + acadoWorkspace.evGx[172]*acadoWorkspace.x[1] + acadoWorkspace.evGx[173]*acadoWorkspace.x[2] + acadoWorkspace.d[57]; +acadoVariables.x[61] += + acadoWorkspace.evGx[174]*acadoWorkspace.x[0] + acadoWorkspace.evGx[175]*acadoWorkspace.x[1] + acadoWorkspace.evGx[176]*acadoWorkspace.x[2] + acadoWorkspace.d[58]; +acadoVariables.x[62] += + acadoWorkspace.evGx[177]*acadoWorkspace.x[0] + acadoWorkspace.evGx[178]*acadoWorkspace.x[1] + acadoWorkspace.evGx[179]*acadoWorkspace.x[2] + acadoWorkspace.d[59]; + +acado_multEDu( acadoWorkspace.E, &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 3 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 3 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 6 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 6 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 9 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 9 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 9 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 15 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 9 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 12 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 21 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 12 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 12 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 27 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 12 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 15 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 33 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 15 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 15 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 39 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 15 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 15 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 45 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 18 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 18 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 51 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 18 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 18 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 57 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 18 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 18 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 63 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 21 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 21 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 69 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 21 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 21 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 75 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 21 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 21 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 81 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 21 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 24 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 87 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 24 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 24 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 93 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 24 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 24 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 99 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 24 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 24 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 105 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 24 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 27 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 111 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 27 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 27 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 117 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 27 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 27 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 123 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 27 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 27 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 129 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 27 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 27 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 135 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 141 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 147 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 153 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 159 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 30 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 165 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 171 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 177 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 183 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 189 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 195 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 33 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 201 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 207 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 213 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 219 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 225 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 231 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 36 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 237 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 243 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 249 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 255 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 261 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 267 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 39 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 273 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 279 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 285 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 291 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 297 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 303 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 309 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 42 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 315 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 321 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 327 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 333 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 339 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 345 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 351 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 357 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 45 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 363 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 369 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 375 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 381 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 387 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 393 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 399 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 405 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 48 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 411 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 417 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 423 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 429 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 435 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 441 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 447 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 453 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 51 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 459 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 465 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 471 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 477 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 483 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 489 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 495 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 501 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 507 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.x[ 20 ]), &(acadoVariables.x[ 54 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 513 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 519 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 525 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 531 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 537 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 543 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 549 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 555 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 561 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.x[ 20 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 567 ]), &(acadoWorkspace.x[ 21 ]), &(acadoVariables.x[ 57 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.x[ 3 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 573 ]), &(acadoWorkspace.x[ 4 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.x[ 5 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 579 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 585 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 591 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 597 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 603 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 609 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 615 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 621 ]), &(acadoWorkspace.x[ 20 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.x[ 21 ]), &(acadoVariables.x[ 60 ]) ); +acado_multEDu( &(acadoWorkspace.E[ 627 ]), &(acadoWorkspace.x[ 22 ]), &(acadoVariables.x[ 60 ]) ); +} + +int acado_preparationStep( ) +{ +int ret; + +ret = acado_modelSimulation(); +acado_evaluateObjective( ); +acado_condensePrep( ); +return ret; +} + +int acado_feedbackStep( ) +{ +int tmp; + +acado_condenseFdb( ); + +tmp = acado_solve( ); + +acado_expand( ); +return tmp; +} + +int acado_initializeSolver( ) +{ +int ret; + +/* This is a function which must be called once before any other function call! */ + + +ret = 0; + +memset(&acadoWorkspace, 0, sizeof( acadoWorkspace )); +return ret; +} + +void acado_initializeNodesByForwardSimulation( ) +{ +int index; +for (index = 0; index < 20; ++index) +{ +acadoWorkspace.state[0] = acadoVariables.x[index * 3]; +acadoWorkspace.state[1] = acadoVariables.x[index * 3 + 1]; +acadoWorkspace.state[2] = acadoVariables.x[index * 3 + 2]; +acadoWorkspace.state[15] = acadoVariables.u[index]; +acadoWorkspace.state[16] = acadoVariables.od[index * 2]; +acadoWorkspace.state[17] = acadoVariables.od[index * 2 + 1]; + +acado_integrate(acadoWorkspace.state, index == 0, index); + +acadoVariables.x[index * 3 + 3] = acadoWorkspace.state[0]; +acadoVariables.x[index * 3 + 4] = acadoWorkspace.state[1]; +acadoVariables.x[index * 3 + 5] = acadoWorkspace.state[2]; +} +} + +void acado_shiftStates( int strategy, real_t* const xEnd, real_t* const uEnd ) +{ +int index; +for (index = 0; index < 20; ++index) +{ +acadoVariables.x[index * 3] = acadoVariables.x[index * 3 + 3]; +acadoVariables.x[index * 3 + 1] = acadoVariables.x[index * 3 + 4]; +acadoVariables.x[index * 3 + 2] = acadoVariables.x[index * 3 + 5]; +} + +if (strategy == 1 && xEnd != 0) +{ +acadoVariables.x[60] = xEnd[0]; +acadoVariables.x[61] = xEnd[1]; +acadoVariables.x[62] = xEnd[2]; +} +else if (strategy == 2) +{ +acadoWorkspace.state[0] = acadoVariables.x[60]; +acadoWorkspace.state[1] = acadoVariables.x[61]; +acadoWorkspace.state[2] = acadoVariables.x[62]; +if (uEnd != 0) +{ +acadoWorkspace.state[15] = uEnd[0]; +} +else +{ +acadoWorkspace.state[15] = acadoVariables.u[19]; +} +acadoWorkspace.state[16] = acadoVariables.od[40]; +acadoWorkspace.state[17] = acadoVariables.od[41]; + +acado_integrate(acadoWorkspace.state, 1, 19); + +acadoVariables.x[60] = acadoWorkspace.state[0]; +acadoVariables.x[61] = acadoWorkspace.state[1]; +acadoVariables.x[62] = acadoWorkspace.state[2]; +} +} + +void acado_shiftControls( real_t* const uEnd ) +{ +int index; +for (index = 0; index < 19; ++index) +{ +acadoVariables.u[index] = acadoVariables.u[index + 1]; +} + +if (uEnd != 0) +{ +acadoVariables.u[19] = uEnd[0]; +} +} + +real_t acado_getKKT( ) +{ +real_t kkt; + +int index; +real_t prd; + +kkt = + acadoWorkspace.g[0]*acadoWorkspace.x[0] + acadoWorkspace.g[1]*acadoWorkspace.x[1] + acadoWorkspace.g[2]*acadoWorkspace.x[2] + acadoWorkspace.g[3]*acadoWorkspace.x[3] + acadoWorkspace.g[4]*acadoWorkspace.x[4] + acadoWorkspace.g[5]*acadoWorkspace.x[5] + acadoWorkspace.g[6]*acadoWorkspace.x[6] + acadoWorkspace.g[7]*acadoWorkspace.x[7] + acadoWorkspace.g[8]*acadoWorkspace.x[8] + acadoWorkspace.g[9]*acadoWorkspace.x[9] + acadoWorkspace.g[10]*acadoWorkspace.x[10] + acadoWorkspace.g[11]*acadoWorkspace.x[11] + acadoWorkspace.g[12]*acadoWorkspace.x[12] + acadoWorkspace.g[13]*acadoWorkspace.x[13] + acadoWorkspace.g[14]*acadoWorkspace.x[14] + acadoWorkspace.g[15]*acadoWorkspace.x[15] + acadoWorkspace.g[16]*acadoWorkspace.x[16] + acadoWorkspace.g[17]*acadoWorkspace.x[17] + acadoWorkspace.g[18]*acadoWorkspace.x[18] + acadoWorkspace.g[19]*acadoWorkspace.x[19] + acadoWorkspace.g[20]*acadoWorkspace.x[20] + acadoWorkspace.g[21]*acadoWorkspace.x[21] + acadoWorkspace.g[22]*acadoWorkspace.x[22]; +kkt = fabs( kkt ); +for (index = 0; index < 23; ++index) +{ +prd = acadoWorkspace.y[index]; +if (prd > 1e-12) +kkt += fabs(acadoWorkspace.lb[index] * prd); +else if (prd < -1e-12) +kkt += fabs(acadoWorkspace.ub[index] * prd); +} +for (index = 0; index < 20; ++index) +{ +prd = acadoWorkspace.y[index + 23]; +if (prd > 1e-12) +kkt += fabs(acadoWorkspace.lbA[index] * prd); +else if (prd < -1e-12) +kkt += fabs(acadoWorkspace.ubA[index] * prd); +} +return kkt; +} + +real_t acado_getObjective( ) +{ +real_t objVal; + +int lRun1; +/** Row vector of size: 4 */ +real_t tmpDy[ 4 ]; + +/** Row vector of size: 3 */ +real_t tmpDyN[ 3 ]; + +for (lRun1 = 0; lRun1 < 20; ++lRun1) +{ +acadoWorkspace.objValueIn[0] = acadoVariables.x[lRun1 * 3]; +acadoWorkspace.objValueIn[1] = acadoVariables.x[lRun1 * 3 + 1]; +acadoWorkspace.objValueIn[2] = acadoVariables.x[lRun1 * 3 + 2]; +acadoWorkspace.objValueIn[3] = acadoVariables.u[lRun1]; +acadoWorkspace.objValueIn[4] = acadoVariables.od[lRun1 * 2]; +acadoWorkspace.objValueIn[5] = acadoVariables.od[lRun1 * 2 + 1]; + +acado_evaluateLSQ( acadoWorkspace.objValueIn, acadoWorkspace.objValueOut ); +acadoWorkspace.Dy[lRun1 * 4] = acadoWorkspace.objValueOut[0] - acadoVariables.y[lRun1 * 4]; +acadoWorkspace.Dy[lRun1 * 4 + 1] = acadoWorkspace.objValueOut[1] - acadoVariables.y[lRun1 * 4 + 1]; +acadoWorkspace.Dy[lRun1 * 4 + 2] = acadoWorkspace.objValueOut[2] - acadoVariables.y[lRun1 * 4 + 2]; +acadoWorkspace.Dy[lRun1 * 4 + 3] = acadoWorkspace.objValueOut[3] - acadoVariables.y[lRun1 * 4 + 3]; +} +acadoWorkspace.objValueIn[0] = acadoVariables.x[60]; +acadoWorkspace.objValueIn[1] = acadoVariables.x[61]; +acadoWorkspace.objValueIn[2] = acadoVariables.x[62]; +acadoWorkspace.objValueIn[3] = acadoVariables.od[40]; +acadoWorkspace.objValueIn[4] = acadoVariables.od[41]; +acado_evaluateLSQEndTerm( acadoWorkspace.objValueIn, acadoWorkspace.objValueOut ); +acadoWorkspace.DyN[0] = acadoWorkspace.objValueOut[0] - acadoVariables.yN[0]; +acadoWorkspace.DyN[1] = acadoWorkspace.objValueOut[1] - acadoVariables.yN[1]; +acadoWorkspace.DyN[2] = acadoWorkspace.objValueOut[2] - acadoVariables.yN[2]; +objVal = 0.0000000000000000e+00; +for (lRun1 = 0; lRun1 < 20; ++lRun1) +{ +tmpDy[0] = + acadoWorkspace.Dy[lRun1 * 4]*acadoVariables.W[lRun1 * 16] + acadoWorkspace.Dy[lRun1 * 4 + 1]*acadoVariables.W[lRun1 * 16 + 4] + acadoWorkspace.Dy[lRun1 * 4 + 2]*acadoVariables.W[lRun1 * 16 + 8] + acadoWorkspace.Dy[lRun1 * 4 + 3]*acadoVariables.W[lRun1 * 16 + 12]; +tmpDy[1] = + acadoWorkspace.Dy[lRun1 * 4]*acadoVariables.W[lRun1 * 16 + 1] + acadoWorkspace.Dy[lRun1 * 4 + 1]*acadoVariables.W[lRun1 * 16 + 5] + acadoWorkspace.Dy[lRun1 * 4 + 2]*acadoVariables.W[lRun1 * 16 + 9] + acadoWorkspace.Dy[lRun1 * 4 + 3]*acadoVariables.W[lRun1 * 16 + 13]; +tmpDy[2] = + acadoWorkspace.Dy[lRun1 * 4]*acadoVariables.W[lRun1 * 16 + 2] + acadoWorkspace.Dy[lRun1 * 4 + 1]*acadoVariables.W[lRun1 * 16 + 6] + acadoWorkspace.Dy[lRun1 * 4 + 2]*acadoVariables.W[lRun1 * 16 + 10] + acadoWorkspace.Dy[lRun1 * 4 + 3]*acadoVariables.W[lRun1 * 16 + 14]; +tmpDy[3] = + acadoWorkspace.Dy[lRun1 * 4]*acadoVariables.W[lRun1 * 16 + 3] + acadoWorkspace.Dy[lRun1 * 4 + 1]*acadoVariables.W[lRun1 * 16 + 7] + acadoWorkspace.Dy[lRun1 * 4 + 2]*acadoVariables.W[lRun1 * 16 + 11] + acadoWorkspace.Dy[lRun1 * 4 + 3]*acadoVariables.W[lRun1 * 16 + 15]; +objVal += + acadoWorkspace.Dy[lRun1 * 4]*tmpDy[0] + acadoWorkspace.Dy[lRun1 * 4 + 1]*tmpDy[1] + acadoWorkspace.Dy[lRun1 * 4 + 2]*tmpDy[2] + acadoWorkspace.Dy[lRun1 * 4 + 3]*tmpDy[3]; +} + +tmpDyN[0] = + acadoWorkspace.DyN[0]*acadoVariables.WN[0] + acadoWorkspace.DyN[1]*acadoVariables.WN[3] + acadoWorkspace.DyN[2]*acadoVariables.WN[6]; +tmpDyN[1] = + acadoWorkspace.DyN[0]*acadoVariables.WN[1] + acadoWorkspace.DyN[1]*acadoVariables.WN[4] + acadoWorkspace.DyN[2]*acadoVariables.WN[7]; +tmpDyN[2] = + acadoWorkspace.DyN[0]*acadoVariables.WN[2] + acadoWorkspace.DyN[1]*acadoVariables.WN[5] + acadoWorkspace.DyN[2]*acadoVariables.WN[8]; +objVal += + acadoWorkspace.DyN[0]*tmpDyN[0] + acadoWorkspace.DyN[1]*tmpDyN[1] + acadoWorkspace.DyN[2]*tmpDyN[2]; + +objVal *= 0.5; +return objVal; +} + diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.d b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.d new file mode 100644 index 00000000000000..2dae4b94389e48 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.d @@ -0,0 +1,3 @@ +lib_mpc_export/acado_solver.o: lib_mpc_export/acado_solver.c \ + lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.o b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.o new file mode 100644 index 00000000000000..435fd9f8382e68 Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Bounds.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Bounds.d new file mode 100644 index 00000000000000..752ec5e9f3c686 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Bounds.d @@ -0,0 +1,14 @@ +lib_qp/Bounds.o: ../../../../phonelibs/qpoases/SRC/Bounds.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Bounds.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Bounds.o new file mode 100644 index 00000000000000..28794f8185f91d Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Bounds.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Constraints.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Constraints.d new file mode 100644 index 00000000000000..60295bc07b3dc9 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Constraints.d @@ -0,0 +1,14 @@ +lib_qp/Constraints.o: ../../../../phonelibs/qpoases/SRC/Constraints.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constraints.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Constraints.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Constraints.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Constraints.o new file mode 100644 index 00000000000000..81352513fd913e Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Constraints.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/CyclingManager.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/CyclingManager.d new file mode 100644 index 00000000000000..24145d8ed318e1 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/CyclingManager.d @@ -0,0 +1,11 @@ +lib_qp/CyclingManager.o: \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/CyclingManager.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/CyclingManager.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/CyclingManager.o new file mode 100644 index 00000000000000..321db37ef2508b Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/CyclingManager.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/EXTRAS/SolutionAnalysis.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/EXTRAS/SolutionAnalysis.d new file mode 100644 index 00000000000000..77c09376eef96e --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/EXTRAS/SolutionAnalysis.d @@ -0,0 +1,24 @@ +lib_qp/EXTRAS/SolutionAnalysis.o: \ + ../../../../phonelibs/qpoases/SRC/EXTRAS/SolutionAnalysis.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/EXTRAS/SolutionAnalysis.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblem.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblemB.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblemB.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/Constraints.hpp \ + ../../../../phonelibs/qpoases/SRC/Constraints.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/CyclingManager.hpp \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblem.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/EXTRAS/SolutionAnalysis.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/EXTRAS/SolutionAnalysis.o new file mode 100644 index 00000000000000..1816ece0eddd64 Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/EXTRAS/SolutionAnalysis.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Indexlist.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Indexlist.d new file mode 100644 index 00000000000000..6ead64cb9d8ee6 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Indexlist.d @@ -0,0 +1,10 @@ +lib_qp/Indexlist.o: ../../../../phonelibs/qpoases/SRC/Indexlist.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Indexlist.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Indexlist.o new file mode 100644 index 00000000000000..c8bdbe979bc7aa Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Indexlist.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/MessageHandling.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/MessageHandling.d new file mode 100644 index 00000000000000..b5c6166aba1f64 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/MessageHandling.d @@ -0,0 +1,9 @@ +lib_qp/MessageHandling.o: \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/MessageHandling.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/MessageHandling.o new file mode 100644 index 00000000000000..87b200d0475adb Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/MessageHandling.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblem.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblem.d new file mode 100644 index 00000000000000..1f6e188af55c17 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblem.d @@ -0,0 +1,22 @@ +lib_qp/QProblem.o: ../../../../phonelibs/qpoases/SRC/QProblem.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblem.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblemB.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblemB.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/Constraints.hpp \ + ../../../../phonelibs/qpoases/SRC/Constraints.ipp \ + ../../../../phonelibs/qpoases/INCLUDE/CyclingManager.hpp \ + ../../../../phonelibs/qpoases/SRC/CyclingManager.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblem.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblem.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblem.o new file mode 100644 index 00000000000000..0d79872a24f25f Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblem.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblemB.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblemB.d new file mode 100644 index 00000000000000..7878a825ce5749 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblemB.d @@ -0,0 +1,16 @@ +lib_qp/QProblemB.o: ../../../../phonelibs/qpoases/SRC/QProblemB.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/QProblemB.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Bounds.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp \ + ../../../../phonelibs/qpoases/SRC/Bounds.ipp \ + ../../../../phonelibs/qpoases/SRC/QProblemB.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblemB.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblemB.o new file mode 100644 index 00000000000000..9ad8900182e509 Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblemB.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/SubjectTo.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/SubjectTo.d new file mode 100644 index 00000000000000..c896d9a9faf58d --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/SubjectTo.d @@ -0,0 +1,12 @@ +lib_qp/SubjectTo.o: ../../../../phonelibs/qpoases/SRC/SubjectTo.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/SubjectTo.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Indexlist.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp \ + ../../../../phonelibs/qpoases/SRC/Indexlist.ipp \ + ../../../../phonelibs/qpoases/SRC/SubjectTo.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/SubjectTo.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/SubjectTo.o new file mode 100644 index 00000000000000..f5b1695e756237 Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/SubjectTo.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Utils.d b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Utils.d new file mode 100644 index 00000000000000..58f35a065397a3 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Utils.d @@ -0,0 +1,8 @@ +lib_qp/Utils.o: ../../../../phonelibs/qpoases/SRC/Utils.cpp \ + ../../../../phonelibs/qpoases/INCLUDE/Utils.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/MessageHandling.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Types.hpp \ + ../../../../phonelibs/qpoases/INCLUDE/Constants.hpp \ + lib_mpc_export/acado_qpoases_interface.hpp \ + ../../../../phonelibs/qpoases/SRC/MessageHandling.ipp \ + ../../../../phonelibs/qpoases/SRC/Utils.ipp diff --git a/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Utils.o b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Utils.o new file mode 100644 index 00000000000000..ef645ef188049f Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/lib_qp/Utils.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/libmpc1.so b/selfdrive/controls/lib/longitudinal_mpc/libmpc1.so new file mode 100755 index 00000000000000..3e05e166d61fb9 Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/libmpc1.so differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/libmpc_py.py b/selfdrive/controls/lib/longitudinal_mpc/libmpc_py.py index b45021a97f0d7a..354a4a493eaa91 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/libmpc_py.py +++ b/selfdrive/controls/lib/longitudinal_mpc/libmpc_py.py @@ -1,14 +1,22 @@ import os +import platform import subprocess from cffi import FFI mpc_dir = os.path.join(os.path.dirname(os.path.abspath(__file__))) -subprocess.check_call(["make", "-j4"], cwd=mpc_dir) +if platform.machine() == "x86_64": + try: + FFI().dlopen(os.path.join(mpc_dir, "libmpc1.so")) + except OSError: + # libmpc1.so is likely built for aarch64. cleaning... + subprocess.check_call(["make", "clean"], cwd=mpc_dir) + +subprocess.check_call(["make", "-j4"], cwd=mpc_dir) def _get_libmpc(mpc_id): - libmpc_fn = os.path.join(mpc_dir, "libcommampc%d.so" % mpc_id) + libmpc_fn = os.path.join(mpc_dir, "libmpc%d.so" % mpc_id) ffi = FFI() ffi.cdef(""" @@ -25,20 +33,19 @@ def _get_libmpc(mpc_id): double x_l[21]; double v_l[21]; double a_l[21]; + double t[21]; double cost; } log_t; void init(double ttcCost, double distanceCost, double accelerationCost, double jerkCost); void init_with_simulation(double v_ego, double x_l, double v_l, double a_l, double l); int run_mpc(state_t * x0, log_t * solution, - double l); + double l, double a_l_0); """) return (ffi, ffi.dlopen(libmpc_fn)) - mpcs = [_get_libmpc(1), _get_libmpc(2)] - def get_libmpc(mpc_id): return mpcs[mpc_id - 1] diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc.c b/selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.c similarity index 75% rename from selfdrive/controls/lib/longitudinal_mpc/mpc.c rename to selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.c index c9226d67e8c9c1..e903ccc758c397 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/mpc.c +++ b/selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.c @@ -2,6 +2,7 @@ #include "acado_auxiliary_functions.h" #include +#include #define NX ACADO_NX /* Number of differential state variables. */ #define NXA ACADO_NXA /* Number of algebraic variables. */ @@ -29,6 +30,7 @@ typedef struct { double x_l[N+1]; double v_l[N+1]; double a_l[N+1]; + double t[N+1]; double cost; } log_t; @@ -65,58 +67,89 @@ void init(double ttcCost, double distanceCost, double accelerationCost, double j } -void init_with_simulation(double v_ego, double x_l, double v_l, double a_l, double l){ +void init_with_simulation(double v_ego, double x_l_0, double v_l_0, double a_l_0, double l){ int i; + + double x_l = x_l_0; + double v_l = v_l_0; + double a_l = a_l_0; + double x_ego = 0.0; - double a_ego = 0.0; + double a_ego = -(v_ego - v_l) * (v_ego - v_l) / (2.0 * x_l + 0.01) + a_l; - if (v_ego > v_l){ - a_ego = -(v_ego - v_l) * (v_ego - v_l) / (2.0 * x_l + 0.01) + a_l; + if (a_ego > 0){ + a_ego = 0.0; } + + double dt = 0.2; + double t = 0.; for (i = 0; i < N + 1; ++i){ if (i > 4){ dt = 0.6; } + + /* printf("%.2f\t%.2f\t%.2f\t%.2f\n", t, x_ego, v_ego, a_l); */ acadoVariables.x[i*NX] = x_ego; acadoVariables.x[i*NX+1] = v_ego; acadoVariables.x[i*NX+2] = a_ego; - acadoVariables.x[i*NX+3] = x_l; - acadoVariables.x[i*NX+4] = v_l; - acadoVariables.x[i*NX+5] = a_l; - - x_ego += v_ego * dt; v_ego += a_ego * dt; - x_l += v_l * dt; - v_l += a_l * dt; - a_l += -l * a_l * dt; - if (v_ego <= 0.0) { v_ego = 0.0; a_ego = 0.0; } + + x_ego += v_ego * dt; + t += dt; } + for (i = 0; i < NU * N; ++i) acadoVariables.u[ i ] = 0.0; for (i = 0; i < NY * N; ++i) acadoVariables.y[ i ] = 0.0; for (i = 0; i < NYN; ++i) acadoVariables.yN[ i ] = 0.0; } -int run_mpc(state_t * x0, log_t * solution, double l){ +int run_mpc(state_t * x0, log_t * solution, double l, double a_l_0){ + // Calculate lead vehicle predictions int i; + double t = 0.; + double dt = 0.2; + double x_l = x0->x_l; + double v_l = x0->v_l; + double a_l = a_l_0; - for (i = 0; i <= NOD * N; i+= NOD){ - acadoVariables.od[i] = l; + /* printf("t\tx_l\t_v_l\t_al\n"); */ + for (i = 0; i < N + 1; ++i){ + if (i > 4){ + dt = 0.6; + } + + /* printf("%.2f\t%.2f\t%.2f\t%.2f\n", t, x_l, v_l, a_l); */ + + acadoVariables.od[i*NOD] = x_l; + acadoVariables.od[i*NOD+1] = v_l; + + solution->x_l[i] = x_l; + solution->v_l[i] = v_l; + solution->a_l[i] = a_l; + solution->t[i] = t; + + a_l = a_l_0 * exp(-l * t * t / 2); + x_l += v_l * dt; + v_l += a_l * dt; + if (v_l < 0.0){ + a_l = 0.0; + v_l = 0.0; + } + + t += dt; } acadoVariables.x[0] = acadoVariables.x0[0] = x0->x_ego; acadoVariables.x[1] = acadoVariables.x0[1] = x0->v_ego; acadoVariables.x[2] = acadoVariables.x0[2] = x0->a_ego; - acadoVariables.x[3] = acadoVariables.x0[3] = x0->x_l; - acadoVariables.x[4] = acadoVariables.x0[4] = x0->v_l; - acadoVariables.x[5] = acadoVariables.x0[5] = x0->a_l; acado_preparationStep(); acado_feedbackStep(); @@ -125,10 +158,6 @@ int run_mpc(state_t * x0, log_t * solution, double l){ solution->x_ego[i] = acadoVariables.x[i*NX]; solution->v_ego[i] = acadoVariables.x[i*NX+1]; solution->a_ego[i] = acadoVariables.x[i*NX+2]; - solution->x_l[i] = acadoVariables.x[i*NX+3]; - solution->v_l[i] = acadoVariables.x[i*NX+4]; - solution->a_l[i] = acadoVariables.x[i*NX+5]; - solution->j_ego[i] = acadoVariables.u[i]; } solution->cost = acado_getObjective(); diff --git a/selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.d b/selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.d new file mode 100644 index 00000000000000..34a2a0d20ce304 --- /dev/null +++ b/selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.d @@ -0,0 +1,3 @@ +longitudinal_mpc.o: longitudinal_mpc.c lib_mpc_export/acado_common.h \ + lib_mpc_export/acado_qpoases_interface.hpp \ + lib_mpc_export/acado_auxiliary_functions.h diff --git a/selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.o b/selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.o new file mode 100644 index 00000000000000..3c0660d96d4a58 Binary files /dev/null and b/selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.o differ diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_integrator.c b/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_integrator.c deleted file mode 100644 index 584d8fb857f530..00000000000000 --- a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_integrator.c +++ /dev/null @@ -1,387 +0,0 @@ -/* - * This file was auto-generated using the ACADO Toolkit. - * - * While ACADO Toolkit is free software released under the terms of - * the GNU Lesser General Public License (LGPL), the generated code - * as such remains the property of the user who used ACADO Toolkit - * to generate this code. In particular, user dependent data of the code - * do not inherit the GNU LGPL license. On the other hand, parts of the - * generated code that are a direct copy of source code from the - * ACADO Toolkit or the software tools it is based on, remain, as derived - * work, automatically covered by the LGPL license. - * - * ACADO Toolkit 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. - * - */ - - -#include "acado_common.h" - - -void acado_rhs_forw(const real_t* in, real_t* out) -{ -const real_t* xd = in; -const real_t* u = in + 48; -const real_t* od = in + 49; - -/* Compute outputs: */ -out[0] = xd[1]; -out[1] = xd[2]; -out[2] = u[0]; -out[3] = xd[4]; -out[4] = xd[5]; -out[5] = (((real_t)(0.0000000000000000e+00)-od[0])*xd[5]); -out[6] = xd[12]; -out[7] = xd[13]; -out[8] = xd[14]; -out[9] = xd[15]; -out[10] = xd[16]; -out[11] = xd[17]; -out[12] = xd[18]; -out[13] = xd[19]; -out[14] = xd[20]; -out[15] = xd[21]; -out[16] = xd[22]; -out[17] = xd[23]; -out[18] = (real_t)(0.0000000000000000e+00); -out[19] = (real_t)(0.0000000000000000e+00); -out[20] = (real_t)(0.0000000000000000e+00); -out[21] = (real_t)(0.0000000000000000e+00); -out[22] = (real_t)(0.0000000000000000e+00); -out[23] = (real_t)(0.0000000000000000e+00); -out[24] = xd[30]; -out[25] = xd[31]; -out[26] = xd[32]; -out[27] = xd[33]; -out[28] = xd[34]; -out[29] = xd[35]; -out[30] = xd[36]; -out[31] = xd[37]; -out[32] = xd[38]; -out[33] = xd[39]; -out[34] = xd[40]; -out[35] = xd[41]; -out[36] = (((real_t)(0.0000000000000000e+00)-od[0])*xd[36]); -out[37] = (((real_t)(0.0000000000000000e+00)-od[0])*xd[37]); -out[38] = (((real_t)(0.0000000000000000e+00)-od[0])*xd[38]); -out[39] = (((real_t)(0.0000000000000000e+00)-od[0])*xd[39]); -out[40] = (((real_t)(0.0000000000000000e+00)-od[0])*xd[40]); -out[41] = (((real_t)(0.0000000000000000e+00)-od[0])*xd[41]); -out[42] = xd[43]; -out[43] = xd[44]; -out[44] = (real_t)(1.0000000000000000e+00); -out[45] = xd[46]; -out[46] = xd[47]; -out[47] = (((real_t)(0.0000000000000000e+00)-od[0])*xd[47]); -} - -/* Fixed step size:0.2 */ -int acado_integrate( real_t* const rk_eta, int resetIntegrator, int rk_index ) -{ -int error; - -int run1; -int numSteps[20] = {1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}; -int numInts = numSteps[rk_index]; -acadoWorkspace.rk_ttt = 0.0000000000000000e+00; -rk_eta[6] = 1.0000000000000000e+00; -rk_eta[7] = 0.0000000000000000e+00; -rk_eta[8] = 0.0000000000000000e+00; -rk_eta[9] = 0.0000000000000000e+00; -rk_eta[10] = 0.0000000000000000e+00; -rk_eta[11] = 0.0000000000000000e+00; -rk_eta[12] = 0.0000000000000000e+00; -rk_eta[13] = 1.0000000000000000e+00; -rk_eta[14] = 0.0000000000000000e+00; -rk_eta[15] = 0.0000000000000000e+00; -rk_eta[16] = 0.0000000000000000e+00; -rk_eta[17] = 0.0000000000000000e+00; -rk_eta[18] = 0.0000000000000000e+00; -rk_eta[19] = 0.0000000000000000e+00; -rk_eta[20] = 1.0000000000000000e+00; -rk_eta[21] = 0.0000000000000000e+00; -rk_eta[22] = 0.0000000000000000e+00; -rk_eta[23] = 0.0000000000000000e+00; -rk_eta[24] = 0.0000000000000000e+00; -rk_eta[25] = 0.0000000000000000e+00; -rk_eta[26] = 0.0000000000000000e+00; -rk_eta[27] = 1.0000000000000000e+00; -rk_eta[28] = 0.0000000000000000e+00; -rk_eta[29] = 0.0000000000000000e+00; -rk_eta[30] = 0.0000000000000000e+00; -rk_eta[31] = 0.0000000000000000e+00; -rk_eta[32] = 0.0000000000000000e+00; -rk_eta[33] = 0.0000000000000000e+00; -rk_eta[34] = 1.0000000000000000e+00; -rk_eta[35] = 0.0000000000000000e+00; -rk_eta[36] = 0.0000000000000000e+00; -rk_eta[37] = 0.0000000000000000e+00; -rk_eta[38] = 0.0000000000000000e+00; -rk_eta[39] = 0.0000000000000000e+00; -rk_eta[40] = 0.0000000000000000e+00; -rk_eta[41] = 1.0000000000000000e+00; -rk_eta[42] = 0.0000000000000000e+00; -rk_eta[43] = 0.0000000000000000e+00; -rk_eta[44] = 0.0000000000000000e+00; -rk_eta[45] = 0.0000000000000000e+00; -rk_eta[46] = 0.0000000000000000e+00; -rk_eta[47] = 0.0000000000000000e+00; -acadoWorkspace.rk_xxx[48] = rk_eta[48]; -acadoWorkspace.rk_xxx[49] = rk_eta[49]; - -for (run1 = 0; run1 < 1; ++run1) -{ -for(run1 = 0; run1 < numInts; run1++ ) { -acadoWorkspace.rk_xxx[0] = + rk_eta[0]; -acadoWorkspace.rk_xxx[1] = + rk_eta[1]; -acadoWorkspace.rk_xxx[2] = + rk_eta[2]; -acadoWorkspace.rk_xxx[3] = + rk_eta[3]; -acadoWorkspace.rk_xxx[4] = + rk_eta[4]; -acadoWorkspace.rk_xxx[5] = + rk_eta[5]; -acadoWorkspace.rk_xxx[6] = + rk_eta[6]; -acadoWorkspace.rk_xxx[7] = + rk_eta[7]; -acadoWorkspace.rk_xxx[8] = + rk_eta[8]; -acadoWorkspace.rk_xxx[9] = + rk_eta[9]; -acadoWorkspace.rk_xxx[10] = + rk_eta[10]; -acadoWorkspace.rk_xxx[11] = + rk_eta[11]; -acadoWorkspace.rk_xxx[12] = + rk_eta[12]; -acadoWorkspace.rk_xxx[13] = + rk_eta[13]; -acadoWorkspace.rk_xxx[14] = + rk_eta[14]; -acadoWorkspace.rk_xxx[15] = + rk_eta[15]; -acadoWorkspace.rk_xxx[16] = + rk_eta[16]; -acadoWorkspace.rk_xxx[17] = + rk_eta[17]; -acadoWorkspace.rk_xxx[18] = + rk_eta[18]; -acadoWorkspace.rk_xxx[19] = + rk_eta[19]; -acadoWorkspace.rk_xxx[20] = + rk_eta[20]; -acadoWorkspace.rk_xxx[21] = + rk_eta[21]; -acadoWorkspace.rk_xxx[22] = + rk_eta[22]; -acadoWorkspace.rk_xxx[23] = + rk_eta[23]; -acadoWorkspace.rk_xxx[24] = + rk_eta[24]; -acadoWorkspace.rk_xxx[25] = + rk_eta[25]; -acadoWorkspace.rk_xxx[26] = + rk_eta[26]; -acadoWorkspace.rk_xxx[27] = + rk_eta[27]; -acadoWorkspace.rk_xxx[28] = + rk_eta[28]; -acadoWorkspace.rk_xxx[29] = + rk_eta[29]; -acadoWorkspace.rk_xxx[30] = + rk_eta[30]; -acadoWorkspace.rk_xxx[31] = + rk_eta[31]; -acadoWorkspace.rk_xxx[32] = + rk_eta[32]; -acadoWorkspace.rk_xxx[33] = + rk_eta[33]; -acadoWorkspace.rk_xxx[34] = + rk_eta[34]; -acadoWorkspace.rk_xxx[35] = + rk_eta[35]; -acadoWorkspace.rk_xxx[36] = + rk_eta[36]; -acadoWorkspace.rk_xxx[37] = + rk_eta[37]; -acadoWorkspace.rk_xxx[38] = + rk_eta[38]; -acadoWorkspace.rk_xxx[39] = + rk_eta[39]; -acadoWorkspace.rk_xxx[40] = + rk_eta[40]; -acadoWorkspace.rk_xxx[41] = + rk_eta[41]; -acadoWorkspace.rk_xxx[42] = + rk_eta[42]; -acadoWorkspace.rk_xxx[43] = + rk_eta[43]; -acadoWorkspace.rk_xxx[44] = + rk_eta[44]; -acadoWorkspace.rk_xxx[45] = + rk_eta[45]; -acadoWorkspace.rk_xxx[46] = + rk_eta[46]; -acadoWorkspace.rk_xxx[47] = + rk_eta[47]; -acado_rhs_forw( acadoWorkspace.rk_xxx, acadoWorkspace.rk_kkk ); -acadoWorkspace.rk_xxx[0] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[0] + rk_eta[0]; -acadoWorkspace.rk_xxx[1] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[1] + rk_eta[1]; -acadoWorkspace.rk_xxx[2] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[2] + rk_eta[2]; -acadoWorkspace.rk_xxx[3] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[3] + rk_eta[3]; -acadoWorkspace.rk_xxx[4] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[4] + rk_eta[4]; -acadoWorkspace.rk_xxx[5] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[5] + rk_eta[5]; -acadoWorkspace.rk_xxx[6] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[6] + rk_eta[6]; -acadoWorkspace.rk_xxx[7] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[7] + rk_eta[7]; -acadoWorkspace.rk_xxx[8] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[8] + rk_eta[8]; -acadoWorkspace.rk_xxx[9] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[9] + rk_eta[9]; -acadoWorkspace.rk_xxx[10] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[10] + rk_eta[10]; -acadoWorkspace.rk_xxx[11] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[11] + rk_eta[11]; -acadoWorkspace.rk_xxx[12] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[12] + rk_eta[12]; -acadoWorkspace.rk_xxx[13] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[13] + rk_eta[13]; -acadoWorkspace.rk_xxx[14] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[14] + rk_eta[14]; -acadoWorkspace.rk_xxx[15] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[15] + rk_eta[15]; -acadoWorkspace.rk_xxx[16] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[16] + rk_eta[16]; -acadoWorkspace.rk_xxx[17] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[17] + rk_eta[17]; -acadoWorkspace.rk_xxx[18] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[18] + rk_eta[18]; -acadoWorkspace.rk_xxx[19] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[19] + rk_eta[19]; -acadoWorkspace.rk_xxx[20] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[20] + rk_eta[20]; -acadoWorkspace.rk_xxx[21] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[21] + rk_eta[21]; -acadoWorkspace.rk_xxx[22] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[22] + rk_eta[22]; -acadoWorkspace.rk_xxx[23] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[23] + rk_eta[23]; -acadoWorkspace.rk_xxx[24] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[24] + rk_eta[24]; -acadoWorkspace.rk_xxx[25] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[25] + rk_eta[25]; -acadoWorkspace.rk_xxx[26] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[26] + rk_eta[26]; -acadoWorkspace.rk_xxx[27] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[27] + rk_eta[27]; -acadoWorkspace.rk_xxx[28] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[28] + rk_eta[28]; -acadoWorkspace.rk_xxx[29] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[29] + rk_eta[29]; -acadoWorkspace.rk_xxx[30] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[30] + rk_eta[30]; -acadoWorkspace.rk_xxx[31] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[31] + rk_eta[31]; -acadoWorkspace.rk_xxx[32] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[32] + rk_eta[32]; -acadoWorkspace.rk_xxx[33] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[33] + rk_eta[33]; -acadoWorkspace.rk_xxx[34] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[34] + rk_eta[34]; -acadoWorkspace.rk_xxx[35] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[35] + rk_eta[35]; -acadoWorkspace.rk_xxx[36] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[36] + rk_eta[36]; -acadoWorkspace.rk_xxx[37] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[37] + rk_eta[37]; -acadoWorkspace.rk_xxx[38] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[38] + rk_eta[38]; -acadoWorkspace.rk_xxx[39] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[39] + rk_eta[39]; -acadoWorkspace.rk_xxx[40] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[40] + rk_eta[40]; -acadoWorkspace.rk_xxx[41] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[41] + rk_eta[41]; -acadoWorkspace.rk_xxx[42] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[42] + rk_eta[42]; -acadoWorkspace.rk_xxx[43] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[43] + rk_eta[43]; -acadoWorkspace.rk_xxx[44] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[44] + rk_eta[44]; -acadoWorkspace.rk_xxx[45] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[45] + rk_eta[45]; -acadoWorkspace.rk_xxx[46] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[46] + rk_eta[46]; -acadoWorkspace.rk_xxx[47] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[47] + rk_eta[47]; -acado_rhs_forw( acadoWorkspace.rk_xxx, &(acadoWorkspace.rk_kkk[ 48 ]) ); -acadoWorkspace.rk_xxx[0] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[48] + rk_eta[0]; -acadoWorkspace.rk_xxx[1] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[49] + rk_eta[1]; -acadoWorkspace.rk_xxx[2] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[50] + rk_eta[2]; -acadoWorkspace.rk_xxx[3] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[51] + rk_eta[3]; -acadoWorkspace.rk_xxx[4] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[52] + rk_eta[4]; -acadoWorkspace.rk_xxx[5] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[53] + rk_eta[5]; -acadoWorkspace.rk_xxx[6] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[54] + rk_eta[6]; -acadoWorkspace.rk_xxx[7] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[55] + rk_eta[7]; -acadoWorkspace.rk_xxx[8] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[56] + rk_eta[8]; -acadoWorkspace.rk_xxx[9] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[57] + rk_eta[9]; -acadoWorkspace.rk_xxx[10] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[58] + rk_eta[10]; -acadoWorkspace.rk_xxx[11] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[59] + rk_eta[11]; -acadoWorkspace.rk_xxx[12] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[60] + rk_eta[12]; -acadoWorkspace.rk_xxx[13] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[61] + rk_eta[13]; -acadoWorkspace.rk_xxx[14] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[62] + rk_eta[14]; -acadoWorkspace.rk_xxx[15] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[63] + rk_eta[15]; -acadoWorkspace.rk_xxx[16] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[64] + rk_eta[16]; -acadoWorkspace.rk_xxx[17] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[65] + rk_eta[17]; -acadoWorkspace.rk_xxx[18] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[66] + rk_eta[18]; -acadoWorkspace.rk_xxx[19] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[67] + rk_eta[19]; -acadoWorkspace.rk_xxx[20] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[68] + rk_eta[20]; -acadoWorkspace.rk_xxx[21] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[69] + rk_eta[21]; -acadoWorkspace.rk_xxx[22] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[70] + rk_eta[22]; -acadoWorkspace.rk_xxx[23] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[71] + rk_eta[23]; -acadoWorkspace.rk_xxx[24] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[72] + rk_eta[24]; -acadoWorkspace.rk_xxx[25] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[73] + rk_eta[25]; -acadoWorkspace.rk_xxx[26] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[74] + rk_eta[26]; -acadoWorkspace.rk_xxx[27] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[75] + rk_eta[27]; -acadoWorkspace.rk_xxx[28] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[76] + rk_eta[28]; -acadoWorkspace.rk_xxx[29] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[77] + rk_eta[29]; -acadoWorkspace.rk_xxx[30] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[78] + rk_eta[30]; -acadoWorkspace.rk_xxx[31] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[79] + rk_eta[31]; -acadoWorkspace.rk_xxx[32] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[80] + rk_eta[32]; -acadoWorkspace.rk_xxx[33] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[81] + rk_eta[33]; -acadoWorkspace.rk_xxx[34] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[82] + rk_eta[34]; -acadoWorkspace.rk_xxx[35] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[83] + rk_eta[35]; -acadoWorkspace.rk_xxx[36] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[84] + rk_eta[36]; -acadoWorkspace.rk_xxx[37] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[85] + rk_eta[37]; -acadoWorkspace.rk_xxx[38] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[86] + rk_eta[38]; -acadoWorkspace.rk_xxx[39] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[87] + rk_eta[39]; -acadoWorkspace.rk_xxx[40] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[88] + rk_eta[40]; -acadoWorkspace.rk_xxx[41] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[89] + rk_eta[41]; -acadoWorkspace.rk_xxx[42] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[90] + rk_eta[42]; -acadoWorkspace.rk_xxx[43] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[91] + rk_eta[43]; -acadoWorkspace.rk_xxx[44] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[92] + rk_eta[44]; -acadoWorkspace.rk_xxx[45] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[93] + rk_eta[45]; -acadoWorkspace.rk_xxx[46] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[94] + rk_eta[46]; -acadoWorkspace.rk_xxx[47] = + (real_t)9.9999999999999964e-02*acadoWorkspace.rk_kkk[95] + rk_eta[47]; -acado_rhs_forw( acadoWorkspace.rk_xxx, &(acadoWorkspace.rk_kkk[ 96 ]) ); -acadoWorkspace.rk_xxx[0] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[96] + rk_eta[0]; -acadoWorkspace.rk_xxx[1] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[97] + rk_eta[1]; -acadoWorkspace.rk_xxx[2] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[98] + rk_eta[2]; -acadoWorkspace.rk_xxx[3] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[99] + rk_eta[3]; -acadoWorkspace.rk_xxx[4] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[100] + rk_eta[4]; -acadoWorkspace.rk_xxx[5] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[101] + rk_eta[5]; -acadoWorkspace.rk_xxx[6] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[102] + rk_eta[6]; -acadoWorkspace.rk_xxx[7] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[103] + rk_eta[7]; -acadoWorkspace.rk_xxx[8] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[104] + rk_eta[8]; -acadoWorkspace.rk_xxx[9] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[105] + rk_eta[9]; -acadoWorkspace.rk_xxx[10] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[106] + rk_eta[10]; -acadoWorkspace.rk_xxx[11] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[107] + rk_eta[11]; -acadoWorkspace.rk_xxx[12] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[108] + rk_eta[12]; -acadoWorkspace.rk_xxx[13] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[109] + rk_eta[13]; -acadoWorkspace.rk_xxx[14] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[110] + rk_eta[14]; -acadoWorkspace.rk_xxx[15] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[111] + rk_eta[15]; -acadoWorkspace.rk_xxx[16] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[112] + rk_eta[16]; -acadoWorkspace.rk_xxx[17] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[113] + rk_eta[17]; -acadoWorkspace.rk_xxx[18] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[114] + rk_eta[18]; -acadoWorkspace.rk_xxx[19] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[115] + rk_eta[19]; -acadoWorkspace.rk_xxx[20] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[116] + rk_eta[20]; -acadoWorkspace.rk_xxx[21] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[117] + rk_eta[21]; -acadoWorkspace.rk_xxx[22] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[118] + rk_eta[22]; -acadoWorkspace.rk_xxx[23] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[119] + rk_eta[23]; -acadoWorkspace.rk_xxx[24] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[120] + rk_eta[24]; -acadoWorkspace.rk_xxx[25] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[121] + rk_eta[25]; -acadoWorkspace.rk_xxx[26] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[122] + rk_eta[26]; -acadoWorkspace.rk_xxx[27] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[123] + rk_eta[27]; -acadoWorkspace.rk_xxx[28] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[124] + rk_eta[28]; -acadoWorkspace.rk_xxx[29] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[125] + rk_eta[29]; -acadoWorkspace.rk_xxx[30] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[126] + rk_eta[30]; -acadoWorkspace.rk_xxx[31] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[127] + rk_eta[31]; -acadoWorkspace.rk_xxx[32] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[128] + rk_eta[32]; -acadoWorkspace.rk_xxx[33] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[129] + rk_eta[33]; -acadoWorkspace.rk_xxx[34] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[130] + rk_eta[34]; -acadoWorkspace.rk_xxx[35] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[131] + rk_eta[35]; -acadoWorkspace.rk_xxx[36] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[132] + rk_eta[36]; -acadoWorkspace.rk_xxx[37] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[133] + rk_eta[37]; -acadoWorkspace.rk_xxx[38] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[134] + rk_eta[38]; -acadoWorkspace.rk_xxx[39] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[135] + rk_eta[39]; -acadoWorkspace.rk_xxx[40] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[136] + rk_eta[40]; -acadoWorkspace.rk_xxx[41] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[137] + rk_eta[41]; -acadoWorkspace.rk_xxx[42] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[138] + rk_eta[42]; -acadoWorkspace.rk_xxx[43] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[139] + rk_eta[43]; -acadoWorkspace.rk_xxx[44] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[140] + rk_eta[44]; -acadoWorkspace.rk_xxx[45] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[141] + rk_eta[45]; -acadoWorkspace.rk_xxx[46] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[142] + rk_eta[46]; -acadoWorkspace.rk_xxx[47] = + (real_t)1.9999999999999993e-01*acadoWorkspace.rk_kkk[143] + rk_eta[47]; -acado_rhs_forw( acadoWorkspace.rk_xxx, &(acadoWorkspace.rk_kkk[ 144 ]) ); -rk_eta[0] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[0] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[48] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[96] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[144]; -rk_eta[1] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[1] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[49] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[97] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[145]; -rk_eta[2] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[2] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[50] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[98] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[146]; -rk_eta[3] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[3] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[51] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[99] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[147]; -rk_eta[4] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[4] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[52] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[100] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[148]; -rk_eta[5] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[5] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[53] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[101] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[149]; -rk_eta[6] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[6] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[54] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[102] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[150]; -rk_eta[7] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[7] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[55] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[103] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[151]; -rk_eta[8] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[8] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[56] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[104] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[152]; -rk_eta[9] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[9] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[57] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[105] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[153]; -rk_eta[10] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[10] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[58] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[106] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[154]; -rk_eta[11] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[11] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[59] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[107] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[155]; -rk_eta[12] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[12] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[60] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[108] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[156]; -rk_eta[13] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[13] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[61] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[109] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[157]; -rk_eta[14] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[14] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[62] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[110] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[158]; -rk_eta[15] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[15] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[63] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[111] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[159]; -rk_eta[16] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[16] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[64] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[112] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[160]; -rk_eta[17] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[17] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[65] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[113] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[161]; -rk_eta[18] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[18] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[66] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[114] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[162]; -rk_eta[19] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[19] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[67] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[115] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[163]; -rk_eta[20] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[20] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[68] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[116] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[164]; -rk_eta[21] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[21] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[69] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[117] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[165]; -rk_eta[22] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[22] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[70] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[118] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[166]; -rk_eta[23] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[23] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[71] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[119] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[167]; -rk_eta[24] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[24] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[72] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[120] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[168]; -rk_eta[25] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[25] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[73] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[121] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[169]; -rk_eta[26] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[26] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[74] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[122] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[170]; -rk_eta[27] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[27] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[75] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[123] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[171]; -rk_eta[28] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[28] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[76] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[124] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[172]; -rk_eta[29] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[29] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[77] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[125] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[173]; -rk_eta[30] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[30] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[78] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[126] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[174]; -rk_eta[31] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[31] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[79] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[127] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[175]; -rk_eta[32] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[32] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[80] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[128] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[176]; -rk_eta[33] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[33] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[81] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[129] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[177]; -rk_eta[34] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[34] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[82] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[130] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[178]; -rk_eta[35] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[35] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[83] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[131] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[179]; -rk_eta[36] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[36] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[84] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[132] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[180]; -rk_eta[37] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[37] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[85] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[133] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[181]; -rk_eta[38] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[38] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[86] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[134] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[182]; -rk_eta[39] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[39] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[87] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[135] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[183]; -rk_eta[40] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[40] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[88] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[136] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[184]; -rk_eta[41] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[41] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[89] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[137] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[185]; -rk_eta[42] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[42] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[90] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[138] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[186]; -rk_eta[43] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[43] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[91] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[139] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[187]; -rk_eta[44] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[44] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[92] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[140] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[188]; -rk_eta[45] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[45] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[93] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[141] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[189]; -rk_eta[46] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[46] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[94] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[142] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[190]; -rk_eta[47] += + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[47] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[95] + (real_t)6.6666666666666638e-02*acadoWorkspace.rk_kkk[143] + (real_t)3.3333333333333319e-02*acadoWorkspace.rk_kkk[191]; -acadoWorkspace.rk_ttt += 1.0000000000000000e+00; -} -} -error = 0; -return error; -} - diff --git a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_solver.c b/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_solver.c deleted file mode 100644 index a06e4a38d6dc90..00000000000000 --- a/selfdrive/controls/lib/longitudinal_mpc/mpc_export/acado_solver.c +++ /dev/null @@ -1,5368 +0,0 @@ -/* - * This file was auto-generated using the ACADO Toolkit. - * - * While ACADO Toolkit is free software released under the terms of - * the GNU Lesser General Public License (LGPL), the generated code - * as such remains the property of the user who used ACADO Toolkit - * to generate this code. In particular, user dependent data of the code - * do not inherit the GNU LGPL license. On the other hand, parts of the - * generated code that are a direct copy of source code from the - * ACADO Toolkit or the software tools it is based on, remain, as derived - * work, automatically covered by the LGPL license. - * - * ACADO Toolkit 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. - * - */ - - -#include "acado_common.h" - - - - -/******************************************************************************/ -/* */ -/* ACADO code generation */ -/* */ -/******************************************************************************/ - - -int acado_modelSimulation( ) -{ -int ret; - -int lRun1; -ret = 0; -for (lRun1 = 0; lRun1 < 20; ++lRun1) -{ -acadoWorkspace.state[0] = acadoVariables.x[lRun1 * 6]; -acadoWorkspace.state[1] = acadoVariables.x[lRun1 * 6 + 1]; -acadoWorkspace.state[2] = acadoVariables.x[lRun1 * 6 + 2]; -acadoWorkspace.state[3] = acadoVariables.x[lRun1 * 6 + 3]; -acadoWorkspace.state[4] = acadoVariables.x[lRun1 * 6 + 4]; -acadoWorkspace.state[5] = acadoVariables.x[lRun1 * 6 + 5]; - -acadoWorkspace.state[48] = acadoVariables.u[lRun1]; -acadoWorkspace.state[49] = acadoVariables.od[lRun1]; - -ret = acado_integrate(acadoWorkspace.state, 1, lRun1); - -acadoWorkspace.d[lRun1 * 6] = acadoWorkspace.state[0] - acadoVariables.x[lRun1 * 6 + 6]; -acadoWorkspace.d[lRun1 * 6 + 1] = acadoWorkspace.state[1] - acadoVariables.x[lRun1 * 6 + 7]; -acadoWorkspace.d[lRun1 * 6 + 2] = acadoWorkspace.state[2] - acadoVariables.x[lRun1 * 6 + 8]; -acadoWorkspace.d[lRun1 * 6 + 3] = acadoWorkspace.state[3] - acadoVariables.x[lRun1 * 6 + 9]; -acadoWorkspace.d[lRun1 * 6 + 4] = acadoWorkspace.state[4] - acadoVariables.x[lRun1 * 6 + 10]; -acadoWorkspace.d[lRun1 * 6 + 5] = acadoWorkspace.state[5] - acadoVariables.x[lRun1 * 6 + 11]; - -acadoWorkspace.evGx[lRun1 * 36] = acadoWorkspace.state[6]; -acadoWorkspace.evGx[lRun1 * 36 + 1] = acadoWorkspace.state[7]; -acadoWorkspace.evGx[lRun1 * 36 + 2] = acadoWorkspace.state[8]; -acadoWorkspace.evGx[lRun1 * 36 + 3] = acadoWorkspace.state[9]; -acadoWorkspace.evGx[lRun1 * 36 + 4] = acadoWorkspace.state[10]; -acadoWorkspace.evGx[lRun1 * 36 + 5] = acadoWorkspace.state[11]; -acadoWorkspace.evGx[lRun1 * 36 + 6] = acadoWorkspace.state[12]; -acadoWorkspace.evGx[lRun1 * 36 + 7] = acadoWorkspace.state[13]; -acadoWorkspace.evGx[lRun1 * 36 + 8] = acadoWorkspace.state[14]; -acadoWorkspace.evGx[lRun1 * 36 + 9] = acadoWorkspace.state[15]; -acadoWorkspace.evGx[lRun1 * 36 + 10] = acadoWorkspace.state[16]; -acadoWorkspace.evGx[lRun1 * 36 + 11] = acadoWorkspace.state[17]; -acadoWorkspace.evGx[lRun1 * 36 + 12] = acadoWorkspace.state[18]; -acadoWorkspace.evGx[lRun1 * 36 + 13] = acadoWorkspace.state[19]; -acadoWorkspace.evGx[lRun1 * 36 + 14] = acadoWorkspace.state[20]; -acadoWorkspace.evGx[lRun1 * 36 + 15] = acadoWorkspace.state[21]; -acadoWorkspace.evGx[lRun1 * 36 + 16] = acadoWorkspace.state[22]; -acadoWorkspace.evGx[lRun1 * 36 + 17] = acadoWorkspace.state[23]; -acadoWorkspace.evGx[lRun1 * 36 + 18] = acadoWorkspace.state[24]; -acadoWorkspace.evGx[lRun1 * 36 + 19] = acadoWorkspace.state[25]; -acadoWorkspace.evGx[lRun1 * 36 + 20] = acadoWorkspace.state[26]; -acadoWorkspace.evGx[lRun1 * 36 + 21] = acadoWorkspace.state[27]; -acadoWorkspace.evGx[lRun1 * 36 + 22] = acadoWorkspace.state[28]; -acadoWorkspace.evGx[lRun1 * 36 + 23] = acadoWorkspace.state[29]; -acadoWorkspace.evGx[lRun1 * 36 + 24] = acadoWorkspace.state[30]; -acadoWorkspace.evGx[lRun1 * 36 + 25] = acadoWorkspace.state[31]; -acadoWorkspace.evGx[lRun1 * 36 + 26] = acadoWorkspace.state[32]; -acadoWorkspace.evGx[lRun1 * 36 + 27] = acadoWorkspace.state[33]; -acadoWorkspace.evGx[lRun1 * 36 + 28] = acadoWorkspace.state[34]; -acadoWorkspace.evGx[lRun1 * 36 + 29] = acadoWorkspace.state[35]; -acadoWorkspace.evGx[lRun1 * 36 + 30] = acadoWorkspace.state[36]; -acadoWorkspace.evGx[lRun1 * 36 + 31] = acadoWorkspace.state[37]; -acadoWorkspace.evGx[lRun1 * 36 + 32] = acadoWorkspace.state[38]; -acadoWorkspace.evGx[lRun1 * 36 + 33] = acadoWorkspace.state[39]; -acadoWorkspace.evGx[lRun1 * 36 + 34] = acadoWorkspace.state[40]; -acadoWorkspace.evGx[lRun1 * 36 + 35] = acadoWorkspace.state[41]; - -acadoWorkspace.evGu[lRun1 * 6] = acadoWorkspace.state[42]; -acadoWorkspace.evGu[lRun1 * 6 + 1] = acadoWorkspace.state[43]; -acadoWorkspace.evGu[lRun1 * 6 + 2] = acadoWorkspace.state[44]; -acadoWorkspace.evGu[lRun1 * 6 + 3] = acadoWorkspace.state[45]; -acadoWorkspace.evGu[lRun1 * 6 + 4] = acadoWorkspace.state[46]; -acadoWorkspace.evGu[lRun1 * 6 + 5] = acadoWorkspace.state[47]; -} -return ret; -} - -void acado_evaluateLSQ(const real_t* in, real_t* out) -{ -const real_t* xd = in; -const real_t* u = in + 6; -/* Vector of auxiliary variables; number of elements: 30. */ -real_t* a = acadoWorkspace.objAuxVar; - -/* Compute intermediate quantities: */ -a[0] = (sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); -a[1] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(xd[3]-xd[0]))/(a[0]+(real_t)(1.0000000000000001e-01)))))); -a[2] = (sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); -a[3] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(a[2]+(real_t)(1.0000000000000001e-01)))))); -a[4] = ((real_t)(1.0000000000000000e+00)/(a[0]+(real_t)(1.0000000000000001e-01))); -a[5] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(xd[3]-xd[0]))/(a[0]+(real_t)(1.0000000000000001e-01)))))); -a[6] = (((real_t)(2.9999999999999999e-01)*(((real_t)(0.0000000000000000e+00)-((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00)))*a[4]))*a[5]); -a[7] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[8] = (1.0/sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); -a[9] = (a[8]*(real_t)(5.0000000000000000e-01)); -a[10] = (a[4]*a[4]); -a[11] = (((real_t)(2.9999999999999999e-01)*(((((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[7]))*a[4])-((((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(xd[3]-xd[0]))*a[9])*a[10])))*a[5]); -a[12] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[13] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[14] = ((real_t)(1.0000000000000000e+00)/(a[2]+(real_t)(1.0000000000000001e-01))); -a[15] = (1.0/sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); -a[16] = (a[15]*(real_t)(5.0000000000000000e-01)); -a[17] = (a[14]*a[14]); -a[18] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(a[2]+(real_t)(1.0000000000000001e-01)))))); -a[19] = (((real_t)(2.9999999999999999e-01)*((((((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[12]))-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[13])))*a[14])-((((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))*a[16])*a[17])))*a[18]); -a[20] = (((real_t)(2.9999999999999999e-01)*(((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00))*a[4]))*a[5]); -a[21] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[22] = (((real_t)(2.9999999999999999e-01)*((((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[21]))*a[4]))*a[5]); -a[23] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[24] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[25] = (((real_t)(2.9999999999999999e-01)*(((((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[23]))-(((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[24])))*a[14]))*a[18]); -a[26] = ((real_t)(1.0000000000000000e+00)/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); -a[27] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[28] = (a[26]*a[26]); -a[29] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); - -/* Compute outputs: */ -out[0] = (a[1]-a[3]); -out[1] = (((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); -out[2] = (xd[2]*(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00))); -out[3] = (u[0]*(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00))); -out[4] = a[6]; -out[5] = (a[11]-a[19]); -out[6] = (real_t)(0.0000000000000000e+00); -out[7] = a[20]; -out[8] = (a[22]-a[25]); -out[9] = (real_t)(0.0000000000000000e+00); -out[10] = (((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00))*a[26]); -out[11] = ((((real_t)(0.0000000000000000e+00)-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[27])))*a[26])-((((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))*(real_t)(5.0000000000000003e-02))*a[28])); -out[12] = (real_t)(0.0000000000000000e+00); -out[13] = a[26]; -out[14] = (((real_t)(0.0000000000000000e+00)-(((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[29])))*a[26]); -out[15] = (real_t)(0.0000000000000000e+00); -out[16] = (real_t)(0.0000000000000000e+00); -out[17] = (xd[2]*(real_t)(1.0000000000000001e-01)); -out[18] = (((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00)); -out[19] = (real_t)(0.0000000000000000e+00); -out[20] = (real_t)(0.0000000000000000e+00); -out[21] = (real_t)(0.0000000000000000e+00); -out[22] = (real_t)(0.0000000000000000e+00); -out[23] = (u[0]*(real_t)(1.0000000000000001e-01)); -out[24] = (real_t)(0.0000000000000000e+00); -out[25] = (real_t)(0.0000000000000000e+00); -out[26] = (real_t)(0.0000000000000000e+00); -out[27] = (real_t)(0.0000000000000000e+00); -out[28] = (real_t)(0.0000000000000000e+00); -out[29] = (real_t)(0.0000000000000000e+00); -out[30] = (real_t)(0.0000000000000000e+00); -out[31] = (((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00)); -} - -void acado_evaluateLSQEndTerm(const real_t* in, real_t* out) -{ -const real_t* xd = in; -/* Vector of auxiliary variables; number of elements: 30. */ -real_t* a = acadoWorkspace.objAuxVar; - -/* Compute intermediate quantities: */ -a[0] = (sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); -a[1] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(xd[3]-xd[0]))/(a[0]+(real_t)(1.0000000000000001e-01)))))); -a[2] = (sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); -a[3] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(a[2]+(real_t)(1.0000000000000001e-01)))))); -a[4] = ((real_t)(1.0000000000000000e+00)/(a[0]+(real_t)(1.0000000000000001e-01))); -a[5] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(xd[3]-xd[0]))/(a[0]+(real_t)(1.0000000000000001e-01)))))); -a[6] = (((real_t)(2.9999999999999999e-01)*(((real_t)(0.0000000000000000e+00)-((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00)))*a[4]))*a[5]); -a[7] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[8] = (1.0/sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); -a[9] = (a[8]*(real_t)(5.0000000000000000e-01)); -a[10] = (a[4]*a[4]); -a[11] = (((real_t)(2.9999999999999999e-01)*(((((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[7]))*a[4])-((((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-(xd[3]-xd[0]))*a[9])*a[10])))*a[5]); -a[12] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[13] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[14] = ((real_t)(1.0000000000000000e+00)/(a[2]+(real_t)(1.0000000000000001e-01))); -a[15] = (1.0/sqrt((xd[1]+(real_t)(5.0000000000000000e-01)))); -a[16] = (a[15]*(real_t)(5.0000000000000000e-01)); -a[17] = (a[14]*a[14]); -a[18] = (exp(((real_t)(2.9999999999999999e-01)*(((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(a[2]+(real_t)(1.0000000000000001e-01)))))); -a[19] = (((real_t)(2.9999999999999999e-01)*((((((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[12]))-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[13])))*a[14])-((((((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))+(real_t)(4.0000000000000000e+00))-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))*a[16])*a[17])))*a[18]); -a[20] = (((real_t)(2.9999999999999999e-01)*(((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00))*a[4]))*a[5]); -a[21] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[22] = (((real_t)(2.9999999999999999e-01)*((((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[21]))*a[4]))*a[5]); -a[23] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[24] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[25] = (((real_t)(2.9999999999999999e-01)*(((((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[23]))-(((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[24])))*a[14]))*a[18]); -a[26] = ((real_t)(1.0000000000000000e+00)/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); -a[27] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); -a[28] = (a[26]*a[26]); -a[29] = ((real_t)(1.0000000000000000e+00)/(real_t)(1.9620000000000001e+01)); - -/* Compute outputs: */ -out[0] = (a[1]-a[3]); -out[1] = (((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))/(((real_t)(5.0000000000000003e-02)*xd[1])+(real_t)(5.0000000000000000e-01))); -out[2] = (xd[2]*(((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00))); -out[3] = a[6]; -out[4] = (a[11]-a[19]); -out[5] = (real_t)(0.0000000000000000e+00); -out[6] = a[20]; -out[7] = (a[22]-a[25]); -out[8] = (real_t)(0.0000000000000000e+00); -out[9] = (((real_t)(0.0000000000000000e+00)-(real_t)(1.0000000000000000e+00))*a[26]); -out[10] = ((((real_t)(0.0000000000000000e+00)-(((real_t)(1.8000000000000000e+00)-((real_t)(-1.8000000000000000e+00)))+((xd[1]+xd[1])*a[27])))*a[26])-((((xd[3]-xd[0])-((real_t)(4.0000000000000000e+00)+((((xd[1]*(real_t)(1.8000000000000000e+00))-((xd[4]-xd[1])*(real_t)(1.8000000000000000e+00)))+((xd[1]*xd[1])/(real_t)(1.9620000000000001e+01)))-((xd[4]*xd[4])/(real_t)(1.9620000000000001e+01)))))*(real_t)(5.0000000000000003e-02))*a[28])); -out[11] = (real_t)(0.0000000000000000e+00); -out[12] = a[26]; -out[13] = (((real_t)(0.0000000000000000e+00)-(((real_t)(0.0000000000000000e+00)-(real_t)(1.8000000000000000e+00))-((xd[4]+xd[4])*a[29])))*a[26]); -out[14] = (real_t)(0.0000000000000000e+00); -out[15] = (real_t)(0.0000000000000000e+00); -out[16] = (xd[2]*(real_t)(1.0000000000000001e-01)); -out[17] = (((real_t)(1.0000000000000001e-01)*xd[1])+(real_t)(1.0000000000000000e+00)); -out[18] = (real_t)(0.0000000000000000e+00); -out[19] = (real_t)(0.0000000000000000e+00); -out[20] = (real_t)(0.0000000000000000e+00); -} - -void acado_setObjQ1Q2( real_t* const tmpFx, real_t* const tmpObjS, real_t* const tmpQ1, real_t* const tmpQ2 ) -{ -tmpQ2[0] = + tmpFx[0]*tmpObjS[0] + tmpFx[6]*tmpObjS[4] + tmpFx[12]*tmpObjS[8] + tmpFx[18]*tmpObjS[12]; -tmpQ2[1] = + tmpFx[0]*tmpObjS[1] + tmpFx[6]*tmpObjS[5] + tmpFx[12]*tmpObjS[9] + tmpFx[18]*tmpObjS[13]; -tmpQ2[2] = + tmpFx[0]*tmpObjS[2] + tmpFx[6]*tmpObjS[6] + tmpFx[12]*tmpObjS[10] + tmpFx[18]*tmpObjS[14]; -tmpQ2[3] = + tmpFx[0]*tmpObjS[3] + tmpFx[6]*tmpObjS[7] + tmpFx[12]*tmpObjS[11] + tmpFx[18]*tmpObjS[15]; -tmpQ2[4] = + tmpFx[1]*tmpObjS[0] + tmpFx[7]*tmpObjS[4] + tmpFx[13]*tmpObjS[8] + tmpFx[19]*tmpObjS[12]; -tmpQ2[5] = + tmpFx[1]*tmpObjS[1] + tmpFx[7]*tmpObjS[5] + tmpFx[13]*tmpObjS[9] + tmpFx[19]*tmpObjS[13]; -tmpQ2[6] = + tmpFx[1]*tmpObjS[2] + tmpFx[7]*tmpObjS[6] + tmpFx[13]*tmpObjS[10] + tmpFx[19]*tmpObjS[14]; -tmpQ2[7] = + tmpFx[1]*tmpObjS[3] + tmpFx[7]*tmpObjS[7] + tmpFx[13]*tmpObjS[11] + tmpFx[19]*tmpObjS[15]; -tmpQ2[8] = + tmpFx[2]*tmpObjS[0] + tmpFx[8]*tmpObjS[4] + tmpFx[14]*tmpObjS[8] + tmpFx[20]*tmpObjS[12]; -tmpQ2[9] = + tmpFx[2]*tmpObjS[1] + tmpFx[8]*tmpObjS[5] + tmpFx[14]*tmpObjS[9] + tmpFx[20]*tmpObjS[13]; -tmpQ2[10] = + tmpFx[2]*tmpObjS[2] + tmpFx[8]*tmpObjS[6] + tmpFx[14]*tmpObjS[10] + tmpFx[20]*tmpObjS[14]; -tmpQ2[11] = + tmpFx[2]*tmpObjS[3] + tmpFx[8]*tmpObjS[7] + tmpFx[14]*tmpObjS[11] + tmpFx[20]*tmpObjS[15]; -tmpQ2[12] = + tmpFx[3]*tmpObjS[0] + tmpFx[9]*tmpObjS[4] + tmpFx[15]*tmpObjS[8] + tmpFx[21]*tmpObjS[12]; -tmpQ2[13] = + tmpFx[3]*tmpObjS[1] + tmpFx[9]*tmpObjS[5] + tmpFx[15]*tmpObjS[9] + tmpFx[21]*tmpObjS[13]; -tmpQ2[14] = + tmpFx[3]*tmpObjS[2] + tmpFx[9]*tmpObjS[6] + tmpFx[15]*tmpObjS[10] + tmpFx[21]*tmpObjS[14]; -tmpQ2[15] = + tmpFx[3]*tmpObjS[3] + tmpFx[9]*tmpObjS[7] + tmpFx[15]*tmpObjS[11] + tmpFx[21]*tmpObjS[15]; -tmpQ2[16] = + tmpFx[4]*tmpObjS[0] + tmpFx[10]*tmpObjS[4] + tmpFx[16]*tmpObjS[8] + tmpFx[22]*tmpObjS[12]; -tmpQ2[17] = + tmpFx[4]*tmpObjS[1] + tmpFx[10]*tmpObjS[5] + tmpFx[16]*tmpObjS[9] + tmpFx[22]*tmpObjS[13]; -tmpQ2[18] = + tmpFx[4]*tmpObjS[2] + tmpFx[10]*tmpObjS[6] + tmpFx[16]*tmpObjS[10] + tmpFx[22]*tmpObjS[14]; -tmpQ2[19] = + tmpFx[4]*tmpObjS[3] + tmpFx[10]*tmpObjS[7] + tmpFx[16]*tmpObjS[11] + tmpFx[22]*tmpObjS[15]; -tmpQ2[20] = + tmpFx[5]*tmpObjS[0] + tmpFx[11]*tmpObjS[4] + tmpFx[17]*tmpObjS[8] + tmpFx[23]*tmpObjS[12]; -tmpQ2[21] = + tmpFx[5]*tmpObjS[1] + tmpFx[11]*tmpObjS[5] + tmpFx[17]*tmpObjS[9] + tmpFx[23]*tmpObjS[13]; -tmpQ2[22] = + tmpFx[5]*tmpObjS[2] + tmpFx[11]*tmpObjS[6] + tmpFx[17]*tmpObjS[10] + tmpFx[23]*tmpObjS[14]; -tmpQ2[23] = + tmpFx[5]*tmpObjS[3] + tmpFx[11]*tmpObjS[7] + tmpFx[17]*tmpObjS[11] + tmpFx[23]*tmpObjS[15]; -tmpQ1[0] = + tmpQ2[0]*tmpFx[0] + tmpQ2[1]*tmpFx[6] + tmpQ2[2]*tmpFx[12] + tmpQ2[3]*tmpFx[18]; -tmpQ1[1] = + tmpQ2[0]*tmpFx[1] + tmpQ2[1]*tmpFx[7] + tmpQ2[2]*tmpFx[13] + tmpQ2[3]*tmpFx[19]; -tmpQ1[2] = + tmpQ2[0]*tmpFx[2] + tmpQ2[1]*tmpFx[8] + tmpQ2[2]*tmpFx[14] + tmpQ2[3]*tmpFx[20]; -tmpQ1[3] = + tmpQ2[0]*tmpFx[3] + tmpQ2[1]*tmpFx[9] + tmpQ2[2]*tmpFx[15] + tmpQ2[3]*tmpFx[21]; -tmpQ1[4] = + tmpQ2[0]*tmpFx[4] + tmpQ2[1]*tmpFx[10] + tmpQ2[2]*tmpFx[16] + tmpQ2[3]*tmpFx[22]; -tmpQ1[5] = + tmpQ2[0]*tmpFx[5] + tmpQ2[1]*tmpFx[11] + tmpQ2[2]*tmpFx[17] + tmpQ2[3]*tmpFx[23]; -tmpQ1[6] = + tmpQ2[4]*tmpFx[0] + tmpQ2[5]*tmpFx[6] + tmpQ2[6]*tmpFx[12] + tmpQ2[7]*tmpFx[18]; -tmpQ1[7] = + tmpQ2[4]*tmpFx[1] + tmpQ2[5]*tmpFx[7] + tmpQ2[6]*tmpFx[13] + tmpQ2[7]*tmpFx[19]; -tmpQ1[8] = + tmpQ2[4]*tmpFx[2] + tmpQ2[5]*tmpFx[8] + tmpQ2[6]*tmpFx[14] + tmpQ2[7]*tmpFx[20]; -tmpQ1[9] = + tmpQ2[4]*tmpFx[3] + tmpQ2[5]*tmpFx[9] + tmpQ2[6]*tmpFx[15] + tmpQ2[7]*tmpFx[21]; -tmpQ1[10] = + tmpQ2[4]*tmpFx[4] + tmpQ2[5]*tmpFx[10] + tmpQ2[6]*tmpFx[16] + tmpQ2[7]*tmpFx[22]; -tmpQ1[11] = + tmpQ2[4]*tmpFx[5] + tmpQ2[5]*tmpFx[11] + tmpQ2[6]*tmpFx[17] + tmpQ2[7]*tmpFx[23]; -tmpQ1[12] = + tmpQ2[8]*tmpFx[0] + tmpQ2[9]*tmpFx[6] + tmpQ2[10]*tmpFx[12] + tmpQ2[11]*tmpFx[18]; -tmpQ1[13] = + tmpQ2[8]*tmpFx[1] + tmpQ2[9]*tmpFx[7] + tmpQ2[10]*tmpFx[13] + tmpQ2[11]*tmpFx[19]; -tmpQ1[14] = + tmpQ2[8]*tmpFx[2] + tmpQ2[9]*tmpFx[8] + tmpQ2[10]*tmpFx[14] + tmpQ2[11]*tmpFx[20]; -tmpQ1[15] = + tmpQ2[8]*tmpFx[3] + tmpQ2[9]*tmpFx[9] + tmpQ2[10]*tmpFx[15] + tmpQ2[11]*tmpFx[21]; -tmpQ1[16] = + tmpQ2[8]*tmpFx[4] + tmpQ2[9]*tmpFx[10] + tmpQ2[10]*tmpFx[16] + tmpQ2[11]*tmpFx[22]; -tmpQ1[17] = + tmpQ2[8]*tmpFx[5] + tmpQ2[9]*tmpFx[11] + tmpQ2[10]*tmpFx[17] + tmpQ2[11]*tmpFx[23]; -tmpQ1[18] = + tmpQ2[12]*tmpFx[0] + tmpQ2[13]*tmpFx[6] + tmpQ2[14]*tmpFx[12] + tmpQ2[15]*tmpFx[18]; -tmpQ1[19] = + tmpQ2[12]*tmpFx[1] + tmpQ2[13]*tmpFx[7] + tmpQ2[14]*tmpFx[13] + tmpQ2[15]*tmpFx[19]; -tmpQ1[20] = + tmpQ2[12]*tmpFx[2] + tmpQ2[13]*tmpFx[8] + tmpQ2[14]*tmpFx[14] + tmpQ2[15]*tmpFx[20]; -tmpQ1[21] = + tmpQ2[12]*tmpFx[3] + tmpQ2[13]*tmpFx[9] + tmpQ2[14]*tmpFx[15] + tmpQ2[15]*tmpFx[21]; -tmpQ1[22] = + tmpQ2[12]*tmpFx[4] + tmpQ2[13]*tmpFx[10] + tmpQ2[14]*tmpFx[16] + tmpQ2[15]*tmpFx[22]; -tmpQ1[23] = + tmpQ2[12]*tmpFx[5] + tmpQ2[13]*tmpFx[11] + tmpQ2[14]*tmpFx[17] + tmpQ2[15]*tmpFx[23]; -tmpQ1[24] = + tmpQ2[16]*tmpFx[0] + tmpQ2[17]*tmpFx[6] + tmpQ2[18]*tmpFx[12] + tmpQ2[19]*tmpFx[18]; -tmpQ1[25] = + tmpQ2[16]*tmpFx[1] + tmpQ2[17]*tmpFx[7] + tmpQ2[18]*tmpFx[13] + tmpQ2[19]*tmpFx[19]; -tmpQ1[26] = + tmpQ2[16]*tmpFx[2] + tmpQ2[17]*tmpFx[8] + tmpQ2[18]*tmpFx[14] + tmpQ2[19]*tmpFx[20]; -tmpQ1[27] = + tmpQ2[16]*tmpFx[3] + tmpQ2[17]*tmpFx[9] + tmpQ2[18]*tmpFx[15] + tmpQ2[19]*tmpFx[21]; -tmpQ1[28] = + tmpQ2[16]*tmpFx[4] + tmpQ2[17]*tmpFx[10] + tmpQ2[18]*tmpFx[16] + tmpQ2[19]*tmpFx[22]; -tmpQ1[29] = + tmpQ2[16]*tmpFx[5] + tmpQ2[17]*tmpFx[11] + tmpQ2[18]*tmpFx[17] + tmpQ2[19]*tmpFx[23]; -tmpQ1[30] = + tmpQ2[20]*tmpFx[0] + tmpQ2[21]*tmpFx[6] + tmpQ2[22]*tmpFx[12] + tmpQ2[23]*tmpFx[18]; -tmpQ1[31] = + tmpQ2[20]*tmpFx[1] + tmpQ2[21]*tmpFx[7] + tmpQ2[22]*tmpFx[13] + tmpQ2[23]*tmpFx[19]; -tmpQ1[32] = + tmpQ2[20]*tmpFx[2] + tmpQ2[21]*tmpFx[8] + tmpQ2[22]*tmpFx[14] + tmpQ2[23]*tmpFx[20]; -tmpQ1[33] = + tmpQ2[20]*tmpFx[3] + tmpQ2[21]*tmpFx[9] + tmpQ2[22]*tmpFx[15] + tmpQ2[23]*tmpFx[21]; -tmpQ1[34] = + tmpQ2[20]*tmpFx[4] + tmpQ2[21]*tmpFx[10] + tmpQ2[22]*tmpFx[16] + tmpQ2[23]*tmpFx[22]; -tmpQ1[35] = + tmpQ2[20]*tmpFx[5] + tmpQ2[21]*tmpFx[11] + tmpQ2[22]*tmpFx[17] + tmpQ2[23]*tmpFx[23]; -} - -void acado_setObjR1R2( real_t* const tmpFu, real_t* const tmpObjS, real_t* const tmpR1, real_t* const tmpR2 ) -{ -tmpR2[0] = + tmpFu[0]*tmpObjS[0] + tmpFu[1]*tmpObjS[4] + tmpFu[2]*tmpObjS[8] + tmpFu[3]*tmpObjS[12]; -tmpR2[1] = + tmpFu[0]*tmpObjS[1] + tmpFu[1]*tmpObjS[5] + tmpFu[2]*tmpObjS[9] + tmpFu[3]*tmpObjS[13]; -tmpR2[2] = + tmpFu[0]*tmpObjS[2] + tmpFu[1]*tmpObjS[6] + tmpFu[2]*tmpObjS[10] + tmpFu[3]*tmpObjS[14]; -tmpR2[3] = + tmpFu[0]*tmpObjS[3] + tmpFu[1]*tmpObjS[7] + tmpFu[2]*tmpObjS[11] + tmpFu[3]*tmpObjS[15]; -tmpR1[0] = + tmpR2[0]*tmpFu[0] + tmpR2[1]*tmpFu[1] + tmpR2[2]*tmpFu[2] + tmpR2[3]*tmpFu[3]; -} - -void acado_setObjQN1QN2( real_t* const tmpFx, real_t* const tmpObjSEndTerm, real_t* const tmpQN1, real_t* const tmpQN2 ) -{ -tmpQN2[0] = + tmpFx[0]*tmpObjSEndTerm[0] + tmpFx[6]*tmpObjSEndTerm[3] + tmpFx[12]*tmpObjSEndTerm[6]; -tmpQN2[1] = + tmpFx[0]*tmpObjSEndTerm[1] + tmpFx[6]*tmpObjSEndTerm[4] + tmpFx[12]*tmpObjSEndTerm[7]; -tmpQN2[2] = + tmpFx[0]*tmpObjSEndTerm[2] + tmpFx[6]*tmpObjSEndTerm[5] + tmpFx[12]*tmpObjSEndTerm[8]; -tmpQN2[3] = + tmpFx[1]*tmpObjSEndTerm[0] + tmpFx[7]*tmpObjSEndTerm[3] + tmpFx[13]*tmpObjSEndTerm[6]; -tmpQN2[4] = + tmpFx[1]*tmpObjSEndTerm[1] + tmpFx[7]*tmpObjSEndTerm[4] + tmpFx[13]*tmpObjSEndTerm[7]; -tmpQN2[5] = + tmpFx[1]*tmpObjSEndTerm[2] + tmpFx[7]*tmpObjSEndTerm[5] + tmpFx[13]*tmpObjSEndTerm[8]; -tmpQN2[6] = + tmpFx[2]*tmpObjSEndTerm[0] + tmpFx[8]*tmpObjSEndTerm[3] + tmpFx[14]*tmpObjSEndTerm[6]; -tmpQN2[7] = + tmpFx[2]*tmpObjSEndTerm[1] + tmpFx[8]*tmpObjSEndTerm[4] + tmpFx[14]*tmpObjSEndTerm[7]; -tmpQN2[8] = + tmpFx[2]*tmpObjSEndTerm[2] + tmpFx[8]*tmpObjSEndTerm[5] + tmpFx[14]*tmpObjSEndTerm[8]; -tmpQN2[9] = + tmpFx[3]*tmpObjSEndTerm[0] + tmpFx[9]*tmpObjSEndTerm[3] + tmpFx[15]*tmpObjSEndTerm[6]; -tmpQN2[10] = + tmpFx[3]*tmpObjSEndTerm[1] + tmpFx[9]*tmpObjSEndTerm[4] + tmpFx[15]*tmpObjSEndTerm[7]; -tmpQN2[11] = + tmpFx[3]*tmpObjSEndTerm[2] + tmpFx[9]*tmpObjSEndTerm[5] + tmpFx[15]*tmpObjSEndTerm[8]; -tmpQN2[12] = + tmpFx[4]*tmpObjSEndTerm[0] + tmpFx[10]*tmpObjSEndTerm[3] + tmpFx[16]*tmpObjSEndTerm[6]; -tmpQN2[13] = + tmpFx[4]*tmpObjSEndTerm[1] + tmpFx[10]*tmpObjSEndTerm[4] + tmpFx[16]*tmpObjSEndTerm[7]; -tmpQN2[14] = + tmpFx[4]*tmpObjSEndTerm[2] + tmpFx[10]*tmpObjSEndTerm[5] + tmpFx[16]*tmpObjSEndTerm[8]; -tmpQN2[15] = + tmpFx[5]*tmpObjSEndTerm[0] + tmpFx[11]*tmpObjSEndTerm[3] + tmpFx[17]*tmpObjSEndTerm[6]; -tmpQN2[16] = + tmpFx[5]*tmpObjSEndTerm[1] + tmpFx[11]*tmpObjSEndTerm[4] + tmpFx[17]*tmpObjSEndTerm[7]; -tmpQN2[17] = + tmpFx[5]*tmpObjSEndTerm[2] + tmpFx[11]*tmpObjSEndTerm[5] + tmpFx[17]*tmpObjSEndTerm[8]; -tmpQN1[0] = + tmpQN2[0]*tmpFx[0] + tmpQN2[1]*tmpFx[6] + tmpQN2[2]*tmpFx[12]; -tmpQN1[1] = + tmpQN2[0]*tmpFx[1] + tmpQN2[1]*tmpFx[7] + tmpQN2[2]*tmpFx[13]; -tmpQN1[2] = + tmpQN2[0]*tmpFx[2] + tmpQN2[1]*tmpFx[8] + tmpQN2[2]*tmpFx[14]; -tmpQN1[3] = + tmpQN2[0]*tmpFx[3] + tmpQN2[1]*tmpFx[9] + tmpQN2[2]*tmpFx[15]; -tmpQN1[4] = + tmpQN2[0]*tmpFx[4] + tmpQN2[1]*tmpFx[10] + tmpQN2[2]*tmpFx[16]; -tmpQN1[5] = + tmpQN2[0]*tmpFx[5] + tmpQN2[1]*tmpFx[11] + tmpQN2[2]*tmpFx[17]; -tmpQN1[6] = + tmpQN2[3]*tmpFx[0] + tmpQN2[4]*tmpFx[6] + tmpQN2[5]*tmpFx[12]; -tmpQN1[7] = + tmpQN2[3]*tmpFx[1] + tmpQN2[4]*tmpFx[7] + tmpQN2[5]*tmpFx[13]; -tmpQN1[8] = + tmpQN2[3]*tmpFx[2] + tmpQN2[4]*tmpFx[8] + tmpQN2[5]*tmpFx[14]; -tmpQN1[9] = + tmpQN2[3]*tmpFx[3] + tmpQN2[4]*tmpFx[9] + tmpQN2[5]*tmpFx[15]; -tmpQN1[10] = + tmpQN2[3]*tmpFx[4] + tmpQN2[4]*tmpFx[10] + tmpQN2[5]*tmpFx[16]; -tmpQN1[11] = + tmpQN2[3]*tmpFx[5] + tmpQN2[4]*tmpFx[11] + tmpQN2[5]*tmpFx[17]; -tmpQN1[12] = + tmpQN2[6]*tmpFx[0] + tmpQN2[7]*tmpFx[6] + tmpQN2[8]*tmpFx[12]; -tmpQN1[13] = + tmpQN2[6]*tmpFx[1] + tmpQN2[7]*tmpFx[7] + tmpQN2[8]*tmpFx[13]; -tmpQN1[14] = + tmpQN2[6]*tmpFx[2] + tmpQN2[7]*tmpFx[8] + tmpQN2[8]*tmpFx[14]; -tmpQN1[15] = + tmpQN2[6]*tmpFx[3] + tmpQN2[7]*tmpFx[9] + tmpQN2[8]*tmpFx[15]; -tmpQN1[16] = + tmpQN2[6]*tmpFx[4] + tmpQN2[7]*tmpFx[10] + tmpQN2[8]*tmpFx[16]; -tmpQN1[17] = + tmpQN2[6]*tmpFx[5] + tmpQN2[7]*tmpFx[11] + tmpQN2[8]*tmpFx[17]; -tmpQN1[18] = + tmpQN2[9]*tmpFx[0] + tmpQN2[10]*tmpFx[6] + tmpQN2[11]*tmpFx[12]; -tmpQN1[19] = + tmpQN2[9]*tmpFx[1] + tmpQN2[10]*tmpFx[7] + tmpQN2[11]*tmpFx[13]; -tmpQN1[20] = + tmpQN2[9]*tmpFx[2] + tmpQN2[10]*tmpFx[8] + tmpQN2[11]*tmpFx[14]; -tmpQN1[21] = + tmpQN2[9]*tmpFx[3] + tmpQN2[10]*tmpFx[9] + tmpQN2[11]*tmpFx[15]; -tmpQN1[22] = + tmpQN2[9]*tmpFx[4] + tmpQN2[10]*tmpFx[10] + tmpQN2[11]*tmpFx[16]; -tmpQN1[23] = + tmpQN2[9]*tmpFx[5] + tmpQN2[10]*tmpFx[11] + tmpQN2[11]*tmpFx[17]; -tmpQN1[24] = + tmpQN2[12]*tmpFx[0] + tmpQN2[13]*tmpFx[6] + tmpQN2[14]*tmpFx[12]; -tmpQN1[25] = + tmpQN2[12]*tmpFx[1] + tmpQN2[13]*tmpFx[7] + tmpQN2[14]*tmpFx[13]; -tmpQN1[26] = + tmpQN2[12]*tmpFx[2] + tmpQN2[13]*tmpFx[8] + tmpQN2[14]*tmpFx[14]; -tmpQN1[27] = + tmpQN2[12]*tmpFx[3] + tmpQN2[13]*tmpFx[9] + tmpQN2[14]*tmpFx[15]; -tmpQN1[28] = + tmpQN2[12]*tmpFx[4] + tmpQN2[13]*tmpFx[10] + tmpQN2[14]*tmpFx[16]; -tmpQN1[29] = + tmpQN2[12]*tmpFx[5] + tmpQN2[13]*tmpFx[11] + tmpQN2[14]*tmpFx[17]; -tmpQN1[30] = + tmpQN2[15]*tmpFx[0] + tmpQN2[16]*tmpFx[6] + tmpQN2[17]*tmpFx[12]; -tmpQN1[31] = + tmpQN2[15]*tmpFx[1] + tmpQN2[16]*tmpFx[7] + tmpQN2[17]*tmpFx[13]; -tmpQN1[32] = + tmpQN2[15]*tmpFx[2] + tmpQN2[16]*tmpFx[8] + tmpQN2[17]*tmpFx[14]; -tmpQN1[33] = + tmpQN2[15]*tmpFx[3] + tmpQN2[16]*tmpFx[9] + tmpQN2[17]*tmpFx[15]; -tmpQN1[34] = + tmpQN2[15]*tmpFx[4] + tmpQN2[16]*tmpFx[10] + tmpQN2[17]*tmpFx[16]; -tmpQN1[35] = + tmpQN2[15]*tmpFx[5] + tmpQN2[16]*tmpFx[11] + tmpQN2[17]*tmpFx[17]; -} - -void acado_evaluateObjective( ) -{ -int runObj; -for (runObj = 0; runObj < 20; ++runObj) -{ -acadoWorkspace.objValueIn[0] = acadoVariables.x[runObj * 6]; -acadoWorkspace.objValueIn[1] = acadoVariables.x[runObj * 6 + 1]; -acadoWorkspace.objValueIn[2] = acadoVariables.x[runObj * 6 + 2]; -acadoWorkspace.objValueIn[3] = acadoVariables.x[runObj * 6 + 3]; -acadoWorkspace.objValueIn[4] = acadoVariables.x[runObj * 6 + 4]; -acadoWorkspace.objValueIn[5] = acadoVariables.x[runObj * 6 + 5]; -acadoWorkspace.objValueIn[6] = acadoVariables.u[runObj]; -acadoWorkspace.objValueIn[7] = acadoVariables.od[runObj]; - -acado_evaluateLSQ( acadoWorkspace.objValueIn, acadoWorkspace.objValueOut ); -acadoWorkspace.Dy[runObj * 4] = acadoWorkspace.objValueOut[0]; -acadoWorkspace.Dy[runObj * 4 + 1] = acadoWorkspace.objValueOut[1]; -acadoWorkspace.Dy[runObj * 4 + 2] = acadoWorkspace.objValueOut[2]; -acadoWorkspace.Dy[runObj * 4 + 3] = acadoWorkspace.objValueOut[3]; - -acado_setObjQ1Q2( &(acadoWorkspace.objValueOut[ 4 ]), &(acadoVariables.W[ runObj * 16 ]), &(acadoWorkspace.Q1[ runObj * 36 ]), &(acadoWorkspace.Q2[ runObj * 24 ]) ); - -acado_setObjR1R2( &(acadoWorkspace.objValueOut[ 28 ]), &(acadoVariables.W[ runObj * 16 ]), &(acadoWorkspace.R1[ runObj ]), &(acadoWorkspace.R2[ runObj * 4 ]) ); - -} -acadoWorkspace.objValueIn[0] = acadoVariables.x[120]; -acadoWorkspace.objValueIn[1] = acadoVariables.x[121]; -acadoWorkspace.objValueIn[2] = acadoVariables.x[122]; -acadoWorkspace.objValueIn[3] = acadoVariables.x[123]; -acadoWorkspace.objValueIn[4] = acadoVariables.x[124]; -acadoWorkspace.objValueIn[5] = acadoVariables.x[125]; -acadoWorkspace.objValueIn[6] = acadoVariables.od[20]; -acado_evaluateLSQEndTerm( acadoWorkspace.objValueIn, acadoWorkspace.objValueOut ); - -acadoWorkspace.DyN[0] = acadoWorkspace.objValueOut[0]; -acadoWorkspace.DyN[1] = acadoWorkspace.objValueOut[1]; -acadoWorkspace.DyN[2] = acadoWorkspace.objValueOut[2]; - -acado_setObjQN1QN2( &(acadoWorkspace.objValueOut[ 3 ]), acadoVariables.WN, acadoWorkspace.QN1, acadoWorkspace.QN2 ); - -} - -void acado_multGxd( real_t* const dOld, real_t* const Gx1, real_t* const dNew ) -{ -dNew[0] += + Gx1[0]*dOld[0] + Gx1[1]*dOld[1] + Gx1[2]*dOld[2] + Gx1[3]*dOld[3] + Gx1[4]*dOld[4] + Gx1[5]*dOld[5]; -dNew[1] += + Gx1[6]*dOld[0] + Gx1[7]*dOld[1] + Gx1[8]*dOld[2] + Gx1[9]*dOld[3] + Gx1[10]*dOld[4] + Gx1[11]*dOld[5]; -dNew[2] += + Gx1[12]*dOld[0] + Gx1[13]*dOld[1] + Gx1[14]*dOld[2] + Gx1[15]*dOld[3] + Gx1[16]*dOld[4] + Gx1[17]*dOld[5]; -dNew[3] += + Gx1[18]*dOld[0] + Gx1[19]*dOld[1] + Gx1[20]*dOld[2] + Gx1[21]*dOld[3] + Gx1[22]*dOld[4] + Gx1[23]*dOld[5]; -dNew[4] += + Gx1[24]*dOld[0] + Gx1[25]*dOld[1] + Gx1[26]*dOld[2] + Gx1[27]*dOld[3] + Gx1[28]*dOld[4] + Gx1[29]*dOld[5]; -dNew[5] += + Gx1[30]*dOld[0] + Gx1[31]*dOld[1] + Gx1[32]*dOld[2] + Gx1[33]*dOld[3] + Gx1[34]*dOld[4] + Gx1[35]*dOld[5]; -} - -void acado_moveGxT( real_t* const Gx1, real_t* const Gx2 ) -{ -Gx2[0] = Gx1[0]; -Gx2[1] = Gx1[1]; -Gx2[2] = Gx1[2]; -Gx2[3] = Gx1[3]; -Gx2[4] = Gx1[4]; -Gx2[5] = Gx1[5]; -Gx2[6] = Gx1[6]; -Gx2[7] = Gx1[7]; -Gx2[8] = Gx1[8]; -Gx2[9] = Gx1[9]; -Gx2[10] = Gx1[10]; -Gx2[11] = Gx1[11]; -Gx2[12] = Gx1[12]; -Gx2[13] = Gx1[13]; -Gx2[14] = Gx1[14]; -Gx2[15] = Gx1[15]; -Gx2[16] = Gx1[16]; -Gx2[17] = Gx1[17]; -Gx2[18] = Gx1[18]; -Gx2[19] = Gx1[19]; -Gx2[20] = Gx1[20]; -Gx2[21] = Gx1[21]; -Gx2[22] = Gx1[22]; -Gx2[23] = Gx1[23]; -Gx2[24] = Gx1[24]; -Gx2[25] = Gx1[25]; -Gx2[26] = Gx1[26]; -Gx2[27] = Gx1[27]; -Gx2[28] = Gx1[28]; -Gx2[29] = Gx1[29]; -Gx2[30] = Gx1[30]; -Gx2[31] = Gx1[31]; -Gx2[32] = Gx1[32]; -Gx2[33] = Gx1[33]; -Gx2[34] = Gx1[34]; -Gx2[35] = Gx1[35]; -} - -void acado_multGxGx( real_t* const Gx1, real_t* const Gx2, real_t* const Gx3 ) -{ -Gx3[0] = + Gx1[0]*Gx2[0] + Gx1[1]*Gx2[6] + Gx1[2]*Gx2[12] + Gx1[3]*Gx2[18] + Gx1[4]*Gx2[24] + Gx1[5]*Gx2[30]; -Gx3[1] = + Gx1[0]*Gx2[1] + Gx1[1]*Gx2[7] + Gx1[2]*Gx2[13] + Gx1[3]*Gx2[19] + Gx1[4]*Gx2[25] + Gx1[5]*Gx2[31]; -Gx3[2] = + Gx1[0]*Gx2[2] + Gx1[1]*Gx2[8] + Gx1[2]*Gx2[14] + Gx1[3]*Gx2[20] + Gx1[4]*Gx2[26] + Gx1[5]*Gx2[32]; -Gx3[3] = + Gx1[0]*Gx2[3] + Gx1[1]*Gx2[9] + Gx1[2]*Gx2[15] + Gx1[3]*Gx2[21] + Gx1[4]*Gx2[27] + Gx1[5]*Gx2[33]; -Gx3[4] = + Gx1[0]*Gx2[4] + Gx1[1]*Gx2[10] + Gx1[2]*Gx2[16] + Gx1[3]*Gx2[22] + Gx1[4]*Gx2[28] + Gx1[5]*Gx2[34]; -Gx3[5] = + Gx1[0]*Gx2[5] + Gx1[1]*Gx2[11] + Gx1[2]*Gx2[17] + Gx1[3]*Gx2[23] + Gx1[4]*Gx2[29] + Gx1[5]*Gx2[35]; -Gx3[6] = + Gx1[6]*Gx2[0] + Gx1[7]*Gx2[6] + Gx1[8]*Gx2[12] + Gx1[9]*Gx2[18] + Gx1[10]*Gx2[24] + Gx1[11]*Gx2[30]; -Gx3[7] = + Gx1[6]*Gx2[1] + Gx1[7]*Gx2[7] + Gx1[8]*Gx2[13] + Gx1[9]*Gx2[19] + Gx1[10]*Gx2[25] + Gx1[11]*Gx2[31]; -Gx3[8] = + Gx1[6]*Gx2[2] + Gx1[7]*Gx2[8] + Gx1[8]*Gx2[14] + Gx1[9]*Gx2[20] + Gx1[10]*Gx2[26] + Gx1[11]*Gx2[32]; -Gx3[9] = + Gx1[6]*Gx2[3] + Gx1[7]*Gx2[9] + Gx1[8]*Gx2[15] + Gx1[9]*Gx2[21] + Gx1[10]*Gx2[27] + Gx1[11]*Gx2[33]; -Gx3[10] = + Gx1[6]*Gx2[4] + Gx1[7]*Gx2[10] + Gx1[8]*Gx2[16] + Gx1[9]*Gx2[22] + Gx1[10]*Gx2[28] + Gx1[11]*Gx2[34]; -Gx3[11] = + Gx1[6]*Gx2[5] + Gx1[7]*Gx2[11] + Gx1[8]*Gx2[17] + Gx1[9]*Gx2[23] + Gx1[10]*Gx2[29] + Gx1[11]*Gx2[35]; -Gx3[12] = + Gx1[12]*Gx2[0] + Gx1[13]*Gx2[6] + Gx1[14]*Gx2[12] + Gx1[15]*Gx2[18] + Gx1[16]*Gx2[24] + Gx1[17]*Gx2[30]; -Gx3[13] = + Gx1[12]*Gx2[1] + Gx1[13]*Gx2[7] + Gx1[14]*Gx2[13] + Gx1[15]*Gx2[19] + Gx1[16]*Gx2[25] + Gx1[17]*Gx2[31]; -Gx3[14] = + Gx1[12]*Gx2[2] + Gx1[13]*Gx2[8] + Gx1[14]*Gx2[14] + Gx1[15]*Gx2[20] + Gx1[16]*Gx2[26] + Gx1[17]*Gx2[32]; -Gx3[15] = + Gx1[12]*Gx2[3] + Gx1[13]*Gx2[9] + Gx1[14]*Gx2[15] + Gx1[15]*Gx2[21] + Gx1[16]*Gx2[27] + Gx1[17]*Gx2[33]; -Gx3[16] = + Gx1[12]*Gx2[4] + Gx1[13]*Gx2[10] + Gx1[14]*Gx2[16] + Gx1[15]*Gx2[22] + Gx1[16]*Gx2[28] + Gx1[17]*Gx2[34]; -Gx3[17] = + Gx1[12]*Gx2[5] + Gx1[13]*Gx2[11] + Gx1[14]*Gx2[17] + Gx1[15]*Gx2[23] + Gx1[16]*Gx2[29] + Gx1[17]*Gx2[35]; -Gx3[18] = + Gx1[18]*Gx2[0] + Gx1[19]*Gx2[6] + Gx1[20]*Gx2[12] + Gx1[21]*Gx2[18] + Gx1[22]*Gx2[24] + Gx1[23]*Gx2[30]; -Gx3[19] = + Gx1[18]*Gx2[1] + Gx1[19]*Gx2[7] + Gx1[20]*Gx2[13] + Gx1[21]*Gx2[19] + Gx1[22]*Gx2[25] + Gx1[23]*Gx2[31]; -Gx3[20] = + Gx1[18]*Gx2[2] + Gx1[19]*Gx2[8] + Gx1[20]*Gx2[14] + Gx1[21]*Gx2[20] + Gx1[22]*Gx2[26] + Gx1[23]*Gx2[32]; -Gx3[21] = + Gx1[18]*Gx2[3] + Gx1[19]*Gx2[9] + Gx1[20]*Gx2[15] + Gx1[21]*Gx2[21] + Gx1[22]*Gx2[27] + Gx1[23]*Gx2[33]; -Gx3[22] = + Gx1[18]*Gx2[4] + Gx1[19]*Gx2[10] + Gx1[20]*Gx2[16] + Gx1[21]*Gx2[22] + Gx1[22]*Gx2[28] + Gx1[23]*Gx2[34]; -Gx3[23] = + Gx1[18]*Gx2[5] + Gx1[19]*Gx2[11] + Gx1[20]*Gx2[17] + Gx1[21]*Gx2[23] + Gx1[22]*Gx2[29] + Gx1[23]*Gx2[35]; -Gx3[24] = + Gx1[24]*Gx2[0] + Gx1[25]*Gx2[6] + Gx1[26]*Gx2[12] + Gx1[27]*Gx2[18] + Gx1[28]*Gx2[24] + Gx1[29]*Gx2[30]; -Gx3[25] = + Gx1[24]*Gx2[1] + Gx1[25]*Gx2[7] + Gx1[26]*Gx2[13] + Gx1[27]*Gx2[19] + Gx1[28]*Gx2[25] + Gx1[29]*Gx2[31]; -Gx3[26] = + Gx1[24]*Gx2[2] + Gx1[25]*Gx2[8] + Gx1[26]*Gx2[14] + Gx1[27]*Gx2[20] + Gx1[28]*Gx2[26] + Gx1[29]*Gx2[32]; -Gx3[27] = + Gx1[24]*Gx2[3] + Gx1[25]*Gx2[9] + Gx1[26]*Gx2[15] + Gx1[27]*Gx2[21] + Gx1[28]*Gx2[27] + Gx1[29]*Gx2[33]; -Gx3[28] = + Gx1[24]*Gx2[4] + Gx1[25]*Gx2[10] + Gx1[26]*Gx2[16] + Gx1[27]*Gx2[22] + Gx1[28]*Gx2[28] + Gx1[29]*Gx2[34]; -Gx3[29] = + Gx1[24]*Gx2[5] + Gx1[25]*Gx2[11] + Gx1[26]*Gx2[17] + Gx1[27]*Gx2[23] + Gx1[28]*Gx2[29] + Gx1[29]*Gx2[35]; -Gx3[30] = + Gx1[30]*Gx2[0] + Gx1[31]*Gx2[6] + Gx1[32]*Gx2[12] + Gx1[33]*Gx2[18] + Gx1[34]*Gx2[24] + Gx1[35]*Gx2[30]; -Gx3[31] = + Gx1[30]*Gx2[1] + Gx1[31]*Gx2[7] + Gx1[32]*Gx2[13] + Gx1[33]*Gx2[19] + Gx1[34]*Gx2[25] + Gx1[35]*Gx2[31]; -Gx3[32] = + Gx1[30]*Gx2[2] + Gx1[31]*Gx2[8] + Gx1[32]*Gx2[14] + Gx1[33]*Gx2[20] + Gx1[34]*Gx2[26] + Gx1[35]*Gx2[32]; -Gx3[33] = + Gx1[30]*Gx2[3] + Gx1[31]*Gx2[9] + Gx1[32]*Gx2[15] + Gx1[33]*Gx2[21] + Gx1[34]*Gx2[27] + Gx1[35]*Gx2[33]; -Gx3[34] = + Gx1[30]*Gx2[4] + Gx1[31]*Gx2[10] + Gx1[32]*Gx2[16] + Gx1[33]*Gx2[22] + Gx1[34]*Gx2[28] + Gx1[35]*Gx2[34]; -Gx3[35] = + Gx1[30]*Gx2[5] + Gx1[31]*Gx2[11] + Gx1[32]*Gx2[17] + Gx1[33]*Gx2[23] + Gx1[34]*Gx2[29] + Gx1[35]*Gx2[35]; -} - -void acado_multGxGu( real_t* const Gx1, real_t* const Gu1, real_t* const Gu2 ) -{ -Gu2[0] = + Gx1[0]*Gu1[0] + Gx1[1]*Gu1[1] + Gx1[2]*Gu1[2] + Gx1[3]*Gu1[3] + Gx1[4]*Gu1[4] + Gx1[5]*Gu1[5]; -Gu2[1] = + Gx1[6]*Gu1[0] + Gx1[7]*Gu1[1] + Gx1[8]*Gu1[2] + Gx1[9]*Gu1[3] + Gx1[10]*Gu1[4] + Gx1[11]*Gu1[5]; -Gu2[2] = + Gx1[12]*Gu1[0] + Gx1[13]*Gu1[1] + Gx1[14]*Gu1[2] + Gx1[15]*Gu1[3] + Gx1[16]*Gu1[4] + Gx1[17]*Gu1[5]; -Gu2[3] = + Gx1[18]*Gu1[0] + Gx1[19]*Gu1[1] + Gx1[20]*Gu1[2] + Gx1[21]*Gu1[3] + Gx1[22]*Gu1[4] + Gx1[23]*Gu1[5]; -Gu2[4] = + Gx1[24]*Gu1[0] + Gx1[25]*Gu1[1] + Gx1[26]*Gu1[2] + Gx1[27]*Gu1[3] + Gx1[28]*Gu1[4] + Gx1[29]*Gu1[5]; -Gu2[5] = + Gx1[30]*Gu1[0] + Gx1[31]*Gu1[1] + Gx1[32]*Gu1[2] + Gx1[33]*Gu1[3] + Gx1[34]*Gu1[4] + Gx1[35]*Gu1[5]; -} - -void acado_moveGuE( real_t* const Gu1, real_t* const Gu2 ) -{ -Gu2[0] = Gu1[0]; -Gu2[1] = Gu1[1]; -Gu2[2] = Gu1[2]; -Gu2[3] = Gu1[3]; -Gu2[4] = Gu1[4]; -Gu2[5] = Gu1[5]; -} - -void acado_setBlockH11( int iRow, int iCol, real_t* const Gu1, real_t* const Gu2 ) -{ -acadoWorkspace.H[(iRow * 26 + 156) + (iCol + 6)] += + Gu1[0]*Gu2[0] + Gu1[1]*Gu2[1] + Gu1[2]*Gu2[2] + Gu1[3]*Gu2[3] + Gu1[4]*Gu2[4] + Gu1[5]*Gu2[5]; -} - -void acado_setBlockH11_R1( int iRow, int iCol, real_t* const R11 ) -{ -acadoWorkspace.H[(iRow * 26 + 156) + (iCol + 6)] = R11[0]; -} - -void acado_zeroBlockH11( int iRow, int iCol ) -{ -acadoWorkspace.H[(iRow * 26 + 156) + (iCol + 6)] = 0.0000000000000000e+00; -} - -void acado_copyHTH( int iRow, int iCol ) -{ -acadoWorkspace.H[(iRow * 26 + 156) + (iCol + 6)] = acadoWorkspace.H[(iCol * 26 + 156) + (iRow + 6)]; -} - -void acado_multQ1d( real_t* const Gx1, real_t* const dOld, real_t* const dNew ) -{ -dNew[0] = + Gx1[0]*dOld[0] + Gx1[1]*dOld[1] + Gx1[2]*dOld[2] + Gx1[3]*dOld[3] + Gx1[4]*dOld[4] + Gx1[5]*dOld[5]; -dNew[1] = + Gx1[6]*dOld[0] + Gx1[7]*dOld[1] + Gx1[8]*dOld[2] + Gx1[9]*dOld[3] + Gx1[10]*dOld[4] + Gx1[11]*dOld[5]; -dNew[2] = + Gx1[12]*dOld[0] + Gx1[13]*dOld[1] + Gx1[14]*dOld[2] + Gx1[15]*dOld[3] + Gx1[16]*dOld[4] + Gx1[17]*dOld[5]; -dNew[3] = + Gx1[18]*dOld[0] + Gx1[19]*dOld[1] + Gx1[20]*dOld[2] + Gx1[21]*dOld[3] + Gx1[22]*dOld[4] + Gx1[23]*dOld[5]; -dNew[4] = + Gx1[24]*dOld[0] + Gx1[25]*dOld[1] + Gx1[26]*dOld[2] + Gx1[27]*dOld[3] + Gx1[28]*dOld[4] + Gx1[29]*dOld[5]; -dNew[5] = + Gx1[30]*dOld[0] + Gx1[31]*dOld[1] + Gx1[32]*dOld[2] + Gx1[33]*dOld[3] + Gx1[34]*dOld[4] + Gx1[35]*dOld[5]; -} - -void acado_multQN1d( real_t* const QN1, real_t* const dOld, real_t* const dNew ) -{ -dNew[0] = + acadoWorkspace.QN1[0]*dOld[0] + acadoWorkspace.QN1[1]*dOld[1] + acadoWorkspace.QN1[2]*dOld[2] + acadoWorkspace.QN1[3]*dOld[3] + acadoWorkspace.QN1[4]*dOld[4] + acadoWorkspace.QN1[5]*dOld[5]; -dNew[1] = + acadoWorkspace.QN1[6]*dOld[0] + acadoWorkspace.QN1[7]*dOld[1] + acadoWorkspace.QN1[8]*dOld[2] + acadoWorkspace.QN1[9]*dOld[3] + acadoWorkspace.QN1[10]*dOld[4] + acadoWorkspace.QN1[11]*dOld[5]; -dNew[2] = + acadoWorkspace.QN1[12]*dOld[0] + acadoWorkspace.QN1[13]*dOld[1] + acadoWorkspace.QN1[14]*dOld[2] + acadoWorkspace.QN1[15]*dOld[3] + acadoWorkspace.QN1[16]*dOld[4] + acadoWorkspace.QN1[17]*dOld[5]; -dNew[3] = + acadoWorkspace.QN1[18]*dOld[0] + acadoWorkspace.QN1[19]*dOld[1] + acadoWorkspace.QN1[20]*dOld[2] + acadoWorkspace.QN1[21]*dOld[3] + acadoWorkspace.QN1[22]*dOld[4] + acadoWorkspace.QN1[23]*dOld[5]; -dNew[4] = + acadoWorkspace.QN1[24]*dOld[0] + acadoWorkspace.QN1[25]*dOld[1] + acadoWorkspace.QN1[26]*dOld[2] + acadoWorkspace.QN1[27]*dOld[3] + acadoWorkspace.QN1[28]*dOld[4] + acadoWorkspace.QN1[29]*dOld[5]; -dNew[5] = + acadoWorkspace.QN1[30]*dOld[0] + acadoWorkspace.QN1[31]*dOld[1] + acadoWorkspace.QN1[32]*dOld[2] + acadoWorkspace.QN1[33]*dOld[3] + acadoWorkspace.QN1[34]*dOld[4] + acadoWorkspace.QN1[35]*dOld[5]; -} - -void acado_multRDy( real_t* const R2, real_t* const Dy1, real_t* const RDy1 ) -{ -RDy1[0] = + R2[0]*Dy1[0] + R2[1]*Dy1[1] + R2[2]*Dy1[2] + R2[3]*Dy1[3]; -} - -void acado_multQDy( real_t* const Q2, real_t* const Dy1, real_t* const QDy1 ) -{ -QDy1[0] = + Q2[0]*Dy1[0] + Q2[1]*Dy1[1] + Q2[2]*Dy1[2] + Q2[3]*Dy1[3]; -QDy1[1] = + Q2[4]*Dy1[0] + Q2[5]*Dy1[1] + Q2[6]*Dy1[2] + Q2[7]*Dy1[3]; -QDy1[2] = + Q2[8]*Dy1[0] + Q2[9]*Dy1[1] + Q2[10]*Dy1[2] + Q2[11]*Dy1[3]; -QDy1[3] = + Q2[12]*Dy1[0] + Q2[13]*Dy1[1] + Q2[14]*Dy1[2] + Q2[15]*Dy1[3]; -QDy1[4] = + Q2[16]*Dy1[0] + Q2[17]*Dy1[1] + Q2[18]*Dy1[2] + Q2[19]*Dy1[3]; -QDy1[5] = + Q2[20]*Dy1[0] + Q2[21]*Dy1[1] + Q2[22]*Dy1[2] + Q2[23]*Dy1[3]; -} - -void acado_multEQDy( real_t* const E1, real_t* const QDy1, real_t* const U1 ) -{ -U1[0] += + E1[0]*QDy1[0] + E1[1]*QDy1[1] + E1[2]*QDy1[2] + E1[3]*QDy1[3] + E1[4]*QDy1[4] + E1[5]*QDy1[5]; -} - -void acado_multQETGx( real_t* const E1, real_t* const Gx1, real_t* const H101 ) -{ -H101[0] += + E1[0]*Gx1[0] + E1[1]*Gx1[6] + E1[2]*Gx1[12] + E1[3]*Gx1[18] + E1[4]*Gx1[24] + E1[5]*Gx1[30]; -H101[1] += + E1[0]*Gx1[1] + E1[1]*Gx1[7] + E1[2]*Gx1[13] + E1[3]*Gx1[19] + E1[4]*Gx1[25] + E1[5]*Gx1[31]; -H101[2] += + E1[0]*Gx1[2] + E1[1]*Gx1[8] + E1[2]*Gx1[14] + E1[3]*Gx1[20] + E1[4]*Gx1[26] + E1[5]*Gx1[32]; -H101[3] += + E1[0]*Gx1[3] + E1[1]*Gx1[9] + E1[2]*Gx1[15] + E1[3]*Gx1[21] + E1[4]*Gx1[27] + E1[5]*Gx1[33]; -H101[4] += + E1[0]*Gx1[4] + E1[1]*Gx1[10] + E1[2]*Gx1[16] + E1[3]*Gx1[22] + E1[4]*Gx1[28] + E1[5]*Gx1[34]; -H101[5] += + E1[0]*Gx1[5] + E1[1]*Gx1[11] + E1[2]*Gx1[17] + E1[3]*Gx1[23] + E1[4]*Gx1[29] + E1[5]*Gx1[35]; -} - -void acado_zeroBlockH10( real_t* const H101 ) -{ -{ int lCopy; for (lCopy = 0; lCopy < 6; lCopy++) H101[ lCopy ] = 0; } -} - -void acado_multEDu( real_t* const E1, real_t* const U1, real_t* const dNew ) -{ -dNew[0] += + E1[0]*U1[0]; -dNew[1] += + E1[1]*U1[0]; -dNew[2] += + E1[2]*U1[0]; -dNew[3] += + E1[3]*U1[0]; -dNew[4] += + E1[4]*U1[0]; -dNew[5] += + E1[5]*U1[0]; -} - -void acado_zeroBlockH00( ) -{ -acadoWorkspace.H[0] = 0.0000000000000000e+00; -acadoWorkspace.H[1] = 0.0000000000000000e+00; -acadoWorkspace.H[2] = 0.0000000000000000e+00; -acadoWorkspace.H[3] = 0.0000000000000000e+00; -acadoWorkspace.H[4] = 0.0000000000000000e+00; -acadoWorkspace.H[5] = 0.0000000000000000e+00; -acadoWorkspace.H[26] = 0.0000000000000000e+00; -acadoWorkspace.H[27] = 0.0000000000000000e+00; -acadoWorkspace.H[28] = 0.0000000000000000e+00; -acadoWorkspace.H[29] = 0.0000000000000000e+00; -acadoWorkspace.H[30] = 0.0000000000000000e+00; -acadoWorkspace.H[31] = 0.0000000000000000e+00; -acadoWorkspace.H[52] = 0.0000000000000000e+00; -acadoWorkspace.H[53] = 0.0000000000000000e+00; -acadoWorkspace.H[54] = 0.0000000000000000e+00; -acadoWorkspace.H[55] = 0.0000000000000000e+00; -acadoWorkspace.H[56] = 0.0000000000000000e+00; -acadoWorkspace.H[57] = 0.0000000000000000e+00; -acadoWorkspace.H[78] = 0.0000000000000000e+00; -acadoWorkspace.H[79] = 0.0000000000000000e+00; -acadoWorkspace.H[80] = 0.0000000000000000e+00; -acadoWorkspace.H[81] = 0.0000000000000000e+00; -acadoWorkspace.H[82] = 0.0000000000000000e+00; -acadoWorkspace.H[83] = 0.0000000000000000e+00; -acadoWorkspace.H[104] = 0.0000000000000000e+00; -acadoWorkspace.H[105] = 0.0000000000000000e+00; -acadoWorkspace.H[106] = 0.0000000000000000e+00; -acadoWorkspace.H[107] = 0.0000000000000000e+00; -acadoWorkspace.H[108] = 0.0000000000000000e+00; -acadoWorkspace.H[109] = 0.0000000000000000e+00; -acadoWorkspace.H[130] = 0.0000000000000000e+00; -acadoWorkspace.H[131] = 0.0000000000000000e+00; -acadoWorkspace.H[132] = 0.0000000000000000e+00; -acadoWorkspace.H[133] = 0.0000000000000000e+00; -acadoWorkspace.H[134] = 0.0000000000000000e+00; -acadoWorkspace.H[135] = 0.0000000000000000e+00; -} - -void acado_multCTQC( real_t* const Gx1, real_t* const Gx2 ) -{ -acadoWorkspace.H[0] += + Gx1[0]*Gx2[0] + Gx1[6]*Gx2[6] + Gx1[12]*Gx2[12] + Gx1[18]*Gx2[18] + Gx1[24]*Gx2[24] + Gx1[30]*Gx2[30]; -acadoWorkspace.H[1] += + Gx1[0]*Gx2[1] + Gx1[6]*Gx2[7] + Gx1[12]*Gx2[13] + Gx1[18]*Gx2[19] + Gx1[24]*Gx2[25] + Gx1[30]*Gx2[31]; -acadoWorkspace.H[2] += + Gx1[0]*Gx2[2] + Gx1[6]*Gx2[8] + Gx1[12]*Gx2[14] + Gx1[18]*Gx2[20] + Gx1[24]*Gx2[26] + Gx1[30]*Gx2[32]; -acadoWorkspace.H[3] += + Gx1[0]*Gx2[3] + Gx1[6]*Gx2[9] + Gx1[12]*Gx2[15] + Gx1[18]*Gx2[21] + Gx1[24]*Gx2[27] + Gx1[30]*Gx2[33]; -acadoWorkspace.H[4] += + Gx1[0]*Gx2[4] + Gx1[6]*Gx2[10] + Gx1[12]*Gx2[16] + Gx1[18]*Gx2[22] + Gx1[24]*Gx2[28] + Gx1[30]*Gx2[34]; -acadoWorkspace.H[5] += + Gx1[0]*Gx2[5] + Gx1[6]*Gx2[11] + Gx1[12]*Gx2[17] + Gx1[18]*Gx2[23] + Gx1[24]*Gx2[29] + Gx1[30]*Gx2[35]; -acadoWorkspace.H[26] += + Gx1[1]*Gx2[0] + Gx1[7]*Gx2[6] + Gx1[13]*Gx2[12] + Gx1[19]*Gx2[18] + Gx1[25]*Gx2[24] + Gx1[31]*Gx2[30]; -acadoWorkspace.H[27] += + Gx1[1]*Gx2[1] + Gx1[7]*Gx2[7] + Gx1[13]*Gx2[13] + Gx1[19]*Gx2[19] + Gx1[25]*Gx2[25] + Gx1[31]*Gx2[31]; -acadoWorkspace.H[28] += + Gx1[1]*Gx2[2] + Gx1[7]*Gx2[8] + Gx1[13]*Gx2[14] + Gx1[19]*Gx2[20] + Gx1[25]*Gx2[26] + Gx1[31]*Gx2[32]; -acadoWorkspace.H[29] += + Gx1[1]*Gx2[3] + Gx1[7]*Gx2[9] + Gx1[13]*Gx2[15] + Gx1[19]*Gx2[21] + Gx1[25]*Gx2[27] + Gx1[31]*Gx2[33]; -acadoWorkspace.H[30] += + Gx1[1]*Gx2[4] + Gx1[7]*Gx2[10] + Gx1[13]*Gx2[16] + Gx1[19]*Gx2[22] + Gx1[25]*Gx2[28] + Gx1[31]*Gx2[34]; -acadoWorkspace.H[31] += + Gx1[1]*Gx2[5] + Gx1[7]*Gx2[11] + Gx1[13]*Gx2[17] + Gx1[19]*Gx2[23] + Gx1[25]*Gx2[29] + Gx1[31]*Gx2[35]; -acadoWorkspace.H[52] += + Gx1[2]*Gx2[0] + Gx1[8]*Gx2[6] + Gx1[14]*Gx2[12] + Gx1[20]*Gx2[18] + Gx1[26]*Gx2[24] + Gx1[32]*Gx2[30]; -acadoWorkspace.H[53] += + Gx1[2]*Gx2[1] + Gx1[8]*Gx2[7] + Gx1[14]*Gx2[13] + Gx1[20]*Gx2[19] + Gx1[26]*Gx2[25] + Gx1[32]*Gx2[31]; -acadoWorkspace.H[54] += + Gx1[2]*Gx2[2] + Gx1[8]*Gx2[8] + Gx1[14]*Gx2[14] + Gx1[20]*Gx2[20] + Gx1[26]*Gx2[26] + Gx1[32]*Gx2[32]; -acadoWorkspace.H[55] += + Gx1[2]*Gx2[3] + Gx1[8]*Gx2[9] + Gx1[14]*Gx2[15] + Gx1[20]*Gx2[21] + Gx1[26]*Gx2[27] + Gx1[32]*Gx2[33]; -acadoWorkspace.H[56] += + Gx1[2]*Gx2[4] + Gx1[8]*Gx2[10] + Gx1[14]*Gx2[16] + Gx1[20]*Gx2[22] + Gx1[26]*Gx2[28] + Gx1[32]*Gx2[34]; -acadoWorkspace.H[57] += + Gx1[2]*Gx2[5] + Gx1[8]*Gx2[11] + Gx1[14]*Gx2[17] + Gx1[20]*Gx2[23] + Gx1[26]*Gx2[29] + Gx1[32]*Gx2[35]; -acadoWorkspace.H[78] += + Gx1[3]*Gx2[0] + Gx1[9]*Gx2[6] + Gx1[15]*Gx2[12] + Gx1[21]*Gx2[18] + Gx1[27]*Gx2[24] + Gx1[33]*Gx2[30]; -acadoWorkspace.H[79] += + Gx1[3]*Gx2[1] + Gx1[9]*Gx2[7] + Gx1[15]*Gx2[13] + Gx1[21]*Gx2[19] + Gx1[27]*Gx2[25] + Gx1[33]*Gx2[31]; -acadoWorkspace.H[80] += + Gx1[3]*Gx2[2] + Gx1[9]*Gx2[8] + Gx1[15]*Gx2[14] + Gx1[21]*Gx2[20] + Gx1[27]*Gx2[26] + Gx1[33]*Gx2[32]; -acadoWorkspace.H[81] += + Gx1[3]*Gx2[3] + Gx1[9]*Gx2[9] + Gx1[15]*Gx2[15] + Gx1[21]*Gx2[21] + Gx1[27]*Gx2[27] + Gx1[33]*Gx2[33]; -acadoWorkspace.H[82] += + Gx1[3]*Gx2[4] + Gx1[9]*Gx2[10] + Gx1[15]*Gx2[16] + Gx1[21]*Gx2[22] + Gx1[27]*Gx2[28] + Gx1[33]*Gx2[34]; -acadoWorkspace.H[83] += + Gx1[3]*Gx2[5] + Gx1[9]*Gx2[11] + Gx1[15]*Gx2[17] + Gx1[21]*Gx2[23] + Gx1[27]*Gx2[29] + Gx1[33]*Gx2[35]; -acadoWorkspace.H[104] += + Gx1[4]*Gx2[0] + Gx1[10]*Gx2[6] + Gx1[16]*Gx2[12] + Gx1[22]*Gx2[18] + Gx1[28]*Gx2[24] + Gx1[34]*Gx2[30]; -acadoWorkspace.H[105] += + Gx1[4]*Gx2[1] + Gx1[10]*Gx2[7] + Gx1[16]*Gx2[13] + Gx1[22]*Gx2[19] + Gx1[28]*Gx2[25] + Gx1[34]*Gx2[31]; -acadoWorkspace.H[106] += + Gx1[4]*Gx2[2] + Gx1[10]*Gx2[8] + Gx1[16]*Gx2[14] + Gx1[22]*Gx2[20] + Gx1[28]*Gx2[26] + Gx1[34]*Gx2[32]; -acadoWorkspace.H[107] += + Gx1[4]*Gx2[3] + Gx1[10]*Gx2[9] + Gx1[16]*Gx2[15] + Gx1[22]*Gx2[21] + Gx1[28]*Gx2[27] + Gx1[34]*Gx2[33]; -acadoWorkspace.H[108] += + Gx1[4]*Gx2[4] + Gx1[10]*Gx2[10] + Gx1[16]*Gx2[16] + Gx1[22]*Gx2[22] + Gx1[28]*Gx2[28] + Gx1[34]*Gx2[34]; -acadoWorkspace.H[109] += + Gx1[4]*Gx2[5] + Gx1[10]*Gx2[11] + Gx1[16]*Gx2[17] + Gx1[22]*Gx2[23] + Gx1[28]*Gx2[29] + Gx1[34]*Gx2[35]; -acadoWorkspace.H[130] += + Gx1[5]*Gx2[0] + Gx1[11]*Gx2[6] + Gx1[17]*Gx2[12] + Gx1[23]*Gx2[18] + Gx1[29]*Gx2[24] + Gx1[35]*Gx2[30]; -acadoWorkspace.H[131] += + Gx1[5]*Gx2[1] + Gx1[11]*Gx2[7] + Gx1[17]*Gx2[13] + Gx1[23]*Gx2[19] + Gx1[29]*Gx2[25] + Gx1[35]*Gx2[31]; -acadoWorkspace.H[132] += + Gx1[5]*Gx2[2] + Gx1[11]*Gx2[8] + Gx1[17]*Gx2[14] + Gx1[23]*Gx2[20] + Gx1[29]*Gx2[26] + Gx1[35]*Gx2[32]; -acadoWorkspace.H[133] += + Gx1[5]*Gx2[3] + Gx1[11]*Gx2[9] + Gx1[17]*Gx2[15] + Gx1[23]*Gx2[21] + Gx1[29]*Gx2[27] + Gx1[35]*Gx2[33]; -acadoWorkspace.H[134] += + Gx1[5]*Gx2[4] + Gx1[11]*Gx2[10] + Gx1[17]*Gx2[16] + Gx1[23]*Gx2[22] + Gx1[29]*Gx2[28] + Gx1[35]*Gx2[34]; -acadoWorkspace.H[135] += + Gx1[5]*Gx2[5] + Gx1[11]*Gx2[11] + Gx1[17]*Gx2[17] + Gx1[23]*Gx2[23] + Gx1[29]*Gx2[29] + Gx1[35]*Gx2[35]; -} - -void acado_macCTSlx( real_t* const C0, real_t* const g0 ) -{ -g0[0] += 0.0; -; -g0[1] += 0.0; -; -g0[2] += 0.0; -; -g0[3] += 0.0; -; -g0[4] += 0.0; -; -g0[5] += 0.0; -; -} - -void acado_macETSlu( real_t* const E0, real_t* const g1 ) -{ -g1[0] += 0.0; -; -} - -void acado_condensePrep( ) -{ -int lRun1; -int lRun2; -int lRun3; -int lRun4; -int lRun5; -/** Row vector of size: 20 */ -static const int xBoundIndices[ 20 ] = -{ 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121 }; -acado_moveGuE( acadoWorkspace.evGu, acadoWorkspace.E ); -acado_moveGxT( &(acadoWorkspace.evGx[ 36 ]), acadoWorkspace.T ); -acado_multGxd( acadoWorkspace.d, &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.d[ 6 ]) ); -acado_multGxGx( acadoWorkspace.T, acadoWorkspace.evGx, &(acadoWorkspace.evGx[ 36 ]) ); - -acado_multGxGu( acadoWorkspace.T, acadoWorkspace.E, &(acadoWorkspace.E[ 6 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 6 ]), &(acadoWorkspace.E[ 12 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 72 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 6 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.d[ 12 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.evGx[ 72 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.E[ 18 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.E[ 24 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 12 ]), &(acadoWorkspace.E[ 30 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 108 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 12 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.d[ 18 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.evGx[ 108 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.E[ 36 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.E[ 42 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.E[ 48 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 18 ]), &(acadoWorkspace.E[ 54 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 144 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 18 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.d[ 24 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.evGx[ 144 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.E[ 60 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.E[ 66 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.E[ 72 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.E[ 78 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 24 ]), &(acadoWorkspace.E[ 84 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 180 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 24 ]), &(acadoWorkspace.evGx[ 180 ]), &(acadoWorkspace.d[ 30 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.evGx[ 180 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.E[ 90 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.E[ 96 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.E[ 102 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.E[ 108 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.E[ 114 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 30 ]), &(acadoWorkspace.E[ 120 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 216 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 30 ]), &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.d[ 36 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 180 ]), &(acadoWorkspace.evGx[ 216 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.E[ 126 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.E[ 132 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.E[ 138 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.E[ 144 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.E[ 150 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.E[ 156 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 36 ]), &(acadoWorkspace.E[ 162 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 252 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 36 ]), &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.d[ 42 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.evGx[ 252 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.E[ 168 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.E[ 174 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.E[ 180 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.E[ 186 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.E[ 192 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.E[ 198 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.E[ 204 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 42 ]), &(acadoWorkspace.E[ 210 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 288 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 42 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.d[ 48 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.evGx[ 288 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.E[ 216 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.E[ 222 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.E[ 228 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.E[ 234 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.E[ 240 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.E[ 246 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.E[ 252 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.E[ 258 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 48 ]), &(acadoWorkspace.E[ 264 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 324 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 48 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.d[ 54 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.evGx[ 324 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.E[ 270 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.E[ 276 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.E[ 282 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.E[ 288 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.E[ 294 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.E[ 300 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.E[ 306 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.E[ 312 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.E[ 318 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 54 ]), &(acadoWorkspace.E[ 324 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 360 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 54 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.d[ 60 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.evGx[ 360 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.E[ 330 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.E[ 336 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.E[ 342 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.E[ 348 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.E[ 354 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.E[ 360 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.E[ 366 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.E[ 372 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.E[ 378 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.E[ 384 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 60 ]), &(acadoWorkspace.E[ 390 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 396 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 60 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.d[ 66 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.evGx[ 396 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.E[ 396 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.E[ 402 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.E[ 408 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.E[ 414 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.E[ 420 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.E[ 426 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.E[ 432 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.E[ 438 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.E[ 444 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.E[ 450 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.E[ 456 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 66 ]), &(acadoWorkspace.E[ 462 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 432 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 66 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.d[ 72 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.evGx[ 432 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.E[ 468 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.E[ 474 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.E[ 480 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.E[ 486 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.E[ 492 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.E[ 498 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.E[ 504 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.E[ 510 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.E[ 516 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.E[ 522 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.E[ 528 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.E[ 534 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 72 ]), &(acadoWorkspace.E[ 540 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 468 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 72 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.d[ 78 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.evGx[ 468 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.E[ 546 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.E[ 552 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.E[ 558 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.E[ 564 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.E[ 570 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.E[ 576 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.E[ 582 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.E[ 588 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.E[ 594 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.E[ 600 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.E[ 606 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.E[ 612 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.E[ 618 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 78 ]), &(acadoWorkspace.E[ 624 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 504 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 78 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.d[ 84 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.evGx[ 504 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.E[ 630 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.E[ 636 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.E[ 642 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.E[ 648 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.E[ 654 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.E[ 660 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.E[ 666 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.E[ 672 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.E[ 678 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.E[ 684 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.E[ 690 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.E[ 696 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.E[ 702 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.E[ 708 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 84 ]), &(acadoWorkspace.E[ 714 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 540 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 84 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.d[ 90 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.evGx[ 540 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.E[ 720 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.E[ 726 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.E[ 732 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.E[ 738 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.E[ 744 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.E[ 750 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.E[ 756 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.E[ 762 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.E[ 768 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.E[ 774 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 690 ]), &(acadoWorkspace.E[ 780 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 696 ]), &(acadoWorkspace.E[ 786 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 702 ]), &(acadoWorkspace.E[ 792 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 708 ]), &(acadoWorkspace.E[ 798 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 714 ]), &(acadoWorkspace.E[ 804 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 90 ]), &(acadoWorkspace.E[ 810 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 576 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 90 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.d[ 96 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.evGx[ 576 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.E[ 816 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.E[ 822 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.E[ 828 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.E[ 834 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.E[ 840 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.E[ 846 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.E[ 852 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.E[ 858 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.E[ 864 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.E[ 870 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.E[ 876 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 786 ]), &(acadoWorkspace.E[ 882 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 792 ]), &(acadoWorkspace.E[ 888 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 798 ]), &(acadoWorkspace.E[ 894 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 804 ]), &(acadoWorkspace.E[ 900 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 810 ]), &(acadoWorkspace.E[ 906 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 96 ]), &(acadoWorkspace.E[ 912 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 612 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 96 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.d[ 102 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.evGx[ 612 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.E[ 918 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.E[ 924 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.E[ 930 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.E[ 936 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.E[ 942 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.E[ 948 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.E[ 954 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.E[ 960 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.E[ 966 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.E[ 972 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.E[ 978 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.E[ 984 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 888 ]), &(acadoWorkspace.E[ 990 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 894 ]), &(acadoWorkspace.E[ 996 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 900 ]), &(acadoWorkspace.E[ 1002 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 906 ]), &(acadoWorkspace.E[ 1008 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 912 ]), &(acadoWorkspace.E[ 1014 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 102 ]), &(acadoWorkspace.E[ 1020 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 648 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 102 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.d[ 108 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.evGx[ 648 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.E[ 1026 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.E[ 1032 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.E[ 1038 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.E[ 1044 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.E[ 1050 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.E[ 1056 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.E[ 1062 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.E[ 1068 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.E[ 1074 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.E[ 1080 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.E[ 1086 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.E[ 1092 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.E[ 1098 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 996 ]), &(acadoWorkspace.E[ 1104 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1002 ]), &(acadoWorkspace.E[ 1110 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1008 ]), &(acadoWorkspace.E[ 1116 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1014 ]), &(acadoWorkspace.E[ 1122 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1020 ]), &(acadoWorkspace.E[ 1128 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 108 ]), &(acadoWorkspace.E[ 1134 ]) ); - -acado_moveGxT( &(acadoWorkspace.evGx[ 684 ]), acadoWorkspace.T ); -acado_multGxd( &(acadoWorkspace.d[ 108 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.d[ 114 ]) ); -acado_multGxGx( acadoWorkspace.T, &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.evGx[ 684 ]) ); - -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.E[ 1140 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.E[ 1146 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.E[ 1152 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.E[ 1158 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.E[ 1164 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.E[ 1170 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.E[ 1176 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.E[ 1182 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.E[ 1188 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.E[ 1194 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.E[ 1200 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.E[ 1206 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.E[ 1212 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.E[ 1218 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1110 ]), &(acadoWorkspace.E[ 1224 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1116 ]), &(acadoWorkspace.E[ 1230 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1122 ]), &(acadoWorkspace.E[ 1236 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1128 ]), &(acadoWorkspace.E[ 1242 ]) ); -acado_multGxGu( acadoWorkspace.T, &(acadoWorkspace.E[ 1134 ]), &(acadoWorkspace.E[ 1248 ]) ); - -acado_moveGuE( &(acadoWorkspace.evGu[ 114 ]), &(acadoWorkspace.E[ 1254 ]) ); - -acado_multGxGx( &(acadoWorkspace.Q1[ 36 ]), acadoWorkspace.evGx, acadoWorkspace.QGx ); -acado_multGxGx( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.QGx[ 36 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.QGx[ 72 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.QGx[ 108 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 180 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.QGx[ 144 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 216 ]), &(acadoWorkspace.evGx[ 180 ]), &(acadoWorkspace.QGx[ 180 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 252 ]), &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.QGx[ 216 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.QGx[ 252 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.QGx[ 288 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.QGx[ 324 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.QGx[ 360 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.QGx[ 396 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.QGx[ 432 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.QGx[ 468 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.QGx[ 504 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.QGx[ 540 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.QGx[ 576 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.QGx[ 612 ]) ); -acado_multGxGx( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.QGx[ 648 ]) ); -acado_multGxGx( acadoWorkspace.QN1, &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.QGx[ 684 ]) ); - -acado_multGxGu( &(acadoWorkspace.Q1[ 36 ]), acadoWorkspace.E, acadoWorkspace.QE ); -acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.QE[ 6 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.QE[ 12 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QE[ 18 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.QE[ 24 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QE[ 30 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QE[ 36 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.QE[ 42 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QE[ 48 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.QE[ 54 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 180 ]), &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QE[ 60 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 180 ]), &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 66 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 180 ]), &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QE[ 72 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 180 ]), &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.QE[ 78 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 180 ]), &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 84 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 216 ]), &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 90 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 216 ]), &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 96 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 216 ]), &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QE[ 102 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 216 ]), &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 108 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 216 ]), &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 114 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 216 ]), &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QE[ 120 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 252 ]), &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 126 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 252 ]), &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QE[ 132 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 252 ]), &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 138 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 252 ]), &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 144 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 252 ]), &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 150 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 252 ]), &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.QE[ 156 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 252 ]), &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.QE[ 162 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 168 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 174 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 180 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 186 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QE[ 192 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 198 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 204 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 210 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 216 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 222 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 228 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 234 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 240 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 246 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 252 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QE[ 258 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 270 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 276 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 282 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 288 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 294 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 300 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QE[ 306 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.QE[ 312 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 330 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 336 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 342 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 348 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 354 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 360 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 366 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 372 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 396 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 402 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 408 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 414 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 420 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 426 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 432 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 438 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 468 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 474 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 480 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 486 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 492 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 498 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 504 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QE[ 510 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 546 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 552 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 558 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 564 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 570 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 576 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 582 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 588 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 630 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 636 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 642 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 648 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 654 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 660 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 666 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QE[ 672 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 690 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 696 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 702 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 708 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.E[ 714 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 720 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 726 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 732 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 738 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 744 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 750 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 756 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 762 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 786 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 792 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 798 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 804 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.E[ 810 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 816 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 822 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 828 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 834 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 840 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 846 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 852 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 858 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 888 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 894 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 900 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 906 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.E[ 912 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 918 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 924 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 930 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 936 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 942 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 948 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 954 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 960 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 996 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 1002 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 1008 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 1014 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.E[ 1020 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1026 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1032 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1038 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1044 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1050 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1056 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1062 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1068 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1110 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1116 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1122 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1128 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_multGxGu( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.E[ 1134 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1140 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1146 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1152 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1158 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1164 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1170 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1176 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1182 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1188 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1194 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1200 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1206 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QE[ 1212 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.QE[ 1218 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1224 ]), &(acadoWorkspace.QE[ 1224 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1230 ]), &(acadoWorkspace.QE[ 1230 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1236 ]), &(acadoWorkspace.QE[ 1236 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1242 ]), &(acadoWorkspace.QE[ 1242 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1248 ]), &(acadoWorkspace.QE[ 1248 ]) ); -acado_multGxGu( acadoWorkspace.QN1, &(acadoWorkspace.E[ 1254 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_zeroBlockH00( ); -acado_multCTQC( acadoWorkspace.evGx, acadoWorkspace.QGx ); -acado_multCTQC( &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.QGx[ 36 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.QGx[ 72 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.QGx[ 108 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.QGx[ 144 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 180 ]), &(acadoWorkspace.QGx[ 180 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.QGx[ 216 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.QGx[ 252 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.QGx[ 288 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.QGx[ 324 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.QGx[ 360 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.QGx[ 396 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.QGx[ 432 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.QGx[ 468 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.QGx[ 504 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.QGx[ 540 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.QGx[ 576 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.QGx[ 612 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.QGx[ 648 ]) ); -acado_multCTQC( &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.QGx[ 684 ]) ); - -acado_zeroBlockH10( acadoWorkspace.H10 ); -acado_multQETGx( acadoWorkspace.QE, acadoWorkspace.evGx, acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 6 ]), &(acadoWorkspace.evGx[ 36 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 18 ]), &(acadoWorkspace.evGx[ 72 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 36 ]), &(acadoWorkspace.evGx[ 108 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 60 ]), &(acadoWorkspace.evGx[ 144 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 90 ]), &(acadoWorkspace.evGx[ 180 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 126 ]), &(acadoWorkspace.evGx[ 216 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 168 ]), &(acadoWorkspace.evGx[ 252 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 216 ]), &(acadoWorkspace.evGx[ 288 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 270 ]), &(acadoWorkspace.evGx[ 324 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 330 ]), &(acadoWorkspace.evGx[ 360 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 396 ]), &(acadoWorkspace.evGx[ 396 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 468 ]), &(acadoWorkspace.evGx[ 432 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 546 ]), &(acadoWorkspace.evGx[ 468 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 630 ]), &(acadoWorkspace.evGx[ 504 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 720 ]), &(acadoWorkspace.evGx[ 540 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 816 ]), &(acadoWorkspace.evGx[ 576 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 918 ]), &(acadoWorkspace.evGx[ 612 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 1026 ]), &(acadoWorkspace.evGx[ 648 ]), acadoWorkspace.H10 ); -acado_multQETGx( &(acadoWorkspace.QE[ 1140 ]), &(acadoWorkspace.evGx[ 684 ]), acadoWorkspace.H10 ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 12 ]), &(acadoWorkspace.evGx[ 36 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 24 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 42 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 66 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 96 ]), &(acadoWorkspace.evGx[ 180 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 132 ]), &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 174 ]), &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 222 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 276 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 336 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 402 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 474 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 552 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 636 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 726 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 822 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 924 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1032 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1146 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 6 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 30 ]), &(acadoWorkspace.evGx[ 72 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 48 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 72 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 102 ]), &(acadoWorkspace.evGx[ 180 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 138 ]), &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 180 ]), &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 228 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 282 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 342 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 408 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 480 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 558 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 642 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 732 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 828 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 930 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1038 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1152 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 12 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 54 ]), &(acadoWorkspace.evGx[ 108 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 78 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 108 ]), &(acadoWorkspace.evGx[ 180 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 144 ]), &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 186 ]), &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 234 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 288 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 348 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 414 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 486 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 564 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 648 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 738 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 834 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 936 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1044 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1158 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 18 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 84 ]), &(acadoWorkspace.evGx[ 144 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 114 ]), &(acadoWorkspace.evGx[ 180 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 150 ]), &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 192 ]), &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 240 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 294 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 354 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 420 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 492 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 570 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 654 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 744 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 840 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 942 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1050 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1164 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 24 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 120 ]), &(acadoWorkspace.evGx[ 180 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 156 ]), &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 198 ]), &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 246 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 300 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 360 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 426 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 498 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 576 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 660 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 750 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 846 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 948 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1056 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1170 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 30 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 162 ]), &(acadoWorkspace.evGx[ 216 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 204 ]), &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 252 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 306 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 366 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 432 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 504 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 582 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 666 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 756 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 852 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 954 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1062 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1176 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 36 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 210 ]), &(acadoWorkspace.evGx[ 252 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 258 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 312 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 372 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 438 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 510 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 588 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 672 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 762 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 858 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 960 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1068 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1182 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 42 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 264 ]), &(acadoWorkspace.evGx[ 288 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 318 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 378 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 444 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 516 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 594 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 678 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 768 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 864 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 966 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1074 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1188 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 48 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 324 ]), &(acadoWorkspace.evGx[ 324 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 384 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 450 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 522 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 600 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 684 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 774 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 870 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 972 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1080 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1194 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 54 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 390 ]), &(acadoWorkspace.evGx[ 360 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 456 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 528 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 606 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 690 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 780 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 876 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 978 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1086 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1200 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 60 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 66 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 462 ]), &(acadoWorkspace.evGx[ 396 ]), &(acadoWorkspace.H10[ 66 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 534 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 66 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 612 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 66 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 696 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 66 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 786 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 66 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 882 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 66 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 984 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 66 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1092 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 66 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1206 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 66 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 72 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 540 ]), &(acadoWorkspace.evGx[ 432 ]), &(acadoWorkspace.H10[ 72 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 618 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 72 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 702 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 72 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 792 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 72 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 888 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 72 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 990 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 72 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1098 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 72 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1212 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 72 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 78 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 624 ]), &(acadoWorkspace.evGx[ 468 ]), &(acadoWorkspace.H10[ 78 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 708 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 78 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 798 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 78 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 894 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 78 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 996 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 78 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1104 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 78 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1218 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 78 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 84 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 714 ]), &(acadoWorkspace.evGx[ 504 ]), &(acadoWorkspace.H10[ 84 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 804 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 84 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 900 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 84 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1002 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 84 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1110 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 84 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1224 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 84 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 90 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 810 ]), &(acadoWorkspace.evGx[ 540 ]), &(acadoWorkspace.H10[ 90 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 906 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 90 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1008 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 90 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1116 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 90 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1230 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 90 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 96 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 912 ]), &(acadoWorkspace.evGx[ 576 ]), &(acadoWorkspace.H10[ 96 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1014 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 96 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1122 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 96 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1236 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 96 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 102 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1020 ]), &(acadoWorkspace.evGx[ 612 ]), &(acadoWorkspace.H10[ 102 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1128 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 102 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1242 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 102 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 108 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1134 ]), &(acadoWorkspace.evGx[ 648 ]), &(acadoWorkspace.H10[ 108 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1248 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 108 ]) ); -acado_zeroBlockH10( &(acadoWorkspace.H10[ 114 ]) ); -acado_multQETGx( &(acadoWorkspace.QE[ 1254 ]), &(acadoWorkspace.evGx[ 684 ]), &(acadoWorkspace.H10[ 114 ]) ); - -acadoWorkspace.H[6] = acadoWorkspace.H10[0]; -acadoWorkspace.H[7] = acadoWorkspace.H10[6]; -acadoWorkspace.H[8] = acadoWorkspace.H10[12]; -acadoWorkspace.H[9] = acadoWorkspace.H10[18]; -acadoWorkspace.H[10] = acadoWorkspace.H10[24]; -acadoWorkspace.H[11] = acadoWorkspace.H10[30]; -acadoWorkspace.H[12] = acadoWorkspace.H10[36]; -acadoWorkspace.H[13] = acadoWorkspace.H10[42]; -acadoWorkspace.H[14] = acadoWorkspace.H10[48]; -acadoWorkspace.H[15] = acadoWorkspace.H10[54]; -acadoWorkspace.H[16] = acadoWorkspace.H10[60]; -acadoWorkspace.H[17] = acadoWorkspace.H10[66]; -acadoWorkspace.H[18] = acadoWorkspace.H10[72]; -acadoWorkspace.H[19] = acadoWorkspace.H10[78]; -acadoWorkspace.H[20] = acadoWorkspace.H10[84]; -acadoWorkspace.H[21] = acadoWorkspace.H10[90]; -acadoWorkspace.H[22] = acadoWorkspace.H10[96]; -acadoWorkspace.H[23] = acadoWorkspace.H10[102]; -acadoWorkspace.H[24] = acadoWorkspace.H10[108]; -acadoWorkspace.H[25] = acadoWorkspace.H10[114]; -acadoWorkspace.H[32] = acadoWorkspace.H10[1]; -acadoWorkspace.H[33] = acadoWorkspace.H10[7]; -acadoWorkspace.H[34] = acadoWorkspace.H10[13]; -acadoWorkspace.H[35] = acadoWorkspace.H10[19]; -acadoWorkspace.H[36] = acadoWorkspace.H10[25]; -acadoWorkspace.H[37] = acadoWorkspace.H10[31]; -acadoWorkspace.H[38] = acadoWorkspace.H10[37]; -acadoWorkspace.H[39] = acadoWorkspace.H10[43]; -acadoWorkspace.H[40] = acadoWorkspace.H10[49]; -acadoWorkspace.H[41] = acadoWorkspace.H10[55]; -acadoWorkspace.H[42] = acadoWorkspace.H10[61]; -acadoWorkspace.H[43] = acadoWorkspace.H10[67]; -acadoWorkspace.H[44] = acadoWorkspace.H10[73]; -acadoWorkspace.H[45] = acadoWorkspace.H10[79]; -acadoWorkspace.H[46] = acadoWorkspace.H10[85]; -acadoWorkspace.H[47] = acadoWorkspace.H10[91]; -acadoWorkspace.H[48] = acadoWorkspace.H10[97]; -acadoWorkspace.H[49] = acadoWorkspace.H10[103]; -acadoWorkspace.H[50] = acadoWorkspace.H10[109]; -acadoWorkspace.H[51] = acadoWorkspace.H10[115]; -acadoWorkspace.H[58] = acadoWorkspace.H10[2]; -acadoWorkspace.H[59] = acadoWorkspace.H10[8]; -acadoWorkspace.H[60] = acadoWorkspace.H10[14]; -acadoWorkspace.H[61] = acadoWorkspace.H10[20]; -acadoWorkspace.H[62] = acadoWorkspace.H10[26]; -acadoWorkspace.H[63] = acadoWorkspace.H10[32]; -acadoWorkspace.H[64] = acadoWorkspace.H10[38]; -acadoWorkspace.H[65] = acadoWorkspace.H10[44]; -acadoWorkspace.H[66] = acadoWorkspace.H10[50]; -acadoWorkspace.H[67] = acadoWorkspace.H10[56]; -acadoWorkspace.H[68] = acadoWorkspace.H10[62]; -acadoWorkspace.H[69] = acadoWorkspace.H10[68]; -acadoWorkspace.H[70] = acadoWorkspace.H10[74]; -acadoWorkspace.H[71] = acadoWorkspace.H10[80]; -acadoWorkspace.H[72] = acadoWorkspace.H10[86]; -acadoWorkspace.H[73] = acadoWorkspace.H10[92]; -acadoWorkspace.H[74] = acadoWorkspace.H10[98]; -acadoWorkspace.H[75] = acadoWorkspace.H10[104]; -acadoWorkspace.H[76] = acadoWorkspace.H10[110]; -acadoWorkspace.H[77] = acadoWorkspace.H10[116]; -acadoWorkspace.H[84] = acadoWorkspace.H10[3]; -acadoWorkspace.H[85] = acadoWorkspace.H10[9]; -acadoWorkspace.H[86] = acadoWorkspace.H10[15]; -acadoWorkspace.H[87] = acadoWorkspace.H10[21]; -acadoWorkspace.H[88] = acadoWorkspace.H10[27]; -acadoWorkspace.H[89] = acadoWorkspace.H10[33]; -acadoWorkspace.H[90] = acadoWorkspace.H10[39]; -acadoWorkspace.H[91] = acadoWorkspace.H10[45]; -acadoWorkspace.H[92] = acadoWorkspace.H10[51]; -acadoWorkspace.H[93] = acadoWorkspace.H10[57]; -acadoWorkspace.H[94] = acadoWorkspace.H10[63]; -acadoWorkspace.H[95] = acadoWorkspace.H10[69]; -acadoWorkspace.H[96] = acadoWorkspace.H10[75]; -acadoWorkspace.H[97] = acadoWorkspace.H10[81]; -acadoWorkspace.H[98] = acadoWorkspace.H10[87]; -acadoWorkspace.H[99] = acadoWorkspace.H10[93]; -acadoWorkspace.H[100] = acadoWorkspace.H10[99]; -acadoWorkspace.H[101] = acadoWorkspace.H10[105]; -acadoWorkspace.H[102] = acadoWorkspace.H10[111]; -acadoWorkspace.H[103] = acadoWorkspace.H10[117]; -acadoWorkspace.H[110] = acadoWorkspace.H10[4]; -acadoWorkspace.H[111] = acadoWorkspace.H10[10]; -acadoWorkspace.H[112] = acadoWorkspace.H10[16]; -acadoWorkspace.H[113] = acadoWorkspace.H10[22]; -acadoWorkspace.H[114] = acadoWorkspace.H10[28]; -acadoWorkspace.H[115] = acadoWorkspace.H10[34]; -acadoWorkspace.H[116] = acadoWorkspace.H10[40]; -acadoWorkspace.H[117] = acadoWorkspace.H10[46]; -acadoWorkspace.H[118] = acadoWorkspace.H10[52]; -acadoWorkspace.H[119] = acadoWorkspace.H10[58]; -acadoWorkspace.H[120] = acadoWorkspace.H10[64]; -acadoWorkspace.H[121] = acadoWorkspace.H10[70]; -acadoWorkspace.H[122] = acadoWorkspace.H10[76]; -acadoWorkspace.H[123] = acadoWorkspace.H10[82]; -acadoWorkspace.H[124] = acadoWorkspace.H10[88]; -acadoWorkspace.H[125] = acadoWorkspace.H10[94]; -acadoWorkspace.H[126] = acadoWorkspace.H10[100]; -acadoWorkspace.H[127] = acadoWorkspace.H10[106]; -acadoWorkspace.H[128] = acadoWorkspace.H10[112]; -acadoWorkspace.H[129] = acadoWorkspace.H10[118]; -acadoWorkspace.H[136] = acadoWorkspace.H10[5]; -acadoWorkspace.H[137] = acadoWorkspace.H10[11]; -acadoWorkspace.H[138] = acadoWorkspace.H10[17]; -acadoWorkspace.H[139] = acadoWorkspace.H10[23]; -acadoWorkspace.H[140] = acadoWorkspace.H10[29]; -acadoWorkspace.H[141] = acadoWorkspace.H10[35]; -acadoWorkspace.H[142] = acadoWorkspace.H10[41]; -acadoWorkspace.H[143] = acadoWorkspace.H10[47]; -acadoWorkspace.H[144] = acadoWorkspace.H10[53]; -acadoWorkspace.H[145] = acadoWorkspace.H10[59]; -acadoWorkspace.H[146] = acadoWorkspace.H10[65]; -acadoWorkspace.H[147] = acadoWorkspace.H10[71]; -acadoWorkspace.H[148] = acadoWorkspace.H10[77]; -acadoWorkspace.H[149] = acadoWorkspace.H10[83]; -acadoWorkspace.H[150] = acadoWorkspace.H10[89]; -acadoWorkspace.H[151] = acadoWorkspace.H10[95]; -acadoWorkspace.H[152] = acadoWorkspace.H10[101]; -acadoWorkspace.H[153] = acadoWorkspace.H10[107]; -acadoWorkspace.H[154] = acadoWorkspace.H10[113]; -acadoWorkspace.H[155] = acadoWorkspace.H10[119]; - -acado_setBlockH11_R1( 0, 0, acadoWorkspace.R1 ); -acado_setBlockH11( 0, 0, acadoWorkspace.E, acadoWorkspace.QE ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.QE[ 6 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QE[ 18 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QE[ 36 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QE[ 60 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 90 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 126 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 168 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 216 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 270 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 330 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 396 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 468 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 546 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 630 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 720 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 816 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 918 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1026 ]) ); -acado_setBlockH11( 0, 0, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1140 ]) ); - -acado_zeroBlockH11( 0, 1 ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.QE[ 12 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QE[ 24 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QE[ 42 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QE[ 66 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 96 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 132 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 174 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 222 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 276 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 336 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 402 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 474 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 552 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 636 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 726 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 822 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 924 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1032 ]) ); -acado_setBlockH11( 0, 1, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1146 ]) ); - -acado_zeroBlockH11( 0, 2 ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QE[ 30 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QE[ 48 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QE[ 72 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 102 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 138 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 180 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 228 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 282 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 342 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 408 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 480 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 558 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 642 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 732 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 828 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 930 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1038 ]) ); -acado_setBlockH11( 0, 2, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1152 ]) ); - -acado_zeroBlockH11( 0, 3 ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QE[ 54 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QE[ 78 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 108 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 144 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 186 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 234 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 288 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 348 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 414 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 486 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 564 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 648 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 738 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 834 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 936 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1044 ]) ); -acado_setBlockH11( 0, 3, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1158 ]) ); - -acado_zeroBlockH11( 0, 4 ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QE[ 84 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 114 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 150 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 192 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 240 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 294 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 354 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 420 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 492 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 570 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 654 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 744 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 840 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 942 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1050 ]) ); -acado_setBlockH11( 0, 4, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1164 ]) ); - -acado_zeroBlockH11( 0, 5 ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QE[ 120 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 156 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 198 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 246 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 300 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 360 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 426 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 498 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 576 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 660 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 750 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 846 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 948 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1056 ]) ); -acado_setBlockH11( 0, 5, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1170 ]) ); - -acado_zeroBlockH11( 0, 6 ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QE[ 162 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 204 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 252 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 306 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 366 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 432 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 504 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 582 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 666 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 756 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 852 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 954 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1062 ]) ); -acado_setBlockH11( 0, 6, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1176 ]) ); - -acado_zeroBlockH11( 0, 7 ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QE[ 210 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 258 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 312 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 372 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 438 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 510 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 588 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 672 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 762 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 858 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 960 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1068 ]) ); -acado_setBlockH11( 0, 7, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1182 ]) ); - -acado_zeroBlockH11( 0, 8 ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_setBlockH11( 0, 8, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1188 ]) ); - -acado_zeroBlockH11( 0, 9 ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 0, 9, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 0, 10 ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 0, 10, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 0, 11 ); -acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 0, 11, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 0, 12 ); -acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 0, 12, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 0, 13 ); -acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 0, 13, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 0, 14 ); -acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 0, 14, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 0, 15 ); -acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 0, 15, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 0, 16 ); -acado_setBlockH11( 0, 16, &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 0, 16, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 0, 16, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 0, 16, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 0, 17 ); -acado_setBlockH11( 0, 17, &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 0, 17, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 0, 17, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 0, 18 ); -acado_setBlockH11( 0, 18, &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 0, 18, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 0, 19 ); -acado_setBlockH11( 0, 19, &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 1, 1, &(acadoWorkspace.R1[ 1 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.QE[ 12 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.QE[ 24 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.QE[ 42 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 66 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 96 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QE[ 132 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 174 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 222 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 276 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 336 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 402 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 474 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 552 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 636 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 726 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 822 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 924 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1032 ]) ); -acado_setBlockH11( 1, 1, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1146 ]) ); - -acado_zeroBlockH11( 1, 2 ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.QE[ 30 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.QE[ 48 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 72 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 102 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QE[ 138 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 180 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 228 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 282 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 342 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 408 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 480 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 558 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 642 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 732 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 828 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 930 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1038 ]) ); -acado_setBlockH11( 1, 2, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1152 ]) ); - -acado_zeroBlockH11( 1, 3 ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.QE[ 54 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 78 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 108 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QE[ 144 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 186 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 234 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 288 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 348 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 414 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 486 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 564 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 648 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 738 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 834 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 936 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1044 ]) ); -acado_setBlockH11( 1, 3, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1158 ]) ); - -acado_zeroBlockH11( 1, 4 ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QE[ 84 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 114 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QE[ 150 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 192 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 240 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 294 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 354 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 420 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 492 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 570 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 654 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 744 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 840 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 942 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1050 ]) ); -acado_setBlockH11( 1, 4, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1164 ]) ); - -acado_zeroBlockH11( 1, 5 ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QE[ 120 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QE[ 156 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 198 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 246 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 300 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 360 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 426 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 498 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 576 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 660 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 750 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 846 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 948 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1056 ]) ); -acado_setBlockH11( 1, 5, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1170 ]) ); - -acado_zeroBlockH11( 1, 6 ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QE[ 162 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 204 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 252 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 306 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 366 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 432 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 504 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 582 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 666 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 756 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 852 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 954 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1062 ]) ); -acado_setBlockH11( 1, 6, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1176 ]) ); - -acado_zeroBlockH11( 1, 7 ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QE[ 210 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 258 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 312 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 372 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 438 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 510 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 588 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 672 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 762 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 858 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 960 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1068 ]) ); -acado_setBlockH11( 1, 7, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1182 ]) ); - -acado_zeroBlockH11( 1, 8 ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_setBlockH11( 1, 8, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1188 ]) ); - -acado_zeroBlockH11( 1, 9 ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 1, 9, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 1, 10 ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 1, 10, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 1, 11 ); -acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 1, 11, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 1, 12 ); -acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 1, 12, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 1, 13 ); -acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 1, 13, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 1, 14 ); -acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 1, 14, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 1, 15 ); -acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 1, 15, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 1, 16 ); -acado_setBlockH11( 1, 16, &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 1, 16, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 1, 16, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 1, 16, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 1, 17 ); -acado_setBlockH11( 1, 17, &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 1, 17, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 1, 17, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 1, 18 ); -acado_setBlockH11( 1, 18, &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 1, 18, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 1, 19 ); -acado_setBlockH11( 1, 19, &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 2, 2, &(acadoWorkspace.R1[ 2 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QE[ 30 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QE[ 48 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QE[ 72 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QE[ 102 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 138 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 180 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 228 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 282 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 342 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 408 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 480 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 558 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 642 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 732 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 828 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 930 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1038 ]) ); -acado_setBlockH11( 2, 2, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1152 ]) ); - -acado_zeroBlockH11( 2, 3 ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QE[ 54 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QE[ 78 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QE[ 108 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 144 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 186 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 234 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 288 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 348 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 414 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 486 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 564 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 648 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 738 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 834 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 936 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1044 ]) ); -acado_setBlockH11( 2, 3, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1158 ]) ); - -acado_zeroBlockH11( 2, 4 ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QE[ 84 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QE[ 114 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 150 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 192 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 240 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 294 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 354 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 420 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 492 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 570 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 654 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 744 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 840 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 942 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1050 ]) ); -acado_setBlockH11( 2, 4, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1164 ]) ); - -acado_zeroBlockH11( 2, 5 ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QE[ 120 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 156 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 198 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 246 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 300 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 360 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 426 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 498 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 576 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 660 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 750 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 846 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 948 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1056 ]) ); -acado_setBlockH11( 2, 5, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1170 ]) ); - -acado_zeroBlockH11( 2, 6 ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QE[ 162 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 204 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 252 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 306 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 366 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 432 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 504 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 582 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 666 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 756 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 852 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 954 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1062 ]) ); -acado_setBlockH11( 2, 6, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1176 ]) ); - -acado_zeroBlockH11( 2, 7 ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QE[ 210 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 258 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 312 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 372 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 438 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 510 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 588 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 672 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 762 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 858 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 960 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1068 ]) ); -acado_setBlockH11( 2, 7, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1182 ]) ); - -acado_zeroBlockH11( 2, 8 ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_setBlockH11( 2, 8, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1188 ]) ); - -acado_zeroBlockH11( 2, 9 ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 2, 9, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 2, 10 ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 2, 10, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 2, 11 ); -acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 2, 11, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 2, 12 ); -acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 2, 12, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 2, 13 ); -acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 2, 13, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 2, 14 ); -acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 2, 14, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 2, 15 ); -acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 2, 15, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 2, 16 ); -acado_setBlockH11( 2, 16, &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 2, 16, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 2, 16, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 2, 16, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 2, 17 ); -acado_setBlockH11( 2, 17, &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 2, 17, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 2, 17, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 2, 18 ); -acado_setBlockH11( 2, 18, &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 2, 18, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 2, 19 ); -acado_setBlockH11( 2, 19, &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 3, 3, &(acadoWorkspace.R1[ 3 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.QE[ 54 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.QE[ 78 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 108 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 144 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 186 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 234 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 288 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 348 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 414 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 486 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 564 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 648 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 738 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 834 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 936 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1044 ]) ); -acado_setBlockH11( 3, 3, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1158 ]) ); - -acado_zeroBlockH11( 3, 4 ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.QE[ 84 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 114 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 150 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 192 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 240 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 294 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 354 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 420 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 492 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 570 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 654 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 744 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 840 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 942 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1050 ]) ); -acado_setBlockH11( 3, 4, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1164 ]) ); - -acado_zeroBlockH11( 3, 5 ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QE[ 120 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 156 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 198 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 246 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 300 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 360 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 426 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 498 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 576 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 660 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 750 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 846 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 948 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1056 ]) ); -acado_setBlockH11( 3, 5, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1170 ]) ); - -acado_zeroBlockH11( 3, 6 ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QE[ 162 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 204 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 252 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 306 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 366 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 432 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 504 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 582 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 666 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 756 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 852 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 954 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1062 ]) ); -acado_setBlockH11( 3, 6, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1176 ]) ); - -acado_zeroBlockH11( 3, 7 ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QE[ 210 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 258 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 312 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 372 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 438 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 510 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 588 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 672 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 762 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 858 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 960 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1068 ]) ); -acado_setBlockH11( 3, 7, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1182 ]) ); - -acado_zeroBlockH11( 3, 8 ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_setBlockH11( 3, 8, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1188 ]) ); - -acado_zeroBlockH11( 3, 9 ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 3, 9, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 3, 10 ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 3, 10, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 3, 11 ); -acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 3, 11, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 3, 12 ); -acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 3, 12, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 3, 13 ); -acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 3, 13, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 3, 14 ); -acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 3, 14, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 3, 15 ); -acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 3, 15, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 3, 16 ); -acado_setBlockH11( 3, 16, &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 3, 16, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 3, 16, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 3, 16, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 3, 17 ); -acado_setBlockH11( 3, 17, &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 3, 17, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 3, 17, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 3, 18 ); -acado_setBlockH11( 3, 18, &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 3, 18, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 3, 19 ); -acado_setBlockH11( 3, 19, &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 4, 4, &(acadoWorkspace.R1[ 4 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QE[ 84 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 114 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 150 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QE[ 192 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 240 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 294 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 354 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 420 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 492 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 570 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 654 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 744 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 840 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 942 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1050 ]) ); -acado_setBlockH11( 4, 4, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1164 ]) ); - -acado_zeroBlockH11( 4, 5 ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QE[ 120 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 156 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QE[ 198 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 246 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 300 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 360 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 426 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 498 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 576 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 660 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 750 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 846 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 948 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1056 ]) ); -acado_setBlockH11( 4, 5, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1170 ]) ); - -acado_zeroBlockH11( 4, 6 ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QE[ 162 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QE[ 204 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 252 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 306 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 366 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 432 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 504 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 582 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 666 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 756 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 852 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 954 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1062 ]) ); -acado_setBlockH11( 4, 6, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1176 ]) ); - -acado_zeroBlockH11( 4, 7 ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QE[ 210 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 258 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 312 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 372 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 438 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 510 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 588 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 672 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 762 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 858 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 960 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1068 ]) ); -acado_setBlockH11( 4, 7, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1182 ]) ); - -acado_zeroBlockH11( 4, 8 ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_setBlockH11( 4, 8, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1188 ]) ); - -acado_zeroBlockH11( 4, 9 ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 4, 9, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 4, 10 ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 4, 10, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 4, 11 ); -acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 4, 11, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 4, 12 ); -acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 4, 12, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 4, 13 ); -acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 4, 13, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 4, 14 ); -acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 4, 14, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 4, 15 ); -acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 4, 15, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 4, 16 ); -acado_setBlockH11( 4, 16, &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 4, 16, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 4, 16, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 4, 16, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 4, 17 ); -acado_setBlockH11( 4, 17, &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 4, 17, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 4, 17, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 4, 18 ); -acado_setBlockH11( 4, 18, &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 4, 18, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 4, 19 ); -acado_setBlockH11( 4, 19, &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 5, 5, &(acadoWorkspace.R1[ 5 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QE[ 120 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.QE[ 156 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 198 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 246 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 300 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 360 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 426 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 498 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 576 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 660 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 750 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 846 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 948 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1056 ]) ); -acado_setBlockH11( 5, 5, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1170 ]) ); - -acado_zeroBlockH11( 5, 6 ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.QE[ 162 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 204 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 252 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 306 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 366 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 432 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 504 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 582 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 666 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 756 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 852 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 954 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1062 ]) ); -acado_setBlockH11( 5, 6, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1176 ]) ); - -acado_zeroBlockH11( 5, 7 ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QE[ 210 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 258 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 312 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 372 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 438 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 510 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 588 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 672 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 762 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 858 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 960 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1068 ]) ); -acado_setBlockH11( 5, 7, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1182 ]) ); - -acado_zeroBlockH11( 5, 8 ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_setBlockH11( 5, 8, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1188 ]) ); - -acado_zeroBlockH11( 5, 9 ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 5, 9, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 5, 10 ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 5, 10, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 5, 11 ); -acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 5, 11, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 5, 12 ); -acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 5, 12, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 5, 13 ); -acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 5, 13, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 5, 14 ); -acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 5, 14, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 5, 15 ); -acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 5, 15, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 5, 16 ); -acado_setBlockH11( 5, 16, &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 5, 16, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 5, 16, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 5, 16, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 5, 17 ); -acado_setBlockH11( 5, 17, &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 5, 17, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 5, 17, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 5, 18 ); -acado_setBlockH11( 5, 18, &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 5, 18, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 5, 19 ); -acado_setBlockH11( 5, 19, &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 6, 6, &(acadoWorkspace.R1[ 6 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.QE[ 162 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 204 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 252 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QE[ 306 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 366 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 432 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 504 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 582 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 666 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 756 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 852 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 954 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1062 ]) ); -acado_setBlockH11( 6, 6, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1176 ]) ); - -acado_zeroBlockH11( 6, 7 ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QE[ 210 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 258 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QE[ 312 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 372 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 438 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 510 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 588 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 672 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 762 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 858 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 960 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1068 ]) ); -acado_setBlockH11( 6, 7, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1182 ]) ); - -acado_zeroBlockH11( 6, 8 ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_setBlockH11( 6, 8, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1188 ]) ); - -acado_zeroBlockH11( 6, 9 ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 6, 9, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 6, 10 ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 6, 10, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 6, 11 ); -acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 6, 11, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 6, 12 ); -acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 6, 12, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 6, 13 ); -acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 6, 13, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 6, 14 ); -acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 6, 14, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 6, 15 ); -acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 6, 15, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 6, 16 ); -acado_setBlockH11( 6, 16, &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 6, 16, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 6, 16, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 6, 16, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 6, 17 ); -acado_setBlockH11( 6, 17, &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 6, 17, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 6, 17, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 6, 18 ); -acado_setBlockH11( 6, 18, &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 6, 18, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 6, 19 ); -acado_setBlockH11( 6, 19, &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 7, 7, &(acadoWorkspace.R1[ 7 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QE[ 210 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QE[ 258 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.QE[ 312 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 372 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 438 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QE[ 510 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 588 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QE[ 672 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 762 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 858 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 960 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1068 ]) ); -acado_setBlockH11( 7, 7, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1182 ]) ); - -acado_zeroBlockH11( 7, 8 ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_setBlockH11( 7, 8, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1188 ]) ); - -acado_zeroBlockH11( 7, 9 ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 7, 9, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 7, 10 ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 7, 10, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 7, 11 ); -acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 7, 11, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 7, 12 ); -acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 7, 12, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 7, 13 ); -acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 7, 13, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 7, 14 ); -acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 7, 14, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 7, 15 ); -acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 7, 15, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 7, 16 ); -acado_setBlockH11( 7, 16, &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 7, 16, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 7, 16, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 7, 16, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 7, 17 ); -acado_setBlockH11( 7, 17, &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 7, 17, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 7, 17, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 7, 18 ); -acado_setBlockH11( 7, 18, &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 7, 18, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 7, 19 ); -acado_setBlockH11( 7, 19, &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 8, 8, &(acadoWorkspace.R1[ 8 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.QE[ 264 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 318 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 378 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 444 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 516 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 594 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.QE[ 678 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QE[ 768 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 864 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 966 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1074 ]) ); -acado_setBlockH11( 8, 8, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1188 ]) ); - -acado_zeroBlockH11( 8, 9 ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 8, 9, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 8, 10 ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 8, 10, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 8, 11 ); -acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 8, 11, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 8, 12 ); -acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 8, 12, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 8, 13 ); -acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 8, 13, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 8, 14 ); -acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 8, 14, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 8, 15 ); -acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 8, 15, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 8, 16 ); -acado_setBlockH11( 8, 16, &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 8, 16, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 8, 16, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 8, 16, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 8, 17 ); -acado_setBlockH11( 8, 17, &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 8, 17, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 8, 17, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 8, 18 ); -acado_setBlockH11( 8, 18, &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 8, 18, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 8, 19 ); -acado_setBlockH11( 8, 19, &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 9, 9, &(acadoWorkspace.R1[ 9 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QE[ 324 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 384 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QE[ 450 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 522 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 600 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.QE[ 684 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.QE[ 774 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QE[ 870 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 972 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1080 ]) ); -acado_setBlockH11( 9, 9, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1194 ]) ); - -acado_zeroBlockH11( 9, 10 ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 9, 10, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 9, 11 ); -acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 9, 11, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 9, 12 ); -acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 9, 12, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 9, 13 ); -acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 9, 13, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 9, 14 ); -acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 9, 14, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 9, 15 ); -acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 9, 15, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 9, 16 ); -acado_setBlockH11( 9, 16, &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 9, 16, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 9, 16, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 9, 16, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 9, 17 ); -acado_setBlockH11( 9, 17, &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 9, 17, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 9, 17, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 9, 18 ); -acado_setBlockH11( 9, 18, &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 9, 18, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 9, 19 ); -acado_setBlockH11( 9, 19, &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 10, 10, &(acadoWorkspace.R1[ 10 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QE[ 390 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.QE[ 456 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 528 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 606 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 690 ]), &(acadoWorkspace.QE[ 690 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.QE[ 780 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.QE[ 876 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QE[ 978 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1086 ]) ); -acado_setBlockH11( 10, 10, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1200 ]) ); - -acado_zeroBlockH11( 10, 11 ); -acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 690 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 10, 11, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 10, 12 ); -acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 690 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 10, 12, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 10, 13 ); -acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 690 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 10, 13, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 10, 14 ); -acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 690 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 10, 14, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 10, 15 ); -acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 10, 15, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 10, 16 ); -acado_setBlockH11( 10, 16, &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 10, 16, &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 10, 16, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 10, 16, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 10, 17 ); -acado_setBlockH11( 10, 17, &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 10, 17, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 10, 17, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 10, 18 ); -acado_setBlockH11( 10, 18, &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 10, 18, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 10, 19 ); -acado_setBlockH11( 10, 19, &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 11, 11, &(acadoWorkspace.R1[ 11 ]) ); -acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QE[ 462 ]) ); -acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 534 ]) ); -acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 612 ]) ); -acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 696 ]), &(acadoWorkspace.QE[ 696 ]) ); -acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 786 ]), &(acadoWorkspace.QE[ 786 ]) ); -acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.QE[ 882 ]) ); -acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.QE[ 984 ]) ); -acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QE[ 1092 ]) ); -acado_setBlockH11( 11, 11, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1206 ]) ); - -acado_zeroBlockH11( 11, 12 ); -acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 696 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 786 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 11, 12, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 11, 13 ); -acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 696 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 786 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 11, 13, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 11, 14 ); -acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 696 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 786 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 11, 14, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 11, 15 ); -acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 786 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 11, 15, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 11, 16 ); -acado_setBlockH11( 11, 16, &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 11, 16, &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 11, 16, &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 11, 16, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 11, 17 ); -acado_setBlockH11( 11, 17, &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 11, 17, &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 11, 17, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 11, 18 ); -acado_setBlockH11( 11, 18, &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 11, 18, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 11, 19 ); -acado_setBlockH11( 11, 19, &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 12, 12, &(acadoWorkspace.R1[ 12 ]) ); -acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QE[ 540 ]) ); -acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QE[ 618 ]) ); -acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 702 ]), &(acadoWorkspace.QE[ 702 ]) ); -acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 792 ]), &(acadoWorkspace.QE[ 792 ]) ); -acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 888 ]), &(acadoWorkspace.QE[ 888 ]) ); -acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.QE[ 990 ]) ); -acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.QE[ 1098 ]) ); -acado_setBlockH11( 12, 12, &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QE[ 1212 ]) ); - -acado_zeroBlockH11( 12, 13 ); -acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 702 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 792 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 888 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 12, 13, &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 12, 14 ); -acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 702 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 792 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 888 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 12, 14, &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 12, 15 ); -acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 792 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 888 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 12, 15, &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 12, 16 ); -acado_setBlockH11( 12, 16, &(acadoWorkspace.E[ 888 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 12, 16, &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 12, 16, &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 12, 16, &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 12, 17 ); -acado_setBlockH11( 12, 17, &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 12, 17, &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 12, 17, &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 12, 18 ); -acado_setBlockH11( 12, 18, &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 12, 18, &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 12, 19 ); -acado_setBlockH11( 12, 19, &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 13, 13, &(acadoWorkspace.R1[ 13 ]) ); -acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.QE[ 624 ]) ); -acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 708 ]), &(acadoWorkspace.QE[ 708 ]) ); -acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 798 ]), &(acadoWorkspace.QE[ 798 ]) ); -acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 894 ]), &(acadoWorkspace.QE[ 894 ]) ); -acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 996 ]), &(acadoWorkspace.QE[ 996 ]) ); -acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.QE[ 1104 ]) ); -acado_setBlockH11( 13, 13, &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.QE[ 1218 ]) ); - -acado_zeroBlockH11( 13, 14 ); -acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 708 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 798 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 894 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 996 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 13, 14, &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 13, 15 ); -acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 798 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 894 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 996 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 13, 15, &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 13, 16 ); -acado_setBlockH11( 13, 16, &(acadoWorkspace.E[ 894 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 13, 16, &(acadoWorkspace.E[ 996 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 13, 16, &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 13, 16, &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 13, 17 ); -acado_setBlockH11( 13, 17, &(acadoWorkspace.E[ 996 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 13, 17, &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 13, 17, &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 13, 18 ); -acado_setBlockH11( 13, 18, &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 13, 18, &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 13, 19 ); -acado_setBlockH11( 13, 19, &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 14, 14, &(acadoWorkspace.R1[ 14 ]) ); -acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 714 ]), &(acadoWorkspace.QE[ 714 ]) ); -acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 804 ]), &(acadoWorkspace.QE[ 804 ]) ); -acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 900 ]), &(acadoWorkspace.QE[ 900 ]) ); -acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 1002 ]), &(acadoWorkspace.QE[ 1002 ]) ); -acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 1110 ]), &(acadoWorkspace.QE[ 1110 ]) ); -acado_setBlockH11( 14, 14, &(acadoWorkspace.E[ 1224 ]), &(acadoWorkspace.QE[ 1224 ]) ); - -acado_zeroBlockH11( 14, 15 ); -acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 804 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 900 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 1002 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 1110 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 14, 15, &(acadoWorkspace.E[ 1224 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 14, 16 ); -acado_setBlockH11( 14, 16, &(acadoWorkspace.E[ 900 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 14, 16, &(acadoWorkspace.E[ 1002 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 14, 16, &(acadoWorkspace.E[ 1110 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 14, 16, &(acadoWorkspace.E[ 1224 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 14, 17 ); -acado_setBlockH11( 14, 17, &(acadoWorkspace.E[ 1002 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 14, 17, &(acadoWorkspace.E[ 1110 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 14, 17, &(acadoWorkspace.E[ 1224 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 14, 18 ); -acado_setBlockH11( 14, 18, &(acadoWorkspace.E[ 1110 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 14, 18, &(acadoWorkspace.E[ 1224 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 14, 19 ); -acado_setBlockH11( 14, 19, &(acadoWorkspace.E[ 1224 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 15, 15, &(acadoWorkspace.R1[ 15 ]) ); -acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 810 ]), &(acadoWorkspace.QE[ 810 ]) ); -acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 906 ]), &(acadoWorkspace.QE[ 906 ]) ); -acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 1008 ]), &(acadoWorkspace.QE[ 1008 ]) ); -acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 1116 ]), &(acadoWorkspace.QE[ 1116 ]) ); -acado_setBlockH11( 15, 15, &(acadoWorkspace.E[ 1230 ]), &(acadoWorkspace.QE[ 1230 ]) ); - -acado_zeroBlockH11( 15, 16 ); -acado_setBlockH11( 15, 16, &(acadoWorkspace.E[ 906 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 15, 16, &(acadoWorkspace.E[ 1008 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 15, 16, &(acadoWorkspace.E[ 1116 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 15, 16, &(acadoWorkspace.E[ 1230 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 15, 17 ); -acado_setBlockH11( 15, 17, &(acadoWorkspace.E[ 1008 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 15, 17, &(acadoWorkspace.E[ 1116 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 15, 17, &(acadoWorkspace.E[ 1230 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 15, 18 ); -acado_setBlockH11( 15, 18, &(acadoWorkspace.E[ 1116 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 15, 18, &(acadoWorkspace.E[ 1230 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 15, 19 ); -acado_setBlockH11( 15, 19, &(acadoWorkspace.E[ 1230 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 16, 16, &(acadoWorkspace.R1[ 16 ]) ); -acado_setBlockH11( 16, 16, &(acadoWorkspace.E[ 912 ]), &(acadoWorkspace.QE[ 912 ]) ); -acado_setBlockH11( 16, 16, &(acadoWorkspace.E[ 1014 ]), &(acadoWorkspace.QE[ 1014 ]) ); -acado_setBlockH11( 16, 16, &(acadoWorkspace.E[ 1122 ]), &(acadoWorkspace.QE[ 1122 ]) ); -acado_setBlockH11( 16, 16, &(acadoWorkspace.E[ 1236 ]), &(acadoWorkspace.QE[ 1236 ]) ); - -acado_zeroBlockH11( 16, 17 ); -acado_setBlockH11( 16, 17, &(acadoWorkspace.E[ 1014 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 16, 17, &(acadoWorkspace.E[ 1122 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 16, 17, &(acadoWorkspace.E[ 1236 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 16, 18 ); -acado_setBlockH11( 16, 18, &(acadoWorkspace.E[ 1122 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 16, 18, &(acadoWorkspace.E[ 1236 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 16, 19 ); -acado_setBlockH11( 16, 19, &(acadoWorkspace.E[ 1236 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 17, 17, &(acadoWorkspace.R1[ 17 ]) ); -acado_setBlockH11( 17, 17, &(acadoWorkspace.E[ 1020 ]), &(acadoWorkspace.QE[ 1020 ]) ); -acado_setBlockH11( 17, 17, &(acadoWorkspace.E[ 1128 ]), &(acadoWorkspace.QE[ 1128 ]) ); -acado_setBlockH11( 17, 17, &(acadoWorkspace.E[ 1242 ]), &(acadoWorkspace.QE[ 1242 ]) ); - -acado_zeroBlockH11( 17, 18 ); -acado_setBlockH11( 17, 18, &(acadoWorkspace.E[ 1128 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 17, 18, &(acadoWorkspace.E[ 1242 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 17, 19 ); -acado_setBlockH11( 17, 19, &(acadoWorkspace.E[ 1242 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 18, 18, &(acadoWorkspace.R1[ 18 ]) ); -acado_setBlockH11( 18, 18, &(acadoWorkspace.E[ 1134 ]), &(acadoWorkspace.QE[ 1134 ]) ); -acado_setBlockH11( 18, 18, &(acadoWorkspace.E[ 1248 ]), &(acadoWorkspace.QE[ 1248 ]) ); - -acado_zeroBlockH11( 18, 19 ); -acado_setBlockH11( 18, 19, &(acadoWorkspace.E[ 1248 ]), &(acadoWorkspace.QE[ 1254 ]) ); - -acado_setBlockH11_R1( 19, 19, &(acadoWorkspace.R1[ 19 ]) ); -acado_setBlockH11( 19, 19, &(acadoWorkspace.E[ 1254 ]), &(acadoWorkspace.QE[ 1254 ]) ); - - -acado_copyHTH( 1, 0 ); -acado_copyHTH( 2, 0 ); -acado_copyHTH( 2, 1 ); -acado_copyHTH( 3, 0 ); -acado_copyHTH( 3, 1 ); -acado_copyHTH( 3, 2 ); -acado_copyHTH( 4, 0 ); -acado_copyHTH( 4, 1 ); -acado_copyHTH( 4, 2 ); -acado_copyHTH( 4, 3 ); -acado_copyHTH( 5, 0 ); -acado_copyHTH( 5, 1 ); -acado_copyHTH( 5, 2 ); -acado_copyHTH( 5, 3 ); -acado_copyHTH( 5, 4 ); -acado_copyHTH( 6, 0 ); -acado_copyHTH( 6, 1 ); -acado_copyHTH( 6, 2 ); -acado_copyHTH( 6, 3 ); -acado_copyHTH( 6, 4 ); -acado_copyHTH( 6, 5 ); -acado_copyHTH( 7, 0 ); -acado_copyHTH( 7, 1 ); -acado_copyHTH( 7, 2 ); -acado_copyHTH( 7, 3 ); -acado_copyHTH( 7, 4 ); -acado_copyHTH( 7, 5 ); -acado_copyHTH( 7, 6 ); -acado_copyHTH( 8, 0 ); -acado_copyHTH( 8, 1 ); -acado_copyHTH( 8, 2 ); -acado_copyHTH( 8, 3 ); -acado_copyHTH( 8, 4 ); -acado_copyHTH( 8, 5 ); -acado_copyHTH( 8, 6 ); -acado_copyHTH( 8, 7 ); -acado_copyHTH( 9, 0 ); -acado_copyHTH( 9, 1 ); -acado_copyHTH( 9, 2 ); -acado_copyHTH( 9, 3 ); -acado_copyHTH( 9, 4 ); -acado_copyHTH( 9, 5 ); -acado_copyHTH( 9, 6 ); -acado_copyHTH( 9, 7 ); -acado_copyHTH( 9, 8 ); -acado_copyHTH( 10, 0 ); -acado_copyHTH( 10, 1 ); -acado_copyHTH( 10, 2 ); -acado_copyHTH( 10, 3 ); -acado_copyHTH( 10, 4 ); -acado_copyHTH( 10, 5 ); -acado_copyHTH( 10, 6 ); -acado_copyHTH( 10, 7 ); -acado_copyHTH( 10, 8 ); -acado_copyHTH( 10, 9 ); -acado_copyHTH( 11, 0 ); -acado_copyHTH( 11, 1 ); -acado_copyHTH( 11, 2 ); -acado_copyHTH( 11, 3 ); -acado_copyHTH( 11, 4 ); -acado_copyHTH( 11, 5 ); -acado_copyHTH( 11, 6 ); -acado_copyHTH( 11, 7 ); -acado_copyHTH( 11, 8 ); -acado_copyHTH( 11, 9 ); -acado_copyHTH( 11, 10 ); -acado_copyHTH( 12, 0 ); -acado_copyHTH( 12, 1 ); -acado_copyHTH( 12, 2 ); -acado_copyHTH( 12, 3 ); -acado_copyHTH( 12, 4 ); -acado_copyHTH( 12, 5 ); -acado_copyHTH( 12, 6 ); -acado_copyHTH( 12, 7 ); -acado_copyHTH( 12, 8 ); -acado_copyHTH( 12, 9 ); -acado_copyHTH( 12, 10 ); -acado_copyHTH( 12, 11 ); -acado_copyHTH( 13, 0 ); -acado_copyHTH( 13, 1 ); -acado_copyHTH( 13, 2 ); -acado_copyHTH( 13, 3 ); -acado_copyHTH( 13, 4 ); -acado_copyHTH( 13, 5 ); -acado_copyHTH( 13, 6 ); -acado_copyHTH( 13, 7 ); -acado_copyHTH( 13, 8 ); -acado_copyHTH( 13, 9 ); -acado_copyHTH( 13, 10 ); -acado_copyHTH( 13, 11 ); -acado_copyHTH( 13, 12 ); -acado_copyHTH( 14, 0 ); -acado_copyHTH( 14, 1 ); -acado_copyHTH( 14, 2 ); -acado_copyHTH( 14, 3 ); -acado_copyHTH( 14, 4 ); -acado_copyHTH( 14, 5 ); -acado_copyHTH( 14, 6 ); -acado_copyHTH( 14, 7 ); -acado_copyHTH( 14, 8 ); -acado_copyHTH( 14, 9 ); -acado_copyHTH( 14, 10 ); -acado_copyHTH( 14, 11 ); -acado_copyHTH( 14, 12 ); -acado_copyHTH( 14, 13 ); -acado_copyHTH( 15, 0 ); -acado_copyHTH( 15, 1 ); -acado_copyHTH( 15, 2 ); -acado_copyHTH( 15, 3 ); -acado_copyHTH( 15, 4 ); -acado_copyHTH( 15, 5 ); -acado_copyHTH( 15, 6 ); -acado_copyHTH( 15, 7 ); -acado_copyHTH( 15, 8 ); -acado_copyHTH( 15, 9 ); -acado_copyHTH( 15, 10 ); -acado_copyHTH( 15, 11 ); -acado_copyHTH( 15, 12 ); -acado_copyHTH( 15, 13 ); -acado_copyHTH( 15, 14 ); -acado_copyHTH( 16, 0 ); -acado_copyHTH( 16, 1 ); -acado_copyHTH( 16, 2 ); -acado_copyHTH( 16, 3 ); -acado_copyHTH( 16, 4 ); -acado_copyHTH( 16, 5 ); -acado_copyHTH( 16, 6 ); -acado_copyHTH( 16, 7 ); -acado_copyHTH( 16, 8 ); -acado_copyHTH( 16, 9 ); -acado_copyHTH( 16, 10 ); -acado_copyHTH( 16, 11 ); -acado_copyHTH( 16, 12 ); -acado_copyHTH( 16, 13 ); -acado_copyHTH( 16, 14 ); -acado_copyHTH( 16, 15 ); -acado_copyHTH( 17, 0 ); -acado_copyHTH( 17, 1 ); -acado_copyHTH( 17, 2 ); -acado_copyHTH( 17, 3 ); -acado_copyHTH( 17, 4 ); -acado_copyHTH( 17, 5 ); -acado_copyHTH( 17, 6 ); -acado_copyHTH( 17, 7 ); -acado_copyHTH( 17, 8 ); -acado_copyHTH( 17, 9 ); -acado_copyHTH( 17, 10 ); -acado_copyHTH( 17, 11 ); -acado_copyHTH( 17, 12 ); -acado_copyHTH( 17, 13 ); -acado_copyHTH( 17, 14 ); -acado_copyHTH( 17, 15 ); -acado_copyHTH( 17, 16 ); -acado_copyHTH( 18, 0 ); -acado_copyHTH( 18, 1 ); -acado_copyHTH( 18, 2 ); -acado_copyHTH( 18, 3 ); -acado_copyHTH( 18, 4 ); -acado_copyHTH( 18, 5 ); -acado_copyHTH( 18, 6 ); -acado_copyHTH( 18, 7 ); -acado_copyHTH( 18, 8 ); -acado_copyHTH( 18, 9 ); -acado_copyHTH( 18, 10 ); -acado_copyHTH( 18, 11 ); -acado_copyHTH( 18, 12 ); -acado_copyHTH( 18, 13 ); -acado_copyHTH( 18, 14 ); -acado_copyHTH( 18, 15 ); -acado_copyHTH( 18, 16 ); -acado_copyHTH( 18, 17 ); -acado_copyHTH( 19, 0 ); -acado_copyHTH( 19, 1 ); -acado_copyHTH( 19, 2 ); -acado_copyHTH( 19, 3 ); -acado_copyHTH( 19, 4 ); -acado_copyHTH( 19, 5 ); -acado_copyHTH( 19, 6 ); -acado_copyHTH( 19, 7 ); -acado_copyHTH( 19, 8 ); -acado_copyHTH( 19, 9 ); -acado_copyHTH( 19, 10 ); -acado_copyHTH( 19, 11 ); -acado_copyHTH( 19, 12 ); -acado_copyHTH( 19, 13 ); -acado_copyHTH( 19, 14 ); -acado_copyHTH( 19, 15 ); -acado_copyHTH( 19, 16 ); -acado_copyHTH( 19, 17 ); -acado_copyHTH( 19, 18 ); - -acadoWorkspace.H[156] = acadoWorkspace.H10[0]; -acadoWorkspace.H[157] = acadoWorkspace.H10[1]; -acadoWorkspace.H[158] = acadoWorkspace.H10[2]; -acadoWorkspace.H[159] = acadoWorkspace.H10[3]; -acadoWorkspace.H[160] = acadoWorkspace.H10[4]; -acadoWorkspace.H[161] = acadoWorkspace.H10[5]; -acadoWorkspace.H[182] = acadoWorkspace.H10[6]; -acadoWorkspace.H[183] = acadoWorkspace.H10[7]; -acadoWorkspace.H[184] = acadoWorkspace.H10[8]; -acadoWorkspace.H[185] = acadoWorkspace.H10[9]; -acadoWorkspace.H[186] = acadoWorkspace.H10[10]; -acadoWorkspace.H[187] = acadoWorkspace.H10[11]; -acadoWorkspace.H[208] = acadoWorkspace.H10[12]; -acadoWorkspace.H[209] = acadoWorkspace.H10[13]; -acadoWorkspace.H[210] = acadoWorkspace.H10[14]; -acadoWorkspace.H[211] = acadoWorkspace.H10[15]; -acadoWorkspace.H[212] = acadoWorkspace.H10[16]; -acadoWorkspace.H[213] = acadoWorkspace.H10[17]; -acadoWorkspace.H[234] = acadoWorkspace.H10[18]; -acadoWorkspace.H[235] = acadoWorkspace.H10[19]; -acadoWorkspace.H[236] = acadoWorkspace.H10[20]; -acadoWorkspace.H[237] = acadoWorkspace.H10[21]; -acadoWorkspace.H[238] = acadoWorkspace.H10[22]; -acadoWorkspace.H[239] = acadoWorkspace.H10[23]; -acadoWorkspace.H[260] = acadoWorkspace.H10[24]; -acadoWorkspace.H[261] = acadoWorkspace.H10[25]; -acadoWorkspace.H[262] = acadoWorkspace.H10[26]; -acadoWorkspace.H[263] = acadoWorkspace.H10[27]; -acadoWorkspace.H[264] = acadoWorkspace.H10[28]; -acadoWorkspace.H[265] = acadoWorkspace.H10[29]; -acadoWorkspace.H[286] = acadoWorkspace.H10[30]; -acadoWorkspace.H[287] = acadoWorkspace.H10[31]; -acadoWorkspace.H[288] = acadoWorkspace.H10[32]; -acadoWorkspace.H[289] = acadoWorkspace.H10[33]; -acadoWorkspace.H[290] = acadoWorkspace.H10[34]; -acadoWorkspace.H[291] = acadoWorkspace.H10[35]; -acadoWorkspace.H[312] = acadoWorkspace.H10[36]; -acadoWorkspace.H[313] = acadoWorkspace.H10[37]; -acadoWorkspace.H[314] = acadoWorkspace.H10[38]; -acadoWorkspace.H[315] = acadoWorkspace.H10[39]; -acadoWorkspace.H[316] = acadoWorkspace.H10[40]; -acadoWorkspace.H[317] = acadoWorkspace.H10[41]; -acadoWorkspace.H[338] = acadoWorkspace.H10[42]; -acadoWorkspace.H[339] = acadoWorkspace.H10[43]; -acadoWorkspace.H[340] = acadoWorkspace.H10[44]; -acadoWorkspace.H[341] = acadoWorkspace.H10[45]; -acadoWorkspace.H[342] = acadoWorkspace.H10[46]; -acadoWorkspace.H[343] = acadoWorkspace.H10[47]; -acadoWorkspace.H[364] = acadoWorkspace.H10[48]; -acadoWorkspace.H[365] = acadoWorkspace.H10[49]; -acadoWorkspace.H[366] = acadoWorkspace.H10[50]; -acadoWorkspace.H[367] = acadoWorkspace.H10[51]; -acadoWorkspace.H[368] = acadoWorkspace.H10[52]; -acadoWorkspace.H[369] = acadoWorkspace.H10[53]; -acadoWorkspace.H[390] = acadoWorkspace.H10[54]; -acadoWorkspace.H[391] = acadoWorkspace.H10[55]; -acadoWorkspace.H[392] = acadoWorkspace.H10[56]; -acadoWorkspace.H[393] = acadoWorkspace.H10[57]; -acadoWorkspace.H[394] = acadoWorkspace.H10[58]; -acadoWorkspace.H[395] = acadoWorkspace.H10[59]; -acadoWorkspace.H[416] = acadoWorkspace.H10[60]; -acadoWorkspace.H[417] = acadoWorkspace.H10[61]; -acadoWorkspace.H[418] = acadoWorkspace.H10[62]; -acadoWorkspace.H[419] = acadoWorkspace.H10[63]; -acadoWorkspace.H[420] = acadoWorkspace.H10[64]; -acadoWorkspace.H[421] = acadoWorkspace.H10[65]; -acadoWorkspace.H[442] = acadoWorkspace.H10[66]; -acadoWorkspace.H[443] = acadoWorkspace.H10[67]; -acadoWorkspace.H[444] = acadoWorkspace.H10[68]; -acadoWorkspace.H[445] = acadoWorkspace.H10[69]; -acadoWorkspace.H[446] = acadoWorkspace.H10[70]; -acadoWorkspace.H[447] = acadoWorkspace.H10[71]; -acadoWorkspace.H[468] = acadoWorkspace.H10[72]; -acadoWorkspace.H[469] = acadoWorkspace.H10[73]; -acadoWorkspace.H[470] = acadoWorkspace.H10[74]; -acadoWorkspace.H[471] = acadoWorkspace.H10[75]; -acadoWorkspace.H[472] = acadoWorkspace.H10[76]; -acadoWorkspace.H[473] = acadoWorkspace.H10[77]; -acadoWorkspace.H[494] = acadoWorkspace.H10[78]; -acadoWorkspace.H[495] = acadoWorkspace.H10[79]; -acadoWorkspace.H[496] = acadoWorkspace.H10[80]; -acadoWorkspace.H[497] = acadoWorkspace.H10[81]; -acadoWorkspace.H[498] = acadoWorkspace.H10[82]; -acadoWorkspace.H[499] = acadoWorkspace.H10[83]; -acadoWorkspace.H[520] = acadoWorkspace.H10[84]; -acadoWorkspace.H[521] = acadoWorkspace.H10[85]; -acadoWorkspace.H[522] = acadoWorkspace.H10[86]; -acadoWorkspace.H[523] = acadoWorkspace.H10[87]; -acadoWorkspace.H[524] = acadoWorkspace.H10[88]; -acadoWorkspace.H[525] = acadoWorkspace.H10[89]; -acadoWorkspace.H[546] = acadoWorkspace.H10[90]; -acadoWorkspace.H[547] = acadoWorkspace.H10[91]; -acadoWorkspace.H[548] = acadoWorkspace.H10[92]; -acadoWorkspace.H[549] = acadoWorkspace.H10[93]; -acadoWorkspace.H[550] = acadoWorkspace.H10[94]; -acadoWorkspace.H[551] = acadoWorkspace.H10[95]; -acadoWorkspace.H[572] = acadoWorkspace.H10[96]; -acadoWorkspace.H[573] = acadoWorkspace.H10[97]; -acadoWorkspace.H[574] = acadoWorkspace.H10[98]; -acadoWorkspace.H[575] = acadoWorkspace.H10[99]; -acadoWorkspace.H[576] = acadoWorkspace.H10[100]; -acadoWorkspace.H[577] = acadoWorkspace.H10[101]; -acadoWorkspace.H[598] = acadoWorkspace.H10[102]; -acadoWorkspace.H[599] = acadoWorkspace.H10[103]; -acadoWorkspace.H[600] = acadoWorkspace.H10[104]; -acadoWorkspace.H[601] = acadoWorkspace.H10[105]; -acadoWorkspace.H[602] = acadoWorkspace.H10[106]; -acadoWorkspace.H[603] = acadoWorkspace.H10[107]; -acadoWorkspace.H[624] = acadoWorkspace.H10[108]; -acadoWorkspace.H[625] = acadoWorkspace.H10[109]; -acadoWorkspace.H[626] = acadoWorkspace.H10[110]; -acadoWorkspace.H[627] = acadoWorkspace.H10[111]; -acadoWorkspace.H[628] = acadoWorkspace.H10[112]; -acadoWorkspace.H[629] = acadoWorkspace.H10[113]; -acadoWorkspace.H[650] = acadoWorkspace.H10[114]; -acadoWorkspace.H[651] = acadoWorkspace.H10[115]; -acadoWorkspace.H[652] = acadoWorkspace.H10[116]; -acadoWorkspace.H[653] = acadoWorkspace.H10[117]; -acadoWorkspace.H[654] = acadoWorkspace.H10[118]; -acadoWorkspace.H[655] = acadoWorkspace.H10[119]; - -acado_multQ1d( &(acadoWorkspace.Q1[ 36 ]), acadoWorkspace.d, acadoWorkspace.Qd ); -acado_multQ1d( &(acadoWorkspace.Q1[ 72 ]), &(acadoWorkspace.d[ 6 ]), &(acadoWorkspace.Qd[ 6 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 108 ]), &(acadoWorkspace.d[ 12 ]), &(acadoWorkspace.Qd[ 12 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 144 ]), &(acadoWorkspace.d[ 18 ]), &(acadoWorkspace.Qd[ 18 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 180 ]), &(acadoWorkspace.d[ 24 ]), &(acadoWorkspace.Qd[ 24 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 216 ]), &(acadoWorkspace.d[ 30 ]), &(acadoWorkspace.Qd[ 30 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 252 ]), &(acadoWorkspace.d[ 36 ]), &(acadoWorkspace.Qd[ 36 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 288 ]), &(acadoWorkspace.d[ 42 ]), &(acadoWorkspace.Qd[ 42 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 324 ]), &(acadoWorkspace.d[ 48 ]), &(acadoWorkspace.Qd[ 48 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 360 ]), &(acadoWorkspace.d[ 54 ]), &(acadoWorkspace.Qd[ 54 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 396 ]), &(acadoWorkspace.d[ 60 ]), &(acadoWorkspace.Qd[ 60 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 432 ]), &(acadoWorkspace.d[ 66 ]), &(acadoWorkspace.Qd[ 66 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 468 ]), &(acadoWorkspace.d[ 72 ]), &(acadoWorkspace.Qd[ 72 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 504 ]), &(acadoWorkspace.d[ 78 ]), &(acadoWorkspace.Qd[ 78 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 540 ]), &(acadoWorkspace.d[ 84 ]), &(acadoWorkspace.Qd[ 84 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 576 ]), &(acadoWorkspace.d[ 90 ]), &(acadoWorkspace.Qd[ 90 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 612 ]), &(acadoWorkspace.d[ 96 ]), &(acadoWorkspace.Qd[ 96 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 648 ]), &(acadoWorkspace.d[ 102 ]), &(acadoWorkspace.Qd[ 102 ]) ); -acado_multQ1d( &(acadoWorkspace.Q1[ 684 ]), &(acadoWorkspace.d[ 108 ]), &(acadoWorkspace.Qd[ 108 ]) ); -acado_multQN1d( acadoWorkspace.QN1, &(acadoWorkspace.d[ 114 ]), &(acadoWorkspace.Qd[ 114 ]) ); - -acado_macCTSlx( acadoWorkspace.evGx, acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 36 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 72 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 108 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 144 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 180 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 216 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 252 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 288 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 324 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 360 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 396 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 432 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 468 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 504 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 540 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 576 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 612 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 648 ]), acadoWorkspace.g ); -acado_macCTSlx( &(acadoWorkspace.evGx[ 684 ]), acadoWorkspace.g ); -acado_macETSlu( acadoWorkspace.QE, &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 6 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 18 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 36 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 60 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 90 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 126 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 168 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 216 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 270 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 330 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 396 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 468 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 546 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 630 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 720 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 816 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 918 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1026 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1140 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 12 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 24 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 42 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 66 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 96 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 132 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 174 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 222 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 276 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 336 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 402 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 474 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 552 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 636 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 726 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 822 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 924 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1032 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1146 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 30 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 48 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 72 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 102 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 138 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 180 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 228 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 282 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 342 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 408 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 480 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 558 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 642 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 732 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 828 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 930 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1038 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1152 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 54 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 78 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 108 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 144 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 186 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 234 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 288 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 348 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 414 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 486 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 564 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 648 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 738 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 834 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 936 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1044 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1158 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 84 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 114 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 150 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 192 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 240 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 294 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 354 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 420 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 492 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 570 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 654 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 744 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 840 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 942 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1050 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1164 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 120 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 156 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 198 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 246 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 300 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 360 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 426 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 498 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 576 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 660 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 750 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 846 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 948 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1056 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1170 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 162 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 204 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 252 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 306 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 366 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 432 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 504 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 582 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 666 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 756 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 852 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 954 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1062 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1176 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 210 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 258 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 312 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 372 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 438 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 510 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 588 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 672 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 762 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 858 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 960 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1068 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1182 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 264 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 318 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 378 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 444 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 516 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 594 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 678 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 768 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 864 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 966 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1074 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1188 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 324 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 384 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 450 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 522 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 600 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 684 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 774 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 870 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 972 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1080 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1194 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 390 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 456 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 528 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 606 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 690 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 780 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 876 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 978 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1086 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1200 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 462 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 534 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 612 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 696 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 786 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 882 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 984 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1092 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1206 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 540 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 618 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 702 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 792 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 888 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 990 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1098 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1212 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 624 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 708 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 798 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 894 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 996 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1104 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1218 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 714 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 804 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 900 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1002 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1110 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1224 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 810 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 906 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1008 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1116 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1230 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 912 ]), &(acadoWorkspace.g[ 22 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1014 ]), &(acadoWorkspace.g[ 22 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1122 ]), &(acadoWorkspace.g[ 22 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1236 ]), &(acadoWorkspace.g[ 22 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1020 ]), &(acadoWorkspace.g[ 23 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1128 ]), &(acadoWorkspace.g[ 23 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1242 ]), &(acadoWorkspace.g[ 23 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1134 ]), &(acadoWorkspace.g[ 24 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1248 ]), &(acadoWorkspace.g[ 24 ]) ); -acado_macETSlu( &(acadoWorkspace.QE[ 1254 ]), &(acadoWorkspace.g[ 25 ]) ); -acadoWorkspace.lb[6] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[0]; -acadoWorkspace.lb[7] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[1]; -acadoWorkspace.lb[8] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[2]; -acadoWorkspace.lb[9] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[3]; -acadoWorkspace.lb[10] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[4]; -acadoWorkspace.lb[11] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[5]; -acadoWorkspace.lb[12] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[6]; -acadoWorkspace.lb[13] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[7]; -acadoWorkspace.lb[14] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[8]; -acadoWorkspace.lb[15] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[9]; -acadoWorkspace.lb[16] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[10]; -acadoWorkspace.lb[17] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[11]; -acadoWorkspace.lb[18] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[12]; -acadoWorkspace.lb[19] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[13]; -acadoWorkspace.lb[20] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[14]; -acadoWorkspace.lb[21] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[15]; -acadoWorkspace.lb[22] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[16]; -acadoWorkspace.lb[23] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[17]; -acadoWorkspace.lb[24] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[18]; -acadoWorkspace.lb[25] = (real_t)-1.0000000000000000e+12 - acadoVariables.u[19]; -acadoWorkspace.ub[6] = (real_t)1.0000000000000000e+12 - acadoVariables.u[0]; -acadoWorkspace.ub[7] = (real_t)1.0000000000000000e+12 - acadoVariables.u[1]; -acadoWorkspace.ub[8] = (real_t)1.0000000000000000e+12 - acadoVariables.u[2]; -acadoWorkspace.ub[9] = (real_t)1.0000000000000000e+12 - acadoVariables.u[3]; -acadoWorkspace.ub[10] = (real_t)1.0000000000000000e+12 - acadoVariables.u[4]; -acadoWorkspace.ub[11] = (real_t)1.0000000000000000e+12 - acadoVariables.u[5]; -acadoWorkspace.ub[12] = (real_t)1.0000000000000000e+12 - acadoVariables.u[6]; -acadoWorkspace.ub[13] = (real_t)1.0000000000000000e+12 - acadoVariables.u[7]; -acadoWorkspace.ub[14] = (real_t)1.0000000000000000e+12 - acadoVariables.u[8]; -acadoWorkspace.ub[15] = (real_t)1.0000000000000000e+12 - acadoVariables.u[9]; -acadoWorkspace.ub[16] = (real_t)1.0000000000000000e+12 - acadoVariables.u[10]; -acadoWorkspace.ub[17] = (real_t)1.0000000000000000e+12 - acadoVariables.u[11]; -acadoWorkspace.ub[18] = (real_t)1.0000000000000000e+12 - acadoVariables.u[12]; -acadoWorkspace.ub[19] = (real_t)1.0000000000000000e+12 - acadoVariables.u[13]; -acadoWorkspace.ub[20] = (real_t)1.0000000000000000e+12 - acadoVariables.u[14]; -acadoWorkspace.ub[21] = (real_t)1.0000000000000000e+12 - acadoVariables.u[15]; -acadoWorkspace.ub[22] = (real_t)1.0000000000000000e+12 - acadoVariables.u[16]; -acadoWorkspace.ub[23] = (real_t)1.0000000000000000e+12 - acadoVariables.u[17]; -acadoWorkspace.ub[24] = (real_t)1.0000000000000000e+12 - acadoVariables.u[18]; -acadoWorkspace.ub[25] = (real_t)1.0000000000000000e+12 - acadoVariables.u[19]; - -for (lRun1 = 0; lRun1 < 20; ++lRun1) -{ -lRun3 = xBoundIndices[ lRun1 ] - 6; -lRun4 = ((lRun3) / (6)) + (1); -acadoWorkspace.A[lRun1 * 26] = acadoWorkspace.evGx[lRun3 * 6]; -acadoWorkspace.A[lRun1 * 26 + 1] = acadoWorkspace.evGx[lRun3 * 6 + 1]; -acadoWorkspace.A[lRun1 * 26 + 2] = acadoWorkspace.evGx[lRun3 * 6 + 2]; -acadoWorkspace.A[lRun1 * 26 + 3] = acadoWorkspace.evGx[lRun3 * 6 + 3]; -acadoWorkspace.A[lRun1 * 26 + 4] = acadoWorkspace.evGx[lRun3 * 6 + 4]; -acadoWorkspace.A[lRun1 * 26 + 5] = acadoWorkspace.evGx[lRun3 * 6 + 5]; -for (lRun2 = 0; lRun2 < lRun4; ++lRun2) -{ -lRun5 = (((((lRun4) * (lRun4-1)) / (2)) + (lRun2)) * (6)) + ((lRun3) % (6)); -acadoWorkspace.A[(lRun1 * 26) + (lRun2 + 6)] = acadoWorkspace.E[lRun5]; -} -} - -} - -void acado_condenseFdb( ) -{ -real_t tmp; - -acadoWorkspace.Dx0[0] = acadoVariables.x0[0] - acadoVariables.x[0]; -acadoWorkspace.Dx0[1] = acadoVariables.x0[1] - acadoVariables.x[1]; -acadoWorkspace.Dx0[2] = acadoVariables.x0[2] - acadoVariables.x[2]; -acadoWorkspace.Dx0[3] = acadoVariables.x0[3] - acadoVariables.x[3]; -acadoWorkspace.Dx0[4] = acadoVariables.x0[4] - acadoVariables.x[4]; -acadoWorkspace.Dx0[5] = acadoVariables.x0[5] - acadoVariables.x[5]; - -acadoWorkspace.Dy[0] -= acadoVariables.y[0]; -acadoWorkspace.Dy[1] -= acadoVariables.y[1]; -acadoWorkspace.Dy[2] -= acadoVariables.y[2]; -acadoWorkspace.Dy[3] -= acadoVariables.y[3]; -acadoWorkspace.Dy[4] -= acadoVariables.y[4]; -acadoWorkspace.Dy[5] -= acadoVariables.y[5]; -acadoWorkspace.Dy[6] -= acadoVariables.y[6]; -acadoWorkspace.Dy[7] -= acadoVariables.y[7]; -acadoWorkspace.Dy[8] -= acadoVariables.y[8]; -acadoWorkspace.Dy[9] -= acadoVariables.y[9]; -acadoWorkspace.Dy[10] -= acadoVariables.y[10]; -acadoWorkspace.Dy[11] -= acadoVariables.y[11]; -acadoWorkspace.Dy[12] -= acadoVariables.y[12]; -acadoWorkspace.Dy[13] -= acadoVariables.y[13]; -acadoWorkspace.Dy[14] -= acadoVariables.y[14]; -acadoWorkspace.Dy[15] -= acadoVariables.y[15]; -acadoWorkspace.Dy[16] -= acadoVariables.y[16]; -acadoWorkspace.Dy[17] -= acadoVariables.y[17]; -acadoWorkspace.Dy[18] -= acadoVariables.y[18]; -acadoWorkspace.Dy[19] -= acadoVariables.y[19]; -acadoWorkspace.Dy[20] -= acadoVariables.y[20]; -acadoWorkspace.Dy[21] -= acadoVariables.y[21]; -acadoWorkspace.Dy[22] -= acadoVariables.y[22]; -acadoWorkspace.Dy[23] -= acadoVariables.y[23]; -acadoWorkspace.Dy[24] -= acadoVariables.y[24]; -acadoWorkspace.Dy[25] -= acadoVariables.y[25]; -acadoWorkspace.Dy[26] -= acadoVariables.y[26]; -acadoWorkspace.Dy[27] -= acadoVariables.y[27]; -acadoWorkspace.Dy[28] -= acadoVariables.y[28]; -acadoWorkspace.Dy[29] -= acadoVariables.y[29]; -acadoWorkspace.Dy[30] -= acadoVariables.y[30]; -acadoWorkspace.Dy[31] -= acadoVariables.y[31]; -acadoWorkspace.Dy[32] -= acadoVariables.y[32]; -acadoWorkspace.Dy[33] -= acadoVariables.y[33]; -acadoWorkspace.Dy[34] -= acadoVariables.y[34]; -acadoWorkspace.Dy[35] -= acadoVariables.y[35]; -acadoWorkspace.Dy[36] -= acadoVariables.y[36]; -acadoWorkspace.Dy[37] -= acadoVariables.y[37]; -acadoWorkspace.Dy[38] -= acadoVariables.y[38]; -acadoWorkspace.Dy[39] -= acadoVariables.y[39]; -acadoWorkspace.Dy[40] -= acadoVariables.y[40]; -acadoWorkspace.Dy[41] -= acadoVariables.y[41]; -acadoWorkspace.Dy[42] -= acadoVariables.y[42]; -acadoWorkspace.Dy[43] -= acadoVariables.y[43]; -acadoWorkspace.Dy[44] -= acadoVariables.y[44]; -acadoWorkspace.Dy[45] -= acadoVariables.y[45]; -acadoWorkspace.Dy[46] -= acadoVariables.y[46]; -acadoWorkspace.Dy[47] -= acadoVariables.y[47]; -acadoWorkspace.Dy[48] -= acadoVariables.y[48]; -acadoWorkspace.Dy[49] -= acadoVariables.y[49]; -acadoWorkspace.Dy[50] -= acadoVariables.y[50]; -acadoWorkspace.Dy[51] -= acadoVariables.y[51]; -acadoWorkspace.Dy[52] -= acadoVariables.y[52]; -acadoWorkspace.Dy[53] -= acadoVariables.y[53]; -acadoWorkspace.Dy[54] -= acadoVariables.y[54]; -acadoWorkspace.Dy[55] -= acadoVariables.y[55]; -acadoWorkspace.Dy[56] -= acadoVariables.y[56]; -acadoWorkspace.Dy[57] -= acadoVariables.y[57]; -acadoWorkspace.Dy[58] -= acadoVariables.y[58]; -acadoWorkspace.Dy[59] -= acadoVariables.y[59]; -acadoWorkspace.Dy[60] -= acadoVariables.y[60]; -acadoWorkspace.Dy[61] -= acadoVariables.y[61]; -acadoWorkspace.Dy[62] -= acadoVariables.y[62]; -acadoWorkspace.Dy[63] -= acadoVariables.y[63]; -acadoWorkspace.Dy[64] -= acadoVariables.y[64]; -acadoWorkspace.Dy[65] -= acadoVariables.y[65]; -acadoWorkspace.Dy[66] -= acadoVariables.y[66]; -acadoWorkspace.Dy[67] -= acadoVariables.y[67]; -acadoWorkspace.Dy[68] -= acadoVariables.y[68]; -acadoWorkspace.Dy[69] -= acadoVariables.y[69]; -acadoWorkspace.Dy[70] -= acadoVariables.y[70]; -acadoWorkspace.Dy[71] -= acadoVariables.y[71]; -acadoWorkspace.Dy[72] -= acadoVariables.y[72]; -acadoWorkspace.Dy[73] -= acadoVariables.y[73]; -acadoWorkspace.Dy[74] -= acadoVariables.y[74]; -acadoWorkspace.Dy[75] -= acadoVariables.y[75]; -acadoWorkspace.Dy[76] -= acadoVariables.y[76]; -acadoWorkspace.Dy[77] -= acadoVariables.y[77]; -acadoWorkspace.Dy[78] -= acadoVariables.y[78]; -acadoWorkspace.Dy[79] -= acadoVariables.y[79]; -acadoWorkspace.DyN[0] -= acadoVariables.yN[0]; -acadoWorkspace.DyN[1] -= acadoVariables.yN[1]; -acadoWorkspace.DyN[2] -= acadoVariables.yN[2]; - -acado_multRDy( acadoWorkspace.R2, acadoWorkspace.Dy, &(acadoWorkspace.g[ 6 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 4 ]), &(acadoWorkspace.Dy[ 4 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 8 ]), &(acadoWorkspace.Dy[ 8 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 12 ]), &(acadoWorkspace.Dy[ 12 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 16 ]), &(acadoWorkspace.Dy[ 16 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 20 ]), &(acadoWorkspace.Dy[ 20 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 24 ]), &(acadoWorkspace.Dy[ 24 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 28 ]), &(acadoWorkspace.Dy[ 28 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 32 ]), &(acadoWorkspace.Dy[ 32 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 36 ]), &(acadoWorkspace.Dy[ 36 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 40 ]), &(acadoWorkspace.Dy[ 40 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 44 ]), &(acadoWorkspace.Dy[ 44 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 48 ]), &(acadoWorkspace.Dy[ 48 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 52 ]), &(acadoWorkspace.Dy[ 52 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 56 ]), &(acadoWorkspace.Dy[ 56 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 60 ]), &(acadoWorkspace.Dy[ 60 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 64 ]), &(acadoWorkspace.Dy[ 64 ]), &(acadoWorkspace.g[ 22 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 68 ]), &(acadoWorkspace.Dy[ 68 ]), &(acadoWorkspace.g[ 23 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 72 ]), &(acadoWorkspace.Dy[ 72 ]), &(acadoWorkspace.g[ 24 ]) ); -acado_multRDy( &(acadoWorkspace.R2[ 76 ]), &(acadoWorkspace.Dy[ 76 ]), &(acadoWorkspace.g[ 25 ]) ); - -acado_multQDy( acadoWorkspace.Q2, acadoWorkspace.Dy, acadoWorkspace.QDy ); -acado_multQDy( &(acadoWorkspace.Q2[ 24 ]), &(acadoWorkspace.Dy[ 4 ]), &(acadoWorkspace.QDy[ 6 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 48 ]), &(acadoWorkspace.Dy[ 8 ]), &(acadoWorkspace.QDy[ 12 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 72 ]), &(acadoWorkspace.Dy[ 12 ]), &(acadoWorkspace.QDy[ 18 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 96 ]), &(acadoWorkspace.Dy[ 16 ]), &(acadoWorkspace.QDy[ 24 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 120 ]), &(acadoWorkspace.Dy[ 20 ]), &(acadoWorkspace.QDy[ 30 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 144 ]), &(acadoWorkspace.Dy[ 24 ]), &(acadoWorkspace.QDy[ 36 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 168 ]), &(acadoWorkspace.Dy[ 28 ]), &(acadoWorkspace.QDy[ 42 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 192 ]), &(acadoWorkspace.Dy[ 32 ]), &(acadoWorkspace.QDy[ 48 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 216 ]), &(acadoWorkspace.Dy[ 36 ]), &(acadoWorkspace.QDy[ 54 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 240 ]), &(acadoWorkspace.Dy[ 40 ]), &(acadoWorkspace.QDy[ 60 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 264 ]), &(acadoWorkspace.Dy[ 44 ]), &(acadoWorkspace.QDy[ 66 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 288 ]), &(acadoWorkspace.Dy[ 48 ]), &(acadoWorkspace.QDy[ 72 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 312 ]), &(acadoWorkspace.Dy[ 52 ]), &(acadoWorkspace.QDy[ 78 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 336 ]), &(acadoWorkspace.Dy[ 56 ]), &(acadoWorkspace.QDy[ 84 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 360 ]), &(acadoWorkspace.Dy[ 60 ]), &(acadoWorkspace.QDy[ 90 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 384 ]), &(acadoWorkspace.Dy[ 64 ]), &(acadoWorkspace.QDy[ 96 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 408 ]), &(acadoWorkspace.Dy[ 68 ]), &(acadoWorkspace.QDy[ 102 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 432 ]), &(acadoWorkspace.Dy[ 72 ]), &(acadoWorkspace.QDy[ 108 ]) ); -acado_multQDy( &(acadoWorkspace.Q2[ 456 ]), &(acadoWorkspace.Dy[ 76 ]), &(acadoWorkspace.QDy[ 114 ]) ); - -acadoWorkspace.QDy[120] = + acadoWorkspace.QN2[0]*acadoWorkspace.DyN[0] + acadoWorkspace.QN2[1]*acadoWorkspace.DyN[1] + acadoWorkspace.QN2[2]*acadoWorkspace.DyN[2]; -acadoWorkspace.QDy[121] = + acadoWorkspace.QN2[3]*acadoWorkspace.DyN[0] + acadoWorkspace.QN2[4]*acadoWorkspace.DyN[1] + acadoWorkspace.QN2[5]*acadoWorkspace.DyN[2]; -acadoWorkspace.QDy[122] = + acadoWorkspace.QN2[6]*acadoWorkspace.DyN[0] + acadoWorkspace.QN2[7]*acadoWorkspace.DyN[1] + acadoWorkspace.QN2[8]*acadoWorkspace.DyN[2]; -acadoWorkspace.QDy[123] = + acadoWorkspace.QN2[9]*acadoWorkspace.DyN[0] + acadoWorkspace.QN2[10]*acadoWorkspace.DyN[1] + acadoWorkspace.QN2[11]*acadoWorkspace.DyN[2]; -acadoWorkspace.QDy[124] = + acadoWorkspace.QN2[12]*acadoWorkspace.DyN[0] + acadoWorkspace.QN2[13]*acadoWorkspace.DyN[1] + acadoWorkspace.QN2[14]*acadoWorkspace.DyN[2]; -acadoWorkspace.QDy[125] = + acadoWorkspace.QN2[15]*acadoWorkspace.DyN[0] + acadoWorkspace.QN2[16]*acadoWorkspace.DyN[1] + acadoWorkspace.QN2[17]*acadoWorkspace.DyN[2]; - -acadoWorkspace.QDy[6] += acadoWorkspace.Qd[0]; -acadoWorkspace.QDy[7] += acadoWorkspace.Qd[1]; -acadoWorkspace.QDy[8] += acadoWorkspace.Qd[2]; -acadoWorkspace.QDy[9] += acadoWorkspace.Qd[3]; -acadoWorkspace.QDy[10] += acadoWorkspace.Qd[4]; -acadoWorkspace.QDy[11] += acadoWorkspace.Qd[5]; -acadoWorkspace.QDy[12] += acadoWorkspace.Qd[6]; -acadoWorkspace.QDy[13] += acadoWorkspace.Qd[7]; -acadoWorkspace.QDy[14] += acadoWorkspace.Qd[8]; -acadoWorkspace.QDy[15] += acadoWorkspace.Qd[9]; -acadoWorkspace.QDy[16] += acadoWorkspace.Qd[10]; -acadoWorkspace.QDy[17] += acadoWorkspace.Qd[11]; -acadoWorkspace.QDy[18] += acadoWorkspace.Qd[12]; -acadoWorkspace.QDy[19] += acadoWorkspace.Qd[13]; -acadoWorkspace.QDy[20] += acadoWorkspace.Qd[14]; -acadoWorkspace.QDy[21] += acadoWorkspace.Qd[15]; -acadoWorkspace.QDy[22] += acadoWorkspace.Qd[16]; -acadoWorkspace.QDy[23] += acadoWorkspace.Qd[17]; -acadoWorkspace.QDy[24] += acadoWorkspace.Qd[18]; -acadoWorkspace.QDy[25] += acadoWorkspace.Qd[19]; -acadoWorkspace.QDy[26] += acadoWorkspace.Qd[20]; -acadoWorkspace.QDy[27] += acadoWorkspace.Qd[21]; -acadoWorkspace.QDy[28] += acadoWorkspace.Qd[22]; -acadoWorkspace.QDy[29] += acadoWorkspace.Qd[23]; -acadoWorkspace.QDy[30] += acadoWorkspace.Qd[24]; -acadoWorkspace.QDy[31] += acadoWorkspace.Qd[25]; -acadoWorkspace.QDy[32] += acadoWorkspace.Qd[26]; -acadoWorkspace.QDy[33] += acadoWorkspace.Qd[27]; -acadoWorkspace.QDy[34] += acadoWorkspace.Qd[28]; -acadoWorkspace.QDy[35] += acadoWorkspace.Qd[29]; -acadoWorkspace.QDy[36] += acadoWorkspace.Qd[30]; -acadoWorkspace.QDy[37] += acadoWorkspace.Qd[31]; -acadoWorkspace.QDy[38] += acadoWorkspace.Qd[32]; -acadoWorkspace.QDy[39] += acadoWorkspace.Qd[33]; -acadoWorkspace.QDy[40] += acadoWorkspace.Qd[34]; -acadoWorkspace.QDy[41] += acadoWorkspace.Qd[35]; -acadoWorkspace.QDy[42] += acadoWorkspace.Qd[36]; -acadoWorkspace.QDy[43] += acadoWorkspace.Qd[37]; -acadoWorkspace.QDy[44] += acadoWorkspace.Qd[38]; -acadoWorkspace.QDy[45] += acadoWorkspace.Qd[39]; -acadoWorkspace.QDy[46] += acadoWorkspace.Qd[40]; -acadoWorkspace.QDy[47] += acadoWorkspace.Qd[41]; -acadoWorkspace.QDy[48] += acadoWorkspace.Qd[42]; -acadoWorkspace.QDy[49] += acadoWorkspace.Qd[43]; -acadoWorkspace.QDy[50] += acadoWorkspace.Qd[44]; -acadoWorkspace.QDy[51] += acadoWorkspace.Qd[45]; -acadoWorkspace.QDy[52] += acadoWorkspace.Qd[46]; -acadoWorkspace.QDy[53] += acadoWorkspace.Qd[47]; -acadoWorkspace.QDy[54] += acadoWorkspace.Qd[48]; -acadoWorkspace.QDy[55] += acadoWorkspace.Qd[49]; -acadoWorkspace.QDy[56] += acadoWorkspace.Qd[50]; -acadoWorkspace.QDy[57] += acadoWorkspace.Qd[51]; -acadoWorkspace.QDy[58] += acadoWorkspace.Qd[52]; -acadoWorkspace.QDy[59] += acadoWorkspace.Qd[53]; -acadoWorkspace.QDy[60] += acadoWorkspace.Qd[54]; -acadoWorkspace.QDy[61] += acadoWorkspace.Qd[55]; -acadoWorkspace.QDy[62] += acadoWorkspace.Qd[56]; -acadoWorkspace.QDy[63] += acadoWorkspace.Qd[57]; -acadoWorkspace.QDy[64] += acadoWorkspace.Qd[58]; -acadoWorkspace.QDy[65] += acadoWorkspace.Qd[59]; -acadoWorkspace.QDy[66] += acadoWorkspace.Qd[60]; -acadoWorkspace.QDy[67] += acadoWorkspace.Qd[61]; -acadoWorkspace.QDy[68] += acadoWorkspace.Qd[62]; -acadoWorkspace.QDy[69] += acadoWorkspace.Qd[63]; -acadoWorkspace.QDy[70] += acadoWorkspace.Qd[64]; -acadoWorkspace.QDy[71] += acadoWorkspace.Qd[65]; -acadoWorkspace.QDy[72] += acadoWorkspace.Qd[66]; -acadoWorkspace.QDy[73] += acadoWorkspace.Qd[67]; -acadoWorkspace.QDy[74] += acadoWorkspace.Qd[68]; -acadoWorkspace.QDy[75] += acadoWorkspace.Qd[69]; -acadoWorkspace.QDy[76] += acadoWorkspace.Qd[70]; -acadoWorkspace.QDy[77] += acadoWorkspace.Qd[71]; -acadoWorkspace.QDy[78] += acadoWorkspace.Qd[72]; -acadoWorkspace.QDy[79] += acadoWorkspace.Qd[73]; -acadoWorkspace.QDy[80] += acadoWorkspace.Qd[74]; -acadoWorkspace.QDy[81] += acadoWorkspace.Qd[75]; -acadoWorkspace.QDy[82] += acadoWorkspace.Qd[76]; -acadoWorkspace.QDy[83] += acadoWorkspace.Qd[77]; -acadoWorkspace.QDy[84] += acadoWorkspace.Qd[78]; -acadoWorkspace.QDy[85] += acadoWorkspace.Qd[79]; -acadoWorkspace.QDy[86] += acadoWorkspace.Qd[80]; -acadoWorkspace.QDy[87] += acadoWorkspace.Qd[81]; -acadoWorkspace.QDy[88] += acadoWorkspace.Qd[82]; -acadoWorkspace.QDy[89] += acadoWorkspace.Qd[83]; -acadoWorkspace.QDy[90] += acadoWorkspace.Qd[84]; -acadoWorkspace.QDy[91] += acadoWorkspace.Qd[85]; -acadoWorkspace.QDy[92] += acadoWorkspace.Qd[86]; -acadoWorkspace.QDy[93] += acadoWorkspace.Qd[87]; -acadoWorkspace.QDy[94] += acadoWorkspace.Qd[88]; -acadoWorkspace.QDy[95] += acadoWorkspace.Qd[89]; -acadoWorkspace.QDy[96] += acadoWorkspace.Qd[90]; -acadoWorkspace.QDy[97] += acadoWorkspace.Qd[91]; -acadoWorkspace.QDy[98] += acadoWorkspace.Qd[92]; -acadoWorkspace.QDy[99] += acadoWorkspace.Qd[93]; -acadoWorkspace.QDy[100] += acadoWorkspace.Qd[94]; -acadoWorkspace.QDy[101] += acadoWorkspace.Qd[95]; -acadoWorkspace.QDy[102] += acadoWorkspace.Qd[96]; -acadoWorkspace.QDy[103] += acadoWorkspace.Qd[97]; -acadoWorkspace.QDy[104] += acadoWorkspace.Qd[98]; -acadoWorkspace.QDy[105] += acadoWorkspace.Qd[99]; -acadoWorkspace.QDy[106] += acadoWorkspace.Qd[100]; -acadoWorkspace.QDy[107] += acadoWorkspace.Qd[101]; -acadoWorkspace.QDy[108] += acadoWorkspace.Qd[102]; -acadoWorkspace.QDy[109] += acadoWorkspace.Qd[103]; -acadoWorkspace.QDy[110] += acadoWorkspace.Qd[104]; -acadoWorkspace.QDy[111] += acadoWorkspace.Qd[105]; -acadoWorkspace.QDy[112] += acadoWorkspace.Qd[106]; -acadoWorkspace.QDy[113] += acadoWorkspace.Qd[107]; -acadoWorkspace.QDy[114] += acadoWorkspace.Qd[108]; -acadoWorkspace.QDy[115] += acadoWorkspace.Qd[109]; -acadoWorkspace.QDy[116] += acadoWorkspace.Qd[110]; -acadoWorkspace.QDy[117] += acadoWorkspace.Qd[111]; -acadoWorkspace.QDy[118] += acadoWorkspace.Qd[112]; -acadoWorkspace.QDy[119] += acadoWorkspace.Qd[113]; -acadoWorkspace.QDy[120] += acadoWorkspace.Qd[114]; -acadoWorkspace.QDy[121] += acadoWorkspace.Qd[115]; -acadoWorkspace.QDy[122] += acadoWorkspace.Qd[116]; -acadoWorkspace.QDy[123] += acadoWorkspace.Qd[117]; -acadoWorkspace.QDy[124] += acadoWorkspace.Qd[118]; -acadoWorkspace.QDy[125] += acadoWorkspace.Qd[119]; - -acadoWorkspace.g[0] = + acadoWorkspace.evGx[0]*acadoWorkspace.QDy[6] + acadoWorkspace.evGx[6]*acadoWorkspace.QDy[7] + acadoWorkspace.evGx[12]*acadoWorkspace.QDy[8] + acadoWorkspace.evGx[18]*acadoWorkspace.QDy[9] + acadoWorkspace.evGx[24]*acadoWorkspace.QDy[10] + acadoWorkspace.evGx[30]*acadoWorkspace.QDy[11] + acadoWorkspace.evGx[36]*acadoWorkspace.QDy[12] + acadoWorkspace.evGx[42]*acadoWorkspace.QDy[13] + acadoWorkspace.evGx[48]*acadoWorkspace.QDy[14] + acadoWorkspace.evGx[54]*acadoWorkspace.QDy[15] + acadoWorkspace.evGx[60]*acadoWorkspace.QDy[16] + acadoWorkspace.evGx[66]*acadoWorkspace.QDy[17] + acadoWorkspace.evGx[72]*acadoWorkspace.QDy[18] + acadoWorkspace.evGx[78]*acadoWorkspace.QDy[19] + acadoWorkspace.evGx[84]*acadoWorkspace.QDy[20] + acadoWorkspace.evGx[90]*acadoWorkspace.QDy[21] + acadoWorkspace.evGx[96]*acadoWorkspace.QDy[22] + acadoWorkspace.evGx[102]*acadoWorkspace.QDy[23] + acadoWorkspace.evGx[108]*acadoWorkspace.QDy[24] + acadoWorkspace.evGx[114]*acadoWorkspace.QDy[25] + acadoWorkspace.evGx[120]*acadoWorkspace.QDy[26] + acadoWorkspace.evGx[126]*acadoWorkspace.QDy[27] + acadoWorkspace.evGx[132]*acadoWorkspace.QDy[28] + acadoWorkspace.evGx[138]*acadoWorkspace.QDy[29] + acadoWorkspace.evGx[144]*acadoWorkspace.QDy[30] + acadoWorkspace.evGx[150]*acadoWorkspace.QDy[31] + acadoWorkspace.evGx[156]*acadoWorkspace.QDy[32] + acadoWorkspace.evGx[162]*acadoWorkspace.QDy[33] + acadoWorkspace.evGx[168]*acadoWorkspace.QDy[34] + acadoWorkspace.evGx[174]*acadoWorkspace.QDy[35] + acadoWorkspace.evGx[180]*acadoWorkspace.QDy[36] + acadoWorkspace.evGx[186]*acadoWorkspace.QDy[37] + acadoWorkspace.evGx[192]*acadoWorkspace.QDy[38] + acadoWorkspace.evGx[198]*acadoWorkspace.QDy[39] + acadoWorkspace.evGx[204]*acadoWorkspace.QDy[40] + acadoWorkspace.evGx[210]*acadoWorkspace.QDy[41] + acadoWorkspace.evGx[216]*acadoWorkspace.QDy[42] + acadoWorkspace.evGx[222]*acadoWorkspace.QDy[43] + acadoWorkspace.evGx[228]*acadoWorkspace.QDy[44] + acadoWorkspace.evGx[234]*acadoWorkspace.QDy[45] + acadoWorkspace.evGx[240]*acadoWorkspace.QDy[46] + acadoWorkspace.evGx[246]*acadoWorkspace.QDy[47] + acadoWorkspace.evGx[252]*acadoWorkspace.QDy[48] + acadoWorkspace.evGx[258]*acadoWorkspace.QDy[49] + acadoWorkspace.evGx[264]*acadoWorkspace.QDy[50] + acadoWorkspace.evGx[270]*acadoWorkspace.QDy[51] + acadoWorkspace.evGx[276]*acadoWorkspace.QDy[52] + acadoWorkspace.evGx[282]*acadoWorkspace.QDy[53] + acadoWorkspace.evGx[288]*acadoWorkspace.QDy[54] + acadoWorkspace.evGx[294]*acadoWorkspace.QDy[55] + acadoWorkspace.evGx[300]*acadoWorkspace.QDy[56] + acadoWorkspace.evGx[306]*acadoWorkspace.QDy[57] + acadoWorkspace.evGx[312]*acadoWorkspace.QDy[58] + acadoWorkspace.evGx[318]*acadoWorkspace.QDy[59] + acadoWorkspace.evGx[324]*acadoWorkspace.QDy[60] + acadoWorkspace.evGx[330]*acadoWorkspace.QDy[61] + acadoWorkspace.evGx[336]*acadoWorkspace.QDy[62] + acadoWorkspace.evGx[342]*acadoWorkspace.QDy[63] + acadoWorkspace.evGx[348]*acadoWorkspace.QDy[64] + acadoWorkspace.evGx[354]*acadoWorkspace.QDy[65] + acadoWorkspace.evGx[360]*acadoWorkspace.QDy[66] + acadoWorkspace.evGx[366]*acadoWorkspace.QDy[67] + acadoWorkspace.evGx[372]*acadoWorkspace.QDy[68] + acadoWorkspace.evGx[378]*acadoWorkspace.QDy[69] + acadoWorkspace.evGx[384]*acadoWorkspace.QDy[70] + acadoWorkspace.evGx[390]*acadoWorkspace.QDy[71] + acadoWorkspace.evGx[396]*acadoWorkspace.QDy[72] + acadoWorkspace.evGx[402]*acadoWorkspace.QDy[73] + acadoWorkspace.evGx[408]*acadoWorkspace.QDy[74] + acadoWorkspace.evGx[414]*acadoWorkspace.QDy[75] + acadoWorkspace.evGx[420]*acadoWorkspace.QDy[76] + acadoWorkspace.evGx[426]*acadoWorkspace.QDy[77] + acadoWorkspace.evGx[432]*acadoWorkspace.QDy[78] + acadoWorkspace.evGx[438]*acadoWorkspace.QDy[79] + acadoWorkspace.evGx[444]*acadoWorkspace.QDy[80] + acadoWorkspace.evGx[450]*acadoWorkspace.QDy[81] + acadoWorkspace.evGx[456]*acadoWorkspace.QDy[82] + acadoWorkspace.evGx[462]*acadoWorkspace.QDy[83] + acadoWorkspace.evGx[468]*acadoWorkspace.QDy[84] + acadoWorkspace.evGx[474]*acadoWorkspace.QDy[85] + acadoWorkspace.evGx[480]*acadoWorkspace.QDy[86] + acadoWorkspace.evGx[486]*acadoWorkspace.QDy[87] + acadoWorkspace.evGx[492]*acadoWorkspace.QDy[88] + acadoWorkspace.evGx[498]*acadoWorkspace.QDy[89] + acadoWorkspace.evGx[504]*acadoWorkspace.QDy[90] + acadoWorkspace.evGx[510]*acadoWorkspace.QDy[91] + acadoWorkspace.evGx[516]*acadoWorkspace.QDy[92] + acadoWorkspace.evGx[522]*acadoWorkspace.QDy[93] + acadoWorkspace.evGx[528]*acadoWorkspace.QDy[94] + acadoWorkspace.evGx[534]*acadoWorkspace.QDy[95] + acadoWorkspace.evGx[540]*acadoWorkspace.QDy[96] + acadoWorkspace.evGx[546]*acadoWorkspace.QDy[97] + acadoWorkspace.evGx[552]*acadoWorkspace.QDy[98] + acadoWorkspace.evGx[558]*acadoWorkspace.QDy[99] + acadoWorkspace.evGx[564]*acadoWorkspace.QDy[100] + acadoWorkspace.evGx[570]*acadoWorkspace.QDy[101] + acadoWorkspace.evGx[576]*acadoWorkspace.QDy[102] + acadoWorkspace.evGx[582]*acadoWorkspace.QDy[103] + acadoWorkspace.evGx[588]*acadoWorkspace.QDy[104] + acadoWorkspace.evGx[594]*acadoWorkspace.QDy[105] + acadoWorkspace.evGx[600]*acadoWorkspace.QDy[106] + acadoWorkspace.evGx[606]*acadoWorkspace.QDy[107] + acadoWorkspace.evGx[612]*acadoWorkspace.QDy[108] + acadoWorkspace.evGx[618]*acadoWorkspace.QDy[109] + acadoWorkspace.evGx[624]*acadoWorkspace.QDy[110] + acadoWorkspace.evGx[630]*acadoWorkspace.QDy[111] + acadoWorkspace.evGx[636]*acadoWorkspace.QDy[112] + acadoWorkspace.evGx[642]*acadoWorkspace.QDy[113] + acadoWorkspace.evGx[648]*acadoWorkspace.QDy[114] + acadoWorkspace.evGx[654]*acadoWorkspace.QDy[115] + acadoWorkspace.evGx[660]*acadoWorkspace.QDy[116] + acadoWorkspace.evGx[666]*acadoWorkspace.QDy[117] + acadoWorkspace.evGx[672]*acadoWorkspace.QDy[118] + acadoWorkspace.evGx[678]*acadoWorkspace.QDy[119] + acadoWorkspace.evGx[684]*acadoWorkspace.QDy[120] + acadoWorkspace.evGx[690]*acadoWorkspace.QDy[121] + acadoWorkspace.evGx[696]*acadoWorkspace.QDy[122] + acadoWorkspace.evGx[702]*acadoWorkspace.QDy[123] + acadoWorkspace.evGx[708]*acadoWorkspace.QDy[124] + acadoWorkspace.evGx[714]*acadoWorkspace.QDy[125]; -acadoWorkspace.g[1] = + acadoWorkspace.evGx[1]*acadoWorkspace.QDy[6] + acadoWorkspace.evGx[7]*acadoWorkspace.QDy[7] + acadoWorkspace.evGx[13]*acadoWorkspace.QDy[8] + acadoWorkspace.evGx[19]*acadoWorkspace.QDy[9] + acadoWorkspace.evGx[25]*acadoWorkspace.QDy[10] + acadoWorkspace.evGx[31]*acadoWorkspace.QDy[11] + acadoWorkspace.evGx[37]*acadoWorkspace.QDy[12] + acadoWorkspace.evGx[43]*acadoWorkspace.QDy[13] + acadoWorkspace.evGx[49]*acadoWorkspace.QDy[14] + acadoWorkspace.evGx[55]*acadoWorkspace.QDy[15] + acadoWorkspace.evGx[61]*acadoWorkspace.QDy[16] + acadoWorkspace.evGx[67]*acadoWorkspace.QDy[17] + acadoWorkspace.evGx[73]*acadoWorkspace.QDy[18] + acadoWorkspace.evGx[79]*acadoWorkspace.QDy[19] + acadoWorkspace.evGx[85]*acadoWorkspace.QDy[20] + acadoWorkspace.evGx[91]*acadoWorkspace.QDy[21] + acadoWorkspace.evGx[97]*acadoWorkspace.QDy[22] + acadoWorkspace.evGx[103]*acadoWorkspace.QDy[23] + acadoWorkspace.evGx[109]*acadoWorkspace.QDy[24] + acadoWorkspace.evGx[115]*acadoWorkspace.QDy[25] + acadoWorkspace.evGx[121]*acadoWorkspace.QDy[26] + acadoWorkspace.evGx[127]*acadoWorkspace.QDy[27] + acadoWorkspace.evGx[133]*acadoWorkspace.QDy[28] + acadoWorkspace.evGx[139]*acadoWorkspace.QDy[29] + acadoWorkspace.evGx[145]*acadoWorkspace.QDy[30] + acadoWorkspace.evGx[151]*acadoWorkspace.QDy[31] + acadoWorkspace.evGx[157]*acadoWorkspace.QDy[32] + acadoWorkspace.evGx[163]*acadoWorkspace.QDy[33] + acadoWorkspace.evGx[169]*acadoWorkspace.QDy[34] + acadoWorkspace.evGx[175]*acadoWorkspace.QDy[35] + acadoWorkspace.evGx[181]*acadoWorkspace.QDy[36] + acadoWorkspace.evGx[187]*acadoWorkspace.QDy[37] + acadoWorkspace.evGx[193]*acadoWorkspace.QDy[38] + acadoWorkspace.evGx[199]*acadoWorkspace.QDy[39] + acadoWorkspace.evGx[205]*acadoWorkspace.QDy[40] + acadoWorkspace.evGx[211]*acadoWorkspace.QDy[41] + acadoWorkspace.evGx[217]*acadoWorkspace.QDy[42] + acadoWorkspace.evGx[223]*acadoWorkspace.QDy[43] + acadoWorkspace.evGx[229]*acadoWorkspace.QDy[44] + acadoWorkspace.evGx[235]*acadoWorkspace.QDy[45] + acadoWorkspace.evGx[241]*acadoWorkspace.QDy[46] + acadoWorkspace.evGx[247]*acadoWorkspace.QDy[47] + acadoWorkspace.evGx[253]*acadoWorkspace.QDy[48] + acadoWorkspace.evGx[259]*acadoWorkspace.QDy[49] + acadoWorkspace.evGx[265]*acadoWorkspace.QDy[50] + acadoWorkspace.evGx[271]*acadoWorkspace.QDy[51] + acadoWorkspace.evGx[277]*acadoWorkspace.QDy[52] + acadoWorkspace.evGx[283]*acadoWorkspace.QDy[53] + acadoWorkspace.evGx[289]*acadoWorkspace.QDy[54] + acadoWorkspace.evGx[295]*acadoWorkspace.QDy[55] + acadoWorkspace.evGx[301]*acadoWorkspace.QDy[56] + acadoWorkspace.evGx[307]*acadoWorkspace.QDy[57] + acadoWorkspace.evGx[313]*acadoWorkspace.QDy[58] + acadoWorkspace.evGx[319]*acadoWorkspace.QDy[59] + acadoWorkspace.evGx[325]*acadoWorkspace.QDy[60] + acadoWorkspace.evGx[331]*acadoWorkspace.QDy[61] + acadoWorkspace.evGx[337]*acadoWorkspace.QDy[62] + acadoWorkspace.evGx[343]*acadoWorkspace.QDy[63] + acadoWorkspace.evGx[349]*acadoWorkspace.QDy[64] + acadoWorkspace.evGx[355]*acadoWorkspace.QDy[65] + acadoWorkspace.evGx[361]*acadoWorkspace.QDy[66] + acadoWorkspace.evGx[367]*acadoWorkspace.QDy[67] + acadoWorkspace.evGx[373]*acadoWorkspace.QDy[68] + acadoWorkspace.evGx[379]*acadoWorkspace.QDy[69] + acadoWorkspace.evGx[385]*acadoWorkspace.QDy[70] + acadoWorkspace.evGx[391]*acadoWorkspace.QDy[71] + acadoWorkspace.evGx[397]*acadoWorkspace.QDy[72] + acadoWorkspace.evGx[403]*acadoWorkspace.QDy[73] + acadoWorkspace.evGx[409]*acadoWorkspace.QDy[74] + acadoWorkspace.evGx[415]*acadoWorkspace.QDy[75] + acadoWorkspace.evGx[421]*acadoWorkspace.QDy[76] + acadoWorkspace.evGx[427]*acadoWorkspace.QDy[77] + acadoWorkspace.evGx[433]*acadoWorkspace.QDy[78] + acadoWorkspace.evGx[439]*acadoWorkspace.QDy[79] + acadoWorkspace.evGx[445]*acadoWorkspace.QDy[80] + acadoWorkspace.evGx[451]*acadoWorkspace.QDy[81] + acadoWorkspace.evGx[457]*acadoWorkspace.QDy[82] + acadoWorkspace.evGx[463]*acadoWorkspace.QDy[83] + acadoWorkspace.evGx[469]*acadoWorkspace.QDy[84] + acadoWorkspace.evGx[475]*acadoWorkspace.QDy[85] + acadoWorkspace.evGx[481]*acadoWorkspace.QDy[86] + acadoWorkspace.evGx[487]*acadoWorkspace.QDy[87] + acadoWorkspace.evGx[493]*acadoWorkspace.QDy[88] + acadoWorkspace.evGx[499]*acadoWorkspace.QDy[89] + acadoWorkspace.evGx[505]*acadoWorkspace.QDy[90] + acadoWorkspace.evGx[511]*acadoWorkspace.QDy[91] + acadoWorkspace.evGx[517]*acadoWorkspace.QDy[92] + acadoWorkspace.evGx[523]*acadoWorkspace.QDy[93] + acadoWorkspace.evGx[529]*acadoWorkspace.QDy[94] + acadoWorkspace.evGx[535]*acadoWorkspace.QDy[95] + acadoWorkspace.evGx[541]*acadoWorkspace.QDy[96] + acadoWorkspace.evGx[547]*acadoWorkspace.QDy[97] + acadoWorkspace.evGx[553]*acadoWorkspace.QDy[98] + acadoWorkspace.evGx[559]*acadoWorkspace.QDy[99] + acadoWorkspace.evGx[565]*acadoWorkspace.QDy[100] + acadoWorkspace.evGx[571]*acadoWorkspace.QDy[101] + acadoWorkspace.evGx[577]*acadoWorkspace.QDy[102] + acadoWorkspace.evGx[583]*acadoWorkspace.QDy[103] + acadoWorkspace.evGx[589]*acadoWorkspace.QDy[104] + acadoWorkspace.evGx[595]*acadoWorkspace.QDy[105] + acadoWorkspace.evGx[601]*acadoWorkspace.QDy[106] + acadoWorkspace.evGx[607]*acadoWorkspace.QDy[107] + acadoWorkspace.evGx[613]*acadoWorkspace.QDy[108] + acadoWorkspace.evGx[619]*acadoWorkspace.QDy[109] + acadoWorkspace.evGx[625]*acadoWorkspace.QDy[110] + acadoWorkspace.evGx[631]*acadoWorkspace.QDy[111] + acadoWorkspace.evGx[637]*acadoWorkspace.QDy[112] + acadoWorkspace.evGx[643]*acadoWorkspace.QDy[113] + acadoWorkspace.evGx[649]*acadoWorkspace.QDy[114] + acadoWorkspace.evGx[655]*acadoWorkspace.QDy[115] + acadoWorkspace.evGx[661]*acadoWorkspace.QDy[116] + acadoWorkspace.evGx[667]*acadoWorkspace.QDy[117] + acadoWorkspace.evGx[673]*acadoWorkspace.QDy[118] + acadoWorkspace.evGx[679]*acadoWorkspace.QDy[119] + acadoWorkspace.evGx[685]*acadoWorkspace.QDy[120] + acadoWorkspace.evGx[691]*acadoWorkspace.QDy[121] + acadoWorkspace.evGx[697]*acadoWorkspace.QDy[122] + acadoWorkspace.evGx[703]*acadoWorkspace.QDy[123] + acadoWorkspace.evGx[709]*acadoWorkspace.QDy[124] + acadoWorkspace.evGx[715]*acadoWorkspace.QDy[125]; -acadoWorkspace.g[2] = + acadoWorkspace.evGx[2]*acadoWorkspace.QDy[6] + acadoWorkspace.evGx[8]*acadoWorkspace.QDy[7] + acadoWorkspace.evGx[14]*acadoWorkspace.QDy[8] + acadoWorkspace.evGx[20]*acadoWorkspace.QDy[9] + acadoWorkspace.evGx[26]*acadoWorkspace.QDy[10] + acadoWorkspace.evGx[32]*acadoWorkspace.QDy[11] + acadoWorkspace.evGx[38]*acadoWorkspace.QDy[12] + acadoWorkspace.evGx[44]*acadoWorkspace.QDy[13] + acadoWorkspace.evGx[50]*acadoWorkspace.QDy[14] + acadoWorkspace.evGx[56]*acadoWorkspace.QDy[15] + acadoWorkspace.evGx[62]*acadoWorkspace.QDy[16] + acadoWorkspace.evGx[68]*acadoWorkspace.QDy[17] + acadoWorkspace.evGx[74]*acadoWorkspace.QDy[18] + acadoWorkspace.evGx[80]*acadoWorkspace.QDy[19] + acadoWorkspace.evGx[86]*acadoWorkspace.QDy[20] + acadoWorkspace.evGx[92]*acadoWorkspace.QDy[21] + acadoWorkspace.evGx[98]*acadoWorkspace.QDy[22] + acadoWorkspace.evGx[104]*acadoWorkspace.QDy[23] + acadoWorkspace.evGx[110]*acadoWorkspace.QDy[24] + acadoWorkspace.evGx[116]*acadoWorkspace.QDy[25] + acadoWorkspace.evGx[122]*acadoWorkspace.QDy[26] + acadoWorkspace.evGx[128]*acadoWorkspace.QDy[27] + acadoWorkspace.evGx[134]*acadoWorkspace.QDy[28] + acadoWorkspace.evGx[140]*acadoWorkspace.QDy[29] + acadoWorkspace.evGx[146]*acadoWorkspace.QDy[30] + acadoWorkspace.evGx[152]*acadoWorkspace.QDy[31] + acadoWorkspace.evGx[158]*acadoWorkspace.QDy[32] + acadoWorkspace.evGx[164]*acadoWorkspace.QDy[33] + acadoWorkspace.evGx[170]*acadoWorkspace.QDy[34] + acadoWorkspace.evGx[176]*acadoWorkspace.QDy[35] + acadoWorkspace.evGx[182]*acadoWorkspace.QDy[36] + acadoWorkspace.evGx[188]*acadoWorkspace.QDy[37] + acadoWorkspace.evGx[194]*acadoWorkspace.QDy[38] + acadoWorkspace.evGx[200]*acadoWorkspace.QDy[39] + acadoWorkspace.evGx[206]*acadoWorkspace.QDy[40] + acadoWorkspace.evGx[212]*acadoWorkspace.QDy[41] + acadoWorkspace.evGx[218]*acadoWorkspace.QDy[42] + acadoWorkspace.evGx[224]*acadoWorkspace.QDy[43] + acadoWorkspace.evGx[230]*acadoWorkspace.QDy[44] + acadoWorkspace.evGx[236]*acadoWorkspace.QDy[45] + acadoWorkspace.evGx[242]*acadoWorkspace.QDy[46] + acadoWorkspace.evGx[248]*acadoWorkspace.QDy[47] + acadoWorkspace.evGx[254]*acadoWorkspace.QDy[48] + acadoWorkspace.evGx[260]*acadoWorkspace.QDy[49] + acadoWorkspace.evGx[266]*acadoWorkspace.QDy[50] + acadoWorkspace.evGx[272]*acadoWorkspace.QDy[51] + acadoWorkspace.evGx[278]*acadoWorkspace.QDy[52] + acadoWorkspace.evGx[284]*acadoWorkspace.QDy[53] + acadoWorkspace.evGx[290]*acadoWorkspace.QDy[54] + acadoWorkspace.evGx[296]*acadoWorkspace.QDy[55] + acadoWorkspace.evGx[302]*acadoWorkspace.QDy[56] + acadoWorkspace.evGx[308]*acadoWorkspace.QDy[57] + acadoWorkspace.evGx[314]*acadoWorkspace.QDy[58] + acadoWorkspace.evGx[320]*acadoWorkspace.QDy[59] + acadoWorkspace.evGx[326]*acadoWorkspace.QDy[60] + acadoWorkspace.evGx[332]*acadoWorkspace.QDy[61] + acadoWorkspace.evGx[338]*acadoWorkspace.QDy[62] + acadoWorkspace.evGx[344]*acadoWorkspace.QDy[63] + acadoWorkspace.evGx[350]*acadoWorkspace.QDy[64] + acadoWorkspace.evGx[356]*acadoWorkspace.QDy[65] + acadoWorkspace.evGx[362]*acadoWorkspace.QDy[66] + acadoWorkspace.evGx[368]*acadoWorkspace.QDy[67] + acadoWorkspace.evGx[374]*acadoWorkspace.QDy[68] + acadoWorkspace.evGx[380]*acadoWorkspace.QDy[69] + acadoWorkspace.evGx[386]*acadoWorkspace.QDy[70] + acadoWorkspace.evGx[392]*acadoWorkspace.QDy[71] + acadoWorkspace.evGx[398]*acadoWorkspace.QDy[72] + acadoWorkspace.evGx[404]*acadoWorkspace.QDy[73] + acadoWorkspace.evGx[410]*acadoWorkspace.QDy[74] + acadoWorkspace.evGx[416]*acadoWorkspace.QDy[75] + acadoWorkspace.evGx[422]*acadoWorkspace.QDy[76] + acadoWorkspace.evGx[428]*acadoWorkspace.QDy[77] + acadoWorkspace.evGx[434]*acadoWorkspace.QDy[78] + acadoWorkspace.evGx[440]*acadoWorkspace.QDy[79] + acadoWorkspace.evGx[446]*acadoWorkspace.QDy[80] + acadoWorkspace.evGx[452]*acadoWorkspace.QDy[81] + acadoWorkspace.evGx[458]*acadoWorkspace.QDy[82] + acadoWorkspace.evGx[464]*acadoWorkspace.QDy[83] + acadoWorkspace.evGx[470]*acadoWorkspace.QDy[84] + acadoWorkspace.evGx[476]*acadoWorkspace.QDy[85] + acadoWorkspace.evGx[482]*acadoWorkspace.QDy[86] + acadoWorkspace.evGx[488]*acadoWorkspace.QDy[87] + acadoWorkspace.evGx[494]*acadoWorkspace.QDy[88] + acadoWorkspace.evGx[500]*acadoWorkspace.QDy[89] + acadoWorkspace.evGx[506]*acadoWorkspace.QDy[90] + acadoWorkspace.evGx[512]*acadoWorkspace.QDy[91] + acadoWorkspace.evGx[518]*acadoWorkspace.QDy[92] + acadoWorkspace.evGx[524]*acadoWorkspace.QDy[93] + acadoWorkspace.evGx[530]*acadoWorkspace.QDy[94] + acadoWorkspace.evGx[536]*acadoWorkspace.QDy[95] + acadoWorkspace.evGx[542]*acadoWorkspace.QDy[96] + acadoWorkspace.evGx[548]*acadoWorkspace.QDy[97] + acadoWorkspace.evGx[554]*acadoWorkspace.QDy[98] + acadoWorkspace.evGx[560]*acadoWorkspace.QDy[99] + acadoWorkspace.evGx[566]*acadoWorkspace.QDy[100] + acadoWorkspace.evGx[572]*acadoWorkspace.QDy[101] + acadoWorkspace.evGx[578]*acadoWorkspace.QDy[102] + acadoWorkspace.evGx[584]*acadoWorkspace.QDy[103] + acadoWorkspace.evGx[590]*acadoWorkspace.QDy[104] + acadoWorkspace.evGx[596]*acadoWorkspace.QDy[105] + acadoWorkspace.evGx[602]*acadoWorkspace.QDy[106] + acadoWorkspace.evGx[608]*acadoWorkspace.QDy[107] + acadoWorkspace.evGx[614]*acadoWorkspace.QDy[108] + acadoWorkspace.evGx[620]*acadoWorkspace.QDy[109] + acadoWorkspace.evGx[626]*acadoWorkspace.QDy[110] + acadoWorkspace.evGx[632]*acadoWorkspace.QDy[111] + acadoWorkspace.evGx[638]*acadoWorkspace.QDy[112] + acadoWorkspace.evGx[644]*acadoWorkspace.QDy[113] + acadoWorkspace.evGx[650]*acadoWorkspace.QDy[114] + acadoWorkspace.evGx[656]*acadoWorkspace.QDy[115] + acadoWorkspace.evGx[662]*acadoWorkspace.QDy[116] + acadoWorkspace.evGx[668]*acadoWorkspace.QDy[117] + acadoWorkspace.evGx[674]*acadoWorkspace.QDy[118] + acadoWorkspace.evGx[680]*acadoWorkspace.QDy[119] + acadoWorkspace.evGx[686]*acadoWorkspace.QDy[120] + acadoWorkspace.evGx[692]*acadoWorkspace.QDy[121] + acadoWorkspace.evGx[698]*acadoWorkspace.QDy[122] + acadoWorkspace.evGx[704]*acadoWorkspace.QDy[123] + acadoWorkspace.evGx[710]*acadoWorkspace.QDy[124] + acadoWorkspace.evGx[716]*acadoWorkspace.QDy[125]; -acadoWorkspace.g[3] = + acadoWorkspace.evGx[3]*acadoWorkspace.QDy[6] + acadoWorkspace.evGx[9]*acadoWorkspace.QDy[7] + acadoWorkspace.evGx[15]*acadoWorkspace.QDy[8] + acadoWorkspace.evGx[21]*acadoWorkspace.QDy[9] + acadoWorkspace.evGx[27]*acadoWorkspace.QDy[10] + acadoWorkspace.evGx[33]*acadoWorkspace.QDy[11] + acadoWorkspace.evGx[39]*acadoWorkspace.QDy[12] + acadoWorkspace.evGx[45]*acadoWorkspace.QDy[13] + acadoWorkspace.evGx[51]*acadoWorkspace.QDy[14] + acadoWorkspace.evGx[57]*acadoWorkspace.QDy[15] + acadoWorkspace.evGx[63]*acadoWorkspace.QDy[16] + acadoWorkspace.evGx[69]*acadoWorkspace.QDy[17] + acadoWorkspace.evGx[75]*acadoWorkspace.QDy[18] + acadoWorkspace.evGx[81]*acadoWorkspace.QDy[19] + acadoWorkspace.evGx[87]*acadoWorkspace.QDy[20] + acadoWorkspace.evGx[93]*acadoWorkspace.QDy[21] + acadoWorkspace.evGx[99]*acadoWorkspace.QDy[22] + acadoWorkspace.evGx[105]*acadoWorkspace.QDy[23] + acadoWorkspace.evGx[111]*acadoWorkspace.QDy[24] + acadoWorkspace.evGx[117]*acadoWorkspace.QDy[25] + acadoWorkspace.evGx[123]*acadoWorkspace.QDy[26] + acadoWorkspace.evGx[129]*acadoWorkspace.QDy[27] + acadoWorkspace.evGx[135]*acadoWorkspace.QDy[28] + acadoWorkspace.evGx[141]*acadoWorkspace.QDy[29] + acadoWorkspace.evGx[147]*acadoWorkspace.QDy[30] + acadoWorkspace.evGx[153]*acadoWorkspace.QDy[31] + acadoWorkspace.evGx[159]*acadoWorkspace.QDy[32] + acadoWorkspace.evGx[165]*acadoWorkspace.QDy[33] + acadoWorkspace.evGx[171]*acadoWorkspace.QDy[34] + acadoWorkspace.evGx[177]*acadoWorkspace.QDy[35] + acadoWorkspace.evGx[183]*acadoWorkspace.QDy[36] + acadoWorkspace.evGx[189]*acadoWorkspace.QDy[37] + acadoWorkspace.evGx[195]*acadoWorkspace.QDy[38] + acadoWorkspace.evGx[201]*acadoWorkspace.QDy[39] + acadoWorkspace.evGx[207]*acadoWorkspace.QDy[40] + acadoWorkspace.evGx[213]*acadoWorkspace.QDy[41] + acadoWorkspace.evGx[219]*acadoWorkspace.QDy[42] + acadoWorkspace.evGx[225]*acadoWorkspace.QDy[43] + acadoWorkspace.evGx[231]*acadoWorkspace.QDy[44] + acadoWorkspace.evGx[237]*acadoWorkspace.QDy[45] + acadoWorkspace.evGx[243]*acadoWorkspace.QDy[46] + acadoWorkspace.evGx[249]*acadoWorkspace.QDy[47] + acadoWorkspace.evGx[255]*acadoWorkspace.QDy[48] + acadoWorkspace.evGx[261]*acadoWorkspace.QDy[49] + acadoWorkspace.evGx[267]*acadoWorkspace.QDy[50] + acadoWorkspace.evGx[273]*acadoWorkspace.QDy[51] + acadoWorkspace.evGx[279]*acadoWorkspace.QDy[52] + acadoWorkspace.evGx[285]*acadoWorkspace.QDy[53] + acadoWorkspace.evGx[291]*acadoWorkspace.QDy[54] + acadoWorkspace.evGx[297]*acadoWorkspace.QDy[55] + acadoWorkspace.evGx[303]*acadoWorkspace.QDy[56] + acadoWorkspace.evGx[309]*acadoWorkspace.QDy[57] + acadoWorkspace.evGx[315]*acadoWorkspace.QDy[58] + acadoWorkspace.evGx[321]*acadoWorkspace.QDy[59] + acadoWorkspace.evGx[327]*acadoWorkspace.QDy[60] + acadoWorkspace.evGx[333]*acadoWorkspace.QDy[61] + acadoWorkspace.evGx[339]*acadoWorkspace.QDy[62] + acadoWorkspace.evGx[345]*acadoWorkspace.QDy[63] + acadoWorkspace.evGx[351]*acadoWorkspace.QDy[64] + acadoWorkspace.evGx[357]*acadoWorkspace.QDy[65] + acadoWorkspace.evGx[363]*acadoWorkspace.QDy[66] + acadoWorkspace.evGx[369]*acadoWorkspace.QDy[67] + acadoWorkspace.evGx[375]*acadoWorkspace.QDy[68] + acadoWorkspace.evGx[381]*acadoWorkspace.QDy[69] + acadoWorkspace.evGx[387]*acadoWorkspace.QDy[70] + acadoWorkspace.evGx[393]*acadoWorkspace.QDy[71] + acadoWorkspace.evGx[399]*acadoWorkspace.QDy[72] + acadoWorkspace.evGx[405]*acadoWorkspace.QDy[73] + acadoWorkspace.evGx[411]*acadoWorkspace.QDy[74] + acadoWorkspace.evGx[417]*acadoWorkspace.QDy[75] + acadoWorkspace.evGx[423]*acadoWorkspace.QDy[76] + acadoWorkspace.evGx[429]*acadoWorkspace.QDy[77] + acadoWorkspace.evGx[435]*acadoWorkspace.QDy[78] + acadoWorkspace.evGx[441]*acadoWorkspace.QDy[79] + acadoWorkspace.evGx[447]*acadoWorkspace.QDy[80] + acadoWorkspace.evGx[453]*acadoWorkspace.QDy[81] + acadoWorkspace.evGx[459]*acadoWorkspace.QDy[82] + acadoWorkspace.evGx[465]*acadoWorkspace.QDy[83] + acadoWorkspace.evGx[471]*acadoWorkspace.QDy[84] + acadoWorkspace.evGx[477]*acadoWorkspace.QDy[85] + acadoWorkspace.evGx[483]*acadoWorkspace.QDy[86] + acadoWorkspace.evGx[489]*acadoWorkspace.QDy[87] + acadoWorkspace.evGx[495]*acadoWorkspace.QDy[88] + acadoWorkspace.evGx[501]*acadoWorkspace.QDy[89] + acadoWorkspace.evGx[507]*acadoWorkspace.QDy[90] + acadoWorkspace.evGx[513]*acadoWorkspace.QDy[91] + acadoWorkspace.evGx[519]*acadoWorkspace.QDy[92] + acadoWorkspace.evGx[525]*acadoWorkspace.QDy[93] + acadoWorkspace.evGx[531]*acadoWorkspace.QDy[94] + acadoWorkspace.evGx[537]*acadoWorkspace.QDy[95] + acadoWorkspace.evGx[543]*acadoWorkspace.QDy[96] + acadoWorkspace.evGx[549]*acadoWorkspace.QDy[97] + acadoWorkspace.evGx[555]*acadoWorkspace.QDy[98] + acadoWorkspace.evGx[561]*acadoWorkspace.QDy[99] + acadoWorkspace.evGx[567]*acadoWorkspace.QDy[100] + acadoWorkspace.evGx[573]*acadoWorkspace.QDy[101] + acadoWorkspace.evGx[579]*acadoWorkspace.QDy[102] + acadoWorkspace.evGx[585]*acadoWorkspace.QDy[103] + acadoWorkspace.evGx[591]*acadoWorkspace.QDy[104] + acadoWorkspace.evGx[597]*acadoWorkspace.QDy[105] + acadoWorkspace.evGx[603]*acadoWorkspace.QDy[106] + acadoWorkspace.evGx[609]*acadoWorkspace.QDy[107] + acadoWorkspace.evGx[615]*acadoWorkspace.QDy[108] + acadoWorkspace.evGx[621]*acadoWorkspace.QDy[109] + acadoWorkspace.evGx[627]*acadoWorkspace.QDy[110] + acadoWorkspace.evGx[633]*acadoWorkspace.QDy[111] + acadoWorkspace.evGx[639]*acadoWorkspace.QDy[112] + acadoWorkspace.evGx[645]*acadoWorkspace.QDy[113] + acadoWorkspace.evGx[651]*acadoWorkspace.QDy[114] + acadoWorkspace.evGx[657]*acadoWorkspace.QDy[115] + acadoWorkspace.evGx[663]*acadoWorkspace.QDy[116] + acadoWorkspace.evGx[669]*acadoWorkspace.QDy[117] + acadoWorkspace.evGx[675]*acadoWorkspace.QDy[118] + acadoWorkspace.evGx[681]*acadoWorkspace.QDy[119] + acadoWorkspace.evGx[687]*acadoWorkspace.QDy[120] + acadoWorkspace.evGx[693]*acadoWorkspace.QDy[121] + acadoWorkspace.evGx[699]*acadoWorkspace.QDy[122] + acadoWorkspace.evGx[705]*acadoWorkspace.QDy[123] + acadoWorkspace.evGx[711]*acadoWorkspace.QDy[124] + acadoWorkspace.evGx[717]*acadoWorkspace.QDy[125]; -acadoWorkspace.g[4] = + acadoWorkspace.evGx[4]*acadoWorkspace.QDy[6] + acadoWorkspace.evGx[10]*acadoWorkspace.QDy[7] + acadoWorkspace.evGx[16]*acadoWorkspace.QDy[8] + acadoWorkspace.evGx[22]*acadoWorkspace.QDy[9] + acadoWorkspace.evGx[28]*acadoWorkspace.QDy[10] + acadoWorkspace.evGx[34]*acadoWorkspace.QDy[11] + acadoWorkspace.evGx[40]*acadoWorkspace.QDy[12] + acadoWorkspace.evGx[46]*acadoWorkspace.QDy[13] + acadoWorkspace.evGx[52]*acadoWorkspace.QDy[14] + acadoWorkspace.evGx[58]*acadoWorkspace.QDy[15] + acadoWorkspace.evGx[64]*acadoWorkspace.QDy[16] + acadoWorkspace.evGx[70]*acadoWorkspace.QDy[17] + acadoWorkspace.evGx[76]*acadoWorkspace.QDy[18] + acadoWorkspace.evGx[82]*acadoWorkspace.QDy[19] + acadoWorkspace.evGx[88]*acadoWorkspace.QDy[20] + acadoWorkspace.evGx[94]*acadoWorkspace.QDy[21] + acadoWorkspace.evGx[100]*acadoWorkspace.QDy[22] + acadoWorkspace.evGx[106]*acadoWorkspace.QDy[23] + acadoWorkspace.evGx[112]*acadoWorkspace.QDy[24] + acadoWorkspace.evGx[118]*acadoWorkspace.QDy[25] + acadoWorkspace.evGx[124]*acadoWorkspace.QDy[26] + acadoWorkspace.evGx[130]*acadoWorkspace.QDy[27] + acadoWorkspace.evGx[136]*acadoWorkspace.QDy[28] + acadoWorkspace.evGx[142]*acadoWorkspace.QDy[29] + acadoWorkspace.evGx[148]*acadoWorkspace.QDy[30] + acadoWorkspace.evGx[154]*acadoWorkspace.QDy[31] + acadoWorkspace.evGx[160]*acadoWorkspace.QDy[32] + acadoWorkspace.evGx[166]*acadoWorkspace.QDy[33] + acadoWorkspace.evGx[172]*acadoWorkspace.QDy[34] + acadoWorkspace.evGx[178]*acadoWorkspace.QDy[35] + acadoWorkspace.evGx[184]*acadoWorkspace.QDy[36] + acadoWorkspace.evGx[190]*acadoWorkspace.QDy[37] + acadoWorkspace.evGx[196]*acadoWorkspace.QDy[38] + acadoWorkspace.evGx[202]*acadoWorkspace.QDy[39] + acadoWorkspace.evGx[208]*acadoWorkspace.QDy[40] + acadoWorkspace.evGx[214]*acadoWorkspace.QDy[41] + acadoWorkspace.evGx[220]*acadoWorkspace.QDy[42] + acadoWorkspace.evGx[226]*acadoWorkspace.QDy[43] + acadoWorkspace.evGx[232]*acadoWorkspace.QDy[44] + acadoWorkspace.evGx[238]*acadoWorkspace.QDy[45] + acadoWorkspace.evGx[244]*acadoWorkspace.QDy[46] + acadoWorkspace.evGx[250]*acadoWorkspace.QDy[47] + acadoWorkspace.evGx[256]*acadoWorkspace.QDy[48] + acadoWorkspace.evGx[262]*acadoWorkspace.QDy[49] + acadoWorkspace.evGx[268]*acadoWorkspace.QDy[50] + acadoWorkspace.evGx[274]*acadoWorkspace.QDy[51] + acadoWorkspace.evGx[280]*acadoWorkspace.QDy[52] + acadoWorkspace.evGx[286]*acadoWorkspace.QDy[53] + acadoWorkspace.evGx[292]*acadoWorkspace.QDy[54] + acadoWorkspace.evGx[298]*acadoWorkspace.QDy[55] + acadoWorkspace.evGx[304]*acadoWorkspace.QDy[56] + acadoWorkspace.evGx[310]*acadoWorkspace.QDy[57] + acadoWorkspace.evGx[316]*acadoWorkspace.QDy[58] + acadoWorkspace.evGx[322]*acadoWorkspace.QDy[59] + acadoWorkspace.evGx[328]*acadoWorkspace.QDy[60] + acadoWorkspace.evGx[334]*acadoWorkspace.QDy[61] + acadoWorkspace.evGx[340]*acadoWorkspace.QDy[62] + acadoWorkspace.evGx[346]*acadoWorkspace.QDy[63] + acadoWorkspace.evGx[352]*acadoWorkspace.QDy[64] + acadoWorkspace.evGx[358]*acadoWorkspace.QDy[65] + acadoWorkspace.evGx[364]*acadoWorkspace.QDy[66] + acadoWorkspace.evGx[370]*acadoWorkspace.QDy[67] + acadoWorkspace.evGx[376]*acadoWorkspace.QDy[68] + acadoWorkspace.evGx[382]*acadoWorkspace.QDy[69] + acadoWorkspace.evGx[388]*acadoWorkspace.QDy[70] + acadoWorkspace.evGx[394]*acadoWorkspace.QDy[71] + acadoWorkspace.evGx[400]*acadoWorkspace.QDy[72] + acadoWorkspace.evGx[406]*acadoWorkspace.QDy[73] + acadoWorkspace.evGx[412]*acadoWorkspace.QDy[74] + acadoWorkspace.evGx[418]*acadoWorkspace.QDy[75] + acadoWorkspace.evGx[424]*acadoWorkspace.QDy[76] + acadoWorkspace.evGx[430]*acadoWorkspace.QDy[77] + acadoWorkspace.evGx[436]*acadoWorkspace.QDy[78] + acadoWorkspace.evGx[442]*acadoWorkspace.QDy[79] + acadoWorkspace.evGx[448]*acadoWorkspace.QDy[80] + acadoWorkspace.evGx[454]*acadoWorkspace.QDy[81] + acadoWorkspace.evGx[460]*acadoWorkspace.QDy[82] + acadoWorkspace.evGx[466]*acadoWorkspace.QDy[83] + acadoWorkspace.evGx[472]*acadoWorkspace.QDy[84] + acadoWorkspace.evGx[478]*acadoWorkspace.QDy[85] + acadoWorkspace.evGx[484]*acadoWorkspace.QDy[86] + acadoWorkspace.evGx[490]*acadoWorkspace.QDy[87] + acadoWorkspace.evGx[496]*acadoWorkspace.QDy[88] + acadoWorkspace.evGx[502]*acadoWorkspace.QDy[89] + acadoWorkspace.evGx[508]*acadoWorkspace.QDy[90] + acadoWorkspace.evGx[514]*acadoWorkspace.QDy[91] + acadoWorkspace.evGx[520]*acadoWorkspace.QDy[92] + acadoWorkspace.evGx[526]*acadoWorkspace.QDy[93] + acadoWorkspace.evGx[532]*acadoWorkspace.QDy[94] + acadoWorkspace.evGx[538]*acadoWorkspace.QDy[95] + acadoWorkspace.evGx[544]*acadoWorkspace.QDy[96] + acadoWorkspace.evGx[550]*acadoWorkspace.QDy[97] + acadoWorkspace.evGx[556]*acadoWorkspace.QDy[98] + acadoWorkspace.evGx[562]*acadoWorkspace.QDy[99] + acadoWorkspace.evGx[568]*acadoWorkspace.QDy[100] + acadoWorkspace.evGx[574]*acadoWorkspace.QDy[101] + acadoWorkspace.evGx[580]*acadoWorkspace.QDy[102] + acadoWorkspace.evGx[586]*acadoWorkspace.QDy[103] + acadoWorkspace.evGx[592]*acadoWorkspace.QDy[104] + acadoWorkspace.evGx[598]*acadoWorkspace.QDy[105] + acadoWorkspace.evGx[604]*acadoWorkspace.QDy[106] + acadoWorkspace.evGx[610]*acadoWorkspace.QDy[107] + acadoWorkspace.evGx[616]*acadoWorkspace.QDy[108] + acadoWorkspace.evGx[622]*acadoWorkspace.QDy[109] + acadoWorkspace.evGx[628]*acadoWorkspace.QDy[110] + acadoWorkspace.evGx[634]*acadoWorkspace.QDy[111] + acadoWorkspace.evGx[640]*acadoWorkspace.QDy[112] + acadoWorkspace.evGx[646]*acadoWorkspace.QDy[113] + acadoWorkspace.evGx[652]*acadoWorkspace.QDy[114] + acadoWorkspace.evGx[658]*acadoWorkspace.QDy[115] + acadoWorkspace.evGx[664]*acadoWorkspace.QDy[116] + acadoWorkspace.evGx[670]*acadoWorkspace.QDy[117] + acadoWorkspace.evGx[676]*acadoWorkspace.QDy[118] + acadoWorkspace.evGx[682]*acadoWorkspace.QDy[119] + acadoWorkspace.evGx[688]*acadoWorkspace.QDy[120] + acadoWorkspace.evGx[694]*acadoWorkspace.QDy[121] + acadoWorkspace.evGx[700]*acadoWorkspace.QDy[122] + acadoWorkspace.evGx[706]*acadoWorkspace.QDy[123] + acadoWorkspace.evGx[712]*acadoWorkspace.QDy[124] + acadoWorkspace.evGx[718]*acadoWorkspace.QDy[125]; -acadoWorkspace.g[5] = + acadoWorkspace.evGx[5]*acadoWorkspace.QDy[6] + acadoWorkspace.evGx[11]*acadoWorkspace.QDy[7] + acadoWorkspace.evGx[17]*acadoWorkspace.QDy[8] + acadoWorkspace.evGx[23]*acadoWorkspace.QDy[9] + acadoWorkspace.evGx[29]*acadoWorkspace.QDy[10] + acadoWorkspace.evGx[35]*acadoWorkspace.QDy[11] + acadoWorkspace.evGx[41]*acadoWorkspace.QDy[12] + acadoWorkspace.evGx[47]*acadoWorkspace.QDy[13] + acadoWorkspace.evGx[53]*acadoWorkspace.QDy[14] + acadoWorkspace.evGx[59]*acadoWorkspace.QDy[15] + acadoWorkspace.evGx[65]*acadoWorkspace.QDy[16] + acadoWorkspace.evGx[71]*acadoWorkspace.QDy[17] + acadoWorkspace.evGx[77]*acadoWorkspace.QDy[18] + acadoWorkspace.evGx[83]*acadoWorkspace.QDy[19] + acadoWorkspace.evGx[89]*acadoWorkspace.QDy[20] + acadoWorkspace.evGx[95]*acadoWorkspace.QDy[21] + acadoWorkspace.evGx[101]*acadoWorkspace.QDy[22] + acadoWorkspace.evGx[107]*acadoWorkspace.QDy[23] + acadoWorkspace.evGx[113]*acadoWorkspace.QDy[24] + acadoWorkspace.evGx[119]*acadoWorkspace.QDy[25] + acadoWorkspace.evGx[125]*acadoWorkspace.QDy[26] + acadoWorkspace.evGx[131]*acadoWorkspace.QDy[27] + acadoWorkspace.evGx[137]*acadoWorkspace.QDy[28] + acadoWorkspace.evGx[143]*acadoWorkspace.QDy[29] + acadoWorkspace.evGx[149]*acadoWorkspace.QDy[30] + acadoWorkspace.evGx[155]*acadoWorkspace.QDy[31] + acadoWorkspace.evGx[161]*acadoWorkspace.QDy[32] + acadoWorkspace.evGx[167]*acadoWorkspace.QDy[33] + acadoWorkspace.evGx[173]*acadoWorkspace.QDy[34] + acadoWorkspace.evGx[179]*acadoWorkspace.QDy[35] + acadoWorkspace.evGx[185]*acadoWorkspace.QDy[36] + acadoWorkspace.evGx[191]*acadoWorkspace.QDy[37] + acadoWorkspace.evGx[197]*acadoWorkspace.QDy[38] + acadoWorkspace.evGx[203]*acadoWorkspace.QDy[39] + acadoWorkspace.evGx[209]*acadoWorkspace.QDy[40] + acadoWorkspace.evGx[215]*acadoWorkspace.QDy[41] + acadoWorkspace.evGx[221]*acadoWorkspace.QDy[42] + acadoWorkspace.evGx[227]*acadoWorkspace.QDy[43] + acadoWorkspace.evGx[233]*acadoWorkspace.QDy[44] + acadoWorkspace.evGx[239]*acadoWorkspace.QDy[45] + acadoWorkspace.evGx[245]*acadoWorkspace.QDy[46] + acadoWorkspace.evGx[251]*acadoWorkspace.QDy[47] + acadoWorkspace.evGx[257]*acadoWorkspace.QDy[48] + acadoWorkspace.evGx[263]*acadoWorkspace.QDy[49] + acadoWorkspace.evGx[269]*acadoWorkspace.QDy[50] + acadoWorkspace.evGx[275]*acadoWorkspace.QDy[51] + acadoWorkspace.evGx[281]*acadoWorkspace.QDy[52] + acadoWorkspace.evGx[287]*acadoWorkspace.QDy[53] + acadoWorkspace.evGx[293]*acadoWorkspace.QDy[54] + acadoWorkspace.evGx[299]*acadoWorkspace.QDy[55] + acadoWorkspace.evGx[305]*acadoWorkspace.QDy[56] + acadoWorkspace.evGx[311]*acadoWorkspace.QDy[57] + acadoWorkspace.evGx[317]*acadoWorkspace.QDy[58] + acadoWorkspace.evGx[323]*acadoWorkspace.QDy[59] + acadoWorkspace.evGx[329]*acadoWorkspace.QDy[60] + acadoWorkspace.evGx[335]*acadoWorkspace.QDy[61] + acadoWorkspace.evGx[341]*acadoWorkspace.QDy[62] + acadoWorkspace.evGx[347]*acadoWorkspace.QDy[63] + acadoWorkspace.evGx[353]*acadoWorkspace.QDy[64] + acadoWorkspace.evGx[359]*acadoWorkspace.QDy[65] + acadoWorkspace.evGx[365]*acadoWorkspace.QDy[66] + acadoWorkspace.evGx[371]*acadoWorkspace.QDy[67] + acadoWorkspace.evGx[377]*acadoWorkspace.QDy[68] + acadoWorkspace.evGx[383]*acadoWorkspace.QDy[69] + acadoWorkspace.evGx[389]*acadoWorkspace.QDy[70] + acadoWorkspace.evGx[395]*acadoWorkspace.QDy[71] + acadoWorkspace.evGx[401]*acadoWorkspace.QDy[72] + acadoWorkspace.evGx[407]*acadoWorkspace.QDy[73] + acadoWorkspace.evGx[413]*acadoWorkspace.QDy[74] + acadoWorkspace.evGx[419]*acadoWorkspace.QDy[75] + acadoWorkspace.evGx[425]*acadoWorkspace.QDy[76] + acadoWorkspace.evGx[431]*acadoWorkspace.QDy[77] + acadoWorkspace.evGx[437]*acadoWorkspace.QDy[78] + acadoWorkspace.evGx[443]*acadoWorkspace.QDy[79] + acadoWorkspace.evGx[449]*acadoWorkspace.QDy[80] + acadoWorkspace.evGx[455]*acadoWorkspace.QDy[81] + acadoWorkspace.evGx[461]*acadoWorkspace.QDy[82] + acadoWorkspace.evGx[467]*acadoWorkspace.QDy[83] + acadoWorkspace.evGx[473]*acadoWorkspace.QDy[84] + acadoWorkspace.evGx[479]*acadoWorkspace.QDy[85] + acadoWorkspace.evGx[485]*acadoWorkspace.QDy[86] + acadoWorkspace.evGx[491]*acadoWorkspace.QDy[87] + acadoWorkspace.evGx[497]*acadoWorkspace.QDy[88] + acadoWorkspace.evGx[503]*acadoWorkspace.QDy[89] + acadoWorkspace.evGx[509]*acadoWorkspace.QDy[90] + acadoWorkspace.evGx[515]*acadoWorkspace.QDy[91] + acadoWorkspace.evGx[521]*acadoWorkspace.QDy[92] + acadoWorkspace.evGx[527]*acadoWorkspace.QDy[93] + acadoWorkspace.evGx[533]*acadoWorkspace.QDy[94] + acadoWorkspace.evGx[539]*acadoWorkspace.QDy[95] + acadoWorkspace.evGx[545]*acadoWorkspace.QDy[96] + acadoWorkspace.evGx[551]*acadoWorkspace.QDy[97] + acadoWorkspace.evGx[557]*acadoWorkspace.QDy[98] + acadoWorkspace.evGx[563]*acadoWorkspace.QDy[99] + acadoWorkspace.evGx[569]*acadoWorkspace.QDy[100] + acadoWorkspace.evGx[575]*acadoWorkspace.QDy[101] + acadoWorkspace.evGx[581]*acadoWorkspace.QDy[102] + acadoWorkspace.evGx[587]*acadoWorkspace.QDy[103] + acadoWorkspace.evGx[593]*acadoWorkspace.QDy[104] + acadoWorkspace.evGx[599]*acadoWorkspace.QDy[105] + acadoWorkspace.evGx[605]*acadoWorkspace.QDy[106] + acadoWorkspace.evGx[611]*acadoWorkspace.QDy[107] + acadoWorkspace.evGx[617]*acadoWorkspace.QDy[108] + acadoWorkspace.evGx[623]*acadoWorkspace.QDy[109] + acadoWorkspace.evGx[629]*acadoWorkspace.QDy[110] + acadoWorkspace.evGx[635]*acadoWorkspace.QDy[111] + acadoWorkspace.evGx[641]*acadoWorkspace.QDy[112] + acadoWorkspace.evGx[647]*acadoWorkspace.QDy[113] + acadoWorkspace.evGx[653]*acadoWorkspace.QDy[114] + acadoWorkspace.evGx[659]*acadoWorkspace.QDy[115] + acadoWorkspace.evGx[665]*acadoWorkspace.QDy[116] + acadoWorkspace.evGx[671]*acadoWorkspace.QDy[117] + acadoWorkspace.evGx[677]*acadoWorkspace.QDy[118] + acadoWorkspace.evGx[683]*acadoWorkspace.QDy[119] + acadoWorkspace.evGx[689]*acadoWorkspace.QDy[120] + acadoWorkspace.evGx[695]*acadoWorkspace.QDy[121] + acadoWorkspace.evGx[701]*acadoWorkspace.QDy[122] + acadoWorkspace.evGx[707]*acadoWorkspace.QDy[123] + acadoWorkspace.evGx[713]*acadoWorkspace.QDy[124] + acadoWorkspace.evGx[719]*acadoWorkspace.QDy[125]; - - -acado_multEQDy( acadoWorkspace.E, &(acadoWorkspace.QDy[ 6 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.QDy[ 12 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.QDy[ 18 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 6 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.QDy[ 12 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.QDy[ 18 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 7 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.QDy[ 18 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 8 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.QDy[ 24 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 9 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.QDy[ 30 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 10 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.QDy[ 36 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 11 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.QDy[ 42 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 12 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.QDy[ 48 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 13 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.QDy[ 54 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 14 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.QDy[ 60 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 15 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.QDy[ 66 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 690 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 16 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.QDy[ 72 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 696 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 786 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 17 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.QDy[ 78 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 702 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 792 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 888 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 18 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.QDy[ 84 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 708 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 798 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 894 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 996 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 19 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 714 ]), &(acadoWorkspace.QDy[ 90 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 804 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 900 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1002 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1110 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1224 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 20 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 810 ]), &(acadoWorkspace.QDy[ 96 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 906 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1008 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1116 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1230 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 21 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 912 ]), &(acadoWorkspace.QDy[ 102 ]), &(acadoWorkspace.g[ 22 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1014 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 22 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1122 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 22 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1236 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 22 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1020 ]), &(acadoWorkspace.QDy[ 108 ]), &(acadoWorkspace.g[ 23 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1128 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 23 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1242 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 23 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1134 ]), &(acadoWorkspace.QDy[ 114 ]), &(acadoWorkspace.g[ 24 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1248 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 24 ]) ); -acado_multEQDy( &(acadoWorkspace.E[ 1254 ]), &(acadoWorkspace.QDy[ 120 ]), &(acadoWorkspace.g[ 25 ]) ); - -acadoWorkspace.lb[0] = acadoWorkspace.Dx0[0]; -acadoWorkspace.lb[1] = acadoWorkspace.Dx0[1]; -acadoWorkspace.lb[2] = acadoWorkspace.Dx0[2]; -acadoWorkspace.lb[3] = acadoWorkspace.Dx0[3]; -acadoWorkspace.lb[4] = acadoWorkspace.Dx0[4]; -acadoWorkspace.lb[5] = acadoWorkspace.Dx0[5]; -acadoWorkspace.ub[0] = acadoWorkspace.Dx0[0]; -acadoWorkspace.ub[1] = acadoWorkspace.Dx0[1]; -acadoWorkspace.ub[2] = acadoWorkspace.Dx0[2]; -acadoWorkspace.ub[3] = acadoWorkspace.Dx0[3]; -acadoWorkspace.ub[4] = acadoWorkspace.Dx0[4]; -acadoWorkspace.ub[5] = acadoWorkspace.Dx0[5]; -tmp = acadoVariables.x[7] + acadoWorkspace.d[1]; -acadoWorkspace.lbA[0] = - tmp; -acadoWorkspace.ubA[0] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[13] + acadoWorkspace.d[7]; -acadoWorkspace.lbA[1] = - tmp; -acadoWorkspace.ubA[1] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[19] + acadoWorkspace.d[13]; -acadoWorkspace.lbA[2] = - tmp; -acadoWorkspace.ubA[2] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[25] + acadoWorkspace.d[19]; -acadoWorkspace.lbA[3] = - tmp; -acadoWorkspace.ubA[3] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[31] + acadoWorkspace.d[25]; -acadoWorkspace.lbA[4] = - tmp; -acadoWorkspace.ubA[4] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[37] + acadoWorkspace.d[31]; -acadoWorkspace.lbA[5] = - tmp; -acadoWorkspace.ubA[5] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[43] + acadoWorkspace.d[37]; -acadoWorkspace.lbA[6] = - tmp; -acadoWorkspace.ubA[6] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[49] + acadoWorkspace.d[43]; -acadoWorkspace.lbA[7] = - tmp; -acadoWorkspace.ubA[7] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[55] + acadoWorkspace.d[49]; -acadoWorkspace.lbA[8] = - tmp; -acadoWorkspace.ubA[8] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[61] + acadoWorkspace.d[55]; -acadoWorkspace.lbA[9] = - tmp; -acadoWorkspace.ubA[9] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[67] + acadoWorkspace.d[61]; -acadoWorkspace.lbA[10] = - tmp; -acadoWorkspace.ubA[10] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[73] + acadoWorkspace.d[67]; -acadoWorkspace.lbA[11] = - tmp; -acadoWorkspace.ubA[11] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[79] + acadoWorkspace.d[73]; -acadoWorkspace.lbA[12] = - tmp; -acadoWorkspace.ubA[12] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[85] + acadoWorkspace.d[79]; -acadoWorkspace.lbA[13] = - tmp; -acadoWorkspace.ubA[13] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[91] + acadoWorkspace.d[85]; -acadoWorkspace.lbA[14] = - tmp; -acadoWorkspace.ubA[14] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[97] + acadoWorkspace.d[91]; -acadoWorkspace.lbA[15] = - tmp; -acadoWorkspace.ubA[15] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[103] + acadoWorkspace.d[97]; -acadoWorkspace.lbA[16] = - tmp; -acadoWorkspace.ubA[16] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[109] + acadoWorkspace.d[103]; -acadoWorkspace.lbA[17] = - tmp; -acadoWorkspace.ubA[17] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[115] + acadoWorkspace.d[109]; -acadoWorkspace.lbA[18] = - tmp; -acadoWorkspace.ubA[18] = (real_t)1.0000000000000000e+12 - tmp; -tmp = acadoVariables.x[121] + acadoWorkspace.d[115]; -acadoWorkspace.lbA[19] = - tmp; -acadoWorkspace.ubA[19] = (real_t)1.0000000000000000e+12 - tmp; - -} - -void acado_expand( ) -{ -acadoVariables.x[0] += acadoWorkspace.x[0]; -acadoVariables.x[1] += acadoWorkspace.x[1]; -acadoVariables.x[2] += acadoWorkspace.x[2]; -acadoVariables.x[3] += acadoWorkspace.x[3]; -acadoVariables.x[4] += acadoWorkspace.x[4]; -acadoVariables.x[5] += acadoWorkspace.x[5]; - -acadoVariables.u[0] += acadoWorkspace.x[6]; -acadoVariables.u[1] += acadoWorkspace.x[7]; -acadoVariables.u[2] += acadoWorkspace.x[8]; -acadoVariables.u[3] += acadoWorkspace.x[9]; -acadoVariables.u[4] += acadoWorkspace.x[10]; -acadoVariables.u[5] += acadoWorkspace.x[11]; -acadoVariables.u[6] += acadoWorkspace.x[12]; -acadoVariables.u[7] += acadoWorkspace.x[13]; -acadoVariables.u[8] += acadoWorkspace.x[14]; -acadoVariables.u[9] += acadoWorkspace.x[15]; -acadoVariables.u[10] += acadoWorkspace.x[16]; -acadoVariables.u[11] += acadoWorkspace.x[17]; -acadoVariables.u[12] += acadoWorkspace.x[18]; -acadoVariables.u[13] += acadoWorkspace.x[19]; -acadoVariables.u[14] += acadoWorkspace.x[20]; -acadoVariables.u[15] += acadoWorkspace.x[21]; -acadoVariables.u[16] += acadoWorkspace.x[22]; -acadoVariables.u[17] += acadoWorkspace.x[23]; -acadoVariables.u[18] += acadoWorkspace.x[24]; -acadoVariables.u[19] += acadoWorkspace.x[25]; - -acadoVariables.x[6] += + acadoWorkspace.evGx[0]*acadoWorkspace.x[0] + acadoWorkspace.evGx[1]*acadoWorkspace.x[1] + acadoWorkspace.evGx[2]*acadoWorkspace.x[2] + acadoWorkspace.evGx[3]*acadoWorkspace.x[3] + acadoWorkspace.evGx[4]*acadoWorkspace.x[4] + acadoWorkspace.evGx[5]*acadoWorkspace.x[5] + acadoWorkspace.d[0]; -acadoVariables.x[7] += + acadoWorkspace.evGx[6]*acadoWorkspace.x[0] + acadoWorkspace.evGx[7]*acadoWorkspace.x[1] + acadoWorkspace.evGx[8]*acadoWorkspace.x[2] + acadoWorkspace.evGx[9]*acadoWorkspace.x[3] + acadoWorkspace.evGx[10]*acadoWorkspace.x[4] + acadoWorkspace.evGx[11]*acadoWorkspace.x[5] + acadoWorkspace.d[1]; -acadoVariables.x[8] += + acadoWorkspace.evGx[12]*acadoWorkspace.x[0] + acadoWorkspace.evGx[13]*acadoWorkspace.x[1] + acadoWorkspace.evGx[14]*acadoWorkspace.x[2] + acadoWorkspace.evGx[15]*acadoWorkspace.x[3] + acadoWorkspace.evGx[16]*acadoWorkspace.x[4] + acadoWorkspace.evGx[17]*acadoWorkspace.x[5] + acadoWorkspace.d[2]; -acadoVariables.x[9] += + acadoWorkspace.evGx[18]*acadoWorkspace.x[0] + acadoWorkspace.evGx[19]*acadoWorkspace.x[1] + acadoWorkspace.evGx[20]*acadoWorkspace.x[2] + acadoWorkspace.evGx[21]*acadoWorkspace.x[3] + acadoWorkspace.evGx[22]*acadoWorkspace.x[4] + acadoWorkspace.evGx[23]*acadoWorkspace.x[5] + acadoWorkspace.d[3]; -acadoVariables.x[10] += + acadoWorkspace.evGx[24]*acadoWorkspace.x[0] + acadoWorkspace.evGx[25]*acadoWorkspace.x[1] + acadoWorkspace.evGx[26]*acadoWorkspace.x[2] + acadoWorkspace.evGx[27]*acadoWorkspace.x[3] + acadoWorkspace.evGx[28]*acadoWorkspace.x[4] + acadoWorkspace.evGx[29]*acadoWorkspace.x[5] + acadoWorkspace.d[4]; -acadoVariables.x[11] += + acadoWorkspace.evGx[30]*acadoWorkspace.x[0] + acadoWorkspace.evGx[31]*acadoWorkspace.x[1] + acadoWorkspace.evGx[32]*acadoWorkspace.x[2] + acadoWorkspace.evGx[33]*acadoWorkspace.x[3] + acadoWorkspace.evGx[34]*acadoWorkspace.x[4] + acadoWorkspace.evGx[35]*acadoWorkspace.x[5] + acadoWorkspace.d[5]; -acadoVariables.x[12] += + acadoWorkspace.evGx[36]*acadoWorkspace.x[0] + acadoWorkspace.evGx[37]*acadoWorkspace.x[1] + acadoWorkspace.evGx[38]*acadoWorkspace.x[2] + acadoWorkspace.evGx[39]*acadoWorkspace.x[3] + acadoWorkspace.evGx[40]*acadoWorkspace.x[4] + acadoWorkspace.evGx[41]*acadoWorkspace.x[5] + acadoWorkspace.d[6]; -acadoVariables.x[13] += + acadoWorkspace.evGx[42]*acadoWorkspace.x[0] + acadoWorkspace.evGx[43]*acadoWorkspace.x[1] + acadoWorkspace.evGx[44]*acadoWorkspace.x[2] + acadoWorkspace.evGx[45]*acadoWorkspace.x[3] + acadoWorkspace.evGx[46]*acadoWorkspace.x[4] + acadoWorkspace.evGx[47]*acadoWorkspace.x[5] + acadoWorkspace.d[7]; -acadoVariables.x[14] += + acadoWorkspace.evGx[48]*acadoWorkspace.x[0] + acadoWorkspace.evGx[49]*acadoWorkspace.x[1] + acadoWorkspace.evGx[50]*acadoWorkspace.x[2] + acadoWorkspace.evGx[51]*acadoWorkspace.x[3] + acadoWorkspace.evGx[52]*acadoWorkspace.x[4] + acadoWorkspace.evGx[53]*acadoWorkspace.x[5] + acadoWorkspace.d[8]; -acadoVariables.x[15] += + acadoWorkspace.evGx[54]*acadoWorkspace.x[0] + acadoWorkspace.evGx[55]*acadoWorkspace.x[1] + acadoWorkspace.evGx[56]*acadoWorkspace.x[2] + acadoWorkspace.evGx[57]*acadoWorkspace.x[3] + acadoWorkspace.evGx[58]*acadoWorkspace.x[4] + acadoWorkspace.evGx[59]*acadoWorkspace.x[5] + acadoWorkspace.d[9]; -acadoVariables.x[16] += + acadoWorkspace.evGx[60]*acadoWorkspace.x[0] + acadoWorkspace.evGx[61]*acadoWorkspace.x[1] + acadoWorkspace.evGx[62]*acadoWorkspace.x[2] + acadoWorkspace.evGx[63]*acadoWorkspace.x[3] + acadoWorkspace.evGx[64]*acadoWorkspace.x[4] + acadoWorkspace.evGx[65]*acadoWorkspace.x[5] + acadoWorkspace.d[10]; -acadoVariables.x[17] += + acadoWorkspace.evGx[66]*acadoWorkspace.x[0] + acadoWorkspace.evGx[67]*acadoWorkspace.x[1] + acadoWorkspace.evGx[68]*acadoWorkspace.x[2] + acadoWorkspace.evGx[69]*acadoWorkspace.x[3] + acadoWorkspace.evGx[70]*acadoWorkspace.x[4] + acadoWorkspace.evGx[71]*acadoWorkspace.x[5] + acadoWorkspace.d[11]; -acadoVariables.x[18] += + acadoWorkspace.evGx[72]*acadoWorkspace.x[0] + acadoWorkspace.evGx[73]*acadoWorkspace.x[1] + acadoWorkspace.evGx[74]*acadoWorkspace.x[2] + acadoWorkspace.evGx[75]*acadoWorkspace.x[3] + acadoWorkspace.evGx[76]*acadoWorkspace.x[4] + acadoWorkspace.evGx[77]*acadoWorkspace.x[5] + acadoWorkspace.d[12]; -acadoVariables.x[19] += + acadoWorkspace.evGx[78]*acadoWorkspace.x[0] + acadoWorkspace.evGx[79]*acadoWorkspace.x[1] + acadoWorkspace.evGx[80]*acadoWorkspace.x[2] + acadoWorkspace.evGx[81]*acadoWorkspace.x[3] + acadoWorkspace.evGx[82]*acadoWorkspace.x[4] + acadoWorkspace.evGx[83]*acadoWorkspace.x[5] + acadoWorkspace.d[13]; -acadoVariables.x[20] += + acadoWorkspace.evGx[84]*acadoWorkspace.x[0] + acadoWorkspace.evGx[85]*acadoWorkspace.x[1] + acadoWorkspace.evGx[86]*acadoWorkspace.x[2] + acadoWorkspace.evGx[87]*acadoWorkspace.x[3] + acadoWorkspace.evGx[88]*acadoWorkspace.x[4] + acadoWorkspace.evGx[89]*acadoWorkspace.x[5] + acadoWorkspace.d[14]; -acadoVariables.x[21] += + acadoWorkspace.evGx[90]*acadoWorkspace.x[0] + acadoWorkspace.evGx[91]*acadoWorkspace.x[1] + acadoWorkspace.evGx[92]*acadoWorkspace.x[2] + acadoWorkspace.evGx[93]*acadoWorkspace.x[3] + acadoWorkspace.evGx[94]*acadoWorkspace.x[4] + acadoWorkspace.evGx[95]*acadoWorkspace.x[5] + acadoWorkspace.d[15]; -acadoVariables.x[22] += + acadoWorkspace.evGx[96]*acadoWorkspace.x[0] + acadoWorkspace.evGx[97]*acadoWorkspace.x[1] + acadoWorkspace.evGx[98]*acadoWorkspace.x[2] + acadoWorkspace.evGx[99]*acadoWorkspace.x[3] + acadoWorkspace.evGx[100]*acadoWorkspace.x[4] + acadoWorkspace.evGx[101]*acadoWorkspace.x[5] + acadoWorkspace.d[16]; -acadoVariables.x[23] += + acadoWorkspace.evGx[102]*acadoWorkspace.x[0] + acadoWorkspace.evGx[103]*acadoWorkspace.x[1] + acadoWorkspace.evGx[104]*acadoWorkspace.x[2] + acadoWorkspace.evGx[105]*acadoWorkspace.x[3] + acadoWorkspace.evGx[106]*acadoWorkspace.x[4] + acadoWorkspace.evGx[107]*acadoWorkspace.x[5] + acadoWorkspace.d[17]; -acadoVariables.x[24] += + acadoWorkspace.evGx[108]*acadoWorkspace.x[0] + acadoWorkspace.evGx[109]*acadoWorkspace.x[1] + acadoWorkspace.evGx[110]*acadoWorkspace.x[2] + acadoWorkspace.evGx[111]*acadoWorkspace.x[3] + acadoWorkspace.evGx[112]*acadoWorkspace.x[4] + acadoWorkspace.evGx[113]*acadoWorkspace.x[5] + acadoWorkspace.d[18]; -acadoVariables.x[25] += + acadoWorkspace.evGx[114]*acadoWorkspace.x[0] + acadoWorkspace.evGx[115]*acadoWorkspace.x[1] + acadoWorkspace.evGx[116]*acadoWorkspace.x[2] + acadoWorkspace.evGx[117]*acadoWorkspace.x[3] + acadoWorkspace.evGx[118]*acadoWorkspace.x[4] + acadoWorkspace.evGx[119]*acadoWorkspace.x[5] + acadoWorkspace.d[19]; -acadoVariables.x[26] += + acadoWorkspace.evGx[120]*acadoWorkspace.x[0] + acadoWorkspace.evGx[121]*acadoWorkspace.x[1] + acadoWorkspace.evGx[122]*acadoWorkspace.x[2] + acadoWorkspace.evGx[123]*acadoWorkspace.x[3] + acadoWorkspace.evGx[124]*acadoWorkspace.x[4] + acadoWorkspace.evGx[125]*acadoWorkspace.x[5] + acadoWorkspace.d[20]; -acadoVariables.x[27] += + acadoWorkspace.evGx[126]*acadoWorkspace.x[0] + acadoWorkspace.evGx[127]*acadoWorkspace.x[1] + acadoWorkspace.evGx[128]*acadoWorkspace.x[2] + acadoWorkspace.evGx[129]*acadoWorkspace.x[3] + acadoWorkspace.evGx[130]*acadoWorkspace.x[4] + acadoWorkspace.evGx[131]*acadoWorkspace.x[5] + acadoWorkspace.d[21]; -acadoVariables.x[28] += + acadoWorkspace.evGx[132]*acadoWorkspace.x[0] + acadoWorkspace.evGx[133]*acadoWorkspace.x[1] + acadoWorkspace.evGx[134]*acadoWorkspace.x[2] + acadoWorkspace.evGx[135]*acadoWorkspace.x[3] + acadoWorkspace.evGx[136]*acadoWorkspace.x[4] + acadoWorkspace.evGx[137]*acadoWorkspace.x[5] + acadoWorkspace.d[22]; -acadoVariables.x[29] += + acadoWorkspace.evGx[138]*acadoWorkspace.x[0] + acadoWorkspace.evGx[139]*acadoWorkspace.x[1] + acadoWorkspace.evGx[140]*acadoWorkspace.x[2] + acadoWorkspace.evGx[141]*acadoWorkspace.x[3] + acadoWorkspace.evGx[142]*acadoWorkspace.x[4] + acadoWorkspace.evGx[143]*acadoWorkspace.x[5] + acadoWorkspace.d[23]; -acadoVariables.x[30] += + acadoWorkspace.evGx[144]*acadoWorkspace.x[0] + acadoWorkspace.evGx[145]*acadoWorkspace.x[1] + acadoWorkspace.evGx[146]*acadoWorkspace.x[2] + acadoWorkspace.evGx[147]*acadoWorkspace.x[3] + acadoWorkspace.evGx[148]*acadoWorkspace.x[4] + acadoWorkspace.evGx[149]*acadoWorkspace.x[5] + acadoWorkspace.d[24]; -acadoVariables.x[31] += + acadoWorkspace.evGx[150]*acadoWorkspace.x[0] + acadoWorkspace.evGx[151]*acadoWorkspace.x[1] + acadoWorkspace.evGx[152]*acadoWorkspace.x[2] + acadoWorkspace.evGx[153]*acadoWorkspace.x[3] + acadoWorkspace.evGx[154]*acadoWorkspace.x[4] + acadoWorkspace.evGx[155]*acadoWorkspace.x[5] + acadoWorkspace.d[25]; -acadoVariables.x[32] += + acadoWorkspace.evGx[156]*acadoWorkspace.x[0] + acadoWorkspace.evGx[157]*acadoWorkspace.x[1] + acadoWorkspace.evGx[158]*acadoWorkspace.x[2] + acadoWorkspace.evGx[159]*acadoWorkspace.x[3] + acadoWorkspace.evGx[160]*acadoWorkspace.x[4] + acadoWorkspace.evGx[161]*acadoWorkspace.x[5] + acadoWorkspace.d[26]; -acadoVariables.x[33] += + acadoWorkspace.evGx[162]*acadoWorkspace.x[0] + acadoWorkspace.evGx[163]*acadoWorkspace.x[1] + acadoWorkspace.evGx[164]*acadoWorkspace.x[2] + acadoWorkspace.evGx[165]*acadoWorkspace.x[3] + acadoWorkspace.evGx[166]*acadoWorkspace.x[4] + acadoWorkspace.evGx[167]*acadoWorkspace.x[5] + acadoWorkspace.d[27]; -acadoVariables.x[34] += + acadoWorkspace.evGx[168]*acadoWorkspace.x[0] + acadoWorkspace.evGx[169]*acadoWorkspace.x[1] + acadoWorkspace.evGx[170]*acadoWorkspace.x[2] + acadoWorkspace.evGx[171]*acadoWorkspace.x[3] + acadoWorkspace.evGx[172]*acadoWorkspace.x[4] + acadoWorkspace.evGx[173]*acadoWorkspace.x[5] + acadoWorkspace.d[28]; -acadoVariables.x[35] += + acadoWorkspace.evGx[174]*acadoWorkspace.x[0] + acadoWorkspace.evGx[175]*acadoWorkspace.x[1] + acadoWorkspace.evGx[176]*acadoWorkspace.x[2] + acadoWorkspace.evGx[177]*acadoWorkspace.x[3] + acadoWorkspace.evGx[178]*acadoWorkspace.x[4] + acadoWorkspace.evGx[179]*acadoWorkspace.x[5] + acadoWorkspace.d[29]; -acadoVariables.x[36] += + acadoWorkspace.evGx[180]*acadoWorkspace.x[0] + acadoWorkspace.evGx[181]*acadoWorkspace.x[1] + acadoWorkspace.evGx[182]*acadoWorkspace.x[2] + acadoWorkspace.evGx[183]*acadoWorkspace.x[3] + acadoWorkspace.evGx[184]*acadoWorkspace.x[4] + acadoWorkspace.evGx[185]*acadoWorkspace.x[5] + acadoWorkspace.d[30]; -acadoVariables.x[37] += + acadoWorkspace.evGx[186]*acadoWorkspace.x[0] + acadoWorkspace.evGx[187]*acadoWorkspace.x[1] + acadoWorkspace.evGx[188]*acadoWorkspace.x[2] + acadoWorkspace.evGx[189]*acadoWorkspace.x[3] + acadoWorkspace.evGx[190]*acadoWorkspace.x[4] + acadoWorkspace.evGx[191]*acadoWorkspace.x[5] + acadoWorkspace.d[31]; -acadoVariables.x[38] += + acadoWorkspace.evGx[192]*acadoWorkspace.x[0] + acadoWorkspace.evGx[193]*acadoWorkspace.x[1] + acadoWorkspace.evGx[194]*acadoWorkspace.x[2] + acadoWorkspace.evGx[195]*acadoWorkspace.x[3] + acadoWorkspace.evGx[196]*acadoWorkspace.x[4] + acadoWorkspace.evGx[197]*acadoWorkspace.x[5] + acadoWorkspace.d[32]; -acadoVariables.x[39] += + acadoWorkspace.evGx[198]*acadoWorkspace.x[0] + acadoWorkspace.evGx[199]*acadoWorkspace.x[1] + acadoWorkspace.evGx[200]*acadoWorkspace.x[2] + acadoWorkspace.evGx[201]*acadoWorkspace.x[3] + acadoWorkspace.evGx[202]*acadoWorkspace.x[4] + acadoWorkspace.evGx[203]*acadoWorkspace.x[5] + acadoWorkspace.d[33]; -acadoVariables.x[40] += + acadoWorkspace.evGx[204]*acadoWorkspace.x[0] + acadoWorkspace.evGx[205]*acadoWorkspace.x[1] + acadoWorkspace.evGx[206]*acadoWorkspace.x[2] + acadoWorkspace.evGx[207]*acadoWorkspace.x[3] + acadoWorkspace.evGx[208]*acadoWorkspace.x[4] + acadoWorkspace.evGx[209]*acadoWorkspace.x[5] + acadoWorkspace.d[34]; -acadoVariables.x[41] += + acadoWorkspace.evGx[210]*acadoWorkspace.x[0] + acadoWorkspace.evGx[211]*acadoWorkspace.x[1] + acadoWorkspace.evGx[212]*acadoWorkspace.x[2] + acadoWorkspace.evGx[213]*acadoWorkspace.x[3] + acadoWorkspace.evGx[214]*acadoWorkspace.x[4] + acadoWorkspace.evGx[215]*acadoWorkspace.x[5] + acadoWorkspace.d[35]; -acadoVariables.x[42] += + acadoWorkspace.evGx[216]*acadoWorkspace.x[0] + acadoWorkspace.evGx[217]*acadoWorkspace.x[1] + acadoWorkspace.evGx[218]*acadoWorkspace.x[2] + acadoWorkspace.evGx[219]*acadoWorkspace.x[3] + acadoWorkspace.evGx[220]*acadoWorkspace.x[4] + acadoWorkspace.evGx[221]*acadoWorkspace.x[5] + acadoWorkspace.d[36]; -acadoVariables.x[43] += + acadoWorkspace.evGx[222]*acadoWorkspace.x[0] + acadoWorkspace.evGx[223]*acadoWorkspace.x[1] + acadoWorkspace.evGx[224]*acadoWorkspace.x[2] + acadoWorkspace.evGx[225]*acadoWorkspace.x[3] + acadoWorkspace.evGx[226]*acadoWorkspace.x[4] + acadoWorkspace.evGx[227]*acadoWorkspace.x[5] + acadoWorkspace.d[37]; -acadoVariables.x[44] += + acadoWorkspace.evGx[228]*acadoWorkspace.x[0] + acadoWorkspace.evGx[229]*acadoWorkspace.x[1] + acadoWorkspace.evGx[230]*acadoWorkspace.x[2] + acadoWorkspace.evGx[231]*acadoWorkspace.x[3] + acadoWorkspace.evGx[232]*acadoWorkspace.x[4] + acadoWorkspace.evGx[233]*acadoWorkspace.x[5] + acadoWorkspace.d[38]; -acadoVariables.x[45] += + acadoWorkspace.evGx[234]*acadoWorkspace.x[0] + acadoWorkspace.evGx[235]*acadoWorkspace.x[1] + acadoWorkspace.evGx[236]*acadoWorkspace.x[2] + acadoWorkspace.evGx[237]*acadoWorkspace.x[3] + acadoWorkspace.evGx[238]*acadoWorkspace.x[4] + acadoWorkspace.evGx[239]*acadoWorkspace.x[5] + acadoWorkspace.d[39]; -acadoVariables.x[46] += + acadoWorkspace.evGx[240]*acadoWorkspace.x[0] + acadoWorkspace.evGx[241]*acadoWorkspace.x[1] + acadoWorkspace.evGx[242]*acadoWorkspace.x[2] + acadoWorkspace.evGx[243]*acadoWorkspace.x[3] + acadoWorkspace.evGx[244]*acadoWorkspace.x[4] + acadoWorkspace.evGx[245]*acadoWorkspace.x[5] + acadoWorkspace.d[40]; -acadoVariables.x[47] += + acadoWorkspace.evGx[246]*acadoWorkspace.x[0] + acadoWorkspace.evGx[247]*acadoWorkspace.x[1] + acadoWorkspace.evGx[248]*acadoWorkspace.x[2] + acadoWorkspace.evGx[249]*acadoWorkspace.x[3] + acadoWorkspace.evGx[250]*acadoWorkspace.x[4] + acadoWorkspace.evGx[251]*acadoWorkspace.x[5] + acadoWorkspace.d[41]; -acadoVariables.x[48] += + acadoWorkspace.evGx[252]*acadoWorkspace.x[0] + acadoWorkspace.evGx[253]*acadoWorkspace.x[1] + acadoWorkspace.evGx[254]*acadoWorkspace.x[2] + acadoWorkspace.evGx[255]*acadoWorkspace.x[3] + acadoWorkspace.evGx[256]*acadoWorkspace.x[4] + acadoWorkspace.evGx[257]*acadoWorkspace.x[5] + acadoWorkspace.d[42]; -acadoVariables.x[49] += + acadoWorkspace.evGx[258]*acadoWorkspace.x[0] + acadoWorkspace.evGx[259]*acadoWorkspace.x[1] + acadoWorkspace.evGx[260]*acadoWorkspace.x[2] + acadoWorkspace.evGx[261]*acadoWorkspace.x[3] + acadoWorkspace.evGx[262]*acadoWorkspace.x[4] + acadoWorkspace.evGx[263]*acadoWorkspace.x[5] + acadoWorkspace.d[43]; -acadoVariables.x[50] += + acadoWorkspace.evGx[264]*acadoWorkspace.x[0] + acadoWorkspace.evGx[265]*acadoWorkspace.x[1] + acadoWorkspace.evGx[266]*acadoWorkspace.x[2] + acadoWorkspace.evGx[267]*acadoWorkspace.x[3] + acadoWorkspace.evGx[268]*acadoWorkspace.x[4] + acadoWorkspace.evGx[269]*acadoWorkspace.x[5] + acadoWorkspace.d[44]; -acadoVariables.x[51] += + acadoWorkspace.evGx[270]*acadoWorkspace.x[0] + acadoWorkspace.evGx[271]*acadoWorkspace.x[1] + acadoWorkspace.evGx[272]*acadoWorkspace.x[2] + acadoWorkspace.evGx[273]*acadoWorkspace.x[3] + acadoWorkspace.evGx[274]*acadoWorkspace.x[4] + acadoWorkspace.evGx[275]*acadoWorkspace.x[5] + acadoWorkspace.d[45]; -acadoVariables.x[52] += + acadoWorkspace.evGx[276]*acadoWorkspace.x[0] + acadoWorkspace.evGx[277]*acadoWorkspace.x[1] + acadoWorkspace.evGx[278]*acadoWorkspace.x[2] + acadoWorkspace.evGx[279]*acadoWorkspace.x[3] + acadoWorkspace.evGx[280]*acadoWorkspace.x[4] + acadoWorkspace.evGx[281]*acadoWorkspace.x[5] + acadoWorkspace.d[46]; -acadoVariables.x[53] += + acadoWorkspace.evGx[282]*acadoWorkspace.x[0] + acadoWorkspace.evGx[283]*acadoWorkspace.x[1] + acadoWorkspace.evGx[284]*acadoWorkspace.x[2] + acadoWorkspace.evGx[285]*acadoWorkspace.x[3] + acadoWorkspace.evGx[286]*acadoWorkspace.x[4] + acadoWorkspace.evGx[287]*acadoWorkspace.x[5] + acadoWorkspace.d[47]; -acadoVariables.x[54] += + acadoWorkspace.evGx[288]*acadoWorkspace.x[0] + acadoWorkspace.evGx[289]*acadoWorkspace.x[1] + acadoWorkspace.evGx[290]*acadoWorkspace.x[2] + acadoWorkspace.evGx[291]*acadoWorkspace.x[3] + acadoWorkspace.evGx[292]*acadoWorkspace.x[4] + acadoWorkspace.evGx[293]*acadoWorkspace.x[5] + acadoWorkspace.d[48]; -acadoVariables.x[55] += + acadoWorkspace.evGx[294]*acadoWorkspace.x[0] + acadoWorkspace.evGx[295]*acadoWorkspace.x[1] + acadoWorkspace.evGx[296]*acadoWorkspace.x[2] + acadoWorkspace.evGx[297]*acadoWorkspace.x[3] + acadoWorkspace.evGx[298]*acadoWorkspace.x[4] + acadoWorkspace.evGx[299]*acadoWorkspace.x[5] + acadoWorkspace.d[49]; -acadoVariables.x[56] += + acadoWorkspace.evGx[300]*acadoWorkspace.x[0] + acadoWorkspace.evGx[301]*acadoWorkspace.x[1] + acadoWorkspace.evGx[302]*acadoWorkspace.x[2] + acadoWorkspace.evGx[303]*acadoWorkspace.x[3] + acadoWorkspace.evGx[304]*acadoWorkspace.x[4] + acadoWorkspace.evGx[305]*acadoWorkspace.x[5] + acadoWorkspace.d[50]; -acadoVariables.x[57] += + acadoWorkspace.evGx[306]*acadoWorkspace.x[0] + acadoWorkspace.evGx[307]*acadoWorkspace.x[1] + acadoWorkspace.evGx[308]*acadoWorkspace.x[2] + acadoWorkspace.evGx[309]*acadoWorkspace.x[3] + acadoWorkspace.evGx[310]*acadoWorkspace.x[4] + acadoWorkspace.evGx[311]*acadoWorkspace.x[5] + acadoWorkspace.d[51]; -acadoVariables.x[58] += + acadoWorkspace.evGx[312]*acadoWorkspace.x[0] + acadoWorkspace.evGx[313]*acadoWorkspace.x[1] + acadoWorkspace.evGx[314]*acadoWorkspace.x[2] + acadoWorkspace.evGx[315]*acadoWorkspace.x[3] + acadoWorkspace.evGx[316]*acadoWorkspace.x[4] + acadoWorkspace.evGx[317]*acadoWorkspace.x[5] + acadoWorkspace.d[52]; -acadoVariables.x[59] += + acadoWorkspace.evGx[318]*acadoWorkspace.x[0] + acadoWorkspace.evGx[319]*acadoWorkspace.x[1] + acadoWorkspace.evGx[320]*acadoWorkspace.x[2] + acadoWorkspace.evGx[321]*acadoWorkspace.x[3] + acadoWorkspace.evGx[322]*acadoWorkspace.x[4] + acadoWorkspace.evGx[323]*acadoWorkspace.x[5] + acadoWorkspace.d[53]; -acadoVariables.x[60] += + acadoWorkspace.evGx[324]*acadoWorkspace.x[0] + acadoWorkspace.evGx[325]*acadoWorkspace.x[1] + acadoWorkspace.evGx[326]*acadoWorkspace.x[2] + acadoWorkspace.evGx[327]*acadoWorkspace.x[3] + acadoWorkspace.evGx[328]*acadoWorkspace.x[4] + acadoWorkspace.evGx[329]*acadoWorkspace.x[5] + acadoWorkspace.d[54]; -acadoVariables.x[61] += + acadoWorkspace.evGx[330]*acadoWorkspace.x[0] + acadoWorkspace.evGx[331]*acadoWorkspace.x[1] + acadoWorkspace.evGx[332]*acadoWorkspace.x[2] + acadoWorkspace.evGx[333]*acadoWorkspace.x[3] + acadoWorkspace.evGx[334]*acadoWorkspace.x[4] + acadoWorkspace.evGx[335]*acadoWorkspace.x[5] + acadoWorkspace.d[55]; -acadoVariables.x[62] += + acadoWorkspace.evGx[336]*acadoWorkspace.x[0] + acadoWorkspace.evGx[337]*acadoWorkspace.x[1] + acadoWorkspace.evGx[338]*acadoWorkspace.x[2] + acadoWorkspace.evGx[339]*acadoWorkspace.x[3] + acadoWorkspace.evGx[340]*acadoWorkspace.x[4] + acadoWorkspace.evGx[341]*acadoWorkspace.x[5] + acadoWorkspace.d[56]; -acadoVariables.x[63] += + acadoWorkspace.evGx[342]*acadoWorkspace.x[0] + acadoWorkspace.evGx[343]*acadoWorkspace.x[1] + acadoWorkspace.evGx[344]*acadoWorkspace.x[2] + acadoWorkspace.evGx[345]*acadoWorkspace.x[3] + acadoWorkspace.evGx[346]*acadoWorkspace.x[4] + acadoWorkspace.evGx[347]*acadoWorkspace.x[5] + acadoWorkspace.d[57]; -acadoVariables.x[64] += + acadoWorkspace.evGx[348]*acadoWorkspace.x[0] + acadoWorkspace.evGx[349]*acadoWorkspace.x[1] + acadoWorkspace.evGx[350]*acadoWorkspace.x[2] + acadoWorkspace.evGx[351]*acadoWorkspace.x[3] + acadoWorkspace.evGx[352]*acadoWorkspace.x[4] + acadoWorkspace.evGx[353]*acadoWorkspace.x[5] + acadoWorkspace.d[58]; -acadoVariables.x[65] += + acadoWorkspace.evGx[354]*acadoWorkspace.x[0] + acadoWorkspace.evGx[355]*acadoWorkspace.x[1] + acadoWorkspace.evGx[356]*acadoWorkspace.x[2] + acadoWorkspace.evGx[357]*acadoWorkspace.x[3] + acadoWorkspace.evGx[358]*acadoWorkspace.x[4] + acadoWorkspace.evGx[359]*acadoWorkspace.x[5] + acadoWorkspace.d[59]; -acadoVariables.x[66] += + acadoWorkspace.evGx[360]*acadoWorkspace.x[0] + acadoWorkspace.evGx[361]*acadoWorkspace.x[1] + acadoWorkspace.evGx[362]*acadoWorkspace.x[2] + acadoWorkspace.evGx[363]*acadoWorkspace.x[3] + acadoWorkspace.evGx[364]*acadoWorkspace.x[4] + acadoWorkspace.evGx[365]*acadoWorkspace.x[5] + acadoWorkspace.d[60]; -acadoVariables.x[67] += + acadoWorkspace.evGx[366]*acadoWorkspace.x[0] + acadoWorkspace.evGx[367]*acadoWorkspace.x[1] + acadoWorkspace.evGx[368]*acadoWorkspace.x[2] + acadoWorkspace.evGx[369]*acadoWorkspace.x[3] + acadoWorkspace.evGx[370]*acadoWorkspace.x[4] + acadoWorkspace.evGx[371]*acadoWorkspace.x[5] + acadoWorkspace.d[61]; -acadoVariables.x[68] += + acadoWorkspace.evGx[372]*acadoWorkspace.x[0] + acadoWorkspace.evGx[373]*acadoWorkspace.x[1] + acadoWorkspace.evGx[374]*acadoWorkspace.x[2] + acadoWorkspace.evGx[375]*acadoWorkspace.x[3] + acadoWorkspace.evGx[376]*acadoWorkspace.x[4] + acadoWorkspace.evGx[377]*acadoWorkspace.x[5] + acadoWorkspace.d[62]; -acadoVariables.x[69] += + acadoWorkspace.evGx[378]*acadoWorkspace.x[0] + acadoWorkspace.evGx[379]*acadoWorkspace.x[1] + acadoWorkspace.evGx[380]*acadoWorkspace.x[2] + acadoWorkspace.evGx[381]*acadoWorkspace.x[3] + acadoWorkspace.evGx[382]*acadoWorkspace.x[4] + acadoWorkspace.evGx[383]*acadoWorkspace.x[5] + acadoWorkspace.d[63]; -acadoVariables.x[70] += + acadoWorkspace.evGx[384]*acadoWorkspace.x[0] + acadoWorkspace.evGx[385]*acadoWorkspace.x[1] + acadoWorkspace.evGx[386]*acadoWorkspace.x[2] + acadoWorkspace.evGx[387]*acadoWorkspace.x[3] + acadoWorkspace.evGx[388]*acadoWorkspace.x[4] + acadoWorkspace.evGx[389]*acadoWorkspace.x[5] + acadoWorkspace.d[64]; -acadoVariables.x[71] += + acadoWorkspace.evGx[390]*acadoWorkspace.x[0] + acadoWorkspace.evGx[391]*acadoWorkspace.x[1] + acadoWorkspace.evGx[392]*acadoWorkspace.x[2] + acadoWorkspace.evGx[393]*acadoWorkspace.x[3] + acadoWorkspace.evGx[394]*acadoWorkspace.x[4] + acadoWorkspace.evGx[395]*acadoWorkspace.x[5] + acadoWorkspace.d[65]; -acadoVariables.x[72] += + acadoWorkspace.evGx[396]*acadoWorkspace.x[0] + acadoWorkspace.evGx[397]*acadoWorkspace.x[1] + acadoWorkspace.evGx[398]*acadoWorkspace.x[2] + acadoWorkspace.evGx[399]*acadoWorkspace.x[3] + acadoWorkspace.evGx[400]*acadoWorkspace.x[4] + acadoWorkspace.evGx[401]*acadoWorkspace.x[5] + acadoWorkspace.d[66]; -acadoVariables.x[73] += + acadoWorkspace.evGx[402]*acadoWorkspace.x[0] + acadoWorkspace.evGx[403]*acadoWorkspace.x[1] + acadoWorkspace.evGx[404]*acadoWorkspace.x[2] + acadoWorkspace.evGx[405]*acadoWorkspace.x[3] + acadoWorkspace.evGx[406]*acadoWorkspace.x[4] + acadoWorkspace.evGx[407]*acadoWorkspace.x[5] + acadoWorkspace.d[67]; -acadoVariables.x[74] += + acadoWorkspace.evGx[408]*acadoWorkspace.x[0] + acadoWorkspace.evGx[409]*acadoWorkspace.x[1] + acadoWorkspace.evGx[410]*acadoWorkspace.x[2] + acadoWorkspace.evGx[411]*acadoWorkspace.x[3] + acadoWorkspace.evGx[412]*acadoWorkspace.x[4] + acadoWorkspace.evGx[413]*acadoWorkspace.x[5] + acadoWorkspace.d[68]; -acadoVariables.x[75] += + acadoWorkspace.evGx[414]*acadoWorkspace.x[0] + acadoWorkspace.evGx[415]*acadoWorkspace.x[1] + acadoWorkspace.evGx[416]*acadoWorkspace.x[2] + acadoWorkspace.evGx[417]*acadoWorkspace.x[3] + acadoWorkspace.evGx[418]*acadoWorkspace.x[4] + acadoWorkspace.evGx[419]*acadoWorkspace.x[5] + acadoWorkspace.d[69]; -acadoVariables.x[76] += + acadoWorkspace.evGx[420]*acadoWorkspace.x[0] + acadoWorkspace.evGx[421]*acadoWorkspace.x[1] + acadoWorkspace.evGx[422]*acadoWorkspace.x[2] + acadoWorkspace.evGx[423]*acadoWorkspace.x[3] + acadoWorkspace.evGx[424]*acadoWorkspace.x[4] + acadoWorkspace.evGx[425]*acadoWorkspace.x[5] + acadoWorkspace.d[70]; -acadoVariables.x[77] += + acadoWorkspace.evGx[426]*acadoWorkspace.x[0] + acadoWorkspace.evGx[427]*acadoWorkspace.x[1] + acadoWorkspace.evGx[428]*acadoWorkspace.x[2] + acadoWorkspace.evGx[429]*acadoWorkspace.x[3] + acadoWorkspace.evGx[430]*acadoWorkspace.x[4] + acadoWorkspace.evGx[431]*acadoWorkspace.x[5] + acadoWorkspace.d[71]; -acadoVariables.x[78] += + acadoWorkspace.evGx[432]*acadoWorkspace.x[0] + acadoWorkspace.evGx[433]*acadoWorkspace.x[1] + acadoWorkspace.evGx[434]*acadoWorkspace.x[2] + acadoWorkspace.evGx[435]*acadoWorkspace.x[3] + acadoWorkspace.evGx[436]*acadoWorkspace.x[4] + acadoWorkspace.evGx[437]*acadoWorkspace.x[5] + acadoWorkspace.d[72]; -acadoVariables.x[79] += + acadoWorkspace.evGx[438]*acadoWorkspace.x[0] + acadoWorkspace.evGx[439]*acadoWorkspace.x[1] + acadoWorkspace.evGx[440]*acadoWorkspace.x[2] + acadoWorkspace.evGx[441]*acadoWorkspace.x[3] + acadoWorkspace.evGx[442]*acadoWorkspace.x[4] + acadoWorkspace.evGx[443]*acadoWorkspace.x[5] + acadoWorkspace.d[73]; -acadoVariables.x[80] += + acadoWorkspace.evGx[444]*acadoWorkspace.x[0] + acadoWorkspace.evGx[445]*acadoWorkspace.x[1] + acadoWorkspace.evGx[446]*acadoWorkspace.x[2] + acadoWorkspace.evGx[447]*acadoWorkspace.x[3] + acadoWorkspace.evGx[448]*acadoWorkspace.x[4] + acadoWorkspace.evGx[449]*acadoWorkspace.x[5] + acadoWorkspace.d[74]; -acadoVariables.x[81] += + acadoWorkspace.evGx[450]*acadoWorkspace.x[0] + acadoWorkspace.evGx[451]*acadoWorkspace.x[1] + acadoWorkspace.evGx[452]*acadoWorkspace.x[2] + acadoWorkspace.evGx[453]*acadoWorkspace.x[3] + acadoWorkspace.evGx[454]*acadoWorkspace.x[4] + acadoWorkspace.evGx[455]*acadoWorkspace.x[5] + acadoWorkspace.d[75]; -acadoVariables.x[82] += + acadoWorkspace.evGx[456]*acadoWorkspace.x[0] + acadoWorkspace.evGx[457]*acadoWorkspace.x[1] + acadoWorkspace.evGx[458]*acadoWorkspace.x[2] + acadoWorkspace.evGx[459]*acadoWorkspace.x[3] + acadoWorkspace.evGx[460]*acadoWorkspace.x[4] + acadoWorkspace.evGx[461]*acadoWorkspace.x[5] + acadoWorkspace.d[76]; -acadoVariables.x[83] += + acadoWorkspace.evGx[462]*acadoWorkspace.x[0] + acadoWorkspace.evGx[463]*acadoWorkspace.x[1] + acadoWorkspace.evGx[464]*acadoWorkspace.x[2] + acadoWorkspace.evGx[465]*acadoWorkspace.x[3] + acadoWorkspace.evGx[466]*acadoWorkspace.x[4] + acadoWorkspace.evGx[467]*acadoWorkspace.x[5] + acadoWorkspace.d[77]; -acadoVariables.x[84] += + acadoWorkspace.evGx[468]*acadoWorkspace.x[0] + acadoWorkspace.evGx[469]*acadoWorkspace.x[1] + acadoWorkspace.evGx[470]*acadoWorkspace.x[2] + acadoWorkspace.evGx[471]*acadoWorkspace.x[3] + acadoWorkspace.evGx[472]*acadoWorkspace.x[4] + acadoWorkspace.evGx[473]*acadoWorkspace.x[5] + acadoWorkspace.d[78]; -acadoVariables.x[85] += + acadoWorkspace.evGx[474]*acadoWorkspace.x[0] + acadoWorkspace.evGx[475]*acadoWorkspace.x[1] + acadoWorkspace.evGx[476]*acadoWorkspace.x[2] + acadoWorkspace.evGx[477]*acadoWorkspace.x[3] + acadoWorkspace.evGx[478]*acadoWorkspace.x[4] + acadoWorkspace.evGx[479]*acadoWorkspace.x[5] + acadoWorkspace.d[79]; -acadoVariables.x[86] += + acadoWorkspace.evGx[480]*acadoWorkspace.x[0] + acadoWorkspace.evGx[481]*acadoWorkspace.x[1] + acadoWorkspace.evGx[482]*acadoWorkspace.x[2] + acadoWorkspace.evGx[483]*acadoWorkspace.x[3] + acadoWorkspace.evGx[484]*acadoWorkspace.x[4] + acadoWorkspace.evGx[485]*acadoWorkspace.x[5] + acadoWorkspace.d[80]; -acadoVariables.x[87] += + acadoWorkspace.evGx[486]*acadoWorkspace.x[0] + acadoWorkspace.evGx[487]*acadoWorkspace.x[1] + acadoWorkspace.evGx[488]*acadoWorkspace.x[2] + acadoWorkspace.evGx[489]*acadoWorkspace.x[3] + acadoWorkspace.evGx[490]*acadoWorkspace.x[4] + acadoWorkspace.evGx[491]*acadoWorkspace.x[5] + acadoWorkspace.d[81]; -acadoVariables.x[88] += + acadoWorkspace.evGx[492]*acadoWorkspace.x[0] + acadoWorkspace.evGx[493]*acadoWorkspace.x[1] + acadoWorkspace.evGx[494]*acadoWorkspace.x[2] + acadoWorkspace.evGx[495]*acadoWorkspace.x[3] + acadoWorkspace.evGx[496]*acadoWorkspace.x[4] + acadoWorkspace.evGx[497]*acadoWorkspace.x[5] + acadoWorkspace.d[82]; -acadoVariables.x[89] += + acadoWorkspace.evGx[498]*acadoWorkspace.x[0] + acadoWorkspace.evGx[499]*acadoWorkspace.x[1] + acadoWorkspace.evGx[500]*acadoWorkspace.x[2] + acadoWorkspace.evGx[501]*acadoWorkspace.x[3] + acadoWorkspace.evGx[502]*acadoWorkspace.x[4] + acadoWorkspace.evGx[503]*acadoWorkspace.x[5] + acadoWorkspace.d[83]; -acadoVariables.x[90] += + acadoWorkspace.evGx[504]*acadoWorkspace.x[0] + acadoWorkspace.evGx[505]*acadoWorkspace.x[1] + acadoWorkspace.evGx[506]*acadoWorkspace.x[2] + acadoWorkspace.evGx[507]*acadoWorkspace.x[3] + acadoWorkspace.evGx[508]*acadoWorkspace.x[4] + acadoWorkspace.evGx[509]*acadoWorkspace.x[5] + acadoWorkspace.d[84]; -acadoVariables.x[91] += + acadoWorkspace.evGx[510]*acadoWorkspace.x[0] + acadoWorkspace.evGx[511]*acadoWorkspace.x[1] + acadoWorkspace.evGx[512]*acadoWorkspace.x[2] + acadoWorkspace.evGx[513]*acadoWorkspace.x[3] + acadoWorkspace.evGx[514]*acadoWorkspace.x[4] + acadoWorkspace.evGx[515]*acadoWorkspace.x[5] + acadoWorkspace.d[85]; -acadoVariables.x[92] += + acadoWorkspace.evGx[516]*acadoWorkspace.x[0] + acadoWorkspace.evGx[517]*acadoWorkspace.x[1] + acadoWorkspace.evGx[518]*acadoWorkspace.x[2] + acadoWorkspace.evGx[519]*acadoWorkspace.x[3] + acadoWorkspace.evGx[520]*acadoWorkspace.x[4] + acadoWorkspace.evGx[521]*acadoWorkspace.x[5] + acadoWorkspace.d[86]; -acadoVariables.x[93] += + acadoWorkspace.evGx[522]*acadoWorkspace.x[0] + acadoWorkspace.evGx[523]*acadoWorkspace.x[1] + acadoWorkspace.evGx[524]*acadoWorkspace.x[2] + acadoWorkspace.evGx[525]*acadoWorkspace.x[3] + acadoWorkspace.evGx[526]*acadoWorkspace.x[4] + acadoWorkspace.evGx[527]*acadoWorkspace.x[5] + acadoWorkspace.d[87]; -acadoVariables.x[94] += + acadoWorkspace.evGx[528]*acadoWorkspace.x[0] + acadoWorkspace.evGx[529]*acadoWorkspace.x[1] + acadoWorkspace.evGx[530]*acadoWorkspace.x[2] + acadoWorkspace.evGx[531]*acadoWorkspace.x[3] + acadoWorkspace.evGx[532]*acadoWorkspace.x[4] + acadoWorkspace.evGx[533]*acadoWorkspace.x[5] + acadoWorkspace.d[88]; -acadoVariables.x[95] += + acadoWorkspace.evGx[534]*acadoWorkspace.x[0] + acadoWorkspace.evGx[535]*acadoWorkspace.x[1] + acadoWorkspace.evGx[536]*acadoWorkspace.x[2] + acadoWorkspace.evGx[537]*acadoWorkspace.x[3] + acadoWorkspace.evGx[538]*acadoWorkspace.x[4] + acadoWorkspace.evGx[539]*acadoWorkspace.x[5] + acadoWorkspace.d[89]; -acadoVariables.x[96] += + acadoWorkspace.evGx[540]*acadoWorkspace.x[0] + acadoWorkspace.evGx[541]*acadoWorkspace.x[1] + acadoWorkspace.evGx[542]*acadoWorkspace.x[2] + acadoWorkspace.evGx[543]*acadoWorkspace.x[3] + acadoWorkspace.evGx[544]*acadoWorkspace.x[4] + acadoWorkspace.evGx[545]*acadoWorkspace.x[5] + acadoWorkspace.d[90]; -acadoVariables.x[97] += + acadoWorkspace.evGx[546]*acadoWorkspace.x[0] + acadoWorkspace.evGx[547]*acadoWorkspace.x[1] + acadoWorkspace.evGx[548]*acadoWorkspace.x[2] + acadoWorkspace.evGx[549]*acadoWorkspace.x[3] + acadoWorkspace.evGx[550]*acadoWorkspace.x[4] + acadoWorkspace.evGx[551]*acadoWorkspace.x[5] + acadoWorkspace.d[91]; -acadoVariables.x[98] += + acadoWorkspace.evGx[552]*acadoWorkspace.x[0] + acadoWorkspace.evGx[553]*acadoWorkspace.x[1] + acadoWorkspace.evGx[554]*acadoWorkspace.x[2] + acadoWorkspace.evGx[555]*acadoWorkspace.x[3] + acadoWorkspace.evGx[556]*acadoWorkspace.x[4] + acadoWorkspace.evGx[557]*acadoWorkspace.x[5] + acadoWorkspace.d[92]; -acadoVariables.x[99] += + acadoWorkspace.evGx[558]*acadoWorkspace.x[0] + acadoWorkspace.evGx[559]*acadoWorkspace.x[1] + acadoWorkspace.evGx[560]*acadoWorkspace.x[2] + acadoWorkspace.evGx[561]*acadoWorkspace.x[3] + acadoWorkspace.evGx[562]*acadoWorkspace.x[4] + acadoWorkspace.evGx[563]*acadoWorkspace.x[5] + acadoWorkspace.d[93]; -acadoVariables.x[100] += + acadoWorkspace.evGx[564]*acadoWorkspace.x[0] + acadoWorkspace.evGx[565]*acadoWorkspace.x[1] + acadoWorkspace.evGx[566]*acadoWorkspace.x[2] + acadoWorkspace.evGx[567]*acadoWorkspace.x[3] + acadoWorkspace.evGx[568]*acadoWorkspace.x[4] + acadoWorkspace.evGx[569]*acadoWorkspace.x[5] + acadoWorkspace.d[94]; -acadoVariables.x[101] += + acadoWorkspace.evGx[570]*acadoWorkspace.x[0] + acadoWorkspace.evGx[571]*acadoWorkspace.x[1] + acadoWorkspace.evGx[572]*acadoWorkspace.x[2] + acadoWorkspace.evGx[573]*acadoWorkspace.x[3] + acadoWorkspace.evGx[574]*acadoWorkspace.x[4] + acadoWorkspace.evGx[575]*acadoWorkspace.x[5] + acadoWorkspace.d[95]; -acadoVariables.x[102] += + acadoWorkspace.evGx[576]*acadoWorkspace.x[0] + acadoWorkspace.evGx[577]*acadoWorkspace.x[1] + acadoWorkspace.evGx[578]*acadoWorkspace.x[2] + acadoWorkspace.evGx[579]*acadoWorkspace.x[3] + acadoWorkspace.evGx[580]*acadoWorkspace.x[4] + acadoWorkspace.evGx[581]*acadoWorkspace.x[5] + acadoWorkspace.d[96]; -acadoVariables.x[103] += + acadoWorkspace.evGx[582]*acadoWorkspace.x[0] + acadoWorkspace.evGx[583]*acadoWorkspace.x[1] + acadoWorkspace.evGx[584]*acadoWorkspace.x[2] + acadoWorkspace.evGx[585]*acadoWorkspace.x[3] + acadoWorkspace.evGx[586]*acadoWorkspace.x[4] + acadoWorkspace.evGx[587]*acadoWorkspace.x[5] + acadoWorkspace.d[97]; -acadoVariables.x[104] += + acadoWorkspace.evGx[588]*acadoWorkspace.x[0] + acadoWorkspace.evGx[589]*acadoWorkspace.x[1] + acadoWorkspace.evGx[590]*acadoWorkspace.x[2] + acadoWorkspace.evGx[591]*acadoWorkspace.x[3] + acadoWorkspace.evGx[592]*acadoWorkspace.x[4] + acadoWorkspace.evGx[593]*acadoWorkspace.x[5] + acadoWorkspace.d[98]; -acadoVariables.x[105] += + acadoWorkspace.evGx[594]*acadoWorkspace.x[0] + acadoWorkspace.evGx[595]*acadoWorkspace.x[1] + acadoWorkspace.evGx[596]*acadoWorkspace.x[2] + acadoWorkspace.evGx[597]*acadoWorkspace.x[3] + acadoWorkspace.evGx[598]*acadoWorkspace.x[4] + acadoWorkspace.evGx[599]*acadoWorkspace.x[5] + acadoWorkspace.d[99]; -acadoVariables.x[106] += + acadoWorkspace.evGx[600]*acadoWorkspace.x[0] + acadoWorkspace.evGx[601]*acadoWorkspace.x[1] + acadoWorkspace.evGx[602]*acadoWorkspace.x[2] + acadoWorkspace.evGx[603]*acadoWorkspace.x[3] + acadoWorkspace.evGx[604]*acadoWorkspace.x[4] + acadoWorkspace.evGx[605]*acadoWorkspace.x[5] + acadoWorkspace.d[100]; -acadoVariables.x[107] += + acadoWorkspace.evGx[606]*acadoWorkspace.x[0] + acadoWorkspace.evGx[607]*acadoWorkspace.x[1] + acadoWorkspace.evGx[608]*acadoWorkspace.x[2] + acadoWorkspace.evGx[609]*acadoWorkspace.x[3] + acadoWorkspace.evGx[610]*acadoWorkspace.x[4] + acadoWorkspace.evGx[611]*acadoWorkspace.x[5] + acadoWorkspace.d[101]; -acadoVariables.x[108] += + acadoWorkspace.evGx[612]*acadoWorkspace.x[0] + acadoWorkspace.evGx[613]*acadoWorkspace.x[1] + acadoWorkspace.evGx[614]*acadoWorkspace.x[2] + acadoWorkspace.evGx[615]*acadoWorkspace.x[3] + acadoWorkspace.evGx[616]*acadoWorkspace.x[4] + acadoWorkspace.evGx[617]*acadoWorkspace.x[5] + acadoWorkspace.d[102]; -acadoVariables.x[109] += + acadoWorkspace.evGx[618]*acadoWorkspace.x[0] + acadoWorkspace.evGx[619]*acadoWorkspace.x[1] + acadoWorkspace.evGx[620]*acadoWorkspace.x[2] + acadoWorkspace.evGx[621]*acadoWorkspace.x[3] + acadoWorkspace.evGx[622]*acadoWorkspace.x[4] + acadoWorkspace.evGx[623]*acadoWorkspace.x[5] + acadoWorkspace.d[103]; -acadoVariables.x[110] += + acadoWorkspace.evGx[624]*acadoWorkspace.x[0] + acadoWorkspace.evGx[625]*acadoWorkspace.x[1] + acadoWorkspace.evGx[626]*acadoWorkspace.x[2] + acadoWorkspace.evGx[627]*acadoWorkspace.x[3] + acadoWorkspace.evGx[628]*acadoWorkspace.x[4] + acadoWorkspace.evGx[629]*acadoWorkspace.x[5] + acadoWorkspace.d[104]; -acadoVariables.x[111] += + acadoWorkspace.evGx[630]*acadoWorkspace.x[0] + acadoWorkspace.evGx[631]*acadoWorkspace.x[1] + acadoWorkspace.evGx[632]*acadoWorkspace.x[2] + acadoWorkspace.evGx[633]*acadoWorkspace.x[3] + acadoWorkspace.evGx[634]*acadoWorkspace.x[4] + acadoWorkspace.evGx[635]*acadoWorkspace.x[5] + acadoWorkspace.d[105]; -acadoVariables.x[112] += + acadoWorkspace.evGx[636]*acadoWorkspace.x[0] + acadoWorkspace.evGx[637]*acadoWorkspace.x[1] + acadoWorkspace.evGx[638]*acadoWorkspace.x[2] + acadoWorkspace.evGx[639]*acadoWorkspace.x[3] + acadoWorkspace.evGx[640]*acadoWorkspace.x[4] + acadoWorkspace.evGx[641]*acadoWorkspace.x[5] + acadoWorkspace.d[106]; -acadoVariables.x[113] += + acadoWorkspace.evGx[642]*acadoWorkspace.x[0] + acadoWorkspace.evGx[643]*acadoWorkspace.x[1] + acadoWorkspace.evGx[644]*acadoWorkspace.x[2] + acadoWorkspace.evGx[645]*acadoWorkspace.x[3] + acadoWorkspace.evGx[646]*acadoWorkspace.x[4] + acadoWorkspace.evGx[647]*acadoWorkspace.x[5] + acadoWorkspace.d[107]; -acadoVariables.x[114] += + acadoWorkspace.evGx[648]*acadoWorkspace.x[0] + acadoWorkspace.evGx[649]*acadoWorkspace.x[1] + acadoWorkspace.evGx[650]*acadoWorkspace.x[2] + acadoWorkspace.evGx[651]*acadoWorkspace.x[3] + acadoWorkspace.evGx[652]*acadoWorkspace.x[4] + acadoWorkspace.evGx[653]*acadoWorkspace.x[5] + acadoWorkspace.d[108]; -acadoVariables.x[115] += + acadoWorkspace.evGx[654]*acadoWorkspace.x[0] + acadoWorkspace.evGx[655]*acadoWorkspace.x[1] + acadoWorkspace.evGx[656]*acadoWorkspace.x[2] + acadoWorkspace.evGx[657]*acadoWorkspace.x[3] + acadoWorkspace.evGx[658]*acadoWorkspace.x[4] + acadoWorkspace.evGx[659]*acadoWorkspace.x[5] + acadoWorkspace.d[109]; -acadoVariables.x[116] += + acadoWorkspace.evGx[660]*acadoWorkspace.x[0] + acadoWorkspace.evGx[661]*acadoWorkspace.x[1] + acadoWorkspace.evGx[662]*acadoWorkspace.x[2] + acadoWorkspace.evGx[663]*acadoWorkspace.x[3] + acadoWorkspace.evGx[664]*acadoWorkspace.x[4] + acadoWorkspace.evGx[665]*acadoWorkspace.x[5] + acadoWorkspace.d[110]; -acadoVariables.x[117] += + acadoWorkspace.evGx[666]*acadoWorkspace.x[0] + acadoWorkspace.evGx[667]*acadoWorkspace.x[1] + acadoWorkspace.evGx[668]*acadoWorkspace.x[2] + acadoWorkspace.evGx[669]*acadoWorkspace.x[3] + acadoWorkspace.evGx[670]*acadoWorkspace.x[4] + acadoWorkspace.evGx[671]*acadoWorkspace.x[5] + acadoWorkspace.d[111]; -acadoVariables.x[118] += + acadoWorkspace.evGx[672]*acadoWorkspace.x[0] + acadoWorkspace.evGx[673]*acadoWorkspace.x[1] + acadoWorkspace.evGx[674]*acadoWorkspace.x[2] + acadoWorkspace.evGx[675]*acadoWorkspace.x[3] + acadoWorkspace.evGx[676]*acadoWorkspace.x[4] + acadoWorkspace.evGx[677]*acadoWorkspace.x[5] + acadoWorkspace.d[112]; -acadoVariables.x[119] += + acadoWorkspace.evGx[678]*acadoWorkspace.x[0] + acadoWorkspace.evGx[679]*acadoWorkspace.x[1] + acadoWorkspace.evGx[680]*acadoWorkspace.x[2] + acadoWorkspace.evGx[681]*acadoWorkspace.x[3] + acadoWorkspace.evGx[682]*acadoWorkspace.x[4] + acadoWorkspace.evGx[683]*acadoWorkspace.x[5] + acadoWorkspace.d[113]; -acadoVariables.x[120] += + acadoWorkspace.evGx[684]*acadoWorkspace.x[0] + acadoWorkspace.evGx[685]*acadoWorkspace.x[1] + acadoWorkspace.evGx[686]*acadoWorkspace.x[2] + acadoWorkspace.evGx[687]*acadoWorkspace.x[3] + acadoWorkspace.evGx[688]*acadoWorkspace.x[4] + acadoWorkspace.evGx[689]*acadoWorkspace.x[5] + acadoWorkspace.d[114]; -acadoVariables.x[121] += + acadoWorkspace.evGx[690]*acadoWorkspace.x[0] + acadoWorkspace.evGx[691]*acadoWorkspace.x[1] + acadoWorkspace.evGx[692]*acadoWorkspace.x[2] + acadoWorkspace.evGx[693]*acadoWorkspace.x[3] + acadoWorkspace.evGx[694]*acadoWorkspace.x[4] + acadoWorkspace.evGx[695]*acadoWorkspace.x[5] + acadoWorkspace.d[115]; -acadoVariables.x[122] += + acadoWorkspace.evGx[696]*acadoWorkspace.x[0] + acadoWorkspace.evGx[697]*acadoWorkspace.x[1] + acadoWorkspace.evGx[698]*acadoWorkspace.x[2] + acadoWorkspace.evGx[699]*acadoWorkspace.x[3] + acadoWorkspace.evGx[700]*acadoWorkspace.x[4] + acadoWorkspace.evGx[701]*acadoWorkspace.x[5] + acadoWorkspace.d[116]; -acadoVariables.x[123] += + acadoWorkspace.evGx[702]*acadoWorkspace.x[0] + acadoWorkspace.evGx[703]*acadoWorkspace.x[1] + acadoWorkspace.evGx[704]*acadoWorkspace.x[2] + acadoWorkspace.evGx[705]*acadoWorkspace.x[3] + acadoWorkspace.evGx[706]*acadoWorkspace.x[4] + acadoWorkspace.evGx[707]*acadoWorkspace.x[5] + acadoWorkspace.d[117]; -acadoVariables.x[124] += + acadoWorkspace.evGx[708]*acadoWorkspace.x[0] + acadoWorkspace.evGx[709]*acadoWorkspace.x[1] + acadoWorkspace.evGx[710]*acadoWorkspace.x[2] + acadoWorkspace.evGx[711]*acadoWorkspace.x[3] + acadoWorkspace.evGx[712]*acadoWorkspace.x[4] + acadoWorkspace.evGx[713]*acadoWorkspace.x[5] + acadoWorkspace.d[118]; -acadoVariables.x[125] += + acadoWorkspace.evGx[714]*acadoWorkspace.x[0] + acadoWorkspace.evGx[715]*acadoWorkspace.x[1] + acadoWorkspace.evGx[716]*acadoWorkspace.x[2] + acadoWorkspace.evGx[717]*acadoWorkspace.x[3] + acadoWorkspace.evGx[718]*acadoWorkspace.x[4] + acadoWorkspace.evGx[719]*acadoWorkspace.x[5] + acadoWorkspace.d[119]; - -acado_multEDu( acadoWorkspace.E, &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 6 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 6 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 12 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 12 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 12 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 18 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 18 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 24 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 18 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 30 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 18 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 36 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 24 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 42 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 24 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 48 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 24 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 54 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 24 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 60 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 30 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 66 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 30 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 72 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 30 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 78 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 30 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 84 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 30 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 90 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 36 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 96 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 36 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 102 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 36 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 108 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 36 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 114 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 36 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 120 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 36 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 126 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 42 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 132 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 42 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 138 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 42 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 144 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 42 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 150 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 42 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 156 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 42 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 162 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 42 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 168 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 48 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 174 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 48 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 180 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 48 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 186 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 48 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 192 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 48 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 198 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 48 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 204 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 48 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 210 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 48 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 216 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 54 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 222 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 54 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 228 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 54 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 234 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 54 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 240 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 54 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 246 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 54 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 252 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 54 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 258 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 54 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 264 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 54 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 270 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 276 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 282 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 288 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 294 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 300 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 306 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 312 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 318 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 324 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 60 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 330 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 336 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 342 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 348 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 354 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 360 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 366 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 372 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 378 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 384 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 390 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 66 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 396 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 402 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 408 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 414 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 420 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 426 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 432 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 438 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 444 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 450 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 456 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 462 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 72 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 468 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 474 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 480 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 486 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 492 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 498 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 504 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 510 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 516 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 522 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 528 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 534 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 540 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 78 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 546 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 552 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 558 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 564 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 570 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 576 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 582 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 588 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 594 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 600 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 606 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 612 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 618 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 624 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 84 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 630 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 636 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 642 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 648 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 654 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 660 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 666 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 672 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 678 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 684 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 690 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 696 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 702 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 708 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 714 ]), &(acadoWorkspace.x[ 20 ]), &(acadoVariables.x[ 90 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 720 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 726 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 732 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 738 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 744 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 750 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 756 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 762 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 768 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 774 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 780 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 786 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 792 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 798 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 804 ]), &(acadoWorkspace.x[ 20 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 810 ]), &(acadoWorkspace.x[ 21 ]), &(acadoVariables.x[ 96 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 816 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 822 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 828 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 834 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 840 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 846 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 852 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 858 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 864 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 870 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 876 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 882 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 888 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 894 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 900 ]), &(acadoWorkspace.x[ 20 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 906 ]), &(acadoWorkspace.x[ 21 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 912 ]), &(acadoWorkspace.x[ 22 ]), &(acadoVariables.x[ 102 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 918 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 924 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 930 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 936 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 942 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 948 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 954 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 960 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 966 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 972 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 978 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 984 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 990 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 996 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1002 ]), &(acadoWorkspace.x[ 20 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1008 ]), &(acadoWorkspace.x[ 21 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1014 ]), &(acadoWorkspace.x[ 22 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1020 ]), &(acadoWorkspace.x[ 23 ]), &(acadoVariables.x[ 108 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1026 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1032 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1038 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1044 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1050 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1056 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1062 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1068 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1074 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1080 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1086 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1092 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1098 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1104 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1110 ]), &(acadoWorkspace.x[ 20 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1116 ]), &(acadoWorkspace.x[ 21 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1122 ]), &(acadoWorkspace.x[ 22 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1128 ]), &(acadoWorkspace.x[ 23 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1134 ]), &(acadoWorkspace.x[ 24 ]), &(acadoVariables.x[ 114 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1140 ]), &(acadoWorkspace.x[ 6 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1146 ]), &(acadoWorkspace.x[ 7 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1152 ]), &(acadoWorkspace.x[ 8 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1158 ]), &(acadoWorkspace.x[ 9 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1164 ]), &(acadoWorkspace.x[ 10 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1170 ]), &(acadoWorkspace.x[ 11 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1176 ]), &(acadoWorkspace.x[ 12 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1182 ]), &(acadoWorkspace.x[ 13 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1188 ]), &(acadoWorkspace.x[ 14 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1194 ]), &(acadoWorkspace.x[ 15 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1200 ]), &(acadoWorkspace.x[ 16 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1206 ]), &(acadoWorkspace.x[ 17 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1212 ]), &(acadoWorkspace.x[ 18 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1218 ]), &(acadoWorkspace.x[ 19 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1224 ]), &(acadoWorkspace.x[ 20 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1230 ]), &(acadoWorkspace.x[ 21 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1236 ]), &(acadoWorkspace.x[ 22 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1242 ]), &(acadoWorkspace.x[ 23 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1248 ]), &(acadoWorkspace.x[ 24 ]), &(acadoVariables.x[ 120 ]) ); -acado_multEDu( &(acadoWorkspace.E[ 1254 ]), &(acadoWorkspace.x[ 25 ]), &(acadoVariables.x[ 120 ]) ); -} - -int acado_preparationStep( ) -{ -int ret; - -ret = acado_modelSimulation(); -acado_evaluateObjective( ); -acado_condensePrep( ); -return ret; -} - -int acado_feedbackStep( ) -{ -int tmp; - -acado_condenseFdb( ); - -tmp = acado_solve( ); - -acado_expand( ); -return tmp; -} - -int acado_initializeSolver( ) -{ -int ret; - -/* This is a function which must be called once before any other function call! */ - - -ret = 0; - -memset(&acadoWorkspace, 0, sizeof( acadoWorkspace )); -return ret; -} - -void acado_initializeNodesByForwardSimulation( ) -{ -int index; -for (index = 0; index < 20; ++index) -{ -acadoWorkspace.state[0] = acadoVariables.x[index * 6]; -acadoWorkspace.state[1] = acadoVariables.x[index * 6 + 1]; -acadoWorkspace.state[2] = acadoVariables.x[index * 6 + 2]; -acadoWorkspace.state[3] = acadoVariables.x[index * 6 + 3]; -acadoWorkspace.state[4] = acadoVariables.x[index * 6 + 4]; -acadoWorkspace.state[5] = acadoVariables.x[index * 6 + 5]; -acadoWorkspace.state[48] = acadoVariables.u[index]; -acadoWorkspace.state[49] = acadoVariables.od[index]; - -acado_integrate(acadoWorkspace.state, index == 0, index); - -acadoVariables.x[index * 6 + 6] = acadoWorkspace.state[0]; -acadoVariables.x[index * 6 + 7] = acadoWorkspace.state[1]; -acadoVariables.x[index * 6 + 8] = acadoWorkspace.state[2]; -acadoVariables.x[index * 6 + 9] = acadoWorkspace.state[3]; -acadoVariables.x[index * 6 + 10] = acadoWorkspace.state[4]; -acadoVariables.x[index * 6 + 11] = acadoWorkspace.state[5]; -} -} - -void acado_shiftStates( int strategy, real_t* const xEnd, real_t* const uEnd ) -{ -int index; -for (index = 0; index < 20; ++index) -{ -acadoVariables.x[index * 6] = acadoVariables.x[index * 6 + 6]; -acadoVariables.x[index * 6 + 1] = acadoVariables.x[index * 6 + 7]; -acadoVariables.x[index * 6 + 2] = acadoVariables.x[index * 6 + 8]; -acadoVariables.x[index * 6 + 3] = acadoVariables.x[index * 6 + 9]; -acadoVariables.x[index * 6 + 4] = acadoVariables.x[index * 6 + 10]; -acadoVariables.x[index * 6 + 5] = acadoVariables.x[index * 6 + 11]; -} - -if (strategy == 1 && xEnd != 0) -{ -acadoVariables.x[120] = xEnd[0]; -acadoVariables.x[121] = xEnd[1]; -acadoVariables.x[122] = xEnd[2]; -acadoVariables.x[123] = xEnd[3]; -acadoVariables.x[124] = xEnd[4]; -acadoVariables.x[125] = xEnd[5]; -} -else if (strategy == 2) -{ -acadoWorkspace.state[0] = acadoVariables.x[120]; -acadoWorkspace.state[1] = acadoVariables.x[121]; -acadoWorkspace.state[2] = acadoVariables.x[122]; -acadoWorkspace.state[3] = acadoVariables.x[123]; -acadoWorkspace.state[4] = acadoVariables.x[124]; -acadoWorkspace.state[5] = acadoVariables.x[125]; -if (uEnd != 0) -{ -acadoWorkspace.state[48] = uEnd[0]; -} -else -{ -acadoWorkspace.state[48] = acadoVariables.u[19]; -} -acadoWorkspace.state[49] = acadoVariables.od[20]; - -acado_integrate(acadoWorkspace.state, 1, 19); - -acadoVariables.x[120] = acadoWorkspace.state[0]; -acadoVariables.x[121] = acadoWorkspace.state[1]; -acadoVariables.x[122] = acadoWorkspace.state[2]; -acadoVariables.x[123] = acadoWorkspace.state[3]; -acadoVariables.x[124] = acadoWorkspace.state[4]; -acadoVariables.x[125] = acadoWorkspace.state[5]; -} -} - -void acado_shiftControls( real_t* const uEnd ) -{ -int index; -for (index = 0; index < 19; ++index) -{ -acadoVariables.u[index] = acadoVariables.u[index + 1]; -} - -if (uEnd != 0) -{ -acadoVariables.u[19] = uEnd[0]; -} -} - -real_t acado_getKKT( ) -{ -real_t kkt; - -int index; -real_t prd; - -kkt = + acadoWorkspace.g[0]*acadoWorkspace.x[0] + acadoWorkspace.g[1]*acadoWorkspace.x[1] + acadoWorkspace.g[2]*acadoWorkspace.x[2] + acadoWorkspace.g[3]*acadoWorkspace.x[3] + acadoWorkspace.g[4]*acadoWorkspace.x[4] + acadoWorkspace.g[5]*acadoWorkspace.x[5] + acadoWorkspace.g[6]*acadoWorkspace.x[6] + acadoWorkspace.g[7]*acadoWorkspace.x[7] + acadoWorkspace.g[8]*acadoWorkspace.x[8] + acadoWorkspace.g[9]*acadoWorkspace.x[9] + acadoWorkspace.g[10]*acadoWorkspace.x[10] + acadoWorkspace.g[11]*acadoWorkspace.x[11] + acadoWorkspace.g[12]*acadoWorkspace.x[12] + acadoWorkspace.g[13]*acadoWorkspace.x[13] + acadoWorkspace.g[14]*acadoWorkspace.x[14] + acadoWorkspace.g[15]*acadoWorkspace.x[15] + acadoWorkspace.g[16]*acadoWorkspace.x[16] + acadoWorkspace.g[17]*acadoWorkspace.x[17] + acadoWorkspace.g[18]*acadoWorkspace.x[18] + acadoWorkspace.g[19]*acadoWorkspace.x[19] + acadoWorkspace.g[20]*acadoWorkspace.x[20] + acadoWorkspace.g[21]*acadoWorkspace.x[21] + acadoWorkspace.g[22]*acadoWorkspace.x[22] + acadoWorkspace.g[23]*acadoWorkspace.x[23] + acadoWorkspace.g[24]*acadoWorkspace.x[24] + acadoWorkspace.g[25]*acadoWorkspace.x[25]; -kkt = fabs( kkt ); -for (index = 0; index < 26; ++index) -{ -prd = acadoWorkspace.y[index]; -if (prd > 1e-12) -kkt += fabs(acadoWorkspace.lb[index] * prd); -else if (prd < -1e-12) -kkt += fabs(acadoWorkspace.ub[index] * prd); -} -for (index = 0; index < 20; ++index) -{ -prd = acadoWorkspace.y[index + 26]; -if (prd > 1e-12) -kkt += fabs(acadoWorkspace.lbA[index] * prd); -else if (prd < -1e-12) -kkt += fabs(acadoWorkspace.ubA[index] * prd); -} -return kkt; -} - -real_t acado_getObjective( ) -{ -real_t objVal; - -int lRun1; -/** Row vector of size: 4 */ -real_t tmpDy[ 4 ]; - -/** Row vector of size: 3 */ -real_t tmpDyN[ 3 ]; - -for (lRun1 = 0; lRun1 < 20; ++lRun1) -{ -acadoWorkspace.objValueIn[0] = acadoVariables.x[lRun1 * 6]; -acadoWorkspace.objValueIn[1] = acadoVariables.x[lRun1 * 6 + 1]; -acadoWorkspace.objValueIn[2] = acadoVariables.x[lRun1 * 6 + 2]; -acadoWorkspace.objValueIn[3] = acadoVariables.x[lRun1 * 6 + 3]; -acadoWorkspace.objValueIn[4] = acadoVariables.x[lRun1 * 6 + 4]; -acadoWorkspace.objValueIn[5] = acadoVariables.x[lRun1 * 6 + 5]; -acadoWorkspace.objValueIn[6] = acadoVariables.u[lRun1]; -acadoWorkspace.objValueIn[7] = acadoVariables.od[lRun1]; - -acado_evaluateLSQ( acadoWorkspace.objValueIn, acadoWorkspace.objValueOut ); -acadoWorkspace.Dy[lRun1 * 4] = acadoWorkspace.objValueOut[0] - acadoVariables.y[lRun1 * 4]; -acadoWorkspace.Dy[lRun1 * 4 + 1] = acadoWorkspace.objValueOut[1] - acadoVariables.y[lRun1 * 4 + 1]; -acadoWorkspace.Dy[lRun1 * 4 + 2] = acadoWorkspace.objValueOut[2] - acadoVariables.y[lRun1 * 4 + 2]; -acadoWorkspace.Dy[lRun1 * 4 + 3] = acadoWorkspace.objValueOut[3] - acadoVariables.y[lRun1 * 4 + 3]; -} -acadoWorkspace.objValueIn[0] = acadoVariables.x[120]; -acadoWorkspace.objValueIn[1] = acadoVariables.x[121]; -acadoWorkspace.objValueIn[2] = acadoVariables.x[122]; -acadoWorkspace.objValueIn[3] = acadoVariables.x[123]; -acadoWorkspace.objValueIn[4] = acadoVariables.x[124]; -acadoWorkspace.objValueIn[5] = acadoVariables.x[125]; -acadoWorkspace.objValueIn[6] = acadoVariables.od[20]; -acado_evaluateLSQEndTerm( acadoWorkspace.objValueIn, acadoWorkspace.objValueOut ); -acadoWorkspace.DyN[0] = acadoWorkspace.objValueOut[0] - acadoVariables.yN[0]; -acadoWorkspace.DyN[1] = acadoWorkspace.objValueOut[1] - acadoVariables.yN[1]; -acadoWorkspace.DyN[2] = acadoWorkspace.objValueOut[2] - acadoVariables.yN[2]; -objVal = 0.0000000000000000e+00; -for (lRun1 = 0; lRun1 < 20; ++lRun1) -{ -tmpDy[0] = + acadoWorkspace.Dy[lRun1 * 4]*acadoVariables.W[lRun1 * 16] + acadoWorkspace.Dy[lRun1 * 4 + 1]*acadoVariables.W[lRun1 * 16 + 4] + acadoWorkspace.Dy[lRun1 * 4 + 2]*acadoVariables.W[lRun1 * 16 + 8] + acadoWorkspace.Dy[lRun1 * 4 + 3]*acadoVariables.W[lRun1 * 16 + 12]; -tmpDy[1] = + acadoWorkspace.Dy[lRun1 * 4]*acadoVariables.W[lRun1 * 16 + 1] + acadoWorkspace.Dy[lRun1 * 4 + 1]*acadoVariables.W[lRun1 * 16 + 5] + acadoWorkspace.Dy[lRun1 * 4 + 2]*acadoVariables.W[lRun1 * 16 + 9] + acadoWorkspace.Dy[lRun1 * 4 + 3]*acadoVariables.W[lRun1 * 16 + 13]; -tmpDy[2] = + acadoWorkspace.Dy[lRun1 * 4]*acadoVariables.W[lRun1 * 16 + 2] + acadoWorkspace.Dy[lRun1 * 4 + 1]*acadoVariables.W[lRun1 * 16 + 6] + acadoWorkspace.Dy[lRun1 * 4 + 2]*acadoVariables.W[lRun1 * 16 + 10] + acadoWorkspace.Dy[lRun1 * 4 + 3]*acadoVariables.W[lRun1 * 16 + 14]; -tmpDy[3] = + acadoWorkspace.Dy[lRun1 * 4]*acadoVariables.W[lRun1 * 16 + 3] + acadoWorkspace.Dy[lRun1 * 4 + 1]*acadoVariables.W[lRun1 * 16 + 7] + acadoWorkspace.Dy[lRun1 * 4 + 2]*acadoVariables.W[lRun1 * 16 + 11] + acadoWorkspace.Dy[lRun1 * 4 + 3]*acadoVariables.W[lRun1 * 16 + 15]; -objVal += + acadoWorkspace.Dy[lRun1 * 4]*tmpDy[0] + acadoWorkspace.Dy[lRun1 * 4 + 1]*tmpDy[1] + acadoWorkspace.Dy[lRun1 * 4 + 2]*tmpDy[2] + acadoWorkspace.Dy[lRun1 * 4 + 3]*tmpDy[3]; -} - -tmpDyN[0] = + acadoWorkspace.DyN[0]*acadoVariables.WN[0] + acadoWorkspace.DyN[1]*acadoVariables.WN[3] + acadoWorkspace.DyN[2]*acadoVariables.WN[6]; -tmpDyN[1] = + acadoWorkspace.DyN[0]*acadoVariables.WN[1] + acadoWorkspace.DyN[1]*acadoVariables.WN[4] + acadoWorkspace.DyN[2]*acadoVariables.WN[7]; -tmpDyN[2] = + acadoWorkspace.DyN[0]*acadoVariables.WN[2] + acadoWorkspace.DyN[1]*acadoVariables.WN[5] + acadoWorkspace.DyN[2]*acadoVariables.WN[8]; -objVal += + acadoWorkspace.DyN[0]*tmpDyN[0] + acadoWorkspace.DyN[1]*tmpDyN[1] + acadoWorkspace.DyN[2]*tmpDyN[2]; - -objVal *= 0.5; -return objVal; -} - diff --git a/selfdrive/controls/lib/model_parser.py b/selfdrive/controls/lib/model_parser.py new file mode 100644 index 00000000000000..747e918f750a86 --- /dev/null +++ b/selfdrive/controls/lib/model_parser.py @@ -0,0 +1,65 @@ +from common.numpy_fast import interp +from selfdrive.controls.lib.latcontrol_helpers import model_polyfit, calc_desired_path, compute_path_pinv + +CAMERA_OFFSET = 0.06 # m from center car to camera + + +class ModelParser(object): + def __init__(self): + self.d_poly = [0., 0., 0., 0.] + self.c_poly = [0., 0., 0., 0.] + self.c_prob = 0. + self.last_model = 0. + self.lead_dist, self.lead_prob, self.lead_var = 0, 0, 1 + self._path_pinv = compute_path_pinv() + + self.lane_width_estimate = 3.7 + self.lane_width_certainty = 1.0 + self.lane_width = 3.7 + self.l_prob = 0. + self.r_prob = 0. + + def update(self, v_ego, md): + if md is not None: + p_poly = model_polyfit(md.model.path.points, self._path_pinv) # predicted path + l_poly = model_polyfit(md.model.leftLane.points, self._path_pinv) # left line + r_poly = model_polyfit(md.model.rightLane.points, self._path_pinv) # right line + + # only offset left and right lane lines; offsetting p_poly does not make sense + l_poly[3] += CAMERA_OFFSET + r_poly[3] += CAMERA_OFFSET + + p_prob = 1. # model does not tell this probability yet, so set to 1 for now + l_prob = md.model.leftLane.prob # left line prob + r_prob = md.model.rightLane.prob # right line prob + + # Find current lanewidth + lr_prob = l_prob * r_prob + self.lane_width_certainty += 0.05 * (lr_prob - self.lane_width_certainty) + current_lane_width = abs(l_poly[3] - r_poly[3]) + self.lane_width_estimate += 0.005 * (current_lane_width - self.lane_width_estimate) + speed_lane_width = interp(v_ego, [0., 31.], [3., 3.8]) + self.lane_width = self.lane_width_certainty * self.lane_width_estimate + \ + (1 - self.lane_width_certainty) * speed_lane_width + + lane_width_diff = abs(self.lane_width - current_lane_width) + lane_r_prob = interp(lane_width_diff, [0.3, 1.0], [1.0, 0.0]) + + r_prob *= lane_r_prob + + self.lead_dist = md.model.lead.dist + self.lead_prob = md.model.lead.prob + self.lead_var = md.model.lead.std**2 + + # compute target path + self.d_poly, self.c_poly, self.c_prob = calc_desired_path( + l_poly, r_poly, p_poly, l_prob, r_prob, p_prob, v_ego, self.lane_width) + + self.r_poly = r_poly + self.r_prob = r_prob + + self.l_poly = l_poly + self.l_prob = l_prob + + self.p_poly = p_poly + self.p_prob = p_prob diff --git a/selfdrive/controls/lib/pathplanner.py b/selfdrive/controls/lib/pathplanner.py index 178b5e6dbb2de4..0161d2f94633a0 100644 --- a/selfdrive/controls/lib/pathplanner.py +++ b/selfdrive/controls/lib/pathplanner.py @@ -1,62 +1,131 @@ -from common.numpy_fast import interp -from selfdrive.controls.lib.latcontrol_helpers import model_polyfit, calc_desired_path, compute_path_pinv +import zmq +import math +import numpy as np + +from common.realtime import sec_since_boot +from selfdrive.services import service_list +from selfdrive.swaglog import cloudlog +from selfdrive.controls.lib.lateral_mpc import libmpc_py +from selfdrive.controls.lib.drive_helpers import MPC_COST_LAT +from selfdrive.controls.lib.model_parser import ModelParser +import selfdrive.messaging as messaging + + +def calc_states_after_delay(states, v_ego, steer_angle, curvature_factor, steer_ratio, delay): + states[0].x = v_ego * delay + states[0].psi = v_ego * curvature_factor * math.radians(steer_angle) / steer_ratio * delay + return states -CAMERA_OFFSET = 0.06 # m from center car to camera class PathPlanner(object): - def __init__(self): - self.d_poly = [0., 0., 0., 0.] - self.c_poly = [0., 0., 0., 0.] - self.c_prob = 0. - self.last_model = 0. - self.lead_dist, self.lead_prob, self.lead_var = 0, 0, 1 - self._path_pinv = compute_path_pinv() - - self.lane_width_estimate = 3.7 - self.lane_width_certainty = 1.0 - self.lane_width = 3.7 - - def update(self, v_ego, md): - if md is not None: - p_poly = model_polyfit(md.model.path.points, self._path_pinv) # predicted path - l_poly = model_polyfit(md.model.leftLane.points, self._path_pinv) # left line - r_poly = model_polyfit(md.model.rightLane.points, self._path_pinv) # right line - - # only offset left and right lane lines; offsetting p_poly does not make sense - l_poly[3] += CAMERA_OFFSET - r_poly[3] += CAMERA_OFFSET - - p_prob = 1. # model does not tell this probability yet, so set to 1 for now - l_prob = md.model.leftLane.prob # left line prob - r_prob = md.model.rightLane.prob # right line prob - - # Find current lanewidth - lr_prob = l_prob * r_prob - self.lane_width_certainty += 0.05 * (lr_prob - self.lane_width_certainty) - current_lane_width = abs(l_poly[3] - r_poly[3]) - self.lane_width_estimate += 0.005 * (current_lane_width - self.lane_width_estimate) - speed_lane_width = interp(v_ego, [0., 31.], [3., 3.8]) - self.lane_width = self.lane_width_certainty * self.lane_width_estimate + \ - (1 - self.lane_width_certainty) * speed_lane_width - - lane_width_diff = abs(self.lane_width - current_lane_width) - lane_r_prob = interp(lane_width_diff, [0.3, 1.0], [1.0, 0.0]) - - r_prob *= lane_r_prob - - self.lead_dist = md.model.lead.dist - self.lead_prob = md.model.lead.prob - self.lead_var = md.model.lead.std**2 - - # compute target path - self.d_poly, self.c_poly, self.c_prob = calc_desired_path( - l_poly, r_poly, p_poly, l_prob, r_prob, p_prob, v_ego, self.lane_width) - - self.r_poly = r_poly - self.r_prob = r_prob - - self.l_poly = l_poly - self.l_prob = l_prob - - self.p_poly = p_poly - self.p_prob = p_prob + def __init__(self, CP): + self.MP = ModelParser() + + self.last_cloudlog_t = 0 + + context = zmq.Context() + self.plan = messaging.pub_sock(context, service_list['pathPlan'].port) + self.livempc = messaging.pub_sock(context, service_list['liveMpc'].port) + + self.setup_mpc(CP.steerRateCost) + self.invalid_counter = 0 + + def setup_mpc(self, steer_rate_cost): + self.libmpc = libmpc_py.libmpc + self.libmpc.init(MPC_COST_LAT.PATH, MPC_COST_LAT.LANE, MPC_COST_LAT.HEADING, steer_rate_cost) + + self.mpc_solution = libmpc_py.ffi.new("log_t *") + self.cur_state = libmpc_py.ffi.new("state_t *") + self.cur_state[0].x = 0.0 + self.cur_state[0].y = 0.0 + self.cur_state[0].psi = 0.0 + self.cur_state[0].delta = 0.0 + + self.angle_steers_des = 0.0 + self.angle_steers_des_mpc = 0.0 + self.angle_steers_des_prev = 0.0 + self.angle_steers_des_time = 0.0 + + def update(self, CP, VM, CS, md, live100, live_parameters): + v_ego = CS.carState.vEgo + angle_steers = CS.carState.steeringAngle + active = live100.live100.active + + angle_offset_bias = live100.live100.angleModelBias + live_parameters.liveParameters.angleOffsetAverage + + self.MP.update(v_ego, md) + + # Run MPC + self.angle_steers_des_prev = self.angle_steers_des_mpc + VM.update_params(live_parameters.liveParameters.stiffnessFactor, live_parameters.liveParameters.steerRatio) + curvature_factor = VM.curvature_factor(v_ego) + + l_poly = libmpc_py.ffi.new("double[4]", list(self.MP.l_poly)) + r_poly = libmpc_py.ffi.new("double[4]", list(self.MP.r_poly)) + p_poly = libmpc_py.ffi.new("double[4]", list(self.MP.p_poly)) + + # account for actuation delay + self.cur_state = calc_states_after_delay(self.cur_state, v_ego, angle_steers, curvature_factor, VM.sR, CP.steerActuatorDelay) + + v_ego_mpc = max(v_ego, 5.0) # avoid mpc roughness due to low speed + self.libmpc.run_mpc(self.cur_state, self.mpc_solution, + l_poly, r_poly, p_poly, + self.MP.l_prob, self.MP.r_prob, self.MP.p_prob, curvature_factor, v_ego_mpc, self.MP.lane_width) + + # reset to current steer angle if not active or overriding + if active: + delta_desired = self.mpc_solution[0].delta[1] + rate_desired = math.degrees(self.mpc_solution[0].rate[0] * VM.sR) + else: + delta_desired = math.radians(angle_steers - angle_offset_bias) / VM.sR + rate_desired = 0.0 + + self.cur_state[0].delta = delta_desired + + self.angle_steers_des_mpc = float(math.degrees(delta_desired * VM.sR) + angle_offset_bias) + + + # Check for infeasable MPC solution + mpc_nans = np.any(np.isnan(list(self.mpc_solution[0].delta))) + t = sec_since_boot() + if mpc_nans: + self.libmpc.init(MPC_COST_LAT.PATH, MPC_COST_LAT.LANE, MPC_COST_LAT.HEADING, CP.steerRateCost) + self.cur_state[0].delta = math.radians(angle_steers) / VM.sR + + if t > self.last_cloudlog_t + 5.0: + self.last_cloudlog_t = t + cloudlog.warning("Lateral mpc - nan: True") + + if self.mpc_solution[0].cost > 20000. or mpc_nans: # TODO: find a better way to detect when MPC did not converge + self.invalid_counter += 1 + else: + self.invalid_counter = 0 + + plan_valid = self.invalid_counter < 2 + + plan_send = messaging.new_message() + plan_send.init('pathPlan') + plan_send.pathPlan.laneWidth = float(self.MP.lane_width) + plan_send.pathPlan.dPoly = map(float, self.MP.d_poly) + plan_send.pathPlan.cPoly = map(float, self.MP.c_poly) + plan_send.pathPlan.cProb = float(self.MP.c_prob) + plan_send.pathPlan.lPoly = map(float, l_poly) + plan_send.pathPlan.lProb = float(self.MP.l_prob) + plan_send.pathPlan.rPoly = map(float, r_poly) + plan_send.pathPlan.rProb = float(self.MP.r_prob) + plan_send.pathPlan.angleSteers = float(self.angle_steers_des_mpc) + plan_send.pathPlan.rateSteers = float(rate_desired) + plan_send.pathPlan.angleOffset = float(live_parameters.liveParameters.angleOffsetAverage) + plan_send.pathPlan.valid = bool(plan_valid) + plan_send.pathPlan.paramsValid = bool(live_parameters.liveParameters.valid) + + self.plan.send(plan_send.to_bytes()) + + dat = messaging.new_message() + dat.init('liveMpc') + dat.liveMpc.x = list(self.mpc_solution[0].x) + dat.liveMpc.y = list(self.mpc_solution[0].y) + dat.liveMpc.psi = list(self.mpc_solution[0].psi) + dat.liveMpc.delta = list(self.mpc_solution[0].delta) + dat.liveMpc.cost = self.mpc_solution[0].cost + self.livempc.send(dat.to_bytes()) diff --git a/selfdrive/controls/lib/planner.py b/selfdrive/controls/lib/planner.py index 11d1d847db08ad..c26711f57e8b21 100755 --- a/selfdrive/controls/lib/planner.py +++ b/selfdrive/controls/lib/planner.py @@ -1,30 +1,25 @@ #!/usr/bin/env python -import os import zmq - -import numpy as np import math -from collections import defaultdict - -from common.realtime import sec_since_boot +import numpy as np +from common.params import Params from common.numpy_fast import interp + import selfdrive.messaging as messaging from selfdrive.swaglog import cloudlog from selfdrive.config import Conversions as CV from selfdrive.services import service_list -from selfdrive.controls.lib.drive_helpers import create_event, MPC_COST_LONG, EventTypes as ET -from selfdrive.controls.lib.pathplanner import PathPlanner -from selfdrive.controls.lib.longitudinal_mpc import libmpc_py +from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET from selfdrive.controls.lib.speed_smoother import speed_smoother from selfdrive.controls.lib.longcontrol import LongCtrlState, MIN_CAN_SPEED +from selfdrive.controls.lib.fcw import FCWChecker +from selfdrive.controls.lib.long_mpc import LongitudinalMpc + +NO_CURVATURE_SPEED = 200. * CV.MPH_TO_MS -_DT = 0.01 # 100Hz _DT_MPC = 0.2 # 5Hz MAX_SPEED_ERROR = 2.0 AWARENESS_DECEL = -0.2 # car smoothly decel at .2m/s^2 when user is distracted -_LEAD_ACCEL_TAU = 1.5 - -GPS_PLANNER_ADDR = "192.168.5.1" # lookup tables VS speed to determine min and max accels in cruise # make sure these accelerations are smaller than mpc limits @@ -41,12 +36,6 @@ _A_TOTAL_MAX_V = [1.5, 1.9, 3.2] _A_TOTAL_MAX_BP = [0., 20., 40.] -_FCW_A_ACT_V = [-3., -2.] -_FCW_A_ACT_BP = [0., 30.] - -# max acceleration allowed in acc, which happens in restart -A_ACC_MAX = max(_A_CRUISE_MAX_V_FOLLOWING) - def calc_cruise_accel_limits(v_ego, following): a_cruise_min = interp(v_ego, _A_CRUISE_MIN_BP, _A_CRUISE_MIN_V) @@ -72,237 +61,32 @@ def limit_accel_in_turns(v_ego, angle_steers, a_target, CP): return a_target -class FCWChecker(object): - def __init__(self): - self.reset_lead(0.0) - - def reset_lead(self, cur_time): - self.last_fcw_a = 0.0 - self.v_lead_max = 0.0 - self.lead_seen_t = cur_time - self.last_fcw_time = 0.0 - self.last_min_a = 0.0 - - self.counters = defaultdict(lambda: 0) - - @staticmethod - def calc_ttc(v_ego, a_ego, x_lead, v_lead, a_lead): - max_ttc = 5.0 - - v_rel = v_ego - v_lead - a_rel = a_ego - a_lead - - # assuming that closing gap ARel comes from lead vehicle decel, - # then limit ARel so that v_lead will get to zero in no sooner than t_decel. - # This helps underweighting ARel when v_lead is close to zero. - t_decel = 2. - a_rel = np.minimum(a_rel, v_lead/t_decel) - - # delta of the quadratic equation to solve for ttc - delta = v_rel**2 + 2 * x_lead * a_rel - - # assign an arbitrary high ttc value if there is no solution to ttc - if delta < 0.1 or (np.sqrt(delta) + v_rel < 0.1): - ttc = max_ttc - else: - ttc = np.minimum(2 * x_lead / (np.sqrt(delta) + v_rel), max_ttc) - return ttc - - def update(self, mpc_solution, cur_time, v_ego, a_ego, x_lead, v_lead, a_lead, y_lead, vlat_lead, fcw_lead, blinkers): - mpc_solution_a = list(mpc_solution[0].a_ego) - self.last_min_a = min(mpc_solution_a) - self.v_lead_max = max(self.v_lead_max, v_lead) - - if (fcw_lead > 0.99): - ttc = self.calc_ttc(v_ego, a_ego, x_lead, v_lead, a_lead) - self.counters['v_ego'] = self.counters['v_ego'] + 1 if v_ego > 5.0 else 0 - self.counters['ttc'] = self.counters['ttc'] + 1 if ttc < 2.5 else 0 - self.counters['v_lead_max'] = self.counters['v_lead_max'] + 1 if self.v_lead_max > 2.5 else 0 - self.counters['v_ego_lead'] = self.counters['v_ego_lead'] + 1 if v_ego > v_lead else 0 - self.counters['lead_seen'] = self.counters['lead_seen'] + 0.33 - self.counters['y_lead'] = self.counters['y_lead'] + 1 if abs(y_lead) < 1.0 else 0 - self.counters['vlat_lead'] = self.counters['vlat_lead'] + 1 if abs(vlat_lead) < 0.4 else 0 - self.counters['blinkers'] = self.counters['blinkers'] + 10.0 / (20 * 3.0) if not blinkers else 0 - - a_thr = interp(v_lead, _FCW_A_ACT_BP, _FCW_A_ACT_V) - a_delta = min(mpc_solution_a[:15]) - min(0.0, a_ego) - - fcw_allowed = all(c >= 10 for c in self.counters.values()) - if (self.last_min_a < -3.0 or a_delta < a_thr) and fcw_allowed and self.last_fcw_time + 5.0 < cur_time: - self.last_fcw_time = cur_time - self.last_fcw_a = self.last_min_a - return True - - return False - - -class LongitudinalMpc(object): - def __init__(self, mpc_id, live_longitudinal_mpc): - self.live_longitudinal_mpc = live_longitudinal_mpc - self.mpc_id = mpc_id - - self.setup_mpc() - self.v_mpc = 0.0 - self.v_mpc_future = 0.0 - self.a_mpc = 0.0 - self.v_cruise = 0.0 - self.prev_lead_status = False - self.prev_lead_x = 0.0 - self.new_lead = False - - self.last_cloudlog_t = 0.0 - - def send_mpc_solution(self, qp_iterations, calculation_time): - qp_iterations = max(0, qp_iterations) - dat = messaging.new_message() - dat.init('liveLongitudinalMpc') - dat.liveLongitudinalMpc.xEgo = list(self.mpc_solution[0].x_ego) - dat.liveLongitudinalMpc.vEgo = list(self.mpc_solution[0].v_ego) - dat.liveLongitudinalMpc.aEgo = list(self.mpc_solution[0].a_ego) - dat.liveLongitudinalMpc.xLead = list(self.mpc_solution[0].x_l) - dat.liveLongitudinalMpc.vLead = list(self.mpc_solution[0].v_l) - dat.liveLongitudinalMpc.aLead = list(self.mpc_solution[0].a_l) - dat.liveLongitudinalMpc.cost = self.mpc_solution[0].cost - dat.liveLongitudinalMpc.aLeadTau = self.l - dat.liveLongitudinalMpc.qpIterations = qp_iterations - dat.liveLongitudinalMpc.mpcId = self.mpc_id - dat.liveLongitudinalMpc.calculationTime = calculation_time - self.live_longitudinal_mpc.send(dat.to_bytes()) - - def setup_mpc(self): - ffi, self.libmpc = libmpc_py.get_libmpc(self.mpc_id) - self.libmpc.init(MPC_COST_LONG.TTC, MPC_COST_LONG.DISTANCE, - MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK) - - self.mpc_solution = ffi.new("log_t *") - self.cur_state = ffi.new("state_t *") - self.cur_state[0].v_ego = 0 - self.cur_state[0].a_ego = 0 - self.l = _LEAD_ACCEL_TAU - - def set_cur_state(self, v, a): - self.cur_state[0].v_ego = v - self.cur_state[0].a_ego = a - - def update(self, CS, lead, v_cruise_setpoint): - # Setup current mpc state - self.cur_state[0].x_ego = 0.0 - - if lead is not None and lead.status: - x_lead = lead.dRel - v_lead = max(0.0, lead.vLead) - a_lead = lead.aLeadK - - if (v_lead < 0.1 or -a_lead / 2.0 > v_lead): - v_lead = 0.0 - a_lead = 0.0 - - # Learn if constant acceleration - if abs(a_lead) < 0.5: - self.l = _LEAD_ACCEL_TAU - else: - self.l *= 0.9 - - l = max(self.l, -a_lead / (v_lead + 0.01)) - self.new_lead = False - if not self.prev_lead_status or abs(x_lead - self.prev_lead_x) > 2.5: - self.libmpc.init_with_simulation(self.v_mpc, x_lead, v_lead, a_lead, l) - self.new_lead = True - - self.prev_lead_status = True - self.prev_lead_x = x_lead - self.cur_state[0].x_l = x_lead - self.cur_state[0].v_l = v_lead - self.cur_state[0].a_l = a_lead - else: - self.prev_lead_status = False - # Fake a fast lead car, so mpc keeps running - self.cur_state[0].x_l = 50.0 - self.cur_state[0].v_l = CS.vEgo + 10.0 - self.cur_state[0].a_l = 0.0 - l = _LEAD_ACCEL_TAU - - # Calculate mpc - t = sec_since_boot() - n_its = self.libmpc.run_mpc(self.cur_state, self.mpc_solution, l) - duration = int((sec_since_boot() - t) * 1e9) - self.send_mpc_solution(n_its, duration) - - # Get solution. MPC timestep is 0.2 s, so interpolation to 0.05 s is needed - self.v_mpc = self.mpc_solution[0].v_ego[1] - self.a_mpc = self.mpc_solution[0].a_ego[1] - self.v_mpc_future = self.mpc_solution[0].v_ego[10] - - # Reset if NaN or goes through lead car - dls = np.array(list(self.mpc_solution[0].x_l)) - np.array(list(self.mpc_solution[0].x_ego)) - crashing = min(dls) < -50.0 - nans = np.any(np.isnan(list(self.mpc_solution[0].v_ego))) - backwards = min(list(self.mpc_solution[0].v_ego)) < -0.01 - - if ((backwards or crashing) and self.prev_lead_status) or nans: - if t > self.last_cloudlog_t + 5.0: - self.last_cloudlog_t = t - cloudlog.warning("Longitudinal mpc %d reset - backwards: %s crashing: %s nan: %s" % ( - self.mpc_id, backwards, crashing, nans)) - - self.libmpc.init(MPC_COST_LONG.TTC, MPC_COST_LONG.DISTANCE, - MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK) - self.cur_state[0].v_ego = CS.vEgo - self.cur_state[0].a_ego = 0.0 - self.v_mpc = CS.vEgo - self.a_mpc = CS.aEgo - self.prev_lead_status = False - - class Planner(object): def __init__(self, CP, fcw_enabled): context = zmq.Context() self.CP = CP self.poller = zmq.Poller() - self.live20 = messaging.sub_sock(context, service_list['live20'].port, conflate=True, poller=self.poller) - self.model = messaging.sub_sock(context, service_list['model'].port, conflate=True, poller=self.poller) - - if os.environ.get('GPS_PLANNER_ACTIVE', False): - self.gps_planner_plan = messaging.sub_sock(context, service_list['gpsPlannerPlan'].port, conflate=True, poller=self.poller, addr=GPS_PLANNER_ADDR) - else: - self.gps_planner_plan = None self.plan = messaging.pub_sock(context, service_list['plan'].port) self.live_longitudinal_mpc = messaging.pub_sock(context, service_list['liveLongitudinalMpc'].port) - self.last_md_ts = 0 - self.last_l20_ts = 0 - self.last_model = 0. - self.last_l20 = 0. - self.model_dead = True - self.radar_dead = True - self.radar_errors = [] - - self.PP = PathPlanner() self.mpc1 = LongitudinalMpc(1, self.live_longitudinal_mpc) self.mpc2 = LongitudinalMpc(2, self.live_longitudinal_mpc) self.v_acc_start = 0.0 self.a_acc_start = 0.0 - self.acc_start_time = sec_since_boot() + self.v_acc = 0.0 - self.v_acc_sol = 0.0 self.v_acc_future = 0.0 self.a_acc = 0.0 - self.a_acc_sol = 0.0 self.v_cruise = 0.0 self.a_cruise = 0.0 - self.lead_1 = None - self.lead_2 = None - self.longitudinalPlanSource = 'cruise' - self.fcw = False self.fcw_checker = FCWChecker() self.fcw_enabled = fcw_enabled - self.last_gps_planner_plan = None - self.gps_planner_active = False + self.params = Params() def choose_solution(self, v_cruise_setpoint, enabled): if enabled: @@ -314,12 +98,6 @@ def choose_solution(self, v_cruise_setpoint, enabled): slowest = min(solutions, key=solutions.get) - """ - print "D_SOL", solutions, slowest, self.v_acc_sol, self.a_acc_sol - print "D_V", self.mpc1.v_mpc, self.mpc2.v_mpc, self.v_cruise - print "D_A", self.mpc1.a_mpc, self.mpc2.a_mpc, self.a_cruise - """ - self.longitudinalPlanSource = slowest # Choose lowest of MPC and cruise @@ -335,163 +113,144 @@ def choose_solution(self, v_cruise_setpoint, enabled): self.v_acc_future = min([self.mpc1.v_mpc_future, self.mpc2.v_mpc_future, v_cruise_setpoint]) - # this runs whenever we get a packet that can change the plan - def update(self, CS, LaC, LoC, v_cruise_kph, force_slow_decel): - cur_time = sec_since_boot() + def update(self, CS, CP, VM, PP, live20, live100, md, live_map_data): + """Gets called when new live20 is available""" + cur_time = live20.logMonoTime / 1e9 + v_ego = CS.carState.vEgo + + long_control_state = live100.live100.longControlState + v_cruise_kph = live100.live100.vCruise + force_slow_decel = live100.live100.forceDecel v_cruise_setpoint = v_cruise_kph * CV.KPH_TO_MS - md = None - l20 = None - gps_planner_plan = None - - for socket, event in self.poller.poll(0): - if socket is self.model: - md = messaging.recv_one(socket) - elif socket is self.live20: - l20 = messaging.recv_one(socket) - elif socket is self.gps_planner_plan: - gps_planner_plan = messaging.recv_one(socket) - - if gps_planner_plan is not None: - self.last_gps_planner_plan = gps_planner_plan - - if md is not None: - self.last_md_ts = md.logMonoTime - self.last_model = cur_time - self.model_dead = False - - self.PP.update(CS.vEgo, md) - - if self.last_gps_planner_plan is not None: - plan = self.last_gps_planner_plan.gpsPlannerPlan - self.gps_planner_active = plan.valid - if plan.valid: - self.PP.d_poly = plan.poly - self.PP.p_poly = plan.poly - self.PP.c_poly = plan.poly - self.PP.l_prob = 0.0 - self.PP.r_prob = 0.0 - self.PP.c_prob = 1.0 - - if l20 is not None: - self.last_l20_ts = l20.logMonoTime - self.last_l20 = cur_time - self.radar_dead = False - self.radar_errors = list(l20.live20.radarErrors) - - self.v_acc_start = self.v_acc_sol - self.a_acc_start = self.a_acc_sol - self.acc_start_time = cur_time - - self.lead_1 = l20.live20.leadOne - self.lead_2 = l20.live20.leadTwo - - enabled = (LoC.long_control_state == LongCtrlState.pid) or (LoC.long_control_state == LongCtrlState.stopping) - following = self.lead_1.status and self.lead_1.dRel < 45.0 and self.lead_1.vLeadK > CS.vEgo and self.lead_1.aLeadK > 0.0 - - # Calculate speed for normal cruise control - if enabled: - - accel_limits = map(float, calc_cruise_accel_limits(CS.vEgo, following)) - # TODO: make a separate lookup for jerk tuning - jerk_limits = [min(-0.1, accel_limits[0]), max(0.1, accel_limits[1])] - accel_limits = limit_accel_in_turns(CS.vEgo, CS.steeringAngle, accel_limits, self.CP) - - if force_slow_decel: - # if required so, force a smooth deceleration - accel_limits[1] = min(accel_limits[1], AWARENESS_DECEL) - accel_limits[0] = min(accel_limits[0], accel_limits[1]) - - self.v_cruise, self.a_cruise = speed_smoother(self.v_acc_start, self.a_acc_start, - v_cruise_setpoint, - accel_limits[1], accel_limits[0], - jerk_limits[1], jerk_limits[0], - _DT_MPC) - # cruise speed can't be negative even is user is distracted - self.v_cruise = max(self.v_cruise, 0.) - else: - starting = LoC.long_control_state == LongCtrlState.starting - a_ego = min(CS.aEgo, 0.0) - reset_speed = MIN_CAN_SPEED if starting else CS.vEgo - reset_accel = self.CP.startAccel if starting else a_ego - self.v_acc = reset_speed - self.a_acc = reset_accel - self.v_acc_start = reset_speed - self.a_acc_start = reset_accel - self.v_cruise = reset_speed - self.a_cruise = reset_accel - self.v_acc_sol = reset_speed - self.a_acc_sol = reset_accel - - self.mpc1.set_cur_state(self.v_acc_start, self.a_acc_start) - self.mpc2.set_cur_state(self.v_acc_start, self.a_acc_start) - - self.mpc1.update(CS, self.lead_1, v_cruise_setpoint) - self.mpc2.update(CS, self.lead_2, v_cruise_setpoint) - - self.choose_solution(v_cruise_setpoint, enabled) - - # determine fcw - if self.mpc1.new_lead: - self.fcw_checker.reset_lead(cur_time) - - blinkers = CS.leftBlinker or CS.rightBlinker - self.fcw = self.fcw_checker.update(self.mpc1.mpc_solution, cur_time, CS.vEgo, CS.aEgo, - self.lead_1.dRel, self.lead_1.vLead, self.lead_1.aLeadK, - self.lead_1.yRel, self.lead_1.vLat, - self.lead_1.fcw, blinkers) \ - and not CS.brakePressed - if self.fcw: - cloudlog.info("FCW triggered %s", self.fcw_checker.counters) - - if cur_time - self.last_model > 0.5: - self.model_dead = True - - if cur_time - self.last_l20 > 0.5: - self.radar_dead = True + lead_1 = live20.live20.leadOne + lead_2 = live20.live20.leadTwo + + enabled = (long_control_state == LongCtrlState.pid) or (long_control_state == LongCtrlState.stopping) + following = lead_1.status and lead_1.dRel < 45.0 and lead_1.vLeadK > v_ego and lead_1.aLeadK > 0.0 + + v_speedlimit = NO_CURVATURE_SPEED + v_curvature = NO_CURVATURE_SPEED + map_valid = live_map_data.liveMapData.mapValid + + # Speed limit and curvature + set_speed_limit_active = self.params.get("LimitSetSpeed") == "1" and self.params.get("SpeedLimitOffset") is not None + if set_speed_limit_active: + if live_map_data.liveMapData.speedLimitValid: + speed_limit = live_map_data.liveMapData.speedLimit + offset = float(self.params.get("SpeedLimitOffset")) + v_speedlimit = speed_limit + offset + + if live_map_data.liveMapData.curvatureValid: + curvature = abs(live_map_data.liveMapData.curvature) + a_y_max = 2.975 - v_ego * 0.0375 # ~1.85 @ 75mph, ~2.6 @ 25mph + v_curvature = math.sqrt(a_y_max / max(1e-4, curvature)) + v_curvature = min(NO_CURVATURE_SPEED, v_curvature) + + decel_for_turn = bool(v_curvature < min([v_cruise_setpoint, v_speedlimit, v_ego + 1.])) + v_cruise_setpoint = min([v_cruise_setpoint, v_curvature, v_speedlimit]) + + # Calculate speed for normal cruise control + if enabled: + accel_limits = map(float, calc_cruise_accel_limits(v_ego, following)) + jerk_limits = [min(-0.1, accel_limits[0]), max(0.1, accel_limits[1])] # TODO: make a separate lookup for jerk tuning + accel_limits = limit_accel_in_turns(v_ego, CS.carState.steeringAngle, accel_limits, self.CP) + + if force_slow_decel: + # if required so, force a smooth deceleration + accel_limits[1] = min(accel_limits[1], AWARENESS_DECEL) + accel_limits[0] = min(accel_limits[0], accel_limits[1]) + + # Change accel limits based on time remaining to turn + if decel_for_turn: + time_to_turn = max(1.0, live_map_data.liveMapData.distToTurn / max(self.v_cruise, 1.)) + required_decel = min(0, (v_curvature - self.v_cruise) / time_to_turn) + accel_limits[0] = max(accel_limits[0], required_decel) + + self.v_cruise, self.a_cruise = speed_smoother(self.v_acc_start, self.a_acc_start, + v_cruise_setpoint, + accel_limits[1], accel_limits[0], + jerk_limits[1], jerk_limits[0], + _DT_MPC) + # cruise speed can't be negative even is user is distracted + self.v_cruise = max(self.v_cruise, 0.) + else: + starting = long_control_state == LongCtrlState.starting + a_ego = min(CS.carState.aEgo, 0.0) + reset_speed = MIN_CAN_SPEED if starting else v_ego + reset_accel = self.CP.startAccel if starting else a_ego + self.v_acc = reset_speed + self.a_acc = reset_accel + self.v_acc_start = reset_speed + self.a_acc_start = reset_accel + self.v_cruise = reset_speed + self.a_cruise = reset_accel + + self.mpc1.set_cur_state(self.v_acc_start, self.a_acc_start) + self.mpc2.set_cur_state(self.v_acc_start, self.a_acc_start) + + self.mpc1.update(CS, lead_1, v_cruise_setpoint) + self.mpc2.update(CS, lead_2, v_cruise_setpoint) + + self.choose_solution(v_cruise_setpoint, enabled) + + # determine fcw + if self.mpc1.new_lead: + self.fcw_checker.reset_lead(cur_time) + + blinkers = CS.carState.leftBlinker or CS.carState.rightBlinker + fcw = self.fcw_checker.update(self.mpc1.mpc_solution, cur_time, v_ego, CS.carState.aEgo, + lead_1.dRel, lead_1.vLead, lead_1.aLeadK, + lead_1.yRel, lead_1.vLat, + lead_1.fcw, blinkers) and not CS.carState.brakePressed + if fcw: + cloudlog.info("FCW triggered %s", self.fcw_checker.counters) + + model_dead = cur_time - (md.logMonoTime / 1e9) > 0.5 + # **** send the plan **** plan_send = messaging.new_message() plan_send.init('plan') + # TODO: Move all these events to controlsd. This has nothing to do with planning events = [] - if self.model_dead: - events.append(create_event('modelCommIssue', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) - if self.radar_dead or 'commIssue' in self.radar_errors: - events.append(create_event('radarCommIssue', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) - if 'fault' in self.radar_errors: - events.append(create_event('radarFault', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) - if LaC.mpc_solution[0].cost > 10000. or LaC.mpc_nans: # TODO: find a better way to detect when MPC did not converge - events.append(create_event('plannerError', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) - - # Interpolation of trajectory - dt = min(cur_time - self.acc_start_time, _DT_MPC + _DT) + _DT # no greater than dt mpc + dt, to prevent too high extraps - self.a_acc_sol = self.a_acc_start + (dt / _DT_MPC) * (self.a_acc - self.a_acc_start) - self.v_acc_sol = self.v_acc_start + dt * (self.a_acc_sol + self.a_acc_start) / 2.0 + if model_dead: + events.append(create_event('modelCommIssue', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - plan_send.plan.events = events - plan_send.plan.mdMonoTime = self.last_md_ts - plan_send.plan.l20MonoTime = self.last_l20_ts + radar_errors = list(live20.live20.radarErrors) + if 'commIssue' in radar_errors: + events.append(create_event('radarCommIssue', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if 'fault' in radar_errors: + events.append(create_event('radarFault', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - # lateral plan - plan_send.plan.lateralValid = not self.model_dead - plan_send.plan.dPoly = map(float, self.PP.d_poly) - plan_send.plan.laneWidth = float(self.PP.lane_width) + plan_send.plan.events = events + plan_send.plan.mdMonoTime = md.logMonoTime + plan_send.plan.l20MonoTime = live20.logMonoTime # longitudal plan - plan_send.plan.longitudinalValid = not self.radar_dead plan_send.plan.vCruise = self.v_cruise plan_send.plan.aCruise = self.a_cruise - plan_send.plan.vTarget = self.v_acc_sol - plan_send.plan.aTarget = self.a_acc_sol + plan_send.plan.vStart = self.v_acc_start + plan_send.plan.aStart = self.a_acc_start + plan_send.plan.vTarget = self.v_acc + plan_send.plan.aTarget = self.a_acc plan_send.plan.vTargetFuture = self.v_acc_future plan_send.plan.hasLead = self.mpc1.prev_lead_status plan_send.plan.longitudinalPlanSource = self.longitudinalPlanSource - plan_send.plan.gpsPlannerActive = self.gps_planner_active + plan_send.plan.vCurvature = v_curvature + plan_send.plan.decelForTurn = decel_for_turn + plan_send.plan.mapValid = map_valid # Send out fcw - fcw = self.fcw and (self.fcw_enabled or LoC.long_control_state != LongCtrlState.off) + fcw = fcw and (self.fcw_enabled or long_control_state != LongCtrlState.off) plan_send.plan.fcw = fcw self.plan.send(plan_send.to_bytes()) - return plan_send + + # Interpolate 0.05 seconds and save as starting point for next iteration + dt = 0.05 # s + a_acc_sol = self.a_acc_start + (dt / _DT_MPC) * (self.a_acc - self.a_acc_start) + v_acc_sol = self.v_acc_start + dt * (a_acc_sol + self.a_acc_start) / 2.0 + self.v_acc_start = v_acc_sol + self.a_acc_start = a_acc_sol diff --git a/selfdrive/controls/lib/radar_helpers.py b/selfdrive/controls/lib/radar_helpers.py index b5ee51e4855614..da7d3f71ba0c4d 100644 --- a/selfdrive/controls/lib/radar_helpers.py +++ b/selfdrive/controls/lib/radar_helpers.py @@ -6,6 +6,7 @@ from common.numpy_fast import clip, interp from common.kalman.simple_kalman import KF1D +_LEAD_ACCEL_TAU = 1.5 NO_FUSION_SCORE = 100 # bad default fusion score # radar tracks @@ -32,6 +33,8 @@ #_VLEAD_K = np.matrix([[ 0.05705578], [ 0.03073241]]) _VLEAD_K = [[ 0.1988689 ], [ 0.28555364]] +RDR_TO_LDR = 2.7 + class Track(object): def __init__(self): @@ -60,6 +63,7 @@ def update(self, d_rel, y_rel, v_rel, d_path, v_ego_t_aligned, measured, steer_o if not self.initted: self.initted = True + self.aLeadTau = _LEAD_ACCEL_TAU self.cnt = 1 self.vision_cnt = 0 self.vision = False @@ -92,6 +96,12 @@ def update(self, d_rel, y_rel, v_rel, d_path, v_ego_t_aligned, measured, steer_o self.vision_score = NO_FUSION_SCORE + # Learn if constant acceleration + if abs(self.aLeadK) < 0.5: + self.aLeadTau = _LEAD_ACCEL_TAU + else: + self.aLeadTau *= 0.9 + def update_vision_score(self, dist_to_vision, rel_speed_diff): # rel speed is very hard to estimate from vision if dist_to_vision < 4.0 and rel_speed_diff < 10.: @@ -110,8 +120,8 @@ def get_key_for_cluster(self): # Weigh y higher since radar is inaccurate in this dimension return [self.dRel, self.yRel*2, self.vRel] -# ******************* Cluster ******************* +# ******************* Cluster ******************* if platform.machine() == 'aarch64': for x in sys.path: pp = os.path.join(x, "phonelibs/hierarchy/lib") @@ -122,6 +132,7 @@ def get_key_for_cluster(self): else: from scipy.cluster import _hierarchy + def fcluster(Z, t, criterion='inconsistent', depth=2, R=None, monocrit=None): # supersimplified function to get fast clustering. Got it from scipy Z = np.asarray(Z, order='c') @@ -130,10 +141,10 @@ def fcluster(Z, t, criterion='inconsistent', depth=2, R=None, monocrit=None): _hierarchy.cluster_dist(Z, T, float(t), int(n)) return T -RDR_TO_LDR = 2.7 def mean(l): - return sum(l)/len(l) + return sum(l) / len(l) + class Cluster(object): def __init__(self): @@ -180,6 +191,10 @@ def vLeadK(self): def aLeadK(self): return mean([t.aLeadK for t in self.tracks]) + @property + def aLeadTau(self): + return mean([t.aLeadTau for t in self.tracks]) + @property def vision(self): return any([t.vision for t in self.tracks]) @@ -213,6 +228,7 @@ def toLive20(self): "aLeadK": float(self.aLeadK), "status": True, "fcw": self.is_potential_fcw(), + "aLeadTau": float(self.aLeadTau) } def __str__(self): diff --git a/selfdrive/controls/lib/vehicle_model.py b/selfdrive/controls/lib/vehicle_model.py index df3bb0a967db05..1dc77bf375afb6 100755 --- a/selfdrive/controls/lib/vehicle_model.py +++ b/selfdrive/controls/lib/vehicle_model.py @@ -1,16 +1,42 @@ #!/usr/bin/env python import numpy as np -from numpy.linalg import inv +from numpy.linalg import solve -# dynamic bycicle model from "The Science of Vehicle Dynamics (2014), M. Guiggiani"## -# Xdot = A*X + B*U -# where X = [v, r], with v and r lateral speed and rotational speed, respectively -# and U is the steering angle (controller input) -# -# A depends on longitudinal speed, u, and vehicle parameters CP +""" +Dynamic bycicle model from "The Science of Vehicle Dynamics (2014), M. Guiggiani" + +The state is x = [v, r]^T +with v lateral speed [m/s], and r rotational speed [rad/s] + +The input u is the steering angle [rad] + +The system is defined by +x_dot = A*x + B*u + +A depends on longitudinal speed, u [m/s], and vehicle parameters CP +""" def create_dyn_state_matrices(u, VM): + """Returns the A and B matrix for the dynamics system + + Args: + u: Vehicle speed [m/s] + VM: Vehicle model + + Returns: + A tuple with the 2x2 A matrix, and 2x1 B matrix + + Parameters in the vehicle model: + cF: Tire stiffnes Front [N/rad] + cR: Tire stiffnes Front [N/rad] + aF: Distance from CG to front wheels [m] + aR: Distance from CG to rear wheels [m] + m: Mass [kg] + j: Rotational inertia [kg m^2] + sR: Steering ratio [-] + chi: Steer ratio rear [-] + """ A = np.zeros((2, 2)) B = np.zeros((2, 1)) A[0, 0] = - (VM.cF + VM.cR) / (VM.m * u) @@ -23,7 +49,18 @@ def create_dyn_state_matrices(u, VM): def kin_ss_sol(sa, u, VM): - # kinematic solution, useful when speed ~ 0 + """Calculate the steady state solution at low speeds + At low speeds the tire slip is undefined, so a kinematic + model is used. + + Args: + sa: Steering angle [rad] + u: Speed [m/s] + VM: Vehicle model + + Returns: + 2x1 matrix with steady state solution + """ K = np.zeros((2, 1)) K[0, 0] = VM.aR / VM.sR / VM.l * u K[1, 0] = 1. / VM.sR / VM.l * u @@ -31,75 +68,126 @@ def kin_ss_sol(sa, u, VM): def dyn_ss_sol(sa, u, VM): - # Dynamic solution, useful when speed > 0 + """Calculate the steady state solution when x_dot = 0, + Ax + Bu = 0 => x = A^{-1} B u + + Args: + sa: Steering angle [rad] + u: Speed [m/s] + VM: Vehicle model + + Returns: + 2x1 matrix with steady state solution + """ A, B = create_dyn_state_matrices(u, VM) - return - np.matmul(inv(A), B) * sa + return -solve(A, B) * sa def calc_slip_factor(VM): - # the slip factor is a measure of how the curvature changes with speed - # it's positive for Oversteering vehicle, negative (usual case) otherwise + """The slip factor is a measure of how the curvature changes with speed + it's positive for Oversteering vehicle, negative (usual case) otherwise. + """ return VM.m * (VM.cF * VM.aF - VM.cR * VM.aR) / (VM.l**2 * VM.cF * VM.cR) class VehicleModel(object): - def __init__(self, CP, init_state=np.asarray([[0.], [0.]])): - self.dt = 0.1 - lookahead = 2. # s - self.steps = int(lookahead / self.dt) - self.update_state(init_state) - self.state_pred = np.zeros((self.steps, self.state.shape[0])) - self.CP = CP + def __init__(self, CP): + """ + Args: + CP: Car Parameters + """ # for math readability, convert long names car params into short names self.m = CP.mass self.j = CP.rotationalInertia self.l = CP.wheelbase self.aF = CP.centerToFront self.aR = CP.wheelbase - CP.centerToFront - self.cF = CP.tireStiffnessFront - self.cR = CP.tireStiffnessRear - self.sR = CP.steerRatio self.chi = CP.steerRatioRear - def update_state(self, state): - self.state = state + self.cF_orig = CP.tireStiffnessFront + self.cR_orig = CP.tireStiffnessRear + self.update_params(1.0, CP.steerRatio) + + def update_params(self, stiffness_factor, steer_ratio): + """Update the vehicle model with a new stiffness factor and steer ratio""" + self.cF = stiffness_factor * self.cF_orig + self.cR = stiffness_factor * self.cR_orig + self.sR = steer_ratio def steady_state_sol(self, sa, u): - # if the speed is too small we can't use the dynamic model - # (tire slip is undefined), we then use the kinematic model + """Returns the steady state solution. + + If the speed is too small we can't use the dynamic model (tire slip is undefined), + we then have to use the kinematic model + + Args: + sa: Steering wheel angle [rad] + u: Speed [m/s] + + Returns: + 2x1 matrix with steady state solution (lateral speed, rotational speed) + """ if u > 0.1: return dyn_ss_sol(sa, u, self) else: return kin_ss_sol(sa, u, self) def calc_curvature(self, sa, u): - # this formula can be derived from state equations in steady state conditions + """Returns the curvature. Multiplied by the speed this will give the yaw rate. + + Args: + sa: Steering wheel angle [rad] + u: Speed [m/s] + + Returns: + Curvature factor [rad/m] + """ return self.curvature_factor(u) * sa / self.sR def curvature_factor(self, u): + """Returns the curvature factor. + Multiplied by wheel angle (not steering wheel angle) this will give the curvature. + + Args: + u: Speed [m/s] + + Returns: + Curvature factor [1/m] + """ sf = calc_slip_factor(self) - return (1. - self.chi)/(1. - sf * u**2) / self.l + return (1. - self.chi) / (1. - sf * u**2) / self.l def get_steer_from_curvature(self, curv, u): - return curv * self.sR * 1.0 / self.curvature_factor(u) + """Calculates the required steering wheel angle for a given curvature + + Args: + curv: Desired curvature [rad/s] + u: Speed [m/s] - def state_prediction(self, sa, u): - # U is the matrix of the controls - # u is the long speed - A, B = create_dyn_state_matrices(u, self) - return np.matmul((A * self.dt + np.identity(2)), self.state) + B * sa * self.dt + Returns: + Steering wheel angle [rad] + """ + + return curv * self.sR * 1.0 / self.curvature_factor(u) def yaw_rate(self, sa, u): + """Calculate yaw rate + + Args: + sa: Steering wheel angle [rad] + u: Speed [m/s] + + Returns: + Yaw rate [rad/s] + """ return self.calc_curvature(sa, u) * u + if __name__ == '__main__': + import math from selfdrive.car.honda.interface import CarInterface - # load car params - #CP = CarInterface.get_params("TOYOTA PRIUS 2017", {}) - CP = CarInterface.get_params("HONDA CIVIC 2016 TOURING", {}) - #print CP + from selfdrive.car.honda.values import CAR + + CP = CarInterface.get_params(CAR.CIVIC, {}) VM = VehicleModel(CP) - #print VM.steady_state_sol(.1, 0.15) - #print calc_slip_factor(VM) - #print VM.yaw_rate(3.*np.pi/180, 32.) * 180./np.pi - #print VM.curvature_factor(32) + print(VM.yaw_rate(math.radians(20), 10.)) diff --git a/selfdrive/controls/plannerd.py b/selfdrive/controls/plannerd.py new file mode 100755 index 00000000000000..2a95375408721b --- /dev/null +++ b/selfdrive/controls/plannerd.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +import zmq + +from cereal import car +from common.params import Params +from selfdrive.swaglog import cloudlog +from selfdrive.services import service_list +from selfdrive.controls.lib.planner import Planner +from selfdrive.controls.lib.vehicle_model import VehicleModel +from selfdrive.controls.lib.pathplanner import PathPlanner +import selfdrive.messaging as messaging + + +def plannerd_thread(): + context = zmq.Context() + params = Params() + + # Get FCW toggle from settings + fcw_enabled = params.get("IsFcwEnabled") == "1" + + cloudlog.info("plannerd is waiting for CarParams") + CP = car.CarParams.from_bytes(Params().get("CarParams", block=True)) + cloudlog.info("plannerd got CarParams: %s", CP.carName) + + PL = Planner(CP, fcw_enabled) + PP = PathPlanner(CP) + + VM = VehicleModel(CP) + + poller = zmq.Poller() + car_state_sock = messaging.sub_sock(context, service_list['carState'].port, conflate=True, poller=poller) + live100_sock = messaging.sub_sock(context, service_list['live100'].port, conflate=True, poller=poller) + live20_sock = messaging.sub_sock(context, service_list['live20'].port, conflate=True, poller=poller) + model_sock = messaging.sub_sock(context, service_list['model'].port, conflate=True, poller=poller) + live_map_data_sock = messaging.sub_sock(context, service_list['liveMapData'].port, conflate=True, poller=poller) + live_parameters_sock = messaging.sub_sock(context, service_list['liveParameters'].port, conflate=True, poller=poller) + + car_state = messaging.new_message() + car_state.init('carState') + live100 = messaging.new_message() + live100.init('live100') + model = messaging.new_message() + model.init('model') + live20 = messaging.new_message() + live20.init('live20') + live_map_data = messaging.new_message() + live_map_data.init('liveMapData') + + live_parameters = messaging.new_message() + live_parameters.init('liveParameters') + live_parameters.liveParameters.valid = True + live_parameters.liveParameters.steerRatio = CP.steerRatio + live_parameters.liveParameters.stiffnessFactor = 1.0 + + while True: + for socket, event in poller.poll(): + if socket is live100_sock: + live100 = messaging.recv_one(socket) + elif socket is car_state_sock: + car_state = messaging.recv_one(socket) + elif socket is live_parameters_sock: + live_parameters = messaging.recv_one(socket) + elif socket is model_sock: + model = messaging.recv_one(socket) + PP.update(CP, VM, car_state, model, live100, live_parameters) + elif socket is live_map_data_sock: + live_map_data = messaging.recv_one(socket) + elif socket is live20_sock: + live20 = messaging.recv_one(socket) + PL.update(car_state, CP, VM, PP, live20, live100, model, live_map_data) + + +def main(gctx=None): + plannerd_thread() + + +if __name__ == "__main__": + main() diff --git a/selfdrive/controls/radard.py b/selfdrive/controls/radard.py index 5f69085cf2b5e2..4d44c96b9dd34e 100755 --- a/selfdrive/controls/radard.py +++ b/selfdrive/controls/radard.py @@ -1,15 +1,15 @@ #!/usr/bin/env python -import gc import zmq import numpy as np import numpy.matlib import importlib -from collections import defaultdict +from collections import defaultdict, deque from fastcluster import linkage_vector + import selfdrive.messaging as messaging from selfdrive.services import service_list from selfdrive.controls.lib.latcontrol_helpers import calc_lookahead_offset -from selfdrive.controls.lib.pathplanner import PathPlanner +from selfdrive.controls.lib.model_parser import ModelParser from selfdrive.controls.lib.radar_helpers import Track, Cluster, fcluster, \ RDR_TO_LDR, NO_FUSION_SCORE from selfdrive.controls.lib.vehicle_model import VehicleModel @@ -26,6 +26,7 @@ XV, SPEEDV = 0, 1 VISION_POINT = -1 + class EKFV1D(EKF): def __init__(self): super(EKFV1D, self).__init__(False) @@ -43,9 +44,10 @@ def calc_transfer_fun(self, dt): return tf, tfj -# fuses camera and radar data for best lead detection +## fuses camera and radar data for best lead detection +# FIXME: radard has a memory leak of about 50MB/hr +# BOUNTY: $100 coupon on shop.comma.ai def radard_thread(gctx=None): - gc.disable() set_realtime_priority(2) # wait for stats about the car to come in from controls @@ -64,8 +66,16 @@ def radard_thread(gctx=None): poller = zmq.Poller() model = messaging.sub_sock(context, service_list['model'].port, conflate=True, poller=poller) live100 = messaging.sub_sock(context, service_list['live100'].port, conflate=True, poller=poller) + live_parameters_sock = messaging.sub_sock(context, service_list['liveParameters'].port, conflate=True, poller=poller) - PP = PathPlanner() + # Default parameters + live_parameters = messaging.new_message() + live_parameters.init('liveParameters') + live_parameters.liveParameters.valid = True + live_parameters.liveParameters.steerRatio = CP.steerRatio + live_parameters.liveParameters.stiffnessFactor = 1.0 + + MP = ModelParser() RI = RadarInterface(CP) last_md_ts = 0 @@ -94,7 +104,8 @@ def radard_thread(gctx=None): # v_ego v_ego = None - v_ego_array = np.zeros([2, v_len]) + v_ego_hist_t = deque(maxlen=v_len) + v_ego_hist_v = deque(maxlen=v_len) v_ego_t_aligned = 0. rk = Ratekeeper(rate, print_delay_threshold=np.inf) @@ -114,6 +125,9 @@ def radard_thread(gctx=None): l100 = messaging.recv_one(socket) elif socket is model: md = messaging.recv_one(socket) + elif socket is live_parameters_sock: + live_parameters = messaging.recv_one(socket) + VM.update_params(live_parameters.liveParameters.stiffnessFactor, live_parameters.liveParameters.steerRatio) if l100 is not None: active = l100.live100.active @@ -121,8 +135,8 @@ def radard_thread(gctx=None): steer_angle = l100.live100.angleSteers steer_override = l100.live100.steerOverride - v_ego_array = np.append(v_ego_array, [[v_ego], [float(rk.frame)/rate]], 1) - v_ego_array = v_ego_array[:, 1:] + v_ego_hist_v.append(v_ego) + v_ego_hist_t.append(float(rk.frame)/rate) last_l100_ts = l100.logMonoTime @@ -133,28 +147,38 @@ def radard_thread(gctx=None): last_md_ts = md.logMonoTime # *** get path prediction from the model *** - PP.update(v_ego, md) + MP.update(v_ego, md) # run kalman filter only if prob is high enough - if PP.lead_prob > 0.7: - ekfv.update(speedSensorV.read(PP.lead_dist, covar=PP.lead_var)) + if MP.lead_prob > 0.7: + reading = speedSensorV.read(MP.lead_dist, covar=np.matrix(MP.lead_var)) + ekfv.update_scalar(reading) ekfv.predict(tsv) - ar_pts[VISION_POINT] = (float(ekfv.state[XV]), np.polyval(PP.d_poly, float(ekfv.state[XV])), + + # When changing lanes the distance to the lead car can suddenly change, + # which makes the Kalman filter output large relative acceleration + if mocked and abs(MP.lead_dist - ekfv.state[XV]) > 2.0: + ekfv.state[XV] = MP.lead_dist + ekfv.covar = (np.diag([MP.lead_var, ekfv.var_init])) + ekfv.state[SPEEDV] = 0. + + ar_pts[VISION_POINT] = (float(ekfv.state[XV]), np.polyval(MP.d_poly, float(ekfv.state[XV])), float(ekfv.state[SPEEDV]), False) else: - ekfv.state[XV] = PP.lead_dist - ekfv.covar = (np.diag([PP.lead_var, ekfv.var_init])) + ekfv.state[XV] = MP.lead_dist + ekfv.covar = (np.diag([MP.lead_var, ekfv.var_init])) ekfv.state[SPEEDV] = 0. + if VISION_POINT in ar_pts: del ar_pts[VISION_POINT] # *** compute the likely path_y *** if (active and not steer_override) or mocked: # use path from model (always when mocking as steering is too noisy) - path_y = np.polyval(PP.d_poly, path_x) + path_y = np.polyval(MP.d_poly, path_x) else: # use path from steer, set angle_offset to 0 it does not only report the physical offset - path_y = calc_lookahead_offset(v_ego, steer_angle, path_x, VM, angle_offset=0)[0] + path_y = calc_lookahead_offset(v_ego, steer_angle, path_x, VM, angle_offset=live_parameters.liveParameters.angleOffsetAverage)[0] # *** remove missing points from meta data *** for ids in tracks.keys(): @@ -170,7 +194,8 @@ def radard_thread(gctx=None): # align v_ego by a fixed time to align it with the radar measurement cur_time = float(rk.frame)/rate - v_ego_t_aligned = np.interp(cur_time - RI.delay, v_ego_array[1], v_ego_array[0]) + v_ego_t_aligned = np.interp(cur_time - RI.delay, v_ego_hist_t, v_ego_hist_v) + d_path = np.sqrt(np.amin((path_x - rpt[0]) ** 2 + (path_y - rpt[1]) ** 2)) # add sign d_path *= np.sign(rpt[1] - np.interp(rpt[0], path_x, path_y)) @@ -276,8 +301,8 @@ def radard_thread(gctx=None): "yRel": float(tracks[ids].yRel), "vRel": float(tracks[ids].vRel), "aRel": float(tracks[ids].aRel), - "stationary": tracks[ids].stationary, - "oncoming": tracks[ids].oncoming, + "stationary": bool(tracks[ids].stationary), + "oncoming": bool(tracks[ids].oncoming), } liveTracks.send(dat.to_bytes()) diff --git a/selfdrive/crash.py b/selfdrive/crash.py index 20003ee9faff57..94bdfd125bb9c7 100644 --- a/selfdrive/crash.py +++ b/selfdrive/crash.py @@ -1,6 +1,7 @@ """Install exception handler for process crash.""" import os import sys +import threading from selfdrive.version import version, dirty from selfdrive.swaglog import cloudlog @@ -38,3 +39,25 @@ def handle_exception(*exc_info): capture_exception(exc_info=exc_info) __excepthook__(*exc_info) sys.excepthook = handle_exception + + """ + Workaround for `sys.excepthook` thread bug from: + http://bugs.python.org/issue1230540 + Call once from the main thread before creating any threads. + Source: https://stackoverflow.com/a/31622038 + """ + init_original = threading.Thread.__init__ + + def init(self, *args, **kwargs): + init_original(self, *args, **kwargs) + run_original = self.run + + def run_with_except_hook(*args2, **kwargs2): + try: + run_original(*args2, **kwargs2) + except Exception: + sys.excepthook(*sys.exc_info()) + + self.run = run_with_except_hook + + threading.Thread.__init__ = init diff --git a/selfdrive/debug/dump.py b/selfdrive/debug/dump.py index 80ac6e4b50859a..45b737953fdebe 100755 --- a/selfdrive/debug/dump.py +++ b/selfdrive/debug/dump.py @@ -26,6 +26,7 @@ def run_server(socketio): parser.add_argument('--proxy', action='store_true', help='republish on localhost') parser.add_argument('--map', action='store_true') parser.add_argument('--addr', default='127.0.0.1') + parser.add_argument('--values', help='values to monitor (instead of entire event)') parser.add_argument("socket", type=str, nargs='*', help="socket name") args = parser.parse_args() @@ -38,7 +39,7 @@ def run_server(socketio): port = int(m) else: print("service not found") - exit(-1) + sys.exit(-1) sock = messaging.sub_sock(context, port, poller, addr=args.addr) if args.proxy: republish_socks[sock] = messaging.pub_sock(context, port) @@ -53,6 +54,10 @@ def run_server(socketio): server_thread.start() print 'server running' + values = None + if args.values: + values = [s.strip().split(".") for s in args.values.split(",")] + while 1: polld = poller.poll(timeout=1000) for sock, mode in polld: @@ -79,5 +84,14 @@ def run_server(socketio): print(json.loads(msg)) elif args.dump_json: print json.dumps(evt.to_dict()) + elif values: + print "logMonotime = {}".format(evt.logMonoTime) + for value in values: + if hasattr(evt, value[0]): + item = evt + for key in value: + item = getattr(item, key) + print "{} = {}".format(".".join(value), item) + print "" else: print evt diff --git a/selfdrive/locationd/calibration_helpers.py b/selfdrive/locationd/calibration_helpers.py new file mode 100644 index 00000000000000..f2909007594924 --- /dev/null +++ b/selfdrive/locationd/calibration_helpers.py @@ -0,0 +1,11 @@ +import math + +class Filter: + MIN_SPEED = 7 # m/s (~15.5mph) + MAX_YAW_RATE = math.radians(3) # per second + +class Calibration: + UNCALIBRATED = 0 + CALIBRATED = 1 + INVALID = 2 + diff --git a/selfdrive/locationd/calibrationd.py b/selfdrive/locationd/calibrationd.py new file mode 100755 index 00000000000000..41911a6b741636 --- /dev/null +++ b/selfdrive/locationd/calibrationd.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python +import os +import zmq +import copy +import json +import numpy as np +import selfdrive.messaging as messaging +from selfdrive.locationd.calibration_helpers import Calibration +from selfdrive.swaglog import cloudlog +from selfdrive.services import service_list +from common.params import Params +from common.transformations.model import model_height, get_camera_frame_from_model_frame, get_camera_frame_from_bigmodel_frame +from common.transformations.camera import view_frame_from_device_frame, get_view_frame_from_road_frame, \ + eon_intrinsics, get_calib_from_vp, H, W + +MPH_TO_MS = 0.44704 +MIN_SPEED_FILTER = 15 * MPH_TO_MS +MAX_YAW_RATE_FILTER = np.radians(2) # per second +INPUTS_NEEDED = 300 # allow to update VP every so many frames +INPUTS_WANTED = 600 # We want a little bit more than we need for stability +WRITE_CYCLES = 400 # write every 400 cycles +VP_INIT = np.array([W/2., H/2.]) + +# These validity corners were chosen by looking at 1000 +# and taking most extreme cases with some margin. +VP_VALIDITY_CORNERS = np.array([[W/2 - 150, 280], [W/2 + 150, 540]]) +DEBUG = os.getenv("DEBUG") is not None + + +def is_calibration_valid(vp): + return vp[0] > VP_VALIDITY_CORNERS[0,0] and vp[0] < VP_VALIDITY_CORNERS[1,0] and \ + vp[1] > VP_VALIDITY_CORNERS[0,1] and vp[1] < VP_VALIDITY_CORNERS[1,1] + + +class Calibrator(object): + def __init__(self, param_put=False): + self.param_put = param_put + self.vp = copy.copy(VP_INIT) + self.vps = [] + self.cal_status = Calibration.UNCALIBRATED + self.write_counter = 0 + self.params = Params() + calibration_params = self.params.get("CalibrationParams") + if calibration_params: + try: + calibration_params = json.loads(calibration_params) + self.vp = np.array(calibration_params["vanishing_point"]) + self.vps = np.tile(self.vp, (calibration_params['valid_points'], 1)).tolist() + self.update_status() + except Exception: + cloudlog.exception("CalibrationParams file found but error encountered") + + + def update_status(self): + if len(self.vps) < INPUTS_NEEDED: + self.cal_status = Calibration.UNCALIBRATED + else: + self.cal_status = Calibration.CALIBRATED if is_calibration_valid(self.vp) else Calibration.INVALID + + def handle_cam_odom(self, log): + trans, rot = log.cameraOdometry.trans, log.cameraOdometry.rot + if np.linalg.norm(trans) > MIN_SPEED_FILTER and abs(rot[2]) < MAX_YAW_RATE_FILTER: + new_vp = eon_intrinsics.dot(view_frame_from_device_frame.dot(trans)) + new_vp = new_vp[:2]/new_vp[2] + self.vps.append(new_vp) + self.vps = self.vps[-INPUTS_WANTED:] + self.vp = np.mean(self.vps, axis=0) + self.update_status() + self.write_counter += 1 + if self.param_put and self.write_counter % WRITE_CYCLES == 0: + cal_params = {"vanishing_point": list(self.vp), + "valid_points": len(self.vps)} + self.params.put("CalibrationParams", json.dumps(cal_params)) + return new_vp + + def send_data(self, livecalibration): + calib = get_calib_from_vp(self.vp) + extrinsic_matrix = get_view_frame_from_road_frame(0, calib[1], calib[2], model_height) + ke = eon_intrinsics.dot(extrinsic_matrix) + warp_matrix = get_camera_frame_from_model_frame(ke) + warp_matrix_big = get_camera_frame_from_bigmodel_frame(ke) + + cal_send = messaging.new_message() + cal_send.init('liveCalibration') + cal_send.liveCalibration.calStatus = self.cal_status + cal_send.liveCalibration.calPerc = min(len(self.vps) * 100 / INPUTS_NEEDED, 100) + cal_send.liveCalibration.warpMatrix2 = map(float, warp_matrix.flatten()) + cal_send.liveCalibration.warpMatrixBig = map(float, warp_matrix_big.flatten()) + cal_send.liveCalibration.extrinsicMatrix = map(float, extrinsic_matrix.flatten()) + + livecalibration.send(cal_send.to_bytes()) + + +def calibrationd_thread(gctx=None, addr="127.0.0.1"): + context = zmq.Context() + + cameraodometry = messaging.sub_sock(context, service_list['cameraOdometry'].port, addr=addr, conflate=True) + livecalibration = messaging.pub_sock(context, service_list['liveCalibration'].port) + calibrator = Calibrator(param_put=True) + + # buffer with all the messages that still need to be input into the kalman + while 1: + co = messaging.recv_one(cameraodometry) + + new_vp = calibrator.handle_cam_odom(co) + if DEBUG and new_vp is not None: + print 'got new vp', new_vp + + calibrator.send_data(livecalibration) + + +def main(gctx=None, addr="127.0.0.1"): + calibrationd_thread(gctx, addr) + + +if __name__ == "__main__": + main() diff --git a/selfdrive/locationd/get_vp.c b/selfdrive/locationd/get_vp.c new file mode 100644 index 00000000000000..8a48c88150b4cb --- /dev/null +++ b/selfdrive/locationd/get_vp.c @@ -0,0 +1,41 @@ +int get_intersections(double *lines, double *intersections, long long n) { + double D, Dx, Dy; + double x, y; + double *L1, *L2; + int k = 0; + for (int i=0; i < n; i++) { + for (int j=0; j < n; j++) { + L1 = lines + i*3; + L2 = lines + j*3; + D = L1[0] * L2[1] - L1[1] * L2[0]; + Dx = L1[2] * L2[1] - L1[1] * L2[2]; + Dy = L1[0] * L2[2] - L1[2] * L2[0]; + // only intersect lines from different quadrants and only left-right crossing + if ((D != 0) && (L1[0]*L2[0]*L1[1]*L2[1] < 0) && (L1[1]*L2[1] < 0)){ + x = Dx / D; + y = Dy / D; + if ((0 < x) && + (x < W) && + (0 < y) && + (y < H)){ + intersections[k*2 + 0] = x; + intersections[k*2 + 1] = y; + k++; + } + } + } + } + return k; +} + +void increment_grid(double *grid, double *lines, long long n) { + double *intersections = (double*) malloc(n*n*2*sizeof(double)); + int y, x, k; + k = get_intersections(lines, intersections, n); + for (int i=0; i < k; i++) { + x = (int) (intersections[i*2 + 0] + 0.5); + y = (int) (intersections[i*2 + 1] + 0.5); + grid[y*(W+1) + x] += 1.; + } + free(intersections); +} diff --git a/selfdrive/locationd/kalman/__init__.py b/selfdrive/locationd/kalman/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/selfdrive/locationd/kalman/ekf_c.c b/selfdrive/locationd/kalman/ekf_c.c new file mode 100644 index 00000000000000..1331036de383e2 --- /dev/null +++ b/selfdrive/locationd/kalman/ekf_c.c @@ -0,0 +1,124 @@ +#include +#include + +typedef Eigen::Matrix DDM; +typedef Eigen::Matrix EEM; +typedef Eigen::Matrix DEM; + +void predict(double *in_x, double *in_P, double *in_Q, double dt) { + typedef Eigen::Matrix RRM; + + double nx[DIM] = {0}; + double in_F[EDIM*EDIM] = {0}; + + // functions from sympy + f_fun(in_x, dt, nx); + F_fun(in_x, dt, in_F); + + + EEM F(in_F); + EEM P(in_P); + EEM Q(in_Q); + + RRM F_main = F.topLeftCorner(MEDIM, MEDIM); + P.topLeftCorner(MEDIM, MEDIM) = (F_main * P.topLeftCorner(MEDIM, MEDIM)) * F_main.transpose(); + P.topRightCorner(MEDIM, EDIM - MEDIM) = F_main * P.topRightCorner(MEDIM, EDIM - MEDIM); + P.bottomLeftCorner(EDIM - MEDIM, MEDIM) = P.bottomLeftCorner(EDIM - MEDIM, MEDIM) * F_main.transpose(); + + P = P + dt*Q; + + // copy out state + memcpy(in_x, nx, DIM * sizeof(double)); + memcpy(in_P, P.data(), EDIM * EDIM * sizeof(double)); +} + +// note: extra_args dim only correct when null space projecting +// otherwise 1 +template +void update(double *in_x, double *in_P, Hfun h_fun, Hfun H_fun, Hfun Hea_fun, double *in_z, double *in_R, double *in_ea, double MAHA_THRESHOLD) { + typedef Eigen::Matrix ZZM; + typedef Eigen::Matrix ZDM; + typedef Eigen::Matrix ZEM; + typedef Eigen::Matrix XEM; + typedef Eigen::Matrix EZM; + typedef Eigen::Matrix X1M; + typedef Eigen::Matrix XXM; + + double in_hx[ZDIM] = {0}; + double in_H[ZDIM * DIM] = {0}; + double in_H_mod[EDIM * DIM] = {0}; + double delta_x[EDIM] = {0}; + double x_new[DIM] = {0}; + + + // state x, P + Eigen::Matrix z(in_z); + EEM P(in_P); + ZZM pre_R(in_R); + + // functions from sympy + h_fun(in_x, in_ea, in_hx); + H_fun(in_x, in_ea, in_H); + ZDM pre_H(in_H); + + // get y (y = z - hx) + Eigen::Matrix pre_y(in_hx); pre_y = z - pre_y; + X1M y; XXM H; XXM R; + if (Hea_fun){ + typedef Eigen::Matrix ZAM; + double in_Hea[ZDIM * EADIM] = {0}; + Hea_fun(in_x, in_ea, in_Hea); + ZAM Hea(in_Hea); + XXM A = Hea.transpose().fullPivLu().kernel(); + + + y = A.transpose() * pre_y; + H = A.transpose() * pre_H; + R = A.transpose() * pre_R * A; + } else { + y = pre_y; + H = pre_H; + R = pre_R; + } + // get modified H + H_mod_fun(in_x, in_H_mod); + DEM H_mod(in_H_mod); + XEM H_err = H * H_mod; + + // Do mahalobis distance test + if (MAHA_TEST){ + XXM a = (H_err * P * H_err.transpose() + R).inverse(); + double maha_dist = y.transpose() * a * y; + if (maha_dist > MAHA_THRESHOLD){ + R = 1.0e16 * R; + } + } + + // Outlier resilient weighting + double weight = 1;//(1.5)/(1 + y.squaredNorm()/R.sum()); + + // kalman gains and I_KH + XXM S = ((H_err * P) * H_err.transpose()) + R/weight; + XEM KT = S.fullPivLu().solve(H_err * P.transpose()); + //EZM K = KT.transpose(); TODO: WHY DOES THIS NOT COMPILE? + //EZM K = S.fullPivLu().solve(H_err * P.transpose()).transpose(); + //std::cout << "Here is the matrix rot:\n" << K << std::endl; + EEM I_KH = Eigen::Matrix::Identity() - (KT.transpose() * H_err); + + // update state by injecting dx + Eigen::Matrix dx(delta_x); + dx = (KT.transpose() * y); + memcpy(delta_x, dx.data(), EDIM * sizeof(double)); + err_fun(in_x, delta_x, x_new); + Eigen::Matrix x(x_new); + + // update cov + P = ((I_KH * P) * I_KH.transpose()) + ((KT.transpose() * R) * KT); + + // copy out state + memcpy(in_x, x.data(), DIM * sizeof(double)); + memcpy(in_P, P.data(), EDIM * EDIM * sizeof(double)); + memcpy(in_z, y.data(), y.rows() * sizeof(double)); +} + + diff --git a/selfdrive/locationd/kalman/ekf_sym.py b/selfdrive/locationd/kalman/ekf_sym.py new file mode 100644 index 00000000000000..2dfefe92d30a7a --- /dev/null +++ b/selfdrive/locationd/kalman/ekf_sym.py @@ -0,0 +1,564 @@ +import os +from bisect import bisect_right +import sympy as sp +import numpy as np +from numpy import dot +from common.ffi_wrapper import compile_code, wrap_compiled +from common.sympy_helpers import sympy_into_c +import scipy +from scipy.stats import chi2 + + +EXTERNAL_PATH = os.path.dirname(os.path.abspath(__file__)) + +def solve(a, b): + if a.shape[0] == 1 and a.shape[1] == 1: + #assert np.allclose(b/a[0][0], np.linalg.solve(a, b)) + return b/a[0][0] + else: + return np.linalg.solve(a, b) + +def null(H, eps=1e-12): + from scipy import linalg + u, s, vh = linalg.svd(H) + padding = max(0,np.shape(H)[1]-np.shape(s)[0]) + null_mask = np.concatenate(((s <= eps), np.ones((padding,),dtype=bool)),axis=0) + null_space = scipy.compress(null_mask, vh, axis=0) + return scipy.transpose(null_space) + +def gen_code(name, f_sym, dt_sym, x_sym, obs_eqs, dim_x, dim_err, eskf_params=None, msckf_params=None, maha_test_kinds=[]): + # optional state transition matrix, H modifier + # and err_function if an error-state kalman filter (ESKF) + # is desired. Best described in "Quaternion kinematics + # for the error-state Kalman filter" by Joan Sola + + if eskf_params: + err_eqs = eskf_params[0] + inv_err_eqs = eskf_params[1] + H_mod_sym = eskf_params[2] + f_err_sym = eskf_params[3] + x_err_sym = eskf_params[4] + else: + nom_x = sp.MatrixSymbol('nom_x',dim_x,1) + true_x = sp.MatrixSymbol('true_x',dim_x,1) + delta_x = sp.MatrixSymbol('delta_x',dim_x,1) + err_function_sym = sp.Matrix(nom_x + delta_x) + inv_err_function_sym = sp.Matrix(true_x - nom_x) + err_eqs = [err_function_sym, nom_x, delta_x] + inv_err_eqs = [inv_err_function_sym, nom_x, true_x] + + H_mod_sym = sp.Matrix(np.eye(dim_x)) + f_err_sym = f_sym + x_err_sym = x_sym + + # This configures the multi-state augmentation + # needed for EKF-SLAM with MSCKF (Mourikis et al 2007) + if msckf_params: + msckf = True + dim_main = msckf_params[0] # size of the main state + dim_augment = msckf_params[1] # size of one augment state chunk + dim_main_err = msckf_params[2] + dim_augment_err = msckf_params[3] + N = msckf_params[4] + feature_track_kinds = msckf_params[5] + assert dim_main + dim_augment*N == dim_x + assert dim_main_err + dim_augment_err*N == dim_err + else: + msckf = False + dim_main = dim_x + dim_augment = 0 + dim_main_err = dim_err + dim_augment_err = 0 + N = 0 + + # linearize with jacobians + F_sym = f_err_sym.jacobian(x_err_sym) + for sym in x_err_sym: + F_sym = F_sym.subs(sym, 0) + for i in xrange(len(obs_eqs)): + obs_eqs[i].append(obs_eqs[i][0].jacobian(x_sym)) + if msckf and obs_eqs[i][1] in feature_track_kinds: + obs_eqs[i].append(obs_eqs[i][0].jacobian(obs_eqs[i][2])) + else: + obs_eqs[i].append(None) + + # collect sympy functions + sympy_functions = [] + + # error functions + sympy_functions.append(('err_fun', err_eqs[0], [err_eqs[1], err_eqs[2]])) + sympy_functions.append(('inv_err_fun', inv_err_eqs[0], [inv_err_eqs[1], inv_err_eqs[2]])) + + # H modifier for ESKF updates + sympy_functions.append(('H_mod_fun', H_mod_sym, [x_sym])) + + # state propagation function + sympy_functions.append(('f_fun', f_sym, [x_sym, dt_sym])) + sympy_functions.append(('F_fun', F_sym, [x_sym, dt_sym])) + + # observation functions + for h_sym, kind, ea_sym, H_sym, He_sym in obs_eqs: + sympy_functions.append(('h_%d' % kind, h_sym, [x_sym, ea_sym])) + sympy_functions.append(('H_%d' % kind, H_sym, [x_sym, ea_sym])) + if msckf and kind in feature_track_kinds: + sympy_functions.append(('He_%d' % kind, He_sym, [x_sym, ea_sym])) + + # Generate and wrap all th c code + header, code = sympy_into_c(sympy_functions) + extra_header = "#define DIM %d\n" % dim_x + extra_header += "#define EDIM %d\n" % dim_err + extra_header += "#define MEDIM %d\n" % dim_main_err + extra_header += "typedef void (*Hfun)(double *, double *, double *);\n" + + extra_header += "\nvoid predict(double *x, double *P, double *Q, double dt);" + + extra_post = "" + + for h_sym, kind, ea_sym, H_sym, He_sym in obs_eqs: + if msckf and kind in feature_track_kinds: + He_str = 'He_%d' % kind + # ea_dim = ea_sym.shape[0] + else: + He_str = 'NULL' + # ea_dim = 1 # not really dim of ea but makes c function work + maha_thresh = chi2.ppf(0.95, int(h_sym.shape[0])) # mahalanobis distance for outlier detection + maha_test = kind in maha_test_kinds + extra_post += """ + void update_%d(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) { + update<%d,%d,%d>(in_x, in_P, h_%d, H_%d, %s, in_z, in_R, in_ea, MAHA_THRESH_%d); + } + """ % (kind, h_sym.shape[0], 3, maha_test, kind, kind, He_str, kind) + extra_header += "\nconst static double MAHA_THRESH_%d = %f;" % (kind, maha_thresh) + extra_header += "\nvoid update_%d(double *, double *, double *, double *, double *);" % kind + + code += "\n" + extra_header + code += "\n" + open(os.path.join(EXTERNAL_PATH, "ekf_c.c")).read() + code += "\n" + extra_post + header += "\n" + extra_header + compile_code(name, code, header, EXTERNAL_PATH) + +class EKF_sym(object): + def __init__(self, name, Q, x_initial, P_initial, dim_main, dim_main_err, + N=0, dim_augment=0, dim_augment_err=0, maha_test_kinds=[]): + ''' + Generates process function and all + observation functions for the kalman + filter. + ''' + if N > 0: + self.msckf = True + else: + self.msckf = False + self.N = N + self.dim_augment = dim_augment + self.dim_augment_err = dim_augment_err + self.dim_main = dim_main + self.dim_main_err = dim_main_err + + # state + x_initial = x_initial.reshape((-1, 1)) + self.dim_x = x_initial.shape[0] + self.dim_err = P_initial.shape[0] + assert dim_main + dim_augment*N == self.dim_x + assert dim_main_err + dim_augment_err*N == self.dim_err + + # kinds that should get mahalanobis distance + # tested for outlier rejection + self.maha_test_kinds = maha_test_kinds + + # process noise + self.Q = Q + + # rewind stuff + self.rewind_t = [] + self.rewind_states = [] + self.rewind_obscache = [] + self.init_state(x_initial, P_initial, None) + + ffi, lib = wrap_compiled(name, EXTERNAL_PATH) + kinds, self.feature_track_kinds = [], [] + for func in dir(lib): + if func[:2] == 'h_': + kinds.append(int(func[2:])) + if func[:3] == 'He_': + self.feature_track_kinds.append(int(func[3:])) + + # wrap all the sympy functions + def wrap_1lists(name): + func = eval("lib.%s" % name, {"lib":lib}) + def ret(lst1, out): + func(ffi.cast("double *", lst1.ctypes.data), + ffi.cast("double *", out.ctypes.data)) + return ret + def wrap_2lists(name): + func = eval("lib.%s" % name, {"lib":lib}) + def ret(lst1, lst2, out): + func(ffi.cast("double *", lst1.ctypes.data), + ffi.cast("double *", lst2.ctypes.data), + ffi.cast("double *", out.ctypes.data)) + return ret + def wrap_1list_1float(name): + func = eval("lib.%s" % name, {"lib":lib}) + def ret(lst1, fl, out): + func(ffi.cast("double *", lst1.ctypes.data), + ffi.cast("double", fl), + ffi.cast("double *", out.ctypes.data)) + return ret + + self.f = wrap_1list_1float("f_fun") + self.F = wrap_1list_1float("F_fun") + + self.err_function = wrap_2lists("err_fun") + self.inv_err_function = wrap_2lists("inv_err_fun") + self.H_mod = wrap_1lists("H_mod_fun") + + self.hs, self.Hs, self.Hes = {}, {}, {} + for kind in kinds: + self.hs[kind] = wrap_2lists("h_%d" % kind) + self.Hs[kind] = wrap_2lists("H_%d" % kind) + if self.msckf and kind in self.feature_track_kinds: + self.Hes[kind] = wrap_2lists("He_%d" % kind) + + # wrap the C++ predict function + def _predict_blas(x, P, dt): + lib.predict(ffi.cast("double *", x.ctypes.data), + ffi.cast("double *", P.ctypes.data), + ffi.cast("double *", self.Q.ctypes.data), + ffi.cast("double", dt)) + return x, P + + # wrap the C++ update function + def fun_wrapper(f, kind): + f = eval("lib.%s" % f, {"lib": lib}) + def _update_inner_blas(x, P, z, R, extra_args): + f(ffi.cast("double *", x.ctypes.data), + ffi.cast("double *", P.ctypes.data), + ffi.cast("double *", z.ctypes.data), + ffi.cast("double *", R.ctypes.data), + ffi.cast("double *", extra_args.ctypes.data)) + if self.msckf and kind in self.feature_track_kinds: + y = z[:-len(extra_args)] + else: + y = z + return x, P, y + return _update_inner_blas + + self._updates = {} + for kind in kinds: + self._updates[kind] = fun_wrapper("update_%d" % kind, kind) + + def _update_blas(x, P, kind, z, R, extra_args=[]): + return self._updates[kind](x, P, z, R, extra_args) + + # assign the functions + self._predict = _predict_blas + #self._predict = self._predict_python + self._update = _update_blas + #self._update = self._update_python + + + def init_state(self, state, covs, filter_time): + self.x = np.array(state.reshape((-1, 1))).astype(np.float64) + self.P = np.array(covs).astype(np.float64) + self.filter_time = filter_time + self.augment_times = [0]*self.N + self.rewind_obscache = [] + self.rewind_t = [] + self.rewind_states = [] + + def augment(self): + # TODO this is not a generalized way of doing + # this and implies that the augmented states + # are simply the first (dim_augment_state) + # elements of the main state. + assert self.msckf + d1 = self.dim_main + d2 = self.dim_main_err + d3 = self.dim_augment + d4 = self.dim_augment_err + # push through augmented states + self.x[d1:-d3] = self.x[d1+d3:] + self.x[-d3:] = self.x[:d3] + assert self.x.shape == (self.dim_x, 1) + # push through augmented covs + assert self.P.shape == (self.dim_err, self.dim_err) + P_reduced = self.P + P_reduced = np.delete(P_reduced, np.s_[d2:d2+d4], axis=1) + P_reduced = np.delete(P_reduced, np.s_[d2:d2+d4], axis=0) + assert P_reduced.shape == (self.dim_err -d4, self.dim_err -d4) + to_mult = np.zeros((self.dim_err, self.dim_err - d4)) + to_mult[:-d4,:] = np.eye(self.dim_err - d4) + to_mult[-d4:,:d4] = np.eye(d4) + self.P = to_mult.dot(P_reduced.dot(to_mult.T)) + self.augment_times = self.augment_times[1:] + self.augment_times.append(self.filter_time) + assert self.P.shape == (self.dim_err, self.dim_err) + + def state(self): + return np.array(self.x).flatten() + + def covs(self): + return self.P + + def rewind(self, t): + # find where we are rewinding to + idx = bisect_right(self.rewind_t, t) + assert self.rewind_t[idx-1] <= t + assert self.rewind_t[idx] > t # must be true, or rewind wouldn't be called + + # set the state to the time right before that + self.filter_time = self.rewind_t[idx-1] + self.x[:] = self.rewind_states[idx-1][0] + self.P[:] = self.rewind_states[idx-1][1] + + # return the observations we rewound over for fast forwarding + ret = self.rewind_obscache[idx:] + + # throw away the old future + # TODO: is this making a copy? + self.rewind_t = self.rewind_t[:idx] + self.rewind_states = self.rewind_states[:idx] + self.rewind_obscache = self.rewind_obscache[:idx] + + return ret + + def checkpoint(self, obs): + # push to rewinder + self.rewind_t.append(self.filter_time) + self.rewind_states.append((np.copy(self.x), np.copy(self.P))) + self.rewind_obscache.append(obs) + + # only keep a certain number around + REWIND_TO_KEEP = 512 + self.rewind_t = self.rewind_t[-REWIND_TO_KEEP:] + self.rewind_states = self.rewind_states[-REWIND_TO_KEEP:] + self.rewind_obscache = self.rewind_obscache[-REWIND_TO_KEEP:] + + def predict_and_update_batch(self, t, kind, z, R, extra_args=[[]], augment=False): + # TODO handle rewinding at this level" + + # rewind + if t < self.filter_time: + if len(self.rewind_t) == 0 or t < self.rewind_t[0] or t < self.rewind_t[-1] -1.0: + print "observation too old at %.3f with filter at %.3f, ignoring" % (t, self.filter_time) + return None + rewound = self.rewind(t) + else: + rewound = [] + + ret = self._predict_and_update_batch(t, kind, z, R, extra_args, augment) + + # optional fast forward + for r in rewound: + self._predict_and_update_batch(*r) + + return ret + + def _predict_and_update_batch(self, t, kind, z, R, extra_args, augment=False): + """The main kalman filter function + Predicts the state and then updates a batch of observations + + dim_x: dimensionality of the state space + dim_z: dimensionality of the observation and depends on kind + n: number of observations + + Args: + t (float): Time of observation + kind (int): Type of observation + z (vec [n,dim_z]): Measurements + R (mat [n,dim_z, dim_z]): Measurement Noise + extra_args (list, [n]): Values used in H computations + """ + # initialize time + if self.filter_time is None: + self.filter_time = t + + # predict + dt = t - self.filter_time + assert dt >= 0 + self.x, self.P = self._predict(self.x, self.P, dt) + self.filter_time = t + xk_km1, Pk_km1 = np.copy(self.x).flatten(), np.copy(self.P) + + # update batch + y = [] + for i in xrange(len(z)): + # these are from the user, so we canonicalize them + z_i = np.array(z[i], dtype=np.float64, order='F') + R_i = np.array(R[i], dtype=np.float64, order='F') + extra_args_i = np.array(extra_args[i], dtype=np.float64, order='F') + # update + self.x, self.P, y_i = self._update(self.x, self.P, kind, z_i, R_i, extra_args=extra_args_i) + y.append(y_i) + xk_k, Pk_k = np.copy(self.x).flatten(), np.copy(self.P) + + if augment: + self.augment() + + # checkpoint + self.checkpoint((t, kind, z, R, extra_args)) + + return xk_km1, xk_k, Pk_km1, Pk_k, t, kind, y, z, extra_args + + def _predict_python(self, x, P, dt): + x_new = np.zeros(x.shape, dtype=np.float64) + self.f(x, dt, x_new) + + F = np.zeros(P.shape, dtype=np.float64) + self.F(x, dt, F) + + if not self.msckf: + P = dot(dot(F, P), F.T) + else: + # Update the predicted state covariance: + # Pk+1|k = |F*Pii*FT + Q*dt F*Pij | + # |PijT*FT Pjj | + # Where F is the jacobian of the main state + # predict function, Pii is the main state's + # covariance and Q its process noise. Pij + # is the covariance between the augmented + # states and the main state. + # + d2 = self.dim_main_err # known at compile time + F_curr = F[:d2, :d2] + P[:d2, :d2] = (F_curr.dot(P[:d2, :d2])).dot(F_curr.T) + P[:d2, d2:] = F_curr.dot(P[:d2, d2:]) + P[d2:, :d2] = P[d2:, :d2].dot(F_curr.T) + + P += dt*self.Q + return x_new, P + + def _update_python(self, x, P, kind, z, R, extra_args=[]): + # init vars + z = z.reshape((-1, 1)) + h = np.zeros(z.shape, dtype=np.float64) + H = np.zeros((z.shape[0], self.dim_x), dtype=np.float64) + + # C functions + self.hs[kind](x, extra_args, h) + self.Hs[kind](x, extra_args, H) + + # y is the "loss" + y = z - h + + # *** same above this line *** + + if self.msckf and kind in self.Hes: + # Do some algebraic magic to decorrelate + He = np.zeros((z.shape[0], len(extra_args)), dtype=np.float64) + self.Hes[kind](x, extra_args, He) + + # TODO: Don't call a function here, do projection locally + A = null(He.T) + + y = A.T.dot(y) + H = A.T.dot(H) + R = A.T.dot(R.dot(A)) + + # TODO If nullspace isn't the dimension we want + if A.shape[1] + He.shape[1] != A.shape[0]: + print 'Warning: null space projection failed, measurement ignored' + return x, P, np.zeros(A.shape[0] - He.shape[1]) + + # if using eskf + H_mod = np.zeros((x.shape[0], P.shape[0]), dtype=np.float64) + self.H_mod(x, H_mod) + H = H.dot(H_mod) + + # Do mahalobis distance test + # currently just runs on msckf observations + # could run on anything if needed + if self.msckf and kind in self.maha_test_kinds: + a = np.linalg.inv(H.dot(P).dot(H.T) + R) + maha_dist = y.T.dot(a.dot(y)) + if maha_dist > chi2.ppf(0.95, y.shape[0]): + R = 10e16*R + + # *** same below this line *** + + # Outlier resilient weighting as described in: + # "A Kalman Filter for Robust Outlier Detection - Jo-Anne Ting, ..." + weight = 1 #(1.5)/(1 + np.sum(y**2)/np.sum(R)) + + S = dot(dot(H, P), H.T) + R/weight + K = solve(S, dot(H, P.T)).T + I_KH = np.eye(P.shape[0]) - dot(K, H) + + # update actual state + delta_x = dot(K, y) + P = dot(dot(I_KH, P), I_KH.T) + dot(dot(K, R), K.T) + + # inject observed error into state + x_new = np.zeros(x.shape, dtype=np.float64) + self.err_function(x, delta_x, x_new) + return x_new, P, y.flatten() + + def maha_test(self, x, P, kind, z, R, extra_args=[], maha_thresh=0.95): + # init vars + z = z.reshape((-1, 1)) + h = np.zeros(z.shape, dtype=np.float64) + H = np.zeros((z.shape[0], self.dim_x), dtype=np.float64) + + # C functions + self.hs[kind](x, extra_args, h) + self.Hs[kind](x, extra_args, H) + + # y is the "loss" + y = z - h + + # if using eskf + H_mod = np.zeros((x.shape[0], P.shape[0]), dtype=np.float64) + self.H_mod(x, H_mod) + H = H.dot(H_mod) + + a = np.linalg.inv(H.dot(P).dot(H.T) + R) + maha_dist = y.T.dot(a.dot(y)) + if maha_dist > chi2.ppf(maha_thresh, y.shape[0]): + return False + else: + return True + + + + + def rts_smooth(self, estimates, norm_quats=False): + ''' + Returns rts smoothed results of + kalman filter estimates + + If the kalman state is augmented with + old states only the main state is smoothed + ''' + xk_n = estimates[-1][0] + Pk_n = estimates[-1][2] + Fk_1 = np.zeros(Pk_n.shape, dtype=np.float64) + + states_smoothed = [xk_n] + covs_smoothed = [Pk_n] + for k in xrange(len(estimates) - 2, -1, -1): + xk1_n = xk_n + if norm_quats: + xk1_n[3:7] /= np.linalg.norm(xk1_n[3:7]) + Pk1_n = Pk_n + + xk1_k, _, Pk1_k, _, t2, _, _, _, _ = estimates[k + 1] + _, xk_k, _, Pk_k, t1, _, _, _, _ = estimates[k] + dt = t2 - t1 + self.F(xk_k, dt, Fk_1) + + d1 = self.dim_main + d2 = self.dim_main_err + Ck = np.linalg.solve(Pk1_k[:d2,:d2], Fk_1[:d2,:d2].dot(Pk_k[:d2,:d2].T)).T + xk_n = xk_k + delta_x = np.zeros((Pk_n.shape[0], 1), dtype=np.float64) + self.inv_err_function(xk1_k, xk1_n, delta_x) + delta_x[:d2] = Ck.dot(delta_x[:d2]) + x_new = np.zeros((xk_n.shape[0], 1), dtype=np.float64) + self.err_function(xk_k, delta_x, x_new) + xk_n[:d1] = x_new[:d1,0] + Pk_n = Pk_k + Pk_n[:d2,:d2] = Pk_k[:d2,:d2] + Ck.dot(Pk1_n[:d2,:d2] - Pk1_k[:d2,:d2]).dot(Ck.T) + states_smoothed.append(xk_n) + covs_smoothed.append(Pk_n) + + return np.flipud(np.vstack(states_smoothed)), np.stack(covs_smoothed, 0)[::-1] diff --git a/selfdrive/locationd/kalman/kalman_helpers.py b/selfdrive/locationd/kalman/kalman_helpers.py new file mode 100644 index 00000000000000..b15f1542e192bf --- /dev/null +++ b/selfdrive/locationd/kalman/kalman_helpers.py @@ -0,0 +1,165 @@ +import numpy as np +import os +from bisect import bisect +from tqdm import tqdm + + +class ObservationKind(object): + UNKNOWN = 0 + NO_OBSERVATION = 1 + GPS_NED = 2 + ODOMETRIC_SPEED = 3 + PHONE_GYRO = 4 + GPS_VEL = 5 + PSEUDORANGE_GPS = 6 + PSEUDORANGE_RATE_GPS = 7 + SPEED = 8 + NO_ROT = 9 + PHONE_ACCEL = 10 + ORB_POINT = 11 + ECEF_POS = 12 + CAMERA_ODO_TRANSLATION = 13 + CAMERA_ODO_ROTATION = 14 + ORB_FEATURES = 15 + MSCKF_TEST = 16 + FEATURE_TRACK_TEST = 17 + LANE_PT = 18 + IMU_FRAME = 19 + PSEUDORANGE_GLONASS = 20 + PSEUDORANGE_RATE_GLONASS = 21 + PSEUDORANGE = 22 + PSEUDORANGE_RATE = 23 + + names = ['Unknown', + 'No observation', + 'GPS NED', + 'Odometric speed', + 'Phone gyro', + 'GPS velocity', + 'GPS pseudorange', + 'GPS pseudorange rate', + 'Speed', + 'No rotation', + 'Phone acceleration', + 'ORB point', + 'ECEF pos', + 'camera odometric translation', + 'camera odometric rotation', + 'ORB features', + 'MSCKF test', + 'Feature track test', + 'Lane ecef point', + 'imu frame eulers', + 'GLONASS pseudorange', + 'GLONASS pseudorange rate'] + + @classmethod + def to_string(cls, kind): + return cls.names[kind] + + + +SAT_OBS = [ObservationKind.PSEUDORANGE_GPS, + ObservationKind.PSEUDORANGE_RATE_GPS, + ObservationKind.PSEUDORANGE_GLONASS, + ObservationKind.PSEUDORANGE_RATE_GLONASS] + + +def run_car_ekf_offline(kf, observations_by_kind): + from laika.raw_gnss import GNSSMeasurement + observations = [] + # create list of observations with element format: [kind, time, data] + for kind in observations_by_kind: + for t, data in zip(observations_by_kind[kind][0], observations_by_kind[kind][1]): + observations.append([t, kind, data]) + observations.sort(key=lambda obs: obs[0]) + + times, estimates = run_observations_through_filter(kf, observations) + + forward_states = np.stack(e[1] for e in estimates) + forward_covs = np.stack(e[3] for e in estimates) + smoothed_states, smoothed_covs = kf.rts_smooth(estimates) + + observations_dict = {} + # TODO assuming observations and estimates + # are same length may not work with VO + for e in estimates: + t = e[4] + kind = str(int(e[5])) + res = e[6] + z = e[7] + ea = e[8] + if len(z) == 0: + continue + if kind not in observations_dict: + observations_dict[kind] = {} + observations_dict[kind]['t'] = np.array(len(z)*[t]) + observations_dict[kind]['z'] = np.array(z) + observations_dict[kind]['ea'] = np.array(ea) + observations_dict[kind]['residual'] = np.array(res) + else: + observations_dict[kind]['t'] = np.append(observations_dict[kind]['t'], np.array(len(z)*[t])) + observations_dict[kind]['z'] = np.vstack((observations_dict[kind]['z'], np.array(z))) + observations_dict[kind]['ea'] = np.vstack((observations_dict[kind]['ea'], np.array(ea))) + observations_dict[kind]['residual'] = np.vstack((observations_dict[kind]['residual'], np.array(res))) + + # add svIds to gnss data + for kind in map(str, SAT_OBS): + if int(kind) in observations_by_kind and kind in observations_dict: + observations_dict[kind]['svIds'] = np.array([]) + observations_dict[kind]['CNO'] = np.array([]) + observations_dict[kind]['std'] = np.array([]) + for obs in observations_by_kind[int(kind)][1]: + observations_dict[kind]['svIds'] = np.append(observations_dict[kind]['svIds'], + np.array([obs[:,GNSSMeasurement.PRN]])) + observations_dict[kind]['std'] = np.append(observations_dict[kind]['std'], + np.array([obs[:,GNSSMeasurement.PR_STD]])) + return smoothed_states, smoothed_covs, forward_states, forward_covs, times, observations_dict + + +def run_observations_through_filter(kf, observations, filter_time=None): + estimates = [] + + for obs in tqdm(observations): + t = obs[0] + kind = obs[1] + data = obs[2] + estimates.append(kf.predict_and_observe(t, kind, data)) + times = [x[4] for x in estimates] + return times, estimates + + +def save_residuals_plot(obs, save_path, data_name): + import matplotlib.pyplot as plt + import mpld3 + fig = plt.figure(figsize=(10,20)) + fig.suptitle('Residuals of ' + data_name, fontsize=24) + n = len(obs.keys()) + start_times = [obs[kind]['t'][0] for kind in obs] + start_time = min(start_times) + xlims = [start_time + 3, start_time + 60] + + for i, kind in enumerate(obs): + ax = fig.add_subplot(n, 1, i+1) + ax.set_xlim(xlims) + t = obs[kind]['t'] + res = obs[kind]['residual'] + start_idx = bisect(t, xlims[0]) + if len(res) == start_idx: + continue + ylim = max(np.linalg.norm(res[start_idx:], axis=1)) + ax.set_ylim([-ylim, ylim]) + if int(kind) in SAT_OBS: + svIds = obs[kind]['svIds'] + for svId in set(svIds): + svId_idx = (svIds == svId) + t = obs[kind]['t'][svId_idx] + res = obs[kind]['residual'][svId_idx] + ax.plot(t, res, label='SV ' + str(int(svId))) + ax.legend(loc='right') + else: + ax.plot(t, res) + plt.title('Residual of kind ' + ObservationKind.to_string(int(kind)), fontsize=20) + plt.tight_layout() + os.makedirs(save_path) + mpld3.save_html(fig, save_path + 'residuals_plot.html') diff --git a/selfdrive/locationd/kalman/loc_local_kf.py b/selfdrive/locationd/kalman/loc_local_kf.py new file mode 100755 index 00000000000000..df6d41c77e2b3e --- /dev/null +++ b/selfdrive/locationd/kalman/loc_local_kf.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python +import numpy as np +import loc_local_model + +from kalman_helpers import ObservationKind +from ekf_sym import EKF_sym + + + +class States(object): + VELOCITY = slice(0,3) # device frame velocity in m/s + ANGULAR_VELOCITY = slice(3, 6) # roll, pitch and yaw rates in device frame in radians/s + GYRO_BIAS = slice(6, 9) # roll, pitch and yaw biases + ODO_SCALE = slice(9, 10) # odometer scale + ACCELERATION = slice(10, 13) # Acceleration in device frame in m/s**2 + + +class LocLocalKalman(object): + def __init__(self): + x_initial = np.array([0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 1, + 0, 0, 0]) + + # state covariance + P_initial = np.diag([10**2, 10**2, 10**2, + 1**2, 1**2, 1**2, + 0.05**2, 0.05**2, 0.05**2, + 0.02**2, + 1**2, 1**2, 1**2]) + + # process noise + Q = np.diag([0.0**2, 0.0**2, 0.0**2, + .01**2, .01**2, .01**2, + (0.005/100)**2, (0.005/100)**2, (0.005/100)**2, + (0.02/100)**2, + 3**2, 3**2, 3**2]) + + self.obs_noise = {ObservationKind.ODOMETRIC_SPEED: np.atleast_2d(0.2**2), + ObservationKind.PHONE_GYRO: np.diag([0.025**2, 0.025**2, 0.025**2])} + + # MSCKF stuff + self.dim_state = len(x_initial) + self.dim_main = self.dim_state + + name = 'loc_local' + loc_local_model.gen_model(name, self.dim_state) + + # init filter + self.filter = EKF_sym(name, Q, x_initial, P_initial, self.dim_main, self.dim_main) + + @property + def x(self): + return self.filter.state() + + @property + def t(self): + return self.filter.filter_time + + @property + def P(self): + return self.filter.covs() + + def predict(self, t): + if self.t: + # Does NOT modify filter state + return self.filter._predict(self.x, self.P, t - self.t)[0] + else: + raise RuntimeError("Request predict on filter with uninitialized time") + + def rts_smooth(self, estimates): + return self.filter.rts_smooth(estimates, norm_quats=True) + + + def init_state(self, state, covs_diag=None, covs=None, filter_time=None): + if covs_diag is not None: + P = np.diag(covs_diag) + elif covs is not None: + P = covs + else: + P = self.filter.covs() + self.filter.init_state(state, P, filter_time) + + def predict_and_observe(self, t, kind, data): + if len(data) > 0: + data = np.atleast_2d(data) + if kind == ObservationKind.CAMERA_ODO_TRANSLATION: + r = self.predict_and_update_odo_trans(data, t, kind) + elif kind == ObservationKind.CAMERA_ODO_ROTATION: + r = self.predict_and_update_odo_rot(data, t, kind) + elif kind == ObservationKind.ODOMETRIC_SPEED: + r = self.predict_and_update_odo_speed(data, t, kind) + else: + r = self.filter.predict_and_update_batch(t, kind, data, self.get_R(kind, len(data))) + return r + + def get_R(self, kind, n): + obs_noise = self.obs_noise[kind] + dim = obs_noise.shape[0] + R = np.zeros((n, dim, dim)) + for i in xrange(n): + R[i,:,:] = obs_noise + return R + + def predict_and_update_odo_speed(self, speed, t, kind): + z = np.array(speed) + R = np.zeros((len(speed), 1, 1)) + for i, _ in enumerate(z): + R[i,:,:] = np.diag([0.2**2]) + return self.filter.predict_and_update_batch(t, kind, z, R) + + def predict_and_update_odo_trans(self, trans, t, kind): + z = trans[:,:3] + R = np.zeros((len(trans), 3, 3)) + for i, _ in enumerate(z): + R[i,:,:] = np.diag(trans[i,3:]**2) + return self.filter.predict_and_update_batch(t, kind, z, R) + + def predict_and_update_odo_rot(self, rot, t, kind): + z = rot[:,:3] + R = np.zeros((len(rot), 3, 3)) + for i, _ in enumerate(z): + R[i,:,:] = np.diag(rot[i,3:]**2) + return self.filter.predict_and_update_batch(t, kind, z, R) + +if __name__ == "__main__": + LocLocalKalman() diff --git a/selfdrive/locationd/kalman/loc_local_model.py b/selfdrive/locationd/kalman/loc_local_model.py new file mode 100644 index 00000000000000..2d69cac024843e --- /dev/null +++ b/selfdrive/locationd/kalman/loc_local_model.py @@ -0,0 +1,80 @@ +import numpy as np +import sympy as sp +import os + +from kalman_helpers import ObservationKind +from ekf_sym import gen_code + + +def gen_model(name, dim_state): + + # check if rebuild is needed + try: + dir_path = os.path.dirname(__file__) + deps = [dir_path + '/' + 'ekf_c.c', + dir_path + '/' + 'ekf_sym.py', + dir_path + '/' + 'loc_local_model.py', + dir_path + '/' + 'loc_local_kf.py'] + + outs = [dir_path + '/' + name + '.o', + dir_path + '/' + name + '.so', + dir_path + '/' + name + '.cpp'] + out_times = map(os.path.getmtime, outs) + dep_times = map(os.path.getmtime, deps) + rebuild = os.getenv("REBUILD", False) + if min(out_times) > max(dep_times) and not rebuild: + return + map(os.remove, outs) + except OSError: + pass + + # make functions and jacobians with sympy + # state variables + state_sym = sp.MatrixSymbol('state', dim_state, 1) + state = sp.Matrix(state_sym) + v = state[0:3,:] + omega = state[3:6,:] + vroll, vpitch, vyaw = omega + vx, vy, vz = v + roll_bias, pitch_bias, yaw_bias = state[6:9,:] + odo_scale = state[9,:] + accel = state[10:13,:] + + dt = sp.Symbol('dt') + + # Time derivative of the state as a function of state + state_dot = sp.Matrix(np.zeros((dim_state, 1))) + state_dot[:3,:] = accel + + # Basic descretization, 1st order intergrator + # Can be pretty bad if dt is big + f_sym = sp.Matrix(state + dt*state_dot) + + # + # Observation functions + # + + # extra args + #imu_rot = euler_rotate(*imu_angles) + #h_gyro_sym = imu_rot*sp.Matrix([vroll + roll_bias, + # vpitch + pitch_bias, + # vyaw + yaw_bias]) + h_gyro_sym = sp.Matrix([vroll + roll_bias, + vpitch + pitch_bias, + vyaw + yaw_bias]) + + speed = vx**2 + vy**2 + vz**2 + h_speed_sym = sp.Matrix([sp.sqrt(speed)*odo_scale]) + + h_relative_motion = sp.Matrix(v) + h_phone_rot_sym = sp.Matrix([vroll, + vpitch, + vyaw]) + + + obs_eqs = [[h_speed_sym, ObservationKind.ODOMETRIC_SPEED, None], + [h_gyro_sym, ObservationKind.PHONE_GYRO, None], + [h_phone_rot_sym, ObservationKind.NO_ROT, None], + [h_relative_motion, ObservationKind.CAMERA_ODO_TRANSLATION, None], + [h_phone_rot_sym, ObservationKind.CAMERA_ODO_ROTATION, None]] + gen_code(name, f_sym, dt, state_sym, obs_eqs, dim_state, dim_state) diff --git a/selfdrive/locationd/locationd_local.py b/selfdrive/locationd/locationd_local.py new file mode 100755 index 00000000000000..0b1af2f4c15e35 --- /dev/null +++ b/selfdrive/locationd/locationd_local.py @@ -0,0 +1,274 @@ +#!/usr/bin/env python +import os +import zmq +import math +import json + +os.environ["OMP_NUM_THREADS"] = "1" +import numpy as np +from bisect import bisect_right + +from cereal import car +from common.params import Params +from common.numpy_fast import clip +import selfdrive.messaging as messaging +from selfdrive.swaglog import cloudlog +from selfdrive.controls.lib.vehicle_model import VehicleModel +from selfdrive.services import service_list +from selfdrive.locationd.kalman.loc_local_kf import LocLocalKalman +from selfdrive.locationd.kalman.kalman_helpers import ObservationKind + +DEBUG = False +kf = LocLocalKalman() # Make sure that model is generated on import time + +MAX_ANGLE_OFFSET = math.radians(10.) +MAX_ANGLE_OFFSET_TH = math.radians(9.) +MIN_STIFFNESS = 0.5 +MAX_STIFFNESS = 2.0 +MIN_SR = 0.5 +MAX_SR = 2.0 +MIN_SR_TH = 0.55 +MAX_SR_TH = 1.9 + +LEARNING_RATE = 3 + +class Localizer(object): + def __init__(self, disabled_logs=None, dog=None): + self.kf = LocLocalKalman() + self.reset_kalman() + + self.max_age = .2 # seconds + self.calibration_valid = False + + if disabled_logs is None: + self.disabled_logs = list() + else: + self.disabled_logs = disabled_logs + + def reset_kalman(self): + self.filter_time = None + self.observation_buffer = [] + self.converter = None + self.speed_counter = 0 + self.sensor_counter = 0 + + def liveLocationMsg(self, time): + fix = messaging.log.KalmanOdometry.new_message() + + predicted_state = self.kf.x + fix.trans = [float(predicted_state[0]), float(predicted_state[1]), float(predicted_state[2])] + fix.rot = [float(predicted_state[3]), float(predicted_state[4]), float(predicted_state[5])] + + return fix + + def update_kalman(self, time, kind, meas): + idx = bisect_right([x[0] for x in self.observation_buffer], time) + self.observation_buffer.insert(idx, (time, kind, meas)) + while self.observation_buffer[-1][0] - self.observation_buffer[0][0] > self.max_age: + self.kf.predict_and_observe(*self.observation_buffer.pop(0)) + + def handle_cam_odo(self, log, current_time): + self.update_kalman(current_time, ObservationKind.CAMERA_ODO_ROTATION, np.concatenate([log.cameraOdometry.rot, + log.cameraOdometry.rotStd])) + self.update_kalman(current_time, ObservationKind.CAMERA_ODO_TRANSLATION, np.concatenate([log.cameraOdometry.trans, + log.cameraOdometry.transStd])) + + def handle_car_state(self, log, current_time): + self.speed_counter += 1 + if self.speed_counter % 5 == 0: + self.update_kalman(current_time, ObservationKind.ODOMETRIC_SPEED, np.array([log.carState.vEgo])) + + def handle_sensors(self, log, current_time): + for sensor_reading in log.sensorEvents: + # TODO does not yet account for double sensor readings in the log + if sensor_reading.type == 4: + self.sensor_counter += 1 + if self.sensor_counter % LEARNING_RATE == 0: + self.update_kalman(current_time, ObservationKind.PHONE_GYRO, [-sensor_reading.gyro.v[2], -sensor_reading.gyro.v[1], -sensor_reading.gyro.v[0]]) + + def handle_log(self, log): + current_time = 1e-9 * log.logMonoTime + typ = log.which + if typ in self.disabled_logs: + return + if typ == "sensorEvents": + self.handle_sensors(log, current_time) + elif typ == "carState": + self.handle_car_state(log, current_time) + elif typ == "cameraOdometry": + self.handle_cam_odo(log, current_time) + + +class ParamsLearner(object): + def __init__(self, VM, angle_offset=0., stiffness_factor=1.0, steer_ratio=None, learning_rate=1.0): + self.VM = VM + + self.ao = math.radians(angle_offset) + self.slow_ao = math.radians(angle_offset) + self.x = stiffness_factor + self.sR = VM.sR if steer_ratio is None else steer_ratio + self.MIN_SR = MIN_SR * self.VM.sR + self.MAX_SR = MAX_SR * self.VM.sR + self.MIN_SR_TH = MIN_SR_TH * self.VM.sR + self.MAX_SR_TH = MAX_SR_TH * self.VM.sR + + self.alpha1 = 0.01 * learning_rate + self.alpha2 = 0.00025 * learning_rate + self.alpha3 = 0.1 * learning_rate + self.alpha4 = 1.0 * learning_rate + + def get_values(self): + return { + 'angleOffsetAverage': math.degrees(self.slow_ao), + 'stiffnessFactor': self.x, + 'steerRatio': self.sR, + } + + def update(self, psi, u, sa): + cF0 = self.VM.cF + cR0 = self.VM.cR + aR = self.VM.aR + aF = self.VM.aF + l = self.VM.l + m = self.VM.m + + x = self.x + ao = self.ao + sR = self.sR + + # Gradient descent: learn angle offset, tire stiffness and steer ratio. + if u > 10.0 and abs(math.degrees(sa)) < 15.: + self.ao -= self.alpha1 * 2.0*cF0*cR0*l*u*x*(1.0*cF0*cR0*l*u*x*(ao - sa) + psi*sR*(cF0*cR0*l**2*x - m*u**2*(aF*cF0 - aR*cR0)))/(sR**2*(cF0*cR0*l**2*x - m*u**2*(aF*cF0 - aR*cR0))**2) + + ao = self.slow_ao + self.slow_ao -= self.alpha2 * 2.0*cF0*cR0*l*u*x*(1.0*cF0*cR0*l*u*x*(ao - sa) + psi*sR*(cF0*cR0*l**2*x - m*u**2*(aF*cF0 - aR*cR0)))/(sR**2*(cF0*cR0*l**2*x - m*u**2*(aF*cF0 - aR*cR0))**2) + + self.x -= self.alpha3 * -2.0*cF0*cR0*l*m*u**3*(ao - sa)*(aF*cF0 - aR*cR0)*(1.0*cF0*cR0*l*u*x*(ao - sa) + psi*sR*(cF0*cR0*l**2*x - m*u**2*(aF*cF0 - aR*cR0)))/(sR**2*(cF0*cR0*l**2*x - m*u**2*(aF*cF0 - aR*cR0))**3) + + self.sR -= self.alpha4 * -2.0*cF0*cR0*l*u*x*(ao - sa)*(1.0*cF0*cR0*l*u*x*(ao - sa) + psi*sR*(cF0*cR0*l**2*x - m*u**2*(aF*cF0 - aR*cR0)))/(sR**3*(cF0*cR0*l**2*x - m*u**2*(aF*cF0 - aR*cR0))**2) + + if DEBUG: + # s1 = "Measured yaw rate % .6f" % psi + # ao = 0. + # s2 = "Uncompensated yaw % .6f" % (1.0*u*(-ao + sa)/(l*sR*(1 - m*u**2*(aF*cF0*x - aR*cR0*x)/(cF0*cR0*l**2*x**2)))) + # instant_ao = aF*m*psi*sR*u/(cR0*l*x) - aR*m*psi*sR*u/(cF0*l*x) - l*psi*sR/u + sa + s4 = "Instant AO: % .2f Avg. AO % .2f" % (math.degrees(self.ao), math.degrees(self.slow_ao)) + s5 = "Stiffnes: % .3f x" % self.x + print s4, s5 + + + self.ao = clip(self.ao, -MAX_ANGLE_OFFSET, MAX_ANGLE_OFFSET) + self.slow_ao = clip(self.slow_ao, -MAX_ANGLE_OFFSET, MAX_ANGLE_OFFSET) + self.x = clip(self.x, MIN_STIFFNESS, MAX_STIFFNESS) + self.sR = clip(self.sR, self.MIN_SR, self.MAX_SR) + + # don't check stiffness for validity, as it can change quickly if sR is off + valid = abs(self.slow_ao) < MAX_ANGLE_OFFSET_TH and \ + self.sR > self.MIN_SR_TH and self.sR < self.MAX_SR_TH + + return valid + + +def locationd_thread(gctx, addr, disabled_logs): + ctx = zmq.Context() + poller = zmq.Poller() + + car_state_socket = messaging.sub_sock(ctx, service_list['carState'].port, poller, addr=addr, conflate=True) + sensor_events_socket = messaging.sub_sock(ctx, service_list['sensorEvents'].port, poller, addr=addr, conflate=True) + camera_odometry_socket = messaging.sub_sock(ctx, service_list['cameraOdometry'].port, poller, addr=addr, conflate=True) + + kalman_odometry_socket = messaging.pub_sock(ctx, service_list['kalmanOdometry'].port) + live_parameters_socket = messaging.pub_sock(ctx, service_list['liveParameters'].port) + + params_reader = Params() + cloudlog.info("Parameter learner is waiting for CarParams") + CP = car.CarParams.from_bytes(params_reader.get("CarParams", block=True)) + VM = VehicleModel(CP) + cloudlog.info("Parameter learner got CarParams: %s" % CP.carFingerprint) + + params = params_reader.get("LiveParameters") + + # Check if car model matches + if params is not None: + params = json.loads(params) + if params.get('carFingerprint', None) != CP.carFingerprint: + cloudlog.info("Parameter learner found parameters for wrong car.") + params = None + + if params is None: + params = { + 'carFingerprint': CP.carFingerprint, + 'angleOffsetAverage': 0.0, + 'stiffnessFactor': 1.0, + 'steerRatio': VM.sR, + } + cloudlog.info("Parameter learner resetting to default values") + + cloudlog.info("Parameter starting with: %s" % str(params)) + localizer = Localizer(disabled_logs=disabled_logs) + + learner = ParamsLearner(VM, + angle_offset=params['angleOffsetAverage'], + stiffness_factor=params['stiffnessFactor'], + steer_ratio=params['steerRatio'], + learning_rate=LEARNING_RATE) + + i = 0 + while True: + for socket, event in poller.poll(timeout=1000): + log = messaging.recv_one(socket) + localizer.handle_log(log) + + if socket is car_state_socket: + if not localizer.kf.t: + continue + + if i % LEARNING_RATE == 0: + # carState is not updating the Kalman Filter, so update KF manually + localizer.kf.predict(1e-9 * log.logMonoTime) + + predicted_state = localizer.kf.x + yaw_rate = -float(predicted_state[5]) + + steering_angle = math.radians(log.carState.steeringAngle) + params_valid = learner.update(yaw_rate, log.carState.vEgo, steering_angle) + + params = messaging.new_message() + params.init('liveParameters') + params.liveParameters.valid = bool(params_valid) + params.liveParameters.angleOffset = float(math.degrees(learner.ao)) + params.liveParameters.angleOffsetAverage = float(math.degrees(learner.slow_ao)) + params.liveParameters.stiffnessFactor = float(learner.x) + params.liveParameters.steerRatio = float(learner.sR) + live_parameters_socket.send(params.to_bytes()) + + if i % 6000 == 0: # once a minute + params = learner.get_values() + params['carFingerprint'] = CP.carFingerprint + params_reader.put("LiveParameters", json.dumps(params)) + + i += 1 + elif socket is camera_odometry_socket: + msg = messaging.new_message() + msg.init('kalmanOdometry') + msg.logMonoTime = log.logMonoTime + msg.kalmanOdometry = localizer.liveLocationMsg(log.logMonoTime * 1e-9) + kalman_odometry_socket.send(msg.to_bytes()) + elif socket is sensor_events_socket: + pass + + +def main(gctx=None, addr="127.0.0.1"): + IN_CAR = os.getenv("IN_CAR", False) + disabled_logs = os.getenv("DISABLED_LOGS", "").split(",") + + # No speed for now + disabled_logs.append('carState') + if IN_CAR: + addr = "192.168.5.11" + + locationd_thread(gctx, addr, disabled_logs) + + +if __name__ == "__main__": + main() diff --git a/selfdrive/locationd/ublox.py b/selfdrive/locationd/ublox.py index 228dfc8433e9c1..70e2d2fa0d7033 100644 --- a/selfdrive/locationd/ublox.py +++ b/selfdrive/locationd/ublox.py @@ -207,10 +207,13 @@ class UBloxDescriptor: def __init__(self, name, msg_format, - fields=[], + fields=None, count_field=None, format2=None, fields2=None): + if fields is None: + fields = [] + self.name = name self.msg_format = msg_format self.fields = fields @@ -459,13 +462,13 @@ def format(self, msg): UBloxDescriptor('RXM_RAW', ';);out;""" + """is_in""" + lat_lon + """;area._[admin_level~"[24]"]; + convert area ::id = id(), admin_level = t['admin_level'], + name = t['name'], "ISO3166-1:alpha2" = t['ISO3166-1:alpha2'];out; + """ + return q + + +def query_thread(): + global last_query_result, last_query_pos, cache_valid + api = overpy.Overpass(url=OVERPASS_API_URL, headers=OVERPASS_HEADERS, timeout=10.) + + while True: + time.sleep(1) + if last_gps is not None: + fix_ok = last_gps.flags & 1 + if not fix_ok: + continue + + if last_query_pos is not None: + cur_ecef = geodetic2ecef((last_gps.latitude, last_gps.longitude, last_gps.altitude)) + prev_ecef = geodetic2ecef((last_query_pos.latitude, last_query_pos.longitude, last_query_pos.altitude)) + dist = np.linalg.norm(cur_ecef - prev_ecef) + if dist < 1000: #updated when we are 1km from the edge of the downloaded circle + continue + + if dist > 3000: + cache_valid = False + + q = build_way_query(last_gps.latitude, last_gps.longitude, radius=3000) + try: + new_result = api.query(q) + + # Build kd-tree + nodes = [] + real_nodes = [] + node_to_way = defaultdict(list) + location_info = {} + + for n in new_result.nodes: + nodes.append((float(n.lat), float(n.lon), 0)) + real_nodes.append(n) + + for way in new_result.ways: + for n in way.nodes: + node_to_way[n.id].append(way) + + for area in new_result.areas: + if area.tags.get('admin_level', '') == "2": + location_info['country'] = area.tags.get('ISO3166-1:alpha2', '') + if area.tags.get('admin_level', '') == "4": + location_info['region'] = area.tags.get('name', '') + + nodes = np.asarray(nodes) + nodes = geodetic2ecef(nodes) + tree = spatial.cKDTree(nodes) + + query_lock.acquire() + last_query_result = new_result, tree, real_nodes, node_to_way, location_info + last_query_pos = last_gps + cache_valid = True + query_lock.release() + + except Exception as e: + print e + query_lock.acquire() + last_query_result = None + query_lock.release() + + +def mapsd_thread(): + global last_gps + + context = zmq.Context() + gps_sock = messaging.sub_sock(context, service_list['gpsLocation'].port, conflate=True) + gps_external_sock = messaging.sub_sock(context, service_list['gpsLocationExternal'].port, conflate=True) + map_data_sock = messaging.pub_sock(context, service_list['liveMapData'].port) + + cur_way = None + curvature_valid = False + curvature = None + upcoming_curvature = 0. + dist_to_turn = 0. + road_points = None + + while True: + gps = messaging.recv_one(gps_sock) + gps_ext = messaging.recv_one_or_none(gps_external_sock) + + if gps_ext is not None: + gps = gps_ext.gpsLocationExternal + else: + gps = gps.gpsLocation + + last_gps = gps + + fix_ok = gps.flags & 1 + if not fix_ok or last_query_result is None or not cache_valid: + cur_way = None + curvature = None + curvature_valid = False + upcoming_curvature = 0. + dist_to_turn = 0. + road_points = None + map_valid = False + else: + map_valid = True + lat = gps.latitude + lon = gps.longitude + heading = gps.bearing + speed = gps.speed + + query_lock.acquire() + cur_way = Way.closest(last_query_result, lat, lon, heading, cur_way) + if cur_way is not None: + pnts, curvature_valid = cur_way.get_lookahead(lat, lon, heading, MAPS_LOOKAHEAD_DISTANCE) + + xs = pnts[:, 0] + ys = pnts[:, 1] + road_points = map(float, xs), map(float, ys) + + if speed < 10: + curvature_valid = False + if curvature_valid and pnts.shape[0] <= 3: + curvature_valid = False + + # The curvature is valid when at least MAPS_LOOKAHEAD_DISTANCE of road is found + if curvature_valid: + # Compute the curvature for each point + with np.errstate(divide='ignore'): + circles = [circle_through_points(*p) for p in zip(pnts, pnts[1:], pnts[2:])] + circles = np.asarray(circles) + radii = np.nan_to_num(circles[:, 2]) + radii[radii < 10] = np.inf + curvature = 1. / radii + + # Index of closest point + closest = np.argmin(np.linalg.norm(pnts, axis=1)) + dist_to_closest = pnts[closest, 0] # We can use x distance here since it should be close + + # Compute distance along path + dists = list() + dists.append(0) + for p, p_prev in zip(pnts, pnts[1:, :]): + dists.append(dists[-1] + np.linalg.norm(p - p_prev)) + dists = np.asarray(dists) + dists = dists - dists[closest] + dist_to_closest + dists = dists[1:-1] + + close_idx = np.logical_and(dists > 0, dists < 500) + dists = dists[close_idx] + curvature = curvature[close_idx] + + if len(curvature): + # TODO: Determine left or right turn + curvature = np.nan_to_num(curvature) + + # Outlier rejection + new_curvature = np.percentile(curvature, 90, interpolation='lower') + + k = 0.6 + upcoming_curvature = k * upcoming_curvature + (1 - k) * new_curvature + in_turn_indices = curvature > 0.8 * new_curvature + + if np.any(in_turn_indices): + dist_to_turn = np.min(dists[in_turn_indices]) + else: + dist_to_turn = 999 + else: + upcoming_curvature = 0. + dist_to_turn = 999 + + query_lock.release() + + dat = messaging.new_message() + dat.init('liveMapData') + + if last_gps is not None: + dat.liveMapData.lastGps = last_gps + + if cur_way is not None: + dat.liveMapData.wayId = cur_way.id + + # Seed limit + max_speed = cur_way.max_speed() + if max_speed is not None: + dat.liveMapData.speedLimitValid = True + dat.liveMapData.speedLimit = max_speed + + # TODO: use the function below to anticipate upcoming speed limits + #max_speed_ahead, max_speed_ahead_dist = cur_way.max_speed_ahead(max_speed, lat, lon, heading, MAPS_LOOKAHEAD_DISTANCE) + #if max_speed_ahead is not None and max_speed_ahead_dist is not None: + # dat.liveMapData.speedLimitAheadValid = True + # dat.liveMapData.speedLimitAhead = float(max_speed_ahead) + # dat.liveMapData.speedLimitAheadDistance = float(max_speed_ahead_dist) + + + advisory_max_speed = cur_way.advisory_max_speed() + if advisory_max_speed is not None: + dat.liveMapData.speedAdvisoryValid = True + dat.liveMapData.speedAdvisory = advisory_max_speed + + # Curvature + dat.liveMapData.curvatureValid = curvature_valid + dat.liveMapData.curvature = float(upcoming_curvature) + dat.liveMapData.distToTurn = float(dist_to_turn) + if road_points is not None: + dat.liveMapData.roadX, dat.liveMapData.roadY = road_points + if curvature is not None: + dat.liveMapData.roadCurvatureX = map(float, dists) + dat.liveMapData.roadCurvature = map(float, curvature) + + dat.liveMapData.mapValid = map_valid + + map_data_sock.send(dat.to_bytes()) + + +def main(gctx=None): + params = Params() + dongle_id = params.get("DongleId") + crash.bind_user(id=dongle_id) + crash.bind_extra(version=version, dirty=dirty, is_eon=True) + crash.install() + + main_thread = threading.Thread(target=mapsd_thread) + main_thread.daemon = True + main_thread.start() + + q_thread = threading.Thread(target=query_thread) + q_thread.daemon = True + q_thread.start() + + while True: + time.sleep(0.1) + + +if __name__ == "__main__": + main() diff --git a/selfdrive/mapd/mapd_helpers.py b/selfdrive/mapd/mapd_helpers.py new file mode 100644 index 00000000000000..0a462765ecce39 --- /dev/null +++ b/selfdrive/mapd/mapd_helpers.py @@ -0,0 +1,360 @@ +import math +import json +import numpy as np +from datetime import datetime +from common.basedir import BASEDIR +from selfdrive.config import Conversions as CV +from common.transformations.coordinates import LocalCoord, geodetic2ecef + +LOOKAHEAD_TIME = 10. +MAPS_LOOKAHEAD_DISTANCE = 50 * LOOKAHEAD_TIME + +DEFAULT_SPEEDS_JSON_FILE = BASEDIR + "/selfdrive/mapd/default_speeds.json" +DEFAULT_SPEEDS = {} +with open(DEFAULT_SPEEDS_JSON_FILE, "rb") as f: + DEFAULT_SPEEDS = json.loads(f.read()) + +DEFAULT_SPEEDS_BY_REGION_JSON_FILE = BASEDIR + "/selfdrive/mapd/default_speeds_by_region.json" +DEFAULT_SPEEDS_BY_REGION = {} +with open(DEFAULT_SPEEDS_BY_REGION_JSON_FILE, "rb") as f: + DEFAULT_SPEEDS_BY_REGION = json.loads(f.read()) + +def circle_through_points(p1, p2, p3): + """Fits a circle through three points + Formulas from: http://www.ambrsoft.com/trigocalc/circle3d.htm""" + x1, y1, _ = p1 + x2, y2, _ = p2 + x3, y3, _ = p3 + + A = x1 * (y2 - y3) - y1 * (x2 - x3) + x2 * y3 - x3 * y2 + B = (x1**2 + y1**2) * (y3 - y2) + (x2**2 + y2**2) * (y1 - y3) + (x3**2 + y3**2) * (y2 - y1) + C = (x1**2 + y1**2) * (x2 - x3) + (x2**2 + y2**2) * (x3 - x1) + (x3**2 + y3**2) * (x1 - x2) + D = (x1**2 + y1**2) * (x3 * y2 - x2 * y3) + (x2**2 + y2**2) * (x1 * y3 - x3 * y1) + (x3**2 + y3**2) * (x2 * y1 - x1 * y2) + + return (-B / (2 * A), - C / (2 * A), np.sqrt((B**2 + C**2 - 4 * A * D) / (4 * A**2))) + +def parse_speed_unit(max_speed): + """Converts a maxspeed string to m/s based on the unit present in the input. + OpenStreetMap defaults to kph if no unit is present. """ + + if not max_speed: + return None + + conversion = CV.KPH_TO_MS + if 'mph' in max_speed: + max_speed = max_speed.replace(' mph', '') + conversion = CV.MPH_TO_MS + try: + return float(max_speed) * conversion + except ValueError: + return None + +def parse_speed_tags(tags): + """Parses tags on a way to find the maxspeed string""" + max_speed = None + + if 'maxspeed' in tags: + max_speed = tags['maxspeed'] + + if 'maxspeed:conditional' in tags: + try: + max_speed_cond, cond = tags['maxspeed:conditional'].split(' @ ') + cond = cond[1:-1] + + start, end = cond.split('-') + now = datetime.now() # TODO: Get time and timezone from gps fix so this will work correctly on replays + start = datetime.strptime(start, "%H:%M").replace(year=now.year, month=now.month, day=now.day) + end = datetime.strptime(end, "%H:%M").replace(year=now.year, month=now.month, day=now.day) + + if start <= now <= end: + max_speed = max_speed_cond + except ValueError: + pass + + if not max_speed and 'source:maxspeed' in tags: + max_speed = DEFAULT_SPEEDS.get(tags['source:maxspeed'], None) + if not max_speed and 'maxspeed:type' in tags: + max_speed = DEFAULT_SPEEDS.get(tags['maxspeed:type'], None) + + max_speed = parse_speed_unit(max_speed) + return max_speed + +def geocode_maxspeed(tags, location_info): + max_speed = None + try: + geocode_country = location_info.get('country', '') + geocode_region = location_info.get('region', '') + + country_rules = DEFAULT_SPEEDS_BY_REGION.get(geocode_country, {}) + country_defaults = country_rules.get('Default', []) + for rule in country_defaults: + rule_valid = all( + tag_name in tags + and tags[tag_name] == value + for tag_name, value in rule['tags'].iteritems() + ) + if rule_valid: + max_speed = rule['speed'] + break #stop searching country + + region_rules = country_rules.get(geocode_region, []) + for rule in region_rules: + rule_valid = all( + tag_name in tags + and tags[tag_name] == value + for tag_name, value in rule['tags'].iteritems() + ) + if rule_valid: + max_speed = rule['speed'] + break #stop searching region + except KeyError: + pass + max_speed = parse_speed_unit(max_speed) + return max_speed + +class Way: + def __init__(self, way, query_results): + self.id = way.id + self.way = way + self.query_results = query_results + + points = list() + + for node in self.way.get_nodes(resolve_missing=False): + points.append((float(node.lat), float(node.lon), 0.)) + + self.points = np.asarray(points) + + @classmethod + def closest(cls, query_results, lat, lon, heading, prev_way=None): + results, tree, real_nodes, node_to_way, location_info = query_results + + cur_pos = geodetic2ecef((lat, lon, 0)) + nodes = tree.query_ball_point(cur_pos, 500) + + # If no nodes within 500m, choose closest one + if not nodes: + nodes = [tree.query(cur_pos)[1]] + + ways = [] + for n in nodes: + real_node = real_nodes[n] + ways += node_to_way[real_node.id] + ways = set(ways) + + closest_way = None + best_score = None + for way in ways: + way = Way(way, query_results) + points = way.points_in_car_frame(lat, lon, heading) + + on_way = way.on_way(lat, lon, heading, points) + if not on_way: + continue + + # Create mask of points in front and behind + x = points[:, 0] + y = points[:, 1] + angles = np.arctan2(y, x) + front = np.logical_and((-np.pi / 2) < angles, + angles < (np.pi / 2)) + behind = np.logical_not(front) + + dists = np.linalg.norm(points, axis=1) + + # Get closest point behind the car + dists_behind = np.copy(dists) + dists_behind[front] = np.NaN + closest_behind = points[np.nanargmin(dists_behind)] + + # Get closest point in front of the car + dists_front = np.copy(dists) + dists_front[behind] = np.NaN + closest_front = points[np.nanargmin(dists_front)] + + # fit line: y = a*x + b + x1, y1, _ = closest_behind + x2, y2, _ = closest_front + a = (y2 - y1) / max((x2 - x1), 1e-5) + b = y1 - a * x1 + + # With a factor of 60 a 20m offset causes the same error as a 20 degree heading error + # (A 20 degree heading offset results in an a of about 1/3) + score = abs(a) * 60. + abs(b) + + # Prefer same type of road + if prev_way is not None: + if way.way.tags.get('highway', '') == prev_way.way.tags.get('highway', ''): + score *= 0.5 + + if closest_way is None or score < best_score: + closest_way = way + best_score = score + + return closest_way + + def __str__(self): + return "%s %s" % (self.id, self.way.tags) + + def max_speed(self): + """Extracts the (conditional) speed limit from a way""" + if not self.way: + return None + + max_speed = parse_speed_tags(self.way.tags) + if not max_speed: + location_info = self.query_results[4] + max_speed = geocode_maxspeed(self.way.tags, location_info) + + return max_speed + + def max_speed_ahead(self, current_speed_limit, lat, lon, heading, lookahead): + """Look ahead for a max speed""" + if not self.way: + return None + + speed_ahead = None + speed_ahead_dist = None + lookahead_ways = 5 + way = self + for i in range(lookahead_ways): + way_pts = way.points_in_car_frame(lat, lon, heading) + + # Check current lookahead distance + max_dist = np.linalg.norm(way_pts[-1, :]) + + if max_dist > 2 * lookahead: + break + + if 'maxspeed' in way.way.tags: + spd = parse_speed_tags(way.way.tags) + if not spd: + location_info = self.query_results[4] + spd = geocode_maxspeed(way.way.tags, location_info) + if spd < current_speed_limit: + speed_ahead = spd + min_dist = np.linalg.norm(way_pts[1, :]) + speed_ahead_dist = min_dist + break + # Find next way + way = way.next_way() + if not way: + break + + return speed_ahead, speed_ahead_dist + + def advisory_max_speed(self): + if not self.way: + return None + + tags = self.way.tags + adv_speed = None + + if 'maxspeed:advisory' in tags: + adv_speed = tags['maxspeed:advisory'] + adv_speed = parse_speed_unit(adv_speed) + return adv_speed + + def on_way(self, lat, lon, heading, points=None): + if points is None: + points = self.points_in_car_frame(lat, lon, heading) + x = points[:, 0] + return np.min(x) < 0. and np.max(x) > 0. + + def closest_point(self, lat, lon, heading, points=None): + if points is None: + points = self.points_in_car_frame(lat, lon, heading) + i = np.argmin(np.linalg.norm(points, axis=1)) + return points[i] + + def distance_to_closest_node(self, lat, lon, heading, points=None): + if points is None: + points = self.points_in_car_frame(lat, lon, heading) + return np.min(np.linalg.norm(points, axis=1)) + + def points_in_car_frame(self, lat, lon, heading): + lc = LocalCoord.from_geodetic([lat, lon, 0.]) + + # Build rotation matrix + heading = math.radians(-heading + 90) + c, s = np.cos(heading), np.sin(heading) + rot = np.array([[c, s, 0.], [-s, c, 0.], [0., 0., 1.]]) + + # Convert to local coordinates + points_carframe = lc.geodetic2ned(self.points).T + + # Rotate with heading of car + points_carframe = np.dot(rot, points_carframe[(1, 0, 2), :]).T + + return points_carframe + + def next_way(self, backwards=False): + results, tree, real_nodes, node_to_way, location_info = self.query_results + + if backwards: + node = self.way.nodes[0] + else: + node = self.way.nodes[-1] + + ways = node_to_way[node.id] + + way = None + try: + # Simple heuristic to find next way + ways = [w for w in ways if w.id != self.id] + ways = [w for w in ways if w.nodes[0] == node] + + # Filter on highway tag + acceptable_tags = list() + cur_tag = self.way.tags['highway'] + acceptable_tags.append(cur_tag) + if cur_tag == 'motorway_link': + acceptable_tags.append('motorway') + acceptable_tags.append('trunk') + acceptable_tags.append('primary') + ways = [w for w in ways if w.tags['highway'] in acceptable_tags] + + # Filter on number of lanes + cur_num_lanes = int(self.way.tags['lanes']) + if len(ways) > 1: + ways_same_lanes = [w for w in ways if int(w.tags['lanes']) == cur_num_lanes] + if len(ways_same_lanes) == 1: + ways = ways_same_lanes + if len(ways) > 1: + ways = [w for w in ways if int(w.tags['lanes']) > cur_num_lanes] + if len(ways) == 1: + way = Way(ways[0], self.query_results) + + except (KeyError, ValueError): + pass + + return way + + def get_lookahead(self, lat, lon, heading, lookahead): + pnts = None + way = self + valid = False + + for i in range(5): + # Get new points and append to list + new_pnts = way.points_in_car_frame(lat, lon, heading) + + if pnts is None: + pnts = new_pnts + else: + pnts = np.vstack([pnts, new_pnts]) + + # Check current lookahead distance + max_dist = np.linalg.norm(pnts[-1, :]) + if max_dist > lookahead: + valid = True + + if max_dist > 2 * lookahead: + break + + # Find next way + way = way.next_way() + if not way: + break + + return pnts, valid diff --git a/selfdrive/orbd/.gitignore b/selfdrive/orbd/.gitignore new file mode 100644 index 00000000000000..829780eb506383 --- /dev/null +++ b/selfdrive/orbd/.gitignore @@ -0,0 +1,8 @@ +orbd +orbd_cpu +test/turbocv_profile +test/turbocv_test +dspout/* +dumb_test +bilinear_lut.h +orb_lut.h diff --git a/selfdrive/orbd/Makefile b/selfdrive/orbd/Makefile new file mode 100644 index 00000000000000..32e9c6dfa549da --- /dev/null +++ b/selfdrive/orbd/Makefile @@ -0,0 +1,105 @@ +# CPU + +CC = clang +CXX = clang++ + +WARN_FLAGS = -Werror=implicit-function-declaration \ + -Werror=incompatible-pointer-types \ + -Werror=int-conversion \ + -Werror=return-type \ + -Werror=format-extra-args + +JSON_FLAGS = -I$(PHONELIBS)/json/src + +CFLAGS = -std=gnu11 -g -O2 -fPIC $(WARN_FLAGS) -Iinclude $(JSON_FLAGS) -I. +CXXFLAGS = -std=c++11 -g -O2 -fPIC $(WARN_FLAGS) -Iinclude $(JSON_FLAGS) -I. +LDFLAGS = + +# profile +# CXXFLAGS += -DTURBOCV_PROFILE=1 + +PHONELIBS = ../../phonelibs +BASEDIR = ../.. +EXTERNAL = ../../external +PYTHONLIBS = + +UNAME_M := $(shell uname -m) + +ifeq ($(UNAME_M),x86_64) +# computer + +ZMQ_FLAGS = -I$(PHONELIBS)/zmq/aarch64/include +ZMQ_LIBS = -L$(BASEDIR)/external/zmq/lib/ \ + -l:libczmq.a -l:libzmq.a -lpthread + +OPENCV_LIBS = -lopencv_core -lopencv_highgui -lopencv_features2d -lopencv_imgproc + +CXXFLAGS += -fopenmp +LDFLAGS += -lomp + +else +# phone +ZMQ_FLAGS = -I$(PHONELIBS)/zmq/aarch64/include +ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib \ + -l:libczmq.a -l:libzmq.a \ + -lgnustl_shared + +OPENCV_FLAGS = -I$(PHONELIBS)/opencv/include +OPENCV_LIBS = -Wl,--enable-new-dtags -Wl,-rpath,/usr/local/lib/python2.7/site-packages -L/usr/local/lib/python2.7/site-packages -l:cv2.so + +endif + +.PHONY: all +all: orbd + +include ../common/cereal.mk + +DEP_OBJS = ../common/visionipc.o ../common/ipc.o ../common/swaglog.o $(PHONELIBS)/json/src/json.o + +orbd: orbd_dsp.o $(DEP_OBJS) calculator_stub.o freethedsp.o + @echo "[ LINK ] $@" + $(CXX) -fPIC -o '$@' $^ \ + $(LDFLAGS) \ + $(ZMQ_LIBS) \ + $(CEREAL_LIBS) \ + -L/usr/lib \ + -L/system/vendor/lib64 \ + -ladsprpc \ + -lm -lz -llog + +%.o: %.c + @echo "[ CC ] $@" + $(CC) $(CFLAGS) \ + $(ZMQ_FLAGS) \ + -I../ \ + -I../../ \ + -c -o '$@' '$<' + +orbd_dsp.o: orbd.cc + @echo "[ CXX ] $@" + $(CXX) $(CXXFLAGS) \ + $(CEREAL_CXXFLAGS) \ + $(ZMQ_FLAGS) \ + $(OPENCV_FLAGS) \ + -DDSP \ + -I../ \ + -I../../ \ + -I../../../ \ + -I./include \ + -c -o '$@' '$<' + +freethedsp.o: dsp/freethedsp.c + @echo "[ CC ] $@" + $(CC) $(CFLAGS) \ + -c -o '$@' '$<' + +calculator_stub.o: dsp/gen/calculator_stub.c + @echo "[ CC ] $@" + $(CC) $(CFLAGS) -I./include -c -o '$@' '$<' + +-include internal.mk + +.PHONY: clean +clean: + rm -f *.o turbocv.so orbd test/turbocv_profile test/turbocv_test test/*.o *_lut.h + diff --git a/selfdrive/orbd/dsp/freethedsp.c b/selfdrive/orbd/dsp/freethedsp.c new file mode 100644 index 00000000000000..298f4fd83143b0 --- /dev/null +++ b/selfdrive/orbd/dsp/freethedsp.c @@ -0,0 +1,119 @@ +// freethedsp by geohot +// (because the DSP should be free) +// released under MIT License + +// usage instructions: +// 1. Compile an example from the Qualcomm Hexagon SDK +// 2. Try to run it on your phone +// 3. Be very sad when "adsprpc ... dlopen error: ... signature verify start failed for ..." appears in logcat +// ...here is where people would give up before freethedsp +// 4. Compile freethedsp with 'clang -shared freethedsp.c -o freethedsp.so' (or statically link it to your program) +// 5. Run your program with 'LD_PRELOAD=./freethedsp.so ./' +// 6. OMG THE DSP WORKS +// 7. Be happy. + +// *** patch may have to change for your phone *** + +// this is patching /dsp/fastrpc_shell_0 +// correct if sha hash of fastrpc_shell_0 is "fbadc96848aefad99a95aa4edb560929dcdf78f8" +// patch to return 0xFFFFFFFF from is_test_enabled instead of 0 +// your fastrpc_shell_0 may vary +#define PATCH_ADDR 0x5200c +#define PATCH_OLD "\x40\x3f\x20\x50" +#define PATCH_NEW "\x40\x3f\x00\x5a" +#define PATCH_LEN (sizeof(PATCH_OLD)-1) +#define _BITS_IOCTL_H_ + +// under 100 lines of code begins now +#include +#include +#include +#include +#include + +// ioctl stuff +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT) +#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ + +#define _IOC(inout,group,num,len) \ + (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) +#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) + +// ion ioctls +#include +#define ION_IOC_MSM_MAGIC 'M' +#define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_MSM_MAGIC, 2, \ + struct ion_flush_data) + +struct ion_flush_data { + ion_user_handle_t handle; + int fd; + void *vaddr; + unsigned int offset; + unsigned int length; +}; + +// fastrpc ioctls +#define FASTRPC_IOCTL_INIT _IOWR('R', 6, struct fastrpc_ioctl_init) + +struct fastrpc_ioctl_init { + uint32_t flags; /* one of FASTRPC_INIT_* macros */ + uintptr_t __user file; /* pointer to elf file */ + int32_t filelen; /* elf file length */ + int32_t filefd; /* ION fd for the file */ + uintptr_t __user mem; /* mem for the PD */ + int32_t memlen; /* mem length */ + int32_t memfd; /* ION fd for the mem */ +}; + +int ioctl(int fd, unsigned long request, void *arg) { + static void *handle = NULL; + static int (*orig_ioctl)(int, int, void*); + + if (handle == NULL) { + handle = dlopen("/system/lib64/libc.so", RTLD_LAZY); + assert(handle != NULL); + orig_ioctl = dlsym(handle, "ioctl"); + } + + int ret = orig_ioctl(fd, request, arg); + + // carefully modify this one + if (request == FASTRPC_IOCTL_INIT) { + struct fastrpc_ioctl_init *init = (struct fastrpc_ioctl_init *)arg; + + // confirm patch is correct and do the patch + assert(memcmp((void*)(init->mem+PATCH_ADDR), PATCH_OLD, PATCH_LEN) == 0); + memcpy((void*)(init->mem+PATCH_ADDR), PATCH_NEW, PATCH_LEN); + + // flush cache + int ionfd = open("/dev/ion", O_RDONLY); + assert(ionfd > 0); + + struct ion_fd_data fd_data; + fd_data.fd = init->memfd; + int ret = ioctl(ionfd, ION_IOC_IMPORT, &fd_data); + assert(ret == 0); + + struct ion_flush_data flush_data; + flush_data.handle = fd_data.handle; + flush_data.vaddr = (void*)init->mem; + flush_data.offset = 0; + flush_data.length = init->memlen; + ret = ioctl(ionfd, ION_IOC_CLEAN_INV_CACHES, &flush_data); + assert(ret == 0); + + struct ion_handle_data handle_data; + handle_data.handle = fd_data.handle; + ret = ioctl(ionfd, ION_IOC_FREE, &handle_data); + assert(ret == 0); + + // cleanup + close(ionfd); + } + + return ret; +} + diff --git a/selfdrive/orbd/dsp/gen/calculator.h b/selfdrive/orbd/dsp/gen/calculator.h new file mode 100644 index 00000000000000..86a3de6717c833 --- /dev/null +++ b/selfdrive/orbd/dsp/gen/calculator.h @@ -0,0 +1,39 @@ +#ifndef _CALCULATOR_H +#define _CALCULATOR_H + +#include +typedef uint8_t uint8; +typedef uint32_t uint32; + +#ifndef __QAIC_HEADER +#define __QAIC_HEADER(ff) ff +#endif //__QAIC_HEADER + +#ifndef __QAIC_HEADER_EXPORT +#define __QAIC_HEADER_EXPORT +#endif // __QAIC_HEADER_EXPORT + +#ifndef __QAIC_HEADER_ATTRIBUTE +#define __QAIC_HEADER_ATTRIBUTE +#endif // __QAIC_HEADER_ATTRIBUTE + +#ifndef __QAIC_IMPL +#define __QAIC_IMPL(ff) ff +#endif //__QAIC_IMPL + +#ifndef __QAIC_IMPL_EXPORT +#define __QAIC_IMPL_EXPORT +#endif // __QAIC_IMPL_EXPORT + +#ifndef __QAIC_IMPL_ATTRIBUTE +#define __QAIC_IMPL_ATTRIBUTE +#endif // __QAIC_IMPL_ATTRIBUTE +#ifdef __cplusplus +extern "C" { +#endif +__QAIC_HEADER_EXPORT int __QAIC_HEADER(calculator_init)(uint32* leet) __QAIC_HEADER_ATTRIBUTE; +__QAIC_HEADER_EXPORT int __QAIC_HEADER(calculator_extract_and_match)(const uint8* img, int imgLen, uint8* features, int featuresLen) __QAIC_HEADER_ATTRIBUTE; +#ifdef __cplusplus +} +#endif +#endif //_CALCULATOR_H diff --git a/selfdrive/orbd/dsp/gen/calculator_stub.c b/selfdrive/orbd/dsp/gen/calculator_stub.c new file mode 100644 index 00000000000000..66e4a0f822158d --- /dev/null +++ b/selfdrive/orbd/dsp/gen/calculator_stub.c @@ -0,0 +1,613 @@ +#ifndef _CALCULATOR_STUB_H +#define _CALCULATOR_STUB_H +#include "calculator.h" + +// remote.h +#include +#include + +typedef uint32_t remote_handle; +typedef uint64_t remote_handle64; + +typedef struct { + void *pv; + size_t nLen; +} remote_buf; + +typedef struct { + int32_t fd; + uint32_t offset; +} remote_dma_handle; + +typedef union { + remote_buf buf; + remote_handle h; + remote_handle64 h64; + remote_dma_handle dma; +} remote_arg; + +int remote_handle_open(const char* name, remote_handle *ph); +int remote_handle_invoke(remote_handle h, uint32_t dwScalars, remote_arg *pra); +int remote_handle_close(remote_handle h); + +#define REMOTE_SCALARS_MAKEX(nAttr,nMethod,nIn,nOut,noIn,noOut) \ + ((((uint32_t) (nAttr) & 0x7) << 29) | \ + (((uint32_t) (nMethod) & 0x1f) << 24) | \ + (((uint32_t) (nIn) & 0xff) << 16) | \ + (((uint32_t) (nOut) & 0xff) << 8) | \ + (((uint32_t) (noIn) & 0x0f) << 4) | \ + ((uint32_t) (noOut) & 0x0f)) + +#ifndef _QAIC_ENV_H +#define _QAIC_ENV_H + +#ifdef __GNUC__ +#ifdef __clang__ +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#else +#pragma GCC diagnostic ignored "-Wpragmas" +#endif +#pragma GCC diagnostic ignored "-Wuninitialized" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wunused-function" +#endif + +#ifndef _ATTRIBUTE_UNUSED + +#ifdef _WIN32 +#define _ATTRIBUTE_UNUSED +#else +#define _ATTRIBUTE_UNUSED __attribute__ ((unused)) +#endif + +#endif // _ATTRIBUTE_UNUSED + +#ifndef __QAIC_REMOTE +#define __QAIC_REMOTE(ff) ff +#endif //__QAIC_REMOTE + +#ifndef __QAIC_HEADER +#define __QAIC_HEADER(ff) ff +#endif //__QAIC_HEADER + +#ifndef __QAIC_HEADER_EXPORT +#define __QAIC_HEADER_EXPORT +#endif // __QAIC_HEADER_EXPORT + +#ifndef __QAIC_HEADER_ATTRIBUTE +#define __QAIC_HEADER_ATTRIBUTE +#endif // __QAIC_HEADER_ATTRIBUTE + +#ifndef __QAIC_IMPL +#define __QAIC_IMPL(ff) ff +#endif //__QAIC_IMPL + +#ifndef __QAIC_IMPL_EXPORT +#define __QAIC_IMPL_EXPORT +#endif // __QAIC_IMPL_EXPORT + +#ifndef __QAIC_IMPL_ATTRIBUTE +#define __QAIC_IMPL_ATTRIBUTE +#endif // __QAIC_IMPL_ATTRIBUTE + +#ifndef __QAIC_STUB +#define __QAIC_STUB(ff) ff +#endif //__QAIC_STUB + +#ifndef __QAIC_STUB_EXPORT +#define __QAIC_STUB_EXPORT +#endif // __QAIC_STUB_EXPORT + +#ifndef __QAIC_STUB_ATTRIBUTE +#define __QAIC_STUB_ATTRIBUTE +#endif // __QAIC_STUB_ATTRIBUTE + +#ifndef __QAIC_SKEL +#define __QAIC_SKEL(ff) ff +#endif //__QAIC_SKEL__ + +#ifndef __QAIC_SKEL_EXPORT +#define __QAIC_SKEL_EXPORT +#endif // __QAIC_SKEL_EXPORT + +#ifndef __QAIC_SKEL_ATTRIBUTE +#define __QAIC_SKEL_ATTRIBUTE +#endif // __QAIC_SKEL_ATTRIBUTE + +#ifdef __QAIC_DEBUG__ + #ifndef __QAIC_DBG_PRINTF__ + #include + #define __QAIC_DBG_PRINTF__( ee ) do { printf ee ; } while(0) + #endif +#else + #define __QAIC_DBG_PRINTF__( ee ) (void)0 +#endif + + +#define _OFFSET(src, sof) ((void*)(((char*)(src)) + (sof))) + +#define _COPY(dst, dof, src, sof, sz) \ + do {\ + struct __copy { \ + char ar[sz]; \ + };\ + *(struct __copy*)_OFFSET(dst, dof) = *(struct __copy*)_OFFSET(src, sof);\ + } while (0) + +#define _COPYIF(dst, dof, src, sof, sz) \ + do {\ + if(_OFFSET(dst, dof) != _OFFSET(src, sof)) {\ + _COPY(dst, dof, src, sof, sz); \ + } \ + } while (0) + +_ATTRIBUTE_UNUSED +static __inline void _qaic_memmove(void* dst, void* src, int size) { + int i; + for(i = 0; i < size; ++i) { + ((char*)dst)[i] = ((char*)src)[i]; + } +} + +#define _MEMMOVEIF(dst, src, sz) \ + do {\ + if(dst != src) {\ + _qaic_memmove(dst, src, sz);\ + } \ + } while (0) + + +#define _ASSIGN(dst, src, sof) \ + do {\ + dst = OFFSET(src, sof); \ + } while (0) + +#define _STD_STRLEN_IF(str) (str == 0 ? 0 : strlen(str)) + +#define AEE_SUCCESS 0 +#define AEE_EOFFSET 0x80000400 +#define AEE_EBADPARM (AEE_EOFFSET + 0x00E) + +#define _TRY(ee, func) \ + do { \ + if (AEE_SUCCESS != ((ee) = func)) {\ + __QAIC_DBG_PRINTF__((__FILE__ ":%d:error:%d:%s\n", __LINE__, (int)(ee),#func));\ + goto ee##bail;\ + } \ + } while (0) + +#define _CATCH(exception) exception##bail: if (exception != AEE_SUCCESS) + +#define _ASSERT(nErr, ff) _TRY(nErr, 0 == (ff) ? AEE_EBADPARM : AEE_SUCCESS) + +#ifdef __QAIC_DEBUG__ +#define _ALLOCATE(nErr, pal, size, alignment, pv) _TRY(nErr, _allocator_alloc(pal, __FILE_LINE__, size, alignment, (void**)&pv)) +#else +#define _ALLOCATE(nErr, pal, size, alignment, pv) _TRY(nErr, _allocator_alloc(pal, 0, size, alignment, (void**)&pv)) +#endif + + +#endif // _QAIC_ENV_H + +#ifndef _ALLOCATOR_H +#define _ALLOCATOR_H + +#include +#include + +typedef struct _heap _heap; +struct _heap { + _heap* pPrev; + const char* loc; + uint64_t buf; +}; + +typedef struct _allocator { + _heap* pheap; + uint8_t* stack; + uint8_t* stackEnd; + int nSize; +} _allocator; + +_ATTRIBUTE_UNUSED +static __inline int _heap_alloc(_heap** ppa, const char* loc, int size, void** ppbuf) { + _heap* pn = 0; + pn = malloc(size + sizeof(_heap) - sizeof(uint64_t)); + if(pn != 0) { + pn->pPrev = *ppa; + pn->loc = loc; + *ppa = pn; + *ppbuf = (void*)&(pn->buf); + return 0; + } else { + return -1; + } +} +#define _ALIGN_SIZE(x, y) (((x) + (y-1)) & ~(y-1)) + +_ATTRIBUTE_UNUSED +static __inline int _allocator_alloc(_allocator* me, + const char* loc, + int size, + unsigned int al, + void** ppbuf) { + if(size < 0) { + return -1; + } else if (size == 0) { + *ppbuf = 0; + return 0; + } + if((_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size) < (uintptr_t)me->stack + me->nSize) { + *ppbuf = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al); + me->stackEnd = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size; + return 0; + } else { + return _heap_alloc(&me->pheap, loc, size, ppbuf); + } +} + +_ATTRIBUTE_UNUSED +static __inline void _allocator_deinit(_allocator* me) { + _heap* pa = me->pheap; + while(pa != 0) { + _heap* pn = pa; + const char* loc = pn->loc; + (void)loc; + pa = pn->pPrev; + free(pn); + } +} + +_ATTRIBUTE_UNUSED +static __inline void _allocator_init(_allocator* me, uint8_t* stack, int stackSize) { + me->stack = stack; + me->stackEnd = stack + stackSize; + me->nSize = stackSize; + me->pheap = 0; +} + + +#endif // _ALLOCATOR_H + +#ifndef SLIM_H +#define SLIM_H + +#include + +//a C data structure for the idl types that can be used to implement +//static and dynamic language bindings fairly efficiently. +// +//the goal is to have a minimal ROM and RAM footprint and without +//doing too many allocations. A good way to package these things seemed +//like the module boundary, so all the idls within one module can share +//all the type references. + + +#define PARAMETER_IN 0x0 +#define PARAMETER_OUT 0x1 +#define PARAMETER_INOUT 0x2 +#define PARAMETER_ROUT 0x3 +#define PARAMETER_INROUT 0x4 + +//the types that we get from idl +#define TYPE_OBJECT 0x0 +#define TYPE_INTERFACE 0x1 +#define TYPE_PRIMITIVE 0x2 +#define TYPE_ENUM 0x3 +#define TYPE_STRING 0x4 +#define TYPE_WSTRING 0x5 +#define TYPE_STRUCTURE 0x6 +#define TYPE_UNION 0x7 +#define TYPE_ARRAY 0x8 +#define TYPE_SEQUENCE 0x9 + +//these require the pack/unpack to recurse +//so it's a hint to those languages that can optimize in cases where +//recursion isn't necessary. +#define TYPE_COMPLEX_STRUCTURE (0x10 | TYPE_STRUCTURE) +#define TYPE_COMPLEX_UNION (0x10 | TYPE_UNION) +#define TYPE_COMPLEX_ARRAY (0x10 | TYPE_ARRAY) +#define TYPE_COMPLEX_SEQUENCE (0x10 | TYPE_SEQUENCE) + + +typedef struct Type Type; + +#define INHERIT_TYPE\ + int32_t nativeSize; /*in the simple case its the same as wire size and alignment*/\ + union {\ + struct {\ + const uintptr_t p1;\ + const uintptr_t p2;\ + } _cast;\ + struct {\ + uint32_t iid;\ + uint32_t bNotNil;\ + } object;\ + struct {\ + const Type *arrayType;\ + int32_t nItems;\ + } array;\ + struct {\ + const Type *seqType;\ + int32_t nMaxLen;\ + } seqSimple; \ + struct {\ + uint32_t bFloating;\ + uint32_t bSigned;\ + } prim; \ + const SequenceType* seqComplex;\ + const UnionType *unionType;\ + const StructType *structType;\ + int32_t stringMaxLen;\ + uint8_t bInterfaceNotNil;\ + } param;\ + uint8_t type;\ + uint8_t nativeAlignment\ + +typedef struct UnionType UnionType; +typedef struct StructType StructType; +typedef struct SequenceType SequenceType; +struct Type { + INHERIT_TYPE; +}; + +struct SequenceType { + const Type * seqType; + uint32_t nMaxLen; + uint32_t inSize; + uint32_t routSizePrimIn; + uint32_t routSizePrimROut; +}; + +//byte offset from the start of the case values for +//this unions case value array. it MUST be aligned +//at the alignment requrements for the descriptor +// +//if negative it means that the unions cases are +//simple enumerators, so the value read from the descriptor +//can be used directly to find the correct case +typedef union CaseValuePtr CaseValuePtr; +union CaseValuePtr { + const uint8_t* value8s; + const uint16_t* value16s; + const uint32_t* value32s; + const uint64_t* value64s; +}; + +//these are only used in complex cases +//so I pulled them out of the type definition as references to make +//the type smaller +struct UnionType { + const Type *descriptor; + uint32_t nCases; + const CaseValuePtr caseValues; + const Type * const *cases; + int32_t inSize; + int32_t routSizePrimIn; + int32_t routSizePrimROut; + uint8_t inAlignment; + uint8_t routAlignmentPrimIn; + uint8_t routAlignmentPrimROut; + uint8_t inCaseAlignment; + uint8_t routCaseAlignmentPrimIn; + uint8_t routCaseAlignmentPrimROut; + uint8_t nativeCaseAlignment; + uint8_t bDefaultCase; +}; + +struct StructType { + uint32_t nMembers; + const Type * const *members; + int32_t inSize; + int32_t routSizePrimIn; + int32_t routSizePrimROut; + uint8_t inAlignment; + uint8_t routAlignmentPrimIn; + uint8_t routAlignmentPrimROut; +}; + +typedef struct Parameter Parameter; +struct Parameter { + INHERIT_TYPE; + uint8_t mode; + uint8_t bNotNil; +}; + +#define SLIM_IFPTR32(is32,is64) (sizeof(uintptr_t) == 4 ? (is32) : (is64)) +#define SLIM_SCALARS_IS_DYNAMIC(u) (((u) & 0x00ffffff) == 0x00ffffff) + +typedef struct Method Method; +struct Method { + uint32_t uScalars; //no method index + int32_t primInSize; + int32_t primROutSize; + int maxArgs; + int numParams; + const Parameter * const *params; + uint8_t primInAlignment; + uint8_t primROutAlignment; +}; + +typedef struct Interface Interface; + +struct Interface { + int nMethods; + const Method * const *methodArray; + int nIIds; + const uint32_t *iids; + const uint16_t* methodStringArray; + const uint16_t* methodStrings; + const char* strings; +}; + + +#endif //SLIM_H + + +#ifndef _CALCULATOR_SLIM_H +#define _CALCULATOR_SLIM_H + +// remote.h + +#include + +#ifndef __QAIC_SLIM +#define __QAIC_SLIM(ff) ff +#endif +#ifndef __QAIC_SLIM_EXPORT +#define __QAIC_SLIM_EXPORT +#endif + +static const Type types[1]; +static const Type types[1] = {{0x1,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x1}}; +static const Parameter parameters[3] = {{0x4,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x4,3,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8),0,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8),3,0}}; +static const Parameter* const parameterArrays[3] = {(&(parameters[1])),(&(parameters[2])),(&(parameters[0]))}; +static const Method methods[2] = {{REMOTE_SCALARS_MAKEX(0,0,0x0,0x1,0x0,0x0),0x0,0x4,1,1,(&(parameterArrays[2])),0x1,0x4},{REMOTE_SCALARS_MAKEX(0,0,0x2,0x1,0x0,0x0),0x8,0x0,5,2,(&(parameterArrays[0])),0x4,0x1}}; +static const Method* const methodArrays[2] = {&(methods[0]),&(methods[1])}; +static const char strings[41] = "extract_and_match\0features\0leet\0init\0img\0"; +static const uint16_t methodStrings[5] = {0,37,18,32,27}; +static const uint16_t methodStringsArrays[2] = {3,0}; +__QAIC_SLIM_EXPORT const Interface __QAIC_SLIM(calculator_slim) = {2,&(methodArrays[0]),0,0,&(methodStringsArrays [0]),methodStrings,strings}; +#endif //_CALCULATOR_SLIM_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _const_calculator_handle +#define _const_calculator_handle ((remote_handle)-1) +#endif //_const_calculator_handle + +static void _calculator_pls_dtor(void* data) { + remote_handle* ph = (remote_handle*)data; + if(_const_calculator_handle != *ph) { + (void)__QAIC_REMOTE(remote_handle_close)(*ph); + *ph = _const_calculator_handle; + } +} + +static int _calculator_pls_ctor(void* ctx, void* data) { + remote_handle* ph = (remote_handle*)data; + *ph = _const_calculator_handle; + if(*ph == (remote_handle)-1) { + return __QAIC_REMOTE(remote_handle_open)((const char*)ctx, ph); + } + return 0; +} + +#if (defined __qdsp6__) || (defined __hexagon__) +#pragma weak adsp_pls_add_lookup +extern int adsp_pls_add_lookup(uint32_t type, uint32_t key, int size, int (*ctor)(void* ctx, void* data), void* ctx, void (*dtor)(void* ctx), void** ppo); +#pragma weak HAP_pls_add_lookup +extern int HAP_pls_add_lookup(uint32_t type, uint32_t key, int size, int (*ctor)(void* ctx, void* data), void* ctx, void (*dtor)(void* ctx), void** ppo); + +__QAIC_STUB_EXPORT remote_handle _calculator_handle(void) { + remote_handle* ph; + if(adsp_pls_add_lookup) { + if(0 == adsp_pls_add_lookup((uint32_t)_calculator_handle, 0, sizeof(*ph), _calculator_pls_ctor, "calculator", _calculator_pls_dtor, (void**)&ph)) { + return *ph; + } + return (remote_handle)-1; + } else if(HAP_pls_add_lookup) { + if(0 == HAP_pls_add_lookup((uint32_t)_calculator_handle, 0, sizeof(*ph), _calculator_pls_ctor, "calculator", _calculator_pls_dtor, (void**)&ph)) { + return *ph; + } + return (remote_handle)-1; + } + return(remote_handle)-1; +} + +#else //__qdsp6__ || __hexagon__ + +uint32_t _calculator_atomic_CompareAndExchange(uint32_t * volatile puDest, uint32_t uExchange, uint32_t uCompare); + +#ifdef _WIN32 +#include "Windows.h" +uint32_t _calculator_atomic_CompareAndExchange(uint32_t * volatile puDest, uint32_t uExchange, uint32_t uCompare) { + return (uint32_t)InterlockedCompareExchange((volatile LONG*)puDest, (LONG)uExchange, (LONG)uCompare); +} +#elif __GNUC__ +uint32_t _calculator_atomic_CompareAndExchange(uint32_t * volatile puDest, uint32_t uExchange, uint32_t uCompare) { + return __sync_val_compare_and_swap(puDest, uCompare, uExchange); +} +#endif //_WIN32 + + +__QAIC_STUB_EXPORT remote_handle _calculator_handle(void) { + static remote_handle handle = _const_calculator_handle; + if((remote_handle)-1 != handle) { + return handle; + } else { + remote_handle tmp; + int nErr = _calculator_pls_ctor("calculator", (void*)&tmp); + if(nErr) { + return (remote_handle)-1; + } + if(((remote_handle)-1 != handle) || ((remote_handle)-1 != (remote_handle)_calculator_atomic_CompareAndExchange((uint32_t*)&handle, (uint32_t)tmp, (uint32_t)-1))) { + _calculator_pls_dtor(&tmp); + } + return handle; + } +} + +#endif //__qdsp6__ + +__QAIC_STUB_EXPORT int __QAIC_STUB(calculator_skel_invoke)(uint32_t _sc, remote_arg* _pra) __QAIC_STUB_ATTRIBUTE { + return __QAIC_REMOTE(remote_handle_invoke)(_calculator_handle(), _sc, _pra); +} + +#ifdef __cplusplus +} +#endif + + +#ifdef __cplusplus +extern "C" { +#endif +extern int remote_register_dma_handle(int, uint32_t); +static __inline int _stub_method(remote_handle _handle, uint32_t _mid, uint32_t _rout0[1]) { + int _numIn[1]; + remote_arg _pra[1]; + uint32_t _primROut[1]; + int _nErr = 0; + _numIn[0] = 0; + _pra[(_numIn[0] + 0)].buf.pv = (void*)_primROut; + _pra[(_numIn[0] + 0)].buf.nLen = sizeof(_primROut); + _TRY(_nErr, __QAIC_REMOTE(remote_handle_invoke)(_handle, REMOTE_SCALARS_MAKEX(0, _mid, 0, 1, 0, 0), _pra)); + _COPY(_rout0, 0, _primROut, 0, 4); + _CATCH(_nErr) {} + return _nErr; +} +__QAIC_STUB_EXPORT int __QAIC_STUB(calculator_init)(uint32* leet) __QAIC_STUB_ATTRIBUTE { + uint32_t _mid = 0; + return _stub_method(_calculator_handle(), _mid, (uint32_t*)leet); +} +static __inline int _stub_method_1(remote_handle _handle, uint32_t _mid, char* _in0[1], uint32_t _in0Len[1], char* _rout1[1], uint32_t _rout1Len[1]) { + int _numIn[1]; + remote_arg _pra[3]; + uint32_t _primIn[2]; + remote_arg* _praIn; + remote_arg* _praROut; + int _nErr = 0; + _numIn[0] = 1; + _pra[0].buf.pv = (void*)_primIn; + _pra[0].buf.nLen = sizeof(_primIn); + _COPY(_primIn, 0, _in0Len, 0, 4); + _praIn = (_pra + 1); + _praIn[0].buf.pv = _in0[0]; + _praIn[0].buf.nLen = (1 * _in0Len[0]); + _COPY(_primIn, 4, _rout1Len, 0, 4); + _praROut = (_praIn + _numIn[0] + 0); + _praROut[0].buf.pv = _rout1[0]; + _praROut[0].buf.nLen = (1 * _rout1Len[0]); + _TRY(_nErr, __QAIC_REMOTE(remote_handle_invoke)(_handle, REMOTE_SCALARS_MAKEX(0, _mid, 2, 1, 0, 0), _pra)); + _CATCH(_nErr) {} + return _nErr; +} +__QAIC_STUB_EXPORT int __QAIC_STUB(calculator_extract_and_match)(const uint8* img, int imgLen, uint8* features, int featuresLen) __QAIC_STUB_ATTRIBUTE { + uint32_t _mid = 1; + return _stub_method_1(_calculator_handle(), _mid, (char**)&img, (uint32_t*)&imgLen, (char**)&features, (uint32_t*)&featuresLen); +} +#ifdef __cplusplus +} +#endif +#endif //_CALCULATOR_STUB_H diff --git a/selfdrive/orbd/dsp/gen/libcalculator_skel.so b/selfdrive/orbd/dsp/gen/libcalculator_skel.so new file mode 100755 index 00000000000000..e48cab48208b0f Binary files /dev/null and b/selfdrive/orbd/dsp/gen/libcalculator_skel.so differ diff --git a/selfdrive/orbd/extractor.h b/selfdrive/orbd/extractor.h new file mode 100644 index 00000000000000..f506cd3868a05d --- /dev/null +++ b/selfdrive/orbd/extractor.h @@ -0,0 +1,38 @@ +#ifndef EXTRACTOR_H +#define EXTRACTOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define ORBD_KEYPOINTS 3000 +#define ORBD_DESCRIPTOR_LENGTH 32 +#define ORBD_HEIGHT 874 +#define ORBD_WIDTH 1164 +#define ORBD_FOCAL 910 + +// matches OrbFeatures from log.capnp +struct orb_features { + // align this + uint16_t n_corners; + uint16_t xy[ORBD_KEYPOINTS][2]; + uint8_t octave[ORBD_KEYPOINTS]; + uint8_t des[ORBD_KEYPOINTS][ORBD_DESCRIPTOR_LENGTH]; + int16_t matches[ORBD_KEYPOINTS]; +}; + +// forward declare this +struct pyramid; + +// manage the pyramids in extractor.c +void init_gpyrs(); +int extract_and_match_gpyrs(const uint8_t *img, struct orb_features *); +int extract_and_match(const uint8_t *img, struct pyramid *pyrs, struct pyramid *prev_pyrs, struct orb_features *); + +#ifdef __cplusplus +} +#endif + +#endif // EXTRACTOR_H diff --git a/selfdrive/orbd/orbd.cc b/selfdrive/orbd/orbd.cc new file mode 100644 index 00000000000000..ce0d47aec6efbd --- /dev/null +++ b/selfdrive/orbd/orbd.cc @@ -0,0 +1,191 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "common/visionipc.h" +#include "common/swaglog.h" + +#include "extractor.h" + +#ifdef DSP +#include "dsp/gen/calculator.h" +#else +#include "turbocv.h" +#endif + +#include +#include +#include "cereal/gen/cpp/log.capnp.h" + +#ifndef PATH_MAX +#include +#endif + +volatile int do_exit = 0; + +static void set_do_exit(int sig) { + do_exit = 1; +} + +int main(int argc, char *argv[]) { + int err; + setpriority(PRIO_PROCESS, 0, -13); + printf("starting orbd\n"); + +#ifdef DSP + uint32_t test_leet = 0; + char my_path[PATH_MAX+1]; + memset(my_path, 0, sizeof(my_path)); + + ssize_t len = readlink("/proc/self/exe", my_path, sizeof(my_path)); + assert(len > 5); + my_path[len-5] = '\0'; + LOGW("running from %s with PATH_MAX %d", my_path, PATH_MAX); + + char adsp_path[PATH_MAX+1]; + snprintf(adsp_path, PATH_MAX, "ADSP_LIBRARY_PATH=%s/dsp/gen", my_path); + assert(putenv(adsp_path) == 0); + + assert(calculator_init(&test_leet) == 0); + assert(test_leet == 0x1337); + LOGW("orbd init complete"); +#else + init_gpyrs(); +#endif + + signal(SIGINT, (sighandler_t) set_do_exit); + signal(SIGTERM, (sighandler_t) set_do_exit); + + void *ctx = zmq_ctx_new(); + + void *orb_features_sock = zmq_socket(ctx, ZMQ_PUB); + assert(orb_features_sock); + zmq_bind(orb_features_sock, "tcp://*:8058"); + + void *orb_features_summary_sock = zmq_socket(ctx, ZMQ_PUB); + assert(orb_features_summary_sock); + zmq_bind(orb_features_summary_sock, "tcp://*:8062"); + + struct orb_features *features = (struct orb_features *)malloc(sizeof(struct orb_features)); + int last_frame_id = 0; + uint64_t frame_count = 0; + + // every other frame + const int RATE = 2; + + VisionStream stream; + while (!do_exit) { + VisionStreamBufs buf_info; + err = visionstream_init(&stream, VISION_STREAM_YUV, true, &buf_info); + if (err) { + printf("visionstream connect fail\n"); + usleep(100000); + continue; + } + uint64_t timestamp_last_eof = 0; + while (!do_exit) { + VIPCBuf *buf; + VIPCBufExtra extra; + buf = visionstream_get(&stream, &extra); + if (buf == NULL) { + printf("visionstream get failed\n"); + break; + } + + // every other frame + frame_count++; + if ((frame_count%RATE) != 0) { + continue; + } + + uint64_t start = nanos_since_boot(); +#ifdef DSP + int ret = calculator_extract_and_match((uint8_t *)buf->addr, ORBD_HEIGHT*ORBD_WIDTH, (uint8_t *)features, sizeof(struct orb_features)); +#else + int ret = extract_and_match_gpyrs((uint8_t *) buf->addr, features); +#endif + uint64_t end = nanos_since_boot(); + LOGD("total(%d): %6.2f ms to get %4d features on %d", ret, (end-start)/1000000.0, features->n_corners, extra.frame_id); + assert(ret == 0); + + if (last_frame_id+RATE != extra.frame_id) { + LOGW("dropped frame!"); + } + + last_frame_id = extra.frame_id; + + if (timestamp_last_eof == 0) { + timestamp_last_eof = extra.timestamp_eof; + continue; + } + + int match_count = 0; + + // *** send OrbFeatures *** + { + // create capnp message + capnp::MallocMessageBuilder msg; + cereal::Event::Builder event = msg.initRoot(); + event.setLogMonoTime(nanos_since_boot()); + + auto orb_features = event.initOrbFeatures(); + + // set timestamps + orb_features.setTimestampEof(extra.timestamp_eof); + orb_features.setTimestampLastEof(timestamp_last_eof); + + // init descriptors for send + kj::ArrayPtr descriptorsPtr = kj::arrayPtr((uint8_t *)features->des, ORBD_DESCRIPTOR_LENGTH * features->n_corners); + orb_features.setDescriptors(descriptorsPtr); + + auto xs = orb_features.initXs(features->n_corners); + auto ys = orb_features.initYs(features->n_corners); + auto octaves = orb_features.initOctaves(features->n_corners); + auto matches = orb_features.initMatches(features->n_corners); + + // copy out normalized keypoints + for (int i = 0; i < features->n_corners; i++) { + xs.set(i, (features->xy[i][0] * 1.0f - ORBD_WIDTH / 2) / ORBD_FOCAL); + ys.set(i, (features->xy[i][1] * 1.0f - ORBD_HEIGHT / 2) / ORBD_FOCAL); + octaves.set(i, features->octave[i]); + matches.set(i, features->matches[i]); + match_count += features->matches[i] != -1; + } + + auto words = capnp::messageToFlatArray(msg); + auto bytes = words.asBytes(); + zmq_send(orb_features_sock, bytes.begin(), bytes.size(), 0); + } + + // *** send OrbFeaturesSummary *** + + { + // create capnp message + capnp::MallocMessageBuilder msg; + cereal::Event::Builder event = msg.initRoot(); + event.setLogMonoTime(nanos_since_boot()); + + auto orb_features_summary = event.initOrbFeaturesSummary(); + + orb_features_summary.setTimestampEof(extra.timestamp_eof); + orb_features_summary.setTimestampLastEof(timestamp_last_eof); + orb_features_summary.setFeatureCount(features->n_corners); + orb_features_summary.setMatchCount(match_count); + orb_features_summary.setComputeNs(end-start); + + auto words = capnp::messageToFlatArray(msg); + auto bytes = words.asBytes(); + zmq_send(orb_features_summary_sock, bytes.begin(), bytes.size(), 0); + } + + timestamp_last_eof = extra.timestamp_eof; + } + } + visionstream_destroy(&stream); + return 0; +} + diff --git a/selfdrive/orbd/orbd_wrapper.sh b/selfdrive/orbd/orbd_wrapper.sh new file mode 100755 index 00000000000000..8ec7443a30d4f7 --- /dev/null +++ b/selfdrive/orbd/orbd_wrapper.sh @@ -0,0 +1,13 @@ +#!/bin/sh +finish() { + echo "exiting orbd" + pkill -SIGINT -P $$ +} + +trap finish EXIT + +while true; do + ./orbd & + wait $! +done + diff --git a/selfdrive/registration.py b/selfdrive/registration.py index 4327ed3a87da03..9b7e6964ef92b5 100644 --- a/selfdrive/registration.py +++ b/selfdrive/registration.py @@ -7,7 +7,10 @@ from common.params import Params def get_imei(): - return subprocess.check_output(["getprop", "oem.device.imeicache"]).strip() + ret = subprocess.check_output(["getprop", "oem.device.imeicache"]).strip() + if ret == "": + ret = "000000000000000" + return ret def get_serial(): return subprocess.check_output(["getprop", "ro.serialno"]).strip() diff --git a/selfdrive/sensord/gpsd b/selfdrive/sensord/gpsd index 20e5332795d31b..540f9b161a28a3 100755 Binary files a/selfdrive/sensord/gpsd and b/selfdrive/sensord/gpsd differ diff --git a/selfdrive/sensord/sensord b/selfdrive/sensord/sensord index 58f9d233c70ba6..40c678c1e033b7 100755 Binary files a/selfdrive/sensord/sensord and b/selfdrive/sensord/sensord differ diff --git a/selfdrive/service_list.yaml b/selfdrive/service_list.yaml index ae2351f5819ab2..627d40df85341d 100644 --- a/selfdrive/service_list.yaml +++ b/selfdrive/service_list.yaml @@ -70,6 +70,11 @@ uiLayoutState: [8060, true] frontEncodeIdx: [8061, true] orbFeaturesSummary: [8062, true] driverMonitoring: [8063, true] +liveParameters: [8064, true] +liveMapData: [8065, true] +cameraOdometry: [8066, true] +pathPlan: [8067, true] +kalmanOdometry: [8068, true] testModel: [8040, false] testLiveLocation: [8045, false] diff --git a/selfdrive/test/plant/plant.py b/selfdrive/test/plant/plant.py index 6c3eb66555825c..903a7e4f73ec7a 100755 --- a/selfdrive/test/plant/plant.py +++ b/selfdrive/test/plant/plant.py @@ -11,6 +11,7 @@ from selfdrive.config import Conversions as CV import selfdrive.messaging as messaging from selfdrive.services import service_list +from selfdrive.car import crc8_pedal from selfdrive.car.honda.hondacan import fix from selfdrive.car.honda.values import CAR from selfdrive.car.honda.carstate import get_can_signals @@ -242,7 +243,7 @@ def step(self, v_lead=0.0, cruise_buttons=None, grade=0.0, publish_model = True) 'INTERCEPTOR_GAS', ]) vls = vls_tuple( - self.speed_sensor(speed), + self.speed_sensor(speed), self.speed_sensor(speed), self.speed_sensor(speed), self.speed_sensor(speed), self.speed_sensor(speed), self.angle_steer, self.angle_steer_rate, 0, #Steer torque sensor 0, 0, # Blinkers @@ -284,12 +285,19 @@ def step(self, v_lead=0.0, cruise_buttons=None, grade=0.0, publish_model = True) if "COUNTER" in honda.get_signals(msg): msg_struct["COUNTER"] = self.rk.frame % 4 + if "COUNTER_PEDAL" in honda.get_signals(msg): + msg_struct["COUNTER_PEDAL"] = self.rk.frame % 0xf + msg = honda.lookup_msg_id(msg) msg_data = honda.encode(msg, msg_struct) if "CHECKSUM" in honda.get_signals(msg): msg_data = fix(msg_data, msg) + if "CHECKSUM_PEDAL" in honda.get_signals(msg): + msg_struct["CHECKSUM_PEDAL"] = crc8_pedal([ord(i) for i in msg_data][:-1]) + msg_data = honda.encode(msg, msg_struct) + can_msgs.append([msg, 0, msg_data, 0]) # add the radar message @@ -302,6 +310,14 @@ def step(self, v_lead=0.0, cruise_buttons=None, grade=0.0, publish_model = True) "0f00000" can_msgs.append([0x400, 0, radar_state_msg, 1]) can_msgs.append([0x445, 0, radar_msg.decode("hex"), 1]) + + # add camera msg so controlsd thinks it's alive + msg_struct["COUNTER"] = self.rk.frame % 4 + msg = honda.lookup_msg_id(0xe4) + msg_data = honda.encode(msg, msg_struct) + msg_data = fix(msg_data, 0xe4) + can_msgs.append([0xe4, 0, msg_data, 2]) + Plant.logcan.send(can_list_to_can_capnp(can_msgs).to_bytes()) # ******** publish a fake model going straight and fake calibration ******** diff --git a/selfdrive/test/test_fingerprints.py b/selfdrive/test/test_fingerprints.py new file mode 100755 index 00000000000000..b1f1a97a2d41ef --- /dev/null +++ b/selfdrive/test/test_fingerprints.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python2 +import os +import sys +from common.basedir import BASEDIR + +def _get_fingerprints(): + # read all the folders in selfdrive/car and return a dict where: + # - keys are all the car names that which we have a fingerprint dict for + # - values are dicts of fingeprints for each trim + fingerprints = {} + for car_folder in [x[0] for x in os.walk(BASEDIR + '/selfdrive/car')]: + car_name = car_folder.split('/')[-1] + try: + fingerprints[car_name] = __import__('selfdrive.car.%s.values' % car_name, fromlist=['FINGERPRINTS']).FINGERPRINTS + except (ImportError, IOError, AttributeError): + pass + + return fingerprints + + +def check_fingerprint_consistency(f1, f2): + # return false if it finds a fingerprint fully included in another + + # max message worth checking is 1900, as above that they usually come too infrequently and not + # usable for fingerprinting + max_msg = 1900 + + is_f1_in_f2 = True + for k in f1: + if (k not in f2 or f1[k] != f2[k]) and k < max_msg: + is_f1_in_f2 = False + + is_f2_in_f1 = True + for k in f2: + if (k not in f1 or f2[k] != f1[k]) and k < max_msg: + is_f2_in_f1 = False + + return not is_f1_in_f2 and not is_f2_in_f1 + + +fingerprints = _get_fingerprints() +fingerprints_flat = [] +car_names = [] +for brand in fingerprints: + for car in fingerprints[brand]: + fingerprints_flat += fingerprints[brand][car] + for i in range(len(fingerprints[brand][car])): + car_names.append(car) + + +valid = True +for idx1, f1 in enumerate(fingerprints_flat): + for idx2, f2 in enumerate(fingerprints_flat): + if idx1 < idx2 and not check_fingerprint_consistency(f1, f2): + valid = False + print "Those two fingerprints are inconsistent", car_names[idx1], car_names[idx2] + print "" + print ', '.join("%d: %d" % v for v in sorted(f1.items())) + print "" + print ', '.join("%d: %d" % v for v in sorted(f2.items())) + print "" + +print "Found ", len(fingerprints_flat), " individual fingerprints" +if not valid or len(fingerprints_flat) == 0: + print "TEST FAILED" + sys.exit(1) +else: + print "TEST SUCESSFUL" diff --git a/selfdrive/test/tests/plant/test_longitudinal.py b/selfdrive/test/tests/plant/test_longitudinal.py index e5affb62765d45..9806f5a19015a4 100755 --- a/selfdrive/test/tests/plant/test_longitudinal.py +++ b/selfdrive/test/tests/plant/test_longitudinal.py @@ -105,6 +105,16 @@ def create_dir(path): speed_lead_breakpoints = [0., 15., 21.66], cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)] ), + Maneuver( + 'steady state following a car at 20m/s, then lead decel to 0mph at 5m/s^2', + duration=40., + initial_speed = 20., + lead_relevancy=True, + initial_distance_lead=35., + speed_lead_values = [20., 20., 0.], + speed_lead_breakpoints = [0., 15., 19.], + cruise_button_presses = [(CB.DECEL_SET, 1.2), (0, 1.3)] + ), Maneuver( 'starting at 0mph, approaching a stopped car 100m away', duration=30., @@ -251,7 +261,8 @@ def create_dir(path): ) ] -#maneuvers = [maneuvers[-1]] +# maneuvers = [maneuvers[-11]] +# maneuvers = [maneuvers[6]] def setup_output(): output_dir = os.path.join(os.getcwd(), 'out/longitudinal') @@ -293,15 +304,11 @@ def setUpClass(cls): manager.gctx = {} manager.prepare_managed_process('radard') manager.prepare_managed_process('controlsd') - - manager.start_managed_process('radard') - manager.start_managed_process('controlsd') + manager.prepare_managed_process('plannerd') @classmethod def tearDownClass(cls): - manager.kill_managed_process('radard') - manager.kill_managed_process('controlsd') - time.sleep(5) + pass # hack def test_longitudinal_setup(self): @@ -311,9 +318,18 @@ def test_longitudinal_setup(self): def run_maneuver_worker(k): output_dir = os.path.join(os.getcwd(), 'out/longitudinal') for i, man in enumerate(maneuvers[k::WORKERS]): + manager.start_managed_process('radard') + manager.start_managed_process('controlsd') + manager.start_managed_process('plannerd') + score, plot = man.evaluate() plot.write_plot(output_dir, "maneuver" + str(WORKERS * i + k+1).zfill(2)) + manager.kill_managed_process('radard') + manager.kill_managed_process('controlsd') + manager.kill_managed_process('plannerd') + time.sleep(5) + for k in xrange(WORKERS): setattr(LongitudinalControl, "test_longitudinal_maneuvers_%d" % (k+1), @@ -321,4 +337,3 @@ def run_maneuver_worker(k): if __name__ == "__main__": unittest.main() - diff --git a/selfdrive/thermald.py b/selfdrive/thermald.py index 97e63b143892c0..fea5a896846756 100755 --- a/selfdrive/thermald.py +++ b/selfdrive/thermald.py @@ -2,7 +2,7 @@ import os import zmq from smbus2 import SMBus - +from cereal import log from selfdrive.version import training_version from selfdrive.swaglog import cloudlog import selfdrive.messaging as messaging @@ -10,9 +10,11 @@ from selfdrive.loggerd.config import ROOT from common.params import Params from common.realtime import sec_since_boot +from common.numpy_fast import clip +from common.filter_simple import FirstOrderFilter -import cereal -ThermalStatus = cereal.log.ThermalData.ThermalStatus +ThermalStatus = log.ThermalData.ThermalStatus +CURRENT_TAU = 2. # 2s time constant def read_tz(x): with open("/sys/devices/virtual/thermal/thermal_zone%d/temp" % x) as f: @@ -56,8 +58,16 @@ def set_eon_fan(val): if last_eon_fan_val is None or last_eon_fan_val != val: bus = SMBus(7, force=True) if LEON: - i = [0x1, 0x3 | 0, 0x3 | 0x08, 0x3 | 0x10][val] - bus.write_i2c_block_data(0x3d, 0, [i]) + try: + i = [0x1, 0x3 | 0, 0x3 | 0x08, 0x3 | 0x10][val] + bus.write_i2c_block_data(0x3d, 0, [i]) + except IOError: + # tusb320 + if val == 0: + bus.write_i2c_block_data(0x67, 0xa, [0]) + else: + bus.write_i2c_block_data(0x67, 0xa, [0x20]) + bus.write_i2c_block_data(0x67, 0x8, [(val-1)<<6]) else: bus.write_byte_data(0x21, 0x04, 0x2) bus.write_byte_data(0x21, 0x03, (val*2)+1) @@ -71,12 +81,13 @@ def set_eon_fan(val): _TEMP_THRS_L = [42.5, 57.5, 72.5, 10000] # fan speed options _FAN_SPEEDS = [0, 16384, 32768, 65535] -# max fan speed only allowed if battery if hot +# max fan speed only allowed if battery is hot _BAT_TEMP_THERSHOLD = 45. -def handle_fan(max_temp, bat_temp, fan_speed): - new_speed_h = next(speed for speed, temp_h in zip(_FAN_SPEEDS, _TEMP_THRS_H) if temp_h > max_temp) - new_speed_l = next(speed for speed, temp_l in zip(_FAN_SPEEDS, _TEMP_THRS_L) if temp_l > max_temp) + +def handle_fan(max_cpu_temp, bat_temp, fan_speed): + new_speed_h = next(speed for speed, temp_h in zip(_FAN_SPEEDS, _TEMP_THRS_H) if temp_h > max_cpu_temp) + new_speed_l = next(speed for speed, temp_l in zip(_FAN_SPEEDS, _TEMP_THRS_L) if temp_l > max_cpu_temp) if new_speed_h > fan_speed: # update speed if using the high thresholds results in fan speed increment @@ -93,6 +104,23 @@ def handle_fan(max_temp, bat_temp, fan_speed): return fan_speed + +def check_car_battery_voltage(should_start, health, charging_disabled): + + # charging disallowed if: + # - there are health packets from panda, and; + # - 12V battery voltage is too low, and; + # - onroad isn't started + if charging_disabled and (health is None or health.health.voltage > 11800): + charging_disabled = False + os.system('echo "1" > /sys/class/power_supply/battery/charging_enabled') + elif not charging_disabled and health is not None and health.health.voltage < 11500 and not should_start: + charging_disabled = True + os.system('echo "0" > /sys/class/power_supply/battery/charging_enabled') + + return charging_disabled + + class LocationStarter(object): def __init__(self): self.last_good_loc = 0 @@ -123,9 +151,13 @@ def update(self, started_ts, location): cloudlog.event("location_start", location=location.to_dict() if location else None) return location.speed*3.6 > 10 + def thermald_thread(): setup_eon_fan() + # prevent LEECO from undervoltage + BATT_PERC_OFF = 10 if LEON else 3 + # now loop context = zmq.Context() thermal_sock = messaging.pub_sock(context, service_list['thermal'].port) @@ -141,11 +173,16 @@ def thermald_thread(): passive_starter = LocationStarter() thermal_status = ThermalStatus.green health_sock.RCVTIMEO = 1500 + current_filter = FirstOrderFilter(0., CURRENT_TAU, 1.) + + # Make sure charging is enabled + charging_disabled = False + os.system('echo "1" > /sys/class/power_supply/battery/charging_enabled') params = Params() while 1: - td = messaging.recv_sock(health_sock, wait=True) + health = messaging.recv_sock(health_sock, wait=True) location = messaging.recv_sock(location_sock) location = location.gpsLocation if location else None msg = read_thermal() @@ -160,44 +197,51 @@ def thermald_thread(): msg.thermal.batteryPercent = int(f.read()) with open("/sys/class/power_supply/battery/status") as f: msg.thermal.batteryStatus = f.read().strip() - with open("/sys/class/power_supply/usb/online") as f: + with open("/sys/class/power_supply/battery/current_now") as f: + msg.thermal.batteryCurrent = int(f.read()) + with open("/sys/class/power_supply/battery/voltage_now") as f: + msg.thermal.batteryVoltage = int(f.read()) + with open("/sys/class/power_supply/usb/present") as f: msg.thermal.usbOnline = bool(int(f.read())) + current_filter.update(msg.thermal.batteryCurrent / 1e6) + # TODO: add car battery voltage check - max_temp = max(msg.thermal.cpu0, msg.thermal.cpu1, - msg.thermal.cpu2, msg.thermal.cpu3) / 10.0 + max_cpu_temp = max(msg.thermal.cpu0, msg.thermal.cpu1, + msg.thermal.cpu2, msg.thermal.cpu3) / 10.0 + max_comp_temp = max(max_cpu_temp, msg.thermal.mem / 10., msg.thermal.gpu / 10.) bat_temp = msg.thermal.bat/1000. - fan_speed = handle_fan(max_temp, bat_temp, fan_speed) + fan_speed = handle_fan(max_cpu_temp, bat_temp, fan_speed) msg.thermal.fanSpeed = fan_speed - # thermal logic here - - if max_temp < 70.0: - thermal_status = ThermalStatus.green - if max_temp > 85.0: - cloudlog.warning("over temp: %r", max_temp) - thermal_status = ThermalStatus.yellow - - # from controls - overtemp_proc = any(t > 950 for t in - (msg.thermal.cpu0, msg.thermal.cpu1, msg.thermal.cpu2, - msg.thermal.cpu3, msg.thermal.mem, msg.thermal.gpu)) - overtemp_bat = msg.thermal.bat > 60000 # 60c - if overtemp_proc or overtemp_bat: - # TODO: hysteresis - thermal_status = ThermalStatus.red - - if max_temp > 107.0 or msg.thermal.bat >= 63000: + # thermal logic with hysterisis + if max_cpu_temp > 107. or bat_temp >= 63.: + # onroad not allowed thermal_status = ThermalStatus.danger + elif max_comp_temp > 95. or bat_temp > 60.: + # hysteresis between onroad not allowed and engage not allowed + thermal_status = clip(thermal_status, ThermalStatus.red, ThermalStatus.danger) + elif max_cpu_temp > 90.0: + # hysteresis between engage not allowed and uploader not allowed + thermal_status = clip(thermal_status, ThermalStatus.yellow, ThermalStatus.red) + elif max_cpu_temp > 85.0: + # uploader not allowed + thermal_status = ThermalStatus.yellow + elif max_cpu_temp > 75.0: + # hysteresis between uploader not allowed and all good + thermal_status = clip(thermal_status, ThermalStatus.green, ThermalStatus.yellow) + else: + # all good + thermal_status = ThermalStatus.green # **** starting logic **** # start constellation of processes when the car starts - ignition = td is not None and td.health.started + ignition = health is not None and health.health.started ignition_seen = ignition_seen or ignition # add voltage check for ignition - if not ignition_seen and td is not None and td.health.voltage > 13500: + if not ignition_seen and health is not None and health.health.voltage > 13500: ignition = True do_uninstall = params.get("DoUninstall") == "1" @@ -210,7 +254,7 @@ def thermald_thread(): passive = (params.get("Passive") == "1") # start on gps movement if we haven't seen ignition and are in passive mode - should_start = should_start or (not (ignition_seen and td) # seen ignition and panda is connected + should_start = should_start or (not (ignition_seen and health) # seen ignition and panda is connected and passive and passive_starter.update(started_ts, location)) @@ -225,7 +269,7 @@ def thermald_thread(): # if any CPU gets above 107 or the battery gets above 63, kill all processes # controls will warn with CPU above 95 or battery above 60 - if msg.thermal.thermalStatus >= ThermalStatus.danger: + if thermal_status >= ThermalStatus.danger: # TODO: Add a better warning when this is happening should_start = False @@ -242,10 +286,14 @@ def thermald_thread(): # shutdown if the battery gets lower than 3%, it's discharging, we aren't running for # more than a minute but we were running - if msg.thermal.batteryPercent < 3 and msg.thermal.batteryStatus == "Discharging" and \ + if msg.thermal.batteryPercent < BATT_PERC_OFF and msg.thermal.batteryStatus == "Discharging" and \ started_seen and (sec_since_boot() - off_ts) > 60: os.system('LD_LIBRARY_PATH="" svc power shutdown') + charging_disabled = check_car_battery_voltage(should_start, health, charging_disabled) + + msg.thermal.chargingDisabled = charging_disabled + msg.thermal.chargingError = current_filter.x > 1.0 # if current is > 1A out, then charger might be off msg.thermal.started = started_ts is not None msg.thermal.startedTs = int(1e9*(started_ts or 0)) @@ -257,7 +305,7 @@ def thermald_thread(): if (count%60) == 0: cloudlog.event("STATUS_PACKET", count=count, - health=(td.to_dict() if td else None), + health=(health.to_dict() if health else None), location=(location.to_dict() if location else None), thermal=msg.to_dict()) diff --git a/selfdrive/tombstoned.py b/selfdrive/tombstoned.py index bac43a0a19772a..c76294e6c56864 100644 --- a/selfdrive/tombstoned.py +++ b/selfdrive/tombstoned.py @@ -11,8 +11,9 @@ from selfdrive.swaglog import cloudlog def get_tombstones(): - return [("/data/tombstones/"+fn, int(os.stat("/data/tombstones/"+fn).st_ctime) ) - for fn in os.listdir("/data/tombstones") if fn.startswith("tombstone")] + DIR_DATA = "/data/tombstones/" + return [(DIR_DATA + fn, int(os.stat(DIR_DATA + fn).st_ctime) ) + for fn in os.listdir(DIR_DATA) if fn.startswith("tombstone")] def report_tombstone(fn, client): mtime = os.path.getmtime(fn) diff --git a/selfdrive/ui/Makefile b/selfdrive/ui/Makefile index e9a5f6f84c465d..a78a48cf2a9193 100644 --- a/selfdrive/ui/Makefile +++ b/selfdrive/ui/Makefile @@ -30,14 +30,18 @@ OPENCL_LIBS = -lgsl -lCB -lOpenCL OPENGL_LIBS = -lGLESv3 +OPENSL_LIBS = -lOpenSLES + FRAMEBUFFER_LIBS = -lutils -lgui -lEGL CFLAGS += -DQCOM CXXFLAGS += -DQCOM -OBJS = ui.o \ +OBJS = slplay.o \ + ui.o \ ../common/glutil.o \ ../common/visionipc.o \ + ../common/ipc.o \ ../common/visionimg.o \ ../common/visionbuf_ion.o \ ../common/framebuffer.o \ @@ -63,8 +67,17 @@ ui: $(OBJS) -lhardware -lui \ $(OPENGL_LIBS) \ $(OPENCL_LIBS) \ + ${OPENSL_LIBS} \ + -Wl,-rpath=/system/lib64,-rpath=/system/comma/usr/lib \ -lcutils -lm -llog -lui -ladreno_utils +slplay.o: slplay.c + @echo "[ CC ] $@" + $(CC) $(CFLAGS) -fPIC \ + -I../ \ + $(OPENSL_LIBS) \ + -c -o '$@' $^ + %.o: %.cc @echo "[ CXX ] $@" $(CXX) $(CXXFLAGS) -MMD \ diff --git a/selfdrive/ui/slplay.c b/selfdrive/ui/slplay.c new file mode 100644 index 00000000000000..6e5d8b95389140 --- /dev/null +++ b/selfdrive/ui/slplay.c @@ -0,0 +1,184 @@ +#include +#include +#include +#include +#include + +#include "common/timing.h" +#include "slplay.h" + +SLEngineItf engineInterface = NULL; +SLObjectItf outputMix = NULL; +SLObjectItf engine = NULL; +uri_player players[32] = {{NULL, NULL, NULL}}; + +uint64_t loop_start = 0; +uint64_t loop_start_ctx = 0; + +uri_player* get_player_by_uri(const char* uri) { + for (uri_player *s = players; s->uri != NULL; s++) { + if (strcmp(s->uri, uri) == 0) { + return s; + } + } + + return NULL; +} + +uri_player* slplay_create_player_for_uri(const char* uri, char **error) { + uri_player player = { uri, NULL, NULL }; + + SLresult result; + SLDataLocator_URI locUri = {SL_DATALOCATOR_URI, (SLchar *) uri}; + SLDataFormat_MIME formatMime = {SL_DATAFORMAT_MIME, NULL, SL_CONTAINERTYPE_UNSPECIFIED}; + SLDataSource audioSrc = {&locUri, &formatMime}; + + SLDataLocator_OutputMix outMix = {SL_DATALOCATOR_OUTPUTMIX, outputMix}; + SLDataSink audioSnk = {&outMix, NULL}; + + result = (*engineInterface)->CreateAudioPlayer(engineInterface, &player.player, &audioSrc, &audioSnk, 0, NULL, NULL); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to create audio player"); + return NULL; + } + + result = (*(player.player))->Realize(player.player, SL_BOOLEAN_FALSE); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to realize audio player"); + return NULL; + } + + result = (*(player.player))->GetInterface(player.player, SL_IID_PLAY, &(player.playInterface)); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to get player interface"); + return NULL; + } + + result = (*(player.playInterface))->SetPlayState(player.playInterface, SL_PLAYSTATE_PAUSED); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to initialize playstate to SL_PLAYSTATE_PAUSED"); + return NULL; + } + + uri_player *p = players; + while (p->uri != NULL) { + p++; + } + *p = player; + + return p; +} + +void slplay_setup(char **error) { + SLresult result; + SLEngineOption engineOptions[] = {{SL_ENGINEOPTION_THREADSAFE, SL_BOOLEAN_TRUE}}; + result = slCreateEngine(&engine, 1, engineOptions, 0, NULL, NULL); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to create OpenSL engine"); + } + + result = (*engine)->Realize(engine, SL_BOOLEAN_FALSE); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to realize OpenSL engine"); + } + + result = (*engine)->GetInterface(engine, SL_IID_ENGINE, &engineInterface); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to realize OpenSL engine"); + } + + const SLInterfaceID ids[1] = {SL_IID_VOLUME}; + const SLboolean req[1] = {SL_BOOLEAN_FALSE}; + result = (*engineInterface)->CreateOutputMix(engineInterface, &outputMix, 1, ids, req); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to create output mix"); + } + + result = (*outputMix)->Realize(outputMix, SL_BOOLEAN_FALSE); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to realize output mix"); + } +} + +void slplay_destroy() { + for (uri_player *player = players; player->uri != NULL; player++) { + if (player->player) { + (*(player->player))->Destroy(player->player); + } + } + + (*outputMix)->Destroy(outputMix); + (*engine)->Destroy(engine); +} + +void slplay_stop (uri_player* player, char **error) { + SLPlayItf playInterface = player->playInterface; + SLresult result; + + // stop a loop + loop_start = 0; + + result = (*playInterface)->SetPlayState(playInterface, SL_PLAYSTATE_PAUSED); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to set SL_PLAYSTATE_STOPPED"); + return; + } +} + +void slplay_stop_uri(const char* uri, char **error) { + uri_player* player = get_player_by_uri(uri); + slplay_stop(player, error); +} + +void SLAPIENTRY slplay_callback(SLPlayItf playItf, void *context, SLuint32 event) { + uint64_t cb_loop_start = *((uint64_t*)context); + if (event == SL_PLAYEVENT_HEADATEND && cb_loop_start == loop_start) { + (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_STOPPED); + (*playItf)->SetMarkerPosition(playItf, 0); + (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING); + } +} + +void slplay_play (const char *uri, bool loop, char **error) { + SLresult result; + + uri_player* player = get_player_by_uri(uri); + if (player == NULL) { + player = slplay_create_player_for_uri(uri, error); + if (*error) { + return; + } + } + + SLPlayItf playInterface = player->playInterface; + if (loop) { + loop_start = nanos_since_boot(); + loop_start_ctx = loop_start; + result = (*playInterface)->RegisterCallback(playInterface, slplay_callback, &loop_start_ctx); + if (result != SL_RESULT_SUCCESS) { + char error[64]; + snprintf(error, sizeof(error), "Failed to register callback. %d", result); + *error = error[0]; + return; + } + + result = (*playInterface)->SetCallbackEventsMask(playInterface, SL_PLAYEVENT_HEADATEND); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to set callback event mask"); + return; + } + } + + // Reset the audio player + result = (*playInterface)->ClearMarkerPosition(playInterface); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to clear marker position"); + return; + } + result = (*playInterface)->SetPlayState(playInterface, SL_PLAYSTATE_PAUSED); + result = (*playInterface)->SetPlayState(playInterface, SL_PLAYSTATE_STOPPED); + result = (*playInterface)->SetPlayState(playInterface, SL_PLAYSTATE_PLAYING); + if (result != SL_RESULT_SUCCESS) { + *error = strdup("Failed to set SL_PLAYSTATE_PLAYING"); + } +} diff --git a/selfdrive/ui/slplay.h b/selfdrive/ui/slplay.h new file mode 100644 index 00000000000000..f8c39ceeb7cb2c --- /dev/null +++ b/selfdrive/ui/slplay.h @@ -0,0 +1,21 @@ +#ifndef SLPLAY_H +#define SLPLAY_H + +#include +#include +#include + +typedef struct { + const char* uri; + SLObjectItf player; + SLPlayItf playInterface; +} uri_player; + +void slplay_setup(char **error); +uri_player* slplay_create_player_for_uri(const char* uri, char **error); +void slplay_play (const char *uri, bool loop, char **error); +void slplay_stop_uri (const char* uri, char **error); +void slplay_destroy(); + +#endif + diff --git a/selfdrive/ui/start.sh b/selfdrive/ui/start.sh new file mode 100755 index 00000000000000..89704a5b6edf93 --- /dev/null +++ b/selfdrive/ui/start.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +make +export LD_LIBRARY_PATH=/system/lib64:$LD_LIBRARY_PATH +exec ./ui diff --git a/selfdrive/ui/ui.c b/selfdrive/ui/ui.c index 6948a492f546c0..33e35d3810f4f2 100644 --- a/selfdrive/ui/ui.c +++ b/selfdrive/ui/ui.c @@ -33,11 +33,7 @@ #include "common/params.h" #include "cereal/gen/c/log.capnp.h" - -// Calibration status values from controlsd.py -#define CALIBRATION_UNCALIBRATED 0 -#define CALIBRATION_CALIBRATED 1 -#define CALIBRATION_INVALID 2 +#include "slplay.h" #define STATUS_STOPPED 0 #define STATUS_DISENGAGED 1 @@ -52,6 +48,7 @@ #define ALERTSIZE_FULL 3 #define UI_BUF_COUNT 4 +//#define DEBUG_TURN const int vwp_w = 1920; const int vwp_h = 1080; @@ -65,6 +62,10 @@ const int box_w = vwp_w-sbr_w-(bdr_s*2); const int box_h = vwp_h-(bdr_s*2); const int viz_w = vwp_w-(bdr_s*2); const int header_h = 420; +const int footer_h = 280; +const int footer_y = vwp_h-bdr_s-footer_h; + +const int UI_FREQ = 60; // Hz const uint8_t bg_colors[][4] = { [STATUS_STOPPED] = {0x07, 0x23, 0x39, 0xff}, @@ -89,8 +90,18 @@ const int alert_sizes[] = { [ALERTSIZE_FULL] = vwp_h, }; +const int SET_SPEED_NA = 255; + +// TODO: this is also hardcoded in common/transformations/camera.py +const mat3 intrinsic_matrix = (mat3){{ + 910., 0., 582., + 0., 910., 437., + 0., 0., 1. +}}; + typedef struct UIScene { int frontview; + int fullview; int transformed_width, transformed_height; @@ -107,9 +118,17 @@ typedef struct UIScene { float v_cruise; uint64_t v_cruise_update_ts; float v_ego; + float v_curvature; + bool decel_for_turn; + + float speedlimit; + bool speedlimit_valid; + bool map_valid; + float curvature; int engaged; bool engageable; + bool monitoring_active; bool uilayout_sidebarcollapsed; bool uilayout_mapenabled; @@ -133,13 +152,10 @@ typedef struct UIScene { uint64_t started_ts; - // Used to display calibration progress - int cal_status; - int cal_perc; - // Used to show gps planner status bool gps_planner_active; + bool is_playing_alert; } UIScene; typedef struct UIState { @@ -158,6 +174,9 @@ typedef struct UIState { int font_sans_semibold; int font_sans_bold; int img_wheel; + int img_turn; + int img_face; + int img_map; zsock_t *thermal_sock; void *thermal_sock_raw; @@ -173,6 +192,8 @@ typedef struct UIState { void *livempc_sock_raw; zsock_t *plus_sock; void *plus_sock_raw; + zsock_t *map_data_sock; + void *map_data_sock_raw; zsock_t *uilayout_sock; void *uilayout_sock_raw; @@ -207,17 +228,24 @@ typedef struct UIState { unsigned int rgb_front_width, rgb_front_height, rgb_front_stride; size_t rgb_front_buf_len; - bool intrinsic_matrix_loaded; - mat3 intrinsic_matrix; - UIScene scene; bool awake; int awake_timeout; + int volume_timeout; + int speed_lim_off_timeout; + int is_metric_timeout; + int limit_set_speed_timeout; + int status; bool is_metric; + bool limit_set_speed; + float speed_lim_off; + bool is_ego_over_limit; bool passive; + char alert_type[64]; + char alert_sound[64]; int alert_size; float alert_blinking_alpha; bool alert_blinked; @@ -256,12 +284,50 @@ static void set_awake(UIState *s, bool awake) { } } +static void set_volume(UIState *s, int volume) { + char volume_change_cmd[64]; + sprintf(volume_change_cmd, "service call audio 3 i32 3 i32 %d i32 1", volume); + + // 5 second timeout at 60fps + s->volume_timeout = 5 * UI_FREQ; + int volume_changed = system(volume_change_cmd); +} + volatile int do_exit = 0; static void set_do_exit(int sig) { do_exit = 1; } +static void read_speed_lim_off(UIState *s) { + char *speed_lim_off = NULL; + read_db_value(NULL, "SpeedLimitOffset", &speed_lim_off, NULL); + s->speed_lim_off = 0.; + if (speed_lim_off) { + s->speed_lim_off = strtod(speed_lim_off, NULL); + free(speed_lim_off); + } + s->speed_lim_off_timeout = 2 * UI_FREQ; // 0.5Hz +} + +static void read_is_metric(UIState *s) { + char *is_metric; + const int result = read_db_value(NULL, "IsMetric", &is_metric, NULL); + if (result == 0) { + s->is_metric = is_metric[0] == '1'; + free(is_metric); + } + s->is_metric_timeout = 2 * UI_FREQ; // 0.5Hz +} +static void read_limit_set_speed(UIState *s) { + char *limit_set_speed; + const int result = read_db_value(NULL, "LimitSetSpeed", &limit_set_speed, NULL); + if (result == 0) { + s->limit_set_speed = limit_set_speed[0] == '1'; + free(limit_set_speed); + } + s->limit_set_speed_timeout = 2 * UI_FREQ; // 0.2Hz +} static const char frame_vertex_shader[] = "attribute vec4 aPosition;\n" "attribute vec4 aTexCoord;\n" @@ -314,6 +380,51 @@ static const mat4 frame_transform = {{ 0.0, 0.0, 0.0, 1.0, }}; +// frame from 4/3 to 16/9 display +static const mat4 full_to_wide_frame_transform = {{ + .75, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0, +}}; + +typedef struct { + const char* name; + const char* uri; + bool loop; +} sound_file; + +sound_file sound_table[] = { + { "chimeDisengage", "../assets/sounds/disengaged.wav", false }, + { "chimeEngage", "../assets/sounds/engaged.wav", false }, + { "chimeWarning1", "../assets/sounds/warning_1.wav", false }, + { "chimeWarning2", "../assets/sounds/warning_2.wav", false }, + { "chimeWarningRepeat", "../assets/sounds/warning_2.wav", true }, + { "chimeError", "../assets/sounds/error.wav", false }, + { "chimePrompt", "../assets/sounds/error.wav", false }, + { NULL, NULL, false }, +}; + +sound_file* get_sound_file_by_name(const char* name) { + for (sound_file *s = sound_table; s->name != NULL; s++) { + if (strcmp(s->name, name) == 0) { + return s; + } + } + + return NULL; +} + +void ui_sound_init(char **error) { + slplay_setup(error); + if (*error) return; + + for (sound_file *s = sound_table; s->name != NULL; s++) { + slplay_create_player_for_uri(s->uri, error); + if (*error) return; + } +} + static void ui_init(UIState *s) { memset(s, 0, sizeof(UIState)); @@ -354,6 +465,10 @@ static void ui_init(UIState *s) { assert(s->plus_sock); s->plus_sock_raw = zsock_resolve(s->plus_sock); + s->map_data_sock = zsock_new_sub(">tcp://127.0.0.1:8065", ""); + assert(s->map_data_sock); + s->map_data_sock_raw = zsock_resolve(s->map_data_sock); + s->ipc_fd = -1; // init display @@ -379,6 +494,15 @@ static void ui_init(UIState *s) { assert(s->img_wheel >= 0); s->img_wheel = nvgCreateImage(s->vg, "../assets/img_chffr_wheel.png", 1); + assert(s->img_turn >= 0); + s->img_turn = nvgCreateImage(s->vg, "../assets/img_trafficSign_turn.png", 1); + + assert(s->img_face >= 0); + s->img_face = nvgCreateImage(s->vg, "../assets/img_driver_face.png", 1); + + assert(s->img_map >= 0); + s->img_map = nvgCreateImage(s->vg, "../assets/img_map.png", 1); + // init gl s->frame_program = load_program(frame_vertex_shader, frame_fragment_shader); assert(s->frame_program); @@ -412,37 +536,6 @@ static void ui_init(UIState *s) { } } -// If the intrinsics are in the params entry, this copies them to -// intrinsic_matrix and returns true. Otherwise returns false. -static bool try_load_intrinsics(mat3 *intrinsic_matrix) { - char *value; - const int result = read_db_value(NULL, "CloudCalibration", &value, NULL); - - if (result == 0) { - JsonNode* calibration_json = json_decode(value); - free(value); - - JsonNode *intrinsic_json = - json_find_member(calibration_json, "intrinsic_matrix"); - - if (intrinsic_json == NULL || intrinsic_json->tag != JSON_ARRAY) { - json_delete(calibration_json); - return false; - } - - int i = 0; - JsonNode* json_num; - json_foreach(json_num, intrinsic_json) { - intrinsic_matrix->v[i++] = json_num->number_; - } - json_delete(calibration_json); - - return true; - } else { - return false; - } -} - static void ui_init_vision(UIState *s, const VisionStreamBufs back_bufs, int num_back_fds, const int *back_fds, const VisionStreamBufs front_bufs, int num_front_fds, @@ -460,7 +553,7 @@ static void ui_init_vision(UIState *s, const VisionStreamBufs back_bufs, s->scene = (UIScene){ .frontview = getenv("FRONTVIEW") != NULL, - .cal_status = CALIBRATION_CALIBRATED, + .fullview = getenv("FULLVIEW") != NULL, .transformed_width = ui_info.transformed_width, .transformed_height = ui_info.transformed_height, .front_box_x = ui_info.front_box_x, @@ -488,12 +581,11 @@ static void ui_init_vision(UIState *s, const VisionStreamBufs back_bufs, 0.0, 0.0, 0.0, 1.0, }}; - char *value; - const int result = read_db_value(NULL, "IsMetric", &value, NULL); - if (result == 0) { - s->is_metric = value[0] == '1'; - free(value); - } + read_speed_lim_off(s); + read_is_metric(s); + read_limit_set_speed(s); + s->is_metric_timeout = UI_FREQ / 2; // offset so values isn't read together with limit offset + s->limit_set_speed_timeout = UI_FREQ; // offset so values isn't read together with limit offset } static void ui_draw_transformed_box(UIState *s, uint32_t color) { @@ -544,7 +636,7 @@ vec3 car_space_to_full_frame(const UIState *s, vec4 car_space_projective) { // The last entry is zero because of how we store E (to use matvecmul). const vec3 Ep = {{Ep4.v[0], Ep4.v[1], Ep4.v[2]}}; - const vec3 KEp = matvecmul3(s->intrinsic_matrix, Ep); + const vec3 KEp = matvecmul3(intrinsic_matrix, Ep); // Project. const vec3 p_image = {{KEp.v[0] / KEp.v[2], KEp.v[1] / KEp.v[2], 1.}}; @@ -766,23 +858,27 @@ static void draw_steering(UIState *s, float curvature) { static void draw_frame(UIState *s) { const UIScene *scene = &s->scene; - mat4 out_mat; float x1, x2, y1, y2; if (s->scene.frontview) { - out_mat = device_transform; // full 16/9 // flip horizontally so it looks like a mirror - x1 = (float)scene->front_box_x / s->rgb_front_width; - x2 = (float)(scene->front_box_x + scene->front_box_width) / s->rgb_front_width; - y2 = (float)scene->front_box_y / s->rgb_front_height; - y1 = (float)(scene->front_box_y + scene->front_box_height) / s->rgb_front_height; + x1 = 0.0; + x2 = 1.0; + y1 = 1.0; + y2 = 0.0; } else { - out_mat = matmul(device_transform, frame_transform); x1 = 1.0; x2 = 0.0; y1 = 1.0; y2 = 0.0; } + mat4 out_mat; + if (s->scene.frontview || s->scene.fullview) { + out_mat = matmul(device_transform, full_to_wide_frame_transform); + } else { + out_mat = matmul(device_transform, frame_transform); + } + const uint8_t frame_indicies[] = {0, 1, 2, 0, 2, 3}; const float frame_coords[4][4] = { {-1.0, -1.0, x2, y1}, //bl @@ -869,40 +965,177 @@ static void ui_draw_vision_maxspeed(UIState *s) { const UIScene *scene = &s->scene; int ui_viz_rx = scene->ui_viz_rx; int ui_viz_rw = scene->ui_viz_rw; - float maxspeed = s->scene.v_cruise; - const int viz_maxspeed_x = (ui_viz_rx + (bdr_s*2)); - const int viz_maxspeed_y = (box_y + (bdr_s*1.5)); - const int viz_maxspeed_w = 180; - const int viz_maxspeed_h = 202; char maxspeed_str[32]; - bool is_cruise_set = (maxspeed != 0 && maxspeed != 255); + float maxspeed = s->scene.v_cruise; + int maxspeed_calc = maxspeed * 0.6225 + 0.5; + float speedlimit = s->scene.speedlimit; + int speedlim_calc = speedlimit * 2.2369363 + 0.5; + int speed_lim_off = s->speed_lim_off * 2.2369363 + 0.5; + if (s->is_metric) { + maxspeed_calc = maxspeed + 0.5; + speedlim_calc = speedlimit * 3.6 + 0.5; + speed_lim_off = s->speed_lim_off * 3.6 + 0.5; + } + + bool is_cruise_set = (maxspeed != 0 && maxspeed != SET_SPEED_NA); + bool is_speedlim_valid = s->scene.speedlimit_valid; + bool is_set_over_limit = is_speedlim_valid && s->scene.engaged && + is_cruise_set && maxspeed_calc > (speedlim_calc + speed_lim_off); + + int viz_maxspeed_w = 184; + int viz_maxspeed_h = 202; + int viz_maxspeed_x = (ui_viz_rx + (bdr_s*2)); + int viz_maxspeed_y = (box_y + (bdr_s*1.5)); + int viz_maxspeed_xo = 180; + viz_maxspeed_w += viz_maxspeed_xo; + viz_maxspeed_x += viz_maxspeed_w - (viz_maxspeed_xo * 2); + // Draw Background + nvgBeginPath(s->vg); + nvgRoundedRect(s->vg, viz_maxspeed_x, viz_maxspeed_y, viz_maxspeed_w, viz_maxspeed_h, 30); + if (is_set_over_limit) { + nvgFillColor(s->vg, nvgRGBA(218, 111, 37, 180)); + } else { + nvgFillColor(s->vg, nvgRGBA(0, 0, 0, 100)); + } + nvgFill(s->vg); + + // Draw Border nvgBeginPath(s->vg); nvgRoundedRect(s->vg, viz_maxspeed_x, viz_maxspeed_y, viz_maxspeed_w, viz_maxspeed_h, 20); - nvgStrokeColor(s->vg, nvgRGBA(255,255,255,80)); - nvgStrokeWidth(s->vg, 6); + if (is_set_over_limit) { + nvgStrokeColor(s->vg, nvgRGBA(218, 111, 37, 255)); + } else if (is_speedlim_valid && !s->is_ego_over_limit) { + nvgStrokeColor(s->vg, nvgRGBA(255, 255, 255, 255)); + } else if (is_speedlim_valid && s->is_ego_over_limit) { + nvgStrokeColor(s->vg, nvgRGBA(255, 255, 255, 20)); + } else { + nvgStrokeColor(s->vg, nvgRGBA(255, 255, 255, 100)); + } + nvgStrokeWidth(s->vg, 10); nvgStroke(s->vg); + // Draw "MAX" Text nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE); nvgFontFace(s->vg, "sans-regular"); nvgFontSize(s->vg, 26*2.5); - nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 200)); - nvgText(s->vg, viz_maxspeed_x+viz_maxspeed_w/2, 148, "MAX", NULL); + if (is_cruise_set) { + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 200)); + } else { + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 100)); + } + nvgText(s->vg, viz_maxspeed_x+(viz_maxspeed_xo/2)+(viz_maxspeed_w/2), 148, "MAX", NULL); - nvgFontFace(s->vg, "sans-semibold"); - nvgFontSize(s->vg, 52*2.5); - nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 255)); + // Draw Speed Text + nvgFontFace(s->vg, "sans-bold"); + nvgFontSize(s->vg, 48*2.5); if (is_cruise_set) { - if (s->is_metric) { - snprintf(maxspeed_str, sizeof(maxspeed_str), "%d", (int)(maxspeed + 0.5)); - } else { - snprintf(maxspeed_str, sizeof(maxspeed_str), "%d", (int)(maxspeed * 0.6225 + 0.5)); + snprintf(maxspeed_str, sizeof(maxspeed_str), "%d", maxspeed_calc); + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 255)); + nvgText(s->vg, viz_maxspeed_x+(viz_maxspeed_xo/2)+(viz_maxspeed_w/2), 242, maxspeed_str, NULL); + } else { + nvgFontFace(s->vg, "sans-semibold"); + nvgFontSize(s->vg, 42*2.5); + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 100)); + nvgText(s->vg, viz_maxspeed_x+(viz_maxspeed_xo/2)+(viz_maxspeed_w/2), 242, "N/A", NULL); + } + +#ifdef DEBUG_TURN + if (s->scene.decel_for_turn && s->scene.engaged){ + int v_curvature = s->scene.v_curvature * 2.2369363 + 0.5; + snprintf(maxspeed_str, sizeof(maxspeed_str), "%d", v_curvature); + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 255)); + nvgFontSize(s->vg, 25*2.5); + nvgText(s->vg, 200 + viz_maxspeed_x+(viz_maxspeed_xo/2)+(viz_maxspeed_w/2), 148, "TURN", NULL); + nvgFontSize(s->vg, 50*2.5); + nvgText(s->vg, 200 + viz_maxspeed_x+(viz_maxspeed_xo/2)+(viz_maxspeed_w/2), 242, maxspeed_str, NULL); + } +#endif +} + +static void ui_draw_vision_speedlimit(UIState *s) { + const UIScene *scene = &s->scene; + int ui_viz_rx = scene->ui_viz_rx; + int ui_viz_rw = scene->ui_viz_rw; + + char speedlim_str[32]; + float speedlimit = s->scene.speedlimit; + int speedlim_calc = speedlimit * 2.2369363 + 0.5; + if (s->is_metric) { + speedlim_calc = speedlimit * 3.6 + 0.5; + } + + bool is_speedlim_valid = s->scene.speedlimit_valid; + float hysteresis_offset = 0.5; + if (s->is_ego_over_limit) { + hysteresis_offset = 0.0; + } + s->is_ego_over_limit = is_speedlim_valid && s->scene.v_ego > (speedlimit + s->speed_lim_off + hysteresis_offset); + + int viz_speedlim_w = 180; + int viz_speedlim_h = 202; + int viz_speedlim_x = (ui_viz_rx + (bdr_s*2)); + int viz_speedlim_y = (box_y + (bdr_s*1.5)); + if (!is_speedlim_valid) { + viz_speedlim_w -= 5; + viz_speedlim_h -= 10; + viz_speedlim_x += 9; + viz_speedlim_y += 5; + } + int viz_speedlim_bdr = is_speedlim_valid ? 30 : 15; + + // Draw Background + nvgBeginPath(s->vg); + nvgRoundedRect(s->vg, viz_speedlim_x, viz_speedlim_y, viz_speedlim_w, viz_speedlim_h, viz_speedlim_bdr); + if (is_speedlim_valid && s->is_ego_over_limit) { + nvgFillColor(s->vg, nvgRGBA(218, 111, 37, 180)); + } else if (is_speedlim_valid) { + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 255)); + } else { + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 100)); + } + nvgFill(s->vg); + + // Draw Border + if (is_speedlim_valid) { + nvgStrokeWidth(s->vg, 10); + nvgStroke(s->vg); + nvgBeginPath(s->vg); + nvgRoundedRect(s->vg, viz_speedlim_x, viz_speedlim_y, viz_speedlim_w, viz_speedlim_h, 20); + if (s->is_ego_over_limit) { + nvgStrokeColor(s->vg, nvgRGBA(218, 111, 37, 255)); + } else if (is_speedlim_valid) { + nvgStrokeColor(s->vg, nvgRGBA(255, 255, 255, 255)); } - nvgText(s->vg, viz_maxspeed_x+viz_maxspeed_w/2, 242, maxspeed_str, NULL); + } + + // Draw "Speed Limit" Text + nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE); + nvgFontFace(s->vg, "sans-semibold"); + nvgFontSize(s->vg, 50); + nvgFillColor(s->vg, nvgRGBA(0, 0, 0, 255)); + if (is_speedlim_valid && s->is_ego_over_limit) { + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 255)); + } + nvgText(s->vg, viz_speedlim_x+viz_speedlim_w/2 + (is_speedlim_valid ? 6 : 0), viz_speedlim_y + (is_speedlim_valid ? 50 : 45), "SPEED", NULL); + nvgText(s->vg, viz_speedlim_x+viz_speedlim_w/2 + (is_speedlim_valid ? 6 : 0), viz_speedlim_y + (is_speedlim_valid ? 90 : 85), "LIMIT", NULL); + + // Draw Speed Text + nvgFontFace(s->vg, "sans-bold"); + nvgFontSize(s->vg, 48*2.5); + if (s->is_ego_over_limit) { + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 255)); } else { + nvgFillColor(s->vg, nvgRGBA(0, 0, 0, 255)); + } + if (is_speedlim_valid) { + snprintf(speedlim_str, sizeof(speedlim_str), "%d", speedlim_calc); + nvgText(s->vg, viz_speedlim_x+viz_speedlim_w/2, viz_speedlim_y + (is_speedlim_valid ? 170 : 165), speedlim_str, NULL); + } else { + nvgFontFace(s->vg, "sans-semibold"); nvgFontSize(s->vg, 42*2.5); - nvgText(s->vg, viz_maxspeed_x+viz_maxspeed_w/2, 242, "N/A", NULL); + nvgText(s->vg, viz_speedlim_x+viz_speedlim_w/2, viz_speedlim_y + (is_speedlim_valid ? 170 : 165), "N/A", NULL); } } @@ -923,7 +1156,7 @@ static void ui_draw_vision_speed(UIState *s) { if (s->is_metric) { snprintf(speed_str, sizeof(speed_str), "%d", (int)(speed * 3.6 + 0.5)); } else { - snprintf(speed_str, sizeof(speed_str), "%d", (int)(speed * 2.2374144 + 0.5)); + snprintf(speed_str, sizeof(speed_str), "%d", (int)(speed * 2.2369363 + 0.5)); } nvgFontFace(s->vg, "sans-bold"); nvgFontSize(s->vg, 96*2.5); @@ -941,7 +1174,7 @@ static void ui_draw_vision_speed(UIState *s) { } } -static void ui_draw_vision_wheel(UIState *s) { +static void ui_draw_vision_event(UIState *s) { const UIScene *scene = &s->scene; const int ui_viz_rx = scene->ui_viz_rx; const int ui_viz_rw = scene->ui_viz_rw; @@ -949,35 +1182,101 @@ static void ui_draw_vision_wheel(UIState *s) { const int viz_event_x = ((ui_viz_rx + ui_viz_rw) - (viz_event_w + (bdr_s*2))); const int viz_event_y = (box_y + (bdr_s*1.5)); const int viz_event_h = (header_h - (bdr_s*1.5)); - // draw steering wheel - const int bg_wheel_size = 96; - const int bg_wheel_x = viz_event_x + (viz_event_w-bg_wheel_size); - const int bg_wheel_y = viz_event_y + (bg_wheel_size/2); - const int img_wheel_size = bg_wheel_size*1.5; - const int img_wheel_x = bg_wheel_x-(img_wheel_size/2); - const int img_wheel_y = bg_wheel_y-25; - float img_wheel_alpha = 0.1f; - bool is_engaged = (s->status == STATUS_ENGAGED); - bool is_warning = (s->status == STATUS_WARNING); - bool is_engageable = scene->engageable; - if (is_engaged || is_warning || is_engageable) { + if (s->scene.decel_for_turn && s->scene.engaged && s->limit_set_speed) { + // draw winding road sign + const int img_turn_size = 160*1.5; + const int img_turn_x = viz_event_x-(img_turn_size/4); + const int img_turn_y = viz_event_y+bdr_s-25; + float img_turn_alpha = 1.0f; nvgBeginPath(s->vg); - nvgCircle(s->vg, bg_wheel_x, (bg_wheel_y + (bdr_s*1.5)), bg_wheel_size); - if (is_engaged) { - nvgFillColor(s->vg, nvgRGBA(23, 134, 68, 255)); - } else if (is_warning) { - nvgFillColor(s->vg, nvgRGBA(218, 111, 37, 255)); - } else if (is_engageable) { - nvgFillColor(s->vg, nvgRGBA(23, 51, 73, 255)); + NVGpaint imgPaint = nvgImagePattern(s->vg, img_turn_x, img_turn_y, + img_turn_size, img_turn_size, 0, s->img_turn, img_turn_alpha); + nvgRect(s->vg, img_turn_x, img_turn_y, img_turn_size, img_turn_size); + nvgFillPaint(s->vg, imgPaint); + nvgFill(s->vg); + } else { + // draw steering wheel + const int bg_wheel_size = 96; + const int bg_wheel_x = viz_event_x + (viz_event_w-bg_wheel_size); + const int bg_wheel_y = viz_event_y + (bg_wheel_size/2); + const int img_wheel_size = bg_wheel_size*1.5; + const int img_wheel_x = bg_wheel_x-(img_wheel_size/2); + const int img_wheel_y = bg_wheel_y-25; + float img_wheel_alpha = 0.1f; + bool is_engaged = (s->status == STATUS_ENGAGED); + bool is_warning = (s->status == STATUS_WARNING); + bool is_engageable = scene->engageable; + if (is_engaged || is_warning || is_engageable) { + nvgBeginPath(s->vg); + nvgCircle(s->vg, bg_wheel_x, (bg_wheel_y + (bdr_s*1.5)), bg_wheel_size); + if (is_engaged) { + nvgFillColor(s->vg, nvgRGBA(23, 134, 68, 255)); + } else if (is_warning) { + nvgFillColor(s->vg, nvgRGBA(218, 111, 37, 255)); + } else if (is_engageable) { + nvgFillColor(s->vg, nvgRGBA(23, 51, 73, 255)); + } + nvgFill(s->vg); + img_wheel_alpha = 1.0f; } + nvgBeginPath(s->vg); + NVGpaint imgPaint = nvgImagePattern(s->vg, img_wheel_x, img_wheel_y, + img_wheel_size, img_wheel_size, 0, s->img_wheel, img_wheel_alpha); + nvgRect(s->vg, img_wheel_x, img_wheel_y, img_wheel_size, img_wheel_size); + nvgFillPaint(s->vg, imgPaint); nvgFill(s->vg); - img_wheel_alpha = 1.0f; } +} + +static void ui_draw_vision_map(UIState *s) { + const UIScene *scene = &s->scene; + const int map_size = 96; + const int map_x = (scene->ui_viz_rx + (map_size * 3) + (bdr_s * 3)); + const int map_y = (footer_y + ((footer_h - map_size) / 2)); + const int map_img_size = (map_size * 1.5); + const int map_img_x = (map_x - (map_img_size / 2)); + const int map_img_y = (map_y - (map_size / 4)); + + bool map_valid = s->scene.map_valid; + float map_img_alpha = map_valid ? 1.0f : 0.15f; + float map_bg_alpha = map_valid ? 0.3f : 0.1f; + NVGcolor map_bg = nvgRGBA(0, 0, 0, (255 * map_bg_alpha)); + NVGpaint map_img = nvgImagePattern(s->vg, map_img_x, map_img_y, + map_img_size, map_img_size, 0, s->img_map, map_img_alpha); + nvgBeginPath(s->vg); - NVGpaint imgPaint = nvgImagePattern(s->vg, img_wheel_x, img_wheel_y, - img_wheel_size, img_wheel_size, 0, s->img_wheel, img_wheel_alpha); - nvgRect(s->vg, img_wheel_x, img_wheel_y, img_wheel_size, img_wheel_size); - nvgFillPaint(s->vg, imgPaint); + nvgCircle(s->vg, map_x, (map_y + (bdr_s * 1.5)), map_size); + nvgFillColor(s->vg, map_bg); + nvgFill(s->vg); + + nvgBeginPath(s->vg); + nvgRect(s->vg, map_img_x, map_img_y, map_img_size, map_img_size); + nvgFillPaint(s->vg, map_img); + nvgFill(s->vg); +} + +static void ui_draw_vision_face(UIState *s) { + const UIScene *scene = &s->scene; + const int face_size = 96; + const int face_x = (scene->ui_viz_rx + face_size + (bdr_s * 2)); + const int face_y = (footer_y + ((footer_h - face_size) / 2)); + const int face_img_size = (face_size * 1.5); + const int face_img_x = (face_x - (face_img_size / 2)); + const int face_img_y = (face_y - (face_size / 4)); + float face_img_alpha = scene->monitoring_active ? 1.0f : 0.15f; + float face_bg_alpha = scene->monitoring_active ? 0.3f : 0.1f; + NVGcolor face_bg = nvgRGBA(0, 0, 0, (255 * face_bg_alpha)); + NVGpaint face_img = nvgImagePattern(s->vg, face_img_x, face_img_y, + face_img_size, face_img_size, 0, s->img_face, face_img_alpha); + + nvgBeginPath(s->vg); + nvgCircle(s->vg, face_x, (face_y + (bdr_s * 1.5)), face_size); + nvgFillColor(s->vg, face_bg); + nvgFill(s->vg); + + nvgBeginPath(s->vg); + nvgRect(s->vg, face_img_x, face_img_y, face_img_size, face_img_size); + nvgFillPaint(s->vg, face_img); nvgFill(s->vg); } @@ -996,8 +1295,21 @@ static void ui_draw_vision_header(UIState *s) { nvgFill(s->vg); ui_draw_vision_maxspeed(s); + ui_draw_vision_speedlimit(s); ui_draw_vision_speed(s); - ui_draw_vision_wheel(s); + ui_draw_vision_event(s); +} + +static void ui_draw_vision_footer(UIState *s) { + const UIScene *scene = &s->scene; + int ui_viz_rx = scene->ui_viz_rx; + int ui_viz_rw = scene->ui_viz_rw; + + nvgBeginPath(s->vg); + nvgRect(s->vg, ui_viz_rx, footer_y, ui_viz_rw, footer_h); + + ui_draw_vision_face(s); + ui_draw_vision_map(s); } static void ui_draw_vision_alert(UIState *s, int va_size, int va_color, @@ -1054,16 +1366,6 @@ static void ui_draw_vision_alert(UIState *s, int va_size, int va_color, } } -static void ui_draw_calibration_status(UIState *s) { - const UIScene *scene = &s->scene; - char calib_str1[64]; - char calib_str2[64]; - snprintf(calib_str1, sizeof(calib_str1), "Calibration in Progress: %d%%", scene->cal_perc); - snprintf(calib_str2, sizeof(calib_str2), (s->is_metric?"Drive above 72 km/h":"Drive above 45 mph")); - - ui_draw_vision_alert(s, ALERTSIZE_MID, s->status, calib_str1, calib_str2); -} - static void ui_draw_vision(UIState *s) { const UIScene *scene = &s->scene; int ui_viz_rx = scene->ui_viz_rx; @@ -1093,7 +1395,7 @@ static void ui_draw_vision(UIState *s) { nvgScissor(s->vg, ui_viz_rx, box_y, ui_viz_rw, box_h); nvgTranslate(s->vg, ui_viz_rx+ui_viz_ro, box_y + (box_h-inner_height)/2.0); nvgScale(s->vg, (float)viz_w / s->fb_w, (float)inner_height / s->fb_h); - if (!scene->frontview) { + if (!scene->frontview && !scene->fullview) { ui_draw_world(s); } @@ -1106,11 +1408,11 @@ static void ui_draw_vision(UIState *s) { // Controls Alerts ui_draw_vision_alert(s, s->scene.alert_size, s->status, s->scene.alert_text1, s->scene.alert_text2); - } else if (scene->cal_status == CALIBRATION_UNCALIBRATED) { - // Calibration Status - ui_draw_calibration_status(s); + } else { + ui_draw_vision_footer(s); } + nvgEndFrame(s->vg); glDisable(GL_BLEND); } @@ -1189,10 +1491,6 @@ static void update_status(UIState *s, int status) { static void ui_update(UIState *s) { int err; - if (!s->intrinsic_matrix_loaded) { - s->intrinsic_matrix_loaded = try_load_intrinsics(&s->intrinsic_matrix); - } - if (s->vision_connect_firstrun) { // cant run this in connector thread because opengl. // do this here for now in lieu of a run_on_main_thread event @@ -1260,7 +1558,7 @@ static void ui_update(UIState *s) { // poll for events while (true) { - zmq_pollitem_t polls[9] = {{0}}; + zmq_pollitem_t polls[10] = {{0}}; polls[0].socket = s->live100_sock_raw; polls[0].events = ZMQ_POLLIN; polls[1].socket = s->livecalibration_sock_raw; @@ -1275,14 +1573,16 @@ static void ui_update(UIState *s) { polls[5].events = ZMQ_POLLIN; polls[6].socket = s->uilayout_sock_raw; polls[6].events = ZMQ_POLLIN; - polls[7].socket = s->plus_sock_raw; + polls[7].socket = s->map_data_sock_raw; polls[7].events = ZMQ_POLLIN; + polls[8].socket = s->plus_sock_raw; // plus_sock should be last + polls[8].events = ZMQ_POLLIN; - int num_polls = 8; + int num_polls = 9; if (s->vision_connected) { assert(s->ipc_fd >= 0); - polls[8].fd = s->ipc_fd; - polls[8].events = ZMQ_POLLIN; + polls[9].fd = s->ipc_fd; + polls[9].events = ZMQ_POLLIN; num_polls++; } @@ -1296,12 +1596,13 @@ static void ui_update(UIState *s) { } if (polls[0].revents || polls[1].revents || polls[2].revents || - polls[3].revents || polls[4].revents || polls[6].revents || polls[7].revents) { + polls[3].revents || polls[4].revents || polls[6].revents || + polls[7].revents || polls[8].revents) { // awake on any (old) activity set_awake(s, true); } - if (s->vision_connected && polls[8].revents) { + if (s->vision_connected && polls[9].revents) { // vision ipc event VisionPacket rp; err = vipc_recv(s->ipc_fd, &rp); @@ -1344,7 +1645,7 @@ static void ui_update(UIState *s) { } else { assert(false); } - } else if (polls[7].revents) { + } else if (polls[8].revents) { // plus socket zmq_msg_t msg; @@ -1399,9 +1700,44 @@ static void ui_update(UIState *s) { s->scene.engaged = datad.enabled; s->scene.engageable = datad.engageable; s->scene.gps_planner_active = datad.gpsPlannerActive; - // printf("recv %f\n", datad.vEgo); + s->scene.monitoring_active = datad.driverMonitoringOn; s->scene.frontview = datad.rearViewCam; + + s->scene.v_curvature = datad.vCurvature; + s->scene.decel_for_turn = datad.decelForTurn; + + if (datad.alertSound.str && datad.alertSound.str[0] != '\0' && strcmp(s->alert_type, datad.alertType.str) != 0) { + char* error = NULL; + if (s->alert_sound[0] != '\0') { + sound_file* active_sound = get_sound_file_by_name(s->alert_sound); + slplay_stop_uri(active_sound->uri, &error); + if (error) { + LOGW("error stopping active sound %s", error); + } + } + + sound_file* sound = get_sound_file_by_name(datad.alertSound.str); + slplay_play(sound->uri, sound->loop, &error); + if(error) { + LOGW("error playing sound: %s", error); + } + + snprintf(s->alert_sound, sizeof(s->alert_sound), "%s", datad.alertSound.str); + snprintf(s->alert_type, sizeof(s->alert_type), "%s", datad.alertType.str); + } else if ((!datad.alertSound.str || datad.alertSound.str[0] == '\0') && s->alert_sound[0] != '\0') { + sound_file* sound = get_sound_file_by_name(s->alert_sound); + + char* error = NULL; + + slplay_stop_uri(sound->uri, &error); + if(error) { + LOGW("error stopping sound: %s", error); + } + s->alert_type[0] = '\0'; + s->alert_sound[0] = '\0'; + } + if (datad.alertText1.str) { snprintf(s->scene.alert_text1, sizeof(s->scene.alert_text1), "%s", datad.alertText1.str); } else { @@ -1454,7 +1790,6 @@ static void ui_update(UIState *s) { } } } - } else if (eventd.which == cereal_Event_live20) { struct cereal_Live20Data datad; cereal_read_Live20Data(&datad, eventd.live20); @@ -1465,13 +1800,10 @@ static void ui_update(UIState *s) { s->scene.lead_y_rel = leaddatad.yRel; s->scene.lead_v_rel = leaddatad.vRel; } else if (eventd.which == cereal_Event_liveCalibration) { - s->scene.world_objects_visible = s->intrinsic_matrix_loaded; + s->scene.world_objects_visible = true; struct cereal_LiveCalibrationData datad; cereal_read_LiveCalibrationData(&datad, eventd.liveCalibration); - s->scene.cal_status = datad.calStatus; - s->scene.cal_perc = datad.calPerc; - // should we still even have this? capn_list32 warpl = datad.warpMatrix2; capn_resolve(&warpl.p); // is this a bug? @@ -1518,22 +1850,28 @@ static void ui_update(UIState *s) { s->scene.started_ts = datad.startedTs; } else if (eventd.which == cereal_Event_uiLayoutState) { - struct cereal_UiLayoutState datad; - cereal_read_UiLayoutState(&datad, eventd.uiLayoutState); - s->scene.uilayout_sidebarcollapsed = datad.sidebarCollapsed; - s->scene.uilayout_mapenabled = datad.mapEnabled; - - bool hasSidebar = !s->scene.uilayout_sidebarcollapsed; - bool mapEnabled = s->scene.uilayout_mapenabled; - if (mapEnabled) { - s->scene.ui_viz_rx = hasSidebar ? (box_x+nav_w) : (box_x+nav_w-(bdr_s*4)); - s->scene.ui_viz_rw = hasSidebar ? (box_w-nav_w) : (box_w-nav_w+(bdr_s*4)); - s->scene.ui_viz_ro = -(sbr_w + 4*bdr_s); - } else { - s->scene.ui_viz_rx = hasSidebar ? box_x : (box_x-sbr_w+bdr_s*2); - s->scene.ui_viz_rw = hasSidebar ? box_w : (box_w+sbr_w-(bdr_s*2)); - s->scene.ui_viz_ro = hasSidebar ? -(sbr_w - 6*bdr_s) : 0; - } + struct cereal_UiLayoutState datad; + cereal_read_UiLayoutState(&datad, eventd.uiLayoutState); + s->scene.uilayout_sidebarcollapsed = datad.sidebarCollapsed; + s->scene.uilayout_mapenabled = datad.mapEnabled; + + bool hasSidebar = !s->scene.uilayout_sidebarcollapsed; + bool mapEnabled = s->scene.uilayout_mapenabled; + if (mapEnabled) { + s->scene.ui_viz_rx = hasSidebar ? (box_x+nav_w) : (box_x+nav_w-(bdr_s*4)); + s->scene.ui_viz_rw = hasSidebar ? (box_w-nav_w) : (box_w-nav_w+(bdr_s*4)); + s->scene.ui_viz_ro = -(sbr_w + 4*bdr_s); + } else { + s->scene.ui_viz_rx = hasSidebar ? box_x : (box_x-sbr_w+bdr_s*2); + s->scene.ui_viz_rw = hasSidebar ? box_w : (box_w+sbr_w-(bdr_s*2)); + s->scene.ui_viz_ro = hasSidebar ? -(sbr_w - 6*bdr_s) : 0; + } + } else if (eventd.which == cereal_Event_liveMapData) { + struct cereal_LiveMapData datad; + cereal_read_LiveMapData(&datad, eventd.liveMapData); + s->scene.speedlimit = datad.speedLimit; + s->scene.speedlimit_valid = datad.speedLimitValid; + s->scene.map_valid = datad.mapValid; } capn_free(&ctx); zmq_msg_close(&msg); @@ -1634,12 +1972,6 @@ static void* light_sensor_thread(void *args) { int SENSOR_LIGHT = 7; - struct stat buffer; - if (stat("/sys/bus/i2c/drivers/cyccg", &buffer) == 0) { - LOGD("LeEco light sensor detected"); - SENSOR_LIGHT = 5; - } - device->activate(device, SENSOR_LIGHT, 0); device->activate(device, SENSOR_LIGHT, 1); device->setDelay(device, SENSOR_LIGHT, ms2ns(100)); @@ -1653,9 +1985,7 @@ static void* light_sensor_thread(void *args) { LOG_100("light_sensor_poll failed: %d", n); } if (n > 0) { - if (SENSOR_LIGHT == 5) s->light_sensor = buffer[0].light * 2; - else s->light_sensor = buffer[0].light; - //printf("new light sensor value: %f\n", s->light_sensor); + s->light_sensor = buffer[0].light; } } @@ -1696,6 +2026,21 @@ static void* bg_thread(void* args) { return NULL; } +int is_leon() { + #define MAXCHAR 1000 + FILE *fp; + char str[MAXCHAR]; + char* filename = "/proc/cmdline"; + + fp = fopen(filename, "r"); + if (fp == NULL){ + printf("Could not open file %s",filename); + return 0; + } + fgets(str, MAXCHAR, fp); + fclose(fp); + return strstr(str, "letv") != NULL; +} int main() { int err; @@ -1726,15 +2071,24 @@ int main() { TouchState touch = {0}; touch_init(&touch); + char* error = NULL; + ui_sound_init(&error); + if (error) { + LOGW(error); + exit(1); + } + // light sensor scaling params - #define LIGHT_SENSOR_M 1.3 - #define LIGHT_SENSOR_B 5.0 + const int EON = (access("/EON", F_OK) != -1); + const int LEON = is_leon(); + const float BRIGHTNESS_B = LEON? 10.0 : 5.0; + const float BRIGHTNESS_M = LEON? 2.6 : 1.3; #define NEO_BRIGHTNESS 100 - float smooth_light_sensor = LIGHT_SENSOR_B; + float smooth_brightness = BRIGHTNESS_B; - const int EON = (access("/EON", F_OK) != -1); + set_volume(s, 0); while (!do_exit) { bool should_swap = false; @@ -1743,10 +2097,10 @@ int main() { if (EON) { // light sensor is only exposed on EONs - float clipped_light_sensor = (s->light_sensor*LIGHT_SENSOR_M) + LIGHT_SENSOR_B; - if (clipped_light_sensor > 255) clipped_light_sensor = 255; - smooth_light_sensor = clipped_light_sensor * 0.01 + smooth_light_sensor * 0.99; - set_brightness(s, (int)smooth_light_sensor); + float clipped_brightness = (s->light_sensor*BRIGHTNESS_M) + BRIGHTNESS_B; + if (clipped_brightness > 255) clipped_brightness = 255; + smooth_brightness = clipped_brightness * 0.01 + smooth_brightness * 0.99; + set_brightness(s, (int)smooth_brightness); } else { // compromise for bright and dark envs set_brightness(s, NEO_BRIGHTNESS); @@ -1775,6 +2129,31 @@ int main() { should_swap = true; } + if (s->volume_timeout > 0) { + s->volume_timeout--; + } else { + int volume = min(13, 11 + s->scene.v_ego / 15); // up one notch every 15 m/s, starting at 11 + set_volume(s, volume); + } + + if (s->speed_lim_off_timeout > 0) { + s->speed_lim_off_timeout--; + } else { + read_speed_lim_off(s); + } + + if (s->is_metric_timeout > 0) { + s->is_metric_timeout--; + } else { + read_is_metric(s); + } + + if (s->limit_set_speed_timeout > 0) { + s->limit_set_speed_timeout--; + } else { + read_limit_set_speed(s); + } + pthread_mutex_unlock(&s->lock); // the bg thread needs to be scheduled, so the main thread needs time without the lock @@ -1786,6 +2165,8 @@ int main() { set_awake(s, true); + slplay_destroy(); + // wake up bg thread to exit pthread_mutex_lock(&s->lock); pthread_cond_signal(&s->bg_cond); diff --git a/selfdrive/visiond/LICENSE.boringssl b/selfdrive/visiond/LICENSE.boringssl index a25996f7202450..0b0b9b3292837f 100644 --- a/selfdrive/visiond/LICENSE.boringssl +++ b/selfdrive/visiond/LICENSE.boringssl @@ -32,7 +32,7 @@ record keeping.) * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * 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 @@ -87,21 +87,21 @@ record keeping.) * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -116,10 +116,10 @@ record keeping.) * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -131,7 +131,7 @@ record keeping.) * 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. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence diff --git a/selfdrive/visiond/README b/selfdrive/visiond/README index d237562739bcd0..1b612afcece0ed 100644 --- a/selfdrive/visiond/README +++ b/selfdrive/visiond/README @@ -1,3 +1 @@ visiond runs the openpilot/chffrplus vision pipeline. Everything running between the camera hardware and model outputs lives here. - -Contact us if you'd like features added or support for your platform. diff --git a/selfdrive/visiond/SConscript b/selfdrive/visiond/SConscript new file mode 100644 index 00000000000000..e55fbd94d9a63e --- /dev/null +++ b/selfdrive/visiond/SConscript @@ -0,0 +1,17 @@ +Import('env') +lenv = env.Clone() +lenv['CPPPATH'] += ['include'] +lenv['LIBPATH'] += ['/system/vendor/lib64'] +lenv['CFLAGS'] += ' -DQCOM' +lenv['CXXFLAGS'] += ' -DQCOM -U __ANDROID__' +lenv.Program(['visiond.cc', 'model.c', 'transform.c', 'loadyuv.c', 'buffering.c', 'efd.c', + 'yuvmodel.c', 'temporalmodel.c', 'monitoring.c', 'monitoringmodel.c', 'clutil.c', + 'camera_qcom.c', 'visionbuf_ion.c'], + LIBS=['zmq', 'czmq', 'capnp', 'capnp_c', 'kj', 'yaml-cpp', 'z', 'curl', + 'gsl', 'CB', 'OpenCL', + 'opencv_video', 'opencv_imgproc', 'opencv_core', + 'gnustl_shared', 'log', 'cutils', + 'yuv', + 'common', 'cereal', + ]) + diff --git a/selfdrive/visiond/__init__.py b/selfdrive/visiond/__init__.py new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/selfdrive/visiond/bufs.h b/selfdrive/visiond/bufs.h new file mode 100644 index 00000000000000..71930baede2cfe --- /dev/null +++ b/selfdrive/visiond/bufs.h @@ -0,0 +1,8 @@ +#ifndef _SELFDRIVE_VISIOND_VISIOND_H_ +#define _SELFDRIVE_VISIOND_VISIOND_H_ + +#include + +typedef struct { uint8_t *y, *u, *v; } YUVBuf; + +#endif // _SELFDRIVE_VISIOND_VISIOND_H_ diff --git a/selfdrive/visiond/build_from_src.mk b/selfdrive/visiond/build_from_src.mk new file mode 100644 index 00000000000000..e23887f27b98fa --- /dev/null +++ b/selfdrive/visiond/build_from_src.mk @@ -0,0 +1,227 @@ +CC = clang +CXX = clang++ + +BASEDIR = ../.. +EXTERNAL = ../../external +PHONELIBS = ../../phonelibs + +WARN_FLAGS = -Werror=implicit-function-declaration \ + -Werror=incompatible-pointer-types \ + -Werror=int-conversion \ + -Werror=return-type \ + -Werror=format-extra-args \ + -Wno-deprecated-declarations + +CFLAGS = -std=gnu11 -fPIC -O2 $(WARN_FLAGS) +CXXFLAGS = -std=c++14 -fPIC -O2 $(WARN_FLAGS) + +#ifneq ($(RELEASE),1) +#CFLAGS += -g +#CXXFLAGS += -g +#endif + +JSON_FLAGS = -I$(PHONELIBS)/json/src +JSON11_FLAGS = -I$(PHONELIBS)/json11/ +EIGEN_FLAGS = -I$(PHONELIBS)/eigen + +UNAME_M := $(shell uname -m) +UNAME_S := $(shell uname -s) + +ifeq ($(UNAME_M),x86_64) + +ifeq ($(UNAME_S),Darwin) + LIBYUV_FLAGS = -I$(PHONELIBS)/libyuv/include + LIBYUV_LIBS = $(PHONELIBS)/libyuv/mac/lib/libyuv.a + + ZMQ_FLAGS = -I$(EXTERNAL)/zmq/include + ZMQ_LIBS = $(PHONELIBS)/zmq/mac/lib/libczmq.a \ + $(PHONELIBS)/zmq/mac/lib/libzmq.a + + OPENCL_LIBS = -framework OpenCL +else + LIBYUV_FLAGS = -I$(PHONELIBS)/libyuv/x64/include + LIBYUV_LIBS = $(PHONELIBS)/libyuv/x64/lib/libyuv.a + + ZMQ_FLAGS = -I$(EXTERNAL)/zmq/include + ZMQ_LIBS = -L$(EXTERNAL)/zmq/lib \ + -l:libczmq.a -l:libzmq.a + + OPENCL_LIBS = -lOpenCL +endif + + CURL_FLAGS = -I/usr/include/curl + CURL_LIBS = -lcurl -lz + + SSL_FLAGS = -I/usr/include/openssl/ + SSL_LIBS = -lssl -lcrypto + + OPENCV_FLAGS = + OPENCV_LIBS = -lopencv_video \ + -lopencv_imgproc \ + -lopencv_core + OTHER_LIBS = -lz -lm -lpthread + + PLATFORM_OBJS = camera_fake.o \ + ../common/visionbuf_cl.o + + CFLAGS += -D_GNU_SOURCE \ + -DCLU_NO_CACHE +else + # assume phone + + LIBYUV_FLAGS = -I$(PHONELIBS)/libyuv/include + LIBYUV_LIBS = $(PHONELIBS)/libyuv/lib/libyuv.a + + ZMQ_FLAGS = -I$(PHONELIBS)/zmq/aarch64/include + ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib \ + -l:libczmq.a -l:libzmq.a \ + -lgnustl_shared + + CURL_FLAGS = -I$(PHONELIBS)/curl/include + CURL_LIBS = $(PHONELIBS)/curl/lib/libcurl.a \ + $(PHONELIBS)/zlib/lib/libz.a + + SSL_FLAGS = -I$(PHONELIBS)/boringssl/include + SSL_LIBS = $(PHONELIBS)/boringssl/lib/libssl_static.a \ + $(PHONELIBS)/boringssl/lib/libcrypto_static.a + + OPENCL_FLAGS = -I$(PHONELIBS)/opencl/include + OPENCL_LIBS = -lgsl -lCB -lOpenCL + + OPENCV_FLAGS = -I/usr/local/sdk/native/jni/include + OPENCV_LIBS = -L/usr/local/sdk/native/libs \ + -l:libopencv_video.a \ + -l:libopencv_imgproc.a \ + -l:libopencv_core.a + + OPENGL_LIBS = -lGLESv3 -lEGL + + SNPE_FLAGS = -I$(PHONELIBS)/snpe/include/ + SNPE_LIBS = -lSNPE -lsymphony-cpu -lsymphonypower + + OTHER_LIBS = -lz -lcutils -lm -llog -lui -ladreno_utils + + PLATFORM_OBJS = camera_qcom.o \ + ../common/visionbuf_ion.o + + CFLAGS += -DQCOM + CXXFLAGS += -DQCOM +endif + +OBJS = visiond.o +OUTPUT = visiond + +.PHONY: all +all: $(OUTPUT) + +include ../common/cereal.mk + +OBJS += $(PLATFORM_OBJS) \ + ../common/swaglog.o \ + ../common/ipc.o \ + ../common/visionipc.o \ + ../common/visionimg.o \ + ../common/util.o \ + ../common/params.o \ + ../common/efd.o \ + ../common/buffering.o \ + transform.o \ + loadyuv.o \ + commonmodel.o \ + snpemodel.o \ + monitoring.o \ + model.o \ + clutil.o \ + $(PHONELIBS)/json/src/json.o \ + $(PHONELIBS)/json11/json11.o \ + $(CEREAL_OBJS) + +#MODEL_DATA = ../../models/driving_bigmodel.dlc ../../models/monitoring_model.dlc +MODEL_DATA = ../../models/driving_model.dlc ../../models/monitoring_model.dlc ../../models/posenet.dlc +MODEL_OBJS = $(MODEL_DATA:.dlc=.o) +OBJS += $(MODEL_OBJS) + +ifeq ($(RELEASE),1) +CFLAGS += -DCLU_NO_SRC +CXXFLAGS += -DCLU_NO_SRC +CLCACHE_FILES = $(wildcard /tmp/clcache/*.clb) +CLCACHE_OBJS += $(CLCACHE_FILES:.clb=.o) +OBJS += $(CLCACHE_OBJS) + +clutil.o: clcache_bins.h +clcache_bins.h: $(CLCACHE_FILES) /tmp/clcache/index.cli + rm -f '$@' + for hash in $(basename $(notdir $(CLCACHE_FILES))) ; do \ + echo "extern const uint8_t clb_$$hash[] asm(\"_binary_$${hash}_clb_start\");" ; \ + echo "extern const uint8_t clb_$${hash}_end[] asm(\"_binary_$${hash}_clb_end\");" ; \ + done >> '$@' + echo "static const CLUProgramIndex clu_index[] = {" >> '$@' + while read idx_hash code_hash; do \ + echo "{ 0x$$idx_hash, clb_$${code_hash}, clb_$${code_hash}_end }," ; \ + done < /tmp/clcache/index.cli >> '$@' + echo "};" >> '$@' + +$(CLCACHE_OBJS): %.o: %.clb + @echo "[ bin2o ] $@" + cd '$(dir $<)' && ld -r -b binary '$(notdir $<)' -o '$(abspath $@)' + +LDFLAGS += -s +endif + +DEPS := $(OBJS:.o=.d) + +$(OUTPUT): $(OBJS) + @echo "[ LINK ] $@" + $(CXX) -fPIC -o '$@' $^ \ + $(LDFLAGS) \ + $(LIBYUV_LIBS) \ + $(OPENCV_LIBS) \ + $(OPENGL_LIBS) \ + $(CEREAL_LIBS) \ + $(ZMQ_LIBS) \ + -L/usr/lib \ + -L/system/vendor/lib64 \ + $(OPENCL_LIBS) \ + $(CURL_LIBS) \ + $(SSL_LIBS) \ + $(SNPE_LIBS) \ + $(OTHER_LIBS) + +$(MODEL_OBJS): %.o: %.dlc + @echo "[ bin2o ] $@" + cd '$(dir $<)' && ld -r -b binary '$(notdir $<)' -o '$(abspath $@)' + +%.o: %.cc + @echo "[ CXX ] $@" + $(CXX) $(CXXFLAGS) -MMD \ + -Iinclude -I.. -I../.. \ + $(OPENCV_FLAGS) $(EIGEN_FLAGS) \ + $(ZMQ_FLAGS) \ + $(CEREAL_CXXFLAGS) \ + $(OPENCL_FLAGS) \ + $(LIBYUV_FLAGS) \ + $(SNPE_FLAGS) \ + $(JSON_FLAGS) \ + $(JSON11_FLAGS) $(CURL_FLAGS) \ + -I$(PHONELIBS)/libgralloc/include \ + -I$(PHONELIBS)/linux/include \ + -c -o '$@' '$<' + +%.o: %.c + @echo "[ CC ] $@" + $(CC) $(CFLAGS) -MMD \ + -Iinclude -I.. -I../.. \ + $(ZMQ_FLAGS) \ + $(CEREAL_CFLAGS) \ + $(OPENCL_FLAGS) \ + $(LIBYUV_FLAGS) \ + $(JSON_FLAGS) \ + -I$(PHONELIBS)/libgralloc/include \ + -I$(PHONELIBS)/linux/include \ + -c -o '$@' '$<' + +.PHONY: clean +clean: + rm -f visiond $(OBJS) $(DEPS) + +-include $(DEPS) diff --git a/selfdrive/visiond/camera_common.h b/selfdrive/visiond/camera_common.h new file mode 100644 index 00000000000000..cea6a9d125d3cd --- /dev/null +++ b/selfdrive/visiond/camera_common.h @@ -0,0 +1,46 @@ +#ifndef CAMERA_COMMON_H +#define CAMERA_COMMON_H + +#include +#include + +#define CAMERA_ID_IMX298 0 +#define CAMERA_ID_IMX179 1 +#define CAMERA_ID_S5K3P8SP 2 +#define CAMERA_ID_OV8865 3 +#define CAMERA_ID_IMX298_FLIPPED 4 +#define CAMERA_ID_OV10640 5 +#define CAMERA_ID_MAX 6 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CameraInfo { + const char* name; + int frame_width, frame_height; + int frame_stride; + bool bayer; + int bayer_flip; + bool hdr; +} CameraInfo; + +typedef struct FrameMetadata { + uint32_t frame_id; + uint64_t timestamp_eof; + unsigned int frame_length; + unsigned int integ_lines; + unsigned int global_gain; + unsigned int lens_pos; + float lens_sag; + float lens_err; + float lens_true_pos; +} FrameMetadata; + +extern CameraInfo cameras_supported[CAMERA_ID_MAX]; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/selfdrive/visiond/camera_fake.cc b/selfdrive/visiond/camera_fake.cc new file mode 100644 index 00000000000000..5b7c9cb7b92399 --- /dev/null +++ b/selfdrive/visiond/camera_fake.cc @@ -0,0 +1,267 @@ +#include "camera_fake.h" + +#include +#include +#include + +#include +#include +#include +#include "cereal/gen/cpp/log.capnp.h" + +#include "common/util.h" +#include "common/timing.h" +#include "common/swaglog.h" +#include "buffering.h" + +extern volatile int do_exit; + +#define FRAME_WIDTH 1164 +#define FRAME_HEIGHT 874 + +namespace { +void camera_open(CameraState *s, VisionBuf *camera_bufs, bool rear) { + assert(camera_bufs); + s->camera_bufs = camera_bufs; +} + +void camera_close(CameraState *s) { + tbuffer_stop(&s->camera_tb); +} + +void camera_release_buffer(void *cookie, int buf_idx) { + CameraState *s = static_cast(cookie); +} + +void camera_init(CameraState *s, int camera_id, unsigned int fps) { + assert(camera_id < ARRAYSIZE(cameras_supported)); + s->ci = cameras_supported[camera_id]; + assert(s->ci.frame_width != 0); + + s->frame_size = s->ci.frame_height * s->ci.frame_stride; + s->fps = fps; + + tbuffer_init2(&s->camera_tb, FRAME_BUF_COUNT, "frame", camera_release_buffer, + s); +} + + +void run_simulator(DualCameraState *s) { + int err = 0; + + zsock_t *frame_sock = zsock_new_sub(">tcp://127.0.0.1:9003", ""); + assert(frame_sock); + void *frame_sock_raw = zsock_resolve(frame_sock); + + CameraState *const rear_camera = &s->rear; + + auto *tb = &rear_camera->camera_tb; + + while (!do_exit) { + const int buf_idx = tbuffer_select(tb); + + auto *buf = &rear_camera->camera_bufs[buf_idx]; + + zmq_msg_t t_msg; + err = zmq_msg_init(&t_msg); + assert(err == 0); + + zmq_msg_t frame_msg; + err = zmq_msg_init(&frame_msg); + assert(err == 0); + + // recv multipart (t, frame) + err = zmq_msg_recv(&t_msg, frame_sock_raw, 0); + assert(err != -1); + err = zmq_msg_recv(&frame_msg, frame_sock_raw, 0); + assert(err != -1); + + assert(zmq_msg_size(&t_msg) >= 8); + uint8_t* dat = (uint8_t*)zmq_msg_data(&t_msg); + float t = *(float*)&dat[0]; + uint32_t frame = *(uint32_t*)&dat[4]; + + rear_camera->camera_bufs_metadata[buf_idx] = { + .frame_id = frame, + .timestamp_eof = nanos_since_boot(), + .frame_length = 0, + .integ_lines = 0, + .global_gain = 0, + }; + + + assert(zmq_msg_size(&frame_msg) == rear_camera->frame_size); + + err = libyuv::RAWToRGB24((const uint8_t*)zmq_msg_data(&frame_msg), rear_camera->ci.frame_width*3, + (uint8_t*)buf->addr, rear_camera->ci.frame_stride, + rear_camera->ci.frame_width, rear_camera->ci.frame_height); + assert(err == 0); + + visionbuf_sync(buf, VISIONBUF_SYNC_TO_DEVICE); + tbuffer_dispatch(tb, buf_idx); + + err = zmq_msg_close(&frame_msg); + assert(err == 0); + err = zmq_msg_close(&t_msg); + assert(err == 0); + } + + zsock_destroy(&frame_sock); +} + +void run_unlogger(DualCameraState *s) { + zsock_t *frame_sock = zsock_new_sub(NULL, ""); + assert(frame_sock); + int err = zsock_connect(frame_sock, + "ipc:///tmp/9464f05d-9d88-4fc9-aa17-c75352d9590d"); + assert(err == 0); + void *frame_sock_raw = zsock_resolve(frame_sock); + + CameraState *const rear_camera = &s->rear; + auto frame_data = std::vector{}; + + auto *tb = &rear_camera->camera_tb; + + while (!do_exit) { + // Handle rear camera only. + zmq_msg_t msg; + int rc = zmq_msg_init(&msg); + assert(rc == 0); + rc = zmq_msg_recv(&msg, frame_sock_raw, 0); + if (rc == -1) { + if (do_exit) { + break; + } else { + fprintf(stderr, "Could not recv frame message: %d\n", errno); + } + } + assert(rc != -1); + + const size_t msg_size_words = zmq_msg_size(&msg) / sizeof(capnp::word); + assert(msg_size_words * sizeof(capnp::word) == zmq_msg_size(&msg)); + + if (frame_data.size() < msg_size_words) { + frame_data = std::vector{msg_size_words}; + } + std::memcpy(frame_data.data(), zmq_msg_data(&msg), + msg_size_words * sizeof(*frame_data.data())); + zmq_msg_close(&msg); + + capnp::FlatArrayMessageReader message{ + kj::arrayPtr(frame_data.data(), msg_size_words), {}}; + + const auto &event = message.getRoot(); + assert(event.which() == cereal::Event::FRAME); + const auto reader = event.getFrame(); + assert(reader.hasImage()); + const auto yuv_image = reader.getImage(); + + // Copy camera data to buffer. + const size_t width = rear_camera->ci.frame_width; + const size_t height = rear_camera->ci.frame_height; + + const size_t y_len = width * height; + const uint8_t *const y = yuv_image.begin(); + const uint8_t *const u = y + y_len; + const uint8_t *const v = u + y_len / 4; + + assert(yuv_image.size() == y_len * 3 / 2); + + const int buf_idx = tbuffer_select(tb); + rear_camera->camera_bufs_metadata[buf_idx] = { + .frame_id = reader.getFrameId(), + .timestamp_eof = reader.getTimestampEof(), + .frame_length = static_cast(reader.getFrameLength()), + .integ_lines = static_cast(reader.getIntegLines()), + .global_gain = static_cast(reader.getGlobalGain()), + }; + + auto *buf = &rear_camera->camera_bufs[buf_idx]; + uint8_t *const rgb = static_cast(buf->addr); + + // Convert to RGB. + const int result = libyuv::I420ToRGB24(y, width, u, width / 2, v, width / 2, + rgb, width * 3, width, height); + assert(result == 0); + + visionbuf_sync(buf, VISIONBUF_SYNC_TO_DEVICE); + + // HACK(mgraczyk): Do not drop frames. + while (*(volatile int*)&tb->pending_idx != -1) { + usleep(20000); + } + tbuffer_dispatch(tb, buf_idx); + } + + zsock_destroy(&frame_sock); +} + +} // namespace + +CameraInfo cameras_supported[CAMERA_ID_MAX] = { + [CAMERA_ID_IMX298] = { + .frame_width = FRAME_WIDTH, + .frame_height = FRAME_HEIGHT, + .frame_stride = FRAME_WIDTH*3, + .bayer = false, + .bayer_flip = false, + }, +}; + +void cameras_init(DualCameraState *s) { + memset(s, 0, sizeof(*s)); + + camera_init(&s->rear, CAMERA_ID_IMX298, 20); + camera_init(&s->front, CAMERA_ID_IMX298, 20); + + if (getenv("SIMULATOR2")) { + // simulator camera is flipped vertically + s->rear.transform = (mat3){{ + 1.0, 0.0, 0.0, + 0.0, -1.0, s->rear.ci.frame_height - 1.0f, + 0.0, 0.0, 1.0, + }}; + } else { + // assume the input is upside-down + s->rear.transform = (mat3){{ + -1.0, 0.0, s->rear.ci.frame_width - 1.0f, + 0.0, -1.0, s->rear.ci.frame_height - 1.0f, + 0.0, 0.0, 1.0, + }}; + } +} + +void cameras_open(DualCameraState *s, VisionBuf *camera_bufs_rear, + VisionBuf *camera_bufs_focus, VisionBuf *camera_bufs_stats, + VisionBuf *camera_bufs_front) { + assert(camera_bufs_rear); + assert(camera_bufs_front); + int err; + + // LOG("*** open front ***"); + camera_open(&s->front, camera_bufs_front, false); + + // LOG("*** open rear ***"); + camera_open(&s->rear, camera_bufs_rear, true); +} + +void cameras_close(DualCameraState *s) { + camera_close(&s->rear); + camera_close(&s->front); +} + +void camera_autoexposure(CameraState *s, float grey_frac) {} + + +void cameras_run(DualCameraState *s) { + set_thread_name("fake_camera"); + + if (getenv("SIMULATOR2")) { + run_simulator(s); + } else { + run_unlogger(s); + } + + cameras_close(s); + +} diff --git a/selfdrive/visiond/camera_fake.h b/selfdrive/visiond/camera_fake.h new file mode 100644 index 00000000000000..04ad01a6d06ef7 --- /dev/null +++ b/selfdrive/visiond/camera_fake.h @@ -0,0 +1,52 @@ +#ifndef FAKE_CAMERA_H +#define FAKE_CAMERA_H + +#include + +#include "common/mat.h" + +#include "buffering.h" +#include "common/visionbuf.h" +#include "camera_common.h" + +#define FRAME_BUF_COUNT 4 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CameraState { + int camera_id; + CameraInfo ci; + int frame_size; + + VisionBuf *camera_bufs; + FrameMetadata camera_bufs_metadata[FRAME_BUF_COUNT]; + TBuffer camera_tb; + + int fps; + float digital_gain; + + mat3 transform; +} CameraState; + + +typedef struct DualCameraState { + int ispif_fd; + + CameraState rear; + CameraState front; +} DualCameraState; + +void cameras_init(DualCameraState *s); +void cameras_open(DualCameraState *s, VisionBuf *camera_bufs_rear, VisionBuf *camera_bufs_focus, VisionBuf *camera_bufs_stats, VisionBuf *camera_bufs_front); +void cameras_run(DualCameraState *s); +void cameras_close(DualCameraState *s); + +void camera_autoexposure(CameraState *s, float grey_frac); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/selfdrive/visiond/camera_qcom.c b/selfdrive/visiond/camera_qcom.c new file mode 100644 index 00000000000000..08a1dff6526e8c --- /dev/null +++ b/selfdrive/visiond/camera_qcom.c @@ -0,0 +1,2275 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include "msmb_isp.h" +#include "msmb_ispif.h" +#include "msmb_camera.h" +#include "msm_cam_sensor.h" + +#include "common/util.h" +#include "common/timing.h" +#include "common/swaglog.h" +#include "common/params.h" + +#include "cereal/gen/c/log.capnp.h" + +#include "sensor_i2c.h" + +#include "camera_qcom.h" + + +// enable this to run the camera at 60fps and sample every third frame +// supposed to reduce 33ms of lag, but no results +//#define HIGH_FPS + +#define CAMERA_MSG_AUTOEXPOSE 0 + +typedef struct CameraMsg { + int type; + int camera_num; + + float grey_frac; +} CameraMsg; + +extern volatile int do_exit; + +CameraInfo cameras_supported[CAMERA_ID_MAX] = { + [CAMERA_ID_IMX298] = { + .frame_width = 2328, + .frame_height = 1748, + .frame_stride = 2912, + .bayer = true, + .bayer_flip = 0, + .hdr = true + }, + [CAMERA_ID_IMX179] = { + .frame_width = 3280, + .frame_height = 2464, + .frame_stride = 4104, + .bayer = true, + .bayer_flip = 0, + .hdr = false + }, + [CAMERA_ID_S5K3P8SP] = { + .frame_width = 2304, + .frame_height = 1728, + .frame_stride = 2880, + .bayer = true, + .bayer_flip = 1, + .hdr = false + }, + [CAMERA_ID_OV8865] = { + .frame_width = 1632, + .frame_height = 1224, + .frame_stride = 2040, // seems right + .bayer = true, + .bayer_flip = 3, + .hdr = false + }, + // this exists to get the kernel to build for the LeEco in release + [CAMERA_ID_IMX298_FLIPPED] = { + .frame_width = 2328, + .frame_height = 1748, + .frame_stride = 2912, + .bayer = true, + .bayer_flip = 3, + .hdr = true + }, + [CAMERA_ID_OV10640] = { + .frame_width = 1280, + .frame_height = 1080, + .frame_stride = 2040, + .bayer = true, + .bayer_flip = 0, + .hdr = true + }, +}; + +static void camera_release_buffer(void* cookie, int buf_idx) { + CameraState *s = cookie; + // printf("camera_release_buffer %d\n", buf_idx); + s->ss[0].qbuf_info[buf_idx].dirty_buf = 1; + ioctl(s->isp_fd, VIDIOC_MSM_ISP_ENQUEUE_BUF, &s->ss[0].qbuf_info[buf_idx]); +} + +static void camera_init(CameraState *s, int camera_id, int camera_num, + uint32_t pixel_clock, uint32_t line_length_pclk, + unsigned int max_gain, unsigned int fps) { + memset(s, 0, sizeof(*s)); + + s->camera_num = camera_num; + s->camera_id = camera_id; + + assert(camera_id < ARRAYSIZE(cameras_supported)); + s->ci = cameras_supported[camera_id]; + assert(s->ci.frame_width != 0); + s->frame_size = s->ci.frame_height * s->ci.frame_stride; + + s->pixel_clock = pixel_clock; + s->line_length_pclk = line_length_pclk; + s->max_gain = max_gain; + s->fps = fps; + + zsock_t *ops_sock = zsock_new_push(">inproc://cameraops"); + assert(ops_sock); + s->ops_sock = zsock_resolve(ops_sock); + + tbuffer_init2(&s->camera_tb, FRAME_BUF_COUNT, "frame", + camera_release_buffer, s); + + pthread_mutex_init(&s->frame_info_lock, NULL); +} + + +int sensor_write_regs(CameraState *s, struct msm_camera_i2c_reg_array* arr, size_t size, int data_type) { + struct msm_camera_i2c_reg_setting out_settings = { + .reg_setting = arr, + .size = size, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .data_type = data_type, + .delay = 0, + }; + struct sensorb_cfg_data cfg_data = {0}; + cfg_data.cfgtype = CFG_WRITE_I2C_ARRAY; + cfg_data.cfg.setting = &out_settings; + return ioctl(s->sensor_fd, VIDIOC_MSM_SENSOR_CFG, &cfg_data); +} + +static int imx298_apply_exposure(CameraState *s, int gain, int integ_lines, int frame_length) { + int err; + + int analog_gain = min(gain, 448); + + if (gain > 448) { + s->digital_gain = (512.0/(512-(gain))) / 8.0; + } else { + s->digital_gain = 1.0; + } + + //printf("%5d/%5d %5d %f\n", s->cur_integ_lines, s->cur_frame_length, analog_gain, s->digital_gain); + + int digital_gain = 0x100; + + float white_balance[] = {0.4609375, 1.0, 0.546875}; + //float white_balance[] = {1.0, 1.0, 1.0}; + + int digital_gain_gr = digital_gain / white_balance[1]; + int digital_gain_gb = digital_gain / white_balance[1]; + int digital_gain_r = digital_gain / white_balance[0]; + int digital_gain_b = digital_gain / white_balance[2]; + + struct msm_camera_i2c_reg_array reg_array[] = { + // REG_HOLD + {0x104,0x1,0}, + {0x3002,0x0,0}, // long autoexposure off + + // FRM_LENGTH + {0x340, frame_length >> 8, 0}, {0x341, frame_length & 0xff, 0}, + // INTEG_TIME aka coarse_int_time_addr aka shutter speed + {0x202, integ_lines >> 8, 0}, {0x203, integ_lines & 0xff,0}, + // global_gain_addr + // if you assume 1x gain is 32, 448 is 14x gain, aka 2^14=16384 + {0x204, analog_gain >> 8, 0}, {0x205, analog_gain & 0xff,0}, + + // digital gain for colors: gain_greenR, gain_red, gain_blue, gain_greenB + /*{0x20e, digital_gain_gr >> 8, 0}, {0x20f,digital_gain_gr & 0xFF,0}, + {0x210, digital_gain_r >> 8, 0}, {0x211,digital_gain_r & 0xFF,0}, + {0x212, digital_gain_b >> 8, 0}, {0x213,digital_gain_b & 0xFF,0}, + {0x214, digital_gain_gb >> 8, 0}, {0x215,digital_gain_gb & 0xFF,0},*/ + + // REG_HOLD + {0x104,0x0,0}, + }; + + err = sensor_write_regs(s, reg_array, ARRAYSIZE(reg_array), MSM_CAMERA_I2C_BYTE_DATA); + if (err != 0) { + LOGE("apply_exposure err %d", err); + } + return err; +} + +static inline int ov8865_get_coarse_gain(int gain) { + static const int gains[] = {0, 256, 384, 448, 480}; + int i; + + for (i = 1; i < ARRAYSIZE(gains); i++) { + if (gain >= gains[i - 1] && gain < gains[i]) + break; + } + + return i - 1; +} + +static int ov8865_apply_exposure(CameraState *s, int gain, int integ_lines, int frame_length) { + //printf("front camera: %d %d %d\n", gain, integ_lines, frame_length); + int err, gain_bitmap; + gain_bitmap = (1 << ov8865_get_coarse_gain(gain)) - 1; + integ_lines *= 16; // The exposure value in reg is in 16ths of a line + struct msm_camera_i2c_reg_array reg_array[] = { + //{0x104,0x1,0}, + + // FRM_LENGTH + {0x380e, frame_length >> 8, 0}, {0x380f, frame_length & 0xff, 0}, + // AEC EXPO + {0x3500, integ_lines >> 16, 0}, {0x3501, integ_lines >> 8, 0}, {0x3502, integ_lines & 0xff,0}, + // AEC MANUAL + {0x3503, 0x4, 0}, + // AEC GAIN + {0x3508, gain_bitmap, 0}, {0x3509, 0xf8, 0}, + + //{0x104,0x0,0}, + }; + err = sensor_write_regs(s, reg_array, ARRAYSIZE(reg_array), MSM_CAMERA_I2C_BYTE_DATA); + if (err != 0) { + LOGE("apply_exposure err %d", err); + } + return err; +} + +static int imx179_s5k3p8sp_apply_exposure(CameraState *s, int gain, int integ_lines, int frame_length) { + //printf("front camera: %d %d %d\n", gain, integ_lines, frame_length); + int err; + + if (gain > 448) { + s->digital_gain = (512.0/(512-(gain))) / 8.0; + } else { + s->digital_gain = 1.0; + } + + struct msm_camera_i2c_reg_array reg_array[] = { + {0x104,0x1,0}, + + // FRM_LENGTH + {0x340, frame_length >> 8, 0}, {0x341, frame_length & 0xff, 0}, + // coarse_int_time + {0x202, integ_lines >> 8, 0}, {0x203, integ_lines & 0xff,0}, + // global_gain + {0x204, gain >> 8, 0}, {0x205, gain & 0xff,0}, + + {0x104,0x0,0}, + }; + err = sensor_write_regs(s, reg_array, ARRAYSIZE(reg_array), MSM_CAMERA_I2C_BYTE_DATA); + if (err != 0) { + LOGE("apply_exposure err %d", err); + } + return err; +} + +void cameras_init(DualCameraState *s) { + memset(s, 0, sizeof(*s)); + + char project_name[1024] = {0}; + property_get("ro.boot.project_name", project_name, ""); + + char product_name[1024] = {0}; + property_get("ro.product.name", product_name, ""); + + if (strlen(project_name) == 0) { + LOGD("LePro 3 op system detected"); + s->device = DEVICE_LP3; + + // sensor is flipped in LP3 + // IMAGE_ORIENT = 3 + init_array_imx298[0].reg_data = 3; + cameras_supported[CAMERA_ID_IMX298].bayer_flip = 3; + } else if (strcmp(product_name, "OnePlus3") == 0 && strcmp(project_name, "15811") != 0) { + // no more OP3 support + s->device = DEVICE_OP3; + assert(false); + } else if (strcmp(product_name, "OnePlus3") == 0 && strcmp(project_name, "15811") == 0) { + // only OP3T support + s->device = DEVICE_OP3T; + } else if (strcmp(product_name, "LePro3") == 0) { + LOGD("LePro 3 detected"); + s->device = DEVICE_LP3; + assert(false); + } else { + assert(false); + } + + // 0 = ISO 100 + // 256 = ISO 200 + // 384 = ISO 400 + // 448 = ISO 800 + // 480 = ISO 1600 + // 496 = ISO 3200 + // 504 = ISO 6400, 8x digital gain + // 508 = ISO 12800, 16x digital gain + // 510 = ISO 25600, 32x digital gain + + camera_init(&s->rear, CAMERA_ID_IMX298, 0, + /*pixel_clock=*/600000000, /*line_length_pclk=*/5536, + /*max_gain=*/510, //0 (ISO 100)- 448 (ISO 800, max analog gain) - 511 (super noisy) +#ifdef HIGH_FPS + /*fps*/60 +#else + /*fps*/20 +#endif + ); + s->rear.apply_exposure = imx298_apply_exposure; + + if (s->device == DEVICE_OP3T) { + camera_init(&s->front, CAMERA_ID_S5K3P8SP, 1, + /*pixel_clock=*/561000000, /*line_length_pclk=*/5120, + /*max_gain=*/510, 10); + s->front.apply_exposure = imx179_s5k3p8sp_apply_exposure; + } else if (s->device == DEVICE_LP3) { + camera_init(&s->front, CAMERA_ID_OV8865, 1, + /*pixel_clock=*/251200000, /*line_length_pclk=*/7000, + /*max_gain=*/510, 10); + s->front.apply_exposure = ov8865_apply_exposure; + } else { + camera_init(&s->front, CAMERA_ID_IMX179, 1, + /*pixel_clock=*/251200000, /*line_length_pclk=*/3440, + /*max_gain=*/224, 20); + s->front.apply_exposure = imx179_s5k3p8sp_apply_exposure; + } + + // assume the device is upside-down (not anymore) + s->rear.transform = (mat3){{ + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + }}; + + // probably wrong + s->front.transform = (mat3){{ + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + }}; + + s->rear.device = s->device; + s->front.device = s->device; +} + +static void set_exposure(CameraState *s, float exposure_frac, float gain_frac) { + int err = 0; + + unsigned int frame_length = s->pixel_clock / s->line_length_pclk / s->fps; + + unsigned int gain = s->cur_gain; + unsigned int integ_lines = s->cur_integ_lines; + + if (exposure_frac >= 0) { + exposure_frac = clamp(exposure_frac, 2.0 / frame_length, 1.0); + integ_lines = frame_length * exposure_frac; + + // See page 79 of the datasheet, this is the max allowed (-1 for phase adjust) + integ_lines = min(integ_lines, frame_length-11); + } + + // done after exposure to not adjust it + if (s->using_pll) { + // can adjust frame length by up to +/- 1 + const int PHASE_DEADZONE = 20000; // 20 us + int phase_max = 1000000000 / s->fps; + int phase_diff = s->phase_actual - s->phase_request; + phase_diff = ((phase_diff + phase_max/2) % phase_max) - phase_max/2; + + if (phase_diff < -PHASE_DEADZONE) { + frame_length += 1; + } else if (phase_diff > PHASE_DEADZONE) { + frame_length -= 1; + } + } + + if (gain_frac >= 0) { + // ISO200 is minimum gain + gain_frac = clamp(gain_frac, 1.0/64, 1.0); + + // linearize gain response + // TODO: will be wrong for front camera + // 0.125 -> 448 + // 0.25 -> 480 + // 0.5 -> 496 + // 1.0 -> 504 + // 512 - 512/(128*gain_frac) + gain = (s->max_gain/510) * (512 - 512/(256*gain_frac)); + } + + if (gain != s->cur_gain + || integ_lines != s->cur_integ_lines + || frame_length != s->cur_frame_length) { + + if (s->apply_exposure) { + err = s->apply_exposure(s, gain, integ_lines, frame_length); + } + + if (err == 0) { + pthread_mutex_lock(&s->frame_info_lock); + s->cur_gain = gain; + s->cur_integ_lines = integ_lines; + s->cur_frame_length = frame_length; + pthread_mutex_unlock(&s->frame_info_lock); + } + } + + if (err == 0) { + s->cur_exposure_frac = exposure_frac; + s->cur_gain_frac = gain_frac; + } + + LOGD("set exposure: %f %f - %d", exposure_frac, gain_frac, err); +} + +static void do_autoexposure(CameraState *s, float grey_frac) { + const float target_grey = 0.3; + + float new_exposure = s->cur_exposure_frac; + new_exposure *= pow(1.05, (target_grey - grey_frac) / 0.05 ); + LOGD("diff %f: %f to %f", target_grey - grey_frac, s->cur_exposure_frac, new_exposure); + + float new_gain = s->cur_gain_frac; + if (new_exposure < 0.10) { + new_gain *= 0.95; + } else if (new_exposure > 0.40) { + new_gain *= 1.05; + } + + set_exposure(s, new_exposure, new_gain); +} + +void camera_autoexposure(CameraState *s, float grey_frac) { + CameraMsg msg = { + .type = CAMERA_MSG_AUTOEXPOSE, + .camera_num = s->camera_num, + .grey_frac = grey_frac, + }; + + zmq_send(s->ops_sock, &msg, sizeof(msg), ZMQ_DONTWAIT); +} + +static uint8_t* get_eeprom(int eeprom_fd, size_t *out_len) { + int err; + + struct msm_eeprom_cfg_data cfg = {0}; + cfg.cfgtype = CFG_EEPROM_GET_CAL_DATA; + err = ioctl(eeprom_fd, VIDIOC_MSM_EEPROM_CFG, &cfg); + assert(err >= 0); + + uint32_t num_bytes = cfg.cfg.get_data.num_bytes; + assert(num_bytes > 100); + + uint8_t* buffer = malloc(num_bytes); + assert(buffer); + memset(buffer, 0, num_bytes); + + cfg.cfgtype = CFG_EEPROM_READ_CAL_DATA; + cfg.cfg.read_data.num_bytes = num_bytes; + cfg.cfg.read_data.dbuffer = buffer; + err = ioctl(eeprom_fd, VIDIOC_MSM_EEPROM_CFG, &cfg); + assert(err >= 0); + + *out_len = num_bytes; + return buffer; +} + +static void imx298_ois_calibration(int ois_fd, uint8_t* eeprom) { + int err; + + const int ois_registers[][2] = { + // == SET_FADJ_PARAM() == (factory adjustment) + + // Set Hall Current DAC + {0x8230, *(uint16_t*)(eeprom+0x102)}, //_P_30_ADC_CH0 (CURDAT) + + // Set Hall PreAmp Offset + {0x8231, *(uint16_t*)(eeprom+0x104)}, //_P_31_ADC_CH1 (HALOFS_X) + {0x8232, *(uint16_t*)(eeprom+0x106)}, //_P_32_ADC_CH2 (HALOFS_Y) + + // Set Hall-X/Y PostAmp Offset + {0x841e, *(uint16_t*)(eeprom+0x108)}, //_M_X_H_ofs + {0x849e, *(uint16_t*)(eeprom+0x10a)}, //_M_Y_H_ofs + + // Set Residual Offset + {0x8239, *(uint16_t*)(eeprom+0x10c)}, //_P_39_Ch3_VAL_1 (PSTXOF) + {0x823b, *(uint16_t*)(eeprom+0x10e)}, //_P_3B_Ch3_VAL_3 (PSTYOF) + + // DIGITAL GYRO OFFSET + {0x8406, *(uint16_t*)(eeprom+0x110)}, //_M_Kgx00 + {0x8486, *(uint16_t*)(eeprom+0x112)}, //_M_Kgy00 + {0x846a, *(uint16_t*)(eeprom+0x120)}, //_M_TMP_X_ + {0x846b, *(uint16_t*)(eeprom+0x122)}, //_M_TMP_Y_ + + // HALLSENSE + // Set Hall Gain + {0x8446, *(uint16_t*)(eeprom+0x114)}, //_M_KgxHG + {0x84c6, *(uint16_t*)(eeprom+0x116)}, //_M_KgyHG + // Set Cross Talk Canceller + {0x8470, *(uint16_t*)(eeprom+0x124)}, //_M_KgxH0 + {0x8472, *(uint16_t*)(eeprom+0x126)}, //_M_KgyH0 + + // LOOPGAIN + {0x840f, *(uint16_t*)(eeprom+0x118)}, //_M_KgxG + {0x848f, *(uint16_t*)(eeprom+0x11a)}, //_M_KgyG + + // Position Servo ON ( OIS OFF ) + {0x847f, 0x0c0c}, //_M_EQCTL + }; + + + struct msm_ois_cfg_data cfg = {0}; + struct msm_camera_i2c_seq_reg_array ois_reg_settings[ARRAYSIZE(ois_registers)] = {{0}}; + for (int i=0; i> 8) & 0xff; + ois_reg_settings[i].reg_data_size = 2; + } + struct msm_camera_i2c_seq_reg_setting ois_reg_setting = { + .reg_setting = &ois_reg_settings[0], + .size = ARRAYSIZE(ois_reg_settings), + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .delay = 0, + }; + cfg.cfgtype = CFG_OIS_I2C_WRITE_SEQ_TABLE; + cfg.cfg.settings = &ois_reg_setting; + err = ioctl(ois_fd, VIDIOC_MSM_OIS_CFG, &cfg); + LOG("ois reg calibration: %d", err); +} + + + + +static void sensors_init(DualCameraState *s) { + int err; + + int sensorinit_fd = -1; + if (s->device == DEVICE_LP3) { + sensorinit_fd = open("/dev/v4l-subdev11", O_RDWR | O_NONBLOCK); + } else { + sensorinit_fd = open("/dev/v4l-subdev12", O_RDWR | O_NONBLOCK); + } + assert(sensorinit_fd >= 0); + + struct sensor_init_cfg_data sensor_init_cfg = {0}; + + // init rear sensor + + struct msm_camera_sensor_slave_info slave_info = {0}; + if (s->device == DEVICE_LP3) { + slave_info = (struct msm_camera_sensor_slave_info){ + .sensor_name = "imx298", + .eeprom_name = "sony_imx298", + .actuator_name = "dw9800w", + .ois_name = "", + .flash_name = "pmic", + .camera_id = 0, + .slave_addr = 32, + .i2c_freq_mode = 1, + .addr_type = 2, + .sensor_id_info = { + .sensor_id_reg_addr = 22, + .sensor_id = 664, + .sensor_id_mask = 0, + .module_id = 9, + .vcm_id = 6, + }, + .power_setting_array = { + .power_setting_a = { + { + .seq_type = 1, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 1, + .seq_val = 5, + .config_val = 2, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 3, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 0, + .seq_val = 0, + .config_val = 24000000, + .delay = 1, + },{ + .seq_type = 1, + .seq_val = 0, + .config_val = 2, + .delay = 10, + }, + }, + .size = 7, + .power_down_setting_a = { + { + .seq_type = 0, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 1, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 1, + .seq_val = 5, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 3, + .config_val = 0, + .delay = 1, + }, + }, + .size_down = 6, + }, + .is_init_params_valid = 0, + .sensor_init_params = { + .modes_supported = 1, + .position = 0, + .sensor_mount_angle = 90, + }, + .output_format = 0, + }; + } else { + slave_info = (struct msm_camera_sensor_slave_info){ + .sensor_name = "imx298", + .eeprom_name = "sony_imx298", + .actuator_name = "rohm_bu63165gwl", + .ois_name = "rohm_bu63165gwl", + .camera_id = 0, + .slave_addr = 52, + .i2c_freq_mode = 2, + .addr_type = 2, + .sensor_id_info = { + .sensor_id_reg_addr = 22, + .sensor_id = 664, + .sensor_id_mask = 0, + }, + .power_setting_array = { + .power_setting_a = { + { + .seq_type = 1, + .seq_val = 0, + .config_val = 0, + .delay = 2, + },{ + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 2, + },{ + .seq_type = 2, + .seq_val = 0, + .config_val = 0, + .delay = 2, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 2, + },{ + .seq_type = 1, + .seq_val = 6, + .config_val = 2, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 3, + .config_val = 0, + .delay = 5, + },{ + .seq_type = 2, + .seq_val = 4, + .config_val = 0, + .delay = 5, + },{ + .seq_type = 0, + .seq_val = 0, + .config_val = 24000000, + .delay = 2, + },{ + .seq_type = 1, + .seq_val = 0, + .config_val = 2, + .delay = 2, + }, + }, + .size = 9, + .power_down_setting_a = { + { + .seq_type = 1, + .seq_val = 0, + .config_val = 0, + .delay = 10, + },{ + .seq_type = 0, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 4, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 3, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 1, + .seq_val = 6, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 0, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 0, + }, + }, + .size_down = 8, + }, + .is_init_params_valid = 0, + .sensor_init_params = { + .modes_supported = 1, + .position = 0, + .sensor_mount_angle = 360, + }, + .output_format = 0, + }; + } + slave_info.power_setting_array.power_setting = + (struct msm_sensor_power_setting *)&slave_info.power_setting_array.power_setting_a[0]; + slave_info.power_setting_array.power_down_setting = + (struct msm_sensor_power_setting *)&slave_info.power_setting_array.power_down_setting_a[0]; + sensor_init_cfg.cfgtype = CFG_SINIT_PROBE; + sensor_init_cfg.cfg.setting = &slave_info; + err = ioctl(sensorinit_fd, VIDIOC_MSM_SENSOR_INIT_CFG, &sensor_init_cfg); + LOG("sensor init cfg (rear): %d", err); + assert(err >= 0); + + + struct msm_camera_sensor_slave_info slave_info2 = {0}; + if (s->device == DEVICE_LP3) { + slave_info2 = (struct msm_camera_sensor_slave_info){ + .sensor_name = "ov8865_sunny", + .eeprom_name = "ov8865_plus", + .actuator_name = "", + .ois_name = "", + .flash_name = "", + .camera_id = 2, + .slave_addr = 108, + .i2c_freq_mode = 1, + .addr_type = 2, + .sensor_id_info = { + .sensor_id_reg_addr = 12299, + .sensor_id = 34917, + .sensor_id_mask = 0, + .module_id = 2, + .vcm_id = 0, + }, + .power_setting_array = { + .power_setting_a = { + { + .seq_type = 1, + .seq_val = 0, + .config_val = 0, + .delay = 5, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 0, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 0, + .seq_val = 0, + .config_val = 24000000, + .delay = 1, + },{ + .seq_type = 1, + .seq_val = 0, + .config_val = 2, + .delay = 1, + }, + }, + .size = 6, + .power_down_setting_a = { + { + .seq_type = 1, + .seq_val = 0, + .config_val = 0, + .delay = 5, + },{ + .seq_type = 0, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 0, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 1, + }, + }, + .size_down = 5, + }, + .is_init_params_valid = 0, + .sensor_init_params = { + .modes_supported = 1, + .position = 1, + .sensor_mount_angle = 270, + }, + .output_format = 0, + }; + } else if (s->front.camera_id == CAMERA_ID_S5K3P8SP) { + // init front camera + slave_info2 = (struct msm_camera_sensor_slave_info){ + .sensor_name = "s5k3p8sp", + .eeprom_name = "s5k3p8sp_m24c64s", + .actuator_name = "", + .ois_name = "", + .camera_id = 1, + .slave_addr = 32, + .i2c_freq_mode = 1, + .addr_type = 2, + .sensor_id_info = { + .sensor_id_reg_addr = 0, + .sensor_id = 12552, + .sensor_id_mask = 0, + }, + .power_setting_array = { + .power_setting_a = { + { + .seq_type = 1, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 0, + .seq_val = 0, + .config_val = 24000000, + .delay = 1, + },{ + .seq_type = 1, + .seq_val = 0, + .config_val = 2, + .delay = 1, + }, + }, + .size = 6, + .power_down_setting_a = { + { + .seq_type = 0, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 1, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 1, + }, + }, + .size_down = 5, + }, + .is_init_params_valid = 0, + .sensor_init_params = { + .modes_supported = 1, + .position = 1, + .sensor_mount_angle = 270, + }, + .output_format = 0, + }; + } else { + // init front camera + slave_info2 = (struct msm_camera_sensor_slave_info){ + .sensor_name = "imx179", + .eeprom_name = "sony_imx179", + .actuator_name = "", + .ois_name = "", + .camera_id = 1, + .slave_addr = 32, + .i2c_freq_mode = 1, + .addr_type = 2, + .sensor_id_info = { + .sensor_id_reg_addr = 2, + .sensor_id = 377, + .sensor_id_mask = 4095, + }, + .power_setting_array = { + .power_setting_a = { + { + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 0, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 1, + .seq_val = 0, + .config_val = 2, + .delay = 0, + },{ + .seq_type = 0, + .seq_val = 0, + .config_val = 24000000, + .delay = 0, + }, + }, + .size = 5, + .power_down_setting_a = { + { + .seq_type = 0, + .seq_val = 0, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 1, + .seq_val = 0, + .config_val = 0, + .delay = 1, + },{ + .seq_type = 2, + .seq_val = 0, + .config_val = 0, + .delay = 2, + },{ + .seq_type = 2, + .seq_val = 1, + .config_val = 0, + .delay = 0, + },{ + .seq_type = 2, + .seq_val = 2, + .config_val = 0, + .delay = 0, + }, + }, + .size_down = 5, + }, + .is_init_params_valid = 0, + .sensor_init_params = { + .modes_supported = 1, + .position = 1, + .sensor_mount_angle = 270, + }, + .output_format = 0, + }; + } + slave_info2.power_setting_array.power_setting = + (struct msm_sensor_power_setting *)&slave_info2.power_setting_array.power_setting_a[0]; + slave_info2.power_setting_array.power_down_setting = + (struct msm_sensor_power_setting *)&slave_info2.power_setting_array.power_down_setting_a[0]; + sensor_init_cfg.cfgtype = CFG_SINIT_PROBE; + sensor_init_cfg.cfg.setting = &slave_info2; + err = ioctl(sensorinit_fd, VIDIOC_MSM_SENSOR_INIT_CFG, &sensor_init_cfg); + LOG("sensor init cfg (front): %d", err); + assert(err >= 0); +} + +static void camera_open(CameraState *s, bool rear) { + int err; + + struct sensorb_cfg_data sensorb_cfg_data = {0}; + struct csid_cfg_data csid_cfg_data = {0}; + struct csiphy_cfg_data csiphy_cfg_data = {0}; + struct msm_camera_csiphy_params csiphy_params = {0}; + struct msm_camera_csid_params csid_params = {0}; + struct msm_vfe_input_cfg input_cfg = {0}; + struct msm_vfe_axi_stream_update_cmd update_cmd = {0}; + struct v4l2_event_subscription sub = {0}; + struct ispif_cfg_data ispif_cfg_data = {0}; + struct msm_vfe_cfg_cmd_list cfg_cmd_list = {0}; + + struct msm_actuator_cfg_data actuator_cfg_data = {0}; + struct msm_ois_cfg_data ois_cfg_data = {0}; + + // open devices + if (rear) { + s->csid_fd = open("/dev/v4l-subdev3", O_RDWR | O_NONBLOCK); + assert(s->csid_fd >= 0); + s->csiphy_fd = open("/dev/v4l-subdev0", O_RDWR | O_NONBLOCK); + assert(s->csiphy_fd >= 0); + if (s->device == DEVICE_LP3) { + s->sensor_fd = open("/dev/v4l-subdev17", O_RDWR | O_NONBLOCK); + } else { + s->sensor_fd = open("/dev/v4l-subdev18", O_RDWR | O_NONBLOCK); + } + assert(s->sensor_fd >= 0); + if (s->device == DEVICE_LP3) { + s->isp_fd = open("/dev/v4l-subdev13", O_RDWR | O_NONBLOCK); + } else { + s->isp_fd = open("/dev/v4l-subdev14", O_RDWR | O_NONBLOCK); + } + assert(s->isp_fd >= 0); + s->eeprom_fd = open("/dev/v4l-subdev8", O_RDWR | O_NONBLOCK); + assert(s->eeprom_fd >= 0); + + s->actuator_fd = open("/dev/v4l-subdev7", O_RDWR | O_NONBLOCK); + assert(s->actuator_fd >= 0); + + if (s->device != DEVICE_LP3) { + s->ois_fd = open("/dev/v4l-subdev10", O_RDWR | O_NONBLOCK); + assert(s->ois_fd >= 0); + } + } else { + s->csid_fd = open("/dev/v4l-subdev5", O_RDWR | O_NONBLOCK); + assert(s->csid_fd >= 0); + s->csiphy_fd = open("/dev/v4l-subdev2", O_RDWR | O_NONBLOCK); + assert(s->csiphy_fd >= 0); + if (s->device == DEVICE_LP3) { + s->sensor_fd = open("/dev/v4l-subdev18", O_RDWR | O_NONBLOCK); + } else { + s->sensor_fd = open("/dev/v4l-subdev19", O_RDWR | O_NONBLOCK); + } + assert(s->sensor_fd >= 0); + if (s->device == DEVICE_LP3) { + s->isp_fd = open("/dev/v4l-subdev14", O_RDWR | O_NONBLOCK); + } else { + s->isp_fd = open("/dev/v4l-subdev15", O_RDWR | O_NONBLOCK); + } + assert(s->isp_fd >= 0); + s->eeprom_fd = open("/dev/v4l-subdev9", O_RDWR | O_NONBLOCK); + assert(s->eeprom_fd >= 0); + } + + // *** SHUTDOWN ALL *** + + // CSIPHY: release csiphy + struct msm_camera_csi_lane_params csi_lane_params = {0}; + csi_lane_params.csi_lane_mask = 0x1f; + csiphy_cfg_data.cfg.csi_lane_params = &csi_lane_params; + csiphy_cfg_data.cfgtype = CSIPHY_RELEASE; + err = ioctl(s->csiphy_fd, VIDIOC_MSM_CSIPHY_IO_CFG, &csiphy_cfg_data); + LOG("release csiphy: %d", err); + + // CSID: release csid + csid_cfg_data.cfgtype = CSID_RELEASE; + err = ioctl(s->csid_fd, VIDIOC_MSM_CSID_IO_CFG, &csid_cfg_data); + LOG("release csid: %d", err); + + // SENSOR: send power down + memset(&sensorb_cfg_data, 0, sizeof(sensorb_cfg_data)); + sensorb_cfg_data.cfgtype = CFG_POWER_DOWN; + err = ioctl(s->sensor_fd, VIDIOC_MSM_SENSOR_CFG, &sensorb_cfg_data); + LOG("sensor power down: %d", err); + + if (rear && s->device != DEVICE_LP3) { + // ois powerdown + ois_cfg_data.cfgtype = CFG_OIS_POWERDOWN; + err = ioctl(s->ois_fd, VIDIOC_MSM_OIS_CFG, &ois_cfg_data); + LOG("ois powerdown: %d", err); + } + + // actuator powerdown + actuator_cfg_data.cfgtype = CFG_ACTUATOR_POWERDOWN; + err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data); + LOG("actuator powerdown: %d", err); + + // reset isp + // struct msm_vfe_axi_halt_cmd halt_cmd = { + // .stop_camif = 1, + // .overflow_detected = 1, + // .blocking_halt = 1, + // }; + // err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_AXI_HALT, &halt_cmd); + // printf("axi halt: %d\n", err); + + // struct msm_vfe_axi_reset_cmd reset_cmd = { + // .blocking = 1, + // .frame_id = 1, + // }; + // err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_AXI_RESET, &reset_cmd); + // printf("axi reset: %d\n", err); + + // struct msm_vfe_axi_restart_cmd restart_cmd = { + // .enable_camif = 1, + // }; + // err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_AXI_RESTART, &restart_cmd); + // printf("axi restart: %d\n", err); + + // **** GO GO GO **** + LOG("******************** GO GO GO ************************"); + + s->eeprom = get_eeprom(s->eeprom_fd, &s->eeprom_size); + + // printf("eeprom:\n"); + // for (int i=0; ieeprom_size; i++) { + // printf("%02x", s->eeprom[i]); + // } + // printf("\n"); + + // CSID: init csid + csid_cfg_data.cfgtype = CSID_INIT; + err = ioctl(s->csid_fd, VIDIOC_MSM_CSID_IO_CFG, &csid_cfg_data); + LOG("init csid: %d", err); + + // CSIPHY: init csiphy + memset(&csiphy_cfg_data, 0, sizeof(csiphy_cfg_data)); + csiphy_cfg_data.cfgtype = CSIPHY_INIT; + err = ioctl(s->csiphy_fd, VIDIOC_MSM_CSIPHY_IO_CFG, &csiphy_cfg_data); + LOG("init csiphy: %d", err); + + // SENSOR: stop stream + struct msm_camera_i2c_reg_setting stop_settings = { + .reg_setting = stop_reg_array, + .size = ARRAYSIZE(stop_reg_array), + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .data_type = MSM_CAMERA_I2C_BYTE_DATA, + .delay = 0 + }; + sensorb_cfg_data.cfgtype = CFG_SET_STOP_STREAM_SETTING; + sensorb_cfg_data.cfg.setting = &stop_settings; + err = ioctl(s->sensor_fd, VIDIOC_MSM_SENSOR_CFG, &sensorb_cfg_data); + LOG("stop stream: %d", err); + + // SENSOR: send power up + memset(&sensorb_cfg_data, 0, sizeof(sensorb_cfg_data)); + sensorb_cfg_data.cfgtype = CFG_POWER_UP; + err = ioctl(s->sensor_fd, VIDIOC_MSM_SENSOR_CFG, &sensorb_cfg_data); + LOG("sensor power up: %d", err); + + // **** configure the sensor **** + + // SENSOR: send i2c configuration + if (s->camera_id == CAMERA_ID_IMX298) { + err = sensor_write_regs(s, init_array_imx298, ARRAYSIZE(init_array_imx298), MSM_CAMERA_I2C_BYTE_DATA); + } else if (s->camera_id == CAMERA_ID_S5K3P8SP) { + err = sensor_write_regs(s, init_array_s5k3p8sp, ARRAYSIZE(init_array_s5k3p8sp), MSM_CAMERA_I2C_WORD_DATA); + } else if (s->camera_id == CAMERA_ID_IMX179) { + err = sensor_write_regs(s, init_array_imx179, ARRAYSIZE(init_array_imx179), MSM_CAMERA_I2C_BYTE_DATA); + } else if (s->camera_id == CAMERA_ID_OV8865) { + err = sensor_write_regs(s, init_array_ov8865, ARRAYSIZE(init_array_ov8865), MSM_CAMERA_I2C_BYTE_DATA); + } else { + assert(false); + } + LOG("sensor init i2c: %d", err); + + if (rear) { + // init the actuator + actuator_cfg_data.cfgtype = CFG_ACTUATOR_POWERUP; + err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data); + LOG("actuator powerup: %d", err); + + actuator_cfg_data.cfgtype = CFG_ACTUATOR_INIT; + err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data); + LOG("actuator init: %d", err); + + + // no OIS in LP3 + if (s->device != DEVICE_LP3) { + // see sony_imx298_eeprom_format_afdata in libmmcamera_sony_imx298_eeprom.so + const float far_margin = -0.28; + uint16_t macro_dac = *(uint16_t*)(s->eeprom + 0x24); + s->infinity_dac = *(uint16_t*)(s->eeprom + 0x26); + LOG("macro_dac: %d infinity_dac: %d", macro_dac, s->infinity_dac); + + int dac_range = macro_dac - s->infinity_dac; + s->infinity_dac += far_margin * dac_range; + + LOG(" -> macro_dac: %d infinity_dac: %d", macro_dac, s->infinity_dac); + + struct msm_actuator_reg_params_t actuator_reg_params[] = { + { + .reg_write_type = MSM_ACTUATOR_WRITE_DAC, + .hw_mask = 0, + .reg_addr = 240, + .hw_shift = 0, + .data_type = 10, + .addr_type = 4, + .reg_data = 0, + .delay = 0, + }, { + .reg_write_type = MSM_ACTUATOR_WRITE_DAC, + .hw_mask = 0, + .reg_addr = 241, + .hw_shift = 0, + .data_type = 10, + .addr_type = 4, + .reg_data = 0, + .delay = 0, + }, { + .reg_write_type = MSM_ACTUATOR_WRITE_DAC, + .hw_mask = 0, + .reg_addr = 242, + .hw_shift = 0, + .data_type = 10, + .addr_type = 4, + .reg_data = 0, + .delay = 0, + }, { + .reg_write_type = MSM_ACTUATOR_WRITE_DAC, + .hw_mask = 0, + .reg_addr = 243, + .hw_shift = 0, + .data_type = 10, + .addr_type = 4, + .reg_data = 0, + .delay = 0, + }, + }; + + //... + struct reg_settings_t actuator_init_settings[1] = {0}; + + struct region_params_t region_params[] = { + { + .step_bound = {512, 0,}, + .code_per_step = 118, + .qvalue = 128, + }, + }; + + actuator_cfg_data.cfgtype = CFG_SET_ACTUATOR_INFO; + actuator_cfg_data.cfg.set_info = (struct msm_actuator_set_info_t){ + .actuator_params = { + .act_type = ACTUATOR_VCM, + .reg_tbl_size = 4, + .data_size = 10, + .init_setting_size = 0, + .i2c_freq_mode = I2C_CUSTOM_MODE, + .i2c_addr = 28, + .i2c_addr_type = MSM_ACTUATOR_BYTE_ADDR, + .i2c_data_type = MSM_ACTUATOR_BYTE_DATA, + .reg_tbl_params = &actuator_reg_params[0], + .init_settings = &actuator_init_settings[0], + .park_lens = { + .damping_step = 1023, + .damping_delay = 15000, + .hw_params = 58404, + .max_step = 20, + } + }, + .af_tuning_params = { + .initial_code = s->infinity_dac, + .pwd_step = 0, + .region_size = 1, + .total_steps = 512, + .region_params = ®ion_params[0], + }, + }; + err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data); + LOG("actuator set info: %d", err); + + // power up ois + ois_cfg_data.cfgtype = CFG_OIS_POWERUP; + err = ioctl(s->ois_fd, VIDIOC_MSM_OIS_CFG, &ois_cfg_data); + LOG("ois powerup: %d", err); + + ois_cfg_data.cfgtype = CFG_OIS_INIT; + err = ioctl(s->ois_fd, VIDIOC_MSM_OIS_CFG, &ois_cfg_data); + LOG("ois init: %d", err); + + ois_cfg_data.cfgtype = CFG_OIS_CONTROL; + ois_cfg_data.cfg.set_info.ois_params = (struct msm_ois_params_t){ + // .data_size = 26312, + .setting_size = 120, + .i2c_addr = 28, + .i2c_freq_mode = I2C_CUSTOM_MODE, + // .i2c_addr_type = wtf + // .i2c_data_type = wtf + .settings = &ois_init_settings[0], + }; + err = ioctl(s->ois_fd, VIDIOC_MSM_OIS_CFG, &ois_cfg_data); + LOG("ois init settings: %d", err); + } else { + // leeco actuator + // from sniff + s->infinity_dac = 364; + + struct msm_actuator_reg_params_t actuator_reg_params[] = { + { + .reg_write_type = MSM_ACTUATOR_WRITE_DAC, + .hw_mask = 0, + .reg_addr = 3, + .hw_shift = 0, + .data_type = 9, + .addr_type = 4, + .reg_data = 0, + .delay = 0, + }, + }; + + struct reg_settings_t actuator_init_settings[] = { + { .reg_addr=2, .addr_type=MSM_ACTUATOR_BYTE_ADDR, .reg_data=1, .data_type = MSM_ACTUATOR_BYTE_DATA, .i2c_operation = MSM_ACT_WRITE, .delay = 0 }, + { .reg_addr=2, .addr_type=MSM_ACTUATOR_BYTE_ADDR, .reg_data=0, .data_type = MSM_ACTUATOR_BYTE_DATA, .i2c_operation = MSM_ACT_WRITE, .delay = 2 }, + { .reg_addr=2, .addr_type=MSM_ACTUATOR_BYTE_ADDR, .reg_data=2, .data_type = MSM_ACTUATOR_BYTE_DATA, .i2c_operation = MSM_ACT_WRITE, .delay = 2 }, + { .reg_addr=6, .addr_type=MSM_ACTUATOR_BYTE_ADDR, .reg_data=64, .data_type = MSM_ACTUATOR_BYTE_DATA, .i2c_operation = MSM_ACT_WRITE, .delay = 0 }, + { .reg_addr=7, .addr_type=MSM_ACTUATOR_BYTE_ADDR, .reg_data=113, .data_type = MSM_ACTUATOR_BYTE_DATA, .i2c_operation = MSM_ACT_WRITE, .delay = 0 }, + }; + + struct region_params_t region_params[] = { + { + .step_bound = {238, 0,}, + .code_per_step = 235, + .qvalue = 128, + }, + }; + + actuator_cfg_data.cfgtype = CFG_SET_ACTUATOR_INFO; + actuator_cfg_data.cfg.set_info = (struct msm_actuator_set_info_t){ + .actuator_params = { + .act_type = ACTUATOR_BIVCM, + .reg_tbl_size = 1, + .data_size = 10, + .init_setting_size = 5, + .i2c_freq_mode = I2C_STANDARD_MODE, + .i2c_addr = 24, + .i2c_addr_type = MSM_ACTUATOR_BYTE_ADDR, + .i2c_data_type = MSM_ACTUATOR_WORD_DATA, + .reg_tbl_params = &actuator_reg_params[0], + .init_settings = &actuator_init_settings[0], + .park_lens = { + .damping_step = 1023, + .damping_delay = 14000, + .hw_params = 11, + .max_step = 20, + } + }, + .af_tuning_params = { + .initial_code = s->infinity_dac, + .pwd_step = 0, + .region_size = 1, + .total_steps = 238, + .region_params = ®ion_params[0], + }, + }; + + err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data); + LOG("actuator set info: %d", err); + } + } + + if (s->camera_id == CAMERA_ID_IMX298) { + err = sensor_write_regs(s, mode_setting_array_imx298, ARRAYSIZE(mode_setting_array_imx298), MSM_CAMERA_I2C_BYTE_DATA); + LOG("sensor setup: %d", err); + } + + // CSIPHY: configure csiphy + if (s->camera_id == CAMERA_ID_IMX298) { + csiphy_params.lane_cnt = 4; + csiphy_params.settle_cnt = 14; + csiphy_params.lane_mask = 0x1f; + csiphy_params.csid_core = 0; + } else if (s->camera_id == CAMERA_ID_S5K3P8SP) { + csiphy_params.lane_cnt = 4; + csiphy_params.settle_cnt = 24; + csiphy_params.lane_mask = 0x1f; + csiphy_params.csid_core = 0; + } else if (s->camera_id == CAMERA_ID_IMX179) { + csiphy_params.lane_cnt = 4; + csiphy_params.settle_cnt = 11; + csiphy_params.lane_mask = 0x1f; + csiphy_params.csid_core = 2; + } else if (s->camera_id == CAMERA_ID_OV8865) { + // guess! + csiphy_params.lane_cnt = 4; + csiphy_params.settle_cnt = 24; + csiphy_params.lane_mask = 0x1f; + csiphy_params.csid_core = 2; + } + csiphy_cfg_data.cfgtype = CSIPHY_CFG; + csiphy_cfg_data.cfg.csiphy_params = &csiphy_params; + err = ioctl(s->csiphy_fd, VIDIOC_MSM_CSIPHY_IO_CFG, &csiphy_cfg_data); + LOG("csiphy configure: %d", err); + + // CSID: configure csid + csid_params.lane_cnt = 4; + csid_params.lane_assign = 0x4320; + if (rear) { + csid_params.phy_sel = 0; + } else { + csid_params.phy_sel = 2; + } + csid_params.lut_params.num_cid = rear ? 3 : 1; + +#define CSI_STATS 0x35 +#define CSI_PD 0x36 + + csid_params.lut_params.vc_cfg_a[0].cid = 0; + csid_params.lut_params.vc_cfg_a[0].dt = CSI_RAW10; + csid_params.lut_params.vc_cfg_a[0].decode_format = CSI_DECODE_10BIT; + csid_params.lut_params.vc_cfg_a[1].cid = 1; + csid_params.lut_params.vc_cfg_a[1].dt = CSI_PD; + csid_params.lut_params.vc_cfg_a[1].decode_format = CSI_DECODE_10BIT; + csid_params.lut_params.vc_cfg_a[2].cid = 2; + csid_params.lut_params.vc_cfg_a[2].dt = CSI_STATS; + csid_params.lut_params.vc_cfg_a[2].decode_format = CSI_DECODE_10BIT; + + csid_params.lut_params.vc_cfg[0] = &csid_params.lut_params.vc_cfg_a[0]; + csid_params.lut_params.vc_cfg[1] = &csid_params.lut_params.vc_cfg_a[1]; + csid_params.lut_params.vc_cfg[2] = &csid_params.lut_params.vc_cfg_a[2]; + + csid_cfg_data.cfgtype = CSID_CFG; + csid_cfg_data.cfg.csid_params = &csid_params; + err = ioctl(s->csid_fd, VIDIOC_MSM_CSID_IO_CFG, &csid_cfg_data); + LOG("csid configure: %d", err); + + // ISP: SMMU_ATTACH + struct msm_vfe_smmu_attach_cmd smmu_attach_cmd = { + .security_mode = 0, + .iommu_attach_mode = IOMMU_ATTACH + }; + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_SMMU_ATTACH, &smmu_attach_cmd); + LOG("isp smmu attach: %d", err); + + // ******************* STREAM RAW ***************************** + + // configure QMET input + for (int i = 0; i < (rear ? 3 : 1); i++) { + StreamState *ss = &s->ss[i]; + + memset(&input_cfg, 0, sizeof(struct msm_vfe_input_cfg)); + input_cfg.input_src = VFE_RAW_0+i; + input_cfg.input_pix_clk = s->pixel_clock; + input_cfg.d.rdi_cfg.cid = i; + input_cfg.d.rdi_cfg.frame_based = 1; + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_INPUT_CFG, &input_cfg); + LOG("configure input(%d): %d", i, err); + + // ISP: REQUEST_STREAM + ss->stream_req.axi_stream_handle = 0; + if (rear) { + ss->stream_req.session_id = 2; + ss->stream_req.stream_id = /*ISP_META_CHANNEL_BIT | */ISP_NATIVE_BUF_BIT | (1+i); + } else { + ss->stream_req.session_id = 3; + ss->stream_req.stream_id = ISP_NATIVE_BUF_BIT | 1; + } + + if (i == 0) { + ss->stream_req.output_format = v4l2_fourcc('R', 'G', '1', '0'); + } else { + ss->stream_req.output_format = v4l2_fourcc('Q', 'M', 'E', 'T'); + } + ss->stream_req.stream_src = RDI_INTF_0+i; + +#ifdef HIGH_FPS + if (rear) { + ss->stream_req.frame_skip_pattern = EVERY_3FRAME; + } +#endif + + ss->stream_req.frame_base = 1; + ss->stream_req.buf_divert = 1; //i == 0; + + // setup stream plane. doesn't even matter? + /*s->stream_req.plane_cfg[0].output_plane_format = Y_PLANE; + s->stream_req.plane_cfg[0].output_width = s->ci.frame_width; + s->stream_req.plane_cfg[0].output_height = s->ci.frame_height; + s->stream_req.plane_cfg[0].output_stride = s->ci.frame_width; + s->stream_req.plane_cfg[0].output_scan_lines = s->ci.frame_height; + s->stream_req.plane_cfg[0].rdi_cid = 0;*/ + + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_REQUEST_STREAM, &ss->stream_req); + LOG("isp request stream: %d -> 0x%x", err, ss->stream_req.axi_stream_handle); + + // ISP: REQUEST_BUF + ss->buf_request.session_id = ss->stream_req.session_id; + ss->buf_request.stream_id = ss->stream_req.stream_id; + ss->buf_request.num_buf = FRAME_BUF_COUNT; + ss->buf_request.buf_type = ISP_PRIVATE_BUF; + ss->buf_request.handle = 0; + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_REQUEST_BUF, &ss->buf_request); + LOG("isp request buf: %d", err); + LOG("got buf handle: 0x%x", ss->buf_request.handle); + + // ENQUEUE all buffers + for (int j = 0; j < ss->buf_request.num_buf; j++) { + ss->qbuf_info[j].handle = ss->buf_request.handle; + ss->qbuf_info[j].buf_idx = j; + ss->qbuf_info[j].buffer.num_planes = 1; + ss->qbuf_info[j].buffer.planes[0].addr = ss->bufs[j].fd; + ss->qbuf_info[j].buffer.planes[0].length = ss->bufs[j].len; + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_ENQUEUE_BUF, &ss->qbuf_info[j]); + } + + // ISP: UPDATE_STREAM + update_cmd.num_streams = 1; + update_cmd.update_info[0].user_stream_id = ss->stream_req.stream_id; + update_cmd.update_info[0].stream_handle = ss->stream_req.axi_stream_handle; + update_cmd.update_type = UPDATE_STREAM_ADD_BUFQ; + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_UPDATE_STREAM, &update_cmd); + LOG("isp update stream: %d", err); + } + + LOG("******** START STREAMS ********"); + + sub.id = 0; + sub.type = 0x1ff; + err = ioctl(s->isp_fd, VIDIOC_SUBSCRIBE_EVENT, &sub); + LOG("isp subscribe: %d", err); + + // ISP: START_STREAM + s->stream_cfg.cmd = START_STREAM; + s->stream_cfg.num_streams = rear ? 3 : 1; + for (int i = 0; i < s->stream_cfg.num_streams; i++) { + s->stream_cfg.stream_handle[i] = s->ss[i].stream_req.axi_stream_handle; + } + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_CFG_STREAM, &s->stream_cfg); + LOG("isp start stream: %d", err); +} + + +static struct damping_params_t actuator_ringing_params = { + .damping_step = 1023, + .damping_delay = 15000, + .hw_params = 0x0000e422, +}; + +static void rear_start(CameraState *s) { + int err; + + struct msm_actuator_cfg_data actuator_cfg_data = {0}; + + set_exposure(s, 1.0, 1.0); + + err = sensor_write_regs(s, start_reg_array, ARRAYSIZE(start_reg_array), MSM_CAMERA_I2C_BYTE_DATA); + LOG("sensor start regs: %d", err); + + // focus on infinity assuming phone is perpendicular + int inf_step; + + if (s->device != DEVICE_LP3) { + imx298_ois_calibration(s->ois_fd, s->eeprom); + inf_step = 332 - s->infinity_dac; + + // initial guess + s->lens_true_pos = 300; + } else { + // default is OP3, this is for LeEco + actuator_ringing_params.damping_step = 1023; + actuator_ringing_params.damping_delay = 20000; + actuator_ringing_params.hw_params = 13; + + inf_step = 512 - s->infinity_dac; + + // initial guess + s->lens_true_pos = 400; + } + + // reset lens position + memset(&actuator_cfg_data, 0, sizeof(actuator_cfg_data)); + actuator_cfg_data.cfgtype = CFG_SET_POSITION; + actuator_cfg_data.cfg.setpos = (struct msm_actuator_set_position_t){ + .number_of_steps = 1, + .hw_params = (s->device != DEVICE_LP3) ? 0x0000e424 : 7, + .pos = {s->infinity_dac, 0}, + .delay = {0,} + }; + err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data); + LOG("actuator set pos: %d", err); + + // TODO: confirm this isn't needed + /*memset(&actuator_cfg_data, 0, sizeof(actuator_cfg_data)); + actuator_cfg_data.cfgtype = CFG_MOVE_FOCUS; + actuator_cfg_data.cfg.move = (struct msm_actuator_move_params_t){ + .dir = 0, + .sign_dir = 1, + .dest_step_pos = inf_step, + .num_steps = inf_step, + .curr_lens_pos = 0, + .ringing_params = &actuator_ringing_params, + }; + err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data); // should be ~332 at startup ? + LOG("init actuator move focus: %d", err);*/ + //actuator_cfg_data.cfg.move.curr_lens_pos; + + s->cur_lens_pos = 0; + s->cur_step_pos = inf_step; + + actuator_move(s, s->cur_lens_pos); + + LOG("init lens pos: %d", s->cur_lens_pos); +} + +void actuator_move(CameraState *s, uint16_t target) { + int err; + + int step = target - s->cur_lens_pos; + // LP3 moves only on even positions. TODO: use proper sensor params + if (s->device == DEVICE_LP3) { + step /= 2; + } + + int dest_step_pos = s->cur_step_pos + step; + dest_step_pos = clamp(dest_step_pos, 0, 255); + + struct msm_actuator_cfg_data actuator_cfg_data = {0}; + actuator_cfg_data.cfgtype = CFG_MOVE_FOCUS; + actuator_cfg_data.cfg.move = (struct msm_actuator_move_params_t){ + .dir = (step > 0) ? 0 : 1, + .sign_dir = (step > 0) ? 1 : -1, + .dest_step_pos = dest_step_pos, + .num_steps = abs(step), + .curr_lens_pos = s->cur_lens_pos, + .ringing_params = &actuator_ringing_params, + }; + err = ioctl(s->actuator_fd, VIDIOC_MSM_ACTUATOR_CFG, &actuator_cfg_data); + LOGD("actuator move focus: %d", err); + + s->cur_step_pos = dest_step_pos; + s->cur_lens_pos = actuator_cfg_data.cfg.move.curr_lens_pos; + + LOGD("step %d target: %d lens pos: %d", dest_step_pos, target, s->cur_lens_pos); +} + +static void parse_autofocus(CameraState *s, uint8_t *d) { + int good_count = 0; + int16_t max_focus = -32767; + int avg_focus = 0; + + /*printf("FOCUS: "); + for (int i = 0; i < 0x10; i++) { + printf("%2.2X ", d[i]); + }*/ + + for (int i = 0; i < NUM_FOCUS; i++) { + int doff = i*5+5; + s->confidence[i] = d[doff]; + int16_t focus_t = (d[doff+1] << 3) | (d[doff+2] >> 5); + if (focus_t >= 1024) focus_t = -(2048-focus_t); + s->focus[i] = focus_t; + //printf("%x->%d ", d[doff], focus_t); + if (s->confidence[i] > 0x20) { + good_count++; + max_focus = max(max_focus, s->focus[i]); + avg_focus += s->focus[i]; + } + } + + //printf("\n"); + if (good_count < 4) { + s->focus_err = nan(""); + return; + } + + avg_focus /= good_count; + + // outlier rejection + if (abs(avg_focus - max_focus) > 200) { + s->focus_err = nan(""); + return; + } + + s->focus_err = max_focus*1.0; +} + +static void do_autofocus(CameraState *s) { + // params for focus PI controller + const float focus_kp = 0.005; + + float err = s->focus_err; + float offset = 0; + float sag = (s->last_sag_acc_z/9.8) * 128; + + const int dac_up = s->device == DEVICE_LP3? 634:456; + const int dac_down = s->device == DEVICE_LP3? 366:224; + + if (!isnan(err)) { + // learn lens_true_pos + s->lens_true_pos -= err*focus_kp; + } + + // stay off the walls + s->lens_true_pos = clamp(s->lens_true_pos, dac_down, dac_up); + + int target = clamp(s->lens_true_pos - sag, dac_down, dac_up); + + char debug[4096]; + char *pdebug = debug; + pdebug += sprintf(pdebug, "focus "); + for (int i = 0; i < NUM_FOCUS; i++) pdebug += sprintf(pdebug, "%2x(%4d) ", s->confidence[i], s->focus[i]); + pdebug += sprintf(pdebug, " err: %7.2f offset: %6.2f sag: %6.2f lens_true_pos: %6.2f cur_lens_pos: %4d->%4d", err * focus_kp, offset, sag, s->lens_true_pos, s->cur_lens_pos, target); + LOGD(debug); + + actuator_move(s, target); +} + + +static void front_start(CameraState *s) { + int err; + + set_exposure(s, 1.0, 1.0); + + err = sensor_write_regs(s, start_reg_array, ARRAYSIZE(start_reg_array), MSM_CAMERA_I2C_BYTE_DATA); + LOG("sensor start regs: %d", err); +} + + + +void cameras_open(DualCameraState *s, VisionBuf *camera_bufs_rear, VisionBuf *camera_bufs_focus, VisionBuf *camera_bufs_stats, VisionBuf *camera_bufs_front) { + int err; + + struct ispif_cfg_data ispif_cfg_data = {0}; + + struct msm_ispif_param_data ispif_params = {0}; + ispif_params.num = 4; + // rear camera + ispif_params.entries[0].vfe_intf = 0; + ispif_params.entries[0].intftype = RDI0; + ispif_params.entries[0].num_cids = 1; + ispif_params.entries[0].cids[0] = 0; + ispif_params.entries[0].csid = 0; + // front camera + ispif_params.entries[1].vfe_intf = 1; + ispif_params.entries[1].intftype = RDI0; + ispif_params.entries[1].num_cids = 1; + ispif_params.entries[1].cids[0] = 0; + ispif_params.entries[1].csid = 2; + // rear camera (focus) + ispif_params.entries[2].vfe_intf = 0; + ispif_params.entries[2].intftype = RDI1; + ispif_params.entries[2].num_cids = 1; + ispif_params.entries[2].cids[0] = 1; + ispif_params.entries[2].csid = 0; + // rear camera (stats, for AE) + ispif_params.entries[3].vfe_intf = 0; + ispif_params.entries[3].intftype = RDI2; + ispif_params.entries[3].num_cids = 1; + ispif_params.entries[3].cids[0] = 2; + ispif_params.entries[3].csid = 0; + + assert(camera_bufs_rear); + assert(camera_bufs_front); + + int msmcfg_fd = open("/dev/media0", O_RDWR | O_NONBLOCK); + assert(msmcfg_fd >= 0); + + sensors_init(s); + + int v4l_fd = open("/dev/video0", O_RDWR | O_NONBLOCK); + assert(v4l_fd >= 0); + + if (s->device == DEVICE_LP3) { + s->ispif_fd = open("/dev/v4l-subdev15", O_RDWR | O_NONBLOCK); + } else { + s->ispif_fd = open("/dev/v4l-subdev16", O_RDWR | O_NONBLOCK); + } + assert(s->ispif_fd >= 0); + + // ISPIF: stop + // memset(&ispif_cfg_data, 0, sizeof(ispif_cfg_data)); + // ispif_cfg_data.cfg_type = ISPIF_STOP_FRAME_BOUNDARY; + // ispif_cfg_data.params = ispif_params; + // err = ioctl(s->ispif_fd, VIDIOC_MSM_ISPIF_CFG, &ispif_cfg_data); + // LOG("ispif stop: %d", err); + + LOG("*** open front ***"); + s->front.ss[0].bufs = camera_bufs_front; + camera_open(&s->front, false); + + LOG("*** open rear ***"); + s->rear.ss[0].bufs = camera_bufs_rear; + s->rear.ss[1].bufs = camera_bufs_focus; + s->rear.ss[2].bufs = camera_bufs_stats; + camera_open(&s->rear, true); + + if (getenv("CAMERA_TEST")) { + cameras_close(s); + exit(0); + } + + // ISPIF: set vfe info + memset(&ispif_cfg_data, 0, sizeof(ispif_cfg_data)); + ispif_cfg_data.cfg_type = ISPIF_SET_VFE_INFO; + ispif_cfg_data.vfe_info.num_vfe = 2; + err = ioctl(s->ispif_fd, VIDIOC_MSM_ISPIF_CFG, &ispif_cfg_data); + LOG("ispif set vfe info: %d", err); + + // ISPIF: setup + memset(&ispif_cfg_data, 0, sizeof(ispif_cfg_data)); + ispif_cfg_data.cfg_type = ISPIF_INIT; + ispif_cfg_data.csid_version = 0x30050000; //CSID_VERSION_V35 + err = ioctl(s->ispif_fd, VIDIOC_MSM_ISPIF_CFG, &ispif_cfg_data); + LOG("ispif setup: %d", err); + + memset(&ispif_cfg_data, 0, sizeof(ispif_cfg_data)); + ispif_cfg_data.cfg_type = ISPIF_CFG; + ispif_cfg_data.params = ispif_params; + + err = ioctl(s->ispif_fd, VIDIOC_MSM_ISPIF_CFG, &ispif_cfg_data); + LOG("ispif cfg: %d", err); + + ispif_cfg_data.cfg_type = ISPIF_START_FRAME_BOUNDARY; + err = ioctl(s->ispif_fd, VIDIOC_MSM_ISPIF_CFG, &ispif_cfg_data); + LOG("ispif start_frame_boundary: %d", err); + + front_start(&s->front); + rear_start(&s->rear); +} + + +static void camera_close(CameraState *s) { + int err; + + tbuffer_stop(&s->camera_tb); + + // ISP: STOP_STREAM + s->stream_cfg.cmd = STOP_STREAM; + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_CFG_STREAM, &s->stream_cfg); + LOG("isp stop stream: %d", err); + + for (int i = 0; i < 3; i++) { + StreamState *ss = &s->ss[i]; + if (ss->stream_req.axi_stream_handle != 0) { + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_RELEASE_BUF, &ss->buf_request); + LOG("isp release buf: %d", err); + + struct msm_vfe_axi_stream_release_cmd stream_release = { + .stream_handle = ss->stream_req.axi_stream_handle, + }; + err = ioctl(s->isp_fd, VIDIOC_MSM_ISP_RELEASE_STREAM, &stream_release); + LOG("isp release stream: %d", err); + } + } +} + + +const char* get_isp_event_name(unsigned int type) { + switch (type) { + case ISP_EVENT_REG_UPDATE: return "ISP_EVENT_REG_UPDATE"; + case ISP_EVENT_EPOCH_0: return "ISP_EVENT_EPOCH_0"; + case ISP_EVENT_EPOCH_1: return "ISP_EVENT_EPOCH_1"; + case ISP_EVENT_START_ACK: return "ISP_EVENT_START_ACK"; + case ISP_EVENT_STOP_ACK: return "ISP_EVENT_STOP_ACK"; + case ISP_EVENT_IRQ_VIOLATION: return "ISP_EVENT_IRQ_VIOLATION"; + case ISP_EVENT_STATS_OVERFLOW: return "ISP_EVENT_STATS_OVERFLOW"; + case ISP_EVENT_ERROR: return "ISP_EVENT_ERROR"; + case ISP_EVENT_SOF: return "ISP_EVENT_SOF"; + case ISP_EVENT_EOF: return "ISP_EVENT_EOF"; + case ISP_EVENT_BUF_DONE: return "ISP_EVENT_BUF_DONE"; + case ISP_EVENT_BUF_DIVERT: return "ISP_EVENT_BUF_DIVERT"; + case ISP_EVENT_STATS_NOTIFY: return "ISP_EVENT_STATS_NOTIFY"; + case ISP_EVENT_COMP_STATS_NOTIFY: return "ISP_EVENT_COMP_STATS_NOTIFY"; + case ISP_EVENT_FE_READ_DONE: return "ISP_EVENT_FE_READ_DONE"; + case ISP_EVENT_IOMMU_P_FAULT: return "ISP_EVENT_IOMMU_P_FAULT"; + case ISP_EVENT_HW_FATAL_ERROR: return "ISP_EVENT_HW_FATAL_ERROR"; + case ISP_EVENT_PING_PONG_MISMATCH: return "ISP_EVENT_PING_PONG_MISMATCH"; + case ISP_EVENT_REG_UPDATE_MISSING: return "ISP_EVENT_REG_UPDATE_MISSING"; + case ISP_EVENT_BUF_FATAL_ERROR: return "ISP_EVENT_BUF_FATAL_ERROR"; + case ISP_EVENT_STREAM_UPDATE_DONE: return "ISP_EVENT_STREAM_UPDATE_DONE"; + default: return "unknown"; + } +} + +static FrameMetadata get_frame_metadata(CameraState *s, uint32_t frame_id) { + pthread_mutex_lock(&s->frame_info_lock); + for (int i=0; iframe_metadata[i].frame_id == frame_id) { + pthread_mutex_unlock(&s->frame_info_lock); + return s->frame_metadata[i]; + } + } + pthread_mutex_unlock(&s->frame_info_lock); + + // should never happen + return (FrameMetadata){ + .frame_id = -1, + }; +} + +static bool acceleration_from_sensor_sock(void* sock, float* vs) { + int err; + + zmq_msg_t msg; + err = zmq_msg_init(&msg); + assert(err == 0); + + err = zmq_msg_recv(&msg, sock, 0); + assert(err >= 0); + + struct capn ctx; + capn_init_mem(&ctx, zmq_msg_data(&msg), zmq_msg_size(&msg), 0); + + cereal_Event_ptr eventp; + eventp.p = capn_getp(capn_root(&ctx), 0, 1); + struct cereal_Event eventd; + cereal_read_Event(&eventd, eventp); + + bool ret = false; + + if (eventd.which == cereal_Event_sensorEvents) { + cereal_SensorEventData_list lst = eventd.sensorEvents; + int len = capn_len(lst); + for (int i=0; i= 0); + + struct capn ctx; + capn_init_mem(&ctx, zmq_msg_data(&msg), zmq_msg_size(&msg), 0); + + cereal_Event_ptr eventp; + eventp.p = capn_getp(capn_root(&ctx), 0, 1); + struct cereal_Event eventd; + cereal_read_Event(&eventd, eventp); + + bool ret = false; + + if (eventd.which == cereal_Event_liveLocationTiming) { + struct cereal_LiveLocationData lld; + cereal_read_LiveLocationData(&lld, eventd.liveLocationTiming); + + *mono_time = lld.fixMonoTime; + *vs = lld.timeOfWeek; + ret = true; + } + + capn_free(&ctx); + zmq_msg_close(&msg); + + return ret; +} + +static void ops_term() { + zsock_t *ops_sock = zsock_new_push(">inproc://cameraops"); + assert(ops_sock); + + CameraMsg msg = {.type = -1}; + zmq_send(zsock_resolve(ops_sock), &msg, sizeof(msg), ZMQ_DONTWAIT); + + zsock_destroy(&ops_sock); +} + +static void* ops_thread(void* arg) { + int err; + DualCameraState *s = (DualCameraState*)arg; + + set_thread_name("camera_settings"); + + zsock_t *cameraops = zsock_new_pull("@inproc://cameraops"); + assert(cameraops); + + zsock_t *sensor_sock = zsock_new_sub(">tcp://127.0.0.1:8003", ""); + assert(sensor_sock); + + zsock_t *livelocationtiming_sock = zsock_new_sub(">tcp://127.0.0.1:8049", ""); + assert(livelocationtiming_sock); + + zsock_t *terminate = zsock_new_sub(">inproc://terminate", ""); + assert(terminate); + + zpoller_t *poller = zpoller_new(cameraops, sensor_sock, livelocationtiming_sock, terminate, NULL); + assert(poller); + + while (!do_exit) { + + zsock_t *which = (zsock_t*)zpoller_wait(poller, -1); + if (which == terminate || which == NULL) { + break; + } + void* sockraw = zsock_resolve(which); + + if (which == cameraops) { + zmq_msg_t msg; + err = zmq_msg_init(&msg); + assert(err == 0); + + err = zmq_msg_recv(&msg, sockraw, 0); + assert(err >= 0); + + CameraMsg cmsg; + if (zmq_msg_size(&msg) == sizeof(cmsg)) { + memcpy(&cmsg, zmq_msg_data(&msg), zmq_msg_size(&msg)); + + LOGD("cameraops %d", cmsg.type); + + if (cmsg.type == CAMERA_MSG_AUTOEXPOSE) { + if (cmsg.camera_num == 0) { + do_autoexposure(&s->rear, cmsg.grey_frac); + do_autofocus(&s->rear); + } else { + do_autoexposure(&s->front, cmsg.grey_frac); + } + } else if (cmsg.type == -1) { + break; + } + } + + zmq_msg_close(&msg); + + } else if (which == sensor_sock) { + float vs[3] = {0.0}; + bool got_accel = acceleration_from_sensor_sock(sockraw, vs); + + uint64_t ts = nanos_since_boot(); + if (got_accel && ts - s->rear.last_sag_ts > 10000000) { // 10 ms + s->rear.last_sag_ts = ts; + s->rear.last_sag_acc_z = -vs[2]; + } + } else if (which == livelocationtiming_sock) { + uint64_t mono_time; + double gps_time; + if (gps_time_from_timing_sock(sockraw, &mono_time, &gps_time)) { + s->rear.global_time_offset = (uint64_t)(gps_time*1e9) - mono_time; + //LOGW("%f %lld = %lld", gps_time, mono_time, s->rear.global_time_offset); + s->rear.phase_request = 10000000; + s->rear.using_pll = true; + } + } + } + + zpoller_destroy(&poller); + zsock_destroy(&cameraops); + zsock_destroy(&sensor_sock); + zsock_destroy(&terminate); + + return NULL; +} + +void cameras_run(DualCameraState *s) { + int err; + + pthread_t ops_thread_handle; + err = pthread_create(&ops_thread_handle, NULL, + ops_thread, s); + assert(err == 0); + + CameraState* cameras[2] = {&s->rear, &s->front}; + + while (!do_exit) { + struct pollfd fds[2] = {{0}}; + + fds[0].fd = cameras[0]->isp_fd; + fds[0].events = POLLPRI; + + fds[1].fd = cameras[1]->isp_fd; + fds[1].events = POLLPRI; + + int ret = poll(fds, ARRAYSIZE(fds), 1000); + if (ret <= 0) { + LOGE("poll failed (%d)", ret); + break; + } + + // process cameras + for (int i=0; i<2; i++) { + if (!fds[i].revents) continue; + + CameraState *c = cameras[i]; + + struct v4l2_event ev; + ret = ioctl(c->isp_fd, VIDIOC_DQEVENT, &ev); + struct msm_isp_event_data *isp_event_data = (struct msm_isp_event_data *)ev.u.data; + unsigned int event_type = ev.type; + + uint64_t timestamp = (isp_event_data->mono_timestamp.tv_sec*1000000000ULL + + isp_event_data->mono_timestamp.tv_usec*1000); + + int buf_idx = isp_event_data->u.buf_done.buf_idx; + int stream_id = isp_event_data->u.buf_done.stream_id; + int buffer = (stream_id&0xFFFF) - 1; + + uint64_t t = nanos_since_boot(); + + /*if (i == 1) { + printf("%10.2f: VIDIOC_DQEVENT: %d type:%X (%s)\n", t*1.0/1e6, ret, event_type, get_isp_event_name(event_type)); + }*/ + + // printf("%d: %s\n", i, get_isp_event_name(event_type)); + + switch (event_type) { + case ISP_EVENT_BUF_DIVERT: + + /*if (c->is_samsung) { + printf("write %d\n", c->frame_size); + FILE *f = fopen("/tmp/test", "wb"); + fwrite((void*)c->camera_bufs[i].addr, 1, c->frame_size, f); + fclose(f); + }*/ + //printf("divert: %d %d %d\n", i, buffer, buf_idx); + + if (buffer == 0) { + c->camera_bufs_metadata[buf_idx] = get_frame_metadata(c, isp_event_data->frame_id); + tbuffer_dispatch(&c->camera_tb, buf_idx); + } else { + uint8_t *d = c->ss[buffer].bufs[buf_idx].addr; + if (buffer == 1) { + parse_autofocus(c, d); + } + c->ss[buffer].qbuf_info[buf_idx].dirty_buf = 1; + ioctl(c->isp_fd, VIDIOC_MSM_ISP_ENQUEUE_BUF, &c->ss[buffer].qbuf_info[buf_idx]); + } + break; + case ISP_EVENT_EOF: + // printf("ISP_EVENT_EOF delta %f\n", (t-last_t)/1e6); + c->last_t = t; + + if (c->using_pll) { + int mod = ((int)1000000000 / c->fps); + c->phase_actual = (((timestamp + c->global_time_offset) % mod) + mod) % mod; + LOGD("phase is %12d request is %12d with offset %lld", c->phase_actual, c->phase_request, c->global_time_offset); + } + + pthread_mutex_lock(&c->frame_info_lock); + c->frame_metadata[c->frame_metadata_idx] = (FrameMetadata){ + .frame_id = isp_event_data->frame_id, + .timestamp_eof = timestamp, + .frame_length = c->cur_frame_length, + .integ_lines = c->cur_integ_lines, + .global_gain = c->cur_gain, + .lens_pos = c->cur_lens_pos, + .lens_sag = c->last_sag_acc_z, + .lens_err = c->focus_err, + .lens_true_pos = c->lens_true_pos, + }; + c->frame_metadata_idx = (c->frame_metadata_idx+1)%METADATA_BUF_COUNT; + pthread_mutex_unlock(&c->frame_info_lock); + + break; + case ISP_EVENT_ERROR: + LOGE("ISP_EVENT_ERROR! err type: 0x%08x", isp_event_data->u.error_info.err_type); + break; + } + } + } + + LOG(" ************** STOPPING **************"); + + ops_term(); + err = pthread_join(ops_thread_handle, NULL); + assert(err == 0); + + cameras_close(s); +} + +void cameras_close(DualCameraState *s) { + camera_close(&s->rear); + camera_close(&s->front); +} + diff --git a/selfdrive/visiond/camera_qcom.h b/selfdrive/visiond/camera_qcom.h new file mode 100644 index 00000000000000..0cc8f844a57477 --- /dev/null +++ b/selfdrive/visiond/camera_qcom.h @@ -0,0 +1,138 @@ +#ifndef CAMERA_H +#define CAMERA_H + +#include +#include +#include + +#include "msmb_isp.h" +#include "msmb_ispif.h" +#include "msmb_camera.h" +#include "msm_cam_sensor.h" + +#include "common/mat.h" +#include "common/visionbuf.h" +#include "common/buffering.h" + +#include "camera_common.h" + +#define FRAME_BUF_COUNT 4 +#define METADATA_BUF_COUNT 4 + +#define DEVICE_OP3 0 +#define DEVICE_OP3T 1 +#define DEVICE_LP3 2 + +#define NUM_FOCUS 8 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct CameraState CameraState; + +typedef int (*camera_apply_exposure_func)(CameraState *s, int gain, int integ_lines, int frame_length); + +typedef struct StreamState { + struct msm_isp_buf_request buf_request; + struct msm_vfe_axi_stream_request_cmd stream_req; + struct msm_isp_qbuf_info qbuf_info[FRAME_BUF_COUNT]; + VisionBuf *bufs; +} StreamState; + +typedef struct CameraState { + int camera_num; + int camera_id; + CameraInfo ci; + int frame_size; + + int device; + + void* ops_sock; + + uint32_t pixel_clock; + uint32_t line_length_pclk; + unsigned int max_gain; + + // PLL to sync cameras in time + // assumes at least 1 FPS + bool using_pll; + int phase_actual; + int phase_request; + int64_t global_time_offset; + + int csid_fd; + int csiphy_fd; + int sensor_fd; + int isp_fd; + int eeprom_fd; + // rear only + int ois_fd, actuator_fd; + uint16_t infinity_dac; + + struct msm_vfe_axi_stream_cfg_cmd stream_cfg; + + size_t eeprom_size; + uint8_t *eeprom; + + // uint32_t camera_bufs_ids[FRAME_BUF_COUNT]; + FrameMetadata camera_bufs_metadata[FRAME_BUF_COUNT]; + TBuffer camera_tb; + + pthread_mutex_t frame_info_lock; + FrameMetadata frame_metadata[METADATA_BUF_COUNT]; + int frame_metadata_idx; + float cur_exposure_frac; + float cur_gain_frac; + int cur_gain; + int cur_frame_length; + int cur_integ_lines; + + float digital_gain; + + StreamState ss[3]; + + uint64_t last_t; + + camera_apply_exposure_func apply_exposure; + + int16_t focus[NUM_FOCUS]; + uint8_t confidence[NUM_FOCUS]; + + float focus_err; + + uint16_t cur_step_pos; + uint16_t cur_lens_pos; + uint64_t last_sag_ts; + float last_sag_acc_z; + float lens_true_pos; + + int fps; + + mat3 transform; +} CameraState; + + +typedef struct DualCameraState { + int device; + + int ispif_fd; + + CameraState rear; + CameraState front; +} DualCameraState; + +void cameras_init(DualCameraState *s); +void cameras_open(DualCameraState *s, VisionBuf *camera_bufs_rear, VisionBuf *camera_bufs_focus, VisionBuf *camera_bufs_stats, VisionBuf *camera_bufs_front); +void cameras_run(DualCameraState *s); +void cameras_close(DualCameraState *s); + +void camera_autoexposure(CameraState *s, float grey_frac); +void actuator_move(CameraState *s, uint16_t target); +int sensor_write_regs(CameraState *s, struct msm_camera_i2c_reg_array* arr, size_t size, int data_type); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/selfdrive/visiond/clutil.c b/selfdrive/visiond/clutil.c new file mode 100644 index 00000000000000..0040e4dd6af6ad --- /dev/null +++ b/selfdrive/visiond/clutil.c @@ -0,0 +1,418 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __APPLE__ +#include +#else +#include +#endif + +#include "common/util.h" + +#include "clutil.h" + +typedef struct CLUProgramIndex { + uint64_t index_hash; + const uint8_t* bin_data; + const uint8_t* bin_end; +} CLUProgramIndex; + +#ifdef CLU_NO_SRC +#include "clcache_bins.h" +#else +static const CLUProgramIndex clu_index[] = {}; +#endif + +void clu_init(void) { +#ifndef CLU_NO_SRC + mkdir("/tmp/clcache", 0777); + unlink("/tmp/clcache/index.cli"); +#endif +} + +cl_program cl_create_program_from_file(cl_context ctx, const char* path) { + char* src_buf = read_file(path, NULL); + assert(src_buf); + + int err = 0; + cl_program ret = clCreateProgramWithSource(ctx, 1, (const char**)&src_buf, NULL, &err); + assert(err == 0); + + free(src_buf); + + return ret; +} + +static char* get_version_string(cl_platform_id platform) { + size_t size = 0; + int err; + err = clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL, &size); + assert(err == 0); + char *str = malloc(size); + assert(str); + err = clGetPlatformInfo(platform, CL_PLATFORM_VERSION, size, str, NULL); + assert(err == 0); + return str; +} + +void cl_print_info(cl_platform_id platform, cl_device_id device) { + char str[4096]; + + clGetPlatformInfo(platform, CL_PLATFORM_VENDOR, sizeof(str), str, NULL); + printf("vendor: '%s'\n", str); + + char* version = get_version_string(platform); + printf("platform version: '%s'\n", version); + free(version); + + clGetPlatformInfo(platform, CL_PLATFORM_PROFILE, sizeof(str), str, NULL); + printf("profile: '%s'\n", str); + + clGetPlatformInfo(platform, CL_PLATFORM_EXTENSIONS, sizeof(str), str, NULL); + printf("extensions: '%s'\n", str); + + clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(str), str, NULL); + printf("name: '%s'\n", str); + + clGetDeviceInfo(device, CL_DEVICE_VERSION, sizeof(str), str, NULL); + printf("device version: '%s'\n", str); + + size_t sz; + clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(sz), &sz, NULL); + printf("max work group size: %u\n", sz); + + cl_device_type type; + clGetDeviceInfo(device, CL_DEVICE_TYPE, sizeof(type), &type, NULL); + printf("type = 0x%04x = ", (unsigned int)type); + switch(type) { + case CL_DEVICE_TYPE_CPU: + printf("CL_DEVICE_TYPE_CPU\n"); + break; + case CL_DEVICE_TYPE_GPU: + printf("CL_DEVICE_TYPE_GPU\n"); + break; + case CL_DEVICE_TYPE_ACCELERATOR: + printf("CL_DEVICE_TYPE_ACCELERATOR\n"); + break; + default: + printf("Other...\n" ); + break; + } +} + +void cl_print_build_errors(cl_program program, cl_device_id device) { + cl_build_status status; + clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_STATUS, + sizeof(cl_build_status), &status, NULL); + + size_t log_size; + clGetProgramBuildInfo(program, device, + CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size); + + char* log = calloc(log_size+1, 1); + assert(log); + + clGetProgramBuildInfo(program, device, + CL_PROGRAM_BUILD_LOG, log_size+1, log, NULL); + + printf("build failed; status=%d, log:\n%s\n", + status, log); + + free(log); +} + +uint64_t clu_index_hash(const char* s) { + size_t sl = strlen(s); + assert(sl < 128); + uint64_t x = 0; + for (int i=127; i>=0; i--) { + x *= 65599ULL; + x += (uint8_t)s[i> 32); +} + +uint64_t clu_fnv_hash(const uint8_t *data, size_t len) { + /* 64 bit Fowler/Noll/Vo FNV-1a hash code */ + uint64_t hval = 0xcbf29ce484222325ULL; + const uint8_t *dp = data; + const uint8_t *de = data + len; + while (dp < de) { + hval ^= (uint64_t) *dp++; + hval += (hval << 1) + (hval << 4) + (hval << 5) + + (hval << 7) + (hval << 8) + (hval << 40); + } + + return hval; +} + +cl_program cl_cached_program_from_hash(cl_context ctx, cl_device_id device_id, uint64_t hash) { + int err; + + char cache_path[1024]; + snprintf(cache_path, sizeof(cache_path), "/tmp/clcache/%016" PRIx64 ".clb", hash); + + size_t bin_size; + uint8_t *bin = read_file(cache_path, &bin_size); + if (!bin) { + return NULL; + } + + cl_program prg = clCreateProgramWithBinary(ctx, 1, &device_id, &bin_size, (const uint8_t**)&bin, NULL, &err); + assert(err == 0); + + free(bin); + + err = clBuildProgram(prg, 1, &device_id, NULL, NULL, NULL); + assert(err == 0); + + return prg; +} + +static uint8_t* get_program_binary(cl_program prg, size_t *out_size) { + int err; + + cl_uint num_devices; + err = clGetProgramInfo(prg, CL_PROGRAM_NUM_DEVICES, sizeof(num_devices), &num_devices, NULL); + assert(err == 0); + assert(num_devices == 1); + + size_t binary_size = 0; + err = clGetProgramInfo(prg, CL_PROGRAM_BINARY_SIZES, sizeof(binary_size), &binary_size, NULL); + assert(err == 0); + assert(binary_size > 0); + + uint8_t *binary_buf = malloc(binary_size); + assert(binary_buf); + + uint8_t* bufs[1] = { binary_buf, }; + + err = clGetProgramInfo(prg, CL_PROGRAM_BINARIES, sizeof(bufs), &bufs, NULL); + assert(err == 0); + + *out_size = binary_size; + return binary_buf; +} + +cl_program cl_cached_program_from_string(cl_context ctx, cl_device_id device_id, + const char* src, const char* args, + uint64_t *out_hash) { + int err; + + cl_platform_id platform; + err = clGetDeviceInfo(device_id, CL_DEVICE_PLATFORM, sizeof(platform), &platform, NULL); + assert(err == 0); + + const char* platform_version = get_version_string(platform); + + const size_t hash_len = strlen(platform_version)+1+strlen(src)+1+strlen(args)+1; + char* hash_buf = malloc(hash_len); + assert(hash_buf); + memset(hash_buf, 0, hash_len); + snprintf(hash_buf, hash_len, "%s%c%s%c%s", platform_version, 1, src, 1, args); + free((void*)platform_version); + + uint64_t hash = clu_fnv_hash((uint8_t*)hash_buf, hash_len); + free(hash_buf); + + cl_program prg = NULL; +#ifndef CLU_NO_CACHE + prg = cl_cached_program_from_hash(ctx, device_id, hash); +#endif + if (prg == NULL) { + prg = clCreateProgramWithSource(ctx, 1, (const char**)&src, NULL, &err); + assert(err == 0); + + err = clBuildProgram(prg, 1, &device_id, args, NULL, NULL); + if (err != 0) { + cl_print_build_errors(prg, device_id); + } + assert(err == 0); + +#ifndef CLU_NO_CACHE + // write program binary to cache + + size_t binary_size; + uint8_t *binary_buf = get_program_binary(prg, &binary_size); + + char cache_path[1024]; + snprintf(cache_path, sizeof(cache_path), "/tmp/clcache/%016" PRIx64 ".clb", hash); + FILE* of = fopen(cache_path, "wb"); + assert(of); + fwrite(binary_buf, 1, binary_size, of); + fclose(of); + + free(binary_buf); +#endif + } + + if (out_hash) *out_hash = hash; + return prg; +} + +cl_program cl_cached_program_from_file(cl_context ctx, cl_device_id device_id, const char* path, const char* args, + uint64_t *out_hash) { + char* src_buf = read_file(path, NULL); + assert(src_buf); + cl_program ret = cl_cached_program_from_string(ctx, device_id, src_buf, args, out_hash); + free(src_buf); + return ret; +} + +static void add_index(uint64_t index_hash, uint64_t src_hash) { + FILE *f = fopen("/tmp/clcache/index.cli", "a"); + assert(f); + fprintf(f, "%016" PRIx64 " %016" PRIx64 "\n", index_hash, src_hash); + fclose(f); +} + + +cl_program cl_program_from_index(cl_context ctx, cl_device_id device_id, uint64_t index_hash) { + int err; + + int i; + for (i=0; i= ARRAYSIZE(clu_index)) { + assert(false); + } + + size_t bin_size = clu_index[i].bin_end - clu_index[i].bin_data; + const uint8_t *bin_data = clu_index[i].bin_data; + + cl_program prg = clCreateProgramWithBinary(ctx, 1, &device_id, &bin_size, (const uint8_t**)&bin_data, NULL, &err); + assert(err == 0); + + err = clBuildProgram(prg, 1, &device_id, NULL, NULL, NULL); + assert(err == 0); + + return prg; +} + +cl_program cl_index_program_from_string(cl_context ctx, cl_device_id device_id, + const char* src, const char* args, + uint64_t index_hash) { + uint64_t src_hash = 0; + cl_program ret = cl_cached_program_from_string(ctx, device_id, src, args, &src_hash); +#ifndef CLU_NO_CACHE + add_index(index_hash, src_hash); +#endif + return ret; +} + +cl_program cl_index_program_from_file(cl_context ctx, cl_device_id device_id, const char* path, const char* args, + uint64_t index_hash) { + uint64_t src_hash = 0; + cl_program ret = cl_cached_program_from_file(ctx, device_id, path, args, &src_hash); +#ifndef CLU_NO_CACHE + add_index(index_hash, src_hash); +#endif + return ret; +} + +/* + * Given a cl code and return a string represenation + */ +const char* cl_get_error_string(int err) { + switch (err) { + case 0: return "CL_SUCCESS"; + case -1: return "CL_DEVICE_NOT_FOUND"; + case -2: return "CL_DEVICE_NOT_AVAILABLE"; + case -3: return "CL_COMPILER_NOT_AVAILABLE"; + case -4: return "CL_MEM_OBJECT_ALLOCATION_FAILURE"; + case -5: return "CL_OUT_OF_RESOURCES"; + case -6: return "CL_OUT_OF_HOST_MEMORY"; + case -7: return "CL_PROFILING_INFO_NOT_AVAILABLE"; + case -8: return "CL_MEM_COPY_OVERLAP"; + case -9: return "CL_IMAGE_FORMAT_MISMATCH"; + case -10: return "CL_IMAGE_FORMAT_NOT_SUPPORTED"; + case -12: return "CL_MAP_FAILURE"; + case -13: return "CL_MISALIGNED_SUB_BUFFER_OFFSET"; + case -14: return "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST"; + case -15: return "CL_COMPILE_PROGRAM_FAILURE"; + case -16: return "CL_LINKER_NOT_AVAILABLE"; + case -17: return "CL_LINK_PROGRAM_FAILURE"; + case -18: return "CL_DEVICE_PARTITION_FAILED"; + case -19: return "CL_KERNEL_ARG_INFO_NOT_AVAILABLE"; + case -30: return "CL_INVALID_VALUE"; + case -31: return "CL_INVALID_DEVICE_TYPE"; + case -32: return "CL_INVALID_PLATFORM"; + case -33: return "CL_INVALID_DEVICE"; + case -34: return "CL_INVALID_CONTEXT"; + case -35: return "CL_INVALID_QUEUE_PROPERTIES"; + case -36: return "CL_INVALID_COMMAND_QUEUE"; + case -37: return "CL_INVALID_HOST_PTR"; + case -38: return "CL_INVALID_MEM_OBJECT"; + case -39: return "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR"; + case -40: return "CL_INVALID_IMAGE_SIZE"; + case -41: return "CL_INVALID_SAMPLER"; + case -42: return "CL_INVALID_BINARY"; + case -43: return "CL_INVALID_BUILD_OPTIONS"; + case -44: return "CL_INVALID_PROGRAM"; + case -45: return "CL_INVALID_PROGRAM_EXECUTABLE"; + case -46: return "CL_INVALID_KERNEL_NAME"; + case -47: return "CL_INVALID_KERNEL_DEFINITION"; + case -48: return "CL_INVALID_KERNEL"; + case -49: return "CL_INVALID_ARG_INDEX"; + case -50: return "CL_INVALID_ARG_VALUE"; + case -51: return "CL_INVALID_ARG_SIZE"; + case -52: return "CL_INVALID_KERNEL_ARGS"; + case -53: return "CL_INVALID_WORK_DIMENSION"; + case -54: return "CL_INVALID_WORK_GROUP_SIZE"; + case -55: return "CL_INVALID_WORK_ITEM_SIZE"; + case -56: return "CL_INVALID_GLOBAL_OFFSET"; + case -57: return "CL_INVALID_EVENT_WAIT_LIST"; + case -58: return "CL_INVALID_EVENT"; + case -59: return "CL_INVALID_OPERATION"; + case -60: return "CL_INVALID_GL_OBJECT"; + case -61: return "CL_INVALID_BUFFER_SIZE"; + case -62: return "CL_INVALID_MIP_LEVEL"; + case -63: return "CL_INVALID_GLOBAL_WORK_SIZE"; + case -64: return "CL_INVALID_PROPERTY"; + case -65: return "CL_INVALID_IMAGE_DESCRIPTOR"; + case -66: return "CL_INVALID_COMPILER_OPTIONS"; + case -67: return "CL_INVALID_LINKER_OPTIONS"; + case -68: return "CL_INVALID_DEVICE_PARTITION_COUNT"; + case -69: return "CL_INVALID_PIPE_SIZE"; + case -70: return "CL_INVALID_DEVICE_QUEUE"; + case -71: return "CL_INVALID_SPEC_ID"; + case -72: return "CL_MAX_SIZE_RESTRICTION_EXCEEDED"; + case -1002: return "CL_INVALID_D3D10_DEVICE_KHR"; + case -1003: return "CL_INVALID_D3D10_RESOURCE_KHR"; + case -1004: return "CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR"; + case -1005: return "CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR"; + case -1006: return "CL_INVALID_D3D11_DEVICE_KHR"; + case -1007: return "CL_INVALID_D3D11_RESOURCE_KHR"; + case -1008: return "CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR"; + case -1009: return "CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR"; + case -1010: return "CL_INVALID_DX9_MEDIA_ADAPTER_KHR"; + case -1011: return "CL_INVALID_DX9_MEDIA_SURFACE_KHR"; + case -1012: return "CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR"; + case -1013: return "CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR"; + case -1093: return "CL_INVALID_EGL_OBJECT_KHR"; + case -1092: return "CL_EGL_RESOURCE_NOT_ACQUIRED_KHR"; + case -1001: return "CL_PLATFORM_NOT_FOUND_KHR"; + case -1057: return "CL_DEVICE_PARTITION_FAILED_EXT"; + case -1058: return "CL_INVALID_PARTITION_COUNT_EXT"; + case -1059: return "CL_INVALID_PARTITION_NAME_EXT"; + case -1094: return "CL_INVALID_ACCELERATOR_INTEL"; + case -1095: return "CL_INVALID_ACCELERATOR_TYPE_INTEL"; + case -1096: return "CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL"; + case -1097: return "CL_ACCELERATOR_TYPE_NOT_SUPPORTED_INTEL"; + case -1000: return "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR"; + case -1098: return "CL_INVALID_VA_API_MEDIA_ADAPTER_INTEL"; + case -1099: return "CL_INVALID_VA_API_MEDIA_SURFACE_INTEL"; + case -1100: return "CL_VA_API_MEDIA_SURFACE_ALREADY_ACQUIRED_INTEL"; + case -1101: return "CL_VA_API_MEDIA_SURFACE_NOT_ACQUIRED_INTEL"; + default: return "CL_UNKNOWN_ERROR"; + } +} diff --git a/selfdrive/visiond/clutil.h b/selfdrive/visiond/clutil.h new file mode 100644 index 00000000000000..b87961eacdfbf8 --- /dev/null +++ b/selfdrive/visiond/clutil.h @@ -0,0 +1,87 @@ +#ifndef CLUTIL_H +#define CLUTIL_H + +#include +#include +#include + +#ifdef __APPLE__ +#include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +void clu_init(void); + +cl_program cl_create_program_from_file(cl_context ctx, const char* path); +void cl_print_info(cl_platform_id platform, cl_device_id device); +void cl_print_build_errors(cl_program program, cl_device_id device); +void cl_print_build_errors(cl_program program, cl_device_id device); + +cl_program cl_cached_program_from_hash(cl_context ctx, cl_device_id device_id, uint64_t hash); +cl_program cl_cached_program_from_string(cl_context ctx, cl_device_id device_id, + const char* src, const char* args, + uint64_t *out_hash); +cl_program cl_cached_program_from_file(cl_context ctx, cl_device_id device_id, const char* path, const char* args, + uint64_t *out_hash); + +cl_program cl_program_from_index(cl_context ctx, cl_device_id device_id, uint64_t index_hash); + +cl_program cl_index_program_from_string(cl_context ctx, cl_device_id device_id, + const char* src, const char* args, + uint64_t index_hash); +cl_program cl_index_program_from_file(cl_context ctx, cl_device_id device_id, const char* path, const char* args, + uint64_t index_hash); + +uint64_t clu_index_hash(const char *s); +uint64_t clu_fnv_hash(const uint8_t *data, size_t len); + +const char* cl_get_error_string(int err); + +static inline int cl_check_error(int err) { + if (err != 0) { + fprintf(stderr, "%s\n", cl_get_error_string(err)); + exit(1); + } + return err; +} + + +// // string hash macro. compiler, I'm so sorry. +#define CLU_H1(s,i,x) (x*65599ULL+(uint8_t)s[(i)>32))) + +#define CLU_STRINGIFY(x) #x +#define CLU_STRINGIFY2(x) CLU_STRINGIFY(x) +#define CLU_LINESTR CLU_STRINGIFY2(__LINE__) + +#ifdef CLU_NO_SRC + + #define CLU_LOAD_FROM_STRING(ctx, device_id, src, args) \ + cl_program_from_index(ctx, device_id, CLU_HASH("\1" __FILE__ "\1" CLU_LINESTR) ^ clu_fnv_hash((const uint8_t*)__func__, strlen(__func__)) ^ clu_fnv_hash((const uint8_t*)args, strlen(args))) + #define CLU_LOAD_FROM_FILE(ctx, device_id, path, args) \ + cl_program_from_index(ctx, device_id, CLU_HASH("\2" path) ^ clu_fnv_hash((const uint8_t*)args, strlen(args))) + +#else + + #define CLU_LOAD_FROM_STRING(ctx, device_id, src, args) \ + cl_index_program_from_string(ctx, device_id, src, args, clu_index_hash("\1" __FILE__ "\1" CLU_LINESTR) ^ clu_fnv_hash((const uint8_t*)__func__, strlen(__func__)) ^ clu_fnv_hash((const uint8_t*)args, strlen(args))) + #define CLU_LOAD_FROM_FILE(ctx, device_id, path, args) \ + cl_index_program_from_file(ctx, device_id, path, args, clu_index_hash("\2" path) ^ clu_fnv_hash((const uint8_t*)args, strlen(args))) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/selfdrive/visiond/commonmodel.c b/selfdrive/visiond/commonmodel.c new file mode 100644 index 00000000000000..595d2609e74d4e --- /dev/null +++ b/selfdrive/visiond/commonmodel.c @@ -0,0 +1,155 @@ +#include "commonmodel.h" + +#include +#include "cereal/gen/c/log.capnp.h" +#include "common/mat.h" +#include "common/timing.h" + +void model_input_init(ModelInput* s, int width, int height, + cl_device_id device_id, cl_context context) { + int err; + s->device_id = device_id; + s->context = context; + + transform_init(&s->transform, context, device_id); + s->transformed_width = width; + s->transformed_height = height; + + s->transformed_y_cl = clCreateBuffer(s->context, CL_MEM_READ_WRITE, + s->transformed_width*s->transformed_height, NULL, &err); + assert(err == 0); + s->transformed_u_cl = clCreateBuffer(s->context, CL_MEM_READ_WRITE, + (s->transformed_width/2)*(s->transformed_height/2), NULL, &err); + assert(err == 0); + s->transformed_v_cl = clCreateBuffer(s->context, CL_MEM_READ_WRITE, + (s->transformed_width/2)*(s->transformed_height/2), NULL, &err); + assert(err == 0); + + s->net_input_size = ((width*height*3)/2)*sizeof(float); + s->net_input = clCreateBuffer(s->context, CL_MEM_READ_WRITE, + s->net_input_size, (void*)NULL, &err); + assert(err == 0); + + loadyuv_init(&s->loadyuv, context, device_id, s->transformed_width, s->transformed_height); +} + +float *model_input_prepare(ModelInput* s, cl_command_queue q, + cl_mem yuv_cl, int width, int height, + mat3 transform) { + int err; + int i = 0; + transform_queue(&s->transform, q, + yuv_cl, width, height, + s->transformed_y_cl, s->transformed_u_cl, s->transformed_v_cl, + s->transformed_width, s->transformed_height, + transform); + loadyuv_queue(&s->loadyuv, q, + s->transformed_y_cl, s->transformed_u_cl, s->transformed_v_cl, + s->net_input); + float *net_input_buf = (float *)clEnqueueMapBuffer(q, s->net_input, CL_TRUE, + CL_MAP_READ, 0, s->net_input_size, + 0, NULL, NULL, &err); + clFinish(q); + return net_input_buf; +} + +void model_input_free(ModelInput* s) { + transform_destroy(&s->transform); + loadyuv_destroy(&s->loadyuv); +} + + +void softmax(const float* input, float* output, size_t len) { + float max_val = -FLT_MAX; + for(int i = 0; i < len; i++) { + const float v = input[i]; + if( v > max_val ) { + max_val = v; + } + } + + float denominator = 0; + for(int i = 0; i < len; i++) { + float const v = input[i]; + float const v_exp = expf(v - max_val); + denominator += v_exp; + output[i] = v_exp; + } + + const float inv_denominator = 1. / denominator; + for(int i = 0; i < len; i++) { + output[i] *= inv_denominator; + } + +} + + +static cereal_ModelData_PathData_ptr path_to_cereal(struct capn_segment *cs, const PathData data) { + capn_list32 points_ptr = capn_new_list32(cs, MODEL_PATH_DISTANCE); + for (int i=0; i + +#include "common/mat.h" +#include "common/modeldata.h" +#include "transform.h" +#include "loadyuv.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void softmax(const float* input, float* output, size_t len); + +typedef struct ModelInput { + cl_device_id device_id; + cl_context context; + + // input + Transform transform; + int transformed_width, transformed_height; + cl_mem transformed_y_cl, transformed_u_cl, transformed_v_cl; + LoadYUVState loadyuv; + cl_mem net_input; + size_t net_input_size; +} ModelInput; + +void model_input_init(ModelInput* s, int width, int height, + cl_device_id device_id, cl_context context); +float *model_input_prepare(ModelInput* s, cl_command_queue q, + cl_mem yuv_cl, int width, int height, + mat3 transform); +void model_input_free(ModelInput* s); + +void model_publish(void* sock, uint32_t frame_id, + const mat3 transform, const ModelData data); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/selfdrive/visiond/constants.py b/selfdrive/visiond/constants.py new file mode 100644 index 00000000000000..878478e9cf1531 --- /dev/null +++ b/selfdrive/visiond/constants.py @@ -0,0 +1,2 @@ +MAX_DISTANCE = 140. +LANE_OFFSET = 1.8 diff --git a/selfdrive/visiond/debayer.cl b/selfdrive/visiond/debayer.cl new file mode 100644 index 00000000000000..344ead035672ec --- /dev/null +++ b/selfdrive/visiond/debayer.cl @@ -0,0 +1,130 @@ +const __constant float3 color_correction[3] = { + // Matrix from WBraw -> sRGBD65 (normalized) + (float3)( 1.62393627, -0.2092988, 0.00119886), + (float3)(-0.45734315, 1.5534676, -0.59296798), + (float3)(-0.16659312, -0.3441688, 1.59176912), +}; + +float3 color_correct(float3 x) { + float3 ret = (0,0,0); + + // white balance of daylight + x /= (float3)(0.4609375, 1.0, 0.546875); + x = max(0.0, min(1.0, x)); + + // fix up the colors + ret += x.x * color_correction[0]; + ret += x.y * color_correction[1]; + ret += x.z * color_correction[2]; + return ret; +} + +float3 srgb_gamma(float3 p) { + // go all out and add an sRGB gamma curve + const float3 ph = (1.0f + 0.055f)*pow(p, 1/2.4f) - 0.055f; + const float3 pl = p*12.92f; + return select(ph, pl, islessequal(p, 0.0031308f)); +} + +__constant int dpcm_lookup[512] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, -30, -31, 935, 951, 967, 983, 999, 1015, 1031, 1047, 1063, 1079, 1095, 1111, 1127, 1143, 1159, 1175, 1191, 1207, 1223, 1239, 1255, 1271, 1287, 1303, 1319, 1335, 1351, 1367, 1383, 1399, 1415, 1431, -935, -951, -967, -983, -999, -1015, -1031, -1047, -1063, -1079, -1095, -1111, -1127, -1143, -1159, -1175, -1191, -1207, -1223, -1239, -1255, -1271, -1287, -1303, -1319, -1335, -1351, -1367, -1383, -1399, -1415, -1431, 419, 427, 435, 443, 451, 459, 467, 475, 483, 491, 499, 507, 515, 523, 531, 539, 547, 555, 563, 571, 579, 587, 595, 603, 611, 619, 627, 635, 643, 651, 659, 667, 675, 683, 691, 699, 707, 715, 723, 731, 739, 747, 755, 763, 771, 779, 787, 795, 803, 811, 819, 827, 835, 843, 851, 859, 867, 875, 883, 891, 899, 907, 915, 923, -419, -427, -435, -443, -451, -459, -467, -475, -483, -491, -499, -507, -515, -523, -531, -539, -547, -555, -563, -571, -579, -587, -595, -603, -611, -619, -627, -635, -643, -651, -659, -667, -675, -683, -691, -699, -707, -715, -723, -731, -739, -747, -755, -763, -771, -779, -787, -795, -803, -811, -819, -827, -835, -843, -851, -859, -867, -875, -883, -891, -899, -907, -915, -923, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 237, 241, 245, 249, 253, 257, 261, 265, 269, 273, 277, 281, 285, 289, 293, 297, 301, 305, 309, 313, 317, 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, 361, 365, 369, 373, 377, 381, 385, 389, 393, 397, 401, 405, 409, 413, -161, -165, -169, -173, -177, -181, -185, -189, -193, -197, -201, -205, -209, -213, -217, -221, -225, -229, -233, -237, -241, -245, -249, -253, -257, -261, -265, -269, -273, -277, -281, -285, -289, -293, -297, -301, -305, -309, -313, -317, -321, -325, -329, -333, -337, -341, -345, -349, -353, -357, -361, -365, -369, -373, -377, -381, -385, -389, -393, -397, -401, -405, -409, -413, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, -32, -34, -36, -38, -40, -42, -44, -46, -48, -50, -52, -54, -56, -58, -60, -62, -64, -66, -68, -70, -72, -74, -76, -78, -80, -82, -84, -86, -88, -90, -92, -94, -96, -98, -100, -102, -104, -106, -108, -110, -112, -114, -116, -118, -120, -122, -124, -126, -128, -130, -132, -134, -136, -138, -140, -142, -144, -146, -148, -150, -152, -154, -156, -158}; + +inline uint4 decompress(uint4 p, uint4 pl) { + uint4 r1 = (pl + (uint4)(dpcm_lookup[p.s0], dpcm_lookup[p.s1], dpcm_lookup[p.s2], dpcm_lookup[p.s3])); + uint4 r2 = ((p-0x200)<<5) | 0xF; + r2 += select((uint4)(0,0,0,0), (uint4)(1,1,1,1), r2 <= pl); + return select(r2, r1, p < 0x200); +} + +__kernel void debayer10(__global uchar const * const in, + __global uchar * out, float digital_gain) +{ + const int oy = get_global_id(0); + if (oy >= RGB_HEIGHT) return; + const int iy = oy * 2; + + uint4 pint_last; + for (int ox = 0; ox < RGB_WIDTH; ox += 2) { + const int ix = (ox/2) * 5; + + // TODO: why doesn't this work for the frontview + /*const uchar8 v1 = vload8(0, &in[iy * FRAME_STRIDE + ix]); + const uchar ex1 = v1.s4; + const uchar8 v2 = vload8(0, &in[(iy+1) * FRAME_STRIDE + ix]); + const uchar ex2 = v2.s4;*/ + + const uchar4 v1 = vload4(0, &in[iy * FRAME_STRIDE + ix]); + const uchar ex1 = in[iy * FRAME_STRIDE + ix + 4]; + const uchar4 v2 = vload4(0, &in[(iy+1) * FRAME_STRIDE + ix]); + const uchar ex2 = in[(iy+1) * FRAME_STRIDE + ix + 4]; + + uint4 pinta[2]; + pinta[0] = (uint4)( + (((uint)v1.s0 << 2) + ( (ex1 >> 0) & 3)), + (((uint)v1.s1 << 2) + ( (ex1 >> 2) & 3)), + (((uint)v2.s0 << 2) + ( (ex2 >> 0) & 3)), + (((uint)v2.s1 << 2) + ( (ex2 >> 2) & 3))); + pinta[1] = (uint4)( + (((uint)v1.s2 << 2) + ( (ex1 >> 4) & 3)), + (((uint)v1.s3 << 2) + ( (ex1 >> 6) & 3)), + (((uint)v2.s2 << 2) + ( (ex2 >> 4) & 3)), + (((uint)v2.s3 << 2) + ( (ex2 >> 6) & 3))); + + #pragma unroll + for (uint px = 0; px < 2; px++) { + uint4 pint = pinta[px]; + +#if HDR + // decompress HDR + pint = (ox == 0 && px == 0) ? ((pint<<4) | 8) : decompress(pint, pint_last); + pint_last = pint; +#endif + + float4 p = convert_float4(pint); + + // 64 is the black level of the sensor, remove + // (changed to 56 for HDR) + const float black_level = 56.0f; + p = (p - black_level); + + // correct vignetting (no pow function?) + // see https://www.eecis.udel.edu/~jye/lab_research/09/JiUp.pdf the A (4th order) + const float r = ((oy - RGB_HEIGHT/2)*(oy - RGB_HEIGHT/2) + (ox - RGB_WIDTH/2)*(ox - RGB_WIDTH/2)); + const float fake_f = 700.0f; // should be 910, but this fits... + const float lil_a = (1.0f + r/(fake_f*fake_f)); + p = p * lil_a * lil_a; + + // rescale to 1.0 +#if HDR + p /= (16384.0f-black_level); +#else + p /= (1024.0f-black_level); +#endif + + // digital gain + p *= digital_gain; + + // use both green channels +#if BAYER_FLIP == 3 + float3 c1 = (float3)(p.s3, (p.s1+p.s2)/2.0f, p.s0); +#elif BAYER_FLIP == 2 + float3 c1 = (float3)(p.s2, (p.s0+p.s3)/2.0f, p.s1); +#elif BAYER_FLIP == 1 + float3 c1 = (float3)(p.s1, (p.s0+p.s3)/2.0f, p.s2); +#elif BAYER_FLIP == 0 + float3 c1 = (float3)(p.s0, (p.s1+p.s2)/2.0f, p.s3); +#endif + + // color correction + c1 = color_correct(c1); + +#if HDR + // srgb gamma isn't right for YUV, so it's disabled for now + c1 = srgb_gamma(c1); +#endif + + // output BGR + const int ooff = oy * RGB_STRIDE/3 + ox; + vstore3(convert_uchar3_sat(c1.zyx * 255.0f), ooff+px, out); + } + } +} diff --git a/selfdrive/visiond/include/msm_cam_sensor.h b/selfdrive/visiond/include/msm_cam_sensor.h new file mode 100644 index 00000000000000..c75d1fd5272444 --- /dev/null +++ b/selfdrive/visiond/include/msm_cam_sensor.h @@ -0,0 +1,829 @@ +#ifndef __LINUX_MSM_CAM_SENSOR_H +#define __LINUX_MSM_CAM_SENSOR_H + +#ifdef MSM_CAMERA_BIONIC +#include +#endif + +//#include +#include "msm_camsensor_sdk.h" + +#include +#include +#ifdef CONFIG_COMPAT +#include +#endif + +#define I2C_SEQ_REG_SETTING_MAX 5 + +#define MSM_SENSOR_MCLK_8HZ 8000000 +#define MSM_SENSOR_MCLK_16HZ 16000000 +#define MSM_SENSOR_MCLK_24HZ 24000000 + +#define MAX_SENSOR_NAME 32 +#define MAX_ACTUATOR_AF_TOTAL_STEPS 1024 + +#define MAX_OIS_MOD_NAME_SIZE 32 +#define MAX_OIS_NAME_SIZE 32 +#define MAX_OIS_REG_SETTINGS 800 + +#define MOVE_NEAR 0 +#define MOVE_FAR 1 + +#define MSM_ACTUATOR_MOVE_SIGNED_FAR -1 +#define MSM_ACTUATOR_MOVE_SIGNED_NEAR 1 + +#define MAX_ACTUATOR_REGION 5 + +#define MAX_EEPROM_NAME 32 + +#define MAX_AF_ITERATIONS 3 +#define MAX_NUMBER_OF_STEPS 47 +#define MAX_REGULATOR 5 + +#define MSM_V4L2_PIX_FMT_META v4l2_fourcc('M', 'E', 'T', 'A') /* META */ +#define MSM_V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4') + /* 14 BGBG.. GRGR.. */ +#define MSM_V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4') + /* 14 GBGB.. RGRG.. */ +#define MSM_V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('B', 'A', '1', '4') + /* 14 GRGR.. BGBG.. */ +#define MSM_V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4') + /* 14 RGRG.. GBGB.. */ + +enum flash_type { + LED_FLASH = 1, + STROBE_FLASH, + GPIO_FLASH +}; + +enum msm_sensor_resolution_t { + MSM_SENSOR_RES_FULL, + MSM_SENSOR_RES_QTR, + MSM_SENSOR_RES_2, + MSM_SENSOR_RES_3, + MSM_SENSOR_RES_4, + MSM_SENSOR_RES_5, + MSM_SENSOR_RES_6, + MSM_SENSOR_RES_7, + MSM_SENSOR_INVALID_RES, +}; + +enum msm_camera_stream_type_t { + MSM_CAMERA_STREAM_PREVIEW, + MSM_CAMERA_STREAM_SNAPSHOT, + MSM_CAMERA_STREAM_VIDEO, + MSM_CAMERA_STREAM_INVALID, +}; + +enum sensor_sub_module_t { + SUB_MODULE_SENSOR, + SUB_MODULE_CHROMATIX, + SUB_MODULE_ACTUATOR, + SUB_MODULE_EEPROM, + SUB_MODULE_LED_FLASH, + SUB_MODULE_STROBE_FLASH, + SUB_MODULE_CSID, + SUB_MODULE_CSID_3D, + SUB_MODULE_CSIPHY, + SUB_MODULE_CSIPHY_3D, + SUB_MODULE_OIS, + SUB_MODULE_EXT, + SUB_MODULE_MAX, +}; + +enum { + MSM_CAMERA_EFFECT_MODE_OFF, + MSM_CAMERA_EFFECT_MODE_MONO, + MSM_CAMERA_EFFECT_MODE_NEGATIVE, + MSM_CAMERA_EFFECT_MODE_SOLARIZE, + MSM_CAMERA_EFFECT_MODE_SEPIA, + MSM_CAMERA_EFFECT_MODE_POSTERIZE, + MSM_CAMERA_EFFECT_MODE_WHITEBOARD, + MSM_CAMERA_EFFECT_MODE_BLACKBOARD, + MSM_CAMERA_EFFECT_MODE_AQUA, + MSM_CAMERA_EFFECT_MODE_EMBOSS, + MSM_CAMERA_EFFECT_MODE_SKETCH, + MSM_CAMERA_EFFECT_MODE_NEON, + MSM_CAMERA_EFFECT_MODE_MAX +}; + +enum { + MSM_CAMERA_WB_MODE_AUTO, + MSM_CAMERA_WB_MODE_CUSTOM, + MSM_CAMERA_WB_MODE_INCANDESCENT, + MSM_CAMERA_WB_MODE_FLUORESCENT, + MSM_CAMERA_WB_MODE_WARM_FLUORESCENT, + MSM_CAMERA_WB_MODE_DAYLIGHT, + MSM_CAMERA_WB_MODE_CLOUDY_DAYLIGHT, + MSM_CAMERA_WB_MODE_TWILIGHT, + MSM_CAMERA_WB_MODE_SHADE, + MSM_CAMERA_WB_MODE_OFF, + MSM_CAMERA_WB_MODE_MAX +}; + +enum { + MSM_CAMERA_SCENE_MODE_OFF, + MSM_CAMERA_SCENE_MODE_AUTO, + MSM_CAMERA_SCENE_MODE_LANDSCAPE, + MSM_CAMERA_SCENE_MODE_SNOW, + MSM_CAMERA_SCENE_MODE_BEACH, + MSM_CAMERA_SCENE_MODE_SUNSET, + MSM_CAMERA_SCENE_MODE_NIGHT, + MSM_CAMERA_SCENE_MODE_PORTRAIT, + MSM_CAMERA_SCENE_MODE_BACKLIGHT, + MSM_CAMERA_SCENE_MODE_SPORTS, + MSM_CAMERA_SCENE_MODE_ANTISHAKE, + MSM_CAMERA_SCENE_MODE_FLOWERS, + MSM_CAMERA_SCENE_MODE_CANDLELIGHT, + MSM_CAMERA_SCENE_MODE_FIREWORKS, + MSM_CAMERA_SCENE_MODE_PARTY, + MSM_CAMERA_SCENE_MODE_NIGHT_PORTRAIT, + MSM_CAMERA_SCENE_MODE_THEATRE, + MSM_CAMERA_SCENE_MODE_ACTION, + MSM_CAMERA_SCENE_MODE_AR, + MSM_CAMERA_SCENE_MODE_FACE_PRIORITY, + MSM_CAMERA_SCENE_MODE_BARCODE, + MSM_CAMERA_SCENE_MODE_HDR, + MSM_CAMERA_SCENE_MODE_MAX +}; + +enum csid_cfg_type_t { + CSID_INIT, + CSID_CFG, + CSID_TESTMODE_CFG, + CSID_RELEASE, +}; + +enum csiphy_cfg_type_t { + CSIPHY_INIT, + CSIPHY_CFG, + CSIPHY_RELEASE, +}; + +enum camera_vreg_type { + VREG_TYPE_DEFAULT, + VREG_TYPE_CUSTOM, +}; + +enum sensor_af_t { + SENSOR_AF_FOCUSSED, + SENSOR_AF_NOT_FOCUSSED, +}; + +enum cci_i2c_master_t { + MASTER_0, + MASTER_1, + MASTER_MAX, +}; + +struct msm_camera_i2c_array_write_config { + struct msm_camera_i2c_reg_setting conf_array; + uint16_t slave_addr; +}; + +struct msm_camera_i2c_read_config { + uint16_t slave_addr; + uint16_t reg_addr; + enum msm_camera_i2c_reg_addr_type addr_type; + enum msm_camera_i2c_data_type data_type; + uint16_t data; +}; + +struct msm_camera_csi2_params { + struct msm_camera_csid_params csid_params; + struct msm_camera_csiphy_params csiphy_params; + uint8_t csi_clk_scale_enable; +}; + +struct msm_camera_csi_lane_params { + uint16_t csi_lane_assign; + uint16_t csi_lane_mask; +}; + +struct csi_lane_params_t { + uint16_t csi_lane_assign; + uint8_t csi_lane_mask; + uint8_t csi_if; + int8_t csid_core[2]; + uint8_t csi_phy_sel; +}; + +struct msm_sensor_info_t { + char sensor_name[MAX_SENSOR_NAME]; + uint32_t session_id; + int32_t subdev_id[SUB_MODULE_MAX]; + int32_t subdev_intf[SUB_MODULE_MAX]; + uint8_t is_mount_angle_valid; + uint32_t sensor_mount_angle; + int modes_supported; + enum camb_position_t position; +}; + +struct camera_vreg_t { + const char *reg_name; + int min_voltage; + int max_voltage; + int op_mode; + uint32_t delay; + const char *custom_vreg_name; + enum camera_vreg_type type; +}; + +struct sensorb_cfg_data { + int cfgtype; + union { + struct msm_sensor_info_t sensor_info; + struct msm_sensor_init_params sensor_init_params; + void *setting; + struct msm_sensor_i2c_sync_params sensor_i2c_sync_params; + } cfg; +}; + +struct csid_cfg_data { + enum csid_cfg_type_t cfgtype; + union { + uint32_t csid_version; + struct msm_camera_csid_params *csid_params; + struct msm_camera_csid_testmode_parms *csid_testmode_params; + } cfg; +}; + +struct csiphy_cfg_data { + enum csiphy_cfg_type_t cfgtype; + union { + struct msm_camera_csiphy_params *csiphy_params; + struct msm_camera_csi_lane_params *csi_lane_params; + } cfg; +}; + +enum eeprom_cfg_type_t { + CFG_EEPROM_GET_INFO, + CFG_EEPROM_GET_CAL_DATA, + CFG_EEPROM_READ_CAL_DATA, + CFG_EEPROM_WRITE_DATA, + CFG_EEPROM_GET_MM_INFO, + CFG_EEPROM_INIT, +}; + +struct eeprom_get_t { + uint32_t num_bytes; +}; + +struct eeprom_read_t { + uint8_t *dbuffer; + uint32_t num_bytes; +}; + +struct eeprom_write_t { + uint8_t *dbuffer; + uint32_t num_bytes; +}; + +struct eeprom_get_cmm_t { + uint32_t cmm_support; + uint32_t cmm_compression; + uint32_t cmm_size; +}; + +struct msm_eeprom_info_t { + struct msm_sensor_power_setting_array *power_setting_array; + enum i2c_freq_mode_t i2c_freq_mode; + struct msm_eeprom_memory_map_array *mem_map_array; +}; + +struct msm_eeprom_cfg_data { + enum eeprom_cfg_type_t cfgtype; + uint8_t is_supported; + union { + char eeprom_name[MAX_SENSOR_NAME]; + struct eeprom_get_t get_data; + struct eeprom_read_t read_data; + struct eeprom_write_t write_data; + struct eeprom_get_cmm_t get_cmm_data; + struct msm_eeprom_info_t eeprom_info; + } cfg; +}; + +#ifdef CONFIG_COMPAT +struct msm_sensor_power_setting32 { + enum msm_sensor_power_seq_type_t seq_type; + uint16_t seq_val; + compat_uint_t config_val; + uint16_t delay; + compat_uptr_t data[10]; +}; + +struct msm_sensor_power_setting_array32 { + struct msm_sensor_power_setting32 power_setting_a[MAX_POWER_CONFIG]; + compat_uptr_t power_setting; + uint16_t size; + struct msm_sensor_power_setting32 + power_down_setting_a[MAX_POWER_CONFIG]; + compat_uptr_t power_down_setting; + uint16_t size_down; +}; + +struct msm_camera_sensor_slave_info32 { + char sensor_name[32]; + char eeprom_name[32]; + char actuator_name[32]; + char ois_name[32]; + char flash_name[32]; + enum msm_sensor_camera_id_t camera_id; + uint16_t slave_addr; + enum i2c_freq_mode_t i2c_freq_mode; + enum msm_camera_i2c_reg_addr_type addr_type; + struct msm_sensor_id_info_t sensor_id_info; + struct msm_sensor_power_setting_array32 power_setting_array; + uint8_t is_init_params_valid; + struct msm_sensor_init_params sensor_init_params; + enum msm_sensor_output_format_t output_format; +}; + +struct msm_camera_csid_lut_params32 { + uint8_t num_cid; + struct msm_camera_csid_vc_cfg vc_cfg_a[MAX_CID]; + compat_uptr_t vc_cfg[MAX_CID]; +}; + +struct msm_camera_csid_params32 { + uint8_t lane_cnt; + uint16_t lane_assign; + uint8_t phy_sel; + uint32_t csi_clk; + struct msm_camera_csid_lut_params32 lut_params; + uint8_t csi_3p_sel; +}; + +struct msm_camera_csi2_params32 { + struct msm_camera_csid_params32 csid_params; + struct msm_camera_csiphy_params csiphy_params; + uint8_t csi_clk_scale_enable; +}; + +struct csid_cfg_data32 { + enum csid_cfg_type_t cfgtype; + union { + uint32_t csid_version; + compat_uptr_t csid_params; + compat_uptr_t csid_testmode_params; + } cfg; +}; + +struct eeprom_read_t32 { + compat_uptr_t dbuffer; + uint32_t num_bytes; +}; + +struct eeprom_write_t32 { + compat_uptr_t dbuffer; + uint32_t num_bytes; +}; + +struct msm_eeprom_info_t32 { + compat_uptr_t power_setting_array; + enum i2c_freq_mode_t i2c_freq_mode; + compat_uptr_t mem_map_array; +}; + +struct msm_eeprom_cfg_data32 { + enum eeprom_cfg_type_t cfgtype; + uint8_t is_supported; + union { + char eeprom_name[MAX_SENSOR_NAME]; + struct eeprom_get_t get_data; + struct eeprom_read_t32 read_data; + struct eeprom_write_t32 write_data; + struct msm_eeprom_info_t32 eeprom_info; + } cfg; +}; + +struct msm_camera_i2c_seq_reg_setting32 { + compat_uptr_t reg_setting; + uint16_t size; + enum msm_camera_i2c_reg_addr_type addr_type; + uint16_t delay; +}; +#endif + +enum msm_sensor_cfg_type_t { + CFG_SET_SLAVE_INFO, + CFG_SLAVE_READ_I2C, + CFG_WRITE_I2C_ARRAY, + CFG_SLAVE_WRITE_I2C_ARRAY, + CFG_WRITE_I2C_SEQ_ARRAY, + CFG_POWER_UP, + CFG_POWER_DOWN, + CFG_SET_STOP_STREAM_SETTING, + CFG_GET_SENSOR_INFO, + CFG_GET_SENSOR_INIT_PARAMS, + CFG_SET_INIT_SETTING, + CFG_SET_RESOLUTION, + CFG_SET_STOP_STREAM, + CFG_SET_START_STREAM, + CFG_SET_SATURATION, + CFG_SET_CONTRAST, + CFG_SET_SHARPNESS, + CFG_SET_ISO, + CFG_SET_EXPOSURE_COMPENSATION, + CFG_SET_ANTIBANDING, + CFG_SET_BESTSHOT_MODE, + CFG_SET_EFFECT, + CFG_SET_WHITE_BALANCE, + CFG_SET_AUTOFOCUS, + CFG_CANCEL_AUTOFOCUS, + CFG_SET_STREAM_TYPE, + CFG_SET_I2C_SYNC_PARAM, + CFG_WRITE_I2C_ARRAY_ASYNC, + CFG_WRITE_I2C_ARRAY_SYNC, + CFG_WRITE_I2C_ARRAY_SYNC_BLOCK, +}; + +enum msm_actuator_cfg_type_t { + CFG_GET_ACTUATOR_INFO, + CFG_SET_ACTUATOR_INFO, + CFG_SET_DEFAULT_FOCUS, + CFG_MOVE_FOCUS, + CFG_SET_POSITION, + CFG_ACTUATOR_POWERDOWN, + CFG_ACTUATOR_POWERUP, + CFG_ACTUATOR_INIT, +}; + +enum msm_ois_cfg_type_t { + CFG_OIS_INIT, + CFG_OIS_POWERDOWN, + CFG_OIS_POWERUP, + CFG_OIS_CONTROL, + CFG_OIS_I2C_WRITE_SEQ_TABLE, +}; + +enum msm_ois_i2c_operation { + MSM_OIS_WRITE = 0, + MSM_OIS_POLL, +}; + +struct reg_settings_ois_t { + uint16_t reg_addr; + enum msm_camera_i2c_reg_addr_type addr_type; + uint32_t reg_data; + enum msm_camera_i2c_data_type data_type; + enum msm_ois_i2c_operation i2c_operation; + uint32_t delay; +#define OIS_REG_DATA_SEQ_MAX 128 + unsigned char reg_data_seq[OIS_REG_DATA_SEQ_MAX]; + uint32_t reg_data_seq_size; +}; + +struct msm_ois_params_t { + uint16_t data_size; + uint16_t setting_size; + uint32_t i2c_addr; + enum i2c_freq_mode_t i2c_freq_mode; + enum msm_camera_i2c_reg_addr_type i2c_addr_type; + enum msm_camera_i2c_data_type i2c_data_type; + struct reg_settings_ois_t *settings; +}; + +struct msm_ois_set_info_t { + struct msm_ois_params_t ois_params; +}; + +struct msm_actuator_move_params_t { + int8_t dir; + int8_t sign_dir; + int16_t dest_step_pos; + int32_t num_steps; + uint16_t curr_lens_pos; + struct damping_params_t *ringing_params; +}; + +struct msm_actuator_tuning_params_t { + int16_t initial_code; + uint16_t pwd_step; + uint16_t region_size; + uint32_t total_steps; + struct region_params_t *region_params; +}; + +struct park_lens_data_t { + uint32_t damping_step; + uint32_t damping_delay; + uint32_t hw_params; + uint32_t max_step; +}; + +struct msm_actuator_params_t { + enum actuator_type act_type; + uint8_t reg_tbl_size; + uint16_t data_size; + uint16_t init_setting_size; + uint32_t i2c_addr; + enum i2c_freq_mode_t i2c_freq_mode; + enum msm_actuator_addr_type i2c_addr_type; + enum msm_actuator_data_type i2c_data_type; + struct msm_actuator_reg_params_t *reg_tbl_params; + struct reg_settings_t *init_settings; + struct park_lens_data_t park_lens; +}; + +struct msm_actuator_set_info_t { + struct msm_actuator_params_t actuator_params; + struct msm_actuator_tuning_params_t af_tuning_params; +}; + +struct msm_actuator_get_info_t { + uint32_t focal_length_num; + uint32_t focal_length_den; + uint32_t f_number_num; + uint32_t f_number_den; + uint32_t f_pix_num; + uint32_t f_pix_den; + uint32_t total_f_dist_num; + uint32_t total_f_dist_den; + uint32_t hor_view_angle_num; + uint32_t hor_view_angle_den; + uint32_t ver_view_angle_num; + uint32_t ver_view_angle_den; +}; + +enum af_camera_name { + ACTUATOR_MAIN_CAM_0, + ACTUATOR_MAIN_CAM_1, + ACTUATOR_MAIN_CAM_2, + ACTUATOR_MAIN_CAM_3, + ACTUATOR_MAIN_CAM_4, + ACTUATOR_MAIN_CAM_5, + ACTUATOR_WEB_CAM_0, + ACTUATOR_WEB_CAM_1, + ACTUATOR_WEB_CAM_2, +}; + +struct msm_ois_cfg_data { + int cfgtype; + union { + struct msm_ois_set_info_t set_info; + struct msm_camera_i2c_seq_reg_setting *settings; + } cfg; +}; + +struct msm_actuator_set_position_t { + uint16_t number_of_steps; + uint32_t hw_params; + uint16_t pos[MAX_NUMBER_OF_STEPS]; + uint16_t delay[MAX_NUMBER_OF_STEPS]; +}; + +struct msm_actuator_cfg_data { + int cfgtype; + uint8_t is_af_supported; + union { + struct msm_actuator_move_params_t move; + struct msm_actuator_set_info_t set_info; + struct msm_actuator_get_info_t get_info; + struct msm_actuator_set_position_t setpos; + enum af_camera_name cam_name; + } cfg; +}; + +enum msm_camera_led_config_t { + MSM_CAMERA_LED_OFF, + MSM_CAMERA_LED_LOW, + MSM_CAMERA_LED_HIGH, + MSM_CAMERA_LED_INIT, + MSM_CAMERA_LED_RELEASE, +}; + +struct msm_camera_led_cfg_t { + enum msm_camera_led_config_t cfgtype; + int32_t torch_current[MAX_LED_TRIGGERS]; + int32_t flash_current[MAX_LED_TRIGGERS]; + int32_t flash_duration[MAX_LED_TRIGGERS]; +}; + +struct msm_flash_init_info_t { + enum msm_flash_driver_type flash_driver_type; + uint32_t slave_addr; + enum i2c_freq_mode_t i2c_freq_mode; + struct msm_sensor_power_setting_array *power_setting_array; + struct msm_camera_i2c_reg_setting_array *settings; +}; + +struct msm_flash_cfg_data_t { + enum msm_flash_cfg_type_t cfg_type; + int32_t flash_current[MAX_LED_TRIGGERS]; + int32_t flash_duration[MAX_LED_TRIGGERS]; + union { + struct msm_flash_init_info_t *flash_init_info; + struct msm_camera_i2c_reg_setting_array *settings; + } cfg; +}; + +/* sensor init structures and enums */ +enum msm_sensor_init_cfg_type_t { + CFG_SINIT_PROBE, + CFG_SINIT_PROBE_DONE, + CFG_SINIT_PROBE_WAIT_DONE, +}; + +struct sensor_init_cfg_data { + enum msm_sensor_init_cfg_type_t cfgtype; + struct msm_sensor_info_t probed_info; + char entity_name[MAX_SENSOR_NAME]; + union { + void *setting; + } cfg; +}; + +#define VIDIOC_MSM_SENSOR_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct sensorb_cfg_data) + +#define VIDIOC_MSM_SENSOR_RELEASE \ + _IO('V', BASE_VIDIOC_PRIVATE + 2) + +#define VIDIOC_MSM_SENSOR_GET_SUBDEV_ID \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 3, uint32_t) + +#define VIDIOC_MSM_CSIPHY_IO_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct csiphy_cfg_data) + +#define VIDIOC_MSM_CSID_IO_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct csid_cfg_data) + +#define VIDIOC_MSM_ACTUATOR_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct msm_actuator_cfg_data) + +#define VIDIOC_MSM_FLASH_LED_DATA_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct msm_camera_led_cfg_t) + +#define VIDIOC_MSM_EEPROM_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct msm_eeprom_cfg_data) + +#define VIDIOC_MSM_SENSOR_GET_AF_STATUS \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 9, uint32_t) + +#define VIDIOC_MSM_SENSOR_INIT_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 10, struct sensor_init_cfg_data) + +#define VIDIOC_MSM_OIS_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 11, struct msm_ois_cfg_data) + +#define VIDIOC_MSM_FLASH_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 13, struct msm_flash_cfg_data_t) + +#ifdef CONFIG_COMPAT +struct msm_camera_i2c_reg_setting32 { + compat_uptr_t reg_setting; + uint16_t size; + enum msm_camera_i2c_reg_addr_type addr_type; + enum msm_camera_i2c_data_type data_type; + uint16_t delay; +}; + +struct msm_camera_i2c_array_write_config32 { + struct msm_camera_i2c_reg_setting32 conf_array; + uint16_t slave_addr; +}; + +struct msm_actuator_tuning_params_t32 { + int16_t initial_code; + uint16_t pwd_step; + uint16_t region_size; + uint32_t total_steps; + compat_uptr_t region_params; +}; + +struct msm_actuator_params_t32 { + enum actuator_type act_type; + uint8_t reg_tbl_size; + uint16_t data_size; + uint16_t init_setting_size; + uint32_t i2c_addr; + enum i2c_freq_mode_t i2c_freq_mode; + enum msm_actuator_addr_type i2c_addr_type; + enum msm_actuator_data_type i2c_data_type; + compat_uptr_t reg_tbl_params; + compat_uptr_t init_settings; + struct park_lens_data_t park_lens; +}; + +struct msm_actuator_set_info_t32 { + struct msm_actuator_params_t32 actuator_params; + struct msm_actuator_tuning_params_t32 af_tuning_params; +}; + +struct sensor_init_cfg_data32 { + enum msm_sensor_init_cfg_type_t cfgtype; + struct msm_sensor_info_t probed_info; + char entity_name[MAX_SENSOR_NAME]; + union { + compat_uptr_t setting; + } cfg; +}; + +struct msm_actuator_move_params_t32 { + int8_t dir; + int8_t sign_dir; + int16_t dest_step_pos; + int32_t num_steps; + uint16_t curr_lens_pos; + compat_uptr_t ringing_params; +}; + +struct msm_actuator_cfg_data32 { + int cfgtype; + uint8_t is_af_supported; + union { + struct msm_actuator_move_params_t32 move; + struct msm_actuator_set_info_t32 set_info; + struct msm_actuator_get_info_t get_info; + struct msm_actuator_set_position_t setpos; + enum af_camera_name cam_name; + } cfg; +}; + +struct csiphy_cfg_data32 { + enum csiphy_cfg_type_t cfgtype; + union { + compat_uptr_t csiphy_params; + compat_uptr_t csi_lane_params; + } cfg; +}; + +struct sensorb_cfg_data32 { + int cfgtype; + union { + struct msm_sensor_info_t sensor_info; + struct msm_sensor_init_params sensor_init_params; + compat_uptr_t setting; + struct msm_sensor_i2c_sync_params sensor_i2c_sync_params; + } cfg; +}; + +struct msm_ois_params_t32 { + uint16_t data_size; + uint16_t setting_size; + uint32_t i2c_addr; + enum i2c_freq_mode_t i2c_freq_mode; + enum msm_camera_i2c_reg_addr_type i2c_addr_type; + enum msm_camera_i2c_data_type i2c_data_type; + compat_uptr_t settings; +}; + +struct msm_ois_set_info_t32 { + struct msm_ois_params_t32 ois_params; +}; + +struct msm_ois_cfg_data32 { + int cfgtype; + union { + struct msm_ois_set_info_t32 set_info; + compat_uptr_t settings; + } cfg; +}; + +struct msm_flash_init_info_t32 { + enum msm_flash_driver_type flash_driver_type; + uint32_t slave_addr; + enum i2c_freq_mode_t i2c_freq_mode; + compat_uptr_t power_setting_array; + compat_uptr_t settings; +}; + +struct msm_flash_cfg_data_t32 { + enum msm_flash_cfg_type_t cfg_type; + int32_t flash_current[MAX_LED_TRIGGERS]; + int32_t flash_duration[MAX_LED_TRIGGERS]; + union { + compat_uptr_t flash_init_info; + compat_uptr_t settings; + } cfg; +}; + +#define VIDIOC_MSM_ACTUATOR_CFG32 \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct msm_actuator_cfg_data32) + +#define VIDIOC_MSM_SENSOR_INIT_CFG32 \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 10, struct sensor_init_cfg_data32) + +#define VIDIOC_MSM_CSIPHY_IO_CFG32 \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct csiphy_cfg_data32) + +#define VIDIOC_MSM_SENSOR_CFG32 \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct sensorb_cfg_data32) + +#define VIDIOC_MSM_EEPROM_CFG32 \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct msm_eeprom_cfg_data32) + +#define VIDIOC_MSM_OIS_CFG32 \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 11, struct msm_ois_cfg_data32) + +#define VIDIOC_MSM_CSID_IO_CFG32 \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct csid_cfg_data32) + +#define VIDIOC_MSM_FLASH_CFG32 \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 13, struct msm_flash_cfg_data_t32) +#endif + +#endif /* __LINUX_MSM_CAM_SENSOR_H */ diff --git a/selfdrive/visiond/include/msm_camsensor_sdk.h b/selfdrive/visiond/include/msm_camsensor_sdk.h new file mode 100644 index 00000000000000..62a4da253c9345 --- /dev/null +++ b/selfdrive/visiond/include/msm_camsensor_sdk.h @@ -0,0 +1,386 @@ +#ifndef __LINUX_MSM_CAMSENSOR_SDK_H +#define __LINUX_MSM_CAMSENSOR_SDK_H + +#define KVERSION 0x1 + +#define MAX_POWER_CONFIG 12 +#define GPIO_OUT_LOW (0 << 1) +#define GPIO_OUT_HIGH (1 << 1) +#define CSI_EMBED_DATA 0x12 +#define CSI_RESERVED_DATA_0 0x13 +#define CSI_YUV422_8 0x1E +#define CSI_RAW8 0x2A +#define CSI_RAW10 0x2B +#define CSI_RAW12 0x2C +#define CSI_DECODE_6BIT 0 +#define CSI_DECODE_8BIT 1 +#define CSI_DECODE_10BIT 2 +#define CSI_DECODE_12BIT 3 +#define CSI_DECODE_DPCM_10_8_10 5 +#define MAX_CID 16 +#define I2C_SEQ_REG_DATA_MAX 1024 +#define I2C_REG_DATA_MAX (8*1024) + +#define MSM_V4L2_PIX_FMT_META v4l2_fourcc('M', 'E', 'T', 'A') /* META */ +#define MSM_V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4') + /* 14 BGBG.. GRGR.. */ +#define MSM_V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4') + /* 14 GBGB.. RGRG.. */ +#define MSM_V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('B', 'A', '1', '4') + /* 14 GRGR.. BGBG.. */ +#define MSM_V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4') + /* 14 RGRG.. GBGB.. */ + +#define MAX_ACTUATOR_REG_TBL_SIZE 8 +#define MAX_ACTUATOR_REGION 5 +#define NUM_ACTUATOR_DIR 2 +#define MAX_ACTUATOR_SCENARIO 8 +#define MAX_ACT_MOD_NAME_SIZE 32 +#define MAX_ACT_NAME_SIZE 32 +#define MAX_ACTUATOR_INIT_SET 120 +#define MAX_I2C_REG_SET 12 + +#define MAX_LED_TRIGGERS 3 + +#define MSM_EEPROM_MEMORY_MAP_MAX_SIZE 80 +#define MSM_EEPROM_MAX_MEM_MAP_CNT 8 + +enum msm_sensor_camera_id_t { + CAMERA_0, + CAMERA_1, + CAMERA_2, + CAMERA_3, + MAX_CAMERAS, +}; + +enum i2c_freq_mode_t { + I2C_STANDARD_MODE, + I2C_FAST_MODE, + I2C_CUSTOM_MODE, + I2C_FAST_PLUS_MODE, + I2C_MAX_MODES, +}; + +enum camb_position_t { + BACK_CAMERA_B, + FRONT_CAMERA_B, + AUX_CAMERA_B = 0x100, + INVALID_CAMERA_B, +}; + +enum msm_sensor_power_seq_type_t { + SENSOR_CLK, + SENSOR_GPIO, + SENSOR_VREG, + SENSOR_I2C_MUX, + SENSOR_I2C, +}; + +enum msm_camera_i2c_reg_addr_type { + MSM_CAMERA_I2C_BYTE_ADDR = 1, + MSM_CAMERA_I2C_WORD_ADDR, + MSM_CAMERA_I2C_3B_ADDR, + MSM_CAMERA_I2C_ADDR_TYPE_MAX, +}; + +enum msm_camera_i2c_data_type { + MSM_CAMERA_I2C_BYTE_DATA = 1, + MSM_CAMERA_I2C_WORD_DATA, + MSM_CAMERA_I2C_DWORD_DATA, + MSM_CAMERA_I2C_SET_BYTE_MASK, + MSM_CAMERA_I2C_UNSET_BYTE_MASK, + MSM_CAMERA_I2C_SET_WORD_MASK, + MSM_CAMERA_I2C_UNSET_WORD_MASK, + MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA, + MSM_CAMERA_I2C_SEQ_DATA, + MSM_CAMERA_I2C_DATA_TYPE_MAX, +}; + +enum msm_sensor_power_seq_gpio_t { + SENSOR_GPIO_RESET, + SENSOR_GPIO_STANDBY, + SENSOR_GPIO_AF_PWDM, + SENSOR_GPIO_VIO, + SENSOR_GPIO_VANA, + SENSOR_GPIO_VDIG, + SENSOR_GPIO_VAF, + SENSOR_GPIO_FL_EN, + SENSOR_GPIO_FL_NOW, + SENSOR_GPIO_FL_RESET, + SENSOR_GPIO_CUSTOM1, + SENSOR_GPIO_CUSTOM2, + SENSOR_GPIO_MAX, +}; + +enum msm_camera_vreg_name_t { + CAM_VDIG, + CAM_VIO, + CAM_VANA, + CAM_VAF, + CAM_V_CUSTOM1, + CAM_V_CUSTOM2, + CAM_VREG_MAX, +}; + +enum msm_sensor_clk_type_t { + SENSOR_CAM_MCLK, + SENSOR_CAM_CLK, + SENSOR_CAM_CLK_MAX, +}; + +enum camerab_mode_t { + CAMERA_MODE_2D_B = (1<<0), + CAMERA_MODE_3D_B = (1<<1), + CAMERA_MODE_INVALID = (1<<2), +}; + +enum msm_actuator_data_type { + MSM_ACTUATOR_BYTE_DATA = 1, + MSM_ACTUATOR_WORD_DATA, +}; + +enum msm_actuator_addr_type { + MSM_ACTUATOR_BYTE_ADDR = 1, + MSM_ACTUATOR_WORD_ADDR, +}; + +enum msm_actuator_write_type { + MSM_ACTUATOR_WRITE_HW_DAMP, + MSM_ACTUATOR_WRITE_DAC, + MSM_ACTUATOR_WRITE, + MSM_ACTUATOR_WRITE_DIR_REG, + MSM_ACTUATOR_POLL, + MSM_ACTUATOR_READ_WRITE, +}; + +enum msm_actuator_i2c_operation { + MSM_ACT_WRITE = 0, + MSM_ACT_POLL, +}; + +enum actuator_type { + ACTUATOR_VCM, + ACTUATOR_PIEZO, + ACTUATOR_HVCM, + ACTUATOR_BIVCM, +}; + +enum msm_flash_driver_type { + FLASH_DRIVER_PMIC, + FLASH_DRIVER_I2C, + FLASH_DRIVER_GPIO, + FLASH_DRIVER_DEFAULT +}; + +enum msm_flash_cfg_type_t { + CFG_FLASH_INIT, + CFG_FLASH_RELEASE, + CFG_FLASH_OFF, + CFG_FLASH_LOW, + CFG_FLASH_HIGH, +}; + +enum msm_sensor_output_format_t { + MSM_SENSOR_BAYER, + MSM_SENSOR_YCBCR, + MSM_SENSOR_META, +}; + +struct msm_sensor_power_setting { + enum msm_sensor_power_seq_type_t seq_type; + unsigned short seq_val; + long config_val; + unsigned short delay; + void *data[10]; +}; + +struct msm_sensor_power_setting_array { + struct msm_sensor_power_setting power_setting_a[MAX_POWER_CONFIG]; + struct msm_sensor_power_setting *power_setting; + unsigned short size; + struct msm_sensor_power_setting power_down_setting_a[MAX_POWER_CONFIG]; + struct msm_sensor_power_setting *power_down_setting; + unsigned short size_down; +}; + +enum msm_camera_i2c_operation { + MSM_CAM_WRITE = 0, + MSM_CAM_POLL, + MSM_CAM_READ, +}; + +struct msm_sensor_i2c_sync_params { + unsigned int cid; + int csid; + unsigned short line; + unsigned short delay; +}; + +struct msm_camera_reg_settings_t { + uint16_t reg_addr; + enum msm_camera_i2c_reg_addr_type addr_type; + uint16_t reg_data; + enum msm_camera_i2c_data_type data_type; + enum msm_camera_i2c_operation i2c_operation; + uint16_t delay; +}; + +struct msm_eeprom_mem_map_t { + int slave_addr; + struct msm_camera_reg_settings_t + mem_settings[MSM_EEPROM_MEMORY_MAP_MAX_SIZE]; + int memory_map_size; +}; + +struct msm_eeprom_memory_map_array { + struct msm_eeprom_mem_map_t memory_map[MSM_EEPROM_MAX_MEM_MAP_CNT]; + uint32_t msm_size_of_max_mappings; +}; + +struct msm_sensor_init_params { + /* mask of modes supported: 2D, 3D */ + int modes_supported; + /* sensor position: front, back */ + enum camb_position_t position; + /* sensor mount angle */ + unsigned int sensor_mount_angle; +}; + +struct msm_sensor_id_info_t { + unsigned short sensor_id_reg_addr; + unsigned short sensor_id; + unsigned short sensor_id_mask; + // added in LeEco + unsigned char module_id; + unsigned char vcm_id; +}; + +struct msm_camera_sensor_slave_info { + char sensor_name[32]; + char eeprom_name[32]; + char actuator_name[32]; + char ois_name[32]; + char flash_name[32]; + enum msm_sensor_camera_id_t camera_id; + unsigned short slave_addr; + enum i2c_freq_mode_t i2c_freq_mode; + enum msm_camera_i2c_reg_addr_type addr_type; + struct msm_sensor_id_info_t sensor_id_info; + struct msm_sensor_power_setting_array power_setting_array; + unsigned char is_init_params_valid; + struct msm_sensor_init_params sensor_init_params; + enum msm_sensor_output_format_t output_format; +}; + +struct msm_camera_i2c_reg_array { + unsigned short reg_addr; + unsigned short reg_data; + unsigned int delay; +}; + +struct msm_camera_i2c_reg_setting { + struct msm_camera_i2c_reg_array *reg_setting; + unsigned short size; + enum msm_camera_i2c_reg_addr_type addr_type; + enum msm_camera_i2c_data_type data_type; + unsigned short delay; +}; + +struct msm_camera_csid_vc_cfg { + unsigned char cid; + unsigned char dt; + unsigned char decode_format; +}; + +struct msm_camera_csid_lut_params { + unsigned char num_cid; + struct msm_camera_csid_vc_cfg vc_cfg_a[MAX_CID]; + struct msm_camera_csid_vc_cfg *vc_cfg[MAX_CID]; +}; + +struct msm_camera_csid_params { + unsigned char lane_cnt; + unsigned short lane_assign; + unsigned char phy_sel; + unsigned int csi_clk; + struct msm_camera_csid_lut_params lut_params; + unsigned char csi_3p_sel; +}; + +struct msm_camera_csid_testmode_parms { + unsigned int num_bytes_per_line; + unsigned int num_lines; + unsigned int h_blanking_count; + unsigned int v_blanking_count; + unsigned int payload_mode; +}; + +struct msm_camera_csiphy_params { + unsigned char lane_cnt; + unsigned char settle_cnt; + unsigned short lane_mask; + unsigned char combo_mode; + unsigned char csid_core; + unsigned int csiphy_clk; + unsigned char csi_3phase; +}; + +struct msm_camera_i2c_seq_reg_array { + unsigned short reg_addr; + unsigned char reg_data[I2C_SEQ_REG_DATA_MAX]; + unsigned short reg_data_size; +}; + +struct msm_camera_i2c_seq_reg_setting { + struct msm_camera_i2c_seq_reg_array *reg_setting; + unsigned short size; + enum msm_camera_i2c_reg_addr_type addr_type; + unsigned short delay; +}; + +struct msm_actuator_reg_params_t { + enum msm_actuator_write_type reg_write_type; + unsigned int hw_mask; + unsigned short reg_addr; + unsigned short hw_shift; + unsigned short data_shift; + unsigned short data_type; + unsigned short addr_type; + unsigned short reg_data; + unsigned short delay; +}; + + +struct damping_params_t { + unsigned int damping_step; + unsigned int damping_delay; + unsigned int hw_params; +}; + +struct region_params_t { + /* [0] = ForwardDirection Macro boundary + [1] = ReverseDirection Inf boundary + */ + unsigned short step_bound[2]; + unsigned short code_per_step; + /* qvalue for converting float type numbers to integer format */ + unsigned int qvalue; +}; + +struct reg_settings_t { + unsigned short reg_addr; + enum msm_actuator_addr_type addr_type; + unsigned short reg_data; + enum msm_actuator_data_type data_type; + enum msm_actuator_i2c_operation i2c_operation; + unsigned int delay; +}; + +struct msm_camera_i2c_reg_setting_array { + struct msm_camera_i2c_reg_array reg_setting_a[MAX_I2C_REG_SET]; + unsigned short size; + enum msm_camera_i2c_reg_addr_type addr_type; + enum msm_camera_i2c_data_type data_type; + unsigned short delay; +}; +#endif /* __LINUX_MSM_CAM_SENSOR_H */ diff --git a/selfdrive/visiond/include/msmb_camera.h b/selfdrive/visiond/include/msmb_camera.h new file mode 100644 index 00000000000000..f4c4b3e183e86c --- /dev/null +++ b/selfdrive/visiond/include/msmb_camera.h @@ -0,0 +1,220 @@ +#ifndef __LINUX_MSMB_CAMERA_H +#define __LINUX_MSMB_CAMERA_H + +#include +#include +#include + +#define MSM_CAM_LOGSYNC_FILE_NAME "logsync" +#define MSM_CAM_LOGSYNC_FILE_BASEDIR "camera" + +#define MSM_CAM_V4L2_IOCTL_NOTIFY \ + _IOW('V', BASE_VIDIOC_PRIVATE + 30, struct msm_v4l2_event_data) + +#define MSM_CAM_V4L2_IOCTL_NOTIFY_META \ + _IOW('V', BASE_VIDIOC_PRIVATE + 31, struct msm_v4l2_event_data) + +#define MSM_CAM_V4L2_IOCTL_CMD_ACK \ + _IOW('V', BASE_VIDIOC_PRIVATE + 32, struct msm_v4l2_event_data) + +#define MSM_CAM_V4L2_IOCTL_NOTIFY_ERROR \ + _IOW('V', BASE_VIDIOC_PRIVATE + 33, struct msm_v4l2_event_data) + +#define MSM_CAM_V4L2_IOCTL_NOTIFY_DEBUG \ + _IOW('V', BASE_VIDIOC_PRIVATE + 34, struct msm_v4l2_event_data) + +#ifdef CONFIG_COMPAT +#define MSM_CAM_V4L2_IOCTL_NOTIFY32 \ + _IOW('V', BASE_VIDIOC_PRIVATE + 30, struct v4l2_event32) + +#define MSM_CAM_V4L2_IOCTL_NOTIFY_META32 \ + _IOW('V', BASE_VIDIOC_PRIVATE + 31, struct v4l2_event32) + +#define MSM_CAM_V4L2_IOCTL_CMD_ACK32 \ + _IOW('V', BASE_VIDIOC_PRIVATE + 32, struct v4l2_event32) + +#define MSM_CAM_V4L2_IOCTL_NOTIFY_ERROR32 \ + _IOW('V', BASE_VIDIOC_PRIVATE + 33, struct v4l2_event32) + +#define MSM_CAM_V4L2_IOCTL_NOTIFY_DEBUG32 \ + _IOW('V', BASE_VIDIOC_PRIVATE + 34, struct v4l2_event32) + +#endif + +#define QCAMERA_DEVICE_GROUP_ID 1 +#define QCAMERA_VNODE_GROUP_ID 2 +#define MSM_CAMERA_NAME "msm_camera" +#define MSM_CONFIGURATION_NAME "msm_config" + +#define MSM_CAMERA_SUBDEV_CSIPHY 0 +#define MSM_CAMERA_SUBDEV_CSID 1 +#define MSM_CAMERA_SUBDEV_ISPIF 2 +#define MSM_CAMERA_SUBDEV_VFE 3 +#define MSM_CAMERA_SUBDEV_AXI 4 +#define MSM_CAMERA_SUBDEV_VPE 5 +#define MSM_CAMERA_SUBDEV_SENSOR 6 +#define MSM_CAMERA_SUBDEV_ACTUATOR 7 +#define MSM_CAMERA_SUBDEV_EEPROM 8 +#define MSM_CAMERA_SUBDEV_CPP 9 +#define MSM_CAMERA_SUBDEV_CCI 10 +#define MSM_CAMERA_SUBDEV_LED_FLASH 11 +#define MSM_CAMERA_SUBDEV_STROBE_FLASH 12 +#define MSM_CAMERA_SUBDEV_BUF_MNGR 13 +#define MSM_CAMERA_SUBDEV_SENSOR_INIT 14 +#define MSM_CAMERA_SUBDEV_OIS 15 +#define MSM_CAMERA_SUBDEV_FLASH 16 +#define MSM_CAMERA_SUBDEV_EXT 17 + +#define MSM_MAX_CAMERA_SENSORS 5 + +/* The below macro is defined to put an upper limit on maximum + * number of buffer requested per stream. In case of extremely + * large value for number of buffer due to data structure corruption + * we return error to avoid integer overflow. Group processing + * can have max of 9 groups of 8 bufs each. This value may be + * configured in future*/ +#define MSM_CAMERA_MAX_STREAM_BUF 72 + +/* Max batch size of processing */ +#define MSM_CAMERA_MAX_USER_BUFF_CNT 16 + +/* featur base */ +#define MSM_CAMERA_FEATURE_BASE 0x00010000 +#define MSM_CAMERA_FEATURE_SHUTDOWN (MSM_CAMERA_FEATURE_BASE + 1) + +#define MSM_CAMERA_STATUS_BASE 0x00020000 +#define MSM_CAMERA_STATUS_FAIL (MSM_CAMERA_STATUS_BASE + 1) +#define MSM_CAMERA_STATUS_SUCCESS (MSM_CAMERA_STATUS_BASE + 2) + +/* event type */ +#define MSM_CAMERA_V4L2_EVENT_TYPE (V4L2_EVENT_PRIVATE_START + 0x00002000) + +/* event id */ +#define MSM_CAMERA_EVENT_MIN 0 +#define MSM_CAMERA_NEW_SESSION (MSM_CAMERA_EVENT_MIN + 1) +#define MSM_CAMERA_DEL_SESSION (MSM_CAMERA_EVENT_MIN + 2) +#define MSM_CAMERA_SET_PARM (MSM_CAMERA_EVENT_MIN + 3) +#define MSM_CAMERA_GET_PARM (MSM_CAMERA_EVENT_MIN + 4) +#define MSM_CAMERA_MAPPING_CFG (MSM_CAMERA_EVENT_MIN + 5) +#define MSM_CAMERA_MAPPING_SES (MSM_CAMERA_EVENT_MIN + 6) +#define MSM_CAMERA_MSM_NOTIFY (MSM_CAMERA_EVENT_MIN + 7) +#define MSM_CAMERA_EVENT_MAX (MSM_CAMERA_EVENT_MIN + 8) + +/* data.command */ +#define MSM_CAMERA_PRIV_S_CROP (V4L2_CID_PRIVATE_BASE + 1) +#define MSM_CAMERA_PRIV_G_CROP (V4L2_CID_PRIVATE_BASE + 2) +#define MSM_CAMERA_PRIV_G_FMT (V4L2_CID_PRIVATE_BASE + 3) +#define MSM_CAMERA_PRIV_S_FMT (V4L2_CID_PRIVATE_BASE + 4) +#define MSM_CAMERA_PRIV_TRY_FMT (V4L2_CID_PRIVATE_BASE + 5) +#define MSM_CAMERA_PRIV_METADATA (V4L2_CID_PRIVATE_BASE + 6) +#define MSM_CAMERA_PRIV_QUERY_CAP (V4L2_CID_PRIVATE_BASE + 7) +#define MSM_CAMERA_PRIV_STREAM_ON (V4L2_CID_PRIVATE_BASE + 8) +#define MSM_CAMERA_PRIV_STREAM_OFF (V4L2_CID_PRIVATE_BASE + 9) +#define MSM_CAMERA_PRIV_NEW_STREAM (V4L2_CID_PRIVATE_BASE + 10) +#define MSM_CAMERA_PRIV_DEL_STREAM (V4L2_CID_PRIVATE_BASE + 11) +#define MSM_CAMERA_PRIV_SHUTDOWN (V4L2_CID_PRIVATE_BASE + 12) +#define MSM_CAMERA_PRIV_STREAM_INFO_SYNC \ + (V4L2_CID_PRIVATE_BASE + 13) +#define MSM_CAMERA_PRIV_G_SESSION_ID (V4L2_CID_PRIVATE_BASE + 14) +#define MSM_CAMERA_PRIV_CMD_MAX 20 + +/* data.status - success */ +#define MSM_CAMERA_CMD_SUCESS 0x00000001 +#define MSM_CAMERA_BUF_MAP_SUCESS 0x00000002 + +/* data.status - error */ +#define MSM_CAMERA_ERR_EVT_BASE 0x00010000 +#define MSM_CAMERA_ERR_CMD_FAIL (MSM_CAMERA_ERR_EVT_BASE + 1) +#define MSM_CAMERA_ERR_MAPPING (MSM_CAMERA_ERR_EVT_BASE + 2) +#define MSM_CAMERA_ERR_DEVICE_BUSY (MSM_CAMERA_ERR_EVT_BASE + 3) + +/* The msm_v4l2_event_data structure should match the + * v4l2_event.u.data field. + * should not exceed 16 elements */ +struct msm_v4l2_event_data { + /*word 0*/ + unsigned int command; + /*word 1*/ + unsigned int status; + /*word 2*/ + unsigned int session_id; + /*word 3*/ + unsigned int stream_id; + /*word 4*/ + unsigned int map_op; + /*word 5*/ + unsigned int map_buf_idx; + /*word 6*/ + unsigned int notify; + /*word 7*/ + unsigned int arg_value; + /*word 8*/ + unsigned int ret_value; + /*word 9*/ + unsigned int v4l2_event_type; + /*word 10*/ + unsigned int v4l2_event_id; + /*word 11*/ + unsigned int handle; + /*word 12*/ + unsigned int nop6; + /*word 13*/ + unsigned int nop7; + /*word 14*/ + unsigned int nop8; + /*word 15*/ + unsigned int nop9; +}; + +/* map to v4l2_format.fmt.raw_data */ +struct msm_v4l2_format_data { + enum v4l2_buf_type type; + unsigned int width; + unsigned int height; + unsigned int pixelformat; /* FOURCC */ + unsigned char num_planes; + unsigned int plane_sizes[VIDEO_MAX_PLANES]; +}; + +/* MSM Four-character-code (FOURCC) */ +#define msm_v4l2_fourcc(a, b, c, d)\ + ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) |\ + ((__u32)(d) << 24)) + +/* Composite stats */ +#define MSM_V4L2_PIX_FMT_STATS_COMB v4l2_fourcc('S', 'T', 'C', 'M') +/* AEC stats */ +#define MSM_V4L2_PIX_FMT_STATS_AE v4l2_fourcc('S', 'T', 'A', 'E') +/* AF stats */ +#define MSM_V4L2_PIX_FMT_STATS_AF v4l2_fourcc('S', 'T', 'A', 'F') +/* AWB stats */ +#define MSM_V4L2_PIX_FMT_STATS_AWB v4l2_fourcc('S', 'T', 'W', 'B') +/* IHIST stats */ +#define MSM_V4L2_PIX_FMT_STATS_IHST v4l2_fourcc('I', 'H', 'S', 'T') +/* Column count stats */ +#define MSM_V4L2_PIX_FMT_STATS_CS v4l2_fourcc('S', 'T', 'C', 'S') +/* Row count stats */ +#define MSM_V4L2_PIX_FMT_STATS_RS v4l2_fourcc('S', 'T', 'R', 'S') +/* Bayer Grid stats */ +#define MSM_V4L2_PIX_FMT_STATS_BG v4l2_fourcc('S', 'T', 'B', 'G') +/* Bayer focus stats */ +#define MSM_V4L2_PIX_FMT_STATS_BF v4l2_fourcc('S', 'T', 'B', 'F') +/* Bayer hist stats */ +#define MSM_V4L2_PIX_FMT_STATS_BHST v4l2_fourcc('B', 'H', 'S', 'T') + +enum smmu_attach_mode { + NON_SECURE_MODE = 0x01, + SECURE_MODE = 0x02, + MAX_PROTECTION_MODE = 0x03, +}; + +struct msm_camera_smmu_attach_type { + enum smmu_attach_mode attach; +}; + +struct msm_camera_user_buf_cont_t { + unsigned int buf_cnt; + unsigned int buf_idx[MSM_CAMERA_MAX_USER_BUFF_CNT]; +}; + +#endif /* __LINUX_MSMB_CAMERA_H */ diff --git a/selfdrive/visiond/include/msmb_isp.h b/selfdrive/visiond/include/msmb_isp.h new file mode 100644 index 00000000000000..35589e050a4d06 --- /dev/null +++ b/selfdrive/visiond/include/msmb_isp.h @@ -0,0 +1,880 @@ +#ifndef __MSMB_ISP__ +#define __MSMB_ISP__ + +#include + +#define MAX_PLANES_PER_STREAM 3 +#define MAX_NUM_STREAM 7 + +#define ISP_VERSION_47 47 +#define ISP_VERSION_46 46 +#define ISP_VERSION_44 44 +#define ISP_VERSION_40 40 +#define ISP_VERSION_32 32 +#define ISP_NATIVE_BUF_BIT (0x10000 << 0) +#define ISP0_BIT (0x10000 << 1) +#define ISP1_BIT (0x10000 << 2) +#define ISP_META_CHANNEL_BIT (0x10000 << 3) +#define ISP_SCRATCH_BUF_BIT (0x10000 << 4) +#define ISP_OFFLINE_STATS_BIT (0x10000 << 5) +#define ISP_STATS_STREAM_BIT 0x80000000 + +struct msm_vfe_cfg_cmd_list; + +enum ISP_START_PIXEL_PATTERN { + ISP_BAYER_RGRGRG, + ISP_BAYER_GRGRGR, + ISP_BAYER_BGBGBG, + ISP_BAYER_GBGBGB, + ISP_YUV_YCbYCr, + ISP_YUV_YCrYCb, + ISP_YUV_CbYCrY, + ISP_YUV_CrYCbY, + ISP_PIX_PATTERN_MAX +}; + +enum msm_vfe_plane_fmt { + Y_PLANE, + CB_PLANE, + CR_PLANE, + CRCB_PLANE, + CBCR_PLANE, + VFE_PLANE_FMT_MAX +}; + +enum msm_vfe_input_src { + VFE_PIX_0, + VFE_RAW_0, + VFE_RAW_1, + VFE_RAW_2, + VFE_SRC_MAX, +}; + +enum msm_vfe_axi_stream_src { + PIX_ENCODER, + PIX_VIEWFINDER, + PIX_VIDEO, + CAMIF_RAW, + IDEAL_RAW, + RDI_INTF_0, + RDI_INTF_1, + RDI_INTF_2, + VFE_AXI_SRC_MAX +}; + +enum msm_vfe_frame_skip_pattern { + NO_SKIP, + EVERY_2FRAME, + EVERY_3FRAME, + EVERY_4FRAME, + EVERY_5FRAME, + EVERY_6FRAME, + EVERY_7FRAME, + EVERY_8FRAME, + EVERY_16FRAME, + EVERY_32FRAME, + SKIP_ALL, + SKIP_RANGE, + MAX_SKIP, +}; + +/* + * Define an unused period. When this period is set it means that the stream is + * stopped(i.e the pattern is 0). We don't track the current pattern, just the + * period defines what the pattern is, if period is this then pattern is 0 else + * pattern is 1 + */ +#define MSM_VFE_STREAM_STOP_PERIOD 15 + +enum msm_isp_stats_type { + MSM_ISP_STATS_AEC, /* legacy based AEC */ + MSM_ISP_STATS_AF, /* legacy based AF */ + MSM_ISP_STATS_AWB, /* legacy based AWB */ + MSM_ISP_STATS_RS, /* legacy based RS */ + MSM_ISP_STATS_CS, /* legacy based CS */ + MSM_ISP_STATS_IHIST, /* legacy based HIST */ + MSM_ISP_STATS_SKIN, /* legacy based SKIN */ + MSM_ISP_STATS_BG, /* Bayer Grids */ + MSM_ISP_STATS_BF, /* Bayer Focus */ + MSM_ISP_STATS_BE, /* Bayer Exposure*/ + MSM_ISP_STATS_BHIST, /* Bayer Hist */ + MSM_ISP_STATS_BF_SCALE, /* Bayer Focus scale */ + MSM_ISP_STATS_HDR_BE, /* HDR Bayer Exposure */ + MSM_ISP_STATS_HDR_BHIST, /* HDR Bayer Hist */ + MSM_ISP_STATS_AEC_BG, /* AEC BG */ + MSM_ISP_STATS_MAX /* MAX */ +}; + +/* + * @stats_type_mask: Stats type mask (enum msm_isp_stats_type). + * @stream_src_mask: Stream src mask (enum msm_vfe_axi_stream_src) + * @skip_mode: skip pattern, if skip mode is range only then min/max is used + * @min_frame_id: minimum frame id (valid only if skip_mode = RANGE) + * @max_frame_id: maximum frame id (valid only if skip_mode = RANGE) +*/ +struct msm_isp_sw_framskip { + uint32_t stats_type_mask; + uint32_t stream_src_mask; + enum msm_vfe_frame_skip_pattern skip_mode; + uint32_t min_frame_id; + uint32_t max_frame_id; +}; + +enum msm_vfe_testgen_color_pattern { + COLOR_BAR_8_COLOR, + UNICOLOR_WHITE, + UNICOLOR_YELLOW, + UNICOLOR_CYAN, + UNICOLOR_GREEN, + UNICOLOR_MAGENTA, + UNICOLOR_RED, + UNICOLOR_BLUE, + UNICOLOR_BLACK, + MAX_COLOR, +}; + +enum msm_vfe_camif_input { + CAMIF_DISABLED, + CAMIF_PAD_REG_INPUT, + CAMIF_MIDDI_INPUT, + CAMIF_MIPI_INPUT, +}; + +struct msm_vfe_fetch_engine_cfg { + uint32_t input_format; + uint32_t buf_width; + uint32_t buf_height; + uint32_t fetch_width; + uint32_t fetch_height; + uint32_t x_offset; + uint32_t y_offset; + uint32_t buf_stride; +}; + +enum msm_vfe_camif_output_format { + CAMIF_QCOM_RAW, + CAMIF_MIPI_RAW, + CAMIF_PLAIN_8, + CAMIF_PLAIN_16, + CAMIF_MAX_FORMAT, +}; + +/* + * Camif output general configuration + */ +struct msm_vfe_camif_subsample_cfg { + uint32_t irq_subsample_period; + uint32_t irq_subsample_pattern; + uint32_t sof_counter_step; + uint32_t pixel_skip; + uint32_t line_skip; + uint32_t first_line; + uint32_t last_line; + uint32_t first_pixel; + uint32_t last_pixel; + enum msm_vfe_camif_output_format output_format; +}; + +/* + * Camif frame and window configuration + */ +struct msm_vfe_camif_cfg { + uint32_t lines_per_frame; + uint32_t pixels_per_line; + uint32_t first_pixel; + uint32_t last_pixel; + uint32_t first_line; + uint32_t last_line; + uint32_t epoch_line0; + uint32_t epoch_line1; + uint32_t is_split; + enum msm_vfe_camif_input camif_input; + struct msm_vfe_camif_subsample_cfg subsample_cfg; +}; + +struct msm_vfe_testgen_cfg { + uint32_t lines_per_frame; + uint32_t pixels_per_line; + uint32_t v_blank; + uint32_t h_blank; + enum ISP_START_PIXEL_PATTERN pixel_bayer_pattern; + uint32_t rotate_period; + enum msm_vfe_testgen_color_pattern color_bar_pattern; + uint32_t burst_num_frame; +}; + +enum msm_vfe_inputmux { + CAMIF, + TESTGEN, + EXTERNAL_READ, +}; + +enum msm_vfe_stats_composite_group { + STATS_COMPOSITE_GRP_NONE, + STATS_COMPOSITE_GRP_1, + STATS_COMPOSITE_GRP_2, + STATS_COMPOSITE_GRP_MAX, +}; + +enum msm_vfe_hvx_streaming_cmd { + HVX_DISABLE, + HVX_ONE_WAY, + HVX_ROUND_TRIP +}; + +struct msm_vfe_pix_cfg { + struct msm_vfe_camif_cfg camif_cfg; + struct msm_vfe_testgen_cfg testgen_cfg; + struct msm_vfe_fetch_engine_cfg fetch_engine_cfg; + enum msm_vfe_inputmux input_mux; + enum ISP_START_PIXEL_PATTERN pixel_pattern; + uint32_t input_format; + enum msm_vfe_hvx_streaming_cmd hvx_cmd; + uint32_t is_split; +}; + +struct msm_vfe_rdi_cfg { + uint8_t cid; + uint8_t frame_based; +}; + +struct msm_vfe_input_cfg { + union { + struct msm_vfe_pix_cfg pix_cfg; + struct msm_vfe_rdi_cfg rdi_cfg; + } d; + enum msm_vfe_input_src input_src; + uint32_t input_pix_clk; +}; + +struct msm_vfe_fetch_eng_start { + uint32_t session_id; + uint32_t stream_id; + uint32_t buf_idx; + uint8_t offline_mode; + uint32_t fd; + uint32_t buf_addr; + uint32_t frame_id; +}; + +struct msm_vfe_axi_plane_cfg { + uint32_t output_width; /*Include padding*/ + uint32_t output_height; + uint32_t output_stride; + uint32_t output_scan_lines; + uint32_t output_plane_format; /*Y/Cb/Cr/CbCr*/ + uint32_t plane_addr_offset; + uint8_t csid_src; /*RDI 0-2*/ + uint8_t rdi_cid;/*CID 1-16*/ +}; + +enum msm_stream_memory_input_t { + MEMORY_INPUT_DISABLED, + MEMORY_INPUT_ENABLED +}; + +struct msm_vfe_axi_stream_request_cmd { + uint32_t session_id; + uint32_t stream_id; + uint32_t vt_enable; + uint32_t output_format;/*Planar/RAW/Misc*/ + enum msm_vfe_axi_stream_src stream_src; /*CAMIF/IDEAL/RDIs*/ + struct msm_vfe_axi_plane_cfg plane_cfg[MAX_PLANES_PER_STREAM]; + + uint32_t burst_count; + uint32_t hfr_mode; + uint8_t frame_base; + + uint32_t init_frame_drop; /*MAX 31 Frames*/ + enum msm_vfe_frame_skip_pattern frame_skip_pattern; + uint8_t buf_divert; /* if TRUE no vb2 buf done. */ + /*Return values*/ + uint32_t axi_stream_handle; + uint32_t controllable_output; + uint32_t burst_len; + /* Flag indicating memory input stream */ + enum msm_stream_memory_input_t memory_input; +}; + +struct msm_vfe_axi_stream_release_cmd { + uint32_t stream_handle; +}; + +enum msm_vfe_axi_stream_cmd { + STOP_STREAM, + START_STREAM, + STOP_IMMEDIATELY, +}; + +struct msm_vfe_axi_stream_cfg_cmd { + uint8_t num_streams; + uint32_t stream_handle[VFE_AXI_SRC_MAX]; + enum msm_vfe_axi_stream_cmd cmd; + uint8_t sync_frame_id_src; +}; + +enum msm_vfe_axi_stream_update_type { + ENABLE_STREAM_BUF_DIVERT, + DISABLE_STREAM_BUF_DIVERT, + UPDATE_STREAM_FRAMEDROP_PATTERN, + UPDATE_STREAM_STATS_FRAMEDROP_PATTERN, + UPDATE_STREAM_AXI_CONFIG, + UPDATE_STREAM_REQUEST_FRAMES, + UPDATE_STREAM_ADD_BUFQ, + UPDATE_STREAM_REMOVE_BUFQ, + UPDATE_STREAM_SW_FRAME_DROP, +}; + +enum msm_vfe_iommu_type { + IOMMU_ATTACH, + IOMMU_DETACH, +}; + +enum msm_vfe_buff_queue_id { + VFE_BUF_QUEUE_DEFAULT, + VFE_BUF_QUEUE_SHARED, + VFE_BUF_QUEUE_MAX, +}; + +struct msm_vfe_axi_stream_cfg_update_info { + uint32_t stream_handle; + uint32_t output_format; + uint32_t user_stream_id; + uint32_t frame_id; + enum msm_vfe_frame_skip_pattern skip_pattern; + struct msm_vfe_axi_plane_cfg plane_cfg[MAX_PLANES_PER_STREAM]; + struct msm_isp_sw_framskip sw_skip_info; +}; + +struct msm_vfe_axi_halt_cmd { + uint32_t stop_camif; + uint32_t overflow_detected; + uint32_t blocking_halt; +}; + +struct msm_vfe_axi_reset_cmd { + uint32_t blocking; + uint32_t frame_id; +}; + +struct msm_vfe_axi_restart_cmd { + uint32_t enable_camif; +}; + +struct msm_vfe_axi_stream_update_cmd { + uint32_t num_streams; + enum msm_vfe_axi_stream_update_type update_type; + struct msm_vfe_axi_stream_cfg_update_info + update_info[MSM_ISP_STATS_MAX]; +}; + +struct msm_vfe_smmu_attach_cmd { + uint32_t security_mode; + uint32_t iommu_attach_mode; +}; + +struct msm_vfe_stats_stream_request_cmd { + uint32_t session_id; + uint32_t stream_id; + enum msm_isp_stats_type stats_type; + uint32_t composite_flag; + uint32_t framedrop_pattern; + uint32_t init_frame_drop; /*MAX 31 Frames*/ + uint32_t irq_subsample_pattern; + uint32_t buffer_offset; + uint32_t stream_handle; +}; + +struct msm_vfe_stats_stream_release_cmd { + uint32_t stream_handle; +}; +struct msm_vfe_stats_stream_cfg_cmd { + uint8_t num_streams; + uint32_t stream_handle[MSM_ISP_STATS_MAX]; + uint8_t enable; + uint32_t stats_burst_len; +}; + +enum msm_vfe_reg_cfg_type { + VFE_WRITE, + VFE_WRITE_MB, + VFE_READ, + VFE_CFG_MASK, + VFE_WRITE_DMI_16BIT, + VFE_WRITE_DMI_32BIT, + VFE_WRITE_DMI_64BIT, + VFE_READ_DMI_16BIT, + VFE_READ_DMI_32BIT, + VFE_READ_DMI_64BIT, + GET_MAX_CLK_RATE, + GET_CLK_RATES, + GET_ISP_ID, + VFE_HW_UPDATE_LOCK, + VFE_HW_UPDATE_UNLOCK, + SET_WM_UB_SIZE, + SET_UB_POLICY, +}; + +struct msm_vfe_cfg_cmd2 { + uint16_t num_cfg; + uint16_t cmd_len; + void __user *cfg_data; + void __user *cfg_cmd; +}; + +struct msm_vfe_cfg_cmd_list { + struct msm_vfe_cfg_cmd2 cfg_cmd; + struct msm_vfe_cfg_cmd_list *next; + uint32_t next_size; +}; + +struct msm_vfe_reg_rw_info { + uint32_t reg_offset; + uint32_t cmd_data_offset; + uint32_t len; +}; + +struct msm_vfe_reg_mask_info { + uint32_t reg_offset; + uint32_t mask; + uint32_t val; +}; + +struct msm_vfe_reg_dmi_info { + uint32_t hi_tbl_offset; /*Optional*/ + uint32_t lo_tbl_offset; /*Required*/ + uint32_t len; +}; + +struct msm_vfe_reg_cfg_cmd { + union { + struct msm_vfe_reg_rw_info rw_info; + struct msm_vfe_reg_mask_info mask_info; + struct msm_vfe_reg_dmi_info dmi_info; + } u; + + enum msm_vfe_reg_cfg_type cmd_type; +}; + +enum vfe_sd_type { + VFE_SD_0 = 0, + VFE_SD_1, + VFE_SD_COMMON, + VFE_SD_MAX, +}; + +/* When you change the value below, check for the sof event_data size. + * V4l2 limits payload to 64 bytes */ +#define MS_NUM_SLAVE_MAX 1 + +/* Usecases when 2 HW need to be related or synced */ +enum msm_vfe_dual_hw_type { + DUAL_NONE = 0, + DUAL_HW_VFE_SPLIT = 1, + DUAL_HW_MASTER_SLAVE = 2, +}; + +/* Type for 2 INTF when used in Master-Slave mode */ +enum msm_vfe_dual_hw_ms_type { + MS_TYPE_NONE, + MS_TYPE_MASTER, + MS_TYPE_SLAVE, +}; + +struct msm_isp_set_dual_hw_ms_cmd { + uint8_t num_src; + /* Each session can be only one type but multiple intf if YUV cam */ + enum msm_vfe_dual_hw_ms_type dual_hw_ms_type; + /* Primary intf is mostly associated with preview. + * This primary intf SOF frame_id and timestamp is tracked + * and used to calculate delta */ + enum msm_vfe_input_src primary_intf; + /* input_src array indicates other input INTF that may be Master/Slave. + * For these additional intf, frame_id and timestamp are not saved. + * However, if these are slaves then they will still get their + * frame_id from Master */ + enum msm_vfe_input_src input_src[VFE_SRC_MAX]; + uint32_t sof_delta_threshold; /* In milliseconds. Sent for Master */ +}; + +enum msm_isp_buf_type { + ISP_PRIVATE_BUF, + ISP_SHARE_BUF, + MAX_ISP_BUF_TYPE, +}; + +struct msm_isp_unmap_buf_req { + uint32_t fd; +}; + +struct msm_isp_buf_request { + uint32_t session_id; + uint32_t stream_id; + uint8_t num_buf; + uint32_t handle; + enum msm_isp_buf_type buf_type; +}; + +struct msm_isp_qbuf_plane { + uint32_t addr; + uint32_t offset; + uint32_t length; +}; + +struct msm_isp_qbuf_buffer { + struct msm_isp_qbuf_plane planes[MAX_PLANES_PER_STREAM]; + uint32_t num_planes; +}; + +struct msm_isp_qbuf_info { + uint32_t handle; + int32_t buf_idx; + /*Only used for prepare buffer*/ + struct msm_isp_qbuf_buffer buffer; + /*Only used for diverted buffer*/ + uint32_t dirty_buf; +}; + +struct msm_isp_clk_rates { + uint32_t svs_rate; + uint32_t nominal_rate; + uint32_t high_rate; +}; + +struct msm_vfe_axi_src_state { + enum msm_vfe_input_src input_src; + uint32_t src_active; + uint32_t src_frame_id; +}; + +enum msm_isp_event_mask_index { + ISP_EVENT_MASK_INDEX_STATS_NOTIFY = 0, + ISP_EVENT_MASK_INDEX_ERROR = 1, + ISP_EVENT_MASK_INDEX_IOMMU_P_FAULT = 2, + ISP_EVENT_MASK_INDEX_STREAM_UPDATE_DONE = 3, + ISP_EVENT_MASK_INDEX_REG_UPDATE = 4, + ISP_EVENT_MASK_INDEX_SOF = 5, + ISP_EVENT_MASK_INDEX_BUF_DIVERT = 6, + ISP_EVENT_MASK_INDEX_COMP_STATS_NOTIFY = 7, + ISP_EVENT_MASK_INDEX_MASK_FE_READ_DONE = 8, + ISP_EVENT_MASK_INDEX_BUF_DONE = 9, + ISP_EVENT_MASK_INDEX_REG_UPDATE_MISSING = 10, + ISP_EVENT_MASK_INDEX_PING_PONG_MISMATCH = 11, + ISP_EVENT_MASK_INDEX_BUF_FATAL_ERROR = 12, +}; + + +#define ISP_EVENT_SUBS_MASK_NONE 0 + +#define ISP_EVENT_SUBS_MASK_STATS_NOTIFY \ + (1 << ISP_EVENT_MASK_INDEX_STATS_NOTIFY) + +#define ISP_EVENT_SUBS_MASK_ERROR \ + (1 << ISP_EVENT_MASK_INDEX_ERROR) + +#define ISP_EVENT_SUBS_MASK_IOMMU_P_FAULT \ + (1 << ISP_EVENT_MASK_INDEX_IOMMU_P_FAULT) + +#define ISP_EVENT_SUBS_MASK_STREAM_UPDATE_DONE \ + (1 << ISP_EVENT_MASK_INDEX_STREAM_UPDATE_DONE) + +#define ISP_EVENT_SUBS_MASK_REG_UPDATE \ + (1 << ISP_EVENT_MASK_INDEX_REG_UPDATE) + +#define ISP_EVENT_SUBS_MASK_SOF \ + (1 << ISP_EVENT_MASK_INDEX_SOF) + +#define ISP_EVENT_SUBS_MASK_BUF_DIVERT \ + (1 << ISP_EVENT_MASK_INDEX_BUF_DIVERT) + +#define ISP_EVENT_SUBS_MASK_COMP_STATS_NOTIFY \ + (1 << ISP_EVENT_MASK_INDEX_COMP_STATS_NOTIFY) + +#define ISP_EVENT_SUBS_MASK_FE_READ_DONE \ + (1 << ISP_EVENT_MASK_INDEX_MASK_FE_READ_DONE) + +#define ISP_EVENT_SUBS_MASK_BUF_DONE \ + (1 << ISP_EVENT_MASK_INDEX_BUF_DONE) + +#define ISP_EVENT_SUBS_MASK_REG_UPDATE_MISSING \ + (1 << ISP_EVENT_MASK_INDEX_REG_UPDATE_MISSING) + +#define ISP_EVENT_SUBS_MASK_PING_PONG_MISMATCH \ + (1 << ISP_EVENT_MASK_INDEX_PING_PONG_MISMATCH) + +#define ISP_EVENT_SUBS_MASK_BUF_FATAL_ERROR \ + (1 << ISP_EVENT_MASK_INDEX_BUF_FATAL_ERROR) + +enum msm_isp_event_idx { + ISP_REG_UPDATE = 0, + ISP_EPOCH_0 = 1, + ISP_EPOCH_1 = 2, + ISP_START_ACK = 3, + ISP_STOP_ACK = 4, + ISP_IRQ_VIOLATION = 5, + ISP_STATS_OVERFLOW = 6, + ISP_BUF_DONE = 7, + ISP_FE_RD_DONE = 8, + ISP_IOMMU_P_FAULT = 9, + ISP_ERROR = 10, + ISP_HW_FATAL_ERROR = 11, + ISP_PING_PONG_MISMATCH = 12, + ISP_REG_UPDATE_MISSING = 13, + ISP_BUF_FATAL_ERROR = 14, + ISP_EVENT_MAX = 15 +}; + +#define ISP_EVENT_OFFSET 8 +#define ISP_EVENT_BASE (V4L2_EVENT_PRIVATE_START) +#define ISP_BUF_EVENT_BASE (ISP_EVENT_BASE + (1 << ISP_EVENT_OFFSET)) +#define ISP_STATS_EVENT_BASE (ISP_EVENT_BASE + (2 << ISP_EVENT_OFFSET)) +#define ISP_CAMIF_EVENT_BASE (ISP_EVENT_BASE + (3 << ISP_EVENT_OFFSET)) +#define ISP_STREAM_EVENT_BASE (ISP_EVENT_BASE + (4 << ISP_EVENT_OFFSET)) +#define ISP_EVENT_REG_UPDATE (ISP_EVENT_BASE + ISP_REG_UPDATE) +#define ISP_EVENT_EPOCH_0 (ISP_EVENT_BASE + ISP_EPOCH_0) +#define ISP_EVENT_EPOCH_1 (ISP_EVENT_BASE + ISP_EPOCH_1) +#define ISP_EVENT_START_ACK (ISP_EVENT_BASE + ISP_START_ACK) +#define ISP_EVENT_STOP_ACK (ISP_EVENT_BASE + ISP_STOP_ACK) +#define ISP_EVENT_IRQ_VIOLATION (ISP_EVENT_BASE + ISP_IRQ_VIOLATION) +#define ISP_EVENT_STATS_OVERFLOW (ISP_EVENT_BASE + ISP_STATS_OVERFLOW) +#define ISP_EVENT_ERROR (ISP_EVENT_BASE + ISP_ERROR) +#define ISP_EVENT_SOF (ISP_CAMIF_EVENT_BASE) +#define ISP_EVENT_EOF (ISP_CAMIF_EVENT_BASE + 1) +#define ISP_EVENT_BUF_DONE (ISP_EVENT_BASE + ISP_BUF_DONE) +#define ISP_EVENT_BUF_DIVERT (ISP_BUF_EVENT_BASE) +#define ISP_EVENT_STATS_NOTIFY (ISP_STATS_EVENT_BASE) +#define ISP_EVENT_COMP_STATS_NOTIFY (ISP_EVENT_STATS_NOTIFY + MSM_ISP_STATS_MAX) +#define ISP_EVENT_FE_READ_DONE (ISP_EVENT_BASE + ISP_FE_RD_DONE) +#define ISP_EVENT_IOMMU_P_FAULT (ISP_EVENT_BASE + ISP_IOMMU_P_FAULT) +#define ISP_EVENT_HW_FATAL_ERROR (ISP_EVENT_BASE + ISP_HW_FATAL_ERROR) +#define ISP_EVENT_PING_PONG_MISMATCH (ISP_EVENT_BASE + ISP_PING_PONG_MISMATCH) +#define ISP_EVENT_REG_UPDATE_MISSING (ISP_EVENT_BASE + ISP_REG_UPDATE_MISSING) +#define ISP_EVENT_BUF_FATAL_ERROR (ISP_EVENT_BASE + ISP_BUF_FATAL_ERROR) +#define ISP_EVENT_STREAM_UPDATE_DONE (ISP_STREAM_EVENT_BASE) + +/* The msm_v4l2_event_data structure should match the + * v4l2_event.u.data field. + * should not exceed 64 bytes */ + +struct msm_isp_buf_event { + uint32_t session_id; + uint32_t stream_id; + uint32_t handle; + uint32_t output_format; + int8_t buf_idx; +}; +struct msm_isp_fetch_eng_event { + uint32_t session_id; + uint32_t stream_id; + uint32_t handle; + uint32_t fd; + int8_t buf_idx; + int8_t offline_mode; +}; +struct msm_isp_stats_event { + uint32_t stats_mask; /* 4 bytes */ + uint8_t stats_buf_idxs[MSM_ISP_STATS_MAX]; /* 11 bytes */ +}; + +struct msm_isp_stream_ack { + uint32_t session_id; + uint32_t stream_id; + uint32_t handle; +}; + +enum msm_vfe_error_type { + ISP_ERROR_NONE, + ISP_ERROR_CAMIF, + ISP_ERROR_BUS_OVERFLOW, + ISP_ERROR_RETURN_EMPTY_BUFFER, + ISP_ERROR_FRAME_ID_MISMATCH, + ISP_ERROR_MAX, +}; + +struct msm_isp_error_info { + enum msm_vfe_error_type err_type; + uint32_t session_id; + uint32_t stream_id; + uint32_t stream_id_mask; +}; + +/* This structure reports delta between master and slave */ +struct msm_isp_ms_delta_info { + uint8_t num_delta_info; + uint32_t delta[MS_NUM_SLAVE_MAX]; +}; + +/* This is sent in EPOCH irq */ +struct msm_isp_output_info { + uint8_t regs_not_updated; + /* mask with bufq_handle for regs not updated or return empty */ + uint16_t output_err_mask; + /* mask with stream_idx for get_buf failed */ + uint8_t stream_framedrop_mask; + /* mask with stats stream_idx for get_buf failed */ + uint16_t stats_framedrop_mask; + /* delta between master and slave */ +}; + +/* This structure is piggybacked with SOF event */ +struct msm_isp_sof_info { + uint8_t regs_not_updated; + /* mask with AXI_SRC for regs not updated */ + uint16_t reg_update_fail_mask; + /* mask with bufq_handle for get_buf failed */ + uint32_t stream_get_buf_fail_mask; + /* mask with stats stream_idx for get_buf failed */ + uint16_t stats_get_buf_fail_mask; + /* delta between master and slave */ + struct msm_isp_ms_delta_info ms_delta_info; +}; + +struct msm_isp_event_data { + /*Wall clock except for buffer divert events + *which use monotonic clock + */ + struct timeval timestamp; + /* Monotonic timestamp since bootup */ + struct timeval mono_timestamp; + uint32_t frame_id; + union { + /* Sent for Stats_Done event */ + struct msm_isp_stats_event stats; + /* Sent for Buf_Divert event */ + struct msm_isp_buf_event buf_done; + /* Sent for offline fetch done event */ + struct msm_isp_fetch_eng_event fetch_done; + /* Sent for Error_Event */ + struct msm_isp_error_info error_info; + /* + * This struct needs to be removed once + * userspace switches to sof_info + */ + struct msm_isp_output_info output_info; + /* Sent for SOF event */ + struct msm_isp_sof_info sof_info; + } u; /* union can have max 52 bytes */ +}; + +#ifdef CONFIG_COMPAT +struct msm_isp_event_data32 { + struct compat_timeval timestamp; + struct compat_timeval mono_timestamp; + uint32_t frame_id; + union { + struct msm_isp_stats_event stats; + struct msm_isp_buf_event buf_done; + struct msm_isp_fetch_eng_event fetch_done; + struct msm_isp_error_info error_info; + struct msm_isp_output_info output_info; + struct msm_isp_sof_info sof_info; + } u; +}; +#endif + +#define V4L2_PIX_FMT_QBGGR8 v4l2_fourcc('Q', 'B', 'G', '8') +#define V4L2_PIX_FMT_QGBRG8 v4l2_fourcc('Q', 'G', 'B', '8') +#define V4L2_PIX_FMT_QGRBG8 v4l2_fourcc('Q', 'G', 'R', '8') +#define V4L2_PIX_FMT_QRGGB8 v4l2_fourcc('Q', 'R', 'G', '8') +#define V4L2_PIX_FMT_QBGGR10 v4l2_fourcc('Q', 'B', 'G', '0') +#define V4L2_PIX_FMT_QGBRG10 v4l2_fourcc('Q', 'G', 'B', '0') +#define V4L2_PIX_FMT_QGRBG10 v4l2_fourcc('Q', 'G', 'R', '0') +#define V4L2_PIX_FMT_QRGGB10 v4l2_fourcc('Q', 'R', 'G', '0') +#define V4L2_PIX_FMT_QBGGR12 v4l2_fourcc('Q', 'B', 'G', '2') +#define V4L2_PIX_FMT_QGBRG12 v4l2_fourcc('Q', 'G', 'B', '2') +#define V4L2_PIX_FMT_QGRBG12 v4l2_fourcc('Q', 'G', 'R', '2') +#define V4L2_PIX_FMT_QRGGB12 v4l2_fourcc('Q', 'R', 'G', '2') +#define V4L2_PIX_FMT_QBGGR14 v4l2_fourcc('Q', 'B', 'G', '4') +#define V4L2_PIX_FMT_QGBRG14 v4l2_fourcc('Q', 'G', 'B', '4') +#define V4L2_PIX_FMT_QGRBG14 v4l2_fourcc('Q', 'G', 'R', '4') +#define V4L2_PIX_FMT_QRGGB14 v4l2_fourcc('Q', 'R', 'G', '4') +#define V4L2_PIX_FMT_P16BGGR10 v4l2_fourcc('P', 'B', 'G', '0') +#define V4L2_PIX_FMT_P16GBRG10 v4l2_fourcc('P', 'G', 'B', '0') +#define V4L2_PIX_FMT_P16GRBG10 v4l2_fourcc('P', 'G', 'R', '0') +#define V4L2_PIX_FMT_P16RGGB10 v4l2_fourcc('P', 'R', 'G', '0') +#define V4L2_PIX_FMT_NV14 v4l2_fourcc('N', 'V', '1', '4') +#define V4L2_PIX_FMT_NV41 v4l2_fourcc('N', 'V', '4', '1') +#define V4L2_PIX_FMT_META v4l2_fourcc('Q', 'M', 'E', 'T') +#define V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4') /* 14 BGBG.GRGR.*/ +#define V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4') /* 14 GBGB.RGRG.*/ +#define V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('B', 'A', '1', '4') /* 14 GRGR.BGBG.*/ +#define V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4') /* 14 RGRG.GBGB.*/ + +#define VIDIOC_MSM_VFE_REG_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_vfe_cfg_cmd2) + +#define VIDIOC_MSM_ISP_REQUEST_BUF \ + _IOWR('V', BASE_VIDIOC_PRIVATE+1, struct msm_isp_buf_request) + +#define VIDIOC_MSM_ISP_ENQUEUE_BUF \ + _IOWR('V', BASE_VIDIOC_PRIVATE+2, struct msm_isp_qbuf_info) + +#define VIDIOC_MSM_ISP_RELEASE_BUF \ + _IOWR('V', BASE_VIDIOC_PRIVATE+3, struct msm_isp_buf_request) + +#define VIDIOC_MSM_ISP_REQUEST_STREAM \ + _IOWR('V', BASE_VIDIOC_PRIVATE+4, struct msm_vfe_axi_stream_request_cmd) + +#define VIDIOC_MSM_ISP_CFG_STREAM \ + _IOWR('V', BASE_VIDIOC_PRIVATE+5, struct msm_vfe_axi_stream_cfg_cmd) + +#define VIDIOC_MSM_ISP_RELEASE_STREAM \ + _IOWR('V', BASE_VIDIOC_PRIVATE+6, struct msm_vfe_axi_stream_release_cmd) + +#define VIDIOC_MSM_ISP_INPUT_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE+7, struct msm_vfe_input_cfg) + +#define VIDIOC_MSM_ISP_SET_SRC_STATE \ + _IOWR('V', BASE_VIDIOC_PRIVATE+8, struct msm_vfe_axi_src_state) + +#define VIDIOC_MSM_ISP_REQUEST_STATS_STREAM \ + _IOWR('V', BASE_VIDIOC_PRIVATE+9, \ + struct msm_vfe_stats_stream_request_cmd) + +#define VIDIOC_MSM_ISP_CFG_STATS_STREAM \ + _IOWR('V', BASE_VIDIOC_PRIVATE+10, struct msm_vfe_stats_stream_cfg_cmd) + +#define VIDIOC_MSM_ISP_RELEASE_STATS_STREAM \ + _IOWR('V', BASE_VIDIOC_PRIVATE+11, \ + struct msm_vfe_stats_stream_release_cmd) + +#define VIDIOC_MSM_ISP_REG_UPDATE_CMD \ + _IOWR('V', BASE_VIDIOC_PRIVATE+12, enum msm_vfe_input_src) + +#define VIDIOC_MSM_ISP_UPDATE_STREAM \ + _IOWR('V', BASE_VIDIOC_PRIVATE+13, struct msm_vfe_axi_stream_update_cmd) + +#define VIDIOC_MSM_VFE_REG_LIST_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE+14, struct msm_vfe_cfg_cmd_list) + +#define VIDIOC_MSM_ISP_SMMU_ATTACH \ + _IOWR('V', BASE_VIDIOC_PRIVATE+15, struct msm_vfe_smmu_attach_cmd) + +#define VIDIOC_MSM_ISP_UPDATE_STATS_STREAM \ + _IOWR('V', BASE_VIDIOC_PRIVATE+16, struct msm_vfe_axi_stream_update_cmd) + +#define VIDIOC_MSM_ISP_AXI_HALT \ + _IOWR('V', BASE_VIDIOC_PRIVATE+17, struct msm_vfe_axi_halt_cmd) + +#define VIDIOC_MSM_ISP_AXI_RESET \ + _IOWR('V', BASE_VIDIOC_PRIVATE+18, struct msm_vfe_axi_reset_cmd) + +#define VIDIOC_MSM_ISP_AXI_RESTART \ + _IOWR('V', BASE_VIDIOC_PRIVATE+19, struct msm_vfe_axi_restart_cmd) + +#define VIDIOC_MSM_ISP_FETCH_ENG_START \ + _IOWR('V', BASE_VIDIOC_PRIVATE+20, struct msm_vfe_fetch_eng_start) + +#define VIDIOC_MSM_ISP_DEQUEUE_BUF \ + _IOWR('V', BASE_VIDIOC_PRIVATE+21, struct msm_isp_qbuf_info) + +#define VIDIOC_MSM_ISP_SET_DUAL_HW_MASTER_SLAVE \ + _IOWR('V', BASE_VIDIOC_PRIVATE+22, struct msm_isp_set_dual_hw_ms_cmd) + +#define VIDIOC_MSM_ISP_MAP_BUF_START_FE \ + _IOWR('V', BASE_VIDIOC_PRIVATE+23, struct msm_vfe_fetch_eng_start) + +#define VIDIOC_MSM_ISP_UNMAP_BUF \ + _IOWR('V', BASE_VIDIOC_PRIVATE+24, struct msm_isp_unmap_buf_req) + +#endif /* __MSMB_ISP__ */ diff --git a/selfdrive/visiond/include/msmb_ispif.h b/selfdrive/visiond/include/msmb_ispif.h new file mode 100644 index 00000000000000..2564c33b7b31ed --- /dev/null +++ b/selfdrive/visiond/include/msmb_ispif.h @@ -0,0 +1,125 @@ +#ifndef MSM_CAM_ISPIF_H +#define MSM_CAM_ISPIF_H + +#define CSID_VERSION_V20 0x02000011 +#define CSID_VERSION_V22 0x02001000 +#define CSID_VERSION_V30 0x30000000 +#define CSID_VERSION_V3 0x30000000 + +enum msm_ispif_vfe_intf { + VFE0, + VFE1, + VFE_MAX +}; +#define VFE0_MASK (1 << VFE0) +#define VFE1_MASK (1 << VFE1) + +enum msm_ispif_intftype { + PIX0, + RDI0, + PIX1, + RDI1, + RDI2, + INTF_MAX +}; +#define MAX_PARAM_ENTRIES (INTF_MAX * 2) +#define MAX_CID_CH 8 + +#define PIX0_MASK (1 << PIX0) +#define PIX1_MASK (1 << PIX1) +#define RDI0_MASK (1 << RDI0) +#define RDI1_MASK (1 << RDI1) +#define RDI2_MASK (1 << RDI2) + + +enum msm_ispif_vc { + VC0, + VC1, + VC2, + VC3, + VC_MAX +}; + +enum msm_ispif_cid { + CID0, + CID1, + CID2, + CID3, + CID4, + CID5, + CID6, + CID7, + CID8, + CID9, + CID10, + CID11, + CID12, + CID13, + CID14, + CID15, + CID_MAX +}; + +enum msm_ispif_csid { + CSID0, + CSID1, + CSID2, + CSID3, + CSID_MAX +}; + +struct msm_ispif_params_entry { + enum msm_ispif_vfe_intf vfe_intf; + enum msm_ispif_intftype intftype; + int num_cids; + enum msm_ispif_cid cids[3]; + enum msm_ispif_csid csid; + int crop_enable; + uint16_t crop_start_pixel; + uint16_t crop_end_pixel; +}; + +struct msm_ispif_param_data { + uint32_t num; + struct msm_ispif_params_entry entries[MAX_PARAM_ENTRIES]; +}; + +struct msm_isp_info { + uint32_t max_resolution; + uint32_t id; + uint32_t ver; +}; + +struct msm_ispif_vfe_info { + int num_vfe; + struct msm_isp_info info[VFE_MAX]; +}; + +enum ispif_cfg_type_t { + ISPIF_CLK_ENABLE, + ISPIF_CLK_DISABLE, + ISPIF_INIT, + ISPIF_CFG, + ISPIF_START_FRAME_BOUNDARY, + ISPIF_RESTART_FRAME_BOUNDARY, + ISPIF_STOP_FRAME_BOUNDARY, + ISPIF_STOP_IMMEDIATELY, + ISPIF_RELEASE, + ISPIF_ENABLE_REG_DUMP, + ISPIF_SET_VFE_INFO, +}; + +struct ispif_cfg_data { + enum ispif_cfg_type_t cfg_type; + union { + int reg_dump; /* ISPIF_ENABLE_REG_DUMP */ + uint32_t csid_version; /* ISPIF_INIT */ + struct msm_ispif_vfe_info vfe_info; /* ISPIF_SET_VFE_INFO */ + struct msm_ispif_param_data params; /* CFG, START, STOP */ + }; +}; + +#define VIDIOC_MSM_ISPIF_CFG \ + _IOWR('V', BASE_VIDIOC_PRIVATE, struct ispif_cfg_data) + +#endif /* MSM_CAM_ISPIF_H */ diff --git a/selfdrive/visiond/loadyuv.c b/selfdrive/visiond/loadyuv.c new file mode 100644 index 00000000000000..2b50fb9d2a4105 --- /dev/null +++ b/selfdrive/visiond/loadyuv.c @@ -0,0 +1,82 @@ +#include +#include + +#include "clutil.h" + +#include "loadyuv.h" + +void loadyuv_init(LoadYUVState* s, cl_context ctx, cl_device_id device_id, int width, int height) { + int err = 0; + memset(s, 0, sizeof(*s)); + + s->width = width; + s->height = height; + + char args[1024]; + snprintf(args, sizeof(args), + "-cl-fast-relaxed-math -cl-denorms-are-zero " + "-DTRANSFORMED_WIDTH=%d -DTRANSFORMED_HEIGHT=%d", + width, height); + cl_program prg = CLU_LOAD_FROM_FILE(ctx, device_id, "loadyuv.cl", args); + + s->loadys_krnl = clCreateKernel(prg, "loadys", &err); + assert(err == 0); + s->loaduv_krnl = clCreateKernel(prg, "loaduv", &err); + assert(err == 0); + + // done with this + err = clReleaseProgram(prg); + assert(err == 0); +} + +void loadyuv_destroy(LoadYUVState* s) { + int err = 0; + + err = clReleaseKernel(s->loadys_krnl); + assert(err == 0); + err = clReleaseKernel(s->loaduv_krnl); + assert(err == 0); +} + +void loadyuv_queue(LoadYUVState* s, cl_command_queue q, + cl_mem y_cl, cl_mem u_cl, cl_mem v_cl, + cl_mem out_cl) { + int err = 0; + + err = clSetKernelArg(s->loadys_krnl, 0, sizeof(cl_mem), &y_cl); + assert(err == 0); + err = clSetKernelArg(s->loadys_krnl, 1, sizeof(cl_mem), &out_cl); + assert(err == 0); + + const size_t loadys_work_size = (s->width*s->height)/8; + err = clEnqueueNDRangeKernel(q, s->loadys_krnl, 1, NULL, + &loadys_work_size, NULL, 0, 0, NULL); + assert(err == 0); + + const size_t loaduv_work_size = ((s->width/2)*(s->height/2))/8; + cl_int loaduv_out_off = (s->width*s->height); + + err = clSetKernelArg(s->loaduv_krnl, 0, sizeof(cl_mem), &u_cl); + assert(err == 0); + err = clSetKernelArg(s->loaduv_krnl, 1, sizeof(cl_mem), &out_cl); + assert(err == 0); + err = clSetKernelArg(s->loaduv_krnl, 2, sizeof(cl_int), &loaduv_out_off); + assert(err == 0); + + err = clEnqueueNDRangeKernel(q, s->loaduv_krnl, 1, NULL, + &loaduv_work_size, NULL, 0, 0, NULL); + assert(err == 0); + + loaduv_out_off += (s->width/2)*(s->height/2); + + err = clSetKernelArg(s->loaduv_krnl, 0, sizeof(cl_mem), &v_cl); + assert(err == 0); + err = clSetKernelArg(s->loaduv_krnl, 1, sizeof(cl_mem), &out_cl); + assert(err == 0); + err = clSetKernelArg(s->loaduv_krnl, 2, sizeof(cl_int), &loaduv_out_off); + assert(err == 0); + + err = clEnqueueNDRangeKernel(q, s->loaduv_krnl, 1, NULL, + &loaduv_work_size, NULL, 0, 0, NULL); + assert(err == 0); +} diff --git a/selfdrive/visiond/loadyuv.cl b/selfdrive/visiond/loadyuv.cl new file mode 100644 index 00000000000000..e015429156ce91 --- /dev/null +++ b/selfdrive/visiond/loadyuv.cl @@ -0,0 +1,43 @@ +#define UV_SIZE ((TRANSFORMED_WIDTH/2)*(TRANSFORMED_HEIGHT/2)) + +__kernel void loadys(__global uchar8 const * const Y, + __global float * out) +{ + const int gid = get_global_id(0); + const int ois = gid * 8; + const int oy = ois / TRANSFORMED_WIDTH; + const int ox = ois % TRANSFORMED_WIDTH; + + const uchar8 ys = Y[gid]; + + // y = (x - 128) / 128 + const float8 ysf = (convert_float8(ys) - 128.f) * 0.0078125f; + + // 02 + // 13 + + __global float* outy0; + __global float* outy1; + if ((oy & 1) == 0) { + outy0 = out; //y0 + outy1 = out + UV_SIZE*2; //y2 + } else { + outy0 = out + UV_SIZE; //y1 + outy1 = out + UV_SIZE*3; //y3 + } + + vstore4(ysf.s0246, 0, outy0 + (oy/2) * (TRANSFORMED_WIDTH/2) + ox/2); + vstore4(ysf.s1357, 0, outy1 + (oy/2) * (TRANSFORMED_WIDTH/2) + ox/2); +} + +__kernel void loaduv(__global uchar8 const * const in, + __global float8 * out, + int out_offset) +{ + const int gid = get_global_id(0); + const uchar8 inv = in[gid]; + + // y = (x - 128) / 128 + const float8 outv = (convert_float8(inv) - 128.f) * 0.0078125f; + out[gid + out_offset / 8] = outv; +} diff --git a/selfdrive/visiond/loadyuv.h b/selfdrive/visiond/loadyuv.h new file mode 100644 index 00000000000000..be7ea21282af3c --- /dev/null +++ b/selfdrive/visiond/loadyuv.h @@ -0,0 +1,34 @@ +#ifndef LOADYUV_H +#define LOADYUV_H + +#include +#include + +#ifdef __APPLE__ +#include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int width, height; + cl_kernel loadys_krnl, loaduv_krnl; +} LoadYUVState; + +void loadyuv_init(LoadYUVState* s, cl_context ctx, cl_device_id device_id, int width, int height); + +void loadyuv_destroy(LoadYUVState* s); + +void loadyuv_queue(LoadYUVState* s, cl_command_queue q, + cl_mem y_cl, cl_mem u_cl, cl_mem v_cl, + cl_mem out_cl); + +#ifdef __cplusplus +} +#endif + +#endif // LOADYUV_H diff --git a/selfdrive/visiond/model.cc b/selfdrive/visiond/model.cc new file mode 100644 index 00000000000000..ef1a7df9f07b90 --- /dev/null +++ b/selfdrive/visiond/model.cc @@ -0,0 +1,96 @@ +#include "common/timing.h" +#include "model.h" + +#ifdef BIGMODEL + #define MODEL_WIDTH 864 + #define MODEL_HEIGHT 288 + #define MODEL_NAME "driving_bigmodel_dlc" +#else + #define MODEL_WIDTH 320 + #define MODEL_HEIGHT 160 + #define MODEL_NAME "driving_model_dlc" +#endif + +#define OUTPUT_SIZE 161 + +#ifdef TEMPORAL + #define TEMPORAL_SIZE 512 +#else + #define TEMPORAL_SIZE 0 +#endif + +extern const uint8_t driving_model_data[] asm("_binary_" MODEL_NAME "_start"); +extern const uint8_t driving_model_end[] asm("_binary_" MODEL_NAME "_end"); +const size_t driving_model_size = driving_model_end - driving_model_data; + +void model_init(ModelState* s, cl_device_id device_id, cl_context context, int temporal) { + model_input_init(&s->in, MODEL_WIDTH, MODEL_HEIGHT, device_id, context); + const int output_size = OUTPUT_SIZE + TEMPORAL_SIZE; + s->output = (float*)malloc(output_size * sizeof(float)); + memset(s->output, 0, output_size * sizeof(float)); + s->m = new SNPEModel(driving_model_data, driving_model_size, s->output, output_size); +#ifdef TEMPORAL + assert(temporal); + s->m->addRecurrent(&s->output[OUTPUT_SIZE], TEMPORAL_SIZE); +#else + assert(!temporal); +#endif +} + +ModelData model_eval_frame(ModelState* s, cl_command_queue q, + cl_mem yuv_cl, int width, int height, + mat3 transform, void* sock) { + struct { + float *path; + float *left_lane; + float *right_lane; + float *lead; + } net_outputs = {NULL}; + + //for (int i = 0; i < OUTPUT_SIZE + TEMPORAL_SIZE; i++) { printf("%f ", s->output[i]); } printf("\n"); + + float *net_input_buf = model_input_prepare(&s->in, q, yuv_cl, width, height, transform); + s->m->execute(net_input_buf); + + // net outputs + net_outputs.path = &s->output[0]; + net_outputs.left_lane = &s->output[51]; + net_outputs.right_lane = &s->output[51+53]; + net_outputs.lead = &s->output[51+53+53]; + + ModelData model = {0}; + + for (int i=0; i 0. ? model.lead.dist : 0.; + + model.lead.std = max_dist * sqrt(2.) / net_outputs.lead[1]; + softmax(&net_outputs.lead[2], softmax_buff, 2); + model.lead.prob = softmax_buff[0]; + + return model; +} + +void model_free(ModelState* s) { + model_input_free(&s->in); + delete s->m; +} + diff --git a/selfdrive/visiond/model.h b/selfdrive/visiond/model.h new file mode 100644 index 00000000000000..06a65f8539752b --- /dev/null +++ b/selfdrive/visiond/model.h @@ -0,0 +1,27 @@ +#ifndef MODEL_H +#define MODEL_H + +// gate this here +//#define BIGMODEL +#define TEMPORAL + +#include "common/mat.h" +#include "common/modeldata.h" + +#include "commonmodel.h" +#include "snpemodel.h" + +typedef struct ModelState { + ModelInput in; + float *output; + SNPEModel *m; +} ModelState; + +void model_init(ModelState* s, cl_device_id device_id, + cl_context context, int temporal); +ModelData model_eval_frame(ModelState* s, cl_command_queue q, + cl_mem yuv_cl, int width, int height, + mat3 transform, void* sock); +void model_free(ModelState* s); + +#endif diff --git a/selfdrive/visiond/monitoring.cc b/selfdrive/visiond/monitoring.cc new file mode 100644 index 00000000000000..84ed9e8c5bb27d --- /dev/null +++ b/selfdrive/visiond/monitoring.cc @@ -0,0 +1,54 @@ +#include "monitoring.h" +#include "common/mat.h" + +#define MODEL_WIDTH 320 +#define MODEL_HEIGHT 160 +extern const uint8_t monitoring_model_data[] asm("_binary_monitoring_model_dlc_start"); +extern const uint8_t monitoring_model_end[] asm("_binary_monitoring_model_dlc_end"); +const size_t monitoring_model_size = monitoring_model_end - monitoring_model_data; + + +void monitoring_init(MonitoringState* s, cl_device_id device_id, cl_context context) { + model_input_init(&s->in, MODEL_WIDTH, MODEL_HEIGHT, device_id, context); + s->m = new SNPEModel(monitoring_model_data, monitoring_model_size, (float*)&s->output, OUTPUT_SIZE); +} + +MonitoringResult monitoring_eval_frame(MonitoringState* s, cl_command_queue q, + cl_mem yuv_cl, int width, int height) { + const mat3 front_frame_from_scaled_frame = (mat3){{ + width/426.0f, 0.0, 0.0, + 0.0,height/320.0f, 0.0, + 0.0, 0.0, 1.0, + }}; + + const mat3 scaled_frame_from_cropped_frame = (mat3){{ + 1.0, 0.0, 426.0-160.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + }}; + + const mat3 transpose = (mat3){{ + 0.0, 1.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, + }}; + + const mat3 front_frame_from_cropped_frame = matmul3(front_frame_from_scaled_frame, scaled_frame_from_cropped_frame); + const mat3 front_frame_from_monitoring_frame = matmul3(front_frame_from_cropped_frame, transpose); + + float *net_input_buf = model_input_prepare(&s->in, q, yuv_cl, width, height, front_frame_from_monitoring_frame); + s->m->execute(net_input_buf); + + MonitoringResult ret = {0}; + memcpy(ret.vs, s->output, sizeof(ret.vs)); + ret.std = sqrtf(2.f) / s->output[6]; + + return ret; +} + + +void monitoring_free(MonitoringState* s) { + model_input_free(&s->in); + delete s->m; +} + diff --git a/selfdrive/visiond/monitoring.h b/selfdrive/visiond/monitoring.h new file mode 100644 index 00000000000000..5689e7941573b5 --- /dev/null +++ b/selfdrive/visiond/monitoring.h @@ -0,0 +1,32 @@ +#ifndef MONITORING_H +#define MONITORING_H + +#include "commonmodel.h" +#include "snpemodel.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define OUTPUT_SIZE 7 + +typedef struct MonitoringResult { + float vs[6]; + float std; +} MonitoringResult; + +typedef struct MonitoringState { + ModelInput in; + SNPEModel *m; + float output[OUTPUT_SIZE]; +} MonitoringState; + +void monitoring_init(MonitoringState* s, cl_device_id device_id, cl_context context); +MonitoringResult monitoring_eval_frame(MonitoringState* s, cl_command_queue q, cl_mem yuv_cl, int width, int height); +void monitoring_free(MonitoringState* s); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/selfdrive/visiond/sensor_i2c.h b/selfdrive/visiond/sensor_i2c.h new file mode 100644 index 00000000000000..c33bc3468ae5df --- /dev/null +++ b/selfdrive/visiond/sensor_i2c.h @@ -0,0 +1,1830 @@ +static struct msm_camera_i2c_reg_array init_array_imx298[] = { + {0x101,0x0,0}, // IMAGE_ORIENT + {0x601,0x0,0}, // test pattern + //{0xb02,0,0}, // green correction? + // external clock setting + {0x136,0x18,0}, {0x137,0x0,0}, // EXCK_FREQ = Extclk_frequency_mhz + // global setting? + {0x30f4,0x1,0}, + {0x30f5,0x7a,0}, + {0x30f6,0x0,0}, + {0x30f7,0xec,0}, + {0x30fc,0x1,0}, + {0x3101,0x1,0}, + {0x5b2f,0x8,0}, + {0x5d32,0x5,0}, + {0x5d7c,0x0,0}, + {0x5d7d,0x0,0}, + {0x5db9,0x1,0}, + {0x5e43,0x0,0}, + {0x6300,0x0,0}, + {0x6301,0xea,0}, + {0x6302,0x0,0}, + {0x6303,0xb4,0}, + {0x6564,0x0,0}, + {0x6565,0xb6,0}, + {0x6566,0x0,0}, + {0x6567,0xe6,0}, + {0x6714,0x1,0}, + {0x6758,0xb,0}, + {0x6910,0x4,0}, + {0x6916,0x1,0}, + {0x6918,0x4,0}, + {0x691e,0x1,0}, + {0x6931,0x1,0}, + {0x6937,0x2,0}, + {0x693b,0x2,0}, + {0x6d00,0x4a,0}, + {0x6d01,0x41,0}, + {0x6d02,0x23,0}, + {0x6d05,0x4c,0}, + {0x6d06,0x10,0}, + {0x6d08,0x30,0}, + {0x6d09,0x38,0}, + {0x6d0a,0x2c,0}, + {0x6d0b,0x2d,0}, + {0x6d0c,0x34,0}, + {0x6d0d,0x42,0}, + {0x6d19,0x1c,0}, + {0x6d1a,0x71,0}, + {0x6d1b,0xc6,0}, + {0x6d1c,0x94,0}, + {0x6d24,0xe4,0}, + {0x6d30,0xa,0}, + {0x6d31,0x1,0}, + {0x6d33,0xb,0}, + {0x6d34,0x5,0}, + {0x6d35,0x0,0}, + {0x83c2,0x3,0}, + {0x83c3,0x8,0}, + {0x83c4,0x48,0}, + {0x83c7,0x8,0}, + {0x83cb,0x0,0}, + {0xb101,0xff,0}, + {0xb103,0xff,0}, + {0xb105,0xff,0}, + {0xb107,0xff,0}, + {0xb109,0xff,0}, + {0xb10b,0xff,0}, + {0xb10d,0xff,0}, + {0xb10f,0xff,0}, + {0xb111,0xff,0}, + {0xb163,0x3c,0}, + {0xc2a0,0x8,0}, + {0xc2a3,0x3,0}, + {0xc2a5,0x8,0}, + {0xc2a6,0x48,0}, + {0xc2a9,0x0,0}, + {0xf800,0x5e,0}, + {0xf801,0x5e,0}, + {0xf802,0xcd,0}, + {0xf803,0x20,0}, + {0xf804,0x55,0}, + {0xf805,0xd4,0}, + {0xf806,0x1f,0}, + {0xf808,0xf8,0}, + {0xf809,0x3a,0}, + {0xf80a,0xf1,0}, + {0xf80b,0x7e,0}, + {0xf80c,0x55,0}, + {0xf80d,0x38,0}, + {0xf80e,0xe3,0}, + {0xf810,0x74,0}, + {0xf811,0x41,0}, + {0xf812,0xbf,0}, + {0xf844,0x40,0}, + {0xf845,0xba,0}, + {0xf846,0x70,0}, + {0xf847,0x47,0}, + {0xf848,0xc0,0}, + {0xf849,0xba,0}, + {0xf84a,0x70,0}, + {0xf84b,0x47,0}, + {0xf84c,0x82,0}, + {0xf84d,0xf6,0}, + {0xf84e,0x32,0}, + {0xf84f,0xfd,0}, + {0xf851,0xf0,0}, + {0xf852,0x2,0}, + {0xf853,0xf8,0}, + {0xf854,0x81,0}, + {0xf855,0xf6,0}, + {0xf856,0xc0,0}, + {0xf857,0xff,0}, + {0xf858,0x10,0}, + {0xf859,0xb5,0}, + {0xf85a,0xd,0}, + {0xf85b,0x48,0}, + {0xf85c,0x40,0}, + {0xf85d,0x7a,0}, + {0xf85e,0x1,0}, + {0xf85f,0x28,0}, + {0xf860,0x15,0}, + {0xf861,0xd1,0}, + {0xf862,0xc,0}, + {0xf863,0x49,0}, + {0xf864,0xc,0}, + {0xf865,0x46,0}, + {0xf866,0x40,0}, + {0xf867,0x3c,0}, + {0xf868,0x48,0}, + {0xf869,0x8a,0}, + {0xf86a,0x62,0}, + {0xf86b,0x8a,0}, + {0xf86c,0x80,0}, + {0xf86d,0x1a,0}, + {0xf86e,0x8a,0}, + {0xf86f,0x89,0}, + {0xf871,0xb2,0}, + {0xf872,0x10,0}, + {0xf873,0x18,0}, + {0xf874,0xa,0}, + {0xf875,0x46,0}, + {0xf876,0x20,0}, + {0xf877,0x32,0}, + {0xf878,0x12,0}, + {0xf879,0x88,0}, + {0xf87a,0x90,0}, + {0xf87b,0x42,0}, + {0xf87d,0xda,0}, + {0xf87e,0x10,0}, + {0xf87f,0x46,0}, + {0xf880,0x80,0}, + {0xf881,0xb2,0}, + {0xf882,0x88,0}, + {0xf883,0x81,0}, + {0xf884,0x84,0}, + {0xf885,0xf6,0}, + {0xf886,0xd2,0}, + {0xf887,0xf9,0}, + {0xf888,0xe0,0}, + {0xf889,0x67,0}, + {0xf88a,0x85,0}, + {0xf88b,0xf6,0}, + {0xf88c,0xa1,0}, + {0xf88d,0xfc,0}, + {0xf88e,0x10,0}, + {0xf88f,0xbd,0}, + {0xf891,0x18,0}, + {0xf892,0x21,0}, + {0xf893,0x24,0}, + {0xf895,0x18,0}, + {0xf896,0x19,0}, + {0xf897,0xb4,0}, + {0x4e29,0x1,0}, + // PDAF stuff + {0x3166,0x1,0}, //AREA_EN_0 + {0x3167,0x1,0}, + {0x3168,0x1,0}, + {0x3169,0x1,0}, + {0x316a,0x1,0}, + {0x316b,0x1,0}, + {0x316c,0x1,0}, + {0x316d,0x1,0}, + {0x3158,0x2,0}, + {0x3159,0x2,0}, + {0x315a,0x2,0}, + {0x315b,0x3,0}, + {0x3013,0x7,0}, //RMSC_NR_MODE + {0x3035,0x1,0}, + {0x3051,0x0,0}, + {0x3056,0x2,0}, + {0x3057,0x1,0}, + {0x3060,0x0,0}, + {0x8435,0x0,0}, + {0x8455,0x0,0}, + {0x847c,0x0,0}, + {0x84fb,0x1,0}, + {0x9619,0xa0,0}, + {0x961b,0xa0,0}, + {0x961d,0xa0,0}, + {0x961f,0x20,0}, + {0x9621,0x20,0}, + {0x9623,0x20,0}, + {0x9625,0xa0,0}, + {0x9627,0xa0,0}, + {0x9629,0xa0,0}, + {0x962b,0x20,0}, + {0x962d,0x20,0}, + {0x962f,0x20,0}, + {0x9901,0x35,0}, + {0x9903,0x23,0}, + {0x9905,0x23,0}, + {0x9906,0x0,0}, + {0x9907,0x31,0}, + {0x9908,0x0,0}, + {0x9909,0x1b,0}, + {0x990a,0x0,0}, + {0x990b,0x15,0}, + {0x990d,0x3f,0}, + {0x990f,0x3f,0}, + {0x9911,0x3f,0}, + {0x9913,0x64,0}, + {0x9915,0x64,0}, + {0x9917,0x64,0}, + {0x9919,0x50,0}, + {0x991b,0x60,0}, + {0x991d,0x65,0}, + {0x991f,0x1,0}, + {0x9921,0x1,0}, + {0x9923,0x1,0}, + {0x9925,0x23,0}, + {0x9927,0x23,0}, + {0x9929,0x23,0}, + {0x992b,0x2f,0}, + {0x992d,0x1a,0}, + {0x992f,0x14,0}, + {0x9931,0x3f,0}, + {0x9933,0x3f,0}, + {0x9935,0x3f,0}, + {0x9937,0x6b,0}, + {0x9939,0x7c,0}, + {0x993b,0x81,0}, + {0x9943,0xf,0}, + {0x9945,0xf,0}, + {0x9947,0xf,0}, + {0x9949,0xf,0}, + {0x994b,0xf,0}, + {0x994d,0xf,0}, + {0x994f,0x42,0}, + {0x9951,0xf,0}, + {0x9953,0xb,0}, + {0x9955,0x5a,0}, + {0x9957,0x13,0}, + {0x9959,0xc,0}, + {0x995a,0x0,0}, + {0x995b,0x0,0}, + {0x995c,0x0,0}, + {0x996b,0x0,0}, + {0x996d,0x10,0}, + {0x996f,0x10,0}, + {0x9971,0xc8,0}, + {0x9973,0x32,0}, + {0x9975,0x4,0}, + {0x9976,0xa,0}, + {0x9977,0xa,0}, + {0x9978,0xa,0}, + {0x99a4,0x2f,0}, + {0x99a5,0x2f,0}, + {0x99a6,0x2f,0}, + {0x99a7,0xa,0}, + {0x99a8,0xa,0}, + {0x99a9,0xa,0}, + {0x99aa,0x2f,0}, + {0x99ab,0x2f,0}, + {0x99ac,0x2f,0}, + {0x99ad,0x0,0}, + {0x99ae,0x0,0}, + {0x99af,0x0,0}, + {0x99b0,0x40,0}, + {0x99b1,0x40,0}, + {0x99b2,0x40,0}, + {0x99b3,0x30,0}, + {0x99b4,0x30,0}, + {0x99b5,0x30,0}, + {0x99bb,0xa,0}, + {0x99bd,0xa,0}, + {0x99bf,0xa,0}, + {0x99c0,0x9,0}, + {0x99c1,0x9,0}, + {0x99c2,0x9,0}, + {0x99c6,0x3c,0}, + {0x99c7,0x3c,0}, + {0x99c8,0x3c,0}, + {0x99c9,0xff,0}, + {0x99ca,0xff,0}, + {0x99cb,0xff,0}, + {0x9b01,0x35,0}, + {0x9b03,0x14,0}, + {0x9b05,0x14,0}, + {0x9b07,0x31,0}, + {0x9b09,0x1b,0}, + {0x9b0b,0x15,0}, + {0x9b0d,0x1e,0}, + {0x9b0f,0x1e,0}, + {0x9b11,0x1e,0}, + {0x9b13,0x64,0}, + {0x9b15,0x64,0}, + {0x9b17,0x64,0}, + {0x9b19,0x50,0}, + {0x9b1b,0x60,0}, + {0x9b1d,0x65,0}, + {0x9b1f,0x1,0}, + {0x9b21,0x1,0}, + {0x9b23,0x1,0}, + {0x9b25,0x14,0}, + {0x9b27,0x14,0}, + {0x9b29,0x14,0}, + {0x9b2b,0x2f,0}, + {0x9b2d,0x1a,0}, + {0x9b2f,0x14,0}, + {0x9b31,0x1e,0}, + {0x9b33,0x1e,0}, + {0x9b35,0x1e,0}, + {0x9b37,0x6b,0}, + {0x9b39,0x7c,0}, + {0x9b3b,0x81,0}, + {0x9b43,0xf,0}, + {0x9b45,0xf,0}, + {0x9b47,0xf,0}, + {0x9b49,0xf,0}, + {0x9b4b,0xf,0}, + {0x9b4d,0xf,0}, + {0x9b4f,0x2d,0}, + {0x9b51,0xb,0}, + {0x9b53,0x8,0}, + {0x9b55,0x40,0}, + {0x9b57,0xd,0}, + {0x9b59,0x8,0}, + {0x9b5a,0x0,0}, + {0x9b5b,0x0,0}, + {0x9b5c,0x0,0}, + {0x9b6b,0x0,0}, + {0x9b6d,0x10,0}, + {0x9b6f,0x10,0}, + {0x9b71,0xc8,0}, + {0x9b73,0x32,0}, + {0x9b75,0x4,0}, + {0x9bb0,0x40,0}, + {0x9bb1,0x40,0}, + {0x9bb2,0x40,0}, + {0x9bb3,0x30,0}, + {0x9bb4,0x30,0}, + {0x9bb5,0x30,0}, + {0x9bbb,0xa,0}, + {0x9bbd,0xa,0}, + {0x9bbf,0xa,0}, + {0x9bc0,0x9,0}, + {0x9bc1,0x9,0}, + {0x9bc2,0x9,0}, + {0x9bc6,0x18,0}, + {0x9bc7,0x18,0}, + {0x9bc8,0x18,0}, + {0x9bc9,0xff,0}, + {0x9bca,0xff,0}, + {0x9bcb,0xff,0}, + {0xb2b2,0x1,0}, +}; + +static struct msm_camera_i2c_reg_array mode_setting_array_imx298[] = { +// i2c settings for mode 3 +// { +// .x_output = 2328, +// .y_output = 1748, +// .line_length_pclk = 5536, +// .frame_length_lines = 1802, +// .vt_pixel_clk = 299300000, +// .op_pixel_clk = 299300000, +// .binning_factor = 2, +// .min_fps = 15.000000, +// .max_fps = 30.020000, +// .mode = 1, +// .offset_x = 0, +// .offset_y = 0, +// .scale_factor = 1.000000, +// .is_pdaf_supported = 1, +// } + +// mode settings + +// hdr settings +{0x0114, 0x03, 0}, // CSI_LANE_MODE = 4-lane +/*{0x0220, 0x00, 0}, // HDR_MODE = disable +{0x0221, 0x11, 0}, // HDR_RESO_REDU_H/V = Full Pixel +{0x0222, 0x10, 0}, // EXPO_RATIO = 16*/ +{0x0220, 0x01, 0}, // HDR_MODE = enable with combined gain and 16x ratio +{0x0221, 0x22, 0}, // HDR_RESO_REDU_H/V = 2 binning +{0x0222, 0x10, 0}, // EXPO_RATIO = 16 + +{0x0340, 0x07, 0}, {0x0341, 0x0a, 0}, // FRM_LENGTH = frame_length_lines = 1802 +{0x0342, 0x15, 0}, {0x0343, 0xa0, 0}, // LINE_LENGTH = line_length_pclk = 5536 +{0x0344, 0x00, 0}, {0x0345, 0x00, 0}, // x_addr_start +{0x0346, 0x00, 0}, {0x0347, 0x00, 0}, // y_addr_start +{0x0348, 0x12, 0}, {0x0349, 0x2f, 0}, // x_addr_end +{0x034a, 0x0d, 0}, {0x034b, 0xa7, 0}, // y_addr_end +{0x0381, 0x01, 0}, // x_even_inc +{0x0383, 0x01, 0}, // x_odd_inc +{0x0385, 0x01, 0}, // y_even_inc +{0x0387, 0x01, 0}, // y_odd_inc +{0x0900, 0x01, 0}, // BINNING_MODE = enable +{0x0901, 0x22, 0}, // BINING_TYPE_H/V = 2binning +{0x0902, 0x00, 0}, // binning_weighting = average + +{0x0b06, 1, 0}, // SING_DEF_CORR_EN +{0x0b0a, 1, 0}, // combined defect correct + +{0x3010, 0x66, 0}, // HDR_OUTPUT_CTRL = ATR + HDR compose + DPC1D + DCP2D +{0x3011, 0x01, 0}, // HDR_OUTPUT_CTRL2 = PD enable +{0x30c0, 0x11, 0}, // RED_GAIN_CB? +{0x300d, 0x00, 0}, // FORCE_FDSUM = disable +{0x30fd, 0x00, 0}, +{0x8493, 0x00, 0}, +{0x8863, 0x00, 0}, +{0x90d7, 0x19, 0}, + +// set black level +{0x3090, 1, 0}, +{0x3092, 0, 0}, +{0x3093, 0x38, 0}, + +// output size settings +{0x0112, 0x0a, 0}, {0x0113, 0x0a, 0}, // CS_DT_FMT_H = 0x0a0a (RAW10 output) +{0x034c, 0x09, 0}, {0x034d, 0x18, 0}, // X_OUT_SIZE = 2328 (1164*2) +{0x034e, 0x06, 0}, {0x034f, 0xd4, 0}, // Y_OUT_SIZE = 1748 (874*2) +{0x0401, 0x00, 0}, // SCALING_MODE +{0x0404, 0x00, 0}, {0x0405, 0x10, 0}, // SCALE_M +{0x0408, 0x00, 0}, {0x0409, 0x00, 0}, // DCROP_XOFS +{0x040a, 0x00, 0}, {0x040b, 0x00, 0}, // DCROP_YOFS +{0x040c, 0x09, 0}, {0x040d, 0x18, 0}, // DCROP_WIDTH +{0x040e, 0x06, 0}, {0x040f, 0xd4, 0}, // DCROP_HIGT + +// clock settings +// 299300000 +/* +{0x0301, 0x05, 0}, // VT_PIX_CLK_DIV +{0x0303, 0x02, 0}, // VT_SYS_CLK_DIV +{0x0305, 0x04, 0}, // PRE_PLL_CLK_DIV +{0x0306, 0x00, 0}, {0x0307, 0x7d, 0}, // PLL_MULTIPLIER . mode 1: 0xf6 +{0x0309, 0x0a, 0}, // OP_PIX_CLK_DIV +{0x030b, 0x01, 0}, // OP_SYS_CLK_DIV +{0x030d, 0x0f, 0}, // PREPLLCK_OP_DIV +{0x030e, 0x03, 0}, {0x030f, 0x41, 0}, // PLL_OP_MPY +{0x0310, 0x00, 0}, // PLL_MULT_DRIV +*/ +// 600000000 +{0x0301, 0x05, 0}, +{0x0303, 0x02, 0}, +{0x0305, 0x04, 0}, +{0x0306, 0x00, 0}, +{0x0307, 0xfa, 0}, +{0x0309, 0x0a, 0}, +{0x030b, 0x01, 0}, +{0x030d, 0x0f, 0}, +{0x030e, 0x03, 0}, {0x030f, 0x41, 0}, +{0x0310, 0x00, 0}, + +// data rate settings +/*{0x0820, 0x0b, 0}, // requested_link_bit_rate_mbps = 3000 +{0x0821, 0xb8, 0}, +{0x0822, 0x00, 0}, +{0x0823, 0x00, 0},*/ +{0x0820, 0x17, 0}, // requested_link_bit_rate_mbps = 6000 +{0x0821, 0x70, 0}, +{0x0822, 0x00, 0}, +{0x0823, 0x00, 0}, + +//integration time settings +{0x0202, 0x07, 0}, {0x0203, 0x00, 0}, // INTEG_TIME = 1792 +{0x0224, 0x01, 0}, {0x0225, 0xf4, 0}, // ST_COARSE_INTEG_TIME = 506 + +// gain settings +{0x0204, 0x00, 0}, {0x0205, 0x00, 0}, // ANA_GAIN_GLOBAL = 512 / (512 - X) +{0x0216, 0x00, 0}, {0x0217, 0x00, 0}, // ST_ANA_GAIN_GLOBAL[8] +{0x020e, 0x01, 0}, {0x020f, 0x00, 0}, // DIG_GAIN_GR +{0x0210, 0x01, 0}, {0x0211, 0x00, 0}, // DIG_GAIN_R +{0x0212, 0x01, 0}, {0x0213, 0x00, 0}, // DIG_GAIN_B +{0x0214, 0x01, 0}, {0x0215, 0x00, 0}, // DIG_GAIN_GB + +// HDR white balance settings (ABS_GAIN) +{0xb8e, 0x01, 0}, {0xb8f, 0x00, 0}, // GR +{0xb90, 0x02, 0}, {0xb91, 0x2b, 0}, // R +{0xb92, 0x01, 0}, {0xb93, 0xd4, 0}, // B +{0xb94, 0x01, 0}, {0xb95, 0x00, 0}, // GB + +// phase detection settings +{0x3058, 0x00, 0}, // NML_NR_EN +{0x3103, 0x01, 0}, // NML_PD_CAL_ENABLE = enable +{0x3108, 0x00, 0}, {0x3109, 0x2c, 0}, //PD_AREA_X_OFFSET +{0x310a, 0x00, 0}, {0x310b, 0x24, 0}, //PD_AREA_Y_OFFSET +{0x310c, 0x01, 0}, {0x310d, 0xa4, 0}, //PD_AREA_WIDTH +{0x310e, 0x01, 0}, {0x310f, 0xa4, 0}, //PD_AREA_HEIGHT +// whole size is 0x918 x 0x6d4 +{0x3110, 0x03, 0}, // PD_AREA_0 = 0x375-0x4d1, 0x258-0x3b6 +{0x3111, 0x75, 0}, +{0x3112, 0x02, 0}, +{0x3113, 0x58, 0}, +{0x3114, 0x04, 0}, +{0x3115, 0xd1, 0}, +{0x3116, 0x03, 0}, +{0x3117, 0xb6, 0}, +{0x3118, 0x04, 0}, // PD_AREA_1 = 0x446-0x5a2, 0x258-0x3b6 +{0x3119, 0x46, 0}, +{0x311a, 0x02, 0}, +{0x311b, 0x58, 0}, +{0x311c, 0x05, 0}, +{0x311d, 0xa2, 0}, +{0x311e, 0x03, 0}, +{0x311f, 0xb6, 0}, +{0x3120, 0x03, 0}, // PD_AREA_2 = 0x375-0x4d1, 0x32a-0x488 +{0x3121, 0x75, 0}, +{0x3122, 0x03, 0}, +{0x3123, 0x2a, 0}, +{0x3124, 0x04, 0}, +{0x3125, 0xd1, 0}, +{0x3126, 0x04, 0}, +{0x3127, 0x88, 0}, +{0x3128, 0x04, 0}, // PD_AREA_3 = 0x446-0x5a2, 0x32a-0x488 +{0x3129, 0x46, 0}, +{0x312a, 0x03, 0}, +{0x312b, 0x2a, 0}, +{0x312c, 0x05, 0}, +{0x312d, 0xa2, 0}, +{0x312e, 0x04, 0}, +{0x312f, 0x88, 0}, +{0x3130, 0x03, 0}, // PD_AREA_4 = 0x375-0x5a2, 0x258-0x488 +{0x3131, 0x75, 0}, +{0x3132, 0x02, 0}, +{0x3133, 0x58, 0}, +{0x3134, 0x05, 0}, +{0x3135, 0xa2, 0}, +{0x3136, 0x04, 0}, +{0x3137, 0x88, 0}, +{0x3138, 0x02, 0}, // PD_AREA_5 = 0x2ba-0x65d, 0x210-0x4d0 +{0x3139, 0xba, 0}, +{0x313a, 0x02, 0}, +{0x313b, 0x10, 0}, +{0x313c, 0x06, 0}, +{0x313d, 0x5d, 0}, +{0x313e, 0x04, 0}, +{0x313f, 0xd0, 0}, +{0x3140, 0x00, 0}, // PD_AREA_6 = 0xa1-0x876, 0x6b-0x676 +{0x3141, 0xa1, 0}, +{0x3142, 0x00, 0}, +{0x3143, 0x6b, 0}, +{0x3144, 0x08, 0}, +{0x3145, 0x76, 0}, +{0x3146, 0x06, 0}, +{0x3147, 0x76, 0}, +{0x3148, 0x00, 0}, // PD_AREA_7 = 0xa1-0x876, 0x5e-0x34c +{0x3149, 0xa1, 0}, +{0x314a, 0x00, 0}, +{0x314b, 0x5e, 0}, +{0x314c, 0x08, 0}, +{0x314d, 0x76, 0}, +{0x314e, 0x03, 0}, +{0x314f, 0x4c, 0}, +{0x3165, 0x02, 0}, // AREA_EN_0 = free area +}; + +// static struct msm_camera_i2c_reg_array reg_array3[] = { +// // REG_HOLD ON +// {0x104,0x1,0}, +// // from regression +// {0x3002,0x0,0}, +// // FRM_LENGTH, 1802 vs 3554 +// // {0x340,0x7,0}, {0x341,0xa,0}, // camera start {0x340,0xd,0}, {0x341,0xe2,0}, +// // INTEG_TIME aka coarse_int_time_addr aka shutter speed +// {0x202,0x03,0}, {0x203,0xda,0}, +// // global_gain_addr +// {0x204,0x0,0}, {0x205,0x0,0}, + +// //?? +// {0x20e,0x1,0}, {0x20f,0x0,0}, +// {0x210,0x1,0}, {0x211,0x0,0}, +// {0x212,0x1,0}, {0x213,0x0,0}, +// {0x214,0x1,0}, {0x215,0x0,0}, + +// // REG_HOLD: mode setting +// {0x104,0x0,0}, +// }; + +// start, remove standby mode +static struct msm_camera_i2c_reg_array start_reg_array[] = {{0x100,0x1,0}}; + +// stop, enable standby mode +static struct msm_camera_i2c_reg_array stop_reg_array[] = {{0x100,0x0,0}}; + + +/////////////////// + + +static struct msm_camera_i2c_reg_array init_array_imx179[] = { + { 0x100, 0x0, 0}, // MODE_SELECT + { 0x101, 0x0, 0}, // IMAGE_ORIENT + { 0x202, 0x9, 0}, { 0x203, 0xd2, 0}, // COARSE_INTEGRATION_TIME + { 0x301, 0x5, 0}, // vt_pix_clk_div + { 0x303, 0x1, 0}, // vt_sys_clk_div + { 0x305, 0x6, 0}, // pre_pll_clk_div + { 0x309, 0x5, 0}, // op_pix_clk_div + { 0x30b, 0x1, 0}, // op_sys_clk_div + { 0x30c, 0x0, 0}, { 0x30d, 0x9d, 0}, + + { 0x340, 0x9, 0}, { 0x341, 0xd6, 0}, // frame_length_lines + { 0x342, 0xd, 0}, { 0x343, 0x70, 0}, // line_length_pclk + { 0x344, 0x0, 0}, { 0x345, 0x0, 0}, // x_addr_start + { 0x346, 0x0, 0}, { 0x347, 0x0, 0}, // y_addr_start + { 0x348, 0xc, 0}, { 0x349, 0xcf, 0}, // last_pixel / x_addr_end + { 0x34a, 0x9, 0}, { 0x34b, 0x9f, 0}, // last_line / y_addr_end + { 0x34c, 0xc, 0}, { 0x34d, 0xd0, 0}, // pixels_per_line / x_output_size + { 0x34e, 0x9, 0}, { 0x34f, 0xa0, 0}, // lines_per_frame / y_output_size + { 0x383, 0x1, 0}, // x_odd_inc + { 0x387, 0x1, 0}, // y_odd_inc + { 0x390, 0x0, 0}, // binning_mode + { 0x401, 0x0, 0}, // SCALING_MODE + { 0x405, 0x10, 0}, // SCALE_M + + {0x3020, 0x10, 0}, + {0x3041, 0x15, 0}, // READ_MODE? + {0x3042, 0x87, 0}, + {0x3089, 0x4f, 0}, + {0x3309, 0x9a, 0}, + {0x3344, 0x57, 0}, + {0x3345, 0x1f, 0}, + {0x3362, 0xa, 0}, + {0x3363, 0xa, 0}, + {0x3364, 0x0, 0}, + {0x3368, 0x18, 0}, + {0x3369, 0x0, 0}, + {0x3370, 0x6f, 0}, + {0x3371, 0x27, 0}, + {0x3372, 0x4f, 0}, + {0x3373, 0x2f, 0}, + {0x3374, 0x27, 0}, + {0x3375, 0x2f, 0}, + {0x3376, 0x97, 0}, + {0x3377, 0x37, 0}, + {0x33c8, 0x0, 0}, + {0x33d4, 0xc, 0}, + {0x33d5, 0xd0, 0}, + {0x33d6, 0x9, 0}, + {0x33d7, 0xa0, 0}, + // znr + {0x4100, 0xe, 0}, + {0x4108, 0x1, 0}, + {0x4109, 0x7c, 0}, +}; + + + +/////////////// ois stuff /////////////// + +/* +#define _OP_FIRM_DWNLD 0x80 +#define _OP_Periphe_RW 0x82 +#define _OP_Memory__RW 0x84 +#define _OP_AD_TRNSFER 0x86 +#define _OP_COEF_DWNLD 0x88 +#define _OP_PrgMem__RD 0x8A +#define _OP_SpecialCMD 0x8C +*/ + +static struct reg_settings_ois_t ois_init_settings[] = { + { + .reg_addr = 0x8262, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0xbf03, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8263, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x9f05, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8264, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x6040, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8260, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x1130, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8265, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x8000, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8261, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0280, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8261, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0380, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8261, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0988, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x34\x84\x00\x03\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x03\x00\x10\x7e\x84\x50\x00\x08\x40\x7e\xa0\x00\x03\x00\x10\x7e\x84\x60\x00\x08\x40\x7e\xa0\x00\x03\x00\x90\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8084, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x10\x08\x80\x00\xa0\x10\x00\x08\x7f\xff\x11\x8f\x02\x07\x80\x00\x11\x40\xff\xa0\x90\x01\x84\x20\x8f\x08\x40\xfe\x90\x40\xf5", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x80a0, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x08\x80\x01\xa0\x00\x01\x11\x8f\x02\x07\xff\xff\x11\x08\x00\x20\x50\x12\x07\x00\x10\x08\x80\x00\xa0\x10\xff\x84\x20\x0a", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x7f\xff\x21\x08\xfe\x84\x00\x04\x07\x20\x0c\x08\x7f\xff\x21\x08\xfe\x84\x00\x03\x00\x90\x17\x84\x20\x1f\x08\x80\x17\xa0\x10\x10", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x7f\xff\x21\x10\x00\x08\x01\x00\x11\x40\x51\xa0\x90\x17\x84\x20\x0f\x08\x80\x47\xa0\x8d\x0c\x07\x00\x00\x11\x30\x03\x07\x80\x41", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8090, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x50\x00\x08\x40\xfc\x90\x88\x2f\x84\x00\x00\x11\x30\x02\x07\x40\xff\x90\x50\x00\x08\x40\xfd\x90\x40\x7f\xa0\x10\xff\x84\x20\x2c", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x7f\xff\x11\x20\x0d\x08\x80\x0f\x90\x80\x26\xa0\x90\x2e\x84\x00\x10\x08\x90\x26\x84\x00\x10\x08\x80\x1f\xa0\x20\x2e\x08\x40\xed", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8090, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x20\x0f\x08\x80\x0e\x90\x00\x00\x21\x30\x02\x07\x40\xeb\xa0\x50\x00\x08\x40\xfe\x90\x40\x7f\xa0\x04\xeb\x84\x10\x00\x20\x20\x0f", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x80\x00\x21\x60\x04\x07\x40\xff\xa0\x10\x00\x08\x40\xea\x90\x10\x00\x20\x20\x0f\x08\x80\x00\x11\x00\x0b\x07\x08\x00\x20\x60\x0d", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\x00\x08\x40\xea\x90\x8f\x06\x07\x04\xff\x84\x20\x09\x60\x10\xfc\x84\x08\xfd\x84\x04\xfe\x84\x00\x03\x00\x00\x10\x08\x80\x37", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x80a0, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x90\x69\x84\x00\x10\x08\x80\x69\xa0\x20\x1a\x08\x40\x64\xa0\x10\x10\x08\x80\x4f\xa0\x20\x1d\x08\x40\x5f\xa0\x20\x1e\x08\x40\x5d", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x80a0, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\x00\x08\x80\x68\x90\x40\xfe\xa0\x20\x0e\x07\x50\x00\x08\x40\x7f\xa0\x04\xfe\x84\x00\x04\x00\x10\xf0\x44\x50\x00\x08\x00\x7f", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x20\xf0\x60\x04\x5c\x84\x04\x61\x84\x04\x57\x84\x00\x00\x21\x04\x74\x84\x00\x40\x21\x00\x0b\x07\x04\x74\x84\x00\x00\x21\x10\x57", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8084, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x30\x20\x08\x00\x04\x11\x50\x00\x08\x03\xff\x11\x20\xfa\x60\x10\xf0\x44\x50\x20\x08\x00\x7f\x11\x60\x20\x08\x40\x00\x08\x00\x08", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x30\x1a\x07\x50\x00\x08\x07\x00\x11\x9f\x1d\x07\x8b\x1e\x07\x9c\x15\x07\x20\xf8\x60\x10\x28\x44\x60\x00\x08\x01\x00\x11\x20\x28", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8060, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x87\x1b\x07\x40\xf7\xa0\x81\x27\x07\x20\x48\x60\x10\x0a\x44\x10\xf4\x84\x3b\xd4\x00\xe0\x14\x43\x08\x00\x20\x00\x06\x07\x89\x02", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\xae\x90\x81\x04\x07\x40\x2e\x90\x40\x7f\xa0\x10\x2e\x44\x20\x2f\x08\x9f\x02\x07\x00\x00\x11\x10\x00\x20\x00\x00\x08\x40\x67", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x80a0, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x11\x84\x02\x07\x20\xf0\x60\x9f\x03\x07\x40\x7e\xa0\x40\x65\x90\x10\x62\x84\x10\x10\x08\x40\x61\xa0\x20\x1d\x08\x40\x5f", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x80a0, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x20\x1e\x08\x40\x5d\xa0\x10\x00\x08\x40\x5e\x90\x20\x30\x60\x10\xcf\x84\x20\x1c\x08\x7f\xff\x21\x3b\xf7\x00\xc8\x14\x43\x10\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8020, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x08\x40\xb5\x90\x40\xad\xa0\x00\x0a\x07\x10\x4f\x84\x20\x1c\x08\x7f\xff\x21\x3c\x01\x00\x48\x14\x43\x10\x00\x20\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x35\x90\x40\x2d\xa0\x00\x14\x07\x80\x0c\x07\x82\x03\x07\x04\x50\x84\x10\x00\x20\x20\x02\x07\x00\x08\x21\x40\x00\x08\x00\x01", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x50\xa0\x00\x04\x00\x20\x7f\x00\x80\x14\x43\x01\x00\x01\x04\x00\x11\x02\x00\x21\x10\x9f\x84\x10\x20\x08\x40\x97\x90\x10\xbf", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8084, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x20\x1d\x08\x40\xc6\xa0\x20\x8e\x08\x40\x72\x90\x40\x16\xa0\x10\x96\x84\x10\x00\x08\x40\x9e\x90\x20\x36\x60\x20\x91\x00\x00\x14", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8043, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x01\x01\x00\x04\x11\x00\x02\x21\x10\x1f\x84\x10\x20\x08\x40\x17\x90\x10\x3f\x84\x20\x1d\x08\x40\x46\xa0\x20\x8e\x08\x40\x70", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8090, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x96\xa0\x10\x16\x84\x10\x00\x08\x40\x1e\x90\x20\x34\x60\x10\x65\x84\x50\x10\x08\x00\x00\x21\x84\x03\x07\x20\xf0\x60\x9f\x03", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x7e\xa0\x00\x10\x08\x40\x65\xa0\x20\x0d\x08\x40\x64\x90\x40\x62\xa0\x00\x04\x00\x04\x1c\x44\x04\x1b\x44\xc3\xff\x21\x87\x04", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x7f\xa0\x10\x42\x84\x20\x1e\x08\x7f\xff\x21\x10\x20\x08\x40\x1c\x90\x10\x07\x84\x10\x00\x08\x40\x06\x90\x40\x55\xa0\x10\xc2", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8084, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x20\x1e\x08\x7f\xff\x21\x10\x20\x08\x40\x9c\x90\x10\x87\x84\x10\x00\x08\x40\x86\x90\x40\x56\xa0\x10\x56\x84\x20\x0f\x08\x40\x7b", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8090, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x22\x00\x60\x40\x00\x08\x40\x79\xa0\x00\x08\x11\x10\x55\x84\x20\x0f\x08\x40\x7a\x90\x22\x00\x60\x50\x00\x08\x40\x79\xa0\x00\xff", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x04\x6f\x84\x00\x05\x21\x21\x39\x00\x04\x00\x11\x10\xc1\x84\x20\x0f\x08\x70\x07\x07\x10\x10\x08\x40\xc0\xa0\x20\x0f\x08\x7f\xff", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x8f\x02\x07\x80\x00\x11\x08\x00\x20\x08\xc1\x84\x40\xbd\x90\x9e\x02\x07\x40\x7f\xa0\x40\xec\x90\x04\x6e\x84\x00\x05\x21\x21\x4c", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x04\x11\x10\x41\x84\x20\x0f\x08\x70\x07\x07\x10\x10\x08\x40\x40\xa0\x20\x0f\x08\x7f\xff\x11\x8f\x02\x07\x80\x00\x11\x08\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8020, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x08\x41\x84\x40\x3d\x90\x9e\x02\x07\x40\x7f\xa0\x40\x6d\x90\x10\x2d\x44\x20\xe7\x00\x08\x00\x11\x20\x32\x60\x80\x14\x43\x10\x2c", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8044, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x20\xec\x00\x00\x08\x11\x20\x31\x60\x00\x14\x43\x04\x34\x44\x40\x5b\xa0\x00\x04\x00\x21\x6a\x00\x80\x00\x11\x21\x70\x00\x3f\xff", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x08\xe8\x84\x20\x32\x50\x08\x68\x84\x20\x31\x50\x08\x5e\x84\x20\x30\x50\x0f\xc4\x07\x10\x34\x44\x10\x5b\x84\x6f\xf3\x07\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x02\x00\x21\x40\xfc\x90\x3d\xd4\x00\x04\xfc\x84\x00\x00\x21\x04\xfd\x84\x00\x08\x21\x00\x04\x00\x21\x81\x00\xc0\x00\x11\x04\x5b", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8084, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x02\x00\x21\x70\x06\x07\x10\xfe\x84\x30\x20\x08\x00\x03\x11\x10\x00\x08\x40\x59\x90\x04\xff\x84\x40\x58\xa0\x10\x59\x84\x20\x0f", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x59\xa0\x20\x00\x11\x70\x1e\x07\x10\x00\x08\x00\x0b\x11\x0f\xe4\x07\x10\x59\x84\x00\x00\x08\x20\x30\x50\x40\x59\xa0\x70\x06", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\x00\x08\x00\x0a\x11\x0f\xec\x07\x08\x34\x44\x02\x10\x11\x10\x58\x84\x20\x0f\x08\x40\x58\xa0\x20\x00\x11\x30\x08\x07\x0f\xf4", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\x58\x84\x00\x00\x08\x20\x30\x50\x40\x58\xa0\x70\x06\x07\x10\x00\x08\x00\x05\x11\x00\x04\x00\x10\x5a\x84\x00\x00\x08\x00\x01", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x5a\xa0\x08\x34\x44\x02\x00\x11\x30\x08\x07\x60\x00\x08\x00\x00\x11\x40\x5a\xa0\x8f\x4f\x07\x40\x7e\xa0\x00\x04\x00\x3c\xdd", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\x00\x20\xa8\x14\x43\x04\xa7\x84\x20\x8e\x08\x40\xc4\x90\x40\xaf\xa0\x20\x0f\x08\x40\xc5\x90\x40\xa7\xa0\x3c\xe7\x00\x10\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8020, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x28\x14\x43\x04\x27\x84\x20\x8e\x08\x40\x44\x90\x40\x2f\xa0\x20\x0f\x08\x40\x45\x90\x40\x27\xa0\x00\x04\x00\x10\xf0\x44\x50\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\xff\xf7\x11\x93\x04\x07\x20\xf0\x60\x04\x61\x84\x04\x5c\x84\x40\x57\xa0\x00\x04\x00\x10\x61\x84\x00\x20\x08\x20\x1f\x08\x40\xff", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x80a0, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\x00\x08\x40\x5c\x90\x40\x57\xa0\x04\x74\x84\x10\x00\x20\x00\x00\x08\x40\x74\xa0\x00\x01\x11\x20\x05\x07\x00\x40\x21\x70\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x7f\xff\x21\x08\xff\x84\x42\x00\x90\x85\x02\x07\x20\xf0\x60\x7f\xff\x11\x60\x20\x08\x00\xd0\x11\x40\x00\x08\x00\x02\x11\x86\x1b", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x74\xa0\x08\x6f\x84\x00\x00\x11\x04\xf1\x84\x00\x40\x21\x21\xf7\x00\x02\x00\x11\x60\x07\x07\x10\x20\x08\x40\xc3\x90\x20\x2f", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x80\x00\x11\x70\x02\x07\x7f\xff\x11\x10\x00\x08\x40\x8d\x90\x40\x85\xa0\x08\x6e\x84\x00\x00\x11\x04\xf0\x84\x00\x40\x21\x22\x07", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x02\x11\x60\x07\x07\x10\x20\x08\x40\x43\x90\x20\x2f\x08\x80\x00\x11\x70\x02\x07\x7f\xff\x11\x10\x00\x08\x40\x0d\x90\x40\x05", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x80a0, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\xec\x84\x00\x10\x08\x10\xe7\x84\x40\xe7\xa0\x20\x0f\x08\x40\xef\xa0\x10\x6d\x84\x00\x10\x08\x10\x6c\x84\x40\x6c\xa0\x20\x0f", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x7d\xa0\x7f\xff\x11\x00\x04\x00\x10\xef\x84\x00\x10\x08\x10\xee\x84\x40\xee\xa0\x20\x0f\x08\x40\xbd\xa0\x10\x7d\x84\x00\x10", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\x7c\x84\x40\x7c\xa0\x20\x0f\x08\x40\x3d\xa0\x40\x00\x11\x3e\x9b\x00\xfb\xff\x21\x6f\x14\x43\x3e\x9e\x00\xff\xfb\x21\x6e\x14", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8043, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x3d\x57\x00\x40\xaf\xa0\xa0\x14\x43\x3d\x5a\x00\x40\x2f\xa0\x20\x14\x43\x00\x04\x00\x3d\x5e\x00\x40\xa5\xa0\xb0\x14\x43\x3d\x61", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x25\xa0\x30\x14\x43\x00\x00\x00\x22\x28\x00\x00\x02\x07\x22\x26\x00\x8a\x03\x07\x89\x04\x07\x40\x7e\xa0\x40\xbd\x90\x98\x14", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8043, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\x9c\x84\x20\x8f\x08\x40\x9a\x90\x40\x99\xa0\x20\x2e\x08\x40\xbd\x90\x00\x10\x08\x40\x9b\xa0\x20\x0e\x08\x7f\xff\x21\x40\xf5", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8090, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x22\x3c\x00\x00\x02\x07\x22\x3a\x00\x82\x03\x07\x81\x04\x07\x40\x7e\xa0\x40\x3d\x90\x18\x14\x43\x10\x1c\x84\x20\x8f", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8008, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x1a\x90\x40\x19\xa0\x20\x2e\x08\x40\x3d\x90\x00\x10\x08\x40\x1b\xa0\x20\x0e\x08\x7f\xff\x21\x40\xf5\x90\x3d\x8c\x00\xb8\x14", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8043, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\xc2\xa0\x3d\x8f\x00\x38\x14\x43\x40\x42\xa0\x00\x04\x00\x10\x51\x84\x20\x0f\x08\x7f\xc0\x11\x40\x51\xa0\x08\xbb\x84\x08\x3b", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8084, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\xcb\x90\x11\x9e\x02\x07\xc7\x00\x11\x40\x7f\xa0\x08\xba\x84\x08\x3a\x84\x74\x70\x11\x9e\x02\x07\x59\x00\x11\x40\x7f\xa0\x3e\xed", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\xfd\xff\x21\xf1\x14\x43\x3e\xf0\x00\xff\xfd\x21\xf0\x14\x43\x00\x04\x00\x04\xb9\x84\x40\xb6\xa0\x04\x39\x84\x40\x36\xa0\x00\x04", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x3e\xc3\x00\x40\x87\xa0\x80\x14\x43\x3e\xc6\x00\x40\x07\xa0\x00\x14\x43\x00\x04\x00\x00\x00\x00\x04\xf5\x84\x00\x00\x21\x70\x03", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\xf5\x84\x10\x00\x08\x40\xf3\x90\x40\xf5\xa0\x3e\xd2\x00\x40\x85\xa0\x88\x14\x43\x3e\xd5\x00\x40\x05\xa0\x08\x14\x43\x00\x04", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8000, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x01\x07\x00\x02\x07\x00\x03\x07\x00\x04\x07\x00\x06\x07\x00\x16\x07\x00\x1e\x07\x00\x24\x07\x00\x3c\x07\x00\x72\x07\x00\x8d", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\xe0\x07\x00\xf6\x07\x01\x9f\x07\x01\xd1\x07\x00\x10\x07\x1f\xff\x07\x20\x03\x60\x0f\x5f\x07\x08\xfa\x84\x04\x11\x44\xff\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x2f\x63\x07\x70\x10\x08\x00\xf0\x21\x50\x00\x08\x00\xf0\x21\x40\xf9\x90\x00\x08\x07\x3e\x79\x00\x0f\x6b\x07\x90\x01\x07\x40\xf9", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x80a0, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x3f\x6e\x07\x70\x00\x08\x00\x7f\x11\x40\xf8\xa0\x9d\x07\x07\x20\x12\x60\x08\xfa\x84\x04\x11\x44\x3e\x54\x00\x00\x16\x07\x48\x80", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x08\x09\x44\x40\x75\x90\x7f\xef\x07\x10\x00\x20\x00\x10\x08\xff\xff\x21\x06\x00\x84\x40\xfb\xa0\x60\x00\x08\x00\x00\x21\x40\xff", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8090, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\xfb\x84\x60\x20\x08\x40\xfb\x90\x30\x00\x08\x00\x08\x11\x3d\xea\x00\x04\xfb\x84\x3d\xec\x00\x04\xff\x84\x40\xf8\xa0\x04\x11", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8044, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x8f\xff\x07\x20\x19\x60\x3e\xd2\x00\x00\x31\x07\x00\x01\x00\x00\x33\x07\x00\x02\x00\x27\x18\x43\x75\x00\x43\x8f\xff\x07\x20\x19", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8060, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x04\xf5\x84\x40\xf2\xa0\x04\x51\x84\x7f\xff\x21\x04\xf5\x84\x00\x00\x21\x04\xf3\x84\x00\x10\x21\x04\xf2\x84\x0c\x00\x21\x04\x72", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8044, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x77\x21\x3f\xfa\x07\x70\x20\x08\x00\x00\x11\x10\x2d\x44\x10\x2c\x44\x00\x20\x08\x10\x00\x11\x00\x00\x08\x00\x00\x11\x80\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8021, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x04\x73\x44\x07\x07\x21\x04\x72\x44\x00\x07\x21\x04\x73\x44\x07\x77\x21\x04\x73\x44\x00\x70\x21\x04\x2e\x44\x04\x2d\x44\x04\x2c", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8044, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x80\x00\x21\x04\x1c\x44\x04\x1b\x44\x0d\x00\x21\x04\x1c\x44\x04\x1b\x44\x0c\x80\x21\x04\x1c\x44\x04\x1b\x44\x1f\x08\x21\x0f\x18", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8043, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x08\x28\x44\x01\x11\x11\x08\x5d\x84\x10\x00\x10\x10\x00\x08\x40\x00\x21\x30\x04\x07\x40\xff\x90\x50\x20\x08\xc0\x00\x11\x10\xff", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8084, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x20\x08\x00\x40\x11\x40\x00\x08\x00\x01\x11\x20\x51\x60\x10\x00\x44\x60\x00\x08\x40\x54\x90\x20\x00\x60\x00\x79\x07\x81\x48", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x80\x03\x07\x40\xf8\xa0\x48\xc0\x11\x00\x77\x07\x00\x78\x07\x00\x79\x07\x00\x04\x07\x00\x7b\x07\x00\x7c\x07\x00\x7d\x07\x00\x55", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8007, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x7f\x07\x00\x80\x07\x00\x81\x07\x00\x74\x07\x00\x83\x07\x00\x82\x07\x00\x85\x07\x00\x86\x07\x0f\xef\x07\x1f\xff\x07\xff\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8011, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x10\x00\x20\x30\x10\x08\x00\x01\x21\x50\x00\x08\x00\x0f\x21\x40\xf9\x90\x30\x90\x07\x70\x10\x08\x00\x80\x21\x50\x00\x08\x00\xf0", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8021, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x08\xf9\x84\x04\xf8\x84\x2f\xff\x07\x3e\x59\x00\x04\xf1\x84\x04\xf0\x84\x04\x5a\x84\x00\x00\x21\x04\xf6\x84\x00\x02\x21\x04\xfa", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8084, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x40\x00\x21\x04\xf7\x84\x01\x04\x21\x04\x1c\x44\x04\x1b\x44\x0b\x23\x21\x0f\x18\x43\x04\x70\x44\x06\x66\x21\x04\x3b\x44\x04\x39", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8044, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x80\x21\x04\x3c\x44\x2a\x0a\x21\x04\x2f\x44\x00\x44\x21\x04\x29\x44\x00\x00\x21\x03\x19\x42\x4e\x19\x43\x0c\x59\x43\x27\x18", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8043, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x15\x00\x43\x04\x22\x44\x03\x07\x21\x04\x21\x44\x11\x11\x21\x04\x20\x44\x33\x33\x21\x00\x00\x42\xc0\x3d\x42\x80\x3d\x43\x04\x35", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8044, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x21\x04\x05\x43\x42\xcd\x00", + .reg_data_seq_size = 9, + },{ + .reg_addr = 0x88ef, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x20\x00\x18\x00\x00\x00\x00\xab\x0a\x00\x40\x00\x40\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x27\x83\x64\x7e\xca\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x88b2, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x7f\x59\x7f\xbe\x7f\xfe\x7f\xfe\x7f\xee\x73\x54\x4c\x70\x5a\x00\x6b\x0e\x6b\x1c\x5b\xcb\x32\x8c\x0b\xd2\x13\x07\x28\x01\x49\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8800, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\xff\x7f\x0b\x97\x14\xae\xf7\x53\x26\x63\x07\x46\x00\x20\x00\x89\x00\x40\x80\x41\x00\x7f\xff\x7f\xd3\x09\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x88ff, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x7f\x00\x00\x00\x00\x90\xcb\x70\x74\xfe\x7f\x52\x09\x00\x00\xfe\x7f\x00\x00\x00\x00\x00\xf2\x00\x40\xf0\x7f\x00\x0c\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8800, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x4a\x00\x4a\x00\x24\xff\x7f\x00\x00\x00\x00\x00\x00\x00\x00\xff\x7f\x00\x00\x00\x50\x00\x30\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8800, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\xa0\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\xff\x7f\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8800, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\xff\x7f\x00\x78\x00\x08\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\xff\x7f\x00\x40\x00\x40\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8800, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x80\xff\x7f\x1c\x1b\xc5\x07\xc0\x20\x12\xf0\x00\x10\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8800, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\xcc\x59\x00\x00\x00\x40\x00\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8800, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\xff\x7f\x0b", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8897, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x14\xae\xf7\x53\x26\x63\x07\x46\x00\x20\x00\x89\x00\x40\x80\x41\x00\x7f\xff\x7f\xd3\x09\x00\x00\xff\x7f\x00\x00\x00\x00\x90\xcb", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8870, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x74\xfe\x7f\x52\x09\x00\x00\xfe\x7f\x00\x00\x00\x00\x00\xf2\x00\x40\xf0\x7f\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4a\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x884a, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x24\xff\x7f\x00\x00\x00\x00\x00\x00\x00\x00\xff\x7f\x00\x00\x00\x50\x00\x30\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x00\x00\x03", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8800, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\xff\x7f\x00\x00\x00\x00\x00\x00\xff\x7f\x00", + .reg_data_seq_size = 32, + },{ + .reg_addr = 0x8878, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0000, + .data_type = MSM_CAMERA_I2C_SEQ_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "\x00\x08\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\xff\x7f\x00\x40\x00\x40", + .reg_data_seq_size = 18, + },{ + .reg_addr = 0x8205, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0c00, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8205, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0d00, + .data_type = MSM_CAMERA_I2C_WORD_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + },{ + .reg_addr = 0x8c01, + .addr_type = MSM_CAMERA_I2C_WORD_ADDR, + .reg_data = 0x0001, + .data_type = MSM_CAMERA_I2C_BYTE_DATA, + .i2c_operation = MSM_OIS_WRITE, + .delay = 0, + .reg_data_seq = "", + .reg_data_seq_size = 0, + } +}; + + +/* +// still mode settings: + {0x847f, 0x0c0c,}, //_M_EQCTL + + {0x8436, 0xfd7f,}, //_M_Kgxdr + {0x8440, 0xf07f,}, //_M_X_LMT + {0x8443, 0xb41e,}, //_M_X_TGT + {0x841b, 0x4001,}, //_M_Kgx10 + + {0x84b6, 0xfd7f,}, //_M_Kgydr + {0x84c0, 0xf07f,}, //_M_Y_LMT + {0x84c3, 0xb41e,}, //_M_Y_TGT + {0x849b, 0x4001,}, //_M_Kgy10 + + {0x8438, 0x2d0f,}, //_M_Kgx11 + {0x84b8, 0x2d0f,}, //_M_Kgy11 + {0x8447, 0x002b,}, //_M_KgxTG + {0x84c7, 0x002b,}, //_M_KgyTG + + {0x847f, 0x0d0d,}, //_M_EQCTL +*/ + +static struct msm_camera_i2c_reg_array init_array_s5k3p8sp[] = { + {0x6028,0x2000,0}, {0x6214,0x7971,0}, {0x6218,0x7150,0}, {0x30e,0x3d,0}, + {0x6028,0x2000,0}, {0x602a,0x2f38,0}, {0x6f12,0x88,0}, {0x6f12,0xd70,0}, + {0x344,0x18,0}, + {0x348,0x1217,0}, // last_pixel = 0x90C*2 + {0x346,0x18,0}, + {0x34a,0xd97,0}, // last_line = 0x6CC*2 + {0x34c,0x900,0}, // width? + {0x34e,0x6c0,0}, // height? + {0x342,0x1400,0}, // line_length_pclk + {0x340,0xe3b,0}, // frame_length_lines + {0x202,0x200,0}, // integ_time + {0x200,0x618,0}, + {0x900,0x122,0}, {0x380,0x1,0}, {0x382,0x3,0}, {0x384,0x3,0}, {0x386,0x1,0}, {0x400,0x0,0}, {0x404,0x10,0}, + {0x3604,0x2,0}, {0x3606,0x103,0}, {0xf496,0x48,0}, {0xf470,0x20,0}, {0xf43a,0x15,0}, {0xf484,0x6,0}, {0xf440,0xaf,0}, {0xf442,0x44c6,0}, + {0xf408,0xfff7,0}, {0x3664,0x19,0}, {0xf494,0x1010,0}, {0x367a,0x100,0}, {0x362a,0x104,0}, {0x362e,0x404,0}, {0x32b2,0x8,0}, {0x3286,0x3,0}, {0x328a,0x5,0}, + {0xf47c,0x1f,0}, {0xf62e,0xc5,0}, {0xf630,0xcd,0}, {0xf632,0xdd,0}, {0xf634,0xe5,0}, {0xf636,0xf5,0}, {0xf638,0xfd,0}, {0xf63a,0x10d,0}, {0xf63c,0x115,0}, {0xf63e,0x125,0}, {0xf640,0x12d,0}, + {0x6028,0x2000,0}, {0x602a,0x1704,0}, {0x6f12,0x8011,0}, {0x3070,0x0,0}, {0xb0e,0x0,0}, {0x317a,0x7,0}, {0x31c0,0xc8,0}, {0x1006,0x4,0}, {0x31a4,0x102,0}, +}; + +static struct msm_camera_i2c_reg_array init_array_ov8865[] = { +// round 1 +//{0x103,0x1,0}, // software reset +{0x100,0x0,0}, // standby on +{0x3638,0xff,0}, +{0x302,0x1e,0}, {0x303,0x0,0}, {0x304,0x3,0}, {0x30d,0x1e,0}, {0x30e,0x0,0}, {0x30f,0x9,0}, {0x312,0x1,0}, {0x31e,0xc,0}, // PLL control +{0x3015,0x1,0}, {0x3018,0x72,0}, {0x3020,0x93,0}, {0x3022,0x1,0}, +{0x3031,0xa,0}, // 10-bit mode +{0x3106,0x1,0}, {0x3305,0xf1,0}, {0x3308,0x0,0}, {0x3309,0x28,0}, {0x330a,0x0,0}, {0x330b,0x20,0}, {0x330c,0x0,0}, {0x330d,0x0,0}, {0x330e,0x0,0}, {0x330f,0x40,0}, {0x3307,0x4,0}, {0x3604,0x4,0}, {0x3602,0x30,0}, {0x3605,0x0,0}, {0x3607,0x20,0}, {0x3608,0x11,0}, {0x3609,0x68,0}, {0x360a,0x40,0}, {0x360c,0xdd,0}, {0x360e,0xc,0}, {0x3610,0x7,0}, {0x3612,0x86,0}, {0x3613,0x58,0}, {0x3614,0x28,0}, {0x3617,0x40,0}, {0x3618,0x5a,0}, {0x3619,0x9b,0}, {0x361c,0x0,0}, {0x361d,0x60,0}, {0x3631,0x60,0}, {0x3633,0x10,0}, {0x3634,0x10,0}, {0x3635,0x10,0}, {0x3636,0x10,0}, {0x3641,0x55,0}, {0x3646,0x86,0}, {0x3647,0x27,0}, {0x364a,0x1b,0}, {0x3500,0x0,0}, {0x3501,0x4c,0}, {0x3502,0x0,0}, {0x3503,0x0,0}, {0x3508,0x2,0}, +{0x3509,0x0,0}, // AEC GAIN +{0x3700,0x24,0}, {0x3701,0xc,0}, {0x3702,0x28,0}, {0x3703,0x19,0}, {0x3704,0x14,0}, {0x3705,0x0,0}, {0x3706,0x38,0}, {0x3707,0x4,0}, {0x3708,0x24,0}, {0x3709,0x40,0}, {0x370a,0x0,0}, {0x370b,0xb8,0}, {0x370c,0x4,0}, {0x3718,0x12,0}, {0x3719,0x31,0}, {0x3712,0x42,0}, {0x3714,0x12,0}, {0x371e,0x19,0}, {0x371f,0x40,0}, {0x3720,0x5,0}, {0x3721,0x5,0}, {0x3724,0x2,0}, {0x3725,0x2,0}, {0x3726,0x6,0}, {0x3728,0x5,0}, {0x3729,0x2,0}, {0x372a,0x3,0}, {0x372b,0x53,0}, {0x372c,0xa3,0}, {0x372d,0x53,0}, {0x372e,0x6,0}, {0x372f,0x10,0}, {0x3730,0x1,0}, {0x3731,0x6,0}, {0x3732,0x14,0}, {0x3733,0x10,0}, {0x3734,0x40,0}, {0x3736,0x20,0}, {0x373a,0x2,0}, {0x373b,0xc,0}, {0x373c,0xa,0}, {0x373e,0x3,0}, {0x3755,0x40,0}, {0x3758,0x0,0}, {0x3759,0x4c,0}, {0x375a,0x6,0}, {0x375b,0x13,0}, {0x375c,0x40,0}, {0x375d,0x2,0}, {0x375e,0x0,0}, {0x375f,0x14,0}, {0x3767,0x1c,0}, {0x3768,0x4,0}, {0x3769,0x20,0}, {0x376c,0xc0,0}, {0x376d,0xc0,0}, {0x376a,0x8,0}, {0x3761,0x0,0}, {0x3762,0x0,0}, {0x3763,0x0,0}, {0x3766,0xff,0}, {0x376b,0x42,0}, {0x3772,0x23,0}, {0x3773,0x2,0}, {0x3774,0x16,0}, {0x3775,0x12,0}, {0x3776,0x8,0}, {0x37a0,0x44,0}, {0x37a1,0x3d,0}, {0x37a2,0x3d,0}, {0x37a3,0x1,0}, {0x37a4,0x0,0}, {0x37a5,0x8,0}, {0x37a6,0x0,0}, {0x37a7,0x44,0}, {0x37a8,0x58,0}, {0x37a9,0x58,0}, {0x3760,0x0,0}, {0x376f,0x1,0}, {0x37aa,0x44,0}, {0x37ab,0x2e,0}, {0x37ac,0x2e,0}, {0x37ad,0x33,0}, {0x37ae,0xd,0}, {0x37af,0xd,0}, {0x37b0,0x0,0}, {0x37b1,0x0,0}, {0x37b2,0x0,0}, {0x37b3,0x42,0}, {0x37b4,0x42,0}, {0x37b5,0x33,0}, {0x37b6,0x0,0}, {0x37b7,0x0,0}, {0x37b8,0x0,0}, {0x37b9,0xff,0}, {0x3800,0x0,0}, {0x3801,0xc,0}, {0x3802,0x0,0}, {0x3803,0xc,0}, +{0x3804,0xc,0}, {0x3805,0xd3,0}, // 3283 +{0x3806,0x9,0}, {0x3807,0xa3,0}, // 2467 +{0x3808,0x6,0}, {0x3809,0x60,0}, // 0x660 = 1632 (width) +{0x380a,0x4,0}, {0x380b,0xc8,0}, // 0x4c8 = 1224 (height) +{0x380c,0x7,0}, {0x380d,0x83,0}, // 0x783 = 1923 (stride) +{0x380e,0x4,0}, {0x380f,0xe0,0}, // 0x4e0 = 1248 (vstride) +{0x3810,0x0,0}, {0x3811,0x4,0}, {0x3813,0x4,0}, +{0x3814,0x3,0}, {0x3815,0x1,0}, // H-binning +{0x3820,0x6,0}, // format1 +{0x3821,0x40,0}, // format2 +{0x382a,0x3,0}, {0x382b,0x1,0}, // V-binning +{0x382d,0x7f,0}, {0x3830,0x8,0}, {0x3836,0x2,0}, {0x3837,0x18,0}, +{0x3841,0xff,0}, +{0x3846,0x88,0}, {0x3d85,0x6,0}, {0x3d8c,0x75,0}, {0x3d8d,0xef,0}, {0x3f08,0xb,0}, {0x4000,0xf1,0}, {0x4001,0x14,0}, {0x4005,0x10,0}, {0x4006,0x1,0}, {0x4007,0x1,0}, {0x400b,0xc,0}, {0x400d,0x10,0}, {0x401b,0x0,0}, {0x401d,0x0,0}, {0x4020,0x0,0}, {0x4021,0x0,0}, {0x4022,0x4,0}, {0x4023,0x1f,0}, {0x4024,0x6,0}, {0x4025,0x20,0}, {0x4026,0x6,0}, {0x4027,0x4f,0}, {0x4028,0x0,0}, {0x4029,0x2,0}, {0x402a,0x4,0}, {0x402b,0x4,0}, {0x402c,0x2,0}, {0x402d,0x2,0}, {0x402e,0x8,0}, {0x402f,0x2,0}, {0x401f,0x0,0}, {0x4034,0x3f,0}, {0x4300,0xff,0}, {0x4301,0x0,0}, {0x4302,0xf,0}, {0x4500,0x40,0}, {0x4503,0x10,0}, {0x4601,0x74,0}, {0x481f,0x32,0}, {0x4837,0x15,0}, {0x4850,0x10,0}, {0x4851,0x32,0}, {0x4b00,0x2a,0}, {0x4b0d,0x0,0}, {0x4d00,0x4,0}, {0x4d01,0x18,0}, {0x4d02,0xc3,0}, {0x4d03,0xff,0}, {0x4d04,0xff,0}, {0x4d05,0xff,0}, {0x5000,0x96,0}, {0x5001,0x1,0}, {0x5002,0x8,0}, {0x5901,0x0,0}, +{0x5e00,0x0,0}, +//{0x5e00,0x80,0}, +{0x5e01,0x41,0}, {0x5b00,0x2,0}, {0x5b01,0xd0,0}, {0x5b02,0x3,0}, {0x5b03,0xff,0}, {0x5b05,0x6c,0}, {0x5780,0xfc,0}, {0x5781,0xdf,0}, {0x5782,0x3f,0}, {0x5783,0x8,0}, {0x5784,0xc,0}, {0x5786,0x20,0}, {0x5787,0x40,0}, {0x5788,0x8,0}, {0x5789,0x8,0}, {0x578a,0x2,0}, {0x578b,0x1,0}, {0x578c,0x1,0}, {0x578d,0xc,0}, {0x578e,0x2,0}, {0x578f,0x1,0}, {0x5790,0x1,0}, {0x5800,0x1d,0}, {0x5801,0xe,0}, {0x5802,0xc,0}, {0x5803,0xc,0}, {0x5804,0xf,0}, {0x5805,0x22,0}, {0x5806,0xa,0}, {0x5807,0x6,0}, {0x5808,0x5,0}, {0x5809,0x5,0}, {0x580a,0x7,0}, {0x580b,0xa,0}, {0x580c,0x6,0}, {0x580d,0x2,0}, {0x580e,0x0,0}, {0x580f,0x0,0}, {0x5810,0x3,0}, {0x5811,0x7,0}, {0x5812,0x6,0}, {0x5813,0x2,0}, {0x5814,0x0,0}, {0x5815,0x0,0}, {0x5816,0x3,0}, {0x5817,0x7,0}, {0x5818,0x9,0}, {0x5819,0x6,0}, {0x581a,0x4,0}, {0x581b,0x4,0}, {0x581c,0x6,0}, {0x581d,0xa,0}, {0x581e,0x19,0}, {0x581f,0xd,0}, {0x5820,0xb,0}, {0x5821,0xb,0}, {0x5822,0xe,0}, {0x5823,0x22,0}, {0x5824,0x23,0}, {0x5825,0x28,0}, {0x5826,0x29,0}, {0x5827,0x27,0}, {0x5828,0x13,0}, {0x5829,0x26,0}, {0x582a,0x33,0}, {0x582b,0x32,0}, {0x582c,0x33,0}, {0x582d,0x16,0}, {0x582e,0x14,0}, {0x582f,0x30,0}, {0x5830,0x31,0}, {0x5831,0x30,0}, {0x5832,0x15,0}, {0x5833,0x26,0}, {0x5834,0x23,0}, {0x5835,0x21,0}, {0x5836,0x23,0}, {0x5837,0x5,0}, {0x5838,0x36,0}, {0x5839,0x27,0}, {0x583a,0x28,0}, {0x583b,0x26,0}, {0x583c,0x24,0}, {0x583d,0xdf,0}, +//{0x100,0x1,0}, +// round 2 (color calibration) +{0x7010,0x0,0}, {0x7011,0x0,0}, {0x7012,0x0,0}, {0x7013,0x0,0}, {0x7014,0x0,0}, {0x7015,0x0,0}, {0x7016,0x0,0}, {0x7017,0x0,0}, {0x7018,0x0,0}, {0x7019,0x0,0}, {0x701a,0x0,0}, {0x701b,0x0,0}, {0x701c,0x0,0}, {0x701d,0x0,0}, {0x701e,0x0,0}, {0x701f,0x0,0}, {0x7020,0x0,0}, {0x7021,0x0,0}, {0x7022,0x0,0}, {0x7023,0x0,0}, {0x7024,0x0,0}, {0x7025,0x0,0}, {0x7026,0x0,0}, {0x7027,0x0,0}, {0x7028,0x0,0}, {0x7029,0x0,0}, {0x702a,0x0,0}, {0x702b,0x0,0}, {0x702c,0x0,0}, {0x702d,0x0,0}, {0x702e,0x0,0}, {0x702f,0x0,0}, {0x7030,0x0,0}, {0x7031,0x0,0}, {0x7032,0x0,0}, {0x7033,0x0,0}, {0x7034,0x0,0}, {0x7035,0x0,0}, {0x7036,0x0,0}, {0x7037,0x0,0}, {0x7038,0x0,0}, {0x7039,0x0,0}, {0x703a,0x0,0}, {0x703b,0x0,0}, {0x703c,0x0,0}, {0x703d,0x0,0}, {0x703e,0x0,0}, {0x703f,0x0,0}, {0x7040,0x0,0}, {0x7041,0x0,0}, {0x7042,0x0,0}, {0x7043,0x0,0}, {0x7044,0x0,0}, {0x7045,0x0,0}, {0x7046,0x0,0}, {0x7047,0x0,0}, {0x7048,0x0,0}, {0x7049,0x0,0}, {0x704a,0x0,0}, {0x704b,0x0,0}, {0x704c,0x0,0}, {0x704d,0x0,0}, {0x704e,0x0,0}, {0x704f,0x0,0}, {0x7050,0x0,0}, {0x7051,0x0,0}, {0x7052,0x0,0}, {0x7053,0x0,0}, {0x7054,0x0,0}, {0x7055,0x0,0}, {0x7056,0x0,0}, {0x7057,0x0,0}, {0x7058,0x0,0}, {0x7059,0x0,0}, {0x705a,0x0,0}, {0x705b,0x0,0}, {0x705c,0x0,0}, {0x705d,0x0,0}, {0x705e,0x0,0}, {0x705f,0x0,0}, {0x7060,0x0,0}, {0x7061,0x0,0}, {0x7062,0x0,0}, {0x7063,0x0,0}, {0x7064,0x0,0}, {0x7065,0x0,0}, {0x7066,0x0,0}, {0x7067,0x0,0}, {0x7068,0x0,0}, {0x7069,0x0,0}, {0x706a,0x0,0}, {0x706b,0x0,0}, {0x706c,0x0,0}, {0x706d,0x0,0}, {0x706e,0x0,0}, {0x706f,0x0,0}, {0x7070,0x0,0}, {0x7071,0x0,0}, {0x7072,0x0,0}, {0x7073,0x0,0}, {0x7074,0x0,0}, {0x7075,0x0,0}, {0x7076,0x0,0}, {0x7077,0x0,0}, {0x7078,0x0,0}, {0x7079,0x0,0}, {0x707a,0x0,0}, {0x707b,0x0,0}, {0x707c,0x0,0}, {0x707d,0x0,0}, {0x707e,0x0,0}, {0x707f,0x0,0}, {0x7080,0x0,0}, {0x7081,0x0,0}, {0x7082,0x0,0}, {0x7083,0x0,0}, {0x7084,0x0,0}, {0x7085,0x0,0}, {0x7086,0x0,0}, {0x7087,0x0,0}, {0x7088,0x0,0}, {0x7089,0x0,0}, {0x708a,0x0,0}, {0x708b,0x0,0}, {0x708c,0x0,0}, {0x708d,0x0,0}, {0x708e,0x0,0}, {0x708f,0x0,0}, {0x7090,0x0,0}, {0x7091,0x0,0}, {0x7092,0x0,0}, {0x7093,0x0,0}, {0x7094,0x0,0}, {0x7095,0x0,0}, {0x7096,0x0,0}, {0x7097,0x0,0}, {0x7098,0x0,0}, {0x7099,0x0,0}, {0x709a,0x0,0}, {0x709b,0x0,0}, {0x709c,0x0,0}, {0x709d,0x0,0}, {0x709e,0x0,0}, {0x709f,0x0,0}, {0x70a0,0x0,0}, {0x70a1,0x0,0}, {0x70a2,0x0,0}, {0x70a3,0x0,0}, {0x70a4,0x0,0}, {0x70a5,0x0,0}, {0x70a6,0x0,0}, {0x70a7,0x0,0}, {0x70a8,0x0,0}, {0x70a9,0x0,0}, {0x70aa,0x0,0}, {0x70ab,0x0,0}, {0x70ac,0x0,0}, {0x70ad,0x0,0}, {0x70ae,0x0,0}, {0x70af,0x0,0}, {0x70b0,0x0,0}, {0x70b1,0x0,0}, {0x70b2,0x0,0}, {0x70b3,0x0,0}, {0x70b4,0x0,0}, {0x70b5,0x0,0}, {0x70b6,0x0,0}, {0x70b7,0x0,0}, {0x70b8,0x0,0}, {0x70b9,0x0,0}, {0x70ba,0x0,0}, {0x70bb,0x0,0}, {0x70bc,0x0,0}, {0x70bd,0x0,0}, {0x70be,0x0,0}, {0x70bf,0x0,0}, {0x70c0,0x0,0}, {0x70c1,0x0,0}, {0x70c2,0x0,0}, {0x70c3,0x0,0}, {0x70c4,0x0,0}, {0x70c5,0x0,0}, {0x70c6,0x0,0}, {0x70c7,0x0,0}, {0x70c8,0x0,0}, {0x70c9,0x0,0}, {0x70ca,0x0,0}, {0x70cb,0x0,0}, {0x70cc,0x0,0}, {0x70cd,0x0,0}, {0x70ce,0x0,0}, {0x70cf,0x0,0}, {0x70d0,0x0,0}, {0x70d1,0x0,0}, {0x70d2,0x0,0}, {0x70d3,0x0,0}, {0x70d4,0x0,0}, {0x70d5,0x0,0}, {0x70d6,0x0,0}, {0x70d7,0x0,0}, {0x70d8,0x0,0}, {0x70d9,0x0,0}, {0x70da,0x0,0}, {0x70db,0x0,0}, {0x70dc,0x0,0}, {0x70dd,0x0,0}, {0x70de,0x0,0}, {0x70df,0x0,0}, {0x70e0,0x0,0}, {0x70e1,0x0,0}, {0x70e2,0x0,0}, {0x70e3,0x0,0}, {0x70e4,0x0,0}, {0x70e5,0x0,0}, {0x70e6,0x0,0}, {0x70e7,0x0,0}, {0x70e8,0x0,0}, {0x70e9,0x0,0}, {0x70ea,0x0,0}, {0x70eb,0x0,0}, {0x70ec,0x0,0}, {0x70ed,0x0,0}, {0x70ee,0x0,0}, {0x70ef,0x0,0}, {0x70f0,0x0,0}, {0x70f1,0x0,0}, {0x70f2,0x0,0}, {0x70f3,0x0,0}, {0x70f4,0x0,0}, {0x70f5,0x0,0}, {0x70f6,0x0,0}, {0x70f7,0x0,0}, {0x70f8,0x0,0}, {0x70f9,0x0,0}, {0x70fa,0x0,0}, {0x70fb,0x0,0}, {0x70fc,0x0,0}, {0x70fd,0x0,0}, {0x70fe,0x0,0}, {0x70ff,0x0,0}, {0x7100,0x0,0}, {0x7101,0x0,0}, {0x7102,0x0,0}, {0x7103,0x0,0}, {0x7104,0x0,0}, {0x7105,0x0,0}, {0x7106,0x0,0}, {0x7107,0x0,0}, {0x7108,0x0,0}, {0x7109,0x0,0}, {0x710a,0x0,0}, {0x710b,0x0,0}, {0x710c,0x0,0}, {0x710d,0x0,0}, {0x710e,0x0,0}, {0x710f,0x0,0}, {0x7110,0x0,0}, {0x7111,0x0,0}, {0x7112,0x0,0}, {0x7113,0x0,0}, {0x7114,0x0,0}, {0x7115,0x0,0}, {0x7116,0x0,0}, {0x7117,0x0,0}, {0x7118,0x0,0}, {0x7119,0x0,0}, {0x711a,0x0,0}, {0x711b,0x0,0}, {0x711c,0x0,0}, {0x711d,0x0,0}, {0x711e,0x0,0}, {0x711f,0x0,0}, {0x7120,0x0,0}, {0x7121,0x0,0}, {0x7122,0x0,0}, {0x7123,0x0,0}, {0x7124,0x0,0}, {0x7125,0x0,0}, {0x7126,0x0,0}, {0x7127,0x0,0}, {0x7128,0x0,0}, {0x7129,0x0,0}, {0x712a,0x0,0}, {0x712b,0x0,0}, {0x712c,0x0,0}, {0x712d,0x0,0}, {0x712e,0x0,0}, {0x712f,0x0,0}, {0x7130,0x0,0}, {0x7131,0x0,0}, {0x7132,0x0,0}, {0x501a,0x10,0}, {0x501b,0xd,0}, {0x501c,0x10,0}, {0x501d,0x13,0}, {0x5000,0x96,0}, {0x5800,0x14,0}, {0x5801,0xd,0}, {0x5802,0xa,0}, {0x5803,0xa,0}, {0x5804,0xd,0}, {0x5805,0x13,0}, {0x5806,0xa,0}, {0x5807,0x5,0}, {0x5808,0x3,0}, {0x5809,0x3,0}, {0x580a,0x5,0}, {0x580b,0x9,0}, {0x580c,0x6,0}, {0x580d,0x2,0}, {0x580e,0x0,0}, {0x580f,0x0,0}, {0x5810,0x2,0}, {0x5811,0x5,0}, {0x5812,0x6,0}, {0x5813,0x2,0}, {0x5814,0x0,0}, {0x5815,0x0,0}, {0x5816,0x2,0}, {0x5817,0x5,0}, {0x5818,0xb,0}, {0x5819,0x6,0}, {0x581a,0x3,0}, {0x581b,0x3,0}, {0x581c,0x5,0}, {0x581d,0xa,0}, {0x581e,0x16,0}, {0x581f,0xf,0}, {0x5820,0xb,0}, {0x5821,0xb,0}, {0x5822,0xf,0}, {0x5823,0x15,0}, {0x5824,0x32,0}, {0x5825,0x23,0}, {0x5826,0x23,0}, {0x5827,0x23,0}, {0x5828,0x22,0}, {0x5829,0x21,0}, {0x582a,0x21,0}, {0x582b,0x22,0}, {0x582c,0x21,0},{0x582d,0x11,0}, {0x582e,0x22,0}, {0x582f,0x31,0}, {0x5830,0x41,0}, {0x5831,0x31,0}, {0x5832,0x1,0}, {0x5833,0x21,0}, {0x5834,0x21,0}, {0x5835,0x21,0}, {0x5836,0x11,0}, {0x5837,0x11,0}, {0x5838,0x22,0}, {0x5839,0x22,0}, {0x583a,0x12,0}, {0x583b,0x22,0}, {0x583c,0x22,0}, {0x583d,0xdf,0}, +}; + diff --git a/selfdrive/visiond/snpemodel.cc b/selfdrive/visiond/snpemodel.cc new file mode 100644 index 00000000000000..ae7b7f10a1531e --- /dev/null +++ b/selfdrive/visiond/snpemodel.cc @@ -0,0 +1,94 @@ +#include "snpemodel.h" + +void PrintErrorStringAndExit() { + const char* const errStr = zdl::DlSystem::getLastErrorString(); + std::cerr << zdl::DlSystem::getLastErrorString() << std::endl; + std::exit(EXIT_FAILURE); +} + +SNPEModel::SNPEModel(const uint8_t *model_data, const size_t model_size, float *output, size_t output_size) { + assert(zdl::SNPE::SNPEFactory::isRuntimeAvailable(zdl::DlSystem::Runtime_t::GPU)); + + // load model + std::unique_ptr container = zdl::DlContainer::IDlContainer::open(model_data, model_size); + if (!container) { PrintErrorStringAndExit(); } + printf("loaded model with size: %d\n", model_size); + + // create model runner + zdl::SNPE::SNPEBuilder snpeBuilder(container.get()); + while (!snpe) { + snpe = snpeBuilder.setOutputLayers({}) + .setRuntimeProcessor(zdl::DlSystem::Runtime_t::GPU) + .setUseUserSuppliedBuffers(true) + .setPerformanceProfile(zdl::DlSystem::PerformanceProfile_t::HIGH_PERFORMANCE) + .build(); + if (!snpe) std::cerr << zdl::DlSystem::getLastErrorString() << std::endl; + } + + // get input and output names + const auto &strListi_opt = snpe->getInputTensorNames(); + if (!strListi_opt) throw std::runtime_error("Error obtaining Input tensor names"); + const auto &strListi = *strListi_opt; + //assert(strListi.size() == 1); + const char *input_tensor_name = strListi.at(0); + + const auto &strListo_opt = snpe->getOutputTensorNames(); + if (!strListo_opt) throw std::runtime_error("Error obtaining Output tensor names"); + const auto &strListo = *strListo_opt; + assert(strListo.size() == 1); + const char *output_tensor_name = strListo.at(0); + + printf("model: %s -> %s\n", input_tensor_name, output_tensor_name); + + zdl::DlSystem::UserBufferEncodingFloat userBufferEncodingFloat; + zdl::DlSystem::IUserBufferFactory& ubFactory = zdl::SNPE::SNPEFactory::getUserBufferFactory(); + + // create input buffer + { + const auto &inputDims_opt = snpe->getInputDimensions(input_tensor_name); + const zdl::DlSystem::TensorShape& bufferShape = *inputDims_opt; + std::vector strides(bufferShape.rank()); + strides[strides.size() - 1] = sizeof(float); + size_t product = 1; + for (size_t i = 0; i < bufferShape.rank(); i++) product *= bufferShape[i]; + size_t stride = strides[strides.size() - 1]; + for (size_t i = bufferShape.rank() - 1; i > 0; i--) { + stride *= bufferShape[i]; + strides[i-1] = stride; + } + printf("input product is %u\n", product); + inputBuffer = ubFactory.createUserBuffer(NULL, product*sizeof(float), strides, &userBufferEncodingFloat); + + inputMap.add(input_tensor_name, inputBuffer.get()); + } + + // create output buffer + { + std::vector outputStrides = {output_size * sizeof(float), sizeof(float)}; + outputBuffer = ubFactory.createUserBuffer(output, output_size * sizeof(float), outputStrides, &userBufferEncodingFloat); + outputMap.add(output_tensor_name, outputBuffer.get()); + } +} + +void SNPEModel::addRecurrent(float *state, int state_size) { + // get input and output names + const auto &strListi_opt = snpe->getInputTensorNames(); + if (!strListi_opt) throw std::runtime_error("Error obtaining Input tensor names"); + const auto &strListi = *strListi_opt; + const char *input_tensor_name = strListi.at(1); + printf("adding recurrent: %s\n", input_tensor_name); + + zdl::DlSystem::UserBufferEncodingFloat userBufferEncodingFloat; + zdl::DlSystem::IUserBufferFactory& ubFactory = zdl::SNPE::SNPEFactory::getUserBufferFactory(); + std::vector recurrentStrides = {state_size * sizeof(float), sizeof(float)}; + recurrentBuffer = ubFactory.createUserBuffer(state, state_size * sizeof(float), recurrentStrides, &userBufferEncodingFloat); + inputMap.add(input_tensor_name, recurrentBuffer.get()); +} + +void SNPEModel::execute(float *net_input_buf) { + assert(inputBuffer->setBufferAddress(net_input_buf)); + if (!snpe->execute(inputMap, outputMap)) { + PrintErrorStringAndExit(); + } +} + diff --git a/selfdrive/visiond/snpemodel.h b/selfdrive/visiond/snpemodel.h new file mode 100644 index 00000000000000..a7fc6083db3541 --- /dev/null +++ b/selfdrive/visiond/snpemodel.h @@ -0,0 +1,37 @@ +#ifndef SNPEMODEL_H +#define SNPEMODEL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SNPEModel { +public: + SNPEModel(const uint8_t *model_data, const size_t model_size, float *output, size_t output_size); + void addRecurrent(float *state, int state_size); + void execute(float *net_input_buf); +private: + // snpe model stuff + std::unique_ptr snpe; + + // snpe input stuff + zdl::DlSystem::UserBufferMap inputMap; + std::unique_ptr inputBuffer; + + // snpe output stuff + zdl::DlSystem::UserBufferMap outputMap; + std::unique_ptr outputBuffer; + float *output; + + // recurrent + std::unique_ptr recurrentBuffer; +}; + +#endif + diff --git a/selfdrive/visiond/transform.c b/selfdrive/visiond/transform.c new file mode 100644 index 00000000000000..5f3d7ad5a11c95 --- /dev/null +++ b/selfdrive/visiond/transform.c @@ -0,0 +1,149 @@ +#include +#include + +#include "clutil.h" + +#include "transform.h" + +void transform_init(Transform* s, cl_context ctx, cl_device_id device_id) { + int err = 0; + memset(s, 0, sizeof(*s)); + + cl_program prg = CLU_LOAD_FROM_FILE(ctx, device_id, "transform.cl", ""); + + s->krnl = clCreateKernel(prg, "warpPerspective", &err); + assert(err == 0); + + // done with this + err = clReleaseProgram(prg); + assert(err == 0); + + s->m_y_cl = clCreateBuffer(ctx, CL_MEM_READ_WRITE, 3*3*sizeof(float), NULL, &err); + assert(err == 0); + + s->m_uv_cl = clCreateBuffer(ctx, CL_MEM_READ_WRITE, 3*3*sizeof(float), NULL, &err); + assert(err == 0); +} + +void transform_destroy(Transform* s) { + int err = 0; + + err = clReleaseMemObject(s->m_y_cl); + assert(err == 0); + err = clReleaseMemObject(s->m_uv_cl); + assert(err == 0); + + err = clReleaseKernel(s->krnl); + assert(err == 0); +} + +void transform_queue(Transform* s, + cl_command_queue q, + cl_mem in_yuv, int in_width, int in_height, + cl_mem out_y, cl_mem out_u, cl_mem out_v, + int out_width, int out_height, + mat3 projection) { + int err = 0; + const int zero = 0; + + // sampled using pixel center origin + // (because thats how fastcv and opencv does it) + + mat3 projection_y = projection; + + // in and out uv is half the size of y. + mat3 projection_uv = transform_scale_buffer(projection, 0.5); + + err = clEnqueueWriteBuffer(q, s->m_y_cl, CL_TRUE, 0, 3*3*sizeof(float), (void*)projection_y.v, 0, NULL, NULL); + assert(err == 0); + err = clEnqueueWriteBuffer(q, s->m_uv_cl, CL_TRUE, 0, 3*3*sizeof(float), (void*)projection_uv.v, 0, NULL, NULL); + assert(err == 0); + + const int in_y_width = in_width; + const int in_y_height = in_height; + const int in_uv_width = in_width/2; + const int in_uv_height = in_height/2; + const int in_y_offset = 0; + const int in_u_offset = in_y_offset + in_y_width*in_y_height; + const int in_v_offset = in_u_offset + in_uv_width*in_uv_height; + + const int out_y_width = out_width; + const int out_y_height = out_height; + const int out_uv_width = out_width/2; + const int out_uv_height = out_height/2; + + err = clSetKernelArg(s->krnl, 0, sizeof(cl_mem), &in_yuv); + assert(err == 0); + + err = clSetKernelArg(s->krnl, 1, sizeof(cl_int), &in_y_width); + assert(err == 0); + err = clSetKernelArg(s->krnl, 2, sizeof(cl_int), &in_y_offset); + assert(err == 0); + err = clSetKernelArg(s->krnl, 3, sizeof(cl_int), &in_y_height); + assert(err == 0); + err = clSetKernelArg(s->krnl, 4, sizeof(cl_int), &in_y_width); + assert(err == 0); + + err = clSetKernelArg(s->krnl, 5, sizeof(cl_mem), &out_y); + assert(err == 0); + + err = clSetKernelArg(s->krnl, 6, sizeof(cl_int), &out_y_width); + assert(err == 0); + err = clSetKernelArg(s->krnl, 7, sizeof(cl_int), &zero); + assert(err == 0); + err = clSetKernelArg(s->krnl, 8, sizeof(cl_int), &out_y_height); + assert(err == 0); + err = clSetKernelArg(s->krnl, 9, sizeof(cl_int), &out_y_width); + assert(err == 0); + + err = clSetKernelArg(s->krnl, 10, sizeof(cl_mem), &s->m_y_cl); + assert(err == 0); + + const size_t work_size_y[2] = {out_y_width, out_y_height}; + + err = clEnqueueNDRangeKernel(q, s->krnl, 2, NULL, + (const size_t*)&work_size_y, NULL, 0, 0, NULL); + assert(err == 0); + + + const size_t work_size_uv[2] = {out_uv_width, out_uv_height}; + + err = clSetKernelArg(s->krnl, 1, sizeof(cl_int), &in_uv_width); + assert(err == 0); + err = clSetKernelArg(s->krnl, 2, sizeof(cl_int), &in_u_offset); + assert(err == 0); + err = clSetKernelArg(s->krnl, 3, sizeof(cl_int), &in_uv_height); + assert(err == 0); + err = clSetKernelArg(s->krnl, 4, sizeof(cl_int), &in_uv_width); + assert(err == 0); + + err = clSetKernelArg(s->krnl, 5, sizeof(cl_mem), &out_u); + assert(err == 0); + + err = clSetKernelArg(s->krnl, 6, sizeof(cl_int), &out_uv_width); + assert(err == 0); + err = clSetKernelArg(s->krnl, 7, sizeof(cl_int), &zero); + assert(err == 0); + err = clSetKernelArg(s->krnl, 8, sizeof(cl_int), &out_uv_height); + assert(err == 0); + err = clSetKernelArg(s->krnl, 9, sizeof(cl_int), &out_uv_width); + assert(err == 0); + + err = clSetKernelArg(s->krnl, 10, sizeof(cl_mem), &s->m_uv_cl); + assert(err == 0); + + err = clEnqueueNDRangeKernel(q, s->krnl, 2, NULL, + (const size_t*)&work_size_uv, NULL, 0, 0, NULL); + assert(err == 0); + + + err = clSetKernelArg(s->krnl, 2, sizeof(cl_int), &in_v_offset); + assert(err == 0); + err = clSetKernelArg(s->krnl, 5, sizeof(cl_mem), &out_v); + assert(err == 0); + + + err = clEnqueueNDRangeKernel(q, s->krnl, 2, NULL, + (const size_t*)&work_size_uv, NULL, 0, 0, NULL); + assert(err == 0); +} diff --git a/selfdrive/visiond/transform.cl b/selfdrive/visiond/transform.cl new file mode 100644 index 00000000000000..8ad186935114c9 --- /dev/null +++ b/selfdrive/visiond/transform.cl @@ -0,0 +1,54 @@ +#define INTER_BITS 5 +#define INTER_TAB_SIZE (1 << INTER_BITS) +#define INTER_SCALE 1.f / INTER_TAB_SIZE + +#define INTER_REMAP_COEF_BITS 15 +#define INTER_REMAP_COEF_SCALE (1 << INTER_REMAP_COEF_BITS) + +__kernel void warpPerspective(__global const uchar * src, + int src_step, int src_offset, int src_rows, int src_cols, + __global uchar * dst, + int dst_step, int dst_offset, int dst_rows, int dst_cols, + __constant float * M) +{ + int dx = get_global_id(0); + int dy = get_global_id(1); + + if (dx < dst_cols && dy < dst_rows) + { + float X0 = M[0] * dx + M[1] * dy + M[2]; + float Y0 = M[3] * dx + M[4] * dy + M[5]; + float W = M[6] * dx + M[7] * dy + M[8]; + W = W != 0.0f ? INTER_TAB_SIZE / W : 0.0f; + int X = rint(X0 * W), Y = rint(Y0 * W); + + short sx = convert_short_sat(X >> INTER_BITS); + short sy = convert_short_sat(Y >> INTER_BITS); + short ay = (short)(Y & (INTER_TAB_SIZE - 1)); + short ax = (short)(X & (INTER_TAB_SIZE - 1)); + + int v0 = (sx >= 0 && sx < src_cols && sy >= 0 && sy < src_rows) ? + convert_int(src[mad24(sy, src_step, src_offset + sx)]) : 0; + int v1 = (sx+1 >= 0 && sx+1 < src_cols && sy >= 0 && sy < src_rows) ? + convert_int(src[mad24(sy, src_step, src_offset + (sx+1))]) : 0; + int v2 = (sx >= 0 && sx < src_cols && sy+1 >= 0 && sy+1 < src_rows) ? + convert_int(src[mad24(sy+1, src_step, src_offset + sx)]) : 0; + int v3 = (sx+1 >= 0 && sx+1 < src_cols && sy+1 >= 0 && sy+1 < src_rows) ? + convert_int(src[mad24(sy+1, src_step, src_offset + (sx+1))]) : 0; + + float taby = 1.f/INTER_TAB_SIZE*ay; + float tabx = 1.f/INTER_TAB_SIZE*ax; + + int dst_index = mad24(dy, dst_step, dst_offset + dx); + + int itab0 = convert_short_sat_rte( (1.0f-taby)*(1.0f-tabx) * INTER_REMAP_COEF_SCALE ); + int itab1 = convert_short_sat_rte( (1.0f-taby)*tabx * INTER_REMAP_COEF_SCALE ); + int itab2 = convert_short_sat_rte( taby*(1.0f-tabx) * INTER_REMAP_COEF_SCALE ); + int itab3 = convert_short_sat_rte( taby*tabx * INTER_REMAP_COEF_SCALE ); + + int val = v0 * itab0 + v1 * itab1 + v2 * itab2 + v3 * itab3; + + uchar pix = convert_uchar_sat((val + (1 << (INTER_REMAP_COEF_BITS-1))) >> INTER_REMAP_COEF_BITS); + dst[dst_index] = pix; + } +} diff --git a/selfdrive/visiond/transform.h b/selfdrive/visiond/transform.h new file mode 100644 index 00000000000000..3854be9da62db6 --- /dev/null +++ b/selfdrive/visiond/transform.h @@ -0,0 +1,38 @@ +#ifndef TRANSFORM_H +#define TRANSFORM_H + +#include +#include + +#ifdef __APPLE__ +#include +#else +#include +#endif + +#include "common/mat.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + cl_kernel krnl; + cl_mem m_y_cl, m_uv_cl; +} Transform; + +void transform_init(Transform* s, cl_context ctx, cl_device_id device_id); + +void transform_destroy(Transform* transform); + +void transform_queue(Transform* s, cl_command_queue q, + cl_mem yuv, int in_width, int in_height, + cl_mem out_y, cl_mem out_u, cl_mem out_v, + int out_width, int out_height, + mat3 projection); + +#ifdef __cplusplus +} +#endif + +#endif // TRANSFORM_H diff --git a/selfdrive/visiond/visiond.cc b/selfdrive/visiond/visiond.cc new file mode 100644 index 00000000000000..af10d760c132e8 --- /dev/null +++ b/selfdrive/visiond/visiond.cc @@ -0,0 +1,1444 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef __APPLE__ +#include +#else +#include +#endif + +#include +#include +#include + +#include "common/version.h" +#include "common/util.h" +#include "common/timing.h" +#include "common/mat.h" +#include "common/swaglog.h" +#include "common/visionipc.h" +#include "common/visionbuf.h" +#include "common/visionimg.h" +#include "common/buffering.h" + +#include "clutil.h" +#include "bufs.h" + +#ifdef QCOM +#include "camera_qcom.h" +#else +#include "camera_fake.h" +#endif + +#include "model.h" +#include "monitoring.h" + +#include "cereal/gen/cpp/log.capnp.h" + +#define M_PI 3.14159265358979323846 + +#define UI_BUF_COUNT 4 + +//#define DUMP_RGB + +//#define DEBUG_DRIVER_MONITOR + +// send net input on port 9000 +//#define SEND_NET_INPUT + +#define YUV_COUNT 40 +#define MAX_CLIENTS 5 + +#ifdef __APPLE__ +typedef void (*sighandler_t) (int); +#endif + +extern "C" { +volatile int do_exit = 0; +} + +namespace { + +struct VisionState; + +struct VisionClientState { + VisionState *s; + int fd; + pthread_t thread_handle; + bool running; +}; + +struct VisionClientStreamState { + bool subscribed; + int bufs_outstanding; + bool tb; + TBuffer* tbuffer; + PoolQueue* queue; +}; + +struct VisionState { + + int frame_width, frame_height; + int frame_stride; + int frame_size; + + int ion_fd; + + // cl state + cl_device_id device_id; + cl_context context; + + cl_program prg_debayer_rear; + cl_program prg_debayer_front; + cl_kernel krnl_debayer_rear; + cl_kernel krnl_debayer_front; + + // processing + TBuffer ui_tb; + TBuffer ui_front_tb; + + mat3 yuv_transform; + TBuffer *yuv_tb; + + // TODO: refactor for both cameras? + Pool yuv_pool; + VisionBuf yuv_ion[YUV_COUNT]; + cl_mem yuv_cl[YUV_COUNT]; + YUVBuf yuv_bufs[YUV_COUNT]; + FrameMetadata yuv_metas[YUV_COUNT]; + size_t yuv_buf_size; + int yuv_width, yuv_height; + + // for front camera recording + Pool yuv_front_pool; + VisionBuf yuv_front_ion[YUV_COUNT]; + cl_mem yuv_front_cl[YUV_COUNT]; + YUVBuf yuv_front_bufs[YUV_COUNT]; + FrameMetadata yuv_front_metas[YUV_COUNT]; + size_t yuv_front_buf_size; + int yuv_front_width, yuv_front_height; + + size_t rgb_buf_size; + int rgb_width, rgb_height, rgb_stride; + VisionBuf rgb_bufs[UI_BUF_COUNT]; + cl_mem rgb_bufs_cl[UI_BUF_COUNT]; + + size_t rgb_front_buf_size; + int rgb_front_width, rgb_front_height, rgb_front_stride; + VisionBuf rgb_front_bufs[UI_BUF_COUNT]; + cl_mem rgb_front_bufs_cl[UI_BUF_COUNT]; + + ModelState model; + ModelData model_bufs[UI_BUF_COUNT]; + + MonitoringState monitoring; + zsock_t *monitoring_sock; + void* monitoring_sock_raw; + + // Protected by transform_lock. + bool run_model; + mat3 cur_transform; + pthread_mutex_t transform_lock; + + cl_mem camera_bufs_cl[FRAME_BUF_COUNT]; + VisionBuf camera_bufs[FRAME_BUF_COUNT]; + VisionBuf focus_bufs[FRAME_BUF_COUNT]; + VisionBuf stats_bufs[FRAME_BUF_COUNT]; + + cl_mem front_camera_bufs_cl[FRAME_BUF_COUNT]; + VisionBuf front_camera_bufs[FRAME_BUF_COUNT]; + + DualCameraState cameras; + + zsock_t *terminate_pub; + zsock_t *recorder_sock; + void* recorder_sock_raw; + + zsock_t *posenet_sock; + void* posenet_sock_raw; + + pthread_mutex_t clients_lock; + VisionClientState clients[MAX_CLIENTS]; + +}; + +void hexdump(uint8_t *d, int l) { + for (int i = 0; i < l; i++) { + if (i%0x10 == 0 && i != 0) printf("\n"); + printf("%02X ", d[i]); + } + printf("\n"); +} + +int mkpath(char* file_path, mode_t mode) { + assert(file_path && *file_path); + char* p; + for (p=strchr(file_path+1, '/'); p; p=strchr(p+1, '/')) { + *p='\0'; + if (mkdir(file_path, mode)==-1) { + if (errno!=EEXIST) { *p='/'; return -1; } + } + *p='/'; + } + return 0; +} + +////////// cl stuff + +cl_program build_debayer_program(VisionState *s, + int frame_width, int frame_height, int frame_stride, + int rgb_width, int rgb_height, int rgb_stride, + int bayer_flip, int hdr) { + assert(rgb_width == frame_width/2); + assert(rgb_height == frame_height/2); + + char args[4096]; + snprintf(args, sizeof(args), + "-cl-fast-relaxed-math -cl-denorms-are-zero " + "-DFRAME_WIDTH=%d -DFRAME_HEIGHT=%d -DFRAME_STRIDE=%d " + "-DRGB_WIDTH=%d -DRGB_HEIGHT=%d -DRGB_STRIDE=%d " + "-DBAYER_FLIP=%d -DHDR=%d", + frame_width, frame_height, frame_stride, + rgb_width, rgb_height, rgb_stride, + bayer_flip, hdr); + return CLU_LOAD_FROM_FILE(s->context, s->device_id, "debayer.cl", args); +} + +void cl_init(VisionState *s) { + int err; + cl_platform_id platform_id = NULL; + cl_uint num_devices; + cl_uint num_platforms; + + err = clGetPlatformIDs(1, &platform_id, &num_platforms); + assert(err == 0); + err = clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_DEFAULT, 1, + &s->device_id, &num_devices); + assert(err == 0); + + cl_print_info(platform_id, s->device_id); + printf("\n"); + + s->context = clCreateContext(NULL, 1, &s->device_id, NULL, NULL, &err); + assert(err == 0); +} + +void cl_free(VisionState *s) { + int err; + + err = clReleaseContext(s->context); + assert(err == 0); +} + +////////// + +#if 0 +// from libadreno_utils.so +extern "C" void compute_aligned_width_and_height(int width, + int height, + int bpp, + int tile_mode, + int raster_mode, + int padding_threshold, + int *aligned_w, + int *aligned_h); + +// TODO: move to visionbuf +void alloc_rgb888_bufs_cl(cl_device_id device_id, cl_context ctx, + int width, int height, int count, + int *out_stride, size_t *out_size, + VisionBuf *out_bufs, cl_mem *out_cl) { + + int aligned_w = 0, aligned_h = 0; +#ifdef QCOM + compute_aligned_width_and_height(ALIGN(width, 32), ALIGN(height, 32), 3, 0, 0, 512, &aligned_w, &aligned_h); +#else + aligned_w = width; aligned_h = height; +#endif + + int stride = aligned_w * 3; + size_t size = aligned_w * aligned_h * 3; + + for (int i=0; icamera_bufs[i] = visionbuf_allocate_cl(s->frame_size, s->device_id, s->context, + &s->camera_bufs_cl[i]); + // TODO: make lengths correct + s->focus_bufs[i] = visionbuf_allocate(0xb80); + s->stats_bufs[i] = visionbuf_allocate(0xb80); + } + + for (int i=0; ifront_camera_bufs[i] = visionbuf_allocate_cl(s->cameras.front.frame_size, + s->device_id, s->context, + &s->front_camera_bufs_cl[i]); + } + + // processing buffers + if (s->cameras.rear.ci.bayer) { + s->rgb_width = s->frame_width/2; + s->rgb_height = s->frame_height/2; + } else { + s->rgb_width = s->frame_width; + s->rgb_height = s->frame_height; + } + + for (int i=0; irgb_width, s->rgb_height, &s->rgb_bufs[i]); + s->rgb_bufs_cl[i] = visionbuf_to_cl(&s->rgb_bufs[i], s->device_id, s->context); + if (i == 0){ + s->rgb_stride = img.stride; + s->rgb_buf_size = img.size; + } + } + tbuffer_init(&s->ui_tb, UI_BUF_COUNT, "rgb"); + + assert(s->cameras.front.ci.bayer); + s->rgb_front_width = s->cameras.front.ci.frame_width/2; + s->rgb_front_height = s->cameras.front.ci.frame_height/2; + + for (int i=0; irgb_front_width, s->rgb_front_height, &s->rgb_front_bufs[i]); + s->rgb_front_bufs_cl[i] = visionbuf_to_cl(&s->rgb_front_bufs[i], s->device_id, s->context); + if (i == 0){ + s->rgb_front_stride = img.stride; + s->rgb_front_buf_size = img.size; + } + } + tbuffer_init(&s->ui_front_tb, UI_BUF_COUNT, "frontrgb"); + + // yuv back for recording and orbd + pool_init(&s->yuv_pool, YUV_COUNT); + + s->yuv_tb = pool_get_tbuffer(&s->yuv_pool); //only for visionserver... + + s->yuv_width = s->rgb_width; + s->yuv_height = s->rgb_height; + s->yuv_buf_size = s->rgb_width * s->rgb_height * 3 / 2; + + for (int i=0; iyuv_ion[i] = visionbuf_allocate_cl(s->yuv_buf_size, s->device_id, s->context, &s->yuv_cl[i]); + s->yuv_bufs[i].y = (uint8_t*)s->yuv_ion[i].addr; + s->yuv_bufs[i].u = s->yuv_bufs[i].y + (s->yuv_width * s->yuv_height); + s->yuv_bufs[i].v = s->yuv_bufs[i].u + (s->yuv_width/2 * s->yuv_height/2); + } + + // yuv front for recording + pool_init(&s->yuv_front_pool, YUV_COUNT); + + s->yuv_front_width = s->rgb_front_width; + s->yuv_front_height = s->rgb_front_height; + s->yuv_front_buf_size = s->rgb_front_width * s->rgb_front_height * 3 / 2; + + for (int i=0; iyuv_front_ion[i] = visionbuf_allocate_cl(s->yuv_front_buf_size, s->device_id, s->context, &s->yuv_front_cl[i]); + s->yuv_front_bufs[i].y = (uint8_t*)s->yuv_front_ion[i].addr; + s->yuv_front_bufs[i].u = s->yuv_front_bufs[i].y + (s->yuv_front_width * s->yuv_front_height); + s->yuv_front_bufs[i].v = s->yuv_front_bufs[i].u + (s->yuv_front_width/2 * s->yuv_front_height/2); + } + + if (s->cameras.rear.ci.bayer) { + // debayering does a 2x downscale + s->yuv_transform = transform_scale_buffer(s->cameras.rear.transform, 0.5); + } else { + s->yuv_transform = s->cameras.rear.transform; + } + + // build all the camera debayer programs + for (int i=0; iprg_debayer_rear = build_debayer_program(s, s->cameras.rear.ci.frame_width, s->cameras.rear.ci.frame_height, + s->cameras.rear.ci.frame_stride, + s->rgb_width, s->rgb_height, s->rgb_stride, + s->cameras.rear.ci.bayer_flip, s->cameras.rear.ci.hdr); + + s->prg_debayer_front = build_debayer_program(s, s->cameras.front.ci.frame_width, s->cameras.front.ci.frame_height, + s->cameras.front.ci.frame_stride, + s->rgb_front_width, s->rgb_front_height, s->rgb_front_stride, + s->cameras.front.ci.bayer_flip, s->cameras.front.ci.hdr); + + s->krnl_debayer_rear = clCreateKernel(s->prg_debayer_rear, "debayer10", &err); + assert(err == 0); + s->krnl_debayer_front = clCreateKernel(s->prg_debayer_front, "debayer10", &err); + assert(err == 0); +} + +void free_buffers(VisionState *s) { + // free bufs + for (int i=0; icamera_bufs[i]); + visionbuf_free(&s->focus_bufs[i]); + visionbuf_free(&s->stats_bufs[i]); + } + + for (int i=0; ifront_camera_bufs[i]); + } + + for (int i=0; irgb_bufs[i]); + } + + for (int i=0; irgb_front_bufs[i]); + } + + for (int i=0; iyuv_ion[i]); + } +} + +void* visionserver_client_thread(void* arg) { + int err; + VisionClientState *client = (VisionClientState*)arg; + VisionState *s = client->s; + int fd = client->fd; + + set_thread_name("clientthread"); + + zsock_t *terminate = zsock_new_sub(">inproc://terminate", ""); + assert(terminate); + void* terminate_raw = zsock_resolve(terminate); + + VisionClientStreamState streams[VISION_STREAM_MAX] = {{0}}; + + LOG("client start fd %d\n", fd); + + while (true) { + zmq_pollitem_t polls[2+VISION_STREAM_MAX] = {{0}}; + polls[0].socket = terminate_raw; + polls[0].events = ZMQ_POLLIN; + polls[1].fd = fd; + polls[1].events = ZMQ_POLLIN; + + int poll_to_stream[2+VISION_STREAM_MAX] = {0}; + int num_polls = 2; + for (int i=0; i= 2) { + continue; + } + if (streams[i].tb) { + polls[num_polls].fd = tbuffer_efd(streams[i].tbuffer); + } else { + polls[num_polls].fd = poolq_efd(streams[i].queue); + } + poll_to_stream[num_polls] = i; + num_polls++; + } + int ret = zmq_poll(polls, num_polls, -1); + if (ret < 0) { + LOGE("poll failed (%d)", ret); + break; + } + if (polls[0].revents) { + break; + } else if (polls[1].revents) { + VisionPacket p; + err = vipc_recv(fd, &p); + // printf("recv %d\n", p.type); + if (err <= 0) { + break; + } else if (p.type == VIPC_STREAM_SUBSCRIBE) { + VisionStreamType stream_type = p.d.stream_sub.type; + VisionPacket rep = { + .type = VIPC_STREAM_BUFS, + .d = { .stream_bufs = { .type = stream_type }, }, + }; + + VisionClientStreamState *stream = &streams[stream_type]; + stream->tb = p.d.stream_sub.tbuffer; + + VisionStreamBufs *stream_bufs = &rep.d.stream_bufs; + if (stream_type == VISION_STREAM_RGB_BACK) { + stream_bufs->width = s->rgb_width; + stream_bufs->height = s->rgb_height; + stream_bufs->stride = s->rgb_stride; + stream_bufs->buf_len = s->rgb_bufs[0].len; + rep.num_fds = UI_BUF_COUNT; + for (int i=0; irgb_bufs[i].fd; + } + if (stream->tb) { + stream->tbuffer = &s->ui_tb; + } else { + assert(false); + } + } else if (stream_type == VISION_STREAM_RGB_FRONT) { + stream_bufs->width = s->rgb_front_width; + stream_bufs->height = s->rgb_front_height; + stream_bufs->stride = s->rgb_front_stride; + stream_bufs->buf_len = s->rgb_front_bufs[0].len; + rep.num_fds = UI_BUF_COUNT; + for (int i=0; irgb_front_bufs[i].fd; + } + if (stream->tb) { + stream->tbuffer = &s->ui_front_tb; + } else { + assert(false); + } + } else if (stream_type == VISION_STREAM_YUV) { + stream_bufs->width = s->yuv_width; + stream_bufs->height = s->yuv_height; + stream_bufs->stride = s->yuv_width; + stream_bufs->buf_len = s->yuv_buf_size; + rep.num_fds = YUV_COUNT; + for (int i=0; iyuv_ion[i].fd; + } + if (stream->tb) { + stream->tbuffer = s->yuv_tb; + } else { + stream->queue = pool_get_queue(&s->yuv_pool); + } + } else if (stream_type == VISION_STREAM_YUV_FRONT) { + stream_bufs->width = s->yuv_front_width; + stream_bufs->height = s->yuv_front_height; + stream_bufs->stride = s->yuv_front_width; + stream_bufs->buf_len = s->yuv_front_buf_size; + rep.num_fds = YUV_COUNT; + for (int i=0; iyuv_front_ion[i].fd; + } + if (stream->tb) { + assert(false); + } else { + stream->queue = pool_get_queue(&s->yuv_front_pool); + } + } else { + assert(false); + } + + if (stream_type == VISION_STREAM_RGB_BACK || + stream_type == VISION_STREAM_RGB_FRONT) { + stream_bufs->buf_info.ui_info = (VisionUIInfo){ + .transformed_width = s->model.in.transformed_width, + .transformed_height = s->model.in.transformed_height, + }; + } + vipc_send(fd, &rep); + streams[stream_type].subscribed = true; + } else if (p.type == VIPC_STREAM_RELEASE) { + // printf("client release f %d %d\n", p.d.stream_rel.type, p.d.stream_rel.idx); + int si = p.d.stream_rel.type; + assert(si < VISION_STREAM_MAX); + if (streams[si].tb) { + tbuffer_release(streams[si].tbuffer, p.d.stream_rel.idx); + } else { + poolq_release(streams[si].queue, p.d.stream_rel.idx); + } + streams[p.d.stream_rel.type].bufs_outstanding--; + } else { + assert(false); + } + } else { + int stream_i = VISION_STREAM_MAX; + for (int i=2; iyuv_metas[idx].frame_id; + rep.d.stream_acq.extra.timestamp_eof = s->yuv_metas[idx].timestamp_eof; + } else if (stream_i == VISION_STREAM_YUV_FRONT) { + rep.d.stream_acq.extra.frame_id = s->yuv_front_metas[idx].frame_id; + rep.d.stream_acq.extra.timestamp_eof = s->yuv_front_metas[idx].timestamp_eof; + } + vipc_send(fd, &rep); + } + } + } + + LOG("client end fd %d\n", fd); + + for (int i=0; iclients_lock); + client->running = false; + pthread_mutex_unlock(&s->clients_lock); + + return NULL; +} + +void* visionserver_thread(void* arg) { + int err; + VisionState *s = (VisionState*)arg; + + set_thread_name("visionserver"); + + zsock_t *terminate = zsock_new_sub(">inproc://terminate", ""); + assert(terminate); + void* terminate_raw = zsock_resolve(terminate); + + unlink(VIPC_SOCKET_PATH); + + int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); + struct sockaddr_un addr = { + .sun_family = AF_UNIX, + .sun_path = VIPC_SOCKET_PATH, + }; + err = bind(sock, (struct sockaddr *)&addr, sizeof(addr)); + assert(err == 0); + + err = listen(sock, 3); + assert(err == 0); + + // printf("waiting\n"); + + while (!do_exit) { + zmq_pollitem_t polls[2] = {{0}}; + polls[0].socket = terminate_raw; + polls[0].events = ZMQ_POLLIN; + polls[1].fd = sock; + polls[1].events = ZMQ_POLLIN; + + int ret = zmq_poll(polls, ARRAYSIZE(polls), -1); + if (ret < 0) { + LOGE("poll failed (%d)", ret); + break; + } + if (polls[0].revents) { + break; + } else if (!polls[1].revents) { + continue; + } + + int fd = accept(sock, NULL, NULL); + assert(fd >= 0); + + pthread_mutex_lock(&s->clients_lock); + + int client_idx = 0; + for (; client_idx < MAX_CLIENTS; client_idx++) { + if (!s->clients[client_idx].running) break; + } + + if (client_idx >= MAX_CLIENTS) { + LOG("ignoring visionserver connection, max clients connected"); + close(fd); + + pthread_mutex_unlock(&s->clients_lock); + continue; + } + + VisionClientState *client = &s->clients[client_idx]; + client->s = s; + client->fd = fd; + client->running = true; + + err = pthread_create(&client->thread_handle, NULL, + visionserver_client_thread, client); + assert(err == 0); + + pthread_mutex_unlock(&s->clients_lock); + } + + for (int i=0; iclients_lock); + bool running = s->clients[i].running; + pthread_mutex_unlock(&s->clients_lock); + if (running) { + err = pthread_join(s->clients[i].thread_handle, NULL); + assert(err == 0); + } + } + + close(sock); + zsock_destroy(&terminate); + + return NULL; +} + +void* monitoring_thread(void *arg) { + int err; + VisionState *s = (VisionState*)arg; + + set_thread_name("monitoring"); + + TBuffer *tb = pool_get_tbuffer(&s->yuv_front_pool); + + cl_command_queue q = clCreateCommandQueue(s->context, s->device_id, 0, &err); + assert(err == 0); + + double last = 0; + while (!do_exit) { + int buf_idx = tbuffer_acquire(tb); + if (buf_idx < 0) { + break; + } + + FrameMetadata frame_data = s->yuv_front_metas[buf_idx]; + + // only process every frame + if ((frame_data.frame_id % 1) == 0) { + + double t1 = millis_since_boot(); + + MonitoringResult res = monitoring_eval_frame(&s->monitoring, q, + s->yuv_front_cl[buf_idx], s->yuv_front_width, s->yuv_front_height); + + // for (int i=0; i<6; i++) { + // printf("%f ", res.vs[i]); + // } + // printf("\n"); + + // send driver monitoring packet + { + capnp::MallocMessageBuilder msg; + cereal::Event::Builder event = msg.initRoot(); + event.setLogMonoTime(nanos_since_boot()); + + auto framed = event.initDriverMonitoring(); + framed.setFrameId(frame_data.frame_id); + + kj::ArrayPtr descriptor_vs(&res.vs[0], ARRAYSIZE(res.vs)); + framed.setDescriptor(descriptor_vs); + + framed.setStd(res.std); + + auto words = capnp::messageToFlatArray(msg); + auto bytes = words.asBytes(); + zmq_send(s->monitoring_sock_raw, bytes.begin(), bytes.size(), ZMQ_DONTWAIT); + } + + double t2 = millis_since_boot(); + + LOGD("monitoring process: %.2fms, from last %.2fms", t2-t1, t1-last); + last = t1; + } + + tbuffer_release(tb, buf_idx); + } + + return NULL; +} + +void* frontview_thread(void *arg) { + int err; + VisionState *s = (VisionState*)arg; + + set_thread_name("frontview"); + + cl_command_queue q = clCreateCommandQueue(s->context, s->device_id, 0, &err); + assert(err == 0); + + for (int cnt = 0; !do_exit; cnt++) { + int buf_idx = tbuffer_acquire(&s->cameras.front.camera_tb); + if (buf_idx < 0) { + break; + } + + int ui_idx = tbuffer_select(&s->ui_front_tb); + FrameMetadata frame_data = s->cameras.front.camera_bufs_metadata[buf_idx]; + + double t1 = millis_since_boot(); + + err = clSetKernelArg(s->krnl_debayer_front, 0, sizeof(cl_mem), &s->front_camera_bufs_cl[buf_idx]); + assert(err == 0); + err = clSetKernelArg(s->krnl_debayer_front, 1, sizeof(cl_mem), &s->rgb_front_bufs_cl[ui_idx]); + assert(err == 0); + float digital_gain = 1.0; + err = clSetKernelArg(s->krnl_debayer_front, 2, sizeof(float), &digital_gain); + assert(err == 0); + + cl_event debayer_event; + const size_t debayer_work_size = s->rgb_front_height; + const size_t debayer_local_work_size = 128; + err = clEnqueueNDRangeKernel(q, s->krnl_debayer_front, 1, NULL, + &debayer_work_size, &debayer_local_work_size, 0, 0, &debayer_event); + assert(err == 0); + clWaitForEvents(1, &debayer_event); + clReleaseEvent(debayer_event); + + tbuffer_release(&s->cameras.front.camera_tb, buf_idx); + + visionbuf_sync(&s->rgb_front_bufs[ui_idx], VISIONBUF_SYNC_FROM_DEVICE); + + // auto exposure + const uint8_t *bgr_front_ptr = (const uint8_t*)s->rgb_front_bufs[ui_idx].addr; +#ifndef DEBUG_DRIVER_MONITOR + if (cnt % 3 == 0) +#endif + { + + // for driver autoexposure, use bottom right corner + const int y_start = s->rgb_front_height / 3; + const int y_end = s->rgb_front_height; + const int x_start = s->rgb_front_width * 2 / 3; + const int x_end = s->rgb_front_width; + + uint32_t lum_binning[256] = {0,}; + for (int y = y_start; y < y_end; ++y) { + for (int x = x_start; x < x_end; x += 2) { // every 2nd col + const uint8_t *pix = &bgr_front_ptr[y * s->rgb_front_stride + x * 3]; + unsigned int lum = (unsigned int)pix[0] + pix[1] + pix[2]; +#ifdef DEBUG_DRIVER_MONITOR + uint8_t *pix_rw = (uint8_t *)pix; + + // set all the autoexposure pixels to pure green (pixel format is bgr) + pix_rw[0] = pix_rw[2] = 0; + pix_rw[1] = 0xff; +#endif + lum_binning[std::min(lum / 3, 255u)]++; + } + } + const unsigned int lum_total = (y_end - y_start) * (x_end - x_start)/2; + unsigned int lum_cur = 0; + int lum_med = 0; + for (lum_med=0; lum_med<256; lum_med++) { + lum_cur += lum_binning[lum_med]; + if (lum_cur >= lum_total / 2) { + break; + } + } + camera_autoexposure(&s->cameras.front, lum_med / 256.0); + } + + // push YUV buffer + int yuv_idx = pool_select(&s->yuv_front_pool); + s->yuv_front_metas[yuv_idx] = frame_data; + + uint8_t *bgr_ptr = (uint8_t*)s->rgb_front_bufs[ui_idx].addr; + libyuv::RGB24ToI420(bgr_ptr, s->rgb_front_stride, + s->yuv_front_bufs[yuv_idx].y, s->yuv_front_width, + s->yuv_front_bufs[yuv_idx].u, s->yuv_front_width/2, + s->yuv_front_bufs[yuv_idx].v, s->yuv_front_width/2, + s->rgb_front_width, s->rgb_front_height); + + s->yuv_front_metas[yuv_idx] = frame_data; + visionbuf_sync(&s->yuv_front_ion[yuv_idx], VISIONBUF_SYNC_TO_DEVICE); + + // no reference required cause we don't use this in visiond + //pool_acquire(&s->yuv_front_pool, yuv_idx); + pool_push(&s->yuv_front_pool, yuv_idx); + //pool_release(&s->yuv_front_pool, yuv_idx); + + /*FILE *f = fopen("/tmp/test2", "wb"); + printf("%d %d\n", s->rgb_front_height, s->rgb_front_stride); + fwrite(bgr_front_ptr, 1, s->rgb_front_stride * s->rgb_front_height, f); + fclose(f);*/ + + tbuffer_dispatch(&s->ui_front_tb, ui_idx); + + double t2 = millis_since_boot(); + + LOGD("front process: %.2fms", t2-t1); + } + + return NULL; +} + +#define POSENET + +#ifdef POSENET +#include "snpemodel.h" +extern const uint8_t posenet_model_data[] asm("_binary_posenet_dlc_start"); +extern const uint8_t posenet_model_end[] asm("_binary_posenet_dlc_end"); +const size_t posenet_model_size = posenet_model_end - posenet_model_data; +#endif + +void* processing_thread(void *arg) { + int err; + VisionState *s = (VisionState*)arg; + + set_thread_name("processing"); + + err = set_realtime_priority(1); + LOG("setpriority returns %d", err); + + // init cl stuff + const cl_queue_properties props[] = {0}; //CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_HIGH_KHR, 0}; + cl_command_queue q = clCreateCommandQueueWithProperties(s->context, s->device_id, props, &err); + assert(err == 0); + + zsock_t *model_sock = zsock_new_pub("@tcp://*:8009"); + assert(model_sock); + void *model_sock_raw = zsock_resolve(model_sock); + +#ifdef SEND_NET_INPUT + zsock_t *img_sock = zsock_new_pub("@tcp://*:9000"); + assert(img_sock); + void *img_sock_raw = zsock_resolve(img_sock); +#else + void *img_sock_raw = NULL; +#endif + +#ifdef DUMP_RGB + FILE *dump_rgb_file = fopen("/sdcard/dump.rgb", "wb"); +#endif + +#ifdef POSENET + int posenet_counter = 0; + float pose_output[12]; + float *posenet_input = (float*)malloc(2*200*532*sizeof(float)); + SNPEModel *posenet = new SNPEModel(posenet_model_data, posenet_model_size, + pose_output, sizeof(pose_output)/sizeof(float)); +#endif + + // init the net + LOG("processing start!"); + + for (int cnt = 0; !do_exit; cnt++) { + int buf_idx = tbuffer_acquire(&s->cameras.rear.camera_tb); + // int buf_idx = camera_acquire_buffer(s); + if (buf_idx < 0) { + break; + } + + double t1 = millis_since_boot(); + + FrameMetadata frame_data = s->cameras.rear.camera_bufs_metadata[buf_idx]; + uint32_t frame_id = frame_data.frame_id; + + if (frame_id == -1) { + LOGE("no frame data? wtf"); + tbuffer_release(&s->cameras.rear.camera_tb, buf_idx); + continue; + } + + int ui_idx = tbuffer_select(&s->ui_tb); + int rgb_idx = ui_idx; + + cl_event debayer_event; + if (s->cameras.rear.ci.bayer) { + err = clSetKernelArg(s->krnl_debayer_rear, 0, sizeof(cl_mem), &s->camera_bufs_cl[buf_idx]); + cl_check_error(err); + err = clSetKernelArg(s->krnl_debayer_rear, 1, sizeof(cl_mem), &s->rgb_bufs_cl[rgb_idx]); + cl_check_error(err); + err = clSetKernelArg(s->krnl_debayer_rear, 2, sizeof(float), &s->cameras.rear.digital_gain); + assert(err == 0); + + const size_t debayer_work_size = s->rgb_height; // doesn't divide evenly, is this okay? + const size_t debayer_local_work_size = 128; + err = clEnqueueNDRangeKernel(q, s->krnl_debayer_rear, 1, NULL, + &debayer_work_size, &debayer_local_work_size, 0, 0, &debayer_event); + assert(err == 0); + } else { + assert(s->rgb_buf_size >= s->frame_size); + assert(s->rgb_stride == s->frame_stride); + err = clEnqueueCopyBuffer(q, s->camera_bufs_cl[buf_idx], s->rgb_bufs_cl[rgb_idx], + 0, 0, s->rgb_buf_size, 0, 0, &debayer_event); + assert(err == 0); + } + + clWaitForEvents(1, &debayer_event); + clReleaseEvent(debayer_event); + + tbuffer_release(&s->cameras.rear.camera_tb, buf_idx); + + visionbuf_sync(&s->rgb_bufs[rgb_idx], VISIONBUF_SYNC_FROM_DEVICE); + + + double t2 = millis_since_boot(); + + uint8_t *bgr_ptr = (uint8_t*)s->rgb_bufs[rgb_idx].addr; + +#ifdef DUMP_RGB + if (cnt % 20 == 0) { + fwrite(bgr_ptr, s->rgb_buf_size, 1, dump_rgb_file); + } +#endif + + double yt1 = millis_since_boot(); + + int yuv_idx = pool_select(&s->yuv_pool); + + s->yuv_metas[yuv_idx] = frame_data; + + uint8_t* yuv_ptr_y = s->yuv_bufs[yuv_idx].y; + uint8_t* yuv_ptr_u = s->yuv_bufs[yuv_idx].u; + uint8_t* yuv_ptr_v = s->yuv_bufs[yuv_idx].v; + cl_mem yuv_cl = s->yuv_cl[yuv_idx]; + + libyuv::RGB24ToI420(bgr_ptr, s->rgb_stride, + yuv_ptr_y, s->yuv_width, + yuv_ptr_u, s->yuv_width/2, + yuv_ptr_v, s->yuv_width/2, + s->rgb_width, s->rgb_height); + + double yt2 = millis_since_boot(); + + visionbuf_sync(&s->yuv_ion[yuv_idx], VISIONBUF_SYNC_TO_DEVICE); + + // keep another reference around till were done processing + pool_acquire(&s->yuv_pool, yuv_idx); + + pool_push(&s->yuv_pool, yuv_idx); + + pthread_mutex_lock(&s->transform_lock); + mat3 transform = s->cur_transform; + const bool run_model_this_iter = s->run_model; + pthread_mutex_unlock(&s->transform_lock); + + double mt1 = 0, mt2 = 0; + if (run_model_this_iter) { + + mat3 model_transform = matmul3(s->yuv_transform, transform); + + mt1 = millis_since_boot(); + s->model_bufs[ui_idx] = + model_eval_frame(&s->model, q, yuv_cl, s->yuv_width, s->yuv_height, + model_transform, img_sock_raw); + mt2 = millis_since_boot(); + + model_publish(model_sock_raw, frame_id, model_transform, s->model_bufs[ui_idx]); + } + + // send frame event + { + capnp::MallocMessageBuilder msg; + cereal::Event::Builder event = msg.initRoot(); + event.setLogMonoTime(nanos_since_boot()); + + auto framed = event.initFrame(); + framed.setFrameId(frame_data.frame_id); + framed.setEncodeId(cnt); + framed.setTimestampEof(frame_data.timestamp_eof); + framed.setFrameLength(frame_data.frame_length); + framed.setIntegLines(frame_data.integ_lines); + framed.setGlobalGain(frame_data.global_gain); + framed.setLensPos(frame_data.lens_pos); + framed.setLensSag(frame_data.lens_sag); + framed.setLensErr(frame_data.lens_err); + framed.setLensTruePos(frame_data.lens_true_pos); + +#ifndef QCOM + framed.setImage(kj::arrayPtr((const uint8_t*)s->yuv_ion[yuv_idx].addr, s->yuv_buf_size)); +#endif + + kj::ArrayPtr transform_vs(&s->yuv_transform.v[0], 9); + framed.setTransform(transform_vs); + + auto words = capnp::messageToFlatArray(msg); + auto bytes = words.asBytes(); + zmq_send(s->recorder_sock_raw, bytes.begin(), bytes.size(), ZMQ_DONTWAIT); + } + + +#ifdef POSENET + double pt1 = 0, pt2 = 0, pt3 = 0; + pt1 = millis_since_boot(); + + // move second frame to first frame + memmove(&posenet_input[0], &posenet_input[1], sizeof(float)*(200*532*2 - 1)); + + // fill posenet input + float a; + // posenet uses a half resolution cropped frame + // with upper left corner: [50, 237] and + // bottom right corner: [1114, 637] + // So the resulting crop is 532 X 200 + for (int y=237; y<637; y+=2) { + int yy = (y-237)/2; + for (int x = 50; x < 1114; x+=2) { + int xx = (x-50)/2; + a = 0; + a += yuv_ptr_y[s->yuv_width*(y+0) + (x+1)]; + a += yuv_ptr_y[s->yuv_width*(y+1) + (x+1)]; + a += yuv_ptr_y[s->yuv_width*(y+0) + (x+0)]; + a += yuv_ptr_y[s->yuv_width*(y+1) + (x+0)]; + // The posenet takes a normalized image input + // like the driving model so [0,255] is remapped + // to [-1,1] + posenet_input[(yy*532+xx)*2 + 1] = (a/512.0 - 1.0); + } + } + //FILE *fp; + //fp = fopen( "testing" , "r" ); + //fread(posenet_input , sizeof(float) , 200*532*2 , fp); + //fclose(fp); + //sleep(5); + + pt2 = millis_since_boot(); + + posenet_counter++; + + if (posenet_counter % 5 == 0){ + // run posenet + //printf("avg %f\n", pose_output[0]); + posenet->execute(posenet_input); + + + // fix stddevs + for (int i = 6; i < 12; i++) { + pose_output[i] = log1p(exp(pose_output[i])) + 1e-6; + } + // to radians + for (int i = 3; i < 6; i++) { + pose_output[i] = M_PI * pose_output[i] / 180.0; + } + // to radians + for (int i = 9; i < 12; i++) { + pose_output[i] = M_PI * pose_output[i] / 180.0; + } + + // send posenet event + { + capnp::MallocMessageBuilder msg; + cereal::Event::Builder event = msg.initRoot(); + event.setLogMonoTime(nanos_since_boot()); + + auto posenetd = event.initCameraOdometry(); + kj::ArrayPtr trans_vs(&pose_output[0], 3); + posenetd.setTrans(trans_vs); + kj::ArrayPtr rot_vs(&pose_output[3], 3); + posenetd.setRot(rot_vs); + kj::ArrayPtr trans_std_vs(&pose_output[6], 3); + posenetd.setTransStd(trans_std_vs); + kj::ArrayPtr rot_std_vs(&pose_output[9], 3); + posenetd.setRotStd(rot_std_vs); + + auto words = capnp::messageToFlatArray(msg); + auto bytes = words.asBytes(); + zmq_send(s->posenet_sock_raw, bytes.begin(), bytes.size(), ZMQ_DONTWAIT); + } + pt3 = millis_since_boot(); + LOGD("pre: %.2fms | posenet: %.2fms", (pt2-pt1), (pt3-pt1)); + } +#endif + + + tbuffer_dispatch(&s->ui_tb, ui_idx); + + // auto exposure over big box + const int exposure_x = 290; + const int exposure_y = 282 + 40; + const int exposure_height = 314; + const int exposure_width = 560; + if (cnt % 3 == 0) { + // find median box luminance for AE + uint32_t lum_binning[256] = {0,}; + for (int y=0; yyuv_width) + exposure_x + x]; + lum_binning[lum]++; + } + } + const unsigned int lum_total = exposure_height * exposure_width; + unsigned int lum_cur = 0; + int lum_med = 0; + for (lum_med=0; lum_med<256; lum_med++) { + // shouldn't be any values less than 16 - yuv footroom + lum_cur += lum_binning[lum_med]; + if (lum_cur >= lum_total / 2) { + break; + } + } + // double avg = (double)acc / (big_box_width * big_box_height) - 16; + // printf("avg %d\n", lum_med); + + camera_autoexposure(&s->cameras.rear, lum_med / 256.0); + } + + pool_release(&s->yuv_pool, yuv_idx); + + // if (cnt%40 == 0) { + // FILE* of = fopen("/sdcard/tmp.yuv", "wb"); + // fwrite(transformed_ptr_y, 1, s->transformed_width*s->transformed_height, of); + // fwrite(transformed_ptr_u, 1, (s->transformed_width/2)*(s->transformed_height/2), of); + // fwrite(transformed_ptr_v, 1, (s->transformed_width/2)*(s->transformed_height/2), of); + // fclose(of); + // } + + double t5 = millis_since_boot(); + + LOGD("queued: %.2fms, yuv: %.2f, model: %.2fms | processing: %.3fms", + (t2-t1), (yt2-yt1), (mt2-mt1), (t5-t1)); + } + +#ifdef DUMP_RGB + fclose(dump_rgb_file); +#endif + + zsock_destroy(&model_sock); + + return NULL; +} + +void* live_thread(void *arg) { + int err; + VisionState *s = (VisionState*)arg; + + set_thread_name("live"); + + zsock_t *terminate = zsock_new_sub(">inproc://terminate", ""); + assert(terminate); + + zsock_t *liveCalibration_sock = zsock_new_sub(">tcp://127.0.0.1:8019", ""); + assert(liveCalibration_sock); + + zpoller_t *poller = zpoller_new(liveCalibration_sock, terminate, NULL); + assert(poller); + + while (!do_exit) { + zsock_t *which = (zsock_t*)zpoller_wait(poller, -1); + if (which == terminate || which == NULL) { + break; + } + + zmq_msg_t msg; + err = zmq_msg_init(&msg); + assert(err == 0); + + err = zmq_msg_recv(&msg, zsock_resolve(which), 0); + assert(err >= 0); + size_t len = zmq_msg_size(&msg); + + // make copy due to alignment issues, will be freed on out of scope + auto amsg = kj::heapArray((len / sizeof(capnp::word)) + 1); + memcpy(amsg.begin(), (const uint8_t*)zmq_msg_data(&msg), len); + + // track camera frames to sync to encoder + capnp::FlatArrayMessageReader cmsg(amsg); + cereal::Event::Reader event = cmsg.getRoot(); + + if (event.isLiveCalibration()) { + pthread_mutex_lock(&s->transform_lock); +#ifdef BIGMODEL + auto wm2 = event.getLiveCalibration().getWarpMatrixBig(); +#else + auto wm2 = event.getLiveCalibration().getWarpMatrix2(); +#endif + assert(wm2.size() == 3*3); + for (int i=0; i<3*3; i++) { + s->cur_transform.v[i] = wm2[i]; + } + s->run_model = true; + pthread_mutex_unlock(&s->transform_lock); + } + + zmq_msg_close(&msg); + } + + zpoller_destroy(&poller); + zsock_destroy(&terminate); + + zsock_destroy(&liveCalibration_sock); + + return NULL; +} + +void set_do_exit(int sig) { + do_exit = 1; +} + +void party(VisionState *s, bool nomodel) { + int err; + + s->terminate_pub = zsock_new_pub("@inproc://terminate"); + assert(s->terminate_pub); + +#ifndef __APPLE__ + pthread_t visionserver_thread_handle; + err = pthread_create(&visionserver_thread_handle, NULL, + visionserver_thread, s); + assert(err == 0); +#endif + + pthread_t proc_thread_handle; + err = pthread_create(&proc_thread_handle, NULL, + processing_thread, s); + assert(err == 0); + + + pthread_t frontview_thread_handle; + err = pthread_create(&frontview_thread_handle, NULL, + frontview_thread, s); + assert(err == 0); + + pthread_t monitoring_thread_handle; + err = pthread_create(&monitoring_thread_handle, NULL, monitoring_thread, s); + assert(err == 0); + + pthread_t live_thread_handle; + err = pthread_create(&live_thread_handle, NULL, + live_thread, s); + assert(err == 0); + + // priority for cameras + err = set_realtime_priority(1); + LOG("setpriority returns %d", err); + + cameras_run(&s->cameras); + + tbuffer_stop(&s->ui_tb); + tbuffer_stop(&s->ui_front_tb); + pool_stop(&s->yuv_pool); + pool_stop(&s->yuv_front_pool); + + zsock_signal(s->terminate_pub, 0); + + LOG("joining frontview_thread"); + err = pthread_join(frontview_thread_handle, NULL); + assert(err == 0); + +#ifndef __APPLE__ + LOG("joining visionserver_thread"); + err = pthread_join(visionserver_thread_handle, NULL); + assert(err == 0); +#endif + + LOG("joining proc_thread"); + err = pthread_join(proc_thread_handle, NULL); + assert(err == 0); + + LOG("joining live_thread"); + err = pthread_join(live_thread_handle, NULL); + assert(err == 0); + + zsock_destroy (&s->terminate_pub); +} + +} + +// TODO: make a version of visiond that runs on pc using streamed video from EON. +// BOUNTY: free EON+panda+giraffe + +int main(int argc, char **argv) { + int err; + + zsys_handler_set(NULL); + signal(SIGINT, (sighandler_t)set_do_exit); + signal(SIGTERM, (sighandler_t)set_do_exit); + + // boringssl via curl via the calibration api can sometimes + // try to write to a closed socket. just ignore SIGPIPE + signal(SIGPIPE, SIG_IGN); + + bool test_run = false; + if (argc > 1 && strcmp(argv[1], "-t") == 0) { + // immediately tear everything down. useful for caching opencl + test_run = true; + } + + bool no_model = false; + if (argc > 1 && strcmp(argv[1], "--no-model") == 0) { + no_model = true; + } + + VisionState state = {0}; + VisionState *s = &state; + + clu_init(); + cl_init(s); + + model_init(&s->model, s->device_id, s->context, true); + monitoring_init(&s->monitoring, s->device_id, s->context); + + // s->zctx = zctx_shadow_zmq_ctx(zsys_init()); + + cameras_init(&s->cameras); + + s->frame_width = s->cameras.rear.ci.frame_width; + s->frame_height = s->cameras.rear.ci.frame_height; + s->frame_stride = s->cameras.rear.ci.frame_stride; + s->frame_size = s->cameras.rear.frame_size; + + // Do not run the model until we receive valid calibration. + s->run_model = false; + pthread_mutex_init(&s->transform_lock, NULL); + + init_buffers(s); + + s->recorder_sock = zsock_new_pub("@tcp://*:8002"); + assert(s->recorder_sock); + s->recorder_sock_raw = zsock_resolve(s->recorder_sock); + + s->monitoring_sock = zsock_new_pub("@tcp://*:8063"); + assert(s->monitoring_sock); + s->monitoring_sock_raw = zsock_resolve(s->monitoring_sock); + + s->posenet_sock = zsock_new_pub("@tcp://*:8066"); + assert(s->posenet_sock); + s->posenet_sock_raw = zsock_resolve(s->posenet_sock); + + cameras_open(&s->cameras, &s->camera_bufs[0], &s->focus_bufs[0], &s->stats_bufs[0], &s->front_camera_bufs[0]); + + if (test_run) { + do_exit = true; + } + party(s, no_model); + + zsock_destroy(&s->recorder_sock); + zsock_destroy(&s->monitoring_sock); + // zctx_destroy(&s->zctx); + + model_free(&s->model); + monitoring_free(&s->monitoring); + free_buffers(s); + + cl_free(s); + + return 0; +}