Hi Ole,

My requirement is following

i) Want to connect to vpp
ii) use that send API messages to VPP
iii) I used this example strongswan vac_create

vac_t *vac_create(char *name)
{
    private_vac_t *this;

    INIT(this,
            .public = {
                    .destroy = _destroy,
                    .send = _vac_send,
                    .send_dump = _vac_send_dump,
                    .register_event = _register_event,
            },
...

...
...

    if (vl_client_api_map("/vpe-api"))
    {
        DBG1(DBG_KNL, "vac unable to map");
        destroy(this);
        return NULL;
    }

    if (vl_client_connect(name, 0, 32) < 0)
    {
        DBG1(DBG_KNL, "vac unable to connect");
        vl_client_api_unmap();
        destroy(this);
        return NULL;
    }

....

}
iv) I have a similar requirement, as to use a PUNT socket to receive the
data from vpp into our application and do certain processing. In order to
use punt sockets, you need to register with VPP using VPP APIs. Could use
goVPP but don't know time so want something working for our initial POC. As
I am comfortable in C, I want C VPP APIs for the same.
v) So the idea is to have an API message Forwarding application. Inside
Fastpath POD, receive a socket forward API request to VPP. This API message
for POC is coming from some other pod.
V) Now if you suggest something to me, that would be great.


I am currently clueless.

Thanks,
Regards,
Venu

On Thu, 30 Sept 2021 at 21:14, <otr...@employees.org> wrote:

> Venu,
>
> Doesn't seem like you are using the higher level C VAPI API nor the
> low-level API in vpp-api/client.c.
> Are you sure this is what you want?
>
> O.
>
> > On 30 Sep 2021, at 16:09, Venumadhav Josyula <vjosy...@gmail.com> wrote:
> >
> > Hi Akash,
> >
> > Thansks, now after devtoolset,
> >
> > @Benoit Ganne (bganne) , @Ole Troan
> > i am getting following error
> >
> > [root@8f57181df3a1 vpp_c_api_examples]# gcc vpp_api_client_test3.c -o
> vpp_api_client_test3.o -lvlibmemoryclient -lsvm -lvppinfra -lvlib
> > /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld:
> /lib/../lib64/libvlib.so: undefined reference to `classify_get_trace_chain'
> > /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld:
> /lib/../lib64/libvlib.so: undefined reference to
> `stat_segment_register_gauge'
> > /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld:
> /lib/../lib64/libvlib.so: undefined reference to `os_exit'
> > collect2: error: ld returned 1 exit status
> > [root@8f57181df3a1 vpp_c_api_examples]#
> >
> > Let me paste the code again,
> > #include<stdio.h>
> > #include<stdlib.h>
> > #include <vlibapi/api.h>
> > #include <vlibmemory/api.h>
> > #include <vpp/api/vpe_msg_enum.h>
> >
> > #define vl_typedefs
> > #define vl_endianfun
> > #include <vpp/api/vpe_all_api_h.h>
> > #undef vl_typedefs
> > #undef vl_endianfun
> >
> > int main()
> > {
> >    char *name = "vpp-test-app";
> >
> >    clib_mem_init_thread_safe (0, 64ULL << 20);
> >
> >    if (vl_client_api_map("/vpe-api"))
> >    {
> >         printf("unable to map....\n");
> >         goto quit;
> >    }
> >    if (vl_client_connect("vpp-test-app", 0, 32) < 0)
> >    {
> >         printf("unable to connect \n");
> >         vl_client_api_unmap();
> >         goto quit;
> >    }
> >    printf("successfully connected... \n");
> >  quit:
> >         return 0;
> > }
> >
> > Is this wrong way, i am trying to use APIs ?
> >
> > Thanks,
> > Regards
> > Venu
> >
> > On Thu, 30 Sept 2021 at 19:00, Akash S R <akashsr.akas...@gmail.com>
> wrote:
> > Hey Venu,
> >
> > Try "scl enable devtoolset-9 bash" inside your docker or update your gcc
> version.
> >
> >
> > /Akash S R
> >
> > On Thu, Sep 30, 2021, 18:54 Venumadhav Josyula <vjosy...@gmail.com>
> wrote:
> > Hi Benoit,
> >
> > Thanks for quick reply.
> >
> > I have docker with following
> > [root@8f57181df3a1 vpp_c_api_examples]# rpm -qa | grep vpp
> > vpp-lib-21.06.0-4~g0d9d3a0.x86_64
> > vpp-api-lua-21.06.0-4~g0d9d3a0.x86_64
> > vpp-api-python3-21.06.0-4~g0d9d3a0.x86_64
> > vpp-debuginfo-21.06.0-4~g0d9d3a0.x86_64
> > vpp-selinux-policy-21.06.0-4~g0d9d3a0.x86_64
> > vpp-21.06.0-4~g0d9d3a0.x86_64
> > vpp-plugins-21.06.0-4~g0d9d3a0.x86_64
> > vpp-devel-21.06.0-4~g0d9d3a0.x86_64
> >
> > This will vpp running in it.
> >
> > [root@8f57181df3a1 /]# cat /etc/redhat-release
> > CentOS Linux release 7.3.1611 (Core)
> > [root@8f57181df3a1 /]#
> >
> > > Eg. use devtoolset-9 (gcc-9).
> >
> > How do I use it ?
> >
> > Thanks,
> > Regards,
> > Venu
> >
> > On Thu, 30 Sept 2021 at 18:47, Benoit Ganne (bganne) <bga...@cisco.com>
> wrote:
> > You should upgrade your compiler... GCC-4 is way too old.
> > Eg. use devtoolset-9 (gcc-9).
> >
> > Best
> > ben
> >
> > > -----Original Message-----
> > > From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of
> Venumadhav
> > > Josyula
> > > Sent: jeudi 30 septembre 2021 14:49
> > > To: otr...@employees.org
> > > Cc: RaviKiran Veldanda <ravi.jup...@gmail.com>; vpp-dev <vpp-
> > > d...@lists.fd.io>
> > > Subject: Re: [vpp-dev] VPP Socket API how to use from the application
> > > #socket-api #vpp #sock-api
> > >
> > > Hi Ole / Others,
> > >
> > >
> > >
> > > Thanks for your email, i getting following compilation error
> > > [root@8f57181df3a1 vpp_c_api_examples]# gcc vpp_api_client_test3.c -o
> > > vpp_api_client_test3.o -lvlibmemoryclient -lsvm -lvppinfra -lvlib
> > > In file included from /usr/include/vppinfra/error.h:41:0,
> > >                  from /usr/include/vlibapi/api.h:24,
> > >                  from vpp_api_client_test3.c:3:
> > > /usr/include/vppinfra/clib.h:43:18: error: missing binary operator
> before
> > > token "("
> > >  #if __has_include(<vppinfra/config.h>)
> > >                   ^
> > > In file included from /usr/include/vppinfra/mem.h:49:0,
> > >                  from /usr/include/vppinfra/vec.h:42,
> > >                  from /usr/include/vppinfra/error.h:53,
> > >                  from /usr/include/vlibapi/api.h:24,
> > >                  from vpp_api_client_test3.c:3:
> > > /usr/include/vppinfra/string.h:92:34: error: expected ';', ',' or ')'
> > > before 'dst'
> > >  clib_memcpy_fast (void *restrict dst, const void *restrict src,
> size_t n)
> > >                                   ^
> > > [root@8f57181df3a1 vpp_c_api_examples]# vim
> /usr/include/vppinfra/clib.h
> > > +43
> > > [root@8f57181df3a1 vpp_c_api_examples]# vim
> /usr/include/vppinfra/clib.h
> > > +43
> > > [root@8f57181df3a1 vpp_c_api_examples]# gcc --version
> > > gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
> > > Copyright (C) 2015 Free Software Foundation, Inc.
> > > This is free software; see the source for copying conditions.  There
> is NO
> > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> > > PURPOSE.
> > >
> > > [root@8f57181df3a1 vpp_c_api_examples]#
> > >
> > >
> > > -----------------
> > >
> > > c -code
> > > ----------------
> > >
> > >
> > > #include<stdio.h>
> > > #include<stdlib.h>
> > > #include <vlibapi/api.h>
> > > #include <vlibmemory/api.h>
> > > #include <vpp/api/vpe_msg_enum.h>
> > >
> > > #define vl_typedefs
> > > #define vl_endianfun
> > > #include <vpp/api/vpe_all_api_h.h>
> > > #undef vl_typedefs
> > > #undef vl_endianfun
> > >
> > > int main()
> > > {
> > >    char *name = "vpp-test-app";
> > >
> > >    clib_mem_init_thread_safe (0, 64ULL << 20);
> > >
> > >    if (vl_client_api_map("/vpe-api"))
> > >    {
> > >         printf("unable to map....\n");
> > >         goto quit;
> > >    }
> > >    if (vl_client_connect("vpp-test-app", 0, 32) < 0)
> > >    {
> > >         printf("unable to connect \n");
> > >         vl_client_api_unmap();
> > >         goto quit;
> > >    }
> > >    printf("successfully connected... \n");
> > >  quit:
> > >         return 0;
> > > }
> > >
> > >
> > > ------------
> > >
> > >
> > > Can you please suggest what can i be doing worng ?
> > >
> > >
> > > Thanks,
> > > Regards,
> > > Venu
> > >
> > >
> > > On Thu, 30 Sept 2021 at 13:21, <otr...@employees.org
> > > <mailto:otr...@employees.org> > wrote:
> > >
> > >
> > >       Hi Venu,
> > >
> > >       > Any examples for VAPI shared to use binary APIs ?
> > >
> > >       Try this for a start:
> > >       https://git.fd.io/vpp/tree/src/vpp-api/vapi/vapi_c_test.c
> > >
> > >       Cheers,
> > >       Ole
> > >
> > >
> >
> >
> >
> >
> >
> > 
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#20251): https://lists.fd.io/g/vpp-dev/message/20251
Mute This Topic: https://lists.fd.io/mt/85796959/21656
Mute #vpp:https://lists.fd.io/g/vpp-dev/mutehashtag/vpp
Mute #socket-api:https://lists.fd.io/g/vpp-dev/mutehashtag/socket-api
Mute #sock-api:https://lists.fd.io/g/vpp-dev/mutehashtag/sock-api
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to