Search in sources :

Example 1 with StructNlMsgErr

use of android.net.netlink.StructNlMsgErr in project android_frameworks_base by crdroidandroid.

the class NetlinkErrorMessageTest method testParseNlmErrorOk.

public void testParseNlmErrorOk() {
    final ByteBuffer byteBuffer = ByteBuffer.wrap(NLM_ERROR_OK);
    // For testing.
    byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
    final NetlinkMessage msg = NetlinkMessage.parse(byteBuffer);
    assertNotNull(msg);
    assertTrue(msg instanceof NetlinkErrorMessage);
    final NetlinkErrorMessage errorMsg = (NetlinkErrorMessage) msg;
    final StructNlMsgHdr hdr = errorMsg.getHeader();
    assertNotNull(hdr);
    assertEquals(36, hdr.nlmsg_len);
    assertEquals(NetlinkConstants.NLMSG_ERROR, hdr.nlmsg_type);
    assertEquals(0, hdr.nlmsg_flags);
    assertEquals(13606, hdr.nlmsg_seq);
    assertEquals(4196, hdr.nlmsg_pid);
    final StructNlMsgErr err = errorMsg.getNlMsgError();
    assertNotNull(err);
    assertEquals(0, err.error);
    assertNotNull(err.msg);
    assertEquals(48, err.msg.nlmsg_len);
    assertEquals(NetlinkConstants.RTM_NEWNEIGH, err.msg.nlmsg_type);
    assertEquals((NLM_F_REQUEST | NLM_F_ACK | NLM_F_REPLACE), err.msg.nlmsg_flags);
    assertEquals(13606, err.msg.nlmsg_seq);
    assertEquals(0, err.msg.nlmsg_pid);
}
Also used : StructNlMsgErr(android.net.netlink.StructNlMsgErr) NetlinkMessage(android.net.netlink.NetlinkMessage) NetlinkErrorMessage(android.net.netlink.NetlinkErrorMessage) ByteBuffer(java.nio.ByteBuffer)

Example 2 with StructNlMsgErr

use of android.net.netlink.StructNlMsgErr in project android_frameworks_base by DirtyUnicorns.

the class NetlinkErrorMessageTest method testParseNlmErrorOk.

public void testParseNlmErrorOk() {
    final ByteBuffer byteBuffer = ByteBuffer.wrap(NLM_ERROR_OK);
    // For testing.
    byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
    final NetlinkMessage msg = NetlinkMessage.parse(byteBuffer);
    assertNotNull(msg);
    assertTrue(msg instanceof NetlinkErrorMessage);
    final NetlinkErrorMessage errorMsg = (NetlinkErrorMessage) msg;
    final StructNlMsgHdr hdr = errorMsg.getHeader();
    assertNotNull(hdr);
    assertEquals(36, hdr.nlmsg_len);
    assertEquals(NetlinkConstants.NLMSG_ERROR, hdr.nlmsg_type);
    assertEquals(0, hdr.nlmsg_flags);
    assertEquals(13606, hdr.nlmsg_seq);
    assertEquals(4196, hdr.nlmsg_pid);
    final StructNlMsgErr err = errorMsg.getNlMsgError();
    assertNotNull(err);
    assertEquals(0, err.error);
    assertNotNull(err.msg);
    assertEquals(48, err.msg.nlmsg_len);
    assertEquals(NetlinkConstants.RTM_NEWNEIGH, err.msg.nlmsg_type);
    assertEquals((NLM_F_REQUEST | NLM_F_ACK | NLM_F_REPLACE), err.msg.nlmsg_flags);
    assertEquals(13606, err.msg.nlmsg_seq);
    assertEquals(0, err.msg.nlmsg_pid);
}
Also used : StructNlMsgErr(android.net.netlink.StructNlMsgErr) NetlinkMessage(android.net.netlink.NetlinkMessage) NetlinkErrorMessage(android.net.netlink.NetlinkErrorMessage) ByteBuffer(java.nio.ByteBuffer)

Example 3 with StructNlMsgErr

use of android.net.netlink.StructNlMsgErr in project android_frameworks_base by ResurrectionRemix.

the class NetlinkErrorMessageTest method testParseNlmErrorOk.

public void testParseNlmErrorOk() {
    final ByteBuffer byteBuffer = ByteBuffer.wrap(NLM_ERROR_OK);
    // For testing.
    byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
    final NetlinkMessage msg = NetlinkMessage.parse(byteBuffer);
    assertNotNull(msg);
    assertTrue(msg instanceof NetlinkErrorMessage);
    final NetlinkErrorMessage errorMsg = (NetlinkErrorMessage) msg;
    final StructNlMsgHdr hdr = errorMsg.getHeader();
    assertNotNull(hdr);
    assertEquals(36, hdr.nlmsg_len);
    assertEquals(NetlinkConstants.NLMSG_ERROR, hdr.nlmsg_type);
    assertEquals(0, hdr.nlmsg_flags);
    assertEquals(13606, hdr.nlmsg_seq);
    assertEquals(4196, hdr.nlmsg_pid);
    final StructNlMsgErr err = errorMsg.getNlMsgError();
    assertNotNull(err);
    assertEquals(0, err.error);
    assertNotNull(err.msg);
    assertEquals(48, err.msg.nlmsg_len);
    assertEquals(NetlinkConstants.RTM_NEWNEIGH, err.msg.nlmsg_type);
    assertEquals((NLM_F_REQUEST | NLM_F_ACK | NLM_F_REPLACE), err.msg.nlmsg_flags);
    assertEquals(13606, err.msg.nlmsg_seq);
    assertEquals(0, err.msg.nlmsg_pid);
}
Also used : StructNlMsgErr(android.net.netlink.StructNlMsgErr) NetlinkMessage(android.net.netlink.NetlinkMessage) NetlinkErrorMessage(android.net.netlink.NetlinkErrorMessage) ByteBuffer(java.nio.ByteBuffer)

Example 4 with StructNlMsgErr

use of android.net.netlink.StructNlMsgErr in project platform_frameworks_base by android.

the class NetlinkErrorMessageTest method testParseNlmErrorOk.

@SmallTest
public void testParseNlmErrorOk() {
    final ByteBuffer byteBuffer = ByteBuffer.wrap(NLM_ERROR_OK);
    // For testing.
    byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
    final NetlinkMessage msg = NetlinkMessage.parse(byteBuffer);
    assertNotNull(msg);
    assertTrue(msg instanceof NetlinkErrorMessage);
    final NetlinkErrorMessage errorMsg = (NetlinkErrorMessage) msg;
    final StructNlMsgHdr hdr = errorMsg.getHeader();
    assertNotNull(hdr);
    assertEquals(36, hdr.nlmsg_len);
    assertEquals(NetlinkConstants.NLMSG_ERROR, hdr.nlmsg_type);
    assertEquals(0, hdr.nlmsg_flags);
    assertEquals(13606, hdr.nlmsg_seq);
    assertEquals(4196, hdr.nlmsg_pid);
    final StructNlMsgErr err = errorMsg.getNlMsgError();
    assertNotNull(err);
    assertEquals(0, err.error);
    assertNotNull(err.msg);
    assertEquals(48, err.msg.nlmsg_len);
    assertEquals(NetlinkConstants.RTM_NEWNEIGH, err.msg.nlmsg_type);
    assertEquals((NLM_F_REQUEST | NLM_F_ACK | NLM_F_REPLACE), err.msg.nlmsg_flags);
    assertEquals(13606, err.msg.nlmsg_seq);
    assertEquals(0, err.msg.nlmsg_pid);
}
Also used : StructNlMsgErr(android.net.netlink.StructNlMsgErr) NetlinkMessage(android.net.netlink.NetlinkMessage) NetlinkErrorMessage(android.net.netlink.NetlinkErrorMessage) ByteBuffer(java.nio.ByteBuffer) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

NetlinkErrorMessage (android.net.netlink.NetlinkErrorMessage)4 NetlinkMessage (android.net.netlink.NetlinkMessage)4 StructNlMsgErr (android.net.netlink.StructNlMsgErr)4 ByteBuffer (java.nio.ByteBuffer)4 SmallTest (android.test.suitebuilder.annotation.SmallTest)1