Changeset 89ba88c in mainline for uspace/srv/net/udp/assoc.c


Ignore:
Timestamp:
2019-10-14T11:16:24Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1cd4b0
Parents:
25525133
git-author:
Jiri Svoboda <jiri@…> (2019-10-13 18:08:59)
git-committer:
Jiri Svoboda <jiri@…> (2019-10-14 11:16:24)
Message:

Test udp_assoc_send()

This required virtualizing inet_get_src_addr() / udp_transmit_msg for the
association module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/udp/assoc.c

    r25525133 r89ba88c  
    4040#include <fibril_synch.h>
    4141#include <inet/endpoint.h>
    42 #include <inet/inet.h>
    4342#include <io/log.h>
    4443#include <nettl/amap.h>
     
    4847#include "msg.h"
    4948#include "pdu.h"
    50 #include "udp_inet.h"
    5149#include "udp_type.h"
    5250
     
    5755static udp_assoc_t *udp_assoc_find_ref(inet_ep2_t *);
    5856static errno_t udp_assoc_queue_msg(udp_assoc_t *, inet_ep2_t *, udp_msg_t *);
     57static udp_assocs_dep_t *assocs_dep;
    5958
    6059/** Initialize associations. */
    61 errno_t udp_assocs_init(void)
     60errno_t udp_assocs_init(udp_assocs_dep_t *dep)
    6261{
    6362        errno_t rc;
     
    6968        }
    7069
     70        assocs_dep = dep;
    7171        return EOK;
    7272}
     
    253253errno_t udp_assoc_send(udp_assoc_t *assoc, inet_ep_t *remote, udp_msg_t *msg)
    254254{
    255         udp_pdu_t *pdu;
    256255        inet_ep2_t epp;
    257256        errno_t rc;
     
    275274        if (inet_addr_is_any(&epp.local.addr) && !assoc->nolocal) {
    276275                log_msg(LOG_DEFAULT, LVL_DEBUG, "Determine local address.");
    277                 rc = inet_get_srcaddr(&epp.remote.addr, 0, &epp.local.addr);
     276                rc = (*assocs_dep->get_srcaddr)(&epp.remote.addr, 0,
     277                    &epp.local.addr);
    278278                if (rc != EOK) {
    279279                        log_msg(LOG_DEFAULT, LVL_DEBUG, "Cannot determine "
     
    289289                return EINVAL;
    290290
    291         log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - encode pdu");
    292 
    293         rc = udp_pdu_encode(&epp, msg, &pdu);
    294         if (rc != EOK)
    295                 return ENOMEM;
    296 
    297291        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - transmit");
    298 
    299         rc = udp_transmit_pdu(pdu);
    300         udp_pdu_delete(pdu);
     292        rc = (*assocs_dep->transmit_msg)(&epp, msg);
    301293
    302294        if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.