---
name: "ping_iterator_get_context"
section: "3"
platform: "linux"
package: "liboping-dev"
version: "1.10.0-5+b5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ping_iterator_get_context"
---

# ping\_iterator\_get\_context(3)

Store host-dependent data

## NAME

ping\_iterator\_get\_context, ping\_iterator\_set\_context - Store host-dependent data

## SYNOPSIS

```
  #include <oping.h>
  void *ping_iterator_get_context (pingobj_iter_t *iter);
  void  ping_iterator_set_context (pingobj_iter_t *iter, void *context);
```

## DESCRIPTION

**ping\_iterator\_set\_context** can be used to store host-specific data within the liboping structures. This data can be received again by calling **ping\_iterator\_get\_context**. The data itself is never touched by liboping. If you call ping\_host\_remove (see [**ping\_host\_add**(3)](/ping_host_add/3.md)) or ping\_destroy (see [**ping\_construct**(3)](/ping_construct/3.md)) and the context is not NULL liboping will assume you know what you're doing and simply ignore the fact this might be a memory leak.

The *iter* argument is an iterator object as returned by [**ping\_iterator\_get**(3)](/ping_iterator_get/3.md) and ping\_iterator\_next.

The *context* argument of **ping\_iterator\_set\_context** is a pointer to anything and may be NULL.

## RETURN VALUE

**ping\_iterator\_get\_context** returns the same pointer previously passed to **ping\_iterator\_set\_context** or NULL if **ping\_iterator\_set\_context** has never been called before.

## SEE ALSO

[**ping\_iterator\_get**(3)](/ping_iterator_get/3.md), [**ping\_construct**(3)](/ping_construct/3.md), [**ping\_host\_add**(3)](/ping_host_add/3.md), [**liboping**(3)](/liboping/3.md)

## AUTHOR

liboping is written by Florian "octo" Forster \<ff at octo.it\>. Its homepage can be found at \<http://noping.cc/\>.

Copyright (c) 2006-2017 by Florian "octo" Forster.
