Do you have some tips for working with...
Articles and Tips: qna
01 May 2001
Q.
Do you have some tips for working with context handles in a multiple DS tree environment?
A.
When writing NDS-aware applications in C, you need to work with context handle(s). A context handle is a pointer to structure, which holds several important variables, like default DS tree name, default name context, flags, etc.
It is extremely important to set variables in this structure correctly while being in a multiple DS tree environment. Why?
If you create a new context handle by issuing NWDSCreateContextHandle() API, a new structure is internally created and initialized with default values. It means it is set to the default DS tree name, default name context, etc. In case your NDS-aware app requires switching among different DS trees, it is not sufficient to change the context's variable holding tree name only. You would have a valid tree name but at the same time an invalid name context and most probably also an invalid connection held in your context structure. This would cause any consecutive NWDS API to fail.
When switching among DS trees in your app, the context's name context must be changed accordingly, and the DCK_LAST_CONNECTION flag should be set to a valid connection number or reset to -1.
Rostislav Letos, Novell
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.