[Swan-dev] prefix for C identifiers: "v2_" is better than "IKEv2_" or "ikev2_"

Paul Wouters paul at nohats.ca
Sun Aug 19 18:35:48 UTC 2018


On Sun, 19 Aug 2018, D. Hugh Redelmeier wrote:

> I've introduced a new function, with a prefixed name.  I chose to break
> new ground by naming it "v2_build_id_payload".  I think that this is
> better than "ikev2_build_id_payload".

It's not new ground :) It's been done before

> - adding IKE is redundant.  We know that we're dealing with IKE.  There is
>  no IPv2, for example.

Agreed.

> - names should be easily distinguished.  Making the similar parts longer
>  makes this cognitively harder

The important thing for me is that the name will tell me if this is
v1only, v2only or shared. While the file the function is located in
gives some idea, that's not always the case (and some functions are
in need of moving as they are misleadingly in the wrong file)

> - the standard for punch cards is no longer subject to revision so we're
>  stuck with 80 columns.  Let's not waste them

I tried to stick to 80 but for some cases it just doesn't work for us,
and I go over a bit.

> At some mythical time, when nothing is in flight, I'd love to rename all
> our identifiers to conform with this new convention.

I think we should talk to a few vendors on killing IKEv1, and as an
industry group try and give a cut of date for IKEv1 support. I'm not
sure how reasonable this is though.

But in the future, it would be nice if we only had no prefix or v1
prefix, and no prefix meant v2 or shared. And where location in the
file becomes more meaningful again.

> It would perhaps be good to rename v1-only functions to have such a "v1"
> prefix.  But perhaps we'll ditch v1 support instead.

I don't care as much for functions within ikev2_*.[ch] but for anything
in lib/ or programs/ that doesn't have that prefix, and it contains a
v1only function, it should be renamed.

Paul


More information about the Swan-dev mailing list