public static nfs_argop4 standard(clientid4 eir_clientid, sequenceid4 eir_sequenceid) { nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_CREATE_SESSION; op.opcreate_session = new CREATE_SESSION4args(); channel_attrs4 chan_attrs = new channel_attrs4(); chan_attrs.ca_headerpadsize = new count4(new uint32_t(0)); chan_attrs.ca_maxoperations = new count4(new uint32_t(8)); chan_attrs.ca_maxrequests = new count4(new uint32_t(128)); chan_attrs.ca_maxrequestsize = new count4(new uint32_t(1049620)); chan_attrs.ca_maxresponsesize = new count4(new uint32_t(1049480)); chan_attrs.ca_maxresponsesize_cached = new count4(new uint32_t(2868)); chan_attrs.ca_rdma_ird = new uint32_t[0]; op.opcreate_session.csa_clientid = eir_clientid; op.opcreate_session.csa_sequence = eir_sequenceid; //connection back channel op.opcreate_session.csa_flags = new uint32_t(0); //3 if u want to use the back channel op.opcreate_session.csa_fore_chan_attrs = chan_attrs; //diferent chan attrs for fore channel channel_attrs4 back_chan_attrs = new channel_attrs4(); back_chan_attrs.ca_headerpadsize = new count4(new uint32_t(0)); back_chan_attrs.ca_maxoperations = new count4(new uint32_t(2)); back_chan_attrs.ca_maxrequests = new count4(new uint32_t(1)); back_chan_attrs.ca_maxrequestsize = new count4(new uint32_t(4096)); back_chan_attrs.ca_maxresponsesize = new count4(new uint32_t(4096)); back_chan_attrs.ca_maxresponsesize_cached = new count4(new uint32_t(0)); back_chan_attrs.ca_rdma_ird = new uint32_t[0]; op.opcreate_session.csa_back_chan_attrs = back_chan_attrs; op.opcreate_session.csa_cb_program = new uint32_t(0x40000000); callback_sec_parms4[] cb = new callback_sec_parms4[1]; callback_sec_parms4 callb = new callback_sec_parms4(); //new auth_sys params callb.cb_secflavor = auth_flavor.AUTH_SYS; callb.cbsp_sys_cred = new authsys_parms(); Random r = new Random(); callb.cbsp_sys_cred.stamp = r.Next(); //just random number callb.cbsp_sys_cred.gid = 0; //maybe root ? callb.cbsp_sys_cred.uid = 0; //maybe root ? callb.cbsp_sys_cred.machinename = System.Environment.MachineName; callb.cbsp_sys_cred.gids = new int[0]; //callb.cb_secflavor = auth_flavor.AUTH_NONE; cb[0] = callb; // op.opcreate_session.csa_sec_parms = new callback_sec_parms4[1]; op.opcreate_session.csa_sec_parms = cb; return(op); }
public static nfs_argop4 normalCREATE(String path, int sequenceId, clientid4 clientid, int access) { System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_OPEN; op.opopen = new OPEN4args(); op.opopen.seqid = new seqid4(new uint32_t(sequenceId)); state_owner4 owner = new state_owner4(); owner.clientid = clientid; owner.owner = encoding.GetBytes("nfsclient"); op.opopen.owner = new open_owner4(owner); //if ((access & NFSv4Protocol.OPEN4_SHARE_ACCESS_WANT_DELEG_MASK) == 0) // { // access |= NFSv4Protocol.OPEN4_SHARE_ACCESS_WANT_NO_DELEG; // } op.opopen.share_access = new uint32_t(access); op.opopen.share_deny = new uint32_t(NFSv4Protocol.OPEN4_SHARE_DENY_NONE); openflag4 flag = new openflag4(); flag.opentype = opentype4.OPEN4_CREATE; // createhow4(mode, attrs, verifier) createhow4 how = new createhow4(); how.mode = createmode4.GUARDED4; //how.mode = createmode4.EXCLUSIVE4_1; fattr4 attr = new fattr4(); attr.attrmask = openFattrBitmap(); attr.attr_vals = new attrlist4(); attr.attr_vals.value = openAttrs(7,7,7,0); how.createattrs = attr; how.createverf = new verifier4(0); //it is long //how.mode = createmode4.GUARDED4; flag.how = how; op.opopen.openhow = flag; open_claim4 claim = new open_claim4(); claim.claim = open_claim_type4.CLAIM_NULL; claim.file = new component4(new utf8str_cs(new utf8string(encoding .GetBytes(path)))); claim.delegate_type = NFSv4Protocol.OPEN4_SHARE_ACCESS_WANT_NO_DELEG; claim.file_delegate_prev = null; claim.oc_delegate_stateid = null; claim.delegate_type = 0; claim.delegate_cur_info = null; op.opopen.claim = claim; return op; }
public static nfs_argop4 standard(clientid4 client) { nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_DESTROY_CLIENTID; op.opdestroy_clientid = new DESTROY_CLIENTID4args(); op.opdestroy_clientid.dca_clientid = client; return(op); }
public static nfs_argop4 standard(clientid4 client) { nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_DESTROY_CLIENTID; op.opdestroy_clientid = new DESTROY_CLIENTID4args(); op.opdestroy_clientid.dca_clientid = client; return op; }
private void destroy_clientId() { if (_clientIdByServer != null) { List <nfs_argop4> ops = new List <nfs_argop4>(); ops.Add(DestroyClientIdStub.standard(_clientIdByServer)); COMPOUND4res compound4res = sendCompound(ops, ""); _clientIdByServer = null; } }
public static nfs_argop4 normalREAD(String path, int sequenceId, clientid4 clientid, int access) { System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_OPEN; op.opopen = new OPEN4args(); op.opopen.seqid = new seqid4(new uint32_t(sequenceId)); // if ((access & nfs4_prot.OPEN4_SHARE_ACCESS_WANT_DELEG_MASK) == 0){ // access |= nfs4_prot.OPEN4_SHARE_ACCESS_WANT_NO_DELEG; // } // op.opopen.share_access = new uint32_t(access); op.opopen.share_access = new uint32_t(NFSv4Protocol.OPEN4_SHARE_ACCESS_READ); op.opopen.share_deny = new uint32_t(NFSv4Protocol.OPEN4_SHARE_DENY_NONE); state_owner4 owner = new state_owner4(); owner.clientid = clientid; owner.owner = encoding.GetBytes("nfsclient"); op.opopen.owner = new open_owner4(owner); openflag4 flag = new openflag4(); flag.opentype = opentype4.OPEN4_NOCREATE; createhow4 how = new createhow4(); how.mode = createmode4.UNCHECKED4; flag.how = how; op.opopen.openhow = flag; open_claim4 claim = new open_claim4(); claim.claim = open_claim_type4.CLAIM_NULL; claim.file = new component4(new utf8str_cs(new utf8string(encoding.GetBytes(path)))); claim.delegate_type = NFSv4Protocol.OPEN4_SHARE_ACCESS_WANT_NO_DELEG; claim.file_delegate_prev = null; claim.oc_delegate_stateid = null; claim.delegate_type = 0; claim.delegate_cur_info = null; op.opopen.claim = claim; return(op); }
public static nfs_argop4 normalREAD(String path, int sequenceId, clientid4 clientid, int access) { System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_OPEN; op.opopen = new OPEN4args(); op.opopen.seqid = new seqid4(new uint32_t(sequenceId)); // if ((access & nfs4_prot.OPEN4_SHARE_ACCESS_WANT_DELEG_MASK) == 0){ // access |= nfs4_prot.OPEN4_SHARE_ACCESS_WANT_NO_DELEG; // } // op.opopen.share_access = new uint32_t(access); op.opopen.share_access = new uint32_t(NFSv4Protocol.OPEN4_SHARE_ACCESS_READ); op.opopen.share_deny = new uint32_t(NFSv4Protocol.OPEN4_SHARE_DENY_NONE); state_owner4 owner = new state_owner4(); owner.clientid = clientid; owner.owner = encoding.GetBytes("nfsclient"); op.opopen.owner = new open_owner4(owner); openflag4 flag = new openflag4(); flag.opentype = opentype4.OPEN4_NOCREATE; createhow4 how = new createhow4(); how.mode = createmode4.UNCHECKED4; flag.how = how; op.opopen.openhow = flag; open_claim4 claim = new open_claim4(); claim.claim = open_claim_type4.CLAIM_NULL; claim.file = new component4(new utf8str_cs(new utf8string(encoding.GetBytes(path)))); claim.delegate_type = NFSv4Protocol.OPEN4_SHARE_ACCESS_WANT_NO_DELEG; claim.file_delegate_prev = null; claim.oc_delegate_stateid = null; claim.delegate_type = 0; claim.delegate_cur_info = null; op.opopen.claim = claim; return op; }
private void exchange_ids() { List <nfs_argop4> ops = new List <nfs_argop4>(); String domain = "localhost"; String name = "NFS Client "; //String guid = System.Environment.MachineName + "@" + domain; String guid = System.Guid.NewGuid().ToString(); ops.Add(ExchengeIDStub.normal(domain, name, guid, NFSv4Protocol.EXCHGID4_FLAG_SUPP_MOVED_REFER + NFSv4Protocol.EXCHGID4_FLAG_USE_NON_PNFS, state_protect_how4.SP4_NONE)); COMPOUND4res compound4res = sendCompound(ops, ""); if (compound4res.status == nfsstat4.NFS4_OK) { /*if (compound4res.resarray[0].opexchange_id.eir_resok4.eir_server_impl_id.Length > 0) * { * string serverId = System.Text.Encoding.UTF8.GetString(compound4res.resarray[0].opexchange_id.eir_resok4.eir_server_impl_id[0].nii_name.value.value); * } * else * { * if (compound4res.resarray[0].opexchange_id.eir_resok4.eir_server_owner.so_major_id.Length > 0) * { * string serverId = System.Text.Encoding.UTF8.GetString(compound4res.resarray[0].opexchange_id.eir_resok4.eir_server_owner.so_major_id); * //throw new NFSConnectionException("Server name: ="+serverId); * } * }*/ _clientIdByServer = compound4res.resarray[0].opexchange_id.eir_resok4.eir_clientid; _sequenceID = compound4res.resarray[0].opexchange_id.eir_resok4.eir_sequenceid; } else { throw new NFSConnectionException(nfsstat4.getErrorString(compound4res.status)); } }
public static nfs_argop4 standard(clientid4 eir_clientid, sequenceid4 eir_sequenceid) { nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_CREATE_SESSION; op.opcreate_session = new CREATE_SESSION4args(); channel_attrs4 chan_attrs = new channel_attrs4(); chan_attrs.ca_headerpadsize = new count4(new uint32_t(0)); chan_attrs.ca_maxoperations = new count4(new uint32_t(8)); chan_attrs.ca_maxrequests = new count4(new uint32_t(128)); chan_attrs.ca_maxrequestsize = new count4(new uint32_t(1049620)); chan_attrs.ca_maxresponsesize = new count4(new uint32_t(1049480)); chan_attrs.ca_maxresponsesize_cached = new count4(new uint32_t(2868)); chan_attrs.ca_rdma_ird = new uint32_t[0]; op.opcreate_session.csa_clientid = eir_clientid; op.opcreate_session.csa_sequence = eir_sequenceid; //connection back channel op.opcreate_session.csa_flags = new uint32_t(0); //3 if u want to use the back channel op.opcreate_session.csa_fore_chan_attrs = chan_attrs; //diferent chan attrs for fore channel channel_attrs4 back_chan_attrs = new channel_attrs4(); back_chan_attrs.ca_headerpadsize = new count4(new uint32_t(0)); back_chan_attrs.ca_maxoperations = new count4(new uint32_t(2)); back_chan_attrs.ca_maxrequests = new count4(new uint32_t(1)); back_chan_attrs.ca_maxrequestsize = new count4(new uint32_t(4096)); back_chan_attrs.ca_maxresponsesize = new count4(new uint32_t(4096)); back_chan_attrs.ca_maxresponsesize_cached = new count4(new uint32_t(0)); back_chan_attrs.ca_rdma_ird = new uint32_t[0]; op.opcreate_session.csa_back_chan_attrs = back_chan_attrs; op.opcreate_session.csa_cb_program = new uint32_t(0x40000000); callback_sec_parms4[] cb = new callback_sec_parms4[1]; callback_sec_parms4 callb = new callback_sec_parms4(); //new auth_sys params callb.cb_secflavor = auth_flavor.AUTH_SYS; callb.cbsp_sys_cred = new authsys_parms(); Random r = new Random(); callb.cbsp_sys_cred.stamp = r.Next(); //just random number callb.cbsp_sys_cred.gid = 0; //maybe root ? callb.cbsp_sys_cred.uid = 0; //maybe root ? callb.cbsp_sys_cred.machinename = System.Environment.MachineName; callb.cbsp_sys_cred.gids = new int[0]; //callb.cb_secflavor = auth_flavor.AUTH_NONE; cb[0] = callb; // op.opcreate_session.csa_sec_parms = new callback_sec_parms4[1]; op.opcreate_session.csa_sec_parms = cb; return op; }
public static nfs_argop4 normalCREATE(String path, int sequenceId, clientid4 clientid, int access) { System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_OPEN; op.opopen = new OPEN4args(); op.opopen.seqid = new seqid4(new uint32_t(sequenceId)); state_owner4 owner = new state_owner4(); owner.clientid = clientid; owner.owner = encoding.GetBytes("nfsclient"); op.opopen.owner = new open_owner4(owner); //if ((access & NFSv4Protocol.OPEN4_SHARE_ACCESS_WANT_DELEG_MASK) == 0) // { // access |= NFSv4Protocol.OPEN4_SHARE_ACCESS_WANT_NO_DELEG; // } op.opopen.share_access = new uint32_t(access); op.opopen.share_deny = new uint32_t(NFSv4Protocol.OPEN4_SHARE_DENY_NONE); openflag4 flag = new openflag4(); flag.opentype = opentype4.OPEN4_CREATE; // createhow4(mode, attrs, verifier) createhow4 how = new createhow4(); how.mode = createmode4.GUARDED4; //how.mode = createmode4.EXCLUSIVE4_1; fattr4 attr = new fattr4(); attr.attrmask = openFattrBitmap(); attr.attr_vals = new attrlist4(); attr.attr_vals.value = openAttrs(7, 7, 7, 0); how.createattrs = attr; how.createverf = new verifier4(0); //it is long //how.mode = createmode4.GUARDED4; flag.how = how; op.opopen.openhow = flag; open_claim4 claim = new open_claim4(); claim.claim = open_claim_type4.CLAIM_NULL; claim.file = new component4(new utf8str_cs(new utf8string(encoding .GetBytes(path)))); claim.delegate_type = NFSv4Protocol.OPEN4_SHARE_ACCESS_WANT_NO_DELEG; claim.file_delegate_prev = null; claim.oc_delegate_stateid = null; claim.delegate_type = 0; claim.delegate_cur_info = null; op.opopen.claim = claim; return(op); }