xref: /386bsd/usr/share/man/cat3/getprotobynumber.0 (revision a2142627)
1GETPROTOENT(3)            386BSD Programmer's Manual            GETPROTOENT(3)
2
3NNAAMMEE
4     ggeettpprroottooeenntt, ggeettpprroottoobbyynnuummbbeerr, ggeettpprroottoobbyynnaammee, sseettpprroottooeenntt, eennddpprroottooeenntt -
5     get protocol entry
6
7SSYYNNOOPPSSIISS
8     ##iinncclluuddee <<nneettddbb..hh>>
9
10     _s_t_r_u_c_t _p_r_o_t_o_e_n_t *
11     ggeettpprroottooeenntt()
12
13     _s_t_r_u_c_t _p_r_o_t_o_e_n_t *
14     ggeettpprroottoobbyynnaammee(_c_h_a_r *_n_a_m_e)
15
16     _s_t_r_u_c_t _p_r_o_t_o_e_n_t *
17     ggeettpprroottoobbyynnuummbbeerr(_i_n_t _p_r_o_t_o)
18
19     sseettpprroottooeenntt(_i_n_t _s_t_a_y_o_p_e_n)
20
21     eennddpprroottooeenntt()
22
23DDEESSCCRRIIPPTTIIOONN
24     The ggeettpprroottooeenntt(), ggeettpprroottoobbyynnaammee(), and ggeettpprroottoobbyynnuummbbeerr() functions
25     each return a pointer to an object with the following structure
26     containing the broken-out fields of a line in the network protocol data
27     base, /_e_t_c/_p_r_o_t_o_c_o_l_s.
28
29
30           struct  protoent {
31                   char    *p_name;        /* official name of protocol */
32                   char    **p_aliases;    /* alias list */
33                   int     p_proto;        /* protocol number */
34           };
35
36     The members of this structure are:
37
38     _p__n_a_m_e     The official name of the protocol.
39
40     _p__a_l_i_a_s_e_s  A zero terminated list of alternate names for the protocol.
41
42     _p__p_r_o_t_o    The protocol number.
43
44     The ggeettpprroottooeenntt() function reads the next line of the file, opening the
45     file if necessary.
46
47     The sseettpprroottooeenntt() function opens and rewinds the file.  If the _s_t_a_y_o_p_e_n
48     flag is non-zero, the net data base will not be closed after each call to
49     ggeettpprroottoobbyynnaammee() or ggeettpprroottoobbyynnuummbbeerr().
50
51     The eennddpprroottooeenntt() function closes the file.
52
53     The ggeettpprroottoobbyynnaammee() function and ggeettpprroottoobbyynnuummbbeerr() sequentially search
54     from the beginning of the file until a matching protocol name or protocol
55     number is found, or until EOF is encountered.
56
57RREETTUURRNN VVAALLUUEESS
58     Null pointer (0) returned on EOF or error.
59
60FFIILLEESS
61     /etc/protocols
62
63SSEEEE AALLSSOO
64     protocols(5)
65
66HHIISSTTOORRYY
67     The ggeettpprroottooeenntt(), ggeettpprroottoobbyynnuummbbeerr(), ggeettpprroottoobbyynnaammee(), sseettpprroottooeenntt(),
68     and eennddpprroottooeenntt() functions appeared in 4.2BSD.
69
70BBUUGGSS
71     These functions use a static data space; if the data is needed for future
72     use, it should be copied before any subsequent calls overwrite it.  Only
73     the Internet protocols are currently understood.
74
754.2 Berkeley Distribution       April 19, 1991                               2
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133