Logo Search packages:      
Sourcecode: libnetfilter-queue version File versions  Download package

int nfq_set_mode ( struct nfq_q_handle qh,
u_int8_t  mode,
u_int32_t  range 
)

nfq_set_mode - set the amount of packet data that nfqueue copies to userspace

Parameters:
qhNetfilter queue handle obtained by call to nfq_create_queue().
modethe part of the packet that we are interested in
rangesize of the packet that we want to get

Sets the amount of data to be copied to userspace for each packet queued to the given queue.

  • NFQNL_COPY_NONE - do not copy any data
  • NFQNL_COPY_META - copy only packet metadata
  • NFQNL_COPY_PACKET - copy entire packet
Returns:
-1 on error; >=0 otherwise.

Definition at line 556 of file libnetfilter_queue.c.

{
      union {
            char buf[NFNL_HEADER_LEN
                  +NFA_LENGTH(sizeof(struct nfqnl_msg_config_params))];
            struct nlmsghdr nmh;
      } u;
      struct nfqnl_msg_config_params params;

      nfnl_fill_hdr(qh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, qh->id,
                  NFQNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);

      params.copy_range = htonl(range);
      params.copy_mode = mode;
      nfnl_addattr_l(&u.nmh, sizeof(u), NFQA_CFG_PARAMS, &params,
                  sizeof(params));

      return nfnl_query(qh->h->nfnlh, &u.nmh);
}

Generated by  Doxygen 1.6.0   Back to index