Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3697486
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:51:57+00:00 2026-05-19T04:51:57+00:00

I research the source of PPTP program, and I want to make clear that

  • 0

I research the source of PPTP program, and I want to make clear that how does PPTP assign a call ID and peer call ID to the session. i find the code as follows, who can explain the code for me ? Actually i am not clear with the logic. thanks!

/*
 * ctrlpacket.c
 *
 * PPTP Control Message packet reading, formatting and writing.
 *
 * $Id: ctrlpacket.c,v 1.6 2005/08/03 09:10:59 quozl Exp $
 */

#define C_BITS (sizeof(unsigned int) * 8)
#define C_SEG(x) (x/C_BITS)
#define C_BIT(x) ((1U)<<(x%C_BITS))
static unsigned int activeCalls[(MAX_CALLS / C_BITS) + 1];
#define MAX_CALLS_PER_TCP_LINK      128
#define MAX_CALLS           60

/*
 * get_call_id
 *
 * Assigns a call ID and peer call ID to the session.
 *
 * args: call_id (OUT) - the call ID for the session
 * retn: 0 on success, -1 on failure
 */
int get_call_id(u_int16_t * loc)
{
 for (i = 0; i < MAX_CALLS; i++) {
  if (!(activeCalls[C_SEG(i)] & C_BIT(i))) {
   activeCalls[C_SEG(i)] |= C_BIT(i);
   *loc = i;
   return 0;
  }
 }
 return -1;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:51:57+00:00Added an answer on May 19, 2026 at 4:51 am

    activeCalls is a bit map with MAX_CALLS entries. It is composed of an array of unsigned int, each of which holds C_BITS bits.

    C_SEG() finds the right unsigned int entry in the array for a given call number, and C_BIT() identifies the right bit.

    The code scans through the bit map, and finds the first un-set bit. It then sets that bit, and returns the index.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing some research on Unicode for a white-paper I am writing. Does
I'm doing some research on the feasibility of an iPhone application, and can't find
I've done some research and I can't really find a preferred way to do
I was reading a research paper about Haskell and how HList is implemented and
I've done some research on using tags from social bookmarking sites for web search
I'm doing some research into databases and I'm looking at some limitations of relational
I've done some research into server push with javascript and have found the general
I'm doing some research into using log4net, and I found the IObjectRenderer interface interesting.
I'm doing some research for my end of degree project: a multiplattform application developed
Scientific or market research questionnaires mainly consist of questions in the following form: INTRO:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.