@@ -1578,9 +1578,9 @@ int ax25_get_rr (packet_t this_p, int n)
1578
1578
*
1579
1579
* Purpose: Obtain Information part of current packet.
1580
1580
*
1581
- * Inputs: None .
1581
+ * Inputs: this_p - Packet object pointer .
1582
1582
*
1583
- * Outputs: paddr - Starting address is returned here.
1583
+ * Outputs: paddr - Starting address of information part is returned here.
1584
1584
*
1585
1585
* Assumption: ax25_from_text or ax25_from_frame was called first.
1586
1586
*
@@ -1621,6 +1621,56 @@ int ax25_get_info (packet_t this_p, unsigned char **paddr)
1621
1621
1622
1622
* paddr = info_ptr ;
1623
1623
return (info_len );
1624
+
1625
+ } /* end ax25_get_info */
1626
+
1627
+
1628
+ /*------------------------------------------------------------------------------
1629
+ *
1630
+ * Name: ax25_cut_at_crlf
1631
+ *
1632
+ * Purpose: Truncate the information part at the first CR or LF.
1633
+ * This is used for the RF>IS IGate function.
1634
+ * CR/LF is used as record separator so we must remove it
1635
+ * before packaging up packet to sending to server.
1636
+ *
1637
+ * Inputs: this_p - Packet object pointer.
1638
+ *
1639
+ * Outputs: Packet is modified in place.
1640
+ *
1641
+ * Returns: Number of characters removed from the end.
1642
+ * 0 if not changed.
1643
+ *
1644
+ * Assumption: ax25_from_text or ax25_from_frame was called first.
1645
+ *
1646
+ *------------------------------------------------------------------------------*/
1647
+
1648
+ int ax25_cut_at_crlf (packet_t this_p )
1649
+ {
1650
+ unsigned char * info_ptr ;
1651
+ int info_len ;
1652
+ int j ;
1653
+
1654
+
1655
+ assert (this_p -> magic1 == MAGIC );
1656
+ assert (this_p -> magic2 == MAGIC );
1657
+
1658
+ info_len = ax25_get_info (this_p , & info_ptr );
1659
+
1660
+ // Can't use strchr because there is potential of nul character.
1661
+
1662
+ for (j = 0 ; j < info_len ; j ++ ) {
1663
+
1664
+ if (info_ptr [j ] == '\r' || info_ptr [j ] == '\n' ) {
1665
+
1666
+ int chop = info_len - j ;
1667
+
1668
+ this_p -> frame_len -= chop ;
1669
+ return (chop );
1670
+ }
1671
+ }
1672
+
1673
+ return (0 );
1624
1674
}
1625
1675
1626
1676
0 commit comments