home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
dynobj.exe
/
DSOBJSCN.C
next >
Wrap
Text File
|
1994-09-09
|
3KB
|
137 lines
/****************************************************************************
** Programmed by: Karl Bunnell
** Description : This program will display all of the dynamic server objects
** a directory service server is aware of.
**
**
** Date :08/09/94
*/
#define NWDOS
#include <stdio.h>
#include <stdlib.h>
#include <nwcalls.h>
#include <nwnet.h>
void main(void)
{
NWCONN_HANDLE connHandle;
char serverName[48];
char objectName[47+1];
BYTE propValue[128];
NWOBJ_ID objectID = -1;
NWCCODE cCode, cCode2;
BYTE netAddress[12];
int i;
cCode = NWCallsInit(NULL,NULL);
if(cCode)
{
printf("NWCallsInit returned: %04X\n",cCode);
exit(1);
}
/*------------------------------------------------------------------------
** Use NWGetNearestDirectoryService to retrieve a handle to a NDS server.
*/
cCode = NWGetNearestDirectoryService(
/* > Connection Handle */ &connHandle
);
switch (cCode)
{
case 0x8846:
printf("\nNo Directory Services Connection!\n");
exit(1);
default:
printf("\nNWGetNearestDirectoryService returned %04X\n", cCode);
}
/*------------------------------------------------------------------------
** Display Name of Nearest Directory Services File Server
*/
NWGetFileServerName(
/* Conn handle */ connHandle,
/* Server name */ serverName
);
printf("\nNearest Response: %s\n", serverName);
printf("\nServers...\n");
printf(" Server Names Network:Node:Socket\n");
printf(" ------------ -------------------\n");
/*------------------------------------------------------------------------
** Iteratively scan until all objects are found.
** Note: The rights required to scan dynamic objects is BS_ANY_READ.
** This means - access allowed to all clients, even if the client
** is not logged in to the server.
** This scan will work even if the Bindery Context is not set.
** Bindery context is NOT set if it is set to the ROOT of the
** DS tree.
*/
while(!cCode)
{
cCode = NWScanObject(
/* > Conn handle */ connHandle,
/* > search name */ "*",
/* > search type */ OT_FILE_SERVER,
/* <>object ID */ &objectID,
/* < object name */ objectName,
/* < object type */ NULL,
/* < object prop */ NULL,
/* < object flag */ NULL,
/* < object sec */ NULL
);
if (!cCode)
{
cCode2 = NWReadPropertyValue(
/* > Conn Handle */ connHandle,
/* > object name */ objectName,
/* > object type */ OT_FILE_SERVER,
/* > property Name*/ "NET_ADDRESS",
/* > data set indx*/ 1,
/* < Data Buffer */ propValue,
/* < More flag */ NULL,
/* < Property Flgs*/ NULL
);
if (cCode2)
{
printf("\nNWReadPropertyValue returned: %04X", cCode);
exit(1);
}
for (i=0; i<12; ++i) // Not necessary, but nice.
netAddress[i] = (BYTE)propValue[i];
}
printf("%-47s%02X%02X%02X%02X:%02X%02X%02X%02X%02X%02X:%02X%02X\n",
objectName,
netAddress[0],
netAddress[1],
netAddress[2],
netAddress[3],
netAddress[4],
netAddress[5],
netAddress[6],
netAddress[7],
netAddress[8],
netAddress[9],
netAddress[10],
netAddress[11]
);
}
}