* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#pragma once
#include <cstddef>
#include <string>
#include <memory>
#include <systemd/sd-event.h>
+#include <cctype>
-extern "C"
-{
- #define AFB_BINDING_VERSION 2
- #include <afb/afb-binding.h>
-};
+#include <afb/afb-binding>
class low_can_subscription_t;
-void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, std::map<int, std::shared_ptr<low_can_subscription_t> >& s);
-void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, uint32_t pid, std::map<int, std::shared_ptr<low_can_subscription_t> >& s);
+typedef std::map<int, std::shared_ptr<low_can_subscription_t>> map_subscription;
+
+void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, map_subscription& s);
+void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, uint32_t pid, map_subscription& s);
int read_message(sd_event_source *s, int fd, uint32_t revents, void *userdata);
-void subscribe(struct afb_req request);
-void unsubscribe(struct afb_req request);
-void swrite(struct afb_req request);
+inline bool caseInsCharCompareN(char a, char b) {
+ return(toupper(a) == toupper(b));
+}
+
+inline bool caseInsCompare(const std::string& s1, const std::string& s2) {
+ return((s1.size() == s2.size()) &&
+ equal(s1.begin(), s1.end(), s2.begin(), caseInsCharCompareN));
+}