Linux X.25 subsystem development
 help / color / mirror / Atom feed
From: Bahri Okuroglu <bahrio@yahoo.com>
To: Matti Aarnio <matti.aarnio@zmailer.org>,
	ven swe <venkat_p257@yahoo.co.in>
Cc: linux-x25@vger.kernel.org
Subject: Re: X.25 in linux
Date: Mon, 17 Dec 2007 05:51:01 -0800 (PST)	[thread overview]
Message-ID: <344966.27604.qm@web54106.mail.re2.yahoo.com> (raw)

I was playing with a modified version of X25ASY module with COM1 and  COM2 looped back on the same PC. Here is my modified version of slattach  to support x25asy but with DCE and DTE modes:  http://dreamsware.info/slattach-1.2.0a-modified-for-custom-x25asy.rar 



Basically, I've copied slip module for X25 as x25asy.c:





#include <sys/types.h>

#include <sys/ioctl.h>

#include <sys/socket.h>

#include <linux/if.h>

#include <stdlib.h>

#include <stdio.h>

#include <ctype.h>

#include <errno.h>

#include <fcntl.h>

#include <string.h>

#include <termios.h>

#include <unistd.h>

#include <linux/if_arp.h>

#include "lapb.h"

#include "support.h"

#include "pathnames.h"

#include "intl.h"

#define  EXTERN





/* Set the line discipline of a terminal line. */

static int

X25_set_disc(int fd, int disc)

{

  if (ioctl(fd, TIOCSETD, &disc) < 0) {

    fprintf(stderr, _("X25_set_disc(%d): %s\n"), disc,  strerror(errno));

    return(-errno);

  }

  return(0);

}





/* Set the encapsulation type of a terminal line. */

static int

X25_set_dte(int fd, char *lapb_mode)

{

   struct lapb_parms_struct parms;

   

   if (ioctl(fd, SIOCGIFMAP, &parms) < 0) {

      fprintf(stderr, _("Can't get LAPB parms: %s\n"),  strerror(errno));

      return(-errno);

   }

   fprintf(stderr, "lapb mode: 0x%02X\n", parms.mode);   

   if (!strcmp(lapb_mode, "dce")) {

      parms.mode = (parms.mode | LAPB_DCE);

      fprintf(stderr, "  will set to DCE");

   } else {

      parms.mode = (parms.mode & ~LAPB_DCE);

      fprintf(stderr, "  will set to DTE");

   }

   fprintf(stderr, "lapb mode: 0x%02X\n", parms.mode);   

   if (ioctl(fd, SIOCSIFMAP, &parms) < 0) {

      fprintf(stderr, _("Can't set LAPB parms: %s\n"),  strerror(errno));

      return(-errno);

   }



   return(0);

}





/* Start the VJ-SLIP encapsulation on the file descriptor. */

static int

do_x25_dte(int fd)

{

  if (X25_set_disc(fd, N_X25) < 0) return(-1);

  if (X25_set_dte(fd, "dte") < 0) return(-1);

  return(0);

}



/* Start the VJ-SLIP encapsulation on the file descriptor. */

static int

do_x25_dce(int fd)

{

  if (X25_set_disc(fd, N_X25) < 0) return(-1);

  if (X25_set_dte(fd, "dce") < 0) return(-1);

  return(0);

}







struct hwtype x25asydte_hwtype = {

  "x25asydte",    NULL, /*"VJ Serial Line IP",*/        ARPHRD_X25,     0,

  NULL,        NULL,        NULL,        do_x25_dte

};



struct hwtype x25asydce_hwtype = {

  "x25asydce",    NULL, /*"VJ Serial Line IP",*/        ARPHRD_X25,     0,

  NULL,        NULL,        NULL,        do_x25_dce

};









and updated hw.c for hwtypes[] array:



static struct hwtype *hwtypes[] = {

  &loop_hwtype,

#if HAVE_HWSLIP

  &slip_hwtype,

  &cslip_hwtype,

  &slip6_hwtype,

  &cslip6_hwtype,

  &adaptive_hwtype,

#endif

  &unspec_hwtype,

#if HAVE_HWETHER

  &ether_hwtype,

#endif

#if HAVE_HWAX25

  &ax25_hwtype,

#endif

#if HAVE_HWPPP

  &ppp_hwtype,

#endif  

#if HAVE_HWARC

  &arcnet_hwtype,

#endif  

  &x25asydce_hwtype,

  &x25asydte_hwtype,

  NULL

};





Hope this helps,







----- Original Message ----

From: Matti Aarnio <matti.aarnio@zmailer.org>

To: ven swe <venkat_p257@yahoo.co.in>

Cc: linux-x25@vger.kernel.org

Sent: Monday, December 17, 2007 2:57:42 PM

Subject: Re: X.25 in linux



 On Mon, Dec 17, 2007 at 12:25:14PM +0000, ven swe wrote:

> 

> Thanks for your reply Matti.

> 

> I already configured my kernel (version 2.6.22.8) with  "X25_ASY" .

> And I am getting the error message.

> 

> I think this is because slattach is not supporting X25.

> 

> -venkat



It should be trivialish to add that support, if same thing

is enough what SLIP and PPP do  -- turn on the serial discipline

and let driver do everything.



Current slattach man-page tells that known disciplines are:



    slip, cslip, adaptive, ppp





SLIP is really trivial thing in terms of what the slattach

command does.  External scripts and programs then do ifconfig

and other magic for the network interfaces.



You could, probably, do the required moves with e.g. few lines

of perl script.  (Or C)



/Matti Aarnio

-

To unsubscribe from this list: send the line "unsubscribe linux-x25" in

the body of a message to majordomo@vger.kernel.org

More majordomo info at  http://vger.kernel.org/majordomo-info.html











      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

             reply	other threads:[~2007-12-17 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-17 13:51 Bahri Okuroglu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-12-17  5:11 X.25 in linux venkat4p
2007-12-17 12:00 ` Matti Aarnio
     [not found]   ` <750297.65484.qm@web8406.mail.in.yahoo.com>
2007-12-17 12:57     ` Matti Aarnio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=344966.27604.qm@web54106.mail.re2.yahoo.com \
    --to=bahrio@yahoo.com \
    --cc=linux-x25@vger.kernel.org \
    --cc=matti.aarnio@zmailer.org \
    --cc=venkat_p257@yahoo.co.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox