# Listing service's terminators

**URL:** <https://openziti.discourse.group/t/listing-services-terminators/4578>\
**Category:** sdk-c\
**Created:** [May 19, 2025, 9:31pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578 "2025-05-19T21:31:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ikozhurin](https://avatars.discourse-cdn.com/v4/letter/i/f04885/32.png) [@ikozhurin](https://openziti.discourse.group/u/ikozhurin)\
**Post date:** [May 19, 2025, 9:31pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/1 "2025-05-19T21:31:01Z")

</div>

Hi, I'm developing proof-of-concept for our application running over openziti network. Application has a number of servers where each server provides the same type of service and clients are getting a list of available servers, with distinctive names, chooses one of them and connects to it. As I understand this is the case for "terminators" so I created a local openziti network in docker, with one controller and one edge router, configured two service and client identities and run C SDK's example programs\sample-host\sample-host.c with supplying ".identity" in both ziti\_listen\_with\_options() and ziti\_dial\_with\_options() (which as I understand is the way to configure terminator's identity in the code and connect to it.  
Now, I need to list all available terminators for the service, but I cannot find C SDK API for it. GO SDK has GetServiceTerminators() and I see it is calling to some HTTP endpoint? But I don't see anything related in C SDK. So, the question is, - how do I list all available terminators, for the service, using C SDK?

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [May 20, 2025, 4:27pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/2 "2025-05-20T16:27:26Z")

</div>

Hi @ikozhurin, welcome to the community and to OpenZiti! So very sorry but your post was flagged as spam. It's clearly not spam so I unflagged it. Discourse's spam-filter is a little tough on first-time posters sometimes!

It's an interesting question. If I understand correctly, it sounds like you want to show a list of clients that are available so that your user can pick the proper client. That does sound like something a terminator could be used for, yes. I don't know if there's a helper function in the CSDK for this yet.

@ekoby (or anyone else that might know), is this sort of functionality available?

---

<div class="post-metadata">

**Author:** ![ekoby](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/ekoby/32/14_2.png) [@ekoby](https://openziti.discourse.group/u/ekoby)\
**Post date:** [May 20, 2025, 5:31pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/3 "2025-05-20T17:31:04Z")

</div>

Currently, there is no function for it. I added an [issue](https://github.com/openziti/ziti-sdk-c/issues/868)

---

<div class="post-metadata">

**Author:** ![ikozhurin](https://avatars.discourse-cdn.com/v4/letter/i/f04885/32.png) [@ikozhurin](https://openziti.discourse.group/u/ikozhurin)\
**Post date:** [May 20, 2025, 5:42pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/4 "2025-05-20T17:42:21Z")

</div>

Can I implement one on my own? If there is another code in C SDK that calls to the similar controller's API I can follow it, if you point it out.

---

<div class="post-metadata">

**Author:** ![ekoby](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/ekoby/32/14_2.png) [@ekoby](https://openziti.discourse.group/u/ekoby)\
**Post date:** [May 20, 2025, 5:53pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/5 "2025-05-20T17:53:32Z")

</div>

I am going to knock it off shortly.

Doing it outside of SDK code is more cumbersome because there several internal helper functions that make it easier to implement. But if you're curious, here is the outline of changes:

- define terminator model based on [github.com/openziti/edge-api/client.yml](http://github.com/openziti/edge-api/client.yml) (see `ziti_model.h`)
- implement internal API `ziti_ctrl` function to make the REST request to `/service/{id}/terminators` (see `ziti_ctrl.c`)
- expose it from the public API layer.

---

<div class="post-metadata">

**Author:** ![ikozhurin](https://avatars.discourse-cdn.com/v4/letter/i/f04885/32.png) [@ikozhurin](https://openziti.discourse.group/u/ikozhurin)\
**Post date:** [May 20, 2025, 6:27pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/6 "2025-05-20T18:27:00Z")

</div>

@ekoby thank you! I will watch the issue tracker

---

<div class="post-metadata">

**Author:** ![ekoby](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/ekoby/32/14_2.png) [@ekoby](https://openziti.discourse.group/u/ekoby)\
**Post date:** [May 20, 2025, 8:30pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/7 "2025-05-20T20:30:09Z")

</div>

the issue is now fixed and API is available on main

---

<div class="post-metadata">

**Author:** ![ikozhurin](https://avatars.discourse-cdn.com/v4/letter/i/f04885/32.png) [@ikozhurin](https://openziti.discourse.group/u/ikozhurin)\
**Post date:** [May 21, 2025, 3:13pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/8 "2025-05-21T15:13:00Z")

</div>

@ekoby This was very fast, thanks! Got a question about controller connection/context, - I'm using initialization from ziti-sdk-c\programs\sample-host\sample-host.c like following:

```auto
    DIE(ziti_load_config(&cfg, argv[2]));
    DIE(ziti_context_init(&ztx, &cfg));
    DIE(ziti_context_set_options(ztx, &(ziti_options){
        .event_cb = on_ziti_init,
        .events = ZitiContextEvent| ZitiServiceEvent,
    }));
    DIE(ziti_context_run(ztx, loop));

```

But, as I understand the test code, listing terminators requires controller connection:

```auto
    REQUIRE(ziti_load_config(&config, conf) == ZITI_OK);
    REQUIRE(load_tls(&config, &tls, &creds) == ZITI_OK);
    REQUIRE(ziti_ctrl_init(loop, &ctrl, &config.controllers, tls) == ZITI_OK);

```

Is it a separate connection, which is not made on ziti\_context\_init() and should be managed as an additional connection?

Also, if ziti\_controller is needed, it is not exposed externally?

---

<div class="post-metadata">

**Author:** ![ekoby](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/ekoby/32/14_2.png) [@ekoby](https://openziti.discourse.group/u/ekoby)\
**Post date:** [May 21, 2025, 5:12pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/9 "2025-05-21T17:12:21Z")

</div>

the test is exercising internal code (ziti\_controller is internal).

externally, you'd call `ziti_list_terminators` declared [here](https://github.com/openziti/ziti-sdk-c/blob/main/includes/ziti/ziti.h#L666)

---

<div class="post-metadata">

**Author:** ![ikozhurin](https://avatars.discourse-cdn.com/v4/letter/i/f04885/32.png) [@ikozhurin](https://openziti.discourse.group/u/ikozhurin)\
**Post date:** [May 21, 2025, 7:11pm UTC](https://openziti.discourse.group/t/listing-services-terminators/4578/10 "2025-05-21T19:11:46Z")

</div>

@ekoby it all works, thanks!
