|
Next: 10.2 SIP Up: 10.1 H.323 Previous: 10.1.5 Retrieving the commURI
|
We will now show how to retrieve information for the commURI selected by the user. The following H.323 fields defined in H.350.1 can be present in the commObject.:
h323Identity
h323IdentityGKDomain
h323Identityh323-ID
h323IdentitydialedDigits
h323Identityemail-ID
h323IdentityURL-ID
h323IdentitytransportID
h323IdentitypartyNumber
h323IdentitymobileUIM
h323IdentityEndpointType
h323IdentityServiceLevel
The following fields are used for H.235 Annex D authentication and are also present in the commObject, and defined in H.350.2:
h235IdentityEndpointID
h235IdentityPassword
The following example shows a possible commObject entry in the LDAP database:
dn: commUniqueId=55, ou=h323identity, dc=vide,dc=net
owner: uid=tsmith,ou=people,dc=vide,dc=net
commUniqueId: 55
h235IdentityEndpointID: Tsmith
h235IdentityPassword:: dGVzdGluZzQ1Ng==
h323IdentitydialedDigits: 971006
objectClass: top
objectClass: commObject
objectClass: h323Identity
objectClass: h235Identity
objectClass: VIDEowner
commOwner: ldap://dakar.oit.unc.edu/dc=vide,dc=net??sub?(uid=tsmith)
h323IdentityServiceLevel: gold
h323Identityh323-ID: Tom.Smith
h323IdentityGKDomain: 172.74.106.27
h323IdentityEndpointType: Terminal
Note that the "owner" field points back to the user entry. This defines the permission levels of this entry, so for example, only the owner (or the administrator) can have access to the value of h235IdentityPassword.
The following sample code shows how to retrieve the attributes from the commObject entry:
int url_ldap_search (LDAPURLDesc *ludp)
{
int msgid, nentries, rc;
LDAP *ld;
char *HOST;
char *token;
char *search = " ";
int PORT;
LDAPMessage *result;
/* Need to strip the Label out of the ludp->lud_filter if one exists. */
/* Step one break the filter apart */
token = strtok (ludp->lud_filter, search);
printf ( "\t<actual filter:%s>\n\n", token);
/* Now Let's call the ldap_search function with the specific information */
/* we got from the previous search */
if ( (msgid = ldap_search( ld, ludp->lud_dn, ludp->lud_scope,
ludp->lud_filter, NULL, 0 )) == -1)
{
ldap_perror( ld, "ldap_search" );
return (-3);
}
/* Let's now list the information we got from the above search */
nentries = 0;
while ( (rc = ldap_result( ld, msgid, 0, NULL, &result )) ==
LDAP_RES_SEARCH_ENTRY )
{
nentries++;
print_entries_with_values( ld, result );
ldap_msgfree( result );
}
if ( rc == -1 )
{
ldap_perror( ld, "ldap_result" );
return (-4);
}
printf( "Found %d entries at %s\n\n",nentries, ludp->lud_dn);
ldap_unbind( ld );
return( 0 );
}
static char h235Passwd[64] = ""
static char h235User[64] = "";
static char h323Id[64] = "";
static char h323Digits[64] = "";
static char h323GKDomain[128] = "";
void print_entries_with_values (LDAP *ld, LDAPMessage *result)
{
LDAPMessage *e;
BerElement *ber;
char *dn, *attr;
char **vals;
int i;
for ( e = ldap_first_entry( ld, result); e != NULL;
e = ldap_next_entry(ld, e) )
{
if ( (dn = ldap_get_dn( ld, e)) != NULL)
{
printf( "dn: %s\n", dn);
ldap_memfree( dn );
}
for ( attr = ldap_first_attribute( ld, e, &ber );
attr != NULL; attr = ldap_next_attribute( ld, e, ber) )
{
if ( (vals = ldap_get_values( ld, e, attr)) != NULL)
{
for (i = 0; vals[i] != NULL; i++)
{
printf( "%s: %s\n", attr, vals[i] );
}
/* Check the attribute and save the found value */
if( !strcmp(attr,"h235IdentityEndpointID") )
strcpy(h235User,vals[0]);
if(!strcmp(attr,"h235IdentityPassword") )
strcpy(h235Passwd,vals[0]);
if(!strcmp(attr,"h235IdentityPassword") )
strcpy(h235Passwd,vals[0]);
if(!strcmp(attr,"h323IdentitydialedDigits") )
strcpy(h323Digits,vals[0]);
if(!strcmp(attr,"h323Identityh323-ID") )
strcpy(h323Id,vals[0]);
if(!strcmp(attr,"h323IdentityGKDomain") )
strcpy(h323GKDomain,vals[0]);
ldap_value_free( vals);
}
ldap_memfree ( attr );
}
printf( "\n" );
if ( ber != NULL )
{
ber_free ( ber, 0 );
}
}
}
Once all the H.235 values are retrieved, they can be used to securely register with the Gatekeeper defined by h323IdentityGKDomain.