Lines Matching defs:mep
197 struct client *mep = (struct client *)args;
227 (void) mutex_lock(&mep->mtx);
228 mep->flags &= ~CLIENT_BUSY;
229 if (mep->flags & CLIENT_FIRSTTIME) {
230 mep->flags &= ~CLIENT_FIRSTTIME;
236 (void) cond_wait(&mep->acv, &mep->mtx);
237 mep->flags |= CLIENT_BUSY;
238 mep->ltime = time(NULL);
240 (void) mutex_unlock(&mep->mtx);
262 mep->hlen = randhlen;
265 for (i = 3; i < mep->hlen; i++) {
266 mep->chaddr[i] = random() & 0xff;
271 (void) memcpy(crequest.chaddr, mep->chaddr, mep->hlen);
272 crequest.hlen = mep->hlen;
275 if (mep->proto) {
276 mep->state = DISCOVER;
279 optp->len = mep->hlen + 1;
281 (void) memcpy(&optp->value[1], mep->chaddr, mep->hlen);
283 (void) octet_to_hexascii(optp->value, mep->hlen + 1, cid,
285 unused_optp = (DHCP_OPT *) & optp->value[mep->hlen + 1];
287 mep->state = 0;
289 (void) octet_to_hexascii(mep->chaddr, mep->hlen, cid, &cidlen);
305 tnf_ulong, state, mep->state,
309 if (mep->state == ACK) {
310 mep->state = RELEASE;
334 if (mep->state == ACK) {
339 mep->state = nstate = 0;
348 mep->state = RELEASE;
365 if (mep->state == REQUEST && expired < time(NULL)) {
372 mep->state = nstate = 0;
381 if (mep->state == RELEASE && !time_to_go) {
382 (void) mutex_lock(&mep->mtx);
385 mep->flags &= ~CLIENT_BUSY;
387 (void) cond_wait(&mep->acv, &mep->mtx);
388 mep->ltime = time(NULL);
390 mep->flags |= CLIENT_BUSY;
391 (void) mutex_unlock(&mep->mtx);
395 crequest.xid = htonl((myself << 2) + mep->xid++);
398 if ((randerr & 0xF) == mep->state || (randerr & 0xF) == 0xF) {
415 if (mep->state == RELEASE) {
446 mep->state = nstate = 0;
459 (void) mutex_lock(&mep->mtx);
463 while (mep->pktlistp == NULL)
464 if (cond_timedwait(&mep->cv, &mep->mtx, &ts) == ETIME) {
477 (void) mutex_unlock(&mep->mtx);
482 (void) mutex_lock(&mep->mtx);
489 wbp = mep->pktlistp;
509 mep->pktlistp = NULL;
510 (void) mutex_unlock(&mep->mtx);
520 if (mep->proto) {
566 if (mep->state == DISCOVER && nstate == OFFER) {
567 mep->state = REQUEST;
605 (void) octet_to_hexascii(mep->chaddr,
606 mep->hlen, host, &cidlen);
627 (mep->chaddr[i] & 0x7);
630 (mep->chaddr[i] & 0x7);
631 strcpy((char *)mep->chost,
633 } else if (randcl && mep->chost[0]) {
635 optp->len = strlen(mep->chost);
636 (void) memcpy(optp->value, mep->chost,
637 strlen(mep->chost));
638 optp->value[strlen(mep->chost)] = '\0';
646 } else if ((mep->state == REQUEST ||
647 mep->state == ACK) && nstate == ACK) {
654 mep->state = ACK;
693 fprintf(stderr, "(%d %s)", mep->id,
786 } else if (mep->state == ACK && nstate == NAK) {
798 mep->state = nstate = 0;
808 dhcpmsgtype(mep->state, p);
823 mep->state = nstate = 0;
843 myself, (mep->proto) ? "DHCP" : "BOOTP");
845 wbp = mep->pktlistp;