Linux HAM/Amateur Radio development
 help / color / mirror / Atom feed
From: csmall@eye-net.com.au (Craig Small)
To: TIMOTHY POWELL <kd4iky@peoplepc.com>
Cc: linux-hams@vger.kernel.org
Subject: Re: AX25 socket question.
Date: Mon, 15 Jul 2002 10:03:08 +1000	[thread overview]
Message-ID: <20020715000308.GA16191@eye-net.com.au> (raw)
In-Reply-To: <20020714120112.23833.h011.c002.wm@mail.peoplepc.com.criticalpath.net>

On Sun, Jul 14, 2002 at 12:01:11PM -0700, TIMOTHY POWELL wrote:
> Got a question about the below code copied from the
> listen.c file that came with ax25-apps-0.0.4
> 
> if ((s = socket(AF_PACKET, SOCK_PACKET, htons(proto)))

listen is doing a low-level (Packet socket) connection.  This is because
it wants to receive all traffic.  Quite often you don't want something
as low-level as that.

> I'm new to sockets so I'm a little confuse.  From what
> i read from the man pages about sockets if i want to
> create a socket for ax.25 I would do something similar
> to the following:
> 
> axsock = socket(PF_AX25, SOCK_STREAM, <?>) ;

This would make a socket with the protocol family of AX25 and a type of
STREAM.  AX.25 connections are usually SOCK_SEQPACKET  I don't think
STREAMs are defined in AX25 land.

> I am assuming that AF_PACKET and SOCK_PACKET, used in
> the first piece of code, are just variables used by the
> programmer to create any type socket he wanted, since I
> couldn't find metion of them in the man pages or any
Not really, it comes to what protocol level the packets come in at.
PACKET is pretty low level, I think SOCK_RAW is lower still though I
cannot see the difference between them.

> way i wrote the function except for <?> if all i want
> to do is create a socket for AX25?  <?> is where the
Create a socket for AX25 to do WHAT?  The what is the essential piece of
information you are missing and it what we need to help you.

>  I tried to find the function 
> htons(proto) in the code but couldn't so I'm not sure
htons? Host to Network (byte order) for Short ints?
Makes sure the bits are the right way around, intel gets them back to
front.

> which protocol to use with AX25.  I looked in the file
> /ect/protocols but didn't see anything for AX25, but
/etc/protocols are the protocols that ride on top of IP
As you're playing around "below" IP so it won't help you.

As someone said before, have a look at the existing code.  It may not be
perfect but it works and gives you a good start.  I can tell you more
specific things to look at once we know what you're trying to do.

 - Craig
-- 
Craig Small VK2XLZ  GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
Eye-Net Consulting http://www.eye-net.com.au/        <csmall@eye-net.com.au>
MIEEE <csmall@ieee.org>                 Debian developer <csmall@debian.org>

  reply	other threads:[~2002-07-15  0:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-14 19:01 AX25 socket question TIMOTHY POWELL
2002-07-15  0:03 ` Craig Small [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-07-15 12:24 TIMOTHY POWELL
2002-07-15 22:38 ` Tomi Manninen OH2BNS
2002-07-17  5:46 ` Craig Small
2002-07-16 12:19 TIMOTHY POWELL
2002-07-16 18:17 ` Riley Williams
2002-07-16 20:23   ` jeff
2002-07-16 21:38     ` Riley Williams
2002-07-17  1:07     ` Bob Nielsen
2002-07-17  0:55   ` Bob Nielsen

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=20020715000308.GA16191@eye-net.com.au \
    --to=csmall@eye-net.com.au \
    --cc=kd4iky@peoplepc.com \
    --cc=linux-hams@vger.kernel.org \
    /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