Hi,
There is no existing implementation. You would need to refer to 3rdparty sample code and do implementation. May refer to ffmpeg or live555.
Or may try to integrate with gstreamer to run like:
appsrc ! h265parse ! rtph265pay ! udpsink
And implement code in appsrc to generate h265 stream.
Here are C samples of using appsrc for reference:
appsrc link to nvvidconv error with reason not-negotiated(-4) - #6 by DaneLLL
What is maximum video encoding resolution in pixels? - #11 by DaneLLL