當前位置: 首頁>>代碼示例>>C++>>正文


C++ AUTHDEBUG函數代碼示例

本文整理匯總了C++中AUTHDEBUG函數的典型用法代碼示例。如果您正苦於以下問題:C++ AUTHDEBUG函數的具體用法?C++ AUTHDEBUG怎麽用?C++ AUTHDEBUG使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AUTHDEBUG函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: auth_peer_success

/*
 * The peer has been successfully authenticated using `protocol'.
 */
void
auth_peer_success(int unit, u16_t protocol, char *name, int namelen)
{
  int pbit;

  AUTHDEBUG((LOG_INFO, "auth_peer_success: %d proto=%X\n", unit, protocol));
  switch (protocol) {
    case PPP_CHAP:
      pbit = CHAP_PEER;
      break;
    case PPP_PAP:
      pbit = PAP_PEER;
      break;
    default:
      AUTHDEBUG((LOG_WARNING, "auth_peer_success: unknown protocol %x\n", protocol));
      return;
  }

  /*
   * Save the authenticated name of the peer for later.
   */
  if (namelen > sizeof(peer_authname) - 1) {
    namelen = sizeof(peer_authname) - 1;
  }
  BCOPY(name, peer_authname, namelen);
  peer_authname[namelen] = 0;

  /*
   * If there is no more authentication still to be done,
   * proceed to the network (or callback) phase.
   */
  if ((auth_pending[unit] &= ~pbit) == 0) {
    network_phase(unit);
  }
}
開發者ID:ThucVD2704,項目名稱:femto-usb-blink-example,代碼行數:38,代碼來源:auth.c

示例2: auth_withpeer_success

/*
 * We have successfully authenticated ourselves with the peer using `protocol'.
 */
void
auth_withpeer_success(int unit, u16_t protocol)
{
  int pbit;

  AUTHDEBUG((LOG_INFO, "auth_withpeer_success: %d proto=%X\n", unit, protocol));
  switch (protocol) {
    case PPP_CHAP:
      pbit = CHAP_WITHPEER;
      break;
    case PPP_PAP:
      if (passwd_from_file) {
        BZERO(ppp_settings.passwd, MAXSECRETLEN);
      }
      pbit = PAP_WITHPEER;
      break;
    default:
      AUTHDEBUG((LOG_WARNING, "auth_peer_success: unknown protocol %x\n", protocol));
      pbit = 0;
  }

  /*
   * If there is no more authentication still being done,
   * proceed to the network (or callback) phase.
   */
  if ((auth_pending[unit] &= ~pbit) == 0) {
    network_phase(unit);
  }
}
開發者ID:ThucVD2704,項目名稱:femto-usb-blink-example,代碼行數:32,代碼來源:auth.c

示例3: np_up

/*
 * np_up - a network protocol has come up.
 */
void
np_up(int unit, u16_t proto)
{
  LWIP_UNUSED_ARG(unit);
  LWIP_UNUSED_ARG(proto);

  AUTHDEBUG((LOG_INFO, "np_up: %d proto=%X\n", unit, proto));
  if (num_np_up == 0) {
    AUTHDEBUG((LOG_INFO, "np_up: maxconnect=%d idle_time_limit=%d\n",ppp_settings.maxconnect,ppp_settings.idle_time_limit));
    /*
     * At this point we consider that the link has come up successfully.
     */
    if (ppp_settings.idle_time_limit > 0) {
      TIMEOUT(check_idle, NULL, ppp_settings.idle_time_limit);
    }

    /*
     * Set a timeout to close the connection once the maximum
     * connect time has expired.
     */
    if (ppp_settings.maxconnect > 0) {
      TIMEOUT(connect_time_expired, 0, ppp_settings.maxconnect);
    }
  }
  ++num_np_up;
}
開發者ID:ThucVD2704,項目名稱:femto-usb-blink-example,代碼行數:29,代碼來源:auth.c

示例4: get_secret

/*
 * get_secret - open the CHAP secret file and return the secret
 * for authenticating the given client on the given server.
 * (We could be either client or server).
 */
int
get_secret(int unit, char *client, char *server, char *secret, int *secret_len, int save_addrs)
{
#if 1
  int len;
  struct wordlist *addrs;

  LWIP_UNUSED_ARG(unit);
  LWIP_UNUSED_ARG(server);
  LWIP_UNUSED_ARG(save_addrs);

  addrs = NULL;

  if(!client || !client[0] || strcmp(client, ppp_settings.user)) {
    return 0;
  }

  len = (int)strlen(ppp_settings.passwd);
  if (len > MAXSECRETLEN) {
    AUTHDEBUG(LOG_ERR, ("Secret for %s on %s is too long\n", client, server));
    len = MAXSECRETLEN;
  }

  BCOPY(ppp_settings.passwd, secret, len);
  *secret_len = len;

  return 1;
#else
  int ret = 0, len;
  struct wordlist *addrs;
  char secbuf[MAXWORDLEN];
  
  addrs = NULL;
  secbuf[0] = 0;

  /* XXX Find secret. */
  if (ret < 0) {
    return 0;
  }

  if (save_addrs) {
    set_allowed_addrs(unit, addrs);
  }

  len = strlen(secbuf);
  if (len > MAXSECRETLEN) {
    AUTHDEBUG(LOG_ERR, ("Secret for %s on %s is too long\n", client, server));
    len = MAXSECRETLEN;
  }

  BCOPY(secbuf, secret, len);
  BZERO(secbuf, sizeof(secbuf));
  *secret_len = len;

  return 1;
#endif
}
開發者ID:10code,項目名稱:lwip,代碼行數:62,代碼來源:auth.c

示例5: link_terminated

/*
 * LCP has terminated the link; go to the Dead phase and take the
 * physical layer down.
 */
void
link_terminated(int unit)
{
  AUTHDEBUG((LOG_INFO, "link_terminated: %d\n", unit));
  if (lcp_phase[unit] == PHASE_DEAD) {
    return;
  }
  if (logged_in) {
    logout();
  }
  lcp_phase[unit] = PHASE_DEAD;
  AUTHDEBUG((LOG_NOTICE, "Connection terminated.\n"));
  pppLinkTerminated(unit);
}
開發者ID:ThucVD2704,項目名稱:femto-usb-blink-example,代碼行數:18,代碼來源:auth.c

示例6: np_down

/*
 * np_down - a network protocol has gone down.
 */
void np_down(int unit, u16_t proto)
{
    AUTHDEBUG((LOG_INFO, "np_down: %d proto=%X\n", unit, proto));
    if (--num_np_up == 0 && ppp_settings.idle_time_limit > 0) {
        UNTIMEOUT(check_idle, NULL);
    }
}
開發者ID:eslinux,項目名稱:network_model,代碼行數:10,代碼來源:auth.c

示例7: link_required

/*
 * An Open on LCP has requested a change from Dead to Establish phase.
 * Do what's necessary to bring the physical layer up.
 */
void
link_required(int unit)
{
  LWIP_UNUSED_ARG(unit);

  AUTHDEBUG((LOG_INFO, "link_required: %d\n", unit));
}
開發者ID:ThucVD2704,項目名稱:femto-usb-blink-example,代碼行數:11,代碼來源:auth.c

示例8: auth_withpeer_fail

/*
 * We have failed to authenticate ourselves to the peer using `protocol'.
 */
void
auth_withpeer_fail(int unit, u16_t protocol)
{
  int errCode = PPPERR_AUTHFAIL;

  LWIP_UNUSED_ARG(protocol);

  AUTHDEBUG((LOG_INFO, "auth_withpeer_fail: %d proto=%X\n", unit, protocol));
  if (passwd_from_file) {
    BZERO(ppp_settings.passwd, MAXSECRETLEN);
  }
  /*
   * XXX Warning: the unit number indicates the interface which is
   * not necessarily the PPP connection.  It works here as long
   * as we are only supporting PPP interfaces.
   */
  pppIOCtl(unit, PPPCTLS_ERRCODE, &errCode);

  /*
   * We've failed to authenticate ourselves to our peer.
   * He'll probably take the link down, and there's not much
   * we can do except wait for that.
   */
  lcp_close(unit, "Authentication failed");
}
開發者ID:FlameN,項目名稱:STM32RUNO,代碼行數:28,代碼來源:auth.c

示例9: link_down

/*
 * LCP has gone down; it will either die or try to re-establish.
 */
void
link_down(int unit)
{
  int i;
  struct protent *protp;

  AUTHDEBUG((LOG_INFO, "link_down: %d\n", unit));
  if (did_authup) {
    /* XXX Do link down processing. */
    did_authup = 0;
  }
  for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) {
    if (!protp->enabled_flag) {
      continue;
    }
    if (protp->protocol != PPP_LCP && protp->lowerdown != NULL) {
      (*protp->lowerdown)(unit);
    }
    if (protp->protocol < 0xC000 && protp->close != NULL) {
      (*protp->close)(unit, "LCP down");
    }
  }
  num_np_open = 0;
  num_np_up = 0;
  if (lcp_phase[unit] != PHASE_DEAD) {
    lcp_phase[unit] = PHASE_TERMINATE;
  }
  pppLinkDown(unit);
}
開發者ID:ThucVD2704,項目名稱:femto-usb-blink-example,代碼行數:32,代碼來源:auth.c

示例10: connect_time_expired

/*
 * connect_time_expired - log a message and close the connection.
 */
static void
connect_time_expired(void *arg)
{
  LWIP_UNUSED_ARG(arg);

  AUTHDEBUG((LOG_INFO, "Connect time expired\n"));
  lcp_close(0, "Connect time expired");   /* Close connection */
}
開發者ID:ThucVD2704,項目名稱:femto-usb-blink-example,代碼行數:11,代碼來源:auth.c

示例11: auth_peer_fail

/*
 * The peer has failed to authenticate himself using `protocol'.
 */
void auth_peer_fail(int unit, u16_t protocol)
{
    AUTHDEBUG((LOG_INFO, "auth_peer_fail: %d proto=%X\n", unit, protocol));
    /*
     * Authentication failure: take the link down
     */
    lcp_close(unit, "Authentication failed");
}
開發者ID:eslinux,項目名稱:network_model,代碼行數:11,代碼來源:auth.c

示例12: np_finished

/*
 * np_finished - a network protocol has finished using the link.
 */
void np_finished(int unit, u16_t proto)
{
    AUTHDEBUG((LOG_INFO, "np_finished: %d proto=%X\n", unit, proto));
    if (--num_np_open <= 0) {
        /* no further use for the link: shut up shop. */
        lcp_close(0, "No network protocols running");
    }
}
開發者ID:eslinux,項目名稱:network_model,代碼行數:11,代碼來源:auth.c

示例13: np_down

/*
 * np_down - a network protocol has gone down.
 */
void
np_down(int unit, u16_t proto)
{
  LWIP_UNUSED_ARG(unit);
  LWIP_UNUSED_ARG(proto);

  AUTHDEBUG(LOG_INFO, ("np_down: %d proto=%X\n", unit, proto));
  if (--num_np_up == 0 && ppp_settings.idle_time_limit > 0) {
    UNTIMEOUT(check_idle, NULL);
  }
}
開發者ID:10code,項目名稱:lwip,代碼行數:14,代碼來源:auth.c

示例14: link_terminated

/*
 * LCP has terminated the link; go to the Dead phase and take the
 * physical layer down.
 */
void link_terminated(int unit)
{
    AUTHDEBUG((LOG_INFO, "link_terminated: %d\n", unit));
    
    if (lcp_phase[unit] == PHASE_DEAD)
        return;
    if (logged_in)
        logout();
    lcp_phase[unit] = PHASE_DEAD;
    ppp_trace(LOG_NOTICE, "Connection terminated.\n");
	pppMainWakeup(unit);
}
開發者ID:eslinux,項目名稱:network_model,代碼行數:16,代碼來源:auth.c

示例15: check_idle

/*
 * check_idle - check whether the link has been idle for long
 * enough that we can shut it down.
 */
static void
check_idle(void *arg)
{
  struct ppp_idle idle;
  u_short itime;

  LWIP_UNUSED_ARG(arg);
  if (!get_idle_time(0, &idle)) {
    return;
  }
  itime = LWIP_MIN(idle.xmit_idle, idle.recv_idle);
  if (itime >= ppp_settings.idle_time_limit) {
    /* link is idle: shut it down. */
    AUTHDEBUG((LOG_INFO, "Terminating connection due to lack of activity.\n"));
    lcp_close(0, "Link inactive");
  } else {
    TIMEOUT(check_idle, NULL, ppp_settings.idle_time_limit - itime);
  }
}
開發者ID:ThucVD2704,項目名稱:femto-usb-blink-example,代碼行數:23,代碼來源:auth.c


注:本文中的AUTHDEBUG函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。