#pragma prefix "omg.org"

module CosNaming
{
        typedef string Istring;
        struct NameComponent {
                Istring id;
                Istring kind;
        };

        typedef sequence <NameComponent> Name;

        enum BindingType {nobject, ncontext};

        struct Binding {
                Name    binding_name;
                BindingType              binding_type;                                  
        };

        typedef sequence <Binding> BindingList;                                         


        interface BindingIterator;

        interface NamingContext {

                enum NotFoundReason { missing_node, not_context, not_object};
        
                exception NotFound { 
                                NotFoundReason why;
                                Name rest_of_name;
                };

                exception CannotProceed {
                                NamingContext cxt;
                                Name rest_of_name;
                };
                                                                                                        
                exception InvalidName{};                                                                        
                exception AlreadyBound {};
                exception NotEmpty{};

                void bind(in Name n, in Object obj)             
                         raises(NotFound, CannotProceed, InvalidName, AlreadyBound);
                void rebind(in Name n, in Object obj)   
                         raises(NotFound, CannotProceed, InvalidName);
                void bind_context(in Name n, in NamingContext nc)               
                         raises(NotFound, CannotProceed, InvalidName, AlreadyBound);
                void rebind_context(in Name n, in NamingContext nc)     
                         raises(NotFound, CannotProceed, InvalidName);
                Object resolve (in Name n)
                         raises(NotFound, CannotProceed, InvalidName);
                void unbind(in Name n)
                         raises(NotFound, CannotProceed, InvalidName);
                NamingContext new_context();
                NamingContext bind_new_context(in Name n)
                         raises(NotFound, AlreadyBound, CannotProceed, InvalidName);
                void destroy( )
                         raises(NotEmpty);
                void list (in unsigned long how_many, 
                                        out BindingList bl, out BindingIterator bi);
        };

        interface BindingIterator {
                boolean next_one(out Binding b);
                boolean next_n(in unsigned long how_many, 
                                        out BindingList bl);
                void destroy();
        };
};

// Names Library interface in PIDL,   CORBAservices p 3- 14, Naming Service V1.0 3/94 
/*
interface LNameComponent {                                                              // PIDL
        exception NotSet{};
        string get_id() 
                raises(NotSet);
        void set_id(in string i);
        string get_kind() 
                raises(NotSet);
        void set_kind(in string k);
        void destroy();
};

interface LName {                                                                                               // PIDL
        exception NoComponent{};
        exception OverFlow{};
        exception InvalidName{};                                
        LName insert_component(in unsigned long i, 
                                        in LNameComponent n) 
                        raises(NoComponent, OverFlow);
        LNameComponent get_component(in unsigned long i)
                 raises(NoComponent);                           
        LNameComponent delete_component(in unsigned long i)
                 raises(NoComponent);                           
        unsigned long num_components();
        boolean equal(in LName ln);
        boolean less_than(in LName ln);
        Name to_idl_form()
                        raises(InvalidName);                             
        void from_idl_form(in Name n);
        void destroy();
};

LName create_lname();                                                                                           // C    /C++
LNameComponent create_lname_component();                 // C/C++

*/
