---
name: "snmpsession"
section: "3"
platform: "linux"
package: "libsnmpkit-dev"
version: "0.9-16"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/snmpsession"
---

# snmpsession(3)

snmpkit functions dealing with a particular snmpsession.

## NAME

snmpsession - snmpkit functions dealing with a particular snmpsession.

## SYNOPSIS

```
#include <snmpkit.h>
SNMPSESSION *sk_new_session(char *host, void *(start_routine)(SNMPSESSION*), const char *community);

```

## DESCRIPTION

A snmpsession is an opaque data structure which specifies a

The **new\_snmpsession()** creates a new session. The SNMPSOCK should have previously created by the application using, **new\_snmpsock().** The host should will be looked up using **gethostbyname()** and the community string is something like a password in SNMP lingo but it doesn't have a username associated with it and it is transmitted in clear text within the packets. In most cases, there are  a couple of community strings. One is only allowed to read and the other is allowed to both read and write. The default read-only community name is "public". If set the community name to NULL, the community name will default to public.

The **new\_snmpsession\_quick()** function is very similar to the  **new\_snmpsession()** function except the community name always defaults to "public".

The **delete\_snmpsock()** function is the opposite of the  **new\_snmpsession()** function. It frees all memory and resources currently being used by the SNMPSESSION structure.

## RETURN VALUE

The **new\_snmpsock()** and the **new\_snmpsock\_quick()** both return a pointer to the newly created snmpsock or  **NULL** if there was an error.

## AUTHOR

Ben Woodard \<ben@users.sourceforge.net\>

## BUGS

The library can possibly throw different kinds of C++ exceptions that won't be caught by the glue code and therefore it can cause your program to crash inexplicably.

## SEE ALSO

[**libsnmpkit**(3)](/libsnmpkit/3.md), **snmpsock**(3), [**snmpstructfiller**(3)](/snmpstructfiller/3.md), **snmptable**(3), [**gethostbyname**(3)](/gethostbyname/3.md)
