Exemple #1
0
        /// <summary>Searches for a named MIB symbol. This method may search outside
        /// the normal (or strict) scope, thereby allowing a form of
        /// relaxed search. Note that the results from the normal and
        /// expanded search may not be identical, due to the context
        /// chaining and the same symbol name appearing in various
        /// contexts.
        /// NOTE: This is an internal method that should
        /// only be called by the MIB loader.
        /// </summary>
        /// <param name="name">The symbol name</param>
        /// <param name="expanded">The expanded scope flag</param>
        /// <returns>The MIB symbol, or null if the symbol is not found</returns>
        public MibSymbol FindSymbol(string name, bool expanded)
        {
            if (this.context is ValueReference valref)
            {
                this.context = valref.Symbol;
            }

            if (this.context is MibTypeSymbol mibTpSymb)
            {
                this.context = mibTpSymb.Type;
            }

            if (this.context is MibValueSymbol mibValSymb)
            {
                this.context = mibValSymb.Type;
            }

            if (this.context is SnmpObjectType snmpObjTp)
            {
                this.context = snmpObjTp.Syntax;
            }

            if (this.context is TypeReference tpRef)
            {
                this.context = tpRef.Symbol;
                return(this.FindSymbol(name, expanded));
            }

            IMibContext ctx = this.context as IMibContext;

            return(ctx?.FindSymbol(name, expanded));
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TypeReference"/> class.
 /// </summary>
 /// <param name="location">The reference location</param>
 /// <param name="context">The reference context</param>
 /// <param name="name">The reference name</param>
 /// <param name="constraint">The additional type constraint</param>
 public TypeReference(
     FileLocation location,
     IMibContext context,
     string name,
     IConstraint constraint)
     : this(location, context, name)
 {
     this.constraint = constraint;
 }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TypeReference"/> class.
 /// </summary>
 /// <param name="location">The reference location</param>
 /// <param name="context">The reference context</param>
 /// <param name="name">The reference name</param>
 /// <param name="values">The additional defined symbols</param>
 public TypeReference(
     FileLocation location,
     IMibContext context,
     string name,
     IList <MibValueSymbol> values)
     : this(location, context, name)
 {
     this.values = values;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ValueReference"/> class.
 /// </summary>
 /// <param name="location">The reference file location</param>
 /// <param name="context">The reference context</param>
 /// <param name="name">The reference name</param>
 public ValueReference(
     FileLocation location,
     IMibContext context,
     string name)
     : base("ReferenceToValue(" + name + ")")
 {
     this.location = location;
     this.context  = context;
     this.name     = name;
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TypeReference"/> class.
 /// </summary>
 /// <param name="location">The reference location</param>
 /// <param name="context">The reference context</param>
 /// <param name="name">The reference name</param>
 public TypeReference(
     FileLocation location,
     IMibContext context,
     string name)
     : base("ReferenceToType(" + name + ")", false)
 {
     this.location = location;
     this.context  = context;
     this.Name     = name;
 }
Exemple #6
0
        /// <summary>
        /// Searches for a named MIB symbol. This method may search outside
        /// the normal (or strict) scope, thereby allowing a form of
        /// relaxed search. Note that the results from the normal and
        /// expanded search may not be identical, due to the context
        /// chaining and the same symbol name appearing in various
        /// contexts. This method checks the referenced type for a
        /// MibContext implementation.
        /// NOTE: This is an internal method that should
        /// only be called by the MIB loader.
        /// </summary>
        /// <param name="name">The symbol name</param>
        /// <param name="expanded">The expanded scope flag</param>
        /// <returns>The MIB symbol, or null if none was found</returns>
        public MibSymbol FindSymbol(string name, bool expanded)
        {
            IMibContext mc = this.type as IMibContext;

            if (mc == null)
            {
                return(null);
            }

            return(mc.FindSymbol(name, expanded));
        }
        /// <summary>Searches for a named MIB symbol. This method may search outside
        /// the normal (or strict) scope, thereby allowing a form of
        /// relaxed search. Note that the results from the normal and
        /// expanded search may not be identical, due to the context
        /// chaining and the same symbol name appearing in various
        /// contexts.
        /// NOTE: This is an internal method that should
        /// only be called by the MIB loader.
        /// </summary>
        /// <param name="name">The symbol name</param>
        /// <param name="expanded">The expanded scope flag</param>
        /// <returns>The MIB symbol, or null if the symbol is not found</returns>
        public MibSymbol FindSymbol(string name, bool expanded)
        {
            IMibContext ctx = null;

            if (this.context is ValueReference)
            {
                this.context = ((ValueReference)this.context).Symbol;
            }

            if (this.context is MibTypeSymbol)
            {
                this.context = ((MibTypeSymbol)this.context).Type;
            }

            if (this.context is MibValueSymbol)
            {
                this.context = ((MibValueSymbol)this.context).Type;
            }

            if (this.context is SnmpObjectType)
            {
                this.context = ((SnmpObjectType)this.context).Syntax;
            }

            if (this.context is TypeReference)
            {
                this.context = ((TypeReference)this.context).Symbol;
                return(this.FindSymbol(name, expanded));
            }

            if (this.context is IMibContext)
            {
                ctx = (IMibContext)this.context;
            }

            return((ctx == null) ? null : ctx.FindSymbol(name, expanded));
        }
 /// <summary>Initializes a new instance of the <see cref="CompoundContext"/> class.</summary>
 /// <param name="first">The primary MIB context</param>
 /// <param name="second">The secondary MIB context</param>
 public CompoundContext(IMibContext first, IMibContext second)
 {
     this.first  = first;
     this.second = second;
 }