/* *=========================================================================== * ipnet_sockdev_ioevent *=========================================================================== * Description: * Parameters: * Returns: * */ IP_STATIC int ipnet_sockdev_ioevent(Ipcom_netif *ipcomif, int command, void *data, int fcflags) { int ret = 0; IPCOM_UNUSED_ARG(ipcomif); IPCOM_UNUSED_ARG(data); if (IP_BIT_ISFALSE(fcflags, IP_FLAG_FC_ISRCONTEXT | IP_FLAG_FC_STACKCONTEXT)) IPNET_CODE_LOCK_WRITE(); switch (command) { case IP_EIOXUP: break; case IP_EIOXDOWN: break; default: ret = -1; break; } if (IP_BIT_ISFALSE(fcflags, IP_FLAG_FC_ISRCONTEXT | IP_FLAG_FC_STACKCONTEXT)) IPNET_CODE_UNLOCK(); return ret; }
/* *=========================================================================== * ipnet_if_mib_lock *=========================================================================== * Description: Protects MIB variables in SNMPv2-MIB from multiple access * Parameters: lock - boolean that controls lock or unlock * Returns: Nothing * */ IP_STATIC void ipnet_if_mib_lock(Ip_bool lock) { if (lock == IP_TRUE) { IPNET_CODE_LOCK_WRITE(); } else { IPNET_CODE_UNLOCK(); } }
/* *=========================================================================== * ipnet_sockdev_send *=========================================================================== * Description: Inputs a packet to the sockdev interface. * Parameters: sock - The socket to use when sending. * msg - Contains the data to send. * flags - IP_MSG_xxx flags. * Returns: >0 = application bytes sent, <0 = error code. * */ IP_STATIC int ipnet_sockdev_send(Ipnet_socket *sock, IP_CONST struct Ip_msghdr *msg, int flags) { int ret; int length; Ipcom_pkt *pkt; Ipnet_netif *netif = ipnet_if_indextonetif(sock->vr_index, sock->bind_to_ifindex); length = ipnet_sock_create_pkt_from_user_iov(sock, msg, flags, &pkt); if (length < 0) return length; IPNET_CODE_UNLOCK(); ipcom_pkt_input(&netif->ipcom, pkt); IPNET_CODE_LOCK_READ(); return ret < 0 ? ret : length; }