~ubuntu-branches/debian/sid/trinity/sid

« back to all changes in this revision

Viewing changes to net/appletalk.c

  • Committer: Package Import Robot
  • Author(s): gustavo panizzo
  • Date: 2014-01-17 21:10:15 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140117211015-k2qbnpu0osa5mlil
Tags: 1.3-1
* New upstream version 1.3.
* Removed wrong dependency on linux-headers. (Closes: #733771).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <stdlib.h>
2
 
#include <sys/types.h>
3
 
#include <sys/socket.h>
4
 
#include <sys/un.h>
5
 
#include <netinet/in.h>
6
 
#include <linux/atalk.h>
7
 
#include "random.h"
8
 
#include "net.h"
9
 
 
10
 
void atalk_gen_sockaddr(unsigned long *addr, unsigned long *addrlen)
11
 
{
12
 
        struct sockaddr_at *atalk;
13
 
 
14
 
        atalk = malloc(sizeof(struct sockaddr_at));
15
 
        if (atalk == NULL)
16
 
                return;
17
 
 
18
 
        atalk->sat_family = PF_APPLETALK;
19
 
        atalk->sat_port = rand();
20
 
        atalk->sat_addr.s_net = rand();
21
 
        atalk->sat_addr.s_node = rand();
22
 
        *addr = (unsigned long) atalk;
23
 
        *addrlen = sizeof(struct sockaddr_at);
24
 
}
25
 
 
26
 
void atalk_rand_socket(struct socket_triplet *st)
27
 
{
28
 
        if (rand_bool()) {
29
 
                st->type = SOCK_DGRAM;
30
 
                st->protocol = 0;
31
 
                return;
32
 
        }
33
 
 
34
 
        st->protocol = rand() % PROTO_MAX;
35
 
        st->type = SOCK_RAW;
36
 
}