summaryrefslogtreecommitdiffstats
path: root/manager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Various cleanupsHEADmasterKun Yi2019-11-251-89/+90
| | | | | | | | | | * Move functions to private as appropriate * Reorder functions to match declaration order * Declare arguments as const when appropriate * Rename to getActionHandler() to match previous method name Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I7d3b5bbb07c218c6c2d6277a1f19d8a0299bd6e6
* cleanup: remove getPathKun Yi2019-11-251-19/+13
| | | | | | | | The getPath call is only used once. Getting rid of it makes it easier to understand. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: Ifc8859f5fc68bb594003a6db7f7e80b1c1dfed28
* Fix openFiles refcountKun Yi2019-11-251-1/+2
| | | | | | | | | The old code deletes session from the session map before doing a lookup of the path. Fix the order and add a unit test to catch the error case. (The unit test would fail without this fix). Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: If043d6aad7bbaafa19ae3b63a6d9cc7a836d25b5
* cleanup: Use scoped initializers; move implementation to source fileKun Yi2019-11-211-5/+16
| | | | | | | | | | | | | | | Simplify code and address comments from http://gerrit.openbmc-project.xyz/c/openbmc/phosphor-ipmi-blobs/+/27399: * Use C++17 syntax of intializers in conditionals to simplify code. * Move getActionHandle() implementation to .cpp * return false explicitly Tested: Unit tests still pass. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I08a78125206f284d8c748822912e11828fb39968
* cleanup: Operate on members directly and allow empty paths in the lookup tableKun Yi2019-11-211-46/+9
| | | | | | | | | | | | | Instead of using private methods to change data, directly operate on it. Currently no test depends on these methods. There is also a minor bug fix: the previous code will not increment or decrement the open session count if the blobId is an empty string, however there is no check on the manager side. If empty blobIds are disallowed they should be checked earlier. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I8d97e098bed2d5c27a204a86ed688d0d9a98f0a2
* Implement session expirationKun Yi2019-11-191-2/+53
| | | | | | | | | | | | | | | If the caller opens sessions but doesn't close them, either intentionally or unintentionally, session IDs will leak. Once the maximum number of sessions are reached, no new session can be opened. Implement a cleanup procedure to automatically remove stale sessions. If a session hasn't seen activity for a while, call the expire() functions on the handler, and remove the session from tracking table. For handlers that haven't implemented the expire() call this change will be a no-op. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I895ae19b4003d2d6f7a0b2e73370fe5aa664adee
* Refactor various methods to get session or blob handlerKun Yi2019-11-191-94/+27
| | | | | | | | Use a single method to fetch the handler, if it can be found using session ID. Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I648cbc48ebfae479f63d34e8f2465d2c8cbe9d64
* blobs: s/struct BlobMeta/BlobMeta/gPatrick Venture2019-06-171-2/+2
| | | | | | | | | | | | | | Because this structure is not anything special, simply use the cpp idiomatic way of referencing the object. Consistently, structures that are packed still have "struct" used in declarations. However, this distinction is only clear through its usage and nothing in the language. Perhaps a better approach would be notational naming struct PackedXYZ {};. However, that can get out of control quickly. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I3b7e48e4b6687ef2e15e9d07c0eeba96eb5d2552
* manager: add hard-coded read checksPatrick Venture2019-02-011-1/+16
| | | | | | | | | | | | | The host-client cannot try to read back more than this number of bytes without hitting a memory overflow in phosphor-host-ipmid. The method we can call to dynamically receive that number isn't currently linking out of the userlayer library. Note: Once the configure_ac can find and provide the userlayer library from phosphor-host-ipmid, we can remove the hard-coded 64 and 0xe. Change-Id: I08f6bb59ce44279f76a494dccaa477ae75d532c4 Signed-off-by: Patrick Venture <venture@google.com>
* stop installing manager headerPatrick Venture2019-01-151-1/+2
| | | | | | | | Stop installing the manager header as it is no longer meant to be exported, but rather used only internally within this repository. Change-Id: I2ab21a31fd745e1b3e36fc39ffea5e26d373ff51 Signed-off-by: Patrick Venture <venture@google.com>
* manager: typo fix availablePatrick Venture2019-01-101-1/+1
| | | | | | | Typo fix in manager_cpp for word "available" Change-Id: I0c4382023fef63f332d4cd677d82ad30e0a44b26 Signed-off-by: Patrick Venture <venture@google.com>
* manager: fixup to use find_ifPatrick Venture2018-10-241-9/+7
| | | | | | | | | | | [manager.cpp:150]: (style) Consider using std::find_if algorithm instead of a raw loop. Note: Amusingly switching to a const iterator allowed cppcheck to find this cleanup. Change-Id: I16d87d4dde165fbb226259d1abc8deaa51569af1 Signed-off-by: Patrick Venture <venture@google.com>
* cleanup: apply const to read-only iteratorsPatrick Venture2018-10-241-2/+2
| | | | | | | Apply const to read-only iterators. Change-Id: Ib58f98596cb9f185d3b16a0b1fbd895dd37d3fd6 Signed-off-by: Patrick Venture <venture@google.com>
* manager: reduce scope of variablePatrick Venture2018-10-121-2/+1
| | | | | | | The lsess variable can have a smaller scope. Change-Id: I79aa84b25b52708c8c35ed1a56dbfe89dabd29fb Signed-off-by: Patrick Venture <venture@google.com>
* new command: BmcBlobWriteMetaPatrick Venture2018-10-101-0/+15
| | | | | | | Implement new command BmcBlobWriteMeta. Change-Id: I2e148f4bde4ef5d24db7e30bb02bdde024d9166a Signed-off-by: Patrick Venture <venture@google.com>
* manager: return abstract base typePatrick Venture2018-10-041-1/+1
| | | | | | | | Unit-tests later required knowing the vtable for a BlobManager, and this should avoid that needless complication. Change-Id: I7a208d08c2065b7383fd5095e00d17c1ab3b0cf5 Signed-off-by: Patrick Venture <venture@google.com>
* manager: add getBlobManager as an exported methodPatrick Venture2018-09-271-0/+14
| | | | | | | | getBlobManager will allow a library to get ahold of the BlobManager for registration purposes. Change-Id: I75f41601d10d59293c7752da8307507cc2c88434 Signed-off-by: Patrick Venture <venture@google.com>
* move blobs and manager header into installation dirPatrick Venture2018-09-271-2/+1
| | | | | | | | The blobs and manager header will be used by handlers once we've transitioned to dynamic loading. Change-Id: Ieae8fcfe383007731cb4f8b2619612c3bfa47f50 Signed-off-by: Patrick Venture <venture@google.com>
* initial drop of phosphor-ipmi-blobsPatrick Venture2018-09-151-0/+347
This implements a majority of the OEM IPMI BLOBS protocol. The only piece missing from this is the timed expiration of sessions. Change-Id: I82c9d17b625c94fc3340edcfabbbf1ffeb5ad7ac Signed-off-by: Patrick Venture <venture@google.com>
OpenPOWER on IntegriCloud