Examples of XDR


Examples of org.apache.hadoop.oncrpc.XDR

    RpcCall rpcCall = (RpcCall) info.header();
    final NFSPROC3 nfsproc3 = NFSPROC3.fromValue(rpcCall.getProcedure());
    int xid = rpcCall.getXid();
    byte[] data = new byte[info.data().readableBytes()];
    info.data().readBytes(data);
    XDR xdr = new XDR(data);
    XDR out = new XDR();
    InetAddress client = ((InetSocketAddress) info.remoteAddress())
        .getAddress();
    Channel channel = info.channel();

    Credentials credentials = rpcCall.getCredential();
    // Ignore auth only for NFSPROC3_NULL, especially for Linux clients.
    if (nfsproc3 != NFSPROC3.NULL) {
      if (credentials.getFlavor() != AuthFlavor.AUTH_SYS
          && credentials.getFlavor() != AuthFlavor.RPCSEC_GSS) {
        LOG.info("Wrong RPC AUTH flavor, " + credentials.getFlavor()
            + " is not AUTH_SYS or RPCSEC_GSS.");
        XDR reply = new XDR();
        RpcDeniedReply rdr = new RpcDeniedReply(xid,
            RpcReply.ReplyState.MSG_ACCEPTED,
            RpcDeniedReply.RejectState.AUTH_ERROR, new VerifierNone());
        rdr.write(reply);

        ChannelBuffer buf = ChannelBuffers.wrappedBuffer(reply.asReadOnlyWrap()
            .buffer());
        RpcResponse rsp = new RpcResponse(buf, info.remoteAddress());
        RpcUtil.sendRpcResponse(ctx, rsp);
        return;
      }
View Full Code Here

Examples of org.apache.hadoop.oncrpc.XDR

  public static void main(String[] args) throws InterruptedException {
    PortmapMapping mapEntry = new PortmapMapping(RpcProgramMountd.PROGRAM,
        RpcProgramMountd.VERSION_1, PortmapMapping.TRANSPORT_UDP,
        RpcProgramMountd.PORT);
    XDR mappingRequest = PortmapRequest.create(mapEntry);
    RegistrationClient registrationClient = new RegistrationClient(
        "localhost", Nfs3Constant.SUN_RPCBIND, mappingRequest);
    registrationClient.run();
       
    Thread t1 = new Runtest1();
View Full Code Here

Examples of org.apache.hadoop.oncrpc.XDR

    xdr_out.putInt(0);
*/
  }
  static void testGetportMount() {
    XDR xdr_out = new XDR();

    createPortmapXDRheader(xdr_out, 3);

    xdr_out.writeInt(100005);
    xdr_out.writeInt(1);
    xdr_out.writeInt(6);
    xdr_out.writeInt(0);

    XDR request2 = new XDR();

    createPortmapXDRheader(xdr_out, 3);
    request2.writeInt(100005);
    request2.writeInt(1);
    request2.writeInt(6);
    request2.writeInt(0);

    testRequest(xdr_out, request2);
  }
View Full Code Here

Examples of org.apache.hadoop.oncrpc.XDR

    testRequest(xdr_out, request2);
  }
 
  static void testGetport() {
    XDR xdr_out = new XDR();

    createPortmapXDRheader(xdr_out, 3);

    xdr_out.writeInt(100003);
    xdr_out.writeInt(3);
    xdr_out.writeInt(6);
    xdr_out.writeInt(0);

    XDR request2 = new XDR();

    createPortmapXDRheader(xdr_out, 3);
    request2.writeInt(100003);
    request2.writeInt(3);
    request2.writeInt(6);
    request2.writeInt(0);

    testRequest(xdr_out, request2);
  }
View Full Code Here

Examples of org.apache.hadoop.oncrpc.XDR

    testRequest(xdr_out, request2);
  }
 
  static void testDump() {
    XDR xdr_out = new XDR();
    createPortmapXDRheader(xdr_out, 4);
    testRequest(xdr_out, xdr_out);
  }
View Full Code Here

Examples of org.apache.hadoop.oncrpc.XDR

    public void run() {
      //testGetportMount();
      PortmapMapping mapEntry = new PortmapMapping(RpcProgramMountd.PROGRAM,
          RpcProgramMountd.VERSION_1, PortmapMapping.TRANSPORT_UDP,
          RpcProgramMountd.PORT);
      XDR req = PortmapRequest.create(mapEntry);
      testRequest(req, req);
    }
View Full Code Here

Examples of org.apache.hadoop.oncrpc.XDR

  static byte[] data1 = new byte[1000];
  static byte[] data2 = new byte[1000];
  static byte[] data3 = new byte[1000];

  static XDR create() {
    XDR request = new XDR();
    RpcCall.getInstance(0x8000004c, Nfs3Constant.PROGRAM, Nfs3Constant.VERSION,
        Nfs3Constant.NFSPROC3.CREATE.getValue(), new CredentialsNone(),
        new VerifierNone()).write(request);

    SetAttr3 objAttr = new SetAttr3();
View Full Code Here

Examples of org.apache.hadoop.oncrpc.XDR

    return request;
  }

  static XDR write(FileHandle handle, int xid, long offset, int count,
      byte[] data) {
    XDR request = new XDR();
    RpcCall.getInstance(xid, Nfs3Constant.PROGRAM, Nfs3Constant.VERSION,
        Nfs3Constant.NFSPROC3.CREATE.getValue(), new CredentialsNone(),
        new VerifierNone()).write(request);

    WRITE3Request write1 = new WRITE3Request(handle, offset, count,
View Full Code Here

Examples of org.apache.hadoop.oncrpc.XDR

      Thread.sleep(1000);
      System.out.println("handle is still null...");
    }
    LOG.info("Send write1 request");

    XDR writeReq;

    writeReq = write(handle, 0x8000005c, 2000, 1000, data3);
    Nfs3Utils.writeChannel(channel, writeReq, 1);
    writeReq = write(handle, 0x8000005d, 1000, 1000, data2);
    Nfs3Utils.writeChannel(channel, writeReq, 2);
View Full Code Here

Examples of org.apache.hadoop.oncrpc.XDR

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
      // Get handle from create response
      ChannelBuffer buf = (ChannelBuffer) e.getMessage();
      XDR rsp = new XDR(buf.array());
      if (rsp.getBytes().length == 0) {
        LOG.info("rsp length is zero, why?");
        return;
      }
      LOG.info("rsp length=" + rsp.getBytes().length);

      RpcReply reply = RpcReply.read(rsp);
      int xid = reply.getXid();
      // Only process the create response
      if (xid != 0x8000004c) {
        return;
      }
      int status = rsp.readInt();
      if (status != Nfs3Status.NFS3_OK) {
        LOG.error("Create failed, status =" + status);
        return;
      }
      LOG.info("Create succeeded");
      rsp.readBoolean(); // value follow
      handle = new FileHandle();
      handle.deserialize(rsp);
      channel = e.getChannel();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.