1.\" $OpenBSD: rtlabel_id2name.9,v 1.4 2014/10/15 11:58:13 mpi Exp $ 2.\" 3.\" Copyright (c) 2011 Bret S. Lambert <blambert@openbsd.org> 4.\" All rights reserved. 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.Dd $Mdocdate: October 15 2014 $ 19.Dt RTLABEL_ID2NAME 9 20.Os 21.Sh NAME 22.Nm rtlabel_id2name , 23.Nm rtlabel_id2sa , 24.Nm rtlabel_name2id , 25.Nm rtlabel_unref 26.Nd manipulate route labels 27.Sh SYNOPSIS 28.In sys/types.h 29.In sys/socket.h 30.In net/route.h 31.Ft const char * 32.Fn rtlabel_id2name "u_int16_t id" 33.Ft struct sockaddr * 34.Fn rtlabel_id2sa "u_int16_t labelid" "struct sockaddr_rtlabel *sa_rl" 35.Ft u_int16_t 36.Fn rtlabel_name2id "char *name" 37.Ft void 38.Fn rtlabel_unref "u_int16_t id" 39.Sh DESCRIPTION 40Route labels are arbitrary data appended to route entries and can be acted 41upon by 42.Xr pf 4 . 43.Bl -tag -width Ds 44.It Fn rtlabel_name2id "char *name" 45Return numerical ID of the route label named 46.Fa name , 47creating the label if it does not already exist. 48.It Fn rtlabel_id2name "u_int16_t id" 49Return the string name of the route label with ID 50.Fa id . 51.It Fn rtlabel_id2sa "u_int16_t labelid" "struct sockaddr_rtlabel *sa_rl" 52Populate 53.Fa sa_rl 54with the data from the route label specified by 55.Fa labelid . 56.It Fn rtlabel_unref "u_int16_t id" 57Remove a reference to the route label with ID 58.Fa id , 59freeing the label if the reference count drops to 0. 60.El 61.Sh CONTEXT 62.Fn rtlabel_id2name , 63.Fn rtlabel_id2sa , 64.Fn rtlabel_name2id , 65and 66.Fn rtlabel_unref 67can be called during autoconf, from process context, or from interrupt context. 68.Sh RETURN VALUES 69.Fn rtlabel_name2id 70returns 71.Fa 0 72if it was unable to create a route label. 73.Sh SEE ALSO 74.Xr route 4 , 75.Xr route 9 76