Changeset fb4d788 in mainline for uspace/srv/net/udp/udp_type.h


Ignore:
Timestamp:
2015-07-28T11:28:14Z (9 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6accc5cf
Parents:
df2bce3 (diff), 47726b5e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from the mainline

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/udp/udp_type.h

    rdf2bce3 rfb4d788  
    11/*
    2  * Copyright (c) 2012 Jiri Svoboda
     2 * Copyright (c) 2015 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3636#define UDP_TYPE_H
    3737
     38#include <async.h>
    3839#include <fibril.h>
    3940#include <fibril_synch.h>
     41#include <inet/endpoint.h>
    4042#include <ipc/loc.h>
    41 #include <socket_core.h>
    4243#include <sys/types.h>
    4344#include <inet/addr.h>
     
    4950        /* Insufficient resources */
    5051        UDP_ENORES,
    51         /* Foreign socket unspecified */
     52        /* Remote endpoint unspecified */
    5253        UDP_EUNSPEC,
    5354        /* No route to destination */
     
    6061        XF_DUMMY = 0x1
    6162} xflags_t;
    62 
    63 enum udp_port {
    64         UDP_PORT_ANY = 0
    65 };
    66 
    67 typedef struct {
    68         inet_addr_t addr;
    69         uint16_t port;
    70 } udp_sock_t;
    71 
    72 typedef struct {
    73         service_id_t iplink;
    74         udp_sock_t local;
    75         udp_sock_t foreign;
    76 } udp_sockpair_t;
    7763
    7864/** Unencoded UDP message (datagram) */
     
    9985
    10086typedef struct {
    101         async_sess_t *sess;
    102         socket_cores_t sockets;
    103 } udp_client_t;
     87        void (*recv_msg)(void *, inet_ep2_t *, udp_msg_t *);
     88} udp_assoc_cb_t;
    10489
    10590/** UDP association
     
    10792 * This is a rough equivalent of a TCP connection endpoint. It allows
    10893 * sending and receiving UDP datagrams and it is uniquely identified
    109  * by a socket pair.
     94 * by an endpoint pair.
    11095 */
    11196typedef struct {
     
    11398        link_t link;
    11499
    115         /** Association identification (local and foreign socket) */
    116         udp_sockpair_t ident;
     100        /** Association identification (endpoint pair) */
     101        inet_ep2_t ident;
    117102
    118103        /** True if association was reset by user */
     
    131116        /** Receive queue CV. Broadcast when new datagram is inserted */
    132117        fibril_condvar_t rcv_queue_cv;
     118
     119        udp_assoc_cb_t *cb;
     120        void *cb_arg;
    133121} udp_assoc_t;
    134122
     
    136124} udp_assoc_status_t;
    137125
    138 typedef struct udp_sockdata {
    139         /** Lock */
    140         fibril_mutex_t lock;
    141         /** Socket core */
    142         socket_core_t *sock_core;
     126typedef struct {
     127        /** Link to receive queue */
     128        link_t link;
     129        /** Endpoint pair */
     130        inet_ep2_t epp;
     131        /** Message */
     132        udp_msg_t *msg;
     133} udp_rcv_queue_entry_t;
     134
     135typedef struct udp_cassoc {
     136        /** Association */
     137        udp_assoc_t *assoc;
     138        /** Association ID for the client */
     139        sysarg_t id;
    143140        /** Client */
    144         udp_client_t *client;
    145         /** Connection */
    146         udp_assoc_t *assoc;
    147         /** User-configured IP link */
    148         service_id_t iplink;
    149         /** Receiving fibril */
    150         fid_t recv_fibril;
    151         uint8_t recv_buffer[UDP_FRAGMENT_SIZE];
    152         size_t recv_buffer_used;
    153         udp_sock_t recv_fsock;
    154         fibril_mutex_t recv_buffer_lock;
    155         fibril_condvar_t recv_buffer_cv;
    156         udp_error_t recv_error;
    157 } udp_sockdata_t;
     141        struct udp_client *client;
     142        link_t lclient;
     143} udp_cassoc_t;
    158144
    159145typedef struct {
    160146        /** Link to receive queue */
    161147        link_t link;
    162         /** Socket pair */
    163         udp_sockpair_t sp;
     148        /** Endpoint pair */
     149        inet_ep2_t epp;
    164150        /** Message */
    165151        udp_msg_t *msg;
    166 } udp_rcv_queue_entry_t;
     152        /** Client association */
     153        udp_cassoc_t *cassoc;
     154} udp_crcv_queue_entry_t;
     155
     156typedef struct udp_client {
     157        /** Client callback session */
     158        async_sess_t *sess;
     159        /** Client assocations */
     160        list_t cassoc; /* of udp_cassoc_t */
     161        /** Client receive queue */
     162        list_t crcv_queue;
     163} udp_client_t;
    167164
    168165#endif
Note: See TracChangeset for help on using the changeset viewer.