• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/db-4.7.25.NC/examples_c/ex_rep/base/

Lines Matching refs:machtab

55  * of the group.  The machtab also contains the parameters that are needed
75 /* Data structure that describes each entry in the machtab. */
102 machtab_t *machtab;
104 if ((machtab = malloc(sizeof(machtab_t))) == NULL) {
109 LIST_INIT(&machtab->machlist);
112 machtab->nextid = 2;
113 machtab->timeout_time = 2 * 1000000; /* 2 seconds. */
114 machtab->current = machtab->max = 0;
115 machtab->nsites = nsites;
117 ret = mutex_init(&machtab->mtmutex, NULL);
118 *machtabp = machtab;
129 machtab_add(machtab, fd, hostaddr, port, idp)
130 machtab_t *machtab;
148 if ((ret = mutex_lock(&machtab->mtmutex)) != 0) {
153 for (m = LIST_FIRST(&machtab->machlist);
159 member->eid = machtab->nextid++;
160 LIST_INSERT_HEAD(&machtab->machlist, member, links);
164 if ((ret = mutex_unlock(&machtab->mtmutex)) != 0) {
173 if (++machtab->current > machtab->max)
174 machtab->max = machtab->current;
181 machtab_print(machtab);
191 machtab_getinfo(machtab, eid, hostp, portp)
192 machtab_t *machtab;
200 if ((ret = mutex_lock(&machtab->mtmutex)) != 0) {
205 for (member = LIST_FIRST(&machtab->machlist);
214 if ((ret = mutex_unlock(&machtab->mtmutex)) != 0) {
225 * whether we need to lock the machtab or not (0 indicates we do not
229 machtab_rem(machtab, eid, lock)
230 machtab_t *machtab;
238 if (lock && (ret = mutex_lock(&machtab->mtmutex)) != 0) {
243 for (found = 0, member = LIST_FIRST(&machtab->machlist);
251 machtab->current--;
255 if (LIST_FIRST(&machtab->machlist) == NULL)
256 machtab->nextid = 2;
258 if (lock && (ret = mutex_unlock(&machtab->mtmutex)) != 0)
263 machtab_print(machtab);
269 machtab_parm(machtab, nump, timeoutp)
270 machtab_t *machtab;
274 if (machtab->nsites == 0)
275 *nump = machtab->max;
277 *nump = machtab->nsites;
278 *timeoutp = machtab->timeout_time;
283 machtab_print(machtab)
284 machtab_t *machtab;
288 if (mutex_lock(&machtab->mtmutex) != 0) {
293 for (m = LIST_FIRST(&machtab->machlist);
300 if (mutex_unlock(&machtab->mtmutex) != 0) {
364 listen_socket_accept(machtab, progname, s, eidp)
365 machtab_t *machtab;
397 ret = machtab_add(machtab, ns, host, port, eidp);
414 * Add this connection to the machtab. If we already have a connection
419 get_connected_socket(machtab, progname, remotehost, port, is_open, eidp)
420 machtab_t *machtab;
446 ret = machtab_add(machtab, s, addr, port, eidp);
461 (void)machtab_rem(machtab, *eidp, 1);
468 * its machtab.
597 machtab_t *machtab;
601 machtab =
610 n = quote_send_broadcast(machtab, rec, control, flags);
616 if ((ret = mutex_lock(&machtab->mtmutex)) != 0) {
622 for (m = LIST_FIRST(&machtab->machlist); m != NULL;
639 if ((t_ret = mutex_unlock(&machtab->mtmutex)) != 0) {
655 quote_send_broadcast(machtab, rec, control, flags)
656 machtab_t *machtab;
663 if ((ret = mutex_lock(&machtab->mtmutex)) != 0) {
669 for (m = LIST_FIRST(&machtab->machlist); m != NULL; m = next) {
673 (void)machtab_rem(machtab, m->eid, 0);
678 if (mutex_unlock(&machtab->mtmutex) != 0) {
692 * Note that the machtab mutex should be held through this call.