File: dnet_eof.c

package info (click to toggle)
dnprogs 2.52
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,644 kB
  • ctags: 4,021
  • sloc: ansic: 26,737; cpp: 10,666; makefile: 832; sh: 537; awk: 13
file content (32 lines) | stat: -rw-r--r-- 474 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <sys/types.h>
#include <sys/socket.h>
#include <netdnet/dnetdb.h>
#include <netdnet/dn.h>
#include <errno.h>
#include <stdio.h>



int dnet_eof(int s)
{
#ifdef DSO_LINKINFO
    struct linkinfo_dn li;
    socklen_t len=4;

    if (getsockopt(s, DNPROTO_NSP, DSO_LINKINFO, &li, &len) == -1)
	return -1;

    if (li.idn_linkstate==LL_DISCONNECTING)
    {
	errno = ENOTCONN;
	return -1;
    }
    else
	return 0;
    
#else
    errno = EINVAL;
    return -1;
#endif

}