1 Aug 2011 09:51
[zebra 23338] Re: Need to include a new program in zebra project
Paul URVOAS <paul.urvoas <at> gmail.com>
2011-08-01 07:51:19 GMT
2011-08-01 07:51:19 GMT
The program I want to add to Zebra is in the directory /zebra/meas
I do not have any skills with automake/autoconf. Which line I have to add in /meas/Makefile.am ??
The source code is as follow :
##### meas_main.c
#include "zebra.h"
#include "stream.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define closesocket(s) close(s)
typedef int SOCKET;
typedef struct sockaddr_in SOCKADDR_IN;
typedef struct sockaddr SOCKADDR;
#define PORT 2616
enum DragonMeasMessage {
Message1 = 1,
Message2 = 2
};
int
main (int argc, char **argv)
{
int n=0;
SOCKET sock;
SOCKADDR_IN sin;
u_int8_t message = Message1;
u_int8_t msgLength;;
struct stream *s;
/* Création de la socket */
sock = socket(AF_INET, SOCK_STREAM, 0);
/* Configuration de la connexion */
sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
sin.sin_family = AF_INET;
sin.sin_port = htons(PORT);
/* Si le client arrive à se connecter */
if(connect(sock, (SOCKADDR*)&sin, sizeof(sin)) != SOCKET_ERROR)
printf("Connexion à %s sur le port %d\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port));
else
printf("Impossible de se connecter\n");
stream_putl(s, msgLength);
stream_putl(s, message);
//write (sock, STREAM_DATA(s), msgLength);
/* On ferme la socket précédemment ouverte */
closesocket(sock);
exit (0);
}
#####
2011/7/29 Yasuhiro Ohara <yasu <at> jaist.ac.jp>
The most simple way is to add 3 lines in Makefile.am,
and run automake/autoconf.
Could you show me the source code ?
regards,
yasu
From: Paul URVOAS <paul.urvoas <at> gmail.com>
Subject: [zebra 23336] Need to include a new program in zebra project
Date: Fri, 29 Jul 2011 11:37:23 +0200
Message-ID: <CALaN9wx+pUu-ix31yuKprQoUkm5BzkLTsLY9ZdE9by3xp5cBpQ <at> mail.gmail.com>
> Hi,
>
> I am begining a project using zebra in order to develop a GMPLS
> implementation.
>
> I would like to create a new process which would communicate with ospfd
> using sockets (functions stream_put) and therefore I want to include
> zebra.h. When I want to compile my program manually, I get the compiler
> message : *stream_putl undefined reference*.
>
> Should I have to include my program in zebra project using makefile etc.. If
> yes how can I get the makefiles I need ?
>
> Should I have to compile my program manually ? (this is a pretty simple
> program just using zebra.h)
>
> If you have some tips, please let me know ;)
>
>
> Paul,
> Intern France Télécom
_______________________________________________ Zebra mailing list Zebra <at> ml.zebra.org http://ml.zebra.org/mailman/listinfo/zebra
RSS Feed