aboutsummaryrefslogtreecommitdiff
path: root/dataservices/sockev/src/sockev_cli.c
diff options
context:
space:
mode:
authordd3boh <dade.garberi@gmail.com>2017-10-06 15:05:25 +0200
committerdd3boh <dade.garberi@gmail.com>2017-10-31 12:34:43 +0100
commit521933570cc5c6b5f30e6e58090f981b4bd7a76b (patch)
treee0fce3de1974c5ec92138ff6f8028260f2c84340 /dataservices/sockev/src/sockev_cli.c
parent0d8fc3596e88bba2c95d4cfce84070f63804b5c2 (diff)
z2_plus: Turn back to caf dataservices
Revert "z2_plus: Specify that we're using a in-device data service" This reverts commit a6b29339d50703e1f349cd91b3ffa0a38f863d3f. Revert "msm8996-common: Import marlin dataservices" This reverts commit 66c36e2cb752b01a8c7fbe45e32ccc1681fb9d4b.
Diffstat (limited to 'dataservices/sockev/src/sockev_cli.c')
-rw-r--r--dataservices/sockev/src/sockev_cli.c96
1 files changed, 0 insertions, 96 deletions
diff --git a/dataservices/sockev/src/sockev_cli.c b/dataservices/sockev/src/sockev_cli.c
deleted file mode 100644
index 2bd2710..0000000
--- a/dataservices/sockev/src/sockev_cli.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/******************************************************************************
- S O C K E V _ C L I . C
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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.
-******************************************************************************/
-
-/******************************************************************************
- @file sockev_cli.c
- @brief command line test utility to receive sockev netlink messages.
-******************************************************************************/
-
-#include <sys/socket.h>
-#include <linux/netlink.h>
-#include <linux/sockev.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <string.h>
-
-#define SOCKEVCLI_ERROR -1
-
-int main(void)
-{
- int skfd, rc;
- socklen_t addrlen;
- struct sockaddr_nl my_addr, src_addr;
- struct nlmsghdr *nlh = NULL;
- struct sknlsockevmsg *msg;
-
- nlh = (struct nlmsghdr *)
- malloc(NLMSG_SPACE(sizeof(struct sknlsockevmsg) + 16));
- if (!nlh) {
- fprintf(stderr, "malloc() failed\n");
- return SOCKEVCLI_ERROR;
- }
-
- skfd = socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCKEV);
- if (skfd < 0) {
- fprintf(stderr, "nl_open_sock: socket failed\n");
- return SOCKEVCLI_ERROR;
- }
-
- memset(&my_addr, 0, sizeof(struct sockaddr_nl));
-
- my_addr.nl_family = AF_NETLINK;
- my_addr.nl_pid = getpid();
- my_addr.nl_groups = SKNLGRP_SOCKEV;
-
- rc = bind(skfd, (struct sockaddr *)&my_addr,
- sizeof(struct sockaddr_nl));
- if (rc < 0) {
- fprintf(stderr, "nl_open_sock: bind failed\n");
- close(skfd);
- return SOCKEVCLI_ERROR;
- }
-
- while (1) {
- recvfrom(skfd, nlh, sizeof(struct sknlsockevmsg) + 16, 0,
- (struct sockaddr *)&src_addr, &addrlen);
- msg = NLMSG_DATA(nlh);
- printf("----------------------------\n");
- printf("pid:\t%d\n", msg->pid);
- printf("event:\t%s\n", msg->event);
- printf("skfamily:\t0x%04X\n", msg->skfamily);
- printf("skstate:\t%03d\n", msg->skstate);
- printf("skprotocol:\t%03d\n", msg->skprotocol);
- printf("sktype:\t0x%04X\n", msg->sktype);
- printf("skflags:\t0x%016llX\n", msg->skflags);
- }
-
- return 0;
-}
-