Search documentation of snmpkit

# SnmpKit.SnmpLib.MIB.SnmpTokenizer (snmpkit v1.2.0)

True 1:1 Elixir port of Erlang SNMP tokenizer (snmpc_tok.erl).

This is a direct translation of the official Erlang SNMP tokenizer from OTP lib/snmp/src/compile/snmpc_tok.erl

Original copyright: Ericsson AB 1996-2025 (Apache License 2.0)

# Summary

## Types

state()
token()

## Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

format_error(error)

Format error message. Equivalent to snmpc_tok:format_error/1

get_all_tokens(pid)

Get all remaining tokens. Equivalent to snmpc_tok:get_all_tokens/1

get_token(pid)

Get next token from tokenizer. Equivalent to snmpc_tok:get_token/1

null_get_line()

Null get_line function. Equivalent to snmpc_tok:null_get_line/0

start_link(chars, get_line_pid)

Start tokenizer gen_server. Equivalent to snmpc_tok:start_link/2

stop(pid)

Stop tokenizer. Equivalent to snmpc_tok:stop/1

test()

Test function. Equivalent to snmpc_tok:test/0

tokenize(chars, get_line_fun)

Tokenize a string directly. Equivalent to snmpc_tok:tokenize/2

# Types

# state()

    @type state() :: %SnmpKit.SnmpLib.MIB.SnmpTokenizer{
      chars: charlist(),
      get_line_fun: function() | nil,
      line: pos_integer()
    }

# token()

    @type token() :: {atom(), any(), pos_integer()}

# Functions

# child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# format_error(error)

    @spec format_error(term()) :: charlist()

Format error message. Equivalent to snmpc_tok:format_error/1

# get_all_tokens(pid)

    @spec get_all_tokens(pid()) :: {:ok, [token()]} | {:error, term()}

Get all remaining tokens. Equivalent to snmpc_tok:get_all_tokens/1

# get_token(pid)

    @spec get_token(pid()) :: {:ok, token()} | {:error, term()}

Get next token from tokenizer. Equivalent to snmpc_tok:get_token/1

# null_get_line()

    @spec null_get_line() :: :eof

Null get_line function. Equivalent to snmpc_tok:null_get_line/0

# start_link(chars, get_line_pid)

    @spec start_link(
      charlist(),
      pid()
    ) :: {:ok, pid()} | {:error, term()}

Start tokenizer gen_server. Equivalent to snmpc_tok:start_link/2

# stop(pid)

    @spec stop(pid()) :: :ok

Stop tokenizer. Equivalent to snmpc_tok:stop/1

# test()

Test function. Equivalent to snmpc_tok:test/0

# tokenize(chars, get_line_fun)

    @spec tokenize(
      charlist(),
      function()
    ) :: {:ok, [token()]} | {:error, term()}

Tokenize a string directly. Equivalent to snmpc_tok:tokenize/2