Lines Matching refs:rap
32 * $Id: rap.c,v 1.8 2001/02/24 15:56:05 bp Exp $
154 smb_rap_rqparam_z(struct smb_rap *rap, const char *value)
158 bcopy(value, rap->r_npbuf, len);
159 rap->r_npbuf += len;
160 rap->r_plen += len;
165 smb_rap_rqparam(struct smb_rap *rap, char ptype, char plen, long value)
167 char *p = rap->r_npbuf;
186 rap->r_npbuf += len;
187 rap->r_plen += len;
195 struct smb_rap *rap;
199 rap = malloc(sizeof(*rap));
200 if (rap == NULL)
202 bzero(rap, sizeof(*rap));
203 p = rap->r_sparam = rap->r_nparam = strdup(param);
204 rap->r_sdata = rap->r_ndata = strdup(data);
215 rap->r_pbuf = rap->r_npbuf = malloc(len);
216 smb_rap_rqparam(rap, 'W', 1, fn);
217 smb_rap_rqparam_z(rap, rap->r_sparam);
218 smb_rap_rqparam_z(rap, rap->r_sdata);
219 *rapp = rap;
224 smb_rap_done(struct smb_rap *rap)
226 if (rap->r_sparam)
227 free(rap->r_sparam);
228 if (rap->r_sdata)
229 free(rap->r_sdata);
230 free(rap);
234 smb_rap_setNparam(struct smb_rap *rap, long value)
236 char *p = rap->r_nparam;
245 rap->r_rcvbuflen = value;
250 error = smb_rap_rqparam(rap, ptype, plen, value);
255 rap->r_nparam = p;
260 smb_rap_setPparam(struct smb_rap *rap, void *value)
262 char *p = rap->r_nparam;
271 rap->r_rcvbuf = value;
276 rap->r_nparam = p;
281 smb_rap_getNparam(struct smb_rap *rap, long *value)
283 char *p = rap->r_nparam;
292 *value = le16toh(*(u_int16_t*)rap->r_npbuf);
297 rap->r_npbuf += plen;
298 rap->r_nparam = p;
303 smb_rap_request(struct smb_rap *rap, struct smb_ctx *ctx)
307 char *dp, *p = rap->r_nparam;
311 rdatacnt = rap->r_rcvbuflen;
312 rparamcnt = rap->r_plen;
314 rap->r_plen, rap->r_pbuf, /* int tparamcnt, void *tparam */
316 &rparamcnt, rap->r_pbuf, /* rparamcnt, void *rparam */
317 &rdatacnt, rap->r_rcvbuf /* int *rdatacnt, void *rdata */
321 rp = (u_int16_t*)rap->r_pbuf;
322 rap->r_result = le16toh(*rp++);
324 rap->r_npbuf = (char*)rp;
325 rap->r_entries = entries = 0;
331 rap->r_entries = entries = le16toh(*(u_int16_t*)rap->r_npbuf);
332 rap->r_npbuf += 2;
344 rap->r_nparam = p;
349 dp = rap->r_rcvbuf;
351 p = rap->r_sdata;
372 smb_rap_error(struct smb_rap *rap, int error)
376 if (rap->r_result == 0)
378 return rap->r_result | SMB_RAP_ERROR;
385 struct smb_rap *rap;
389 error = smb_rap_create(0, "WrLeh", "B13BWz", &rap);
392 smb_rap_setNparam(rap, sLevel); /* W - sLevel */
393 smb_rap_setPparam(rap, pbBuffer); /* r - pbBuffer */
394 smb_rap_setNparam(rap, cbBuffer); /* L - cbBuffer */
395 error = smb_rap_request(rap, ctx);
397 *pcEntriesRead = rap->r_entries;
398 error = smb_rap_getNparam(rap, &lval);
401 error = smb_rap_error(rap, error);
402 smb_rap_done(rap);