Lines Matching defs:rap

33  * $Id: rap.c,v 1.5 2004/12/13 00:25:23 lindak Exp $
152 smb_rap_rqparam_z(struct smb_rap *rap, const char *value)
156 bcopy(value, rap->r_npbuf, len);
157 rap->r_npbuf += len;
158 rap->r_plen += len;
167 smb_rap_rqparam(struct smb_rap *rap, char ptype, char plen, int value)
179 sp = (uint16_t *)rap->r_npbuf;
185 lp = (uint32_t *)rap->r_npbuf;
190 p = rap->r_npbuf;
196 rap->r_npbuf += len;
197 rap->r_plen += len;
205 struct smb_rap *rap;
209 rap = malloc(sizeof (*rap));
210 if (rap == NULL)
212 bzero(rap, sizeof (*rap));
213 p = rap->r_sparam = rap->r_nparam = strdup(param);
214 rap->r_sdata = rap->r_ndata = strdup(data);
225 rap->r_pbuf = rap->r_npbuf = malloc(len);
226 if (rap->r_pbuf == NULL)
228 (void) smb_rap_rqparam(rap, 'W', 1, fn);
229 (void) smb_rap_rqparam_z(rap, rap->r_sparam);
230 (void) smb_rap_rqparam_z(rap, rap->r_sdata);
231 *rapp = rap;
236 smb_rap_done(struct smb_rap *rap)
238 if (rap->r_sparam)
239 free(rap->r_sparam);
240 if (rap->r_sdata)
241 free(rap->r_sdata);
242 if (rap->r_pbuf)
243 free(rap->r_pbuf);
245 if (rap->r_npbuf)
246 free(rap->r_npbuf);
247 if (rap->r_dbuf)
248 free(rap->r_dbuf);
249 if (rap->r_rcvbuf)
250 free(rap->r_rcvbuf);
252 free(rap);
256 smb_rap_setNparam(struct smb_rap *rap, int value)
258 char *p = rap->r_nparam;
267 rap->r_rcvbuflen = value;
272 error = smb_rap_rqparam(rap, ptype, plen, value);
277 rap->r_nparam = p;
282 smb_rap_setPparam(struct smb_rap *rap, void *value)
284 char *p = rap->r_nparam;
293 rap->r_rcvbuf = value;
298 rap->r_nparam = p;
303 smb_rap_getNparam(struct smb_rap *rap, long *value)
305 char *p = rap->r_nparam;
316 te = (uint16_t *)rap->r_npbuf;
322 rap->r_npbuf += plen;
323 rap->r_nparam = p;
328 smb_rap_request(struct smb_rap *rap, struct smb_ctx *ctx)
332 char *dp, *p = rap->r_nparam;
336 rdatacnt = rap->r_rcvbuflen;
337 rparamcnt = rap->r_plen;
340 rap->r_plen, rap->r_pbuf, /* int tparamcnt,void *tparam */
342 &rparamcnt, rap->r_pbuf, /* rparamcnt, void *rparam */
343 &rdatacnt, rap->r_rcvbuf, /* int *rdatacnt, void *rdata */
349 rp = (uint16_t *)rap->r_pbuf;
357 rap->r_result = letohs(*rp);
360 if (rap->r_result != 0) {
366 return (rap->r_result | SMB_RAP_ERROR);
374 rap->r_npbuf = (char *)rp;
375 rap->r_entries = entries = 0;
377 rap->r_rcvbuflen = rdatacnt;
387 tmp = (uint16_t *)rap->r_npbuf;
388 rap->r_entries = entries = letohs(*tmp);
389 rap->r_npbuf += 2;
405 rap->r_nparam = p;
410 dp = rap->r_rcvbuf;
412 p = rap->r_sdata;
438 smb_rap_error(struct smb_rap *rap, int error)
442 if (rap->r_result == 0)
444 return (rap->r_result | SMB_RAP_ERROR);