Logo Search packages:      
Sourcecode: uapevent version File versions  Download package

int read_event_netlink_socket ( int  sk_fd,
unsigned char *  buffer,
struct nlmsghdr *  nlh,
struct msghdr *  msg 

Read event data from netlink socket.

sk_fdNetlink socket handler
bufferPointer to the data buffer
nlhPointer to netlink message header
msgPointer to message header
Number of bytes read or UAP_FAILURE

Definition at line 647 of file uapevent.c.

References hexdump(), NL_MAX_PAYLOAD, terminate_flag, and UAP_FAILURE.

Referenced by read_event().

    int count = -1;
    count = recvmsg(sk_fd, msg, 0);
    printf("DBG:Waiting for message from NETLINK.\n");
    if (count < 0) {
        printf("ERR:NETLINK read failed!\n");
        return UAP_FAILURE;
    printf("DBG:Received message payload (%d)\n", count);
    if (count > NLMSG_SPACE(NL_MAX_PAYLOAD)) {
        printf("ERR:Buffer overflow!\n");
        return UAP_FAILURE;
    bzero(buffer, NL_MAX_PAYLOAD);
    memcpy(buffer, NLMSG_DATA(nlh), count - NLMSG_HDRLEN);
    hexdump(buffer, count - NLMSG_HDRLEN, ' ');
    return count - NLMSG_HDRLEN;

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index